/alps/pcitool

To get this branch, use:
bzr branch http://darksoft.org/webbzr/alps/pcitool

« back to all changes in this revision

Viewing changes to ipecamera/model.c

  • Committer: Suren A. Chilingaryan
  • Date: 2011-04-12 00:57:02 UTC
  • Revision ID: csa@dside.dyndns.org-20110412005702-ir1cch0f1feop7ay
Infrastructure for event API

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
 
#define _IPECAMERA_C
 
1
#define _IPECAMERA_MODEL_C
2
2
#include <sys/time.h>
3
3
#include <assert.h>
4
4
 
5
 
#include "tools.h"
6
 
#include "ipecamera.h"
7
 
#include "error.h"
 
5
#include "../tools.h"
 
6
#include "../error.h"
 
7
#include "model.h"
8
8
 
9
9
#define ADDR_MASK 0x7F00
10
10
#define WRITE_BIT 0x8000
110
110
    }
111
111
 
112
112
    if ((val & READ_READY_BIT) == 0) {
 
113
        if (--retries > 0) {
 
114
            pcilib_warning("Timeout occured during register write, retrying (try %i of %i)...", RETRIES - retries, RETRIES);
 
115
            goto retry;
 
116
        }
 
117
 
113
118
        pcilib_error("Timeout writting register value");
114
119
        return PCILIB_ERROR_TIMEOUT;
115
120
    }
121
126
 
122
127
    if (((val&ADDR_MASK) >> 8) != addr) {
123
128
        if (--retries > 0) {
124
 
            pcilib_warning("Address verification failed during register read, retrying (try %i of %i)...", RETRIES - retries, RETRIES);
 
129
            pcilib_warning("Address verification failed during register write, retrying (try %i of %i)...", RETRIES - retries, RETRIES);
125
130
            goto retry;
126
131
        }
127
132
        pcilib_error("Address verification failed during register write");
137
142
 
138
143
    return 0;
139
144
}
 
145
 
 
146
 
 
147