boards: cxd56: nxstyle fixes for the common code

nxstyle fixes on the cxd56 common code

Signed-off-by: Alin Jerpelea <alin.jerpelea@sony.com>
This commit is contained in:
Alin Jerpelea
2020-04-17 12:00:02 +02:00
committed by patacongo
parent efbd6ada21
commit e899bc92d2
19 changed files with 185 additions and 84 deletions
+2 -2
View File
@@ -143,8 +143,8 @@ void board_altmdm_poweron(void)
} }
} }
/* Slave request seems to float in Lite Hibernation and becomes HIGH at some /* Slave request seems to float in Lite Hibernation and becomes HIGH at
* times when it should stay LOW. * some times when it should stay LOW.
*/ */
cxd56_pin_config(PINCONF_SET(SLAVE_REQUEST, cxd56_pin_config(PINCONF_SET(SLAVE_REQUEST,
@@ -50,6 +50,10 @@
#include "cxd56_i2c.h" #include "cxd56_i2c.h"
/****************************************************************************
* Public Functions
****************************************************************************/
#ifdef CONFIG_SENSORS_APDS9930_SCU #ifdef CONFIG_SENSORS_APDS9930_SCU
int board_apds9930_initialize(int bus) int board_apds9930_initialize(int bus)
{ {
@@ -49,6 +49,10 @@
#include "cxd56_i2c.h" #include "cxd56_i2c.h"
/****************************************************************************
* Public Functions
****************************************************************************/
#if defined(CONFIG_CXD56_I2C) && defined(CONFIG_APDS9960) #if defined(CONFIG_CXD56_I2C) && defined(CONFIG_APDS9960)
int board_apds9960_initialize(FAR const char *devpath, int bus) int board_apds9960_initialize(FAR const char *devpath, int bus)
@@ -50,6 +50,10 @@
#include "cxd56_i2c.h" #include "cxd56_i2c.h"
/****************************************************************************
* Public Functions
****************************************************************************/
#ifdef CONFIG_SENSORS_BH1721FVC_SCU #ifdef CONFIG_SENSORS_BH1721FVC_SCU
int board_bh1721fvc_initialize(FAR const char *devpath, int bus) int board_bh1721fvc_initialize(FAR const char *devpath, int bus)
{ {
@@ -50,6 +50,10 @@
#include "cxd56_i2c.h" #include "cxd56_i2c.h"
/****************************************************************************
* Public Functions
****************************************************************************/
#ifdef CONFIG_SENSORS_BH1745NUC_SCU #ifdef CONFIG_SENSORS_BH1745NUC_SCU
int board_bh1745nuc_initialize(FAR const char *devpath, int bus) int board_bh1745nuc_initialize(FAR const char *devpath, int bus)
{ {
@@ -50,6 +50,10 @@
#include "cxd56_i2c.h" #include "cxd56_i2c.h"
/****************************************************************************
* Public Functions
****************************************************************************/
#ifdef CONFIG_SENSORS_BM1383GLV_SCU #ifdef CONFIG_SENSORS_BM1383GLV_SCU
int board_bm1383glv_initialize(FAR const char *devpath, int bus) int board_bm1383glv_initialize(FAR const char *devpath, int bus)
{ {
@@ -56,6 +56,10 @@
# define BM1422GMV_PATH_CNT 1 # define BM1422GMV_PATH_CNT 1
#endif #endif
/****************************************************************************
* Public Functions
****************************************************************************/
#ifdef CONFIG_SENSORS_BM1422GMV_SCU #ifdef CONFIG_SENSORS_BM1422GMV_SCU
int board_bm1422gmv_initialize(FAR const char *devpath, int bus) int board_bm1422gmv_initialize(FAR const char *devpath, int bus)
{ {
@@ -62,6 +62,10 @@
# define ACCEL_NR_SEQS 1 # define ACCEL_NR_SEQS 1
#endif #endif
/****************************************************************************
* Public Functions
****************************************************************************/
#if defined(CONFIG_SENSORS_BMI160_SCU) #if defined(CONFIG_SENSORS_BMI160_SCU)
int board_bmi160_initialize(int bus) int board_bmi160_initialize(int bus)
@@ -61,6 +61,10 @@
# define ACCEL_NR_SEQS 1 # define ACCEL_NR_SEQS 1
#endif #endif
/****************************************************************************
* Public Functions
****************************************************************************/
#if defined(CONFIG_CXD56_SPI) && defined(CONFIG_SENSORS_BMI160) #if defined(CONFIG_CXD56_SPI) && defined(CONFIG_SENSORS_BMI160)
int board_bmi160_initialize(int bus) int board_bmi160_initialize(int bus)
@@ -49,6 +49,10 @@
#include "cxd56_i2c.h" #include "cxd56_i2c.h"
/****************************************************************************
* Public Functions
****************************************************************************/
#if defined(CONFIG_CXD56_I2C) && defined(CONFIG_SENSORS_BMP280) #if defined(CONFIG_CXD56_I2C) && defined(CONFIG_SENSORS_BMP280)
int board_bmp280_initialize(int bus) int board_bmp280_initialize(int bus)
{ {
@@ -62,6 +62,10 @@
# define TEMP_NR_SEQS 1 # define TEMP_NR_SEQS 1
#endif #endif
/****************************************************************************
* Public Functions
****************************************************************************/
#ifdef CONFIG_SENSORS_BMP280_SCU #ifdef CONFIG_SENSORS_BMP280_SCU
int board_bmp280_initialize(int bus) int board_bmp280_initialize(int bus)
{ {
@@ -225,9 +225,9 @@ void board_crashdump(uintptr_t currentsp, FAR void *tcb,
/* Is it Invalid? */ /* Is it Invalid? */
if (!(pdump->info.stacks.interrupt.sp <= pdump->info.stacks.interrupt.top && if (!(pdump->info.stacks.interrupt.sp <= pdump->info.stacks.interrupt.top
pdump->info.stacks.interrupt.sp > pdump->info.stacks.interrupt.top - && pdump->info.stacks.interrupt.sp > pdump->info.stacks.interrupt.top
pdump->info.stacks.interrupt.size)) - pdump->info.stacks.interrupt.size))
{ {
pdump->info.flags |= INVALID_INTSTACK_PTR; pdump->info.flags |= INVALID_INTSTACK_PTR;
} }
@@ -199,6 +199,7 @@ static void spi_pincontrol(int bus, bool on)
CXD56_PIN_CONFIGS(PINCONFS_EMMCA_GPIO); CXD56_PIN_CONFIGS(PINCONFS_EMMCA_GPIO);
} }
#endif #endif
#ifdef CONFIG_CXD56_SPI5_PINMAP_SDIO #ifdef CONFIG_CXD56_SPI5_PINMAP_SDIO
if (on) if (on)
{ {
@@ -45,6 +45,10 @@
#include "cxd56_i2c.h" #include "cxd56_i2c.h"
/****************************************************************************
* Public Functions
****************************************************************************/
/**************************************************************************** /****************************************************************************
* Name: board_i2cdev_initialize * Name: board_i2cdev_initialize
* *
+119 -76
View File
@@ -146,69 +146,69 @@
/* Copy command (32 bytes) */ /* Copy command (32 bytes) */
struct ge2d_copycmd_s struct __attribute__ ((aligned(16))) ge2d_copycmd_s
{ {
uint32_t cmd; /* 0x00 */ uint32_t cmd; /* 0x00 */
uint16_t srch; /* 0x04 */ uint16_t srch; /* 0x04 */
uint16_t srcv; /* 0x06 */ uint16_t srcv; /* 0x06 */
uint32_t saddr; /* 0x08 */ uint32_t saddr; /* 0x08 */
uint32_t daddr; /* 0x0c */ uint32_t daddr; /* 0x0c */
uint16_t spitch; /* 0x10 */ uint16_t spitch; /* 0x10 */
uint16_t dpitch; /* 0x12 */ uint16_t dpitch; /* 0x12 */
uint32_t reserved[3]; uint32_t reserved[3];
} __attribute__ ((aligned(16))); };
/* Raster operation (ROP) command (48 bytes) */ /* Raster operation (ROP) command (48 bytes) */
struct ge2d_ropcmd_s struct __attribute__ ((aligned(16))) ge2d_ropcmd_s
{ {
uint16_t cmd; /* 0x00 */ uint16_t cmd; /* 0x00 */
uint8_t rop; /* 0x02 */ uint8_t rop; /* 0x02 */
uint8_t options; /* 0x03 */ uint8_t options; /* 0x03 */
uint16_t srch; /* 0x04 */ uint16_t srch; /* 0x04 */
uint16_t srcv; /* 0x06 */ uint16_t srcv; /* 0x06 */
uint32_t saddr; /* 0x08 */ uint32_t saddr; /* 0x08 */
uint32_t daddr; /* 0x0c */ uint32_t daddr; /* 0x0c */
uint16_t spitch; /* 0x10 */ uint16_t spitch; /* 0x10 */
uint16_t dpitch; /* 0x12 */ uint16_t dpitch; /* 0x12 */
uint32_t fixedcolor; /* 0x14 */ uint32_t fixedcolor; /* 0x14 */
uint32_t pataddr; /* 0x18 */ uint32_t pataddr; /* 0x18 */
uint16_t patpitch; /* 0x1c */ uint16_t patpitch; /* 0x1c */
uint8_t pathoffset; /* 0x1e */ uint8_t pathoffset; /* 0x1e */
uint8_t patvoffset; /* 0x1f */ uint8_t patvoffset; /* 0x1f */
uint16_t desth; /* 0x20 */ uint16_t desth; /* 0x20 */
uint16_t destv; /* 0x22 */ uint16_t destv; /* 0x22 */
uint16_t ratioh; /* 0x24 */ uint16_t ratioh; /* 0x24 */
uint16_t ratiov; /* 0x26 */ uint16_t ratiov; /* 0x26 */
uint8_t hphaseinit; /* 0x28 */ uint8_t hphaseinit; /* 0x28 */
uint8_t hphaseoffset; /* 0x29: must be 0 */ uint8_t hphaseoffset; /* 0x29: must be 0 */
uint8_t vphaseinit; /* 0x2a */ uint8_t vphaseinit; /* 0x2a */
uint8_t vphaseoffset; /* 0x2b: must be 0 */ uint8_t vphaseoffset; /* 0x2b: must be 0 */
uint32_t intpmode; /* 0x2c: interpolation mode */ uint32_t intpmode; /* 0x2c: interpolation mode */
} __attribute__ ((aligned(16))); };
/* Alpha blending (AB) command (32 bytes) */ /* Alpha blending (AB) command (32 bytes) */
struct ge2d_abcmd_s struct __attribute__ ((aligned(16))) ge2d_abcmd_s
{ {
uint16_t cmd; /* 0x00 */ uint16_t cmd; /* 0x00 */
uint16_t mode; /* 0x02 */ uint16_t mode; /* 0x02 */
uint16_t srch; /* 0x04 */ uint16_t srch; /* 0x04 */
uint16_t srcv; /* 0x06 */ uint16_t srcv; /* 0x06 */
uint32_t saddr; /* 0x08 */ uint32_t saddr; /* 0x08 */
uint32_t daddr; /* 0x0c */ uint32_t daddr; /* 0x0c */
uint16_t spitch; /* 0x10 */ uint16_t spitch; /* 0x10 */
uint16_t dpitch; /* 0x12 */ uint16_t dpitch; /* 0x12 */
uint32_t fixedsrc; /* 0x14 */ uint32_t fixedsrc; /* 0x14 */
uint32_t aaddr; /* 0x18 */ uint32_t aaddr; /* 0x18 */
uint16_t apitch; /* 0x1c */ uint16_t apitch; /* 0x1c */
uint16_t reserved; uint16_t reserved;
} __attribute__ ((aligned(16))); };
/**************************************************************************** /****************************************************************************
* Private Data * Private Data
@@ -235,7 +235,7 @@ static void ip_semgive(sem_t * id)
nxsem_post(id); nxsem_post(id);
} }
static int intr_handler_ROT(int irq, FAR void *context, FAR void *arg) static int intr_handler_rot(int irq, FAR void *context, FAR void *arg)
{ {
putreg32(1, ROT_INTR_CLEAR); putreg32(1, ROT_INTR_CLEAR);
putreg32(0, ROT_INTR_ENABLE); putreg32(0, ROT_INTR_ENABLE);
@@ -295,11 +295,19 @@ static uint16_t calc_ratio(uint16_t src, uint16_t dest)
return 0; return 0;
} }
static void *set_rop_cmd(void *cmdbuf, void *srcaddr, void *destaddr, static void *set_rop_cmd(void *cmdbuf,
uint16_t srcwidth, uint16_t srcheight, void *srcaddr,
uint16_t srcpitch, uint16_t destwidth, void *destaddr,
uint16_t destheight, uint16_t destpitch, uint8_t bpp, uint16_t srcwidth,
uint8_t rop, uint8_t options, uint16_t patcolor) uint16_t srcheight,
uint16_t srcpitch,
uint16_t destwidth,
uint16_t destheight,
uint16_t destpitch,
uint8_t bpp,
uint8_t rop,
uint8_t options,
uint16_t patcolor)
{ {
struct ge2d_ropcmd_s *rc = (struct ge2d_ropcmd_s *)cmdbuf; struct ge2d_ropcmd_s *rc = (struct ge2d_ropcmd_s *)cmdbuf;
uint16_t rv; uint16_t rv;
@@ -321,6 +329,7 @@ static void *set_rop_cmd(void *cmdbuf, void *srcaddr, void *destaddr,
{ {
return NULL; return NULL;
} }
rh = calc_ratio(srcwidth, destwidth); rh = calc_ratio(srcwidth, destwidth);
if (rh == 0) if (rh == 0)
{ {
@@ -389,7 +398,7 @@ void imageproc_initialize(void)
putreg32(0, ROT_INTR_ENABLE); putreg32(0, ROT_INTR_ENABLE);
putreg32(1, ROT_INTR_DISABLE); putreg32(1, ROT_INTR_DISABLE);
irq_attach(CXD56_IRQ_ROT, intr_handler_ROT, NULL); irq_attach(CXD56_IRQ_ROT, intr_handler_rot, NULL);
up_enable_irq(CXD56_IRQ_ROT); up_enable_irq(CXD56_IRQ_ROT);
} }
@@ -411,7 +420,9 @@ void imageproc_finalize(void)
nxsem_destroy(&g_geexc); nxsem_destroy(&g_geexc);
} }
void imageproc_convert_yuv2rgb(uint8_t * ibuf, uint32_t hsize, uint32_t vsize) void imageproc_convert_yuv2rgb(uint8_t * ibuf,
uint32_t hsize,
uint32_t vsize)
{ {
int ret; int ret;
@@ -471,9 +482,13 @@ void imageproc_convert_yuv2gray(uint8_t * ibuf, uint8_t * obuf, size_t hsize,
} }
} }
int imageproc_resize(uint8_t * ibuf, uint16_t ihsize, int imageproc_resize(uint8_t * ibuf,
uint16_t ivsize, uint8_t * obuf, uint16_t ihsize,
uint16_t ohsize, uint16_t ovsize, int bpp) uint16_t ivsize,
uint8_t * obuf,
uint16_t ohsize,
uint16_t ovsize,
int bpp)
{ {
void *cmd = g_gcmdbuf; void *cmd = g_gcmdbuf;
size_t len; size_t len;
@@ -497,7 +512,8 @@ int imageproc_resize(uint8_t * ibuf, uint16_t ihsize,
return -EINVAL; return -EINVAL;
} }
if ((ratio_check(ihsize, ohsize) != 0) || (ratio_check(ivsize, ovsize) != 0)) if ((ratio_check(ihsize, ohsize) != 0) ||
(ratio_check(ivsize, ovsize) != 0))
{ {
return -EINVAL; return -EINVAL;
} }
@@ -510,8 +526,19 @@ int imageproc_resize(uint8_t * ibuf, uint16_t ihsize,
/* Create descriptor to graphics engine */ /* Create descriptor to graphics engine */
cmd = set_rop_cmd(cmd, ibuf, obuf, ihsize, ivsize, ihsize, cmd = set_rop_cmd(cmd,
ohsize, ovsize, ohsize, bpp, SRCCOPY, FIXEDCOLOR, 0x0080); ibuf,
obuf,
ihsize,
ivsize,
ihsize,
ohsize,
ovsize,
ohsize,
bpp,
SRCCOPY,
FIXEDCOLOR,
0x0080);
if (cmd == NULL) if (cmd == NULL)
{ {
ip_semgive(&g_geexc); ip_semgive(&g_geexc);
@@ -537,10 +564,14 @@ int imageproc_resize(uint8_t * ibuf, uint16_t ihsize,
return 0; return 0;
} }
int imageproc_clip_and_resize(uint8_t * ibuf, uint16_t ihsize, int imageproc_clip_and_resize(uint8_t * ibuf,
uint16_t ivsize, uint8_t * obuf, uint16_t ihsize,
uint16_t ohsize, uint16_t ovsize, uint16_t ivsize,
int bpp, imageproc_rect_t * clip_rect) uint8_t * obuf,
uint16_t ohsize,
uint16_t ovsize,
int bpp,
imageproc_rect_t * clip_rect)
{ {
void *cmd = g_gcmdbuf; void *cmd = g_gcmdbuf;
size_t len; size_t len;
@@ -569,7 +600,8 @@ int imageproc_clip_and_resize(uint8_t * ibuf, uint16_t ihsize,
if (clip_rect != NULL) if (clip_rect != NULL)
{ {
if ((clip_rect->x2 < clip_rect->x1) || (clip_rect->y2 < clip_rect->y1)) if ((clip_rect->x2 < clip_rect->x1) ||
(clip_rect->y2 < clip_rect->y1))
{ {
return -EINVAL; return -EINVAL;
} }
@@ -589,8 +621,8 @@ int imageproc_clip_and_resize(uint8_t * ibuf, uint16_t ihsize,
} }
pix_bytes = bpp >> 3; pix_bytes = bpp >> 3;
ibuf = ibuf = ibuf + (clip_rect->x1 * pix_bytes +
ibuf + (clip_rect->x1 * pix_bytes + clip_rect->y1 * ihsize * pix_bytes); clip_rect->y1 * ihsize * pix_bytes);
} }
else else
{ {
@@ -599,6 +631,7 @@ int imageproc_clip_and_resize(uint8_t * ibuf, uint16_t ihsize,
{ {
return -EINVAL; return -EINVAL;
} }
clip_width = ihsize; clip_width = ihsize;
clip_height = ivsize; clip_height = ivsize;
} }
@@ -611,9 +644,19 @@ int imageproc_clip_and_resize(uint8_t * ibuf, uint16_t ihsize,
/* Create descriptor to graphics engine */ /* Create descriptor to graphics engine */
cmd = set_rop_cmd(cmd, ibuf, obuf, cmd = set_rop_cmd(cmd,
clip_width, clip_height, ihsize, ibuf,
ohsize, ovsize, ohsize, bpp, SRCCOPY, FIXEDCOLOR, 0x0080); obuf,
clip_width,
clip_height,
ihsize,
ohsize,
ovsize,
ohsize,
bpp,
SRCCOPY,
FIXEDCOLOR,
0x0080);
if (cmd == NULL) if (cmd == NULL)
{ {
@@ -56,6 +56,10 @@
# define KX022_FIFO_CNT 1 # define KX022_FIFO_CNT 1
#endif #endif
/****************************************************************************
* Public Functions
****************************************************************************/
#ifdef CONFIG_SENSORS_KX022_SCU #ifdef CONFIG_SENSORS_KX022_SCU
int board_kx022_initialize(FAR const char *devpath, int bus) int board_kx022_initialize(FAR const char *devpath, int bus)
{ {
@@ -50,6 +50,10 @@
#include "cxd56_i2c.h" #include "cxd56_i2c.h"
/****************************************************************************
* Public Functions
****************************************************************************/
#ifdef CONFIG_SENSORS_LT1PA01_SCU #ifdef CONFIG_SENSORS_LT1PA01_SCU
int board_lt1pa01_initialize(int bus) int board_lt1pa01_initialize(int bus)
{ {
@@ -50,6 +50,10 @@
#include "cxd56_i2c.h" #include "cxd56_i2c.h"
/****************************************************************************
* Public Functions
****************************************************************************/
#ifdef CONFIG_SENSORS_RPR0521RS_SCU #ifdef CONFIG_SENSORS_RPR0521RS_SCU
int board_rpr0521rs_initialize(int bus) int board_rpr0521rs_initialize(int bus)
{ {
@@ -166,9 +166,9 @@
#define _I2C_DEVICE_WOPATH(_name) _DEVICE_WOPATH(_name, SENSOR_I2C) #define _I2C_DEVICE_WOPATH(_name) _DEVICE_WOPATH(_name, SENSOR_I2C)
#define _SPI_DEVICE_WOPATH(_name) _DEVICE_WOPATH(_name, SENSOR_SPI) #define _SPI_DEVICE_WOPATH(_name) _DEVICE_WOPATH(_name, SENSOR_SPI)
/************************************************************************************ /****************************************************************************
* Private Types * Private Types
************************************************************************************/ ****************************************************************************/
typedef int (*_init_t)(int bus); typedef int (*_init_t)(int bus);
typedef int (*_initdev_t)(FAR const char *devpath, int bus); typedef int (*_initdev_t)(FAR const char *devpath, int bus);
@@ -278,7 +278,8 @@ int board_sensors_initialize(void)
if (ret < 0) if (ret < 0)
{ {
_err("Failed to init %s at bus %d: %d\n", dev->name, dev->bus, ret); _err("Failed to init %s at bus %d: %d\n",
dev->name, dev->bus, ret);
} }
} }