Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
L
linux-elphel
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Commits
Open sidebar
Elphel
linux-elphel
Commits
63b28248
Commit
63b28248
authored
Jan 31, 2018
by
Oleg Dzhimiev
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
minor edits
parent
2b5bad4a
Changes
3
Expand all
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
93 additions
and
46 deletions
+93
-46
mt9x001.c
src/drivers/elphel/mt9x001.c
+15
-11
pgm_functions.c
src/drivers/elphel/pgm_functions.c
+77
-34
sensor_i2c.c
src/drivers/elphel/sensor_i2c.c
+1
-1
No files found.
src/drivers/elphel/mt9x001.c
View file @
63b28248
...
@@ -684,18 +684,22 @@ int mt9x001_pgm_sensorregs (int sensor_port, struct sensor_t * sensor, struct
...
@@ -684,18 +684,22 @@ int mt9x001_pgm_sensorregs (int sensor_port, struct sensor_t * sensor, struct
#ifdef NC353
#ifdef NC353
#define I2C_READ_DATA16(x) ((i2c_read_data[(x)<<1]<<8)+i2c_read_data[((x)<<1)+1])
#define I2C_READ_DATA16(x) ((i2c_read_data[(x)<<1]<<8)+i2c_read_data[((x)<<1)+1])
#endif
#endif
/**Detect and initialize sensor and related data structures
/**
* Detect and initialize sensor and related data structures
* - detect sensor type.
* - detect sensor type.
* - if successful, proceed to:,
* - if successful, proceed to:,
* - copy sensor static structure
* -- copy sensor static structure
* - setup appropriate pgm_* functions
* -- setup appropriate pgm_* functions
* - read sensor registers to shadows
* -- read sensor registers to shadows
* - initialize appropriate P_* registers (including sensor register shadows) - that initialization will schedule related pgm_* functions
* -- initialize appropriate P_* registers (including sensor register shadows) - that initialization will schedule related pgm_* functions
*
* TODO: when is P_CLK_FPGA initialized? Needs to be done before this
* TODO: when is P_CLK_FPGA initialized? Needs to be done before this
* hardware i2c is expected to be reset and initialized - no wrong, it will be programmed in
* hardware i2c is expected to be reset and initialized - no wrong, it will be programmed in
* onchange_i2c should be the first after init sensor (even before onchange_sensorphase)
* onchange_i2c should be the first after init sensor (even before onchange_sensorphase)
* onchange_sensorphase will be triggered after this
* onchange_sensorphase will be triggered after this
* hardware i2c after this function will be disabled, will need onchange_sensorphase to initialize/start it. */
* hardware i2c after this function will be disabled, will need onchange_sensorphase to initialize/start it.
*/
int
mt9x001_pgm_detectsensor
(
int
sensor_port
,
///< sensor port number (0..3)
int
mt9x001_pgm_detectsensor
(
int
sensor_port
,
///< sensor port number (0..3)
struct
sensor_t
*
sensor
,
///< sensor static parameters (capabilities)
struct
sensor_t
*
sensor
,
///< sensor static parameters (capabilities)
struct
framepars_t
*
thispars
,
///< sensor current parameters
struct
framepars_t
*
thispars
,
///< sensor current parameters
...
@@ -705,11 +709,11 @@ int mt9x001_pgm_detectsensor (int sensor_port, ///< sensor port
...
@@ -705,11 +709,11 @@ int mt9x001_pgm_detectsensor (int sensor_port, ///< sensor port
///< @return 0 - OK, negative - error
///< @return 0 - OK, negative - error
{
{
//
unsigned long flags; // this function uses software i2c operations - they need to have interrupts (and hardware i2c off)
//
unsigned long flags; // this function uses software i2c operations - they need to have interrupts (and hardware i2c off)
//
unsigned char i2c_read_data[2]; // each two bytes - one short word, big endian
//unsigned char i2c_read_data[2]; // each two bytes - one short word, big endian
u32
i2c_read_dataw
;
u32
i2c_read_dataw
;
//
u8 * i2c_read_data = (u8*)& i2c_read_dataw; // each two bytes - one short word, big endian
//
u8 * i2c_read_data = (u8*)& i2c_read_dataw; // each two bytes - one short word, big endian
//
unsigned char chipver_reg=P_MT9X001_CHIPVER;
//unsigned char chipver_reg=P_MT9X001_CHIPVER;
int
sensor_subtype
=
0
;
int
sensor_subtype
=
0
;
int
i
;
int
i
;
int
sensor_multi_regs_number
;
int
sensor_multi_regs_number
;
...
...
src/drivers/elphel/pgm_functions.c
View file @
63b28248
This diff is collapsed.
Click to expand it.
src/drivers/elphel/sensor_i2c.c
View file @
63b28248
...
@@ -235,7 +235,7 @@ int i2c_page_alloc(int chn)
...
@@ -235,7 +235,7 @@ int i2c_page_alloc(int chn)
EXPORT_SYMBOL_GPL
(
i2c_page_alloc
);
EXPORT_SYMBOL_GPL
(
i2c_page_alloc
);
/** Register specific page, can be used with legacy software to register page equal to slave address,
/** Register specific page, can be used with legacy software to register page equal to slave address,
* and use 0xff for reading. Works with 1
byh
te addresses and 16-bit data */
* and use 0xff for reading. Works with 1
-by
te addresses and 16-bit data */
int
i2c_page_register
(
int
chn
,
///< Sensor port
int
i2c_page_register
(
int
chn
,
///< Sensor port
int
page
)
///< page to register (for legacy software, use 7-bit slave address
int
page
)
///< page to register (for legacy software, use 7-bit slave address
///< @return 0 on success, -ENOMEM if page is already registered
///< @return 0 on success, -ENOMEM if page is already registered
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment