no-OS
Loading...
Searching...
No Matches
gmsl_reg_access.h File Reference
#include <stdint.h>
#include "no_os_i2c.h"
Include dependency graph for gmsl_reg_access.h:
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Macros

#define RETURN_ON_ERR(x)
 
#define REG_WRITE_RETURN_ON_ERR(ret, i2c_desc, reg, writeval)
 
#define REG_READ_RETURN_ON_ERR(ret, i2c_desc, reg, mask, readval)
 
#define REG_UPDATE_RETURN_ON_ERR(ret, i2c_desc, reg, val, mask)
 
#define BREAK_ON_ERR(x)
 
#define REG_WRITE_BREAK_ON_ERR(ret, i2c_desc, reg, writeval)
 
#define REG_READ_BREAK_ON_ERR(ret, i2c_desc, reg, mask, readval)
 
#define REG_UPDATE_BREAK_ON_ERR(ret, i2c_desc, reg, val, mask)
 

Functions

int32_t gmsl_reg_read (struct no_os_i2c_desc *i2c_desc, uint16_t reg, uint8_t mask, uint8_t *readval)
 Read a value from a GMSL register.
 
int32_t gmsl_reg_write (struct no_os_i2c_desc *i2c_desc, uint16_t reg, uint8_t writeval)
 Write a value to a GMSL register.
 
int32_t gmsl_reg_update (struct no_os_i2c_desc *i2c_desc, uint16_t reg, uint8_t val, uint8_t mask)
 Update a value in a GMSL register.
 

Macro Definition Documentation

◆ BREAK_ON_ERR

#define BREAK_ON_ERR ( x)
Value:
if(x != 0)\
{\
break;\
}

◆ REG_READ_BREAK_ON_ERR

#define REG_READ_BREAK_ON_ERR ( ret,
i2c_desc,
reg,
mask,
readval )
Value:
{\
ret = gmsl_reg_read(i2c_desc, reg, mask, readval);\
BREAK_ON_ERR(ret);\
}
int32_t gmsl_reg_read(struct no_os_i2c_desc *i2c_desc, uint16_t reg, uint8_t mask, uint8_t *readval)
Read a value from a GMSL register.
Definition gmsl_reg_access.c:51

◆ REG_READ_RETURN_ON_ERR

#define REG_READ_RETURN_ON_ERR ( ret,
i2c_desc,
reg,
mask,
readval )
Value:
{\
ret = gmsl_reg_read(i2c_desc, reg, mask, readval); \
if(ret)\
return ret;\
}

◆ REG_UPDATE_BREAK_ON_ERR

#define REG_UPDATE_BREAK_ON_ERR ( ret,
i2c_desc,
reg,
val,
mask )
Value:
{\
ret = gmsl_reg_update(i2c_desc, reg, val, mask);\
BREAK_ON_ERR(ret);\
}
int32_t gmsl_reg_update(struct no_os_i2c_desc *i2c_desc, uint16_t reg, uint8_t val, uint8_t mask)
Update a value in a GMSL register.
Definition gmsl_reg_access.c:119

◆ REG_UPDATE_RETURN_ON_ERR

#define REG_UPDATE_RETURN_ON_ERR ( ret,
i2c_desc,
reg,
val,
mask )
Value:
{\
ret = gmsl_reg_update(i2c_desc, reg, val, mask); \
if(ret)\
return ret;\
}

◆ REG_WRITE_BREAK_ON_ERR

#define REG_WRITE_BREAK_ON_ERR ( ret,
i2c_desc,
reg,
writeval )
Value:
{\
ret = gmsl_reg_write(i2c_desc, reg, writeval);\
BREAK_ON_ERR(ret);\
}
int32_t gmsl_reg_write(struct no_os_i2c_desc *i2c_desc, uint16_t reg, uint8_t writeval)
Write a value to a GMSL register.
Definition gmsl_reg_access.c:90

◆ REG_WRITE_RETURN_ON_ERR

#define REG_WRITE_RETURN_ON_ERR ( ret,
i2c_desc,
reg,
writeval )
Value:
{\
ret = gmsl_reg_write(i2c_desc, reg, writeval); \
if(ret)\
return ret;\
}

◆ RETURN_ON_ERR

#define RETURN_ON_ERR ( x)
Value:
if(x != 0) return (x)

Function Documentation

◆ gmsl_reg_read()

int32_t gmsl_reg_read ( struct no_os_i2c_desc * i2c_desc,
uint16_t reg,
uint8_t mask,
uint8_t * readval )

Read a value from a GMSL register.

Read a device register through the I2C interface.

Parameters
i2c_desc- Pointer to the I2C descriptor.
reg- Register address to read from.
mask- Mask to apply to the read value.
readval- Pointer to store the read value.
Returns
0 in case of success, negative error code in case of PAL errors.
Here is the caller graph for this function:

◆ gmsl_reg_update()

int32_t gmsl_reg_update ( struct no_os_i2c_desc * i2c_desc,
uint16_t reg,
uint8_t val,
uint8_t mask )

Update a value in a GMSL register.

Read-modify-write operation on a field of a register.

Parameters
i2c_desc- Pointer to the I2C descriptor.
reg- Register address to update.
val- Value to write to the register.
mask- Mask to apply to the value.
Returns
0 in case of success, negative error code in case of PAL errors.
Todo
Revert this after removal of explicit mask being used in mission mode api's
Here is the caller graph for this function:

◆ gmsl_reg_write()

int32_t gmsl_reg_write ( struct no_os_i2c_desc * i2c_desc,
uint16_t reg,
uint8_t writeval )

Write a value to a GMSL register.

Write a device register through the I2C interface.

Parameters
i2c_desc- Pointer to the I2C descriptor.
reg- Register address to write to.
writeval- Value to write to the register.
Returns
0 in case of success, negative error code in case of PAL errors.
Here is the caller graph for this function: