Merge commit '2e43815c929acb818b34a5ff8828494b0c6f6891' into dev

Change-Id: Idcbac12fec435abff01cfb4efd5a26a02eb08f93
This commit is contained in:
Xiang Xiao
2021-07-13 00:55:36 +08:00
3728 changed files with 185024 additions and 40147 deletions
+2 -1
View File
@@ -39,6 +39,7 @@
#include <nuttx/config.h>
#include <assert.h>
#include <errno.h>
#include <debug.h>
#include <string.h>
@@ -541,7 +542,7 @@ int onewire_search(FAR struct onewire_master_s *master,
DEBUGASSERT(master->insearch == false);
/* Make complete search on the bus mutal exlusive */
/* Make complete search on the bus mutal exclusive */
ret = onewire_sem_wait(master);
if (ret < 0)
+1 -1
View File
@@ -81,7 +81,7 @@ struct onewire_slave_s
* Public Function Prototypes
****************************************************************************/
/* Aditional CRC helpers from 1wire_crc.c */
/* Additional CRC helpers from 1wire_crc.c */
bool onewire_valid_rom(uint64_t rom);
+1
View File
@@ -39,6 +39,7 @@
#include <nuttx/config.h>
#include <assert.h>
#include <errno.h>
#include <debug.h>
#include <string.h>
+2 -2
View File
@@ -68,7 +68,7 @@ void simple_addrenv_initialize(FAR const struct simple_addrenv_s *addrenv)
FAR void *up_addrenv_pa_to_va(uintptr_t pa)
{
FAR struct simple_addrenv_node_s *node;
FAR struct simple_addrenv_s *addrenv;
FAR const struct simple_addrenv_s *addrenv;
uint32_t i;
list_for_every_entry(&g_addrenv_list, node,
@@ -91,7 +91,7 @@ FAR void *up_addrenv_pa_to_va(uintptr_t pa)
uintptr_t up_addrenv_va_to_pa(FAR void *va_)
{
FAR struct simple_addrenv_node_s *node;
FAR struct simple_addrenv_s *addrenv;
FAR const struct simple_addrenv_s *addrenv;
uintptr_t va = C2B((uintptr_t)va_);
uint32_t i;
+34 -1
View File
@@ -52,6 +52,7 @@
#include <unistd.h>
#include <string.h>
#include <fcntl.h>
#include <assert.h>
#include <errno.h>
#include <debug.h>
@@ -71,6 +72,7 @@ static int adc_close(FAR struct file *filep);
static ssize_t adc_read(FAR struct file *fielp, FAR char *buffer,
size_t buflen);
static int adc_ioctl(FAR struct file *filep, int cmd, unsigned long arg);
static int adc_reset(FAR struct adc_dev_s *dev);
static int adc_receive(FAR struct adc_dev_s *dev, uint8_t ch,
int32_t data);
static void adc_notify(FAR struct adc_dev_s *dev);
@@ -97,7 +99,8 @@ static const struct file_operations g_adc_fops =
static const struct adc_callback_s g_adc_callback =
{
adc_receive /* au_receive */
adc_receive, /* au_receive */
adc_reset /* au_reset */
};
/****************************************************************************
@@ -157,6 +160,10 @@ static int adc_open(FAR struct file *filep)
dev->ad_recv.af_head = 0;
dev->ad_recv.af_tail = 0;
/* Clear overrun indicator */
dev->ad_isovr = false;
/* Finally, Enable the ADC RX interrupt */
dev->ad_ops->ao_rxint(dev, true);
@@ -279,6 +286,15 @@ static ssize_t adc_read(FAR struct file *filep, FAR char *buffer,
flags = enter_critical_section();
while (dev->ad_recv.af_head == dev->ad_recv.af_tail)
{
/* Check if there was an overrun, if set we need to return EIO */
if (dev->ad_isovr)
{
dev->ad_isovr = false;
ret = -EIO;
goto return_with_irqdisabled;
}
/* The receive FIFO is empty -- was non-blocking mode selected? */
if (filep->f_oflags & O_NONBLOCK)
@@ -419,6 +435,23 @@ static int adc_ioctl(FAR struct file *filep, int cmd, unsigned long arg)
return ret;
}
/****************************************************************************
* Name: adc_reset
****************************************************************************/
static int adc_reset(FAR struct adc_dev_s *dev)
{
/* Set overrun flag to give read a chance to recover */
dev->ad_isovr = true;
/* No need to notify here. The adc_receive callback will be called next.
* If an ADC overrun occurs then there must be at least one conversion.
*/
return OK;
}
/****************************************************************************
* Name: adc_receive
****************************************************************************/
+1
View File
@@ -27,6 +27,7 @@
#include <stdlib.h>
#include <stdbool.h>
#include <fixedmath.h>
#include <assert.h>
#include <errno.h>
#include <debug.h>
+1
View File
@@ -28,6 +28,7 @@
#include <stdint.h>
#include <unistd.h>
#include <fcntl.h>
#include <assert.h>
#include <errno.h>
#include <debug.h>
#include <poll.h>
+1
View File
@@ -49,6 +49,7 @@
#include <sys/types.h>
#include <stdint.h>
#include <stdbool.h>
#include <assert.h>
#include <errno.h>
#include <debug.h>
+1
View File
@@ -48,6 +48,7 @@
#include <sys/types.h>
#include <stdint.h>
#include <stdbool.h>
#include <assert.h>
#include <errno.h>
#include <debug.h>
+1
View File
@@ -28,6 +28,7 @@
#include <sys/types.h>
#include <stdint.h>
#include <stdbool.h>
#include <assert.h>
#include <errno.h>
#include <debug.h>
+4
View File
@@ -23,6 +23,10 @@
****************************************************************************/
#include <nuttx/config.h>
#include <assert.h>
#include <debug.h>
#include <nuttx/audio/audio.h>
#include <nuttx/audio/i2s.h>
#include <nuttx/kmalloc.h>
+1
View File
@@ -32,6 +32,7 @@
#include <inttypes.h>
#include <fcntl.h>
#include <string.h>
#include <assert.h>
#include <errno.h>
#include <queue.h>
#include <debug.h>
+1
View File
@@ -32,6 +32,7 @@
#include <stdio.h>
#include <fcntl.h>
#include <string.h>
#include <assert.h>
#include <errno.h>
#include <fixedmath.h>
#include <queue.h>
+13 -28
View File
@@ -1,36 +1,20 @@
/****************************************************************************
* drivers/audio/cs43l22.c
* Audio device driver for Cirrus logic CS43L22 Audio codec.
*
* Copyright (C) 2017-2018 Gregory Nutt. All rights reserved.
* Author: Taras Drozdovskiy <t.drozdovskiy@gmail.com>
* Licensed to the Apache Software Foundation (ASF) under one or more
* contributor license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright ownership. The
* ASF licenses this file to you under the Apache License, Version 2.0 (the
* "License"); you may not use this file except in compliance with the
* License. You may obtain a copy of the License at
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
* http://www.apache.org/licenses/LICENSE-2.0
*
* 1. Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in
* the documentation and/or other materials provided with the
* distribution.
* 3. Neither the name NuttX nor the names of its contributors may be
* used to endorse or promote products derived from this software
* without specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
* FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
* COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
* INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
* BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
* OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
* AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
* ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
* POSSIBILITY OF SUCH DAMAGE.
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
* WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
* License for the specific language governing permissions and limitations
* under the License.
*
****************************************************************************/
@@ -48,6 +32,7 @@
#include <stdio.h>
#include <fcntl.h>
#include <string.h>
#include <assert.h>
#include <errno.h>
#include <fixedmath.h>
#include <queue.h>
+12 -28
View File
@@ -1,36 +1,20 @@
/****************************************************************************
* drivers/audio/cs43l22_debug.c
* Audio device driver for Cirrus Logic CS43L22 Audio codec.
*
* Copyright (C) 2017 Gregory Nutt. All rights reserved.
* Author: Taras Drozdovsky <t.drozdovskiy@gmail.comnuttx.org>
* Licensed to the Apache Software Foundation (ASF) under one or more
* contributor license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright ownership. The
* ASF licenses this file to you under the Apache License, Version 2.0 (the
* "License"); you may not use this file except in compliance with the
* License. You may obtain a copy of the License at
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
* http://www.apache.org/licenses/LICENSE-2.0
*
* 1. Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in
* the documentation and/or other materials provided with the
* distribution.
* 3. Neither the name NuttX nor the names of its contributors may be
* used to endorse or promote products derived from this software
* without specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
* FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
* COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
* INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
* BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
* OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
* AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
* ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
* POSSIBILITY OF SUCH DAMAGE.
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
* WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
* License for the specific language governing permissions and limitations
* under the License.
*
****************************************************************************/
+5 -3
View File
@@ -22,6 +22,8 @@
* Included Files
****************************************************************************/
#include <assert.h>
#include <debug.h>
#include <errno.h>
#include <fcntl.h>
#include <math.h>
@@ -39,6 +41,7 @@
#include <arch/board/cxd56_clock.h>
#include <arch/board/board.h>
#include <arch/chip/audio.h>
#include <arch/chip/chip.h>
#include "cxd56.h"
@@ -160,7 +163,6 @@
#define CXD56_DMA_SMP_WAIT_HIRES 10 /* usec per sample. */
#define CXD56_DMA_SMP_WAIT_NORMALT 40 /* usec per sample. */
#define CXD56_DMA_CMD_FIFO_NOT_FULL 1
#define CXD56_DMA_START_ADDR_MASK 0x3fffffff
/****************************************************************************
* Public Function Prototypes
@@ -3223,11 +3225,11 @@ static int cxd56_start_dma(FAR struct cxd56_dev_s *dev)
#ifdef CONFIG_AUDIO_CXD56_SRC
src_apb = (struct ap_buffer_s *) dq_peek(&dev->down_pendq);
addr = ((uint32_t)src_apb->samp) & CXD56_DMA_START_ADDR_MASK;
addr = CXD56_PHYSADDR(src_apb->samp);
size = (src_apb->nbytes / (dev->bitwidth / 8) / dev->channels) - 1;
#else
apb = (struct ap_buffer_s *) dq_peek(&dev->up_pendq);
addr = ((uint32_t)apb->samp) & CXD56_DMA_START_ADDR_MASK;
addr = CXD56_PHYSADDR(apb->samp);
size = (apb->nbytes / (dev->bitwidth / 8) / dev->channels) - 1;
#endif
+1
View File
@@ -33,6 +33,7 @@
#include <stdio.h>
#include <fcntl.h>
#include <string.h>
#include <assert.h>
#include <debug.h>
#include <errno.h>
#include <queue.h>
+1
View File
@@ -32,6 +32,7 @@
#include <stdio.h>
#include <fcntl.h>
#include <string.h>
#include <assert.h>
#include <errno.h>
#include <fixedmath.h>
#include <queue.h>
+1
View File
@@ -37,6 +37,7 @@
#include <inttypes.h>
#include <fcntl.h>
#include <string.h>
#include <assert.h>
#include <errno.h>
#include <fixedmath.h>
#include <queue.h>
+1
View File
@@ -31,6 +31,7 @@
#include <stdio.h>
#include <fcntl.h>
#include <string.h>
#include <assert.h>
#include <errno.h>
#include <fixedmath.h>
#include <queue.h>
+13 -29
View File
@@ -1,37 +1,20 @@
/****************************************************************************
* drivers/can/mcp2515.c
*
* Copyright (C) 2017, 2019 Gregory Nutt. All rights reserved.
* Copyright (C) 2017 Alan Carvalho de Assis. All rights reserved.
* Author: Alan Carvalho de Assis <acassis@gmail.com>
* Modified: Ben <disruptivesolutionsnl@gmail.com>
* Licensed to the Apache Software Foundation (ASF) under one or more
* contributor license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright ownership. The
* ASF licenses this file to you under the Apache License, Version 2.0 (the
* "License"); you may not use this file except in compliance with the
* License. You may obtain a copy of the License at
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
* http://www.apache.org/licenses/LICENSE-2.0
*
* 1. Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in
* the documentation and/or other materials provided with the
* distribution.
* 3. Neither the name NuttX, Atmel, nor the names of its contributors may
* be used to endorse or promote products derived from this software
* without specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
* FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
* COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
* INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
* BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
* OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
* AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
* ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
* POSSIBILITY OF SUCH DAMAGE.
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
* WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
* License for the specific language governing permissions and limitations
* under the License.
*
****************************************************************************/
@@ -47,6 +30,7 @@
#include <stdint.h>
#include <stdbool.h>
#include <string.h>
#include <assert.h>
#include <errno.h>
#include <debug.h>
#include <strings.h>
+1
View File
@@ -35,6 +35,7 @@
#include <stdio.h>
#include <errno.h>
#include <assert.h>
#include <debug.h>
#include <nuttx/kmalloc.h>
#include <nuttx/signal.h>
+1
View File
@@ -77,6 +77,7 @@
#include <stdbool.h>
#include <sys/types.h>
#include <assert.h>
#include <debug.h>
#include <errno.h>
#include <string.h>
+3 -1
View File
@@ -102,6 +102,7 @@
#include <nuttx/config.h>
#include <sys/types.h>
#include <assert.h>
#include <debug.h>
#include <errno.h>
#include <nuttx/fs/fs.h>
@@ -850,7 +851,8 @@ int ee25xx_initialize(FAR struct spi_dev_s *dev, FAR char *devname,
eedev->readonly = !!readonly;
finfo("EEPROM device %s, %d bytes, %d per page, addrlen %d, readonly %d\n",
finfo("EEPROM device %s, %"PRIu32" bytes, "
"%u per page, addrlen %u, readonly %d\n",
devname, eedev->size, eedev->pgsize, eedev->addrlen, eedev->readonly);
return register_driver(devname, &ee25xx_fops, 0666, eedev);
+12 -28
View File
@@ -1,36 +1,20 @@
############################################################################
# drivers/i2c/Make.defs
#
# Copyright (C) 2016, 2018 Gregory Nutt. All rights reserved.
# Author: Gregory Nutt <gnutt@nuttx.org>,
# Giorgio Gross <giorgio.gross@robodev.eu>
# Licensed to the Apache Software Foundation (ASF) under one or more
# contributor license agreements. See the NOTICE file distributed with
# this work for additional information regarding copyright ownership. The
# ASF licenses this file to you under the Apache License, Version 2.0 (the
# "License"); you may not use this file except in compliance with the
# License. You may obtain a copy of the License at
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions
# are met:
# http://www.apache.org/licenses/LICENSE-2.0
#
# 1. Redistributions of source code must retain the above copyright
# notice, this list of conditions and the following disclaimer.
# 2. Redistributions in binary form must reproduce the above copyright
# notice, this list of conditions and the following disclaimer in
# the documentation and/or other materials provided with the
# distribution.
# 3. Neither the name NuttX nor the names of its contributors may be
# used to endorse or promote products derived from this software
# without specific prior written permission.
#
# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
# FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
# COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
# INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
# BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
# OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
# AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
# LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
# ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
# POSSIBILITY OF SUCH DAMAGE.
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
# License for the specific language governing permissions and limitations
# under the License.
#
############################################################################
+1
View File
@@ -24,6 +24,7 @@
#include <nuttx/config.h>
#include <assert.h>
#include <errno.h>
#include <debug.h>
+1
View File
@@ -28,6 +28,7 @@
#include <stdbool.h>
#include <stdio.h>
#include <string.h>
#include <assert.h>
#include <errno.h>
#include <debug.h>
+1
View File
@@ -42,6 +42,7 @@
#include <stdlib.h>
#include <fixedmath.h>
#include <assert.h>
#include <errno.h>
#include <debug.h>
+1
View File
@@ -39,6 +39,7 @@
#include <stdio.h>
#include <fcntl.h>
#include <string.h>
#include <assert.h>
#include <debug.h>
#include <errno.h>
+12 -29
View File
@@ -1,37 +1,20 @@
/****************************************************************************
* drivers/input/ads7843e.c
*
* Copyright (C) 2011-2012, 2014, 2016-2017 Gregory Nutt. All rights
* reserved.
* Authors: Gregory Nutt <gnutt@nuttx.org>
* Diego Sanchez <dsanchez@nx-engineering.com>
* Licensed to the Apache Software Foundation (ASF) under one or more
* contributor license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright ownership. The
* ASF licenses this file to you under the Apache License, Version 2.0 (the
* "License"); you may not use this file except in compliance with the
* License. You may obtain a copy of the License at
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
* http://www.apache.org/licenses/LICENSE-2.0
*
* 1. Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in
* the documentation and/or other materials provided with the
* distribution.
* 3. Neither the name NuttX nor the names of its contributors may be
* used to endorse or promote products derived from this software
* without specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
* FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
* COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
* INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
* BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
* OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
* AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
* ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
* POSSIBILITY OF SUCH DAMAGE.
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
* WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
* License for the specific language governing permissions and limitations
* under the License.
*
****************************************************************************/
+1
View File
@@ -39,6 +39,7 @@
#include <stdbool.h>
#include <string.h>
#include <poll.h>
#include <assert.h>
#include <errno.h>
#include <debug.h>
+1
View File
@@ -35,6 +35,7 @@
#include <stdbool.h>
#include <string.h>
#include <poll.h>
#include <assert.h>
#include <errno.h>
#include <debug.h>
+1
View File
@@ -43,6 +43,7 @@
#include <stdint.h>
#include <string.h>
#include <poll.h>
#include <assert.h>
#include <errno.h>
#include <debug.h>
+1
View File
@@ -39,6 +39,7 @@
#include <stdbool.h>
#include <string.h>
#include <poll.h>
#include <assert.h>
#include <errno.h>
#include <debug.h>
+12 -28
View File
@@ -1,36 +1,20 @@
/****************************************************************************
* drivers/input/max11802.c
*
* Copyright (C) 2011-2012, 2014-2017 Gregory Nutt. All rights reserved.
* Authors: Gregory Nutt <gnutt@nuttx.org>
* Petteri Aimonen <jpa@nx.mail.kapsi.fi>
* Licensed to the Apache Software Foundation (ASF) under one or more
* contributor license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright ownership. The
* ASF licenses this file to you under the Apache License, Version 2.0 (the
* "License"); you may not use this file except in compliance with the
* License. You may obtain a copy of the License at
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
* http://www.apache.org/licenses/LICENSE-2.0
*
* 1. Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in
* the documentation and/or other materials provided with the
* distribution.
* 3. Neither the name NuttX nor the names of its contributors may be
* used to endorse or promote products derived from this software
* without specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
* FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
* COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
* INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
* BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
* OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
* AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
* ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
* POSSIBILITY OF SUCH DAMAGE.
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
* WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
* License for the specific language governing permissions and limitations
* under the License.
*
****************************************************************************/
+12 -28
View File
@@ -1,36 +1,20 @@
/****************************************************************************
* drivers/input/max11802.h
*
* Copyright (C) 2011-2012, 2014 Gregory Nutt. All rights reserved.
* Authors: Gregory Nutt <gnutt@nuttx.org>
* Petteri Aimonen <jpa@nx.mail.kapsi.fi>
* Licensed to the Apache Software Foundation (ASF) under one or more
* contributor license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright ownership. The
* ASF licenses this file to you under the Apache License, Version 2.0 (the
* "License"); you may not use this file except in compliance with the
* License. You may obtain a copy of the License at
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
* http://www.apache.org/licenses/LICENSE-2.0
*
* 1. Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in
* the documentation and/or other materials provided with the
* distribution.
* 3. Neither the name NuttX nor the names of its contributors may be
* used to endorse or promote products derived from this software
* without specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
* FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
* COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
* INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
* BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
* OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
* AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
* ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
* POSSIBILITY OF SUCH DAMAGE.
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
* WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
* License for the specific language governing permissions and limitations
* under the License.
*
****************************************************************************/
+1
View File
@@ -38,6 +38,7 @@
#include <stdbool.h>
#include <string.h>
#include <poll.h>
#include <assert.h>
#include <errno.h>
#include <debug.h>
+1
View File
@@ -26,6 +26,7 @@
#include <stdbool.h>
#include <stdio.h>
#include <assert.h>
#include <debug.h>
#include <errno.h>
#include <poll.h>
+1
View File
@@ -30,6 +30,7 @@
#include <nuttx/config.h>
#include <unistd.h>
#include <assert.h>
#include <errno.h>
#include <debug.h>
+44
View File
@@ -14,6 +14,50 @@ config IOEXPANDER
if IOEXPANDER
config IOEXPANDER_MCP23X17
bool "MCP23017/MCP23S17 I2C/SPI IO expander"
default n
depends on I2C
---help---
Enable support for the MCP23017/MCP23S17 IO Expander
if IOEXPANDER_MCP23X17
config MCP23X17_MULTIPLE
bool "Multiple MCP23x17 Devices"
default n
---help---
Can be defined to support multiple MCP23x17 devices on board.
config MCP23X17_INT_ENABLE
bool "Enable MCP23x17 Interrupt Support"
default n
select IOEXPANDER_INT_ENABLE
---help---
Enable driver interrupt functionality
config MCP23X17_INT_NCALLBACKS
int "Max number of interrupt callbacks"
default 4
depends on MCP23X17_INT_ENABLE
---help---
This is the maximum number of interrupt callbacks supported
config MCP23X17_INT_POLL
bool "Enable interrupt poll"
default n
---help---
Enable polling for missed interrupts.
config MCP23X17_INT_POLLDELAY
int "Interrupt poll delay (used)"
default 500000
depends on MCP23X17_INT_POLL
---help---
This microsecond delay defines the polling rate for missed interrupts.
endif # IOEXPANDER_MCP23X17
config IOEXPANDER_PCA9555
bool "PCA9555 I2C IO expander"
default n
+4
View File
@@ -40,6 +40,10 @@ ifeq ($(CONFIG_IOEXPANDER_PCF8574),y)
CSRCS += pcf8574.c
endif
ifeq ($(CONFIG_IOEXPANDER_MCP23X17),y)
CSRCS += mcp23x17.c
endif
endif # CONFIG_IOEXPANDER
# GPIO test device driver (independent of IOEXPANDERS)
+1
View File
@@ -29,6 +29,7 @@
#include <string.h>
#include <signal.h>
#include <assert.h>
#include <debug.h>
#include <errno.h>
#include <unistd.h>
+1
View File
@@ -26,6 +26,7 @@
#include <sys/types.h>
#include <assert.h>
#include <debug.h>
#include <errno.h>
#include <nuttx/kmalloc.h>
File diff suppressed because it is too large Load Diff
+175
View File
@@ -0,0 +1,175 @@
/****************************************************************************
* drivers/ioexpander/mcp23x17.h
*
* Licensed to the Apache Software Foundation (ASF) under one or more
* contributor license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright ownership. The
* ASF licenses this file to you under the Apache License, Version 2.0 (the
* "License"); you may not use this file except in compliance with the
* License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
* WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
* License for the specific language governing permissions and limitations
* under the License.
*
****************************************************************************/
#ifndef __DRIVERS_IOEXPANDER_MCP23X17_H
#define __DRIVERS_IOEXPANDER_MCP23X17_H
/****************************************************************************
* Included Files
****************************************************************************/
#include <nuttx/config.h>
#include <nuttx/wdog.h>
#include <nuttx/clock.h>
#include <nuttx/semaphore.h>
#include <nuttx/wqueue.h>
#include <nuttx/ioexpander/ioexpander.h>
#include <nuttx/ioexpander/mcp23x17.h>
#include <nuttx/i2c/i2c_master.h>
#include <nuttx/irq.h>
#if defined(CONFIG_IOEXPANDER) && defined(CONFIG_IOEXPANDER_MCP23X17)
/****************************************************************************
* Pre-processor Definitions
****************************************************************************/
/* Configuration ************************************************************/
/* Prerequisites:
* CONFIG_I2C
* I2C support is required
* CONFIG_IOEXPANDER
* Enables I/O expander support
*
* CONFIG_IOEXPANDER_MCP23X17
* Enables support for the MCP23X17 driver (Needs CONFIG_INPUT)
* CONFIG_MCP23X17_MULTIPLE
* Can be defined to support multiple MCP23X17 devices on board.
* CONFIG_MCP23X17_INT_NCALLBACKS
* Maximum number of supported pin interrupt callbacks.
* CONFIG_MCP23X17_INT_POLL
* Enables a poll for missed interrupts
* CONFIG_MCP23X17_INT_POLLDELAY
* If CONFIG_MCP23X17_INT_POLL=y, then this is the delay in microseconds
* between polls for missed interrupts.
*/
#ifndef CONFIG_I2C
# error "CONFIG_I2C is required by MCP23X17"
#endif
#ifdef CONFIG_IOEXPANDER_INT_ENABLE
# ifndef CONFIG_MCP23X17_INT_NCALLBACKS
# define CONFIG_MCP23X17_INT_NCALLBACKS 4
# endif
#endif
#ifdef CONFIG_IOEXPANDER_INT_ENABLE
# ifndef CONFIG_SCHED_WORKQUEUE
# error Work queue support required. CONFIG_SCHED_WORKQUEUE must be selected.
# endif
#endif
#ifndef CONFIG_MCP23X17_INT_POLLDELAY
# define CONFIG_MCP23X17_INT_POLLDELAY 500000
#endif
/* MCP23X17 Definitions *****************************************************/
/* I2C frequency */
#define MCP23X17_I2C_MAXFREQUENCY 400000 /* 400KHz */
/* MCP23X17 *****************************************************************/
/* If IOCON.BANK = 0 Addressing Mode */
#define MCP23X17_IODIRA 0x00
#define MCP23X17_IODIRB 0x01
#define MCP23X17_IPOLA 0x02
#define MCP23X17_IPOLB 0x03
#define MCP23X17_GPINTENA 0x04
#define MCP23X17_GPINTENB 0x05
#define MCP23X17_DEFVALA 0x06
#define MCP23X17_DEFVALB 0x07
#define MCP23X17_INTCONA 0x08
#define MCP23X17_INTCONB 0x09
#define MCP23X17_IOCON 0x0a
#define MCP23X17_IOCON_2 0x0b
#define MCP23X17_GPPUA 0x0c
#define MCP23X17_GPPUB 0x0d
#define MCP23X17_INTFA 0x0e
#define MCP23X17_INTFB 0x0f
#define MCP23X17_INTCAPA 0x10
#define MCP23X17_INTCAPB 0x11
#define MCP23X17_GPIOA 0x12
#define MCP23X17_GPIOB 0x13
#define MCP23X17_OLATA 0x14
#define MCP23X17_OLATB 0x15
#define MCP23X17_IOCON_INTPOL (1 << 1) /* Polarity of INT output pin */
#define MCP23X17_IOCON_ODR (1 << 2) /* Config INT pin as open-drain */
#define MCP23X17_IOCON_HAEN (1 << 3) /* HW Address enable bit */
#define MCP23X17_IOCON_DISSLW (1 << 4) /* Disable Slew Rate for SDA output */
#define MCP23X17_IOCON_SEQOP (1 << 5) /* Disable Sequencial Operation */
#define MCP23X17_IOCON_MIRROR (1 << 6) /* Mirror INT pins */
#define MCP23X17_IOCON_BANK (1 << 7) /* Configure how to address register */
#define MCP23X17_NR_GPIO_MAX 16
#define MCP23X17_POLLDELAY (CONFIG_MCP23X17_INT_POLLDELAY / USEC_PER_TICK)
/****************************************************************************
* Public Types
****************************************************************************/
#ifdef CONFIG_IOEXPANDER_INT_ENABLE
/* This type represents on registered pin interrupt callback */
struct mcp23x17_callback_s
{
ioe_pinset_t pinset; /* Set of pin interrupts that will generate
* the callback. */
ioe_callback_t cbfunc; /* The saved callback function pointer */
FAR void *cbarg; /* Callback argument */
};
#endif
/* This structure represents the state of the MCP23X17 driver */
struct mcp23x17_dev_s
{
struct ioexpander_dev_s dev; /* Nested structure to allow casting
* as public gpio expander.
*/
FAR struct mcp23x17_config_s *config; /* Board configuration data */
FAR struct i2c_master_s *i2c; /* Saved I2C driver instance */
sem_t exclsem; /* Mutual exclusion */
#ifdef CONFIG_IOEXPANDER_INT_ENABLE
#ifdef CONFIG_MCP23X17_INT_POLL
struct wdog_s wdog; /* Timer used to poll for missed interrupts */
#endif
ioe_pinset_t input; /* Last input registers */
ioe_pinset_t intstat; /* Pending interrupts */
struct work_s work; /* Supports the interrupt handling "bottom half" */
/* Saved callback information for each I/O expander client */
struct mcp23x17_callback_s cb[CONFIG_MCP23X17_INT_NCALLBACKS];
#endif
};
#endif /* CONFIG_IOEXPANDER && CONFIG_IOEXPANDER_MCP23X17 */
#endif /* __DRIVERS_IOEXPANDER_MCP23X17_H */
+1 -1
View File
@@ -814,7 +814,7 @@ static int pca9555_detach(FAR struct ioexpander_dev_s *dev, FAR void *handle)
DEBUGASSERT(pca != NULL && cb != NULL);
DEBUGASSERT((uintptr_t)cb >= (uintptr_t)&pca->cb[0] &&
(uintptr_t)cb <=
(uintptr_t)&pca->cb[CONFIG_TCA64XX_INT_NCALLBACKS - 1]);
(uintptr_t)&pca->cb[CONFIG_PCA9555_INT_NCALLBACKS - 1]);
UNUSED(pca);
cb->pinset = 0;
+30
View File
@@ -1451,6 +1451,36 @@ config LCD_ST7032
connected to a pull-up resistor and the pin SHLC is connected to
the ground. So only I2C pins SDA and SCL are used by NuttX.
config LCD_HT16K33
bool "Holtek HT16K32 4 Digits 14-Segment Display"
default n
depends on I2C
---help---
Enable support for Holtek HT16K33 (and Vinka VK16K33) 4 Digits
14-Segment module: 0.54" 14-segment LED HT16K32 Backpack.
if LCD_HT16K33
config LCD_HT16K33_MULT_MODULE
bool "Enable support to multiple modules as a single display"
default n
depends on I2C
---help---
It is possible to connect many HT16K33 modules with sequential
I2C addresses to work as a single display to support length
text strings. The device at the I2C address 0x70 will display the
4 more significant characters, the device 0x71 will display the
previous 4 more significant characters and so on.
config LCD_HT16K33_NUMBER_MODULES
int "Quantity of HT16K33 modules to be used as a single display"
range 1 8
depends on LCD_HT16K33_MULT_MODULE
---help---
Quantity of sequential modules to be used to create a single
display. We can have up to 8 to I2C Addresses: 0x70 - 0x77.
endif # LCD_HT16K33
endif # SLCD
comment "Other LCD-related Devices"
+4
View File
@@ -146,6 +146,10 @@ endif
ifeq ($(CONFIG_LCD_ST7032),y)
CSRCS += st7032.c
endif
ifeq ($(CONFIG_LCD_HT16K33),y)
CSRCS += ht16k33_14seg.c
endif
endif # CONFIG_SLCD
# Other LCD-related devices
+1
View File
@@ -42,6 +42,7 @@
#include <stdint.h>
#include <stdbool.h>
#include <string.h>
#include <assert.h>
#include <errno.h>
#include <debug.h>
+1
View File
@@ -26,6 +26,7 @@
#include <inttypes.h>
#include <unistd.h>
#include <assert.h>
#include <errno.h>
#include <debug.h>

Some files were not shown because too many files have changed in this diff Show More