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:
parent
efbd6ada21
commit
e899bc92d2
boards/arm/cxd56xx/common/src
cxd56_altmdm.ccxd56_apds9930_scu.ccxd56_apds9960_i2c.ccxd56_bh1721fvc_scu.ccxd56_bh1745nuc_scu.ccxd56_bm1383glv_scu.ccxd56_bm1422gmv_scu.ccxd56_bmi160_scu.ccxd56_bmi160_spi.ccxd56_bmp280_i2c.ccxd56_bmp280_scu.ccxd56_crashdump.ccxd56_gs2200m.ccxd56_i2cdev.ccxd56_imageproc.ccxd56_kx022_scu.ccxd56_lt1pa01_scu.ccxd56_rpr0521rs_scu.ccxd56_sensors.c
@ -143,8 +143,8 @@ void board_altmdm_poweron(void)
|
||||
}
|
||||
}
|
||||
|
||||
/* Slave request seems to float in Lite Hibernation and becomes HIGH at some
|
||||
* times when it should stay LOW.
|
||||
/* Slave request seems to float in Lite Hibernation and becomes HIGH at
|
||||
* some times when it should stay LOW.
|
||||
*/
|
||||
|
||||
cxd56_pin_config(PINCONF_SET(SLAVE_REQUEST,
|
||||
|
@ -50,6 +50,10 @@
|
||||
|
||||
#include "cxd56_i2c.h"
|
||||
|
||||
/****************************************************************************
|
||||
* Public Functions
|
||||
****************************************************************************/
|
||||
|
||||
#ifdef CONFIG_SENSORS_APDS9930_SCU
|
||||
int board_apds9930_initialize(int bus)
|
||||
{
|
||||
|
@ -49,6 +49,10 @@
|
||||
|
||||
#include "cxd56_i2c.h"
|
||||
|
||||
/****************************************************************************
|
||||
* Public Functions
|
||||
****************************************************************************/
|
||||
|
||||
#if defined(CONFIG_CXD56_I2C) && defined(CONFIG_APDS9960)
|
||||
|
||||
int board_apds9960_initialize(FAR const char *devpath, int bus)
|
||||
|
@ -50,6 +50,10 @@
|
||||
|
||||
#include "cxd56_i2c.h"
|
||||
|
||||
/****************************************************************************
|
||||
* Public Functions
|
||||
****************************************************************************/
|
||||
|
||||
#ifdef CONFIG_SENSORS_BH1721FVC_SCU
|
||||
int board_bh1721fvc_initialize(FAR const char *devpath, int bus)
|
||||
{
|
||||
|
@ -50,6 +50,10 @@
|
||||
|
||||
#include "cxd56_i2c.h"
|
||||
|
||||
/****************************************************************************
|
||||
* Public Functions
|
||||
****************************************************************************/
|
||||
|
||||
#ifdef CONFIG_SENSORS_BH1745NUC_SCU
|
||||
int board_bh1745nuc_initialize(FAR const char *devpath, int bus)
|
||||
{
|
||||
|
@ -50,6 +50,10 @@
|
||||
|
||||
#include "cxd56_i2c.h"
|
||||
|
||||
/****************************************************************************
|
||||
* Public Functions
|
||||
****************************************************************************/
|
||||
|
||||
#ifdef CONFIG_SENSORS_BM1383GLV_SCU
|
||||
int board_bm1383glv_initialize(FAR const char *devpath, int bus)
|
||||
{
|
||||
|
@ -56,6 +56,10 @@
|
||||
# define BM1422GMV_PATH_CNT 1
|
||||
#endif
|
||||
|
||||
/****************************************************************************
|
||||
* Public Functions
|
||||
****************************************************************************/
|
||||
|
||||
#ifdef CONFIG_SENSORS_BM1422GMV_SCU
|
||||
int board_bm1422gmv_initialize(FAR const char *devpath, int bus)
|
||||
{
|
||||
|
@ -62,6 +62,10 @@
|
||||
# define ACCEL_NR_SEQS 1
|
||||
#endif
|
||||
|
||||
/****************************************************************************
|
||||
* Public Functions
|
||||
****************************************************************************/
|
||||
|
||||
#if defined(CONFIG_SENSORS_BMI160_SCU)
|
||||
|
||||
int board_bmi160_initialize(int bus)
|
||||
|
@ -61,6 +61,10 @@
|
||||
# define ACCEL_NR_SEQS 1
|
||||
#endif
|
||||
|
||||
/****************************************************************************
|
||||
* Public Functions
|
||||
****************************************************************************/
|
||||
|
||||
#if defined(CONFIG_CXD56_SPI) && defined(CONFIG_SENSORS_BMI160)
|
||||
|
||||
int board_bmi160_initialize(int bus)
|
||||
|
@ -49,6 +49,10 @@
|
||||
|
||||
#include "cxd56_i2c.h"
|
||||
|
||||
/****************************************************************************
|
||||
* Public Functions
|
||||
****************************************************************************/
|
||||
|
||||
#if defined(CONFIG_CXD56_I2C) && defined(CONFIG_SENSORS_BMP280)
|
||||
int board_bmp280_initialize(int bus)
|
||||
{
|
||||
|
@ -62,6 +62,10 @@
|
||||
# define TEMP_NR_SEQS 1
|
||||
#endif
|
||||
|
||||
/****************************************************************************
|
||||
* Public Functions
|
||||
****************************************************************************/
|
||||
|
||||
#ifdef CONFIG_SENSORS_BMP280_SCU
|
||||
int board_bmp280_initialize(int bus)
|
||||
{
|
||||
|
@ -225,9 +225,9 @@ void board_crashdump(uintptr_t currentsp, FAR void *tcb,
|
||||
|
||||
/* Is it Invalid? */
|
||||
|
||||
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.size))
|
||||
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.size))
|
||||
{
|
||||
pdump->info.flags |= INVALID_INTSTACK_PTR;
|
||||
}
|
||||
|
@ -199,6 +199,7 @@ static void spi_pincontrol(int bus, bool on)
|
||||
CXD56_PIN_CONFIGS(PINCONFS_EMMCA_GPIO);
|
||||
}
|
||||
#endif
|
||||
|
||||
#ifdef CONFIG_CXD56_SPI5_PINMAP_SDIO
|
||||
if (on)
|
||||
{
|
||||
|
@ -45,6 +45,10 @@
|
||||
|
||||
#include "cxd56_i2c.h"
|
||||
|
||||
/****************************************************************************
|
||||
* Public Functions
|
||||
****************************************************************************/
|
||||
|
||||
/****************************************************************************
|
||||
* Name: board_i2cdev_initialize
|
||||
*
|
||||
|
@ -146,69 +146,69 @@
|
||||
|
||||
/* Copy command (32 bytes) */
|
||||
|
||||
struct ge2d_copycmd_s
|
||||
{
|
||||
uint32_t cmd; /* 0x00 */
|
||||
uint16_t srch; /* 0x04 */
|
||||
uint16_t srcv; /* 0x06 */
|
||||
uint32_t saddr; /* 0x08 */
|
||||
uint32_t daddr; /* 0x0c */
|
||||
uint16_t spitch; /* 0x10 */
|
||||
uint16_t dpitch; /* 0x12 */
|
||||
uint32_t reserved[3];
|
||||
} __attribute__ ((aligned(16)));
|
||||
struct __attribute__ ((aligned(16))) ge2d_copycmd_s
|
||||
{
|
||||
uint32_t cmd; /* 0x00 */
|
||||
uint16_t srch; /* 0x04 */
|
||||
uint16_t srcv; /* 0x06 */
|
||||
uint32_t saddr; /* 0x08 */
|
||||
uint32_t daddr; /* 0x0c */
|
||||
uint16_t spitch; /* 0x10 */
|
||||
uint16_t dpitch; /* 0x12 */
|
||||
uint32_t reserved[3];
|
||||
};
|
||||
|
||||
/* Raster operation (ROP) command (48 bytes) */
|
||||
|
||||
struct ge2d_ropcmd_s
|
||||
{
|
||||
uint16_t cmd; /* 0x00 */
|
||||
uint8_t rop; /* 0x02 */
|
||||
uint8_t options; /* 0x03 */
|
||||
uint16_t srch; /* 0x04 */
|
||||
uint16_t srcv; /* 0x06 */
|
||||
uint32_t saddr; /* 0x08 */
|
||||
uint32_t daddr; /* 0x0c */
|
||||
uint16_t spitch; /* 0x10 */
|
||||
uint16_t dpitch; /* 0x12 */
|
||||
struct __attribute__ ((aligned(16))) ge2d_ropcmd_s
|
||||
{
|
||||
uint16_t cmd; /* 0x00 */
|
||||
uint8_t rop; /* 0x02 */
|
||||
uint8_t options; /* 0x03 */
|
||||
uint16_t srch; /* 0x04 */
|
||||
uint16_t srcv; /* 0x06 */
|
||||
uint32_t saddr; /* 0x08 */
|
||||
uint32_t daddr; /* 0x0c */
|
||||
uint16_t spitch; /* 0x10 */
|
||||
uint16_t dpitch; /* 0x12 */
|
||||
|
||||
uint32_t fixedcolor; /* 0x14 */
|
||||
uint32_t pataddr; /* 0x18 */
|
||||
uint16_t patpitch; /* 0x1c */
|
||||
uint8_t pathoffset; /* 0x1e */
|
||||
uint8_t patvoffset; /* 0x1f */
|
||||
uint32_t fixedcolor; /* 0x14 */
|
||||
uint32_t pataddr; /* 0x18 */
|
||||
uint16_t patpitch; /* 0x1c */
|
||||
uint8_t pathoffset; /* 0x1e */
|
||||
uint8_t patvoffset; /* 0x1f */
|
||||
|
||||
uint16_t desth; /* 0x20 */
|
||||
uint16_t destv; /* 0x22 */
|
||||
uint16_t ratioh; /* 0x24 */
|
||||
uint16_t ratiov; /* 0x26 */
|
||||
uint16_t desth; /* 0x20 */
|
||||
uint16_t destv; /* 0x22 */
|
||||
uint16_t ratioh; /* 0x24 */
|
||||
uint16_t ratiov; /* 0x26 */
|
||||
|
||||
uint8_t hphaseinit; /* 0x28 */
|
||||
uint8_t hphaseoffset; /* 0x29: must be 0 */
|
||||
uint8_t vphaseinit; /* 0x2a */
|
||||
uint8_t vphaseoffset; /* 0x2b: must be 0 */
|
||||
uint8_t hphaseinit; /* 0x28 */
|
||||
uint8_t hphaseoffset; /* 0x29: must be 0 */
|
||||
uint8_t vphaseinit; /* 0x2a */
|
||||
uint8_t vphaseoffset; /* 0x2b: must be 0 */
|
||||
|
||||
uint32_t intpmode; /* 0x2c: interpolation mode */
|
||||
} __attribute__ ((aligned(16)));
|
||||
uint32_t intpmode; /* 0x2c: interpolation mode */
|
||||
};
|
||||
|
||||
/* Alpha blending (AB) command (32 bytes) */
|
||||
|
||||
struct ge2d_abcmd_s
|
||||
{
|
||||
uint16_t cmd; /* 0x00 */
|
||||
uint16_t mode; /* 0x02 */
|
||||
uint16_t srch; /* 0x04 */
|
||||
uint16_t srcv; /* 0x06 */
|
||||
uint32_t saddr; /* 0x08 */
|
||||
uint32_t daddr; /* 0x0c */
|
||||
uint16_t spitch; /* 0x10 */
|
||||
uint16_t dpitch; /* 0x12 */
|
||||
struct __attribute__ ((aligned(16))) ge2d_abcmd_s
|
||||
{
|
||||
uint16_t cmd; /* 0x00 */
|
||||
uint16_t mode; /* 0x02 */
|
||||
uint16_t srch; /* 0x04 */
|
||||
uint16_t srcv; /* 0x06 */
|
||||
uint32_t saddr; /* 0x08 */
|
||||
uint32_t daddr; /* 0x0c */
|
||||
uint16_t spitch; /* 0x10 */
|
||||
uint16_t dpitch; /* 0x12 */
|
||||
|
||||
uint32_t fixedsrc; /* 0x14 */
|
||||
uint32_t aaddr; /* 0x18 */
|
||||
uint16_t apitch; /* 0x1c */
|
||||
uint16_t reserved;
|
||||
} __attribute__ ((aligned(16)));
|
||||
uint32_t fixedsrc; /* 0x14 */
|
||||
uint32_t aaddr; /* 0x18 */
|
||||
uint16_t apitch; /* 0x1c */
|
||||
uint16_t reserved;
|
||||
};
|
||||
|
||||
/****************************************************************************
|
||||
* Private Data
|
||||
@ -235,7 +235,7 @@ static void ip_semgive(sem_t * 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(0, ROT_INTR_ENABLE);
|
||||
@ -295,11 +295,19 @@ static uint16_t calc_ratio(uint16_t src, uint16_t dest)
|
||||
return 0;
|
||||
}
|
||||
|
||||
static void *set_rop_cmd(void *cmdbuf, void *srcaddr, void *destaddr,
|
||||
uint16_t srcwidth, 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)
|
||||
static void *set_rop_cmd(void *cmdbuf,
|
||||
void *srcaddr,
|
||||
void *destaddr,
|
||||
uint16_t srcwidth,
|
||||
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;
|
||||
uint16_t rv;
|
||||
@ -321,6 +329,7 @@ static void *set_rop_cmd(void *cmdbuf, void *srcaddr, void *destaddr,
|
||||
{
|
||||
return NULL;
|
||||
}
|
||||
|
||||
rh = calc_ratio(srcwidth, destwidth);
|
||||
if (rh == 0)
|
||||
{
|
||||
@ -389,7 +398,7 @@ void imageproc_initialize(void)
|
||||
putreg32(0, ROT_INTR_ENABLE);
|
||||
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);
|
||||
}
|
||||
|
||||
@ -411,7 +420,9 @@ void imageproc_finalize(void)
|
||||
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;
|
||||
|
||||
@ -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,
|
||||
uint16_t ivsize, uint8_t * obuf,
|
||||
uint16_t ohsize, uint16_t ovsize, int bpp)
|
||||
int imageproc_resize(uint8_t * ibuf,
|
||||
uint16_t ihsize,
|
||||
uint16_t ivsize,
|
||||
uint8_t * obuf,
|
||||
uint16_t ohsize,
|
||||
uint16_t ovsize,
|
||||
int bpp)
|
||||
{
|
||||
void *cmd = g_gcmdbuf;
|
||||
size_t len;
|
||||
@ -497,7 +512,8 @@ int imageproc_resize(uint8_t * ibuf, uint16_t ihsize,
|
||||
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;
|
||||
}
|
||||
@ -510,8 +526,19 @@ int imageproc_resize(uint8_t * ibuf, uint16_t ihsize,
|
||||
|
||||
/* Create descriptor to graphics engine */
|
||||
|
||||
cmd = set_rop_cmd(cmd, ibuf, obuf, ihsize, ivsize, ihsize,
|
||||
ohsize, ovsize, ohsize, bpp, SRCCOPY, FIXEDCOLOR, 0x0080);
|
||||
cmd = set_rop_cmd(cmd,
|
||||
ibuf,
|
||||
obuf,
|
||||
ihsize,
|
||||
ivsize,
|
||||
ihsize,
|
||||
ohsize,
|
||||
ovsize,
|
||||
ohsize,
|
||||
bpp,
|
||||
SRCCOPY,
|
||||
FIXEDCOLOR,
|
||||
0x0080);
|
||||
if (cmd == NULL)
|
||||
{
|
||||
ip_semgive(&g_geexc);
|
||||
@ -537,10 +564,14 @@ int imageproc_resize(uint8_t * ibuf, uint16_t ihsize,
|
||||
return 0;
|
||||
}
|
||||
|
||||
int imageproc_clip_and_resize(uint8_t * ibuf, uint16_t ihsize,
|
||||
uint16_t ivsize, uint8_t * obuf,
|
||||
uint16_t ohsize, uint16_t ovsize,
|
||||
int bpp, imageproc_rect_t * clip_rect)
|
||||
int imageproc_clip_and_resize(uint8_t * ibuf,
|
||||
uint16_t ihsize,
|
||||
uint16_t ivsize,
|
||||
uint8_t * obuf,
|
||||
uint16_t ohsize,
|
||||
uint16_t ovsize,
|
||||
int bpp,
|
||||
imageproc_rect_t * clip_rect)
|
||||
{
|
||||
void *cmd = g_gcmdbuf;
|
||||
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->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;
|
||||
}
|
||||
@ -589,8 +621,8 @@ int imageproc_clip_and_resize(uint8_t * ibuf, uint16_t ihsize,
|
||||
}
|
||||
|
||||
pix_bytes = bpp >> 3;
|
||||
ibuf =
|
||||
ibuf + (clip_rect->x1 * pix_bytes + clip_rect->y1 * ihsize * pix_bytes);
|
||||
ibuf = ibuf + (clip_rect->x1 * pix_bytes +
|
||||
clip_rect->y1 * ihsize * pix_bytes);
|
||||
}
|
||||
else
|
||||
{
|
||||
@ -599,6 +631,7 @@ int imageproc_clip_and_resize(uint8_t * ibuf, uint16_t ihsize,
|
||||
{
|
||||
return -EINVAL;
|
||||
}
|
||||
|
||||
clip_width = ihsize;
|
||||
clip_height = ivsize;
|
||||
}
|
||||
@ -611,9 +644,19 @@ int imageproc_clip_and_resize(uint8_t * ibuf, uint16_t ihsize,
|
||||
|
||||
/* Create descriptor to graphics engine */
|
||||
|
||||
cmd = set_rop_cmd(cmd, ibuf, obuf,
|
||||
clip_width, clip_height, ihsize,
|
||||
ohsize, ovsize, ohsize, bpp, SRCCOPY, FIXEDCOLOR, 0x0080);
|
||||
cmd = set_rop_cmd(cmd,
|
||||
ibuf,
|
||||
obuf,
|
||||
clip_width,
|
||||
clip_height,
|
||||
ihsize,
|
||||
ohsize,
|
||||
ovsize,
|
||||
ohsize,
|
||||
bpp,
|
||||
SRCCOPY,
|
||||
FIXEDCOLOR,
|
||||
0x0080);
|
||||
|
||||
if (cmd == NULL)
|
||||
{
|
||||
|
@ -56,6 +56,10 @@
|
||||
# define KX022_FIFO_CNT 1
|
||||
#endif
|
||||
|
||||
/****************************************************************************
|
||||
* Public Functions
|
||||
****************************************************************************/
|
||||
|
||||
#ifdef CONFIG_SENSORS_KX022_SCU
|
||||
int board_kx022_initialize(FAR const char *devpath, int bus)
|
||||
{
|
||||
|
@ -50,6 +50,10 @@
|
||||
|
||||
#include "cxd56_i2c.h"
|
||||
|
||||
/****************************************************************************
|
||||
* Public Functions
|
||||
****************************************************************************/
|
||||
|
||||
#ifdef CONFIG_SENSORS_LT1PA01_SCU
|
||||
int board_lt1pa01_initialize(int bus)
|
||||
{
|
||||
|
@ -50,6 +50,10 @@
|
||||
|
||||
#include "cxd56_i2c.h"
|
||||
|
||||
/****************************************************************************
|
||||
* Public Functions
|
||||
****************************************************************************/
|
||||
|
||||
#ifdef CONFIG_SENSORS_RPR0521RS_SCU
|
||||
int board_rpr0521rs_initialize(int bus)
|
||||
{
|
||||
|
@ -166,9 +166,9 @@
|
||||
#define _I2C_DEVICE_WOPATH(_name) _DEVICE_WOPATH(_name, SENSOR_I2C)
|
||||
#define _SPI_DEVICE_WOPATH(_name) _DEVICE_WOPATH(_name, SENSOR_SPI)
|
||||
|
||||
/************************************************************************************
|
||||
/****************************************************************************
|
||||
* Private Types
|
||||
************************************************************************************/
|
||||
****************************************************************************/
|
||||
|
||||
typedef int (*_init_t)(int bus);
|
||||
typedef int (*_initdev_t)(FAR const char *devpath, int bus);
|
||||
@ -278,7 +278,8 @@ int board_sensors_initialize(void)
|
||||
|
||||
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);
|
||||
}
|
||||
}
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user