[PR] Esp32 openeth [nuttx]

2024-03-11 Thread via GitHub


casaroli opened a new pull request, #11895:
URL: https://github.com/apache/nuttx/pull/11895

   ## Summary
   
   Adds the ESP32 Opencores ethernet driver for use with QEMU emulation.
   
   ## Impact
   
   Now networking can be achieved with QEMU with the new driver
   
   ## Testing
   
   Manually run QEMU as described in the documentation.
   


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscr...@nuttx.apache.org

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org



Re: [I] undefined reference to `arm_serialinit' [nuttx]

2024-03-11 Thread via GitHub


nimish commented on issue #7856:
URL: https://github.com/apache/nuttx/issues/7856#issuecomment-1989438814

   This happens if no uart is enabled. Enable UART0 and it'll pull in the right 
files.


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscr...@nuttx.apache.org

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org



Re: [PR] drivers/can/sja1000: Add SJA1000 CAN driver support [nuttx]

2024-03-11 Thread via GitHub


radek-pesina commented on code in PR #11868:
URL: https://github.com/apache/nuttx/pull/11868#discussion_r1520546877


##
drivers/can/Kconfig:
##
@@ -193,4 +193,44 @@ config MCP2515_SPI_SCK_FREQUENCY
 
 endif # CAN_MCP2515
 
-endif
+menuconfig CAN_SJA1000
+   tristate "Philips/NXP SJA1000 devices"
+
+if CAN_SJA1000
+
+config CAN_SJA1000_BITRATE
+   int "SJA1000 bitrate"
+   default 100
+   ---help---
+   SJA1000 bit rate.
+
+config CAN_SJA1000_SJW
+   int "SJA1000 Synchronization Jump Width"
+   default 1
+   range 1 4
+   ---help---
+   The duration of a synchronization jump is SJW.
+
+config CAN_SJA1000_SAM
+   bool "The CAN bus is sampled 3 times"
+   default false
+   ---help---
+   Recommended for low to medium speed buses
+   to filter spikes on the bus-line.
+
+config CAN_SJA1000_SAMPLEP
+   int "SJA1000 CAN sample point (Percentage)"
+   default 87
+   range 0 100
+

Review Comment:
   This is carrying-over the existing TWAI method of calculating bitrate, where 
instead of defining Propagation Delay, Phase Segment 1, Phase Segment 2 and 
Sync Jump Width to determine the sample point, the values of TSEG1 and TSEG 2 
are automatically calculated based on SJW, sample point and the requested baud 
rate.  They both achieve the same function, but one is programatically while 
the other is a more explicit setting of each parameter (e.g. setting PD, PS1, 
PS2 and SJW determines the resulting sample point, else by defining the sample 
point and SJW you can determine PD, PS1 and PS2).  Happy to go either way.  Let 
me know your thoughts.



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscr...@nuttx.apache.org

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org



Re: [PR] drivers/can/sja1000: Add SJA1000 CAN driver support [nuttx]

2024-03-11 Thread via GitHub


radek-pesina commented on code in PR #11868:
URL: https://github.com/apache/nuttx/pull/11868#discussion_r1520546877


##
drivers/can/Kconfig:
##
@@ -193,4 +193,44 @@ config MCP2515_SPI_SCK_FREQUENCY
 
 endif # CAN_MCP2515
 
-endif
+menuconfig CAN_SJA1000
+   tristate "Philips/NXP SJA1000 devices"
+
+if CAN_SJA1000
+
+config CAN_SJA1000_BITRATE
+   int "SJA1000 bitrate"
+   default 100
+   ---help---
+   SJA1000 bit rate.
+
+config CAN_SJA1000_SJW
+   int "SJA1000 Synchronization Jump Width"
+   default 1
+   range 1 4
+   ---help---
+   The duration of a synchronization jump is SJW.
+
+config CAN_SJA1000_SAM
+   bool "The CAN bus is sampled 3 times"
+   default false
+   ---help---
+   Recommended for low to medium speed buses
+   to filter spikes on the bus-line.
+
+config CAN_SJA1000_SAMPLEP
+   int "SJA1000 CAN sample point (Percentage)"
+   default 87
+   range 0 100
+

Review Comment:
   This is carrying-over the existing TWAI method of calculating bitrate, where 
instead of defining Propagation Delay, Phase Segment 1, Phase Segment 2 and 
Sync Jump Width to determine the baud rate, the values of TSEG1 and TSEG 2 are 
automatically calculated based on SJW, sample point and the requested baud 
rate.  They both achieve the same function, but one is programatically while 
the other is a more explicit setting of each parameter (e.g. setting PD, PS1, 
PS2 and SJW determines the resulting sample point, else by defining the sample 
point and SJW you can determine PD, PS1 and PS2).  Happy to go either way.  Let 
me know your thoughts.



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscr...@nuttx.apache.org

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org



Re: [PR] libs/libc/string: fix memmem() boundary case when needle is at end of haystack [nuttx]

2024-03-11 Thread via GitHub


PetteriAimonen commented on PR #11889:
URL: https://github.com/apache/nuttx/pull/11889#issuecomment-1989216435

   I have run into some NuttX libc bugs before (which have since been fixed), 
so I think it would be a good idea to incorporate some established libc test 
suite. 


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscr...@nuttx.apache.org

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org



Re: [PR] ostest: add test for libc memmem() function [nuttx-apps]

2024-03-11 Thread via GitHub


acassis commented on PR #2327:
URL: https://github.com/apache/nuttx-apps/pull/2327#issuecomment-1989067493

   Is if failing because chicken-egg CI test:
   ```
   /usr/bin/ld: nuttx.rel: in function `user_main':
   /github/workspace/sources/apps/testing/ostest/ostest_main.c:266: undefined 
reference to `memmem_test'
   ```


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscr...@nuttx.apache.org

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org



Re: [PR] libs/libc/string: fix memmem() boundary case when needle is at end of haystack [nuttx]

2024-03-11 Thread via GitHub


acassis commented on PR #11889:
URL: https://github.com/apache/nuttx/pull/11889#issuecomment-1989150999

   @xiaoxiang781216 but libc-test is focused on musl and probably only tested 
on NuttX and it is not integrated on NuttX. Also that project seems very 
inactive (one commit per year).
   


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscr...@nuttx.apache.org

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org



Re: [PR] drivers/can/sja1000: Add SJA1000 CAN driver support [nuttx]

2024-03-11 Thread via GitHub


radek-pesina commented on code in PR #11868:
URL: https://github.com/apache/nuttx/pull/11868#discussion_r1520546877


##
drivers/can/Kconfig:
##
@@ -193,4 +193,44 @@ config MCP2515_SPI_SCK_FREQUENCY
 
 endif # CAN_MCP2515
 
-endif
+menuconfig CAN_SJA1000
+   tristate "Philips/NXP SJA1000 devices"
+
+if CAN_SJA1000
+
+config CAN_SJA1000_BITRATE
+   int "SJA1000 bitrate"
+   default 100
+   ---help---
+   SJA1000 bit rate.
+
+config CAN_SJA1000_SJW
+   int "SJA1000 Synchronization Jump Width"
+   default 1
+   range 1 4
+   ---help---
+   The duration of a synchronization jump is SJW.
+
+config CAN_SJA1000_SAM
+   bool "The CAN bus is sampled 3 times"
+   default false
+   ---help---
+   Recommended for low to medium speed buses
+   to filter spikes on the bus-line.
+
+config CAN_SJA1000_SAMPLEP
+   int "SJA1000 CAN sample point (Percentage)"
+   default 87
+   range 0 100
+

Review Comment:
   This is carrying-over the existing TWAI method of calculating bitrate, where 
instead of defining Propagation Delay, Phase Segment 1, Phase Segment 2 and 
Sync Jump Width to determine the sample point, the values of TSEG1 and TSEG 2 
are automatically calculated based on SJW, sample point and the requested baud 
rate.  They both achieve the same function, but one is programatically while 
the other is a more explicit setting of each parameter (e.g. setting PD, PS1, 
PS2 and SJW determines the resulting sample point, else by defining the sample 
point and SJW you can determine the closest values for PD, PS1 and PS2) to 
achieve the requested sample point.  Happy to go either way.  Let me know your 
thoughts.



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscr...@nuttx.apache.org

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org



Re: [PR] drivers/video: Update unlink() and video_uninitialize() operation [nuttx]

2024-03-11 Thread via GitHub


SPRESENSE commented on PR #11008:
URL: https://github.com/apache/nuttx/pull/11008#issuecomment-1989855041

   @xiaoxiang781216 @Donny9  Thank you for information. I verified that work 
well with #11892 without my change. I withdraw this PR.


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscr...@nuttx.apache.org

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org



Re: [PR] revise comments and harden nx_mount logic [nuttx]

2024-03-11 Thread via GitHub


xiaoxiang781216 commented on code in PR #11896:
URL: https://github.com/apache/nuttx/pull/11896#discussion_r1520870616


##
fs/mount/fs_mount.c:
##
@@ -293,7 +293,7 @@ int nx_mount(FAR const char *source, FAR const char *target,
 
   /* Find the specified filesystem. Try the block driver filesystems first */
 
-  if (source != NULL &&
+  if (source != NULL && strlen(source) > 0 &&

Review Comment:
   It's better than strlen



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscr...@nuttx.apache.org

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org



Re: [PR] revise comments and harden nx_mount logic [nuttx]

2024-03-11 Thread via GitHub


xiaoxiang781216 commented on code in PR #11896:
URL: https://github.com/apache/nuttx/pull/11896#discussion_r1520722098


##
fs/mount/fs_mount.c:
##
@@ -310,7 +310,7 @@ int nx_mount(FAR const char *source, FAR const char *target,
   goto errout_with_inode;
 }
 }
-  else if (source != NULL &&
+  else if (source != NULL && strlen(source) > 0 &&

Review Comment:
   ditto



##
fs/mount/fs_mount.c:
##
@@ -293,7 +293,7 @@ int nx_mount(FAR const char *source, FAR const char *target,
 
   /* Find the specified filesystem. Try the block driver filesystems first */
 
-  if (source != NULL &&
+  if (source != NULL && strlen(source) > 0 &&

Review Comment:
   why need strlen



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscr...@nuttx.apache.org

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org



[PR] xtensa/esp32: Fix wrong interrupt number [nuttx]

2024-03-11 Thread via GitHub


cwespressif opened a new pull request, #11897:
URL: https://github.com/apache/nuttx/pull/11897

   ## Summary
   
   - Fix wrong interrupt number: it should be `ESP32_IRQ_EMAC` instead of 
`priv->cpuint`
   
   ## Impact
   
   ## Testing
   
   


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscr...@nuttx.apache.org

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org



Re: [PR] libs/libc/string: fix memmem() boundary case when needle is at end of haystack [nuttx]

2024-03-11 Thread via GitHub


xiaoxiang781216 commented on PR #11889:
URL: https://github.com/apache/nuttx/pull/11889#issuecomment-1990037212

   > @xiaoxiang781216 but libc-test is focused on musl and probably only tested 
on NuttX and it is not integrated on NuttX. Also that project seems very 
inactive (one commit per year).
   
   It's always good to have more test to verify the implementation of NuttX's 
libc/posix.
   


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscr...@nuttx.apache.org

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org



Re: [PR] revise comments and harden nx_mount logic [nuttx]

2024-03-11 Thread via GitHub


yf13 commented on code in PR #11896:
URL: https://github.com/apache/nuttx/pull/11896#discussion_r1520766100


##
fs/mount/fs_mount.c:
##
@@ -293,7 +293,7 @@ int nx_mount(FAR const char *source, FAR const char *target,
 
   /* Find the specified filesystem. Try the block driver filesystems first */
 
-  if (source != NULL &&
+  if (source != NULL && strlen(source) > 0 &&

Review Comment:
   When source is "" and without this, there are duplicated `mm_free: Freeing 
...` log during my test.  How about using `source[0]!=0` here?



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscr...@nuttx.apache.org

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org



(nuttx-website) branch asf-site updated: Publishing web: f355c37abb2c2dea4b5ff1c582aacf9520a34e3a docs: 63782c7ff277e861aad41e4c43a362304ab615df

2024-03-11 Thread github-bot
This is an automated email from the ASF dual-hosted git repository.

github-bot pushed a commit to branch asf-site
in repository https://gitbox.apache.org/repos/asf/nuttx-website.git


The following commit(s) were added to refs/heads/asf-site by this push:
 new 3bdf9f8d3 Publishing web: f355c37abb2c2dea4b5ff1c582aacf9520a34e3a 
docs: 63782c7ff277e861aad41e4c43a362304ab615df
3bdf9f8d3 is described below

commit 3bdf9f8d365e97b2ade16480663fd4eef027dc53
Author: Tomasz 'CeDeROM' CEDRO 
AuthorDate: Tue Mar 12 00:15:10 2024 +

Publishing web: f355c37abb2c2dea4b5ff1c582aacf9520a34e3a docs: 
63782c7ff277e861aad41e4c43a362304ab615df
---
 content/docs/10.0.0/index.html |   2 +-
 content/docs/10.0.0/searchindex.js |   2 +-
 content/docs/10.0.1/index.html |   2 +-
 content/docs/10.0.1/searchindex.js |   2 +-
 content/docs/10.1.0/index.html |   2 +-
 content/docs/10.1.0/searchindex.js |   2 +-
 content/docs/10.2.0/index.html |   2 +-
 content/docs/10.2.0/searchindex.js |   2 +-
 content/docs/10.3.0/index.html |   2 +-
 content/docs/10.3.0/searchindex.js |   2 +-
 content/docs/11.0.0/index.html |   2 +-
 content/docs/11.0.0/searchindex.js |   2 +-
 content/docs/12.0.0/index.html |   2 +-
 content/docs/12.0.0/searchindex.js |   2 +-
 content/docs/12.1.0/index.html |   2 +-
 content/docs/12.1.0/searchindex.js |   2 +-
 content/docs/12.2.0/index.html |   2 +-
 content/docs/12.2.0/searchindex.js |   2 +-
 content/docs/12.2.1/index.html |   2 +-
 content/docs/12.2.1/searchindex.js |   2 +-
 content/docs/12.3.0/index.html |   2 +-
 content/docs/12.3.0/searchindex.js |   2 +-
 content/docs/12.4.0/index.html |   2 +-
 content/docs/12.4.0/searchindex.js |   2 +-
 .../stm32f4/boards/stm32f401rc-rs485/index.rst.txt |  23 +
 .../esp32c3/boards/esp32c3-generic/index.rst.txt   |  13 +---
 .../platforms/risc-v/esp32c3/index.rst.txt |   2 +-
 .../esp32c6/boards/esp32c6-devkit/index.rst.txt|  13 +---
 .../platforms/risc-v/esp32c6/index.rst.txt |   2 +-
 .../esp32h2/boards/esp32h2-devkit/index.rst.txt|  13 +---
 .../platforms/risc-v/esp32h2/index.rst.txt |   2 +-
 content/docs/latest/index.html |   2 +-
 content/docs/latest/objects.inv| Bin 113647 -> 113659 bytes
 .../stm32f4/boards/stm32f401rc-rs485/index.html|  23 +
 .../esp32c3/boards/esp32c3-generic/index.html  |  13 +---
 .../latest/platforms/risc-v/esp32c3/index.html |   2 +-
 .../esp32c6/boards/esp32c6-devkit/index.html   |  13 +---
 .../latest/platforms/risc-v/esp32c6/index.html |   2 +-
 .../esp32h2/boards/esp32h2-devkit/index.html   |  13 +---
 .../latest/platforms/risc-v/esp32h2/index.html |   2 +-
 content/docs/latest/searchindex.js |   2 +-
 content/feed.xml   |   4 ++--
 42 files changed, 140 insertions(+), 52 deletions(-)

diff --git a/content/docs/10.0.0/index.html b/content/docs/10.0.0/index.html
index 41355f3a7..0a2046bf3 100644
--- a/content/docs/10.0.0/index.html
+++ b/content/docs/10.0.0/index.html
@@ -131,7 +131,7 @@ by following these 
 NuttX Documentation
 NuttX is a real-time operating system (RTOS) with an emphasis on standards 
compliance and small footprint. Scalable from 8-bit to 32-bit microcontroller 
environments, the primary governing standards in NuttX are Posix and ANSI 
standards. Additional standard APIs from Unix and other common RTOS’s (such as 
VxWorks) are adopted for functionality not available under these standards, or 
for functionality that is not appropriate for deeply-embedded environments 
(such as fork()).
-Last Updated: 11 March 24 at 00:10
+Last Updated: 12 March 24 at 00:09
 
 Table of 
Contents
 
diff --git a/content/docs/10.0.0/searchindex.js 
b/content/docs/10.0.0/searchindex.js
index 4040a9e41..1bc09a527 100644
--- a/content/docs/10.0.0/searchindex.js
+++ b/content/docs/10.0.0/searchindex.js
@@ -1 +1 @@
-Search.setIndex({"docnames": ["applications/index", "boards/index", 
"components/binfmt", "components/drivers/block/index", 
"components/drivers/character/analog", "components/drivers/character/can", 
"components/drivers/character/index", "components/drivers/character/keypad", 
"components/drivers/character/pwm", "components/drivers/character/quadrature", 
"components/drivers/character/rtc", "components/drivers/character/serial", 
"components/drivers/character/timer", "components/drivers/chara [...]
\ No newline at end of file
+Search.setIndex({"docnames": 

[PR] revise comments and harden nx_mount logic [nuttx]

2024-03-11 Thread via GitHub


yf13 opened a new pull request, #11896:
URL: https://github.com/apache/nuttx/pull/11896

   ## Summary
   
   This patch contains  improvements to harden logic of nx_mount():
   - currently some variables may not get populated by called functions, thus 
initialization is added.
   - empty string device path is possible when multiple type of file systems 
are enabled.
   
   It also revised comments for mm_heap/mm.h
   
   ## Impact
   
   file system mount operations
   
   ## Testing
   
   Checked with CanMV230
   


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscr...@nuttx.apache.org

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org



Re: [I] Simulator export fails [nuttx]

2024-03-11 Thread via GitHub


xuxin930 commented on issue #11863:
URL: https://github.com/apache/nuttx/issues/11863#issuecomment-1989772048

   hi @acassis @nicolas71640 
   Thank you for your reminder 
   The current CMake base does not support the `import` `export` feat. 
   We considered using `cmake install `during the design, but it is not perfect 
yet.
   
   You can first consider using the Makefile base compilation method.
   
   I will mark an action and try to add this feature of CMake as soon as 
possible.


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscr...@nuttx.apache.org

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org



Re: [I] Can't create new folder on the dialog when vscode.window.showOpenDialog is called on WSL environment. [nuttx]

2024-03-11 Thread via GitHub


takayoshi-k commented on issue #11800:
URL: https://github.com/apache/nuttx/issues/11800#issuecomment-1989892944

   Oh...
   I am sorry...
   I thought I make this issue on VSCode github...
   But thank you for your reply. I will check it..


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscr...@nuttx.apache.org

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org



Re: [PR] revise comments and harden nx_mount logic [nuttx]

2024-03-11 Thread via GitHub


yf13 commented on code in PR #11896:
URL: https://github.com/apache/nuttx/pull/11896#discussion_r1520766100


##
fs/mount/fs_mount.c:
##
@@ -293,7 +293,7 @@ int nx_mount(FAR const char *source, FAR const char *target,
 
   /* Find the specified filesystem. Try the block driver filesystems first */
 
-  if (source != NULL &&
+  if (source != NULL && strlen(source) > 0 &&

Review Comment:
   When source is "" and without this, there are duplicated "mm_free: Freeing 
..." log during my test.



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscr...@nuttx.apache.org

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org



Re: [PR] revise comments and harden nx_mount logic [nuttx]

2024-03-11 Thread via GitHub


yf13 commented on code in PR #11896:
URL: https://github.com/apache/nuttx/pull/11896#discussion_r1520766100


##
fs/mount/fs_mount.c:
##
@@ -293,7 +293,7 @@ int nx_mount(FAR const char *source, FAR const char *target,
 
   /* Find the specified filesystem. Try the block driver filesystems first */
 
-  if (source != NULL &&
+  if (source != NULL && strlen(source) > 0 &&

Review Comment:
   When source is "" and without this, there are duplicated `mm_free: Freeing 
...` log during my test.



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscr...@nuttx.apache.org

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org



Re: [PR] drivers/can/sja1000: Add SJA1000 CAN driver support [nuttx]

2024-03-11 Thread via GitHub


xiaoxiang781216 commented on code in PR #11868:
URL: https://github.com/apache/nuttx/pull/11868#discussion_r1520877050


##
include/nuttx/can/sja1000.h:
##
@@ -0,0 +1,163 @@
+/
+ * include/nuttx/can/sja1000.h
+ *
+ * SJA1000 CAN driver based on esp32c3_twai.h
+ *
+ * License header retained from original source.
+ *
+ * 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_INCLUDE_CAN_SJA1000_H

Review Comment:
   ```suggestion
   #ifndef __INCLUDE_NUTTX_CAN_SJA1000_H
   ```



##
include/nuttx/can/sja1000.h:
##
@@ -0,0 +1,163 @@
+/
+ * include/nuttx/can/sja1000.h
+ *
+ * SJA1000 CAN driver based on esp32c3_twai.h
+ *
+ * License header retained from original source.
+ *
+ * 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_INCLUDE_CAN_SJA1000_H
+#define __DRIVERS_INCLUDE_CAN_SJA1000_H
+
+/
+ * Included Files
+ /
+
+#include 
+
+/
+ * Pre-processor Definitions
+ /
+
+/
+ * Public Types
+ /
+
+/* CAN hardware-dependent bit-timing constant
+ *
+ * Used for calculating and checking bit-timing parameters
+ */
+
+struct sja1000_can_bittiming_const

Review Comment:
   ```suggestion
   struct sja1000_can_bittiming_s
   ```



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscr...@nuttx.apache.org

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org



Re: [PR] STM32H7 serial TX DMA fix [nuttx]

2024-03-11 Thread via GitHub


kk-thrane commented on PR #11871:
URL: https://github.com/apache/nuttx/pull/11871#issuecomment-1987826207

   To my surprise, nuttx implements nxsem_trywait() using a critical section... 
so yes, using a critical section instead of the semaphore provides better 
performance.
   Hasn't nuttx got a better way to handle this? E.g. disabling only the DMA 
IRQ would be better.
   
   I believe the call to stm32_dmaresidual() should be removed. I think is 
redundant and not a reliable method for testing whether DMA is running?
   
   I don't like dma_up_txcallback() calling up_dma_txavailable(). It works, but 
it is unnecessary. The ISR doesn't need to enter a critical section. I prefer 
the dma_up_txcallback() implementation in my patch - just leave out the call to 
nxsem_post(). What do you think?
   
   I will make another version with the above changes and push to this branch 
later this week when I have had time to verify it. I'm a little preoccupied by 
something at the moment.


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscr...@nuttx.apache.org

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org



Re: [PR] drivers/video: Update unlink() and video_uninitialize() operation [nuttx]

2024-03-11 Thread via GitHub


xiaoxiang781216 commented on code in PR #11008:
URL: https://github.com/apache/nuttx/pull/11008#discussion_r1519352890


##
drivers/video/video.c:
##
@@ -3488,7 +3494,16 @@ int video_register(FAR const char *devpath,
 
 int video_unregister(FAR const char *devpath)
 {
-  return unregister_driver(devpath);
+  int ret;
+  struct stat buf;
+
+  ret = nx_stat(devpath, , 1);

Review Comment:
   Ok, after compare the mainline with our local git, we found the similar 
issue when dealing with USB hotplug, and change unreigster_driver to fix the 
problem.
   unreigster_driver is better place to fix this issue. @Donny9 could you 
upstream the patch? so @SPRESENSE could veriy whether your change work in this 
case too.



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscr...@nuttx.apache.org

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org



Re: [PR] drivers/video: Update unlink() and video_uninitialize() operation [nuttx]

2024-03-11 Thread via GitHub


SPRESENSE commented on code in PR #11008:
URL: https://github.com/apache/nuttx/pull/11008#discussion_r1519342452


##
drivers/video/video.c:
##
@@ -3488,7 +3494,16 @@ int video_register(FAR const char *devpath,
 
 int video_unregister(FAR const char *devpath)
 {
-  return unregister_driver(devpath);
+  int ret;
+  struct stat buf;
+
+  ret = nx_stat(devpath, , 1);

Review Comment:
   @xiaoxiang781216 When unregister_driver is executed, the device file is 
removed, but video_unlink() does not seem to be called.
   (This was confirmed with my Spresense environment.)
   
   So, this change is necessary to avoid memory leak.



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscr...@nuttx.apache.org

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org



Re: [PR] drivers/video: Update unlink() and video_uninitialize() operation [nuttx]

2024-03-11 Thread via GitHub


xiaoxiang781216 commented on code in PR #11008:
URL: https://github.com/apache/nuttx/pull/11008#discussion_r1519352890


##
drivers/video/video.c:
##
@@ -3488,7 +3494,16 @@ int video_register(FAR const char *devpath,
 
 int video_unregister(FAR const char *devpath)
 {
-  return unregister_driver(devpath);
+  int ret;
+  struct stat buf;
+
+  ret = nx_stat(devpath, , 1);

Review Comment:
   Ok, after compare the mainline with our local git, I found @Donny9 hit the 
similar issue when dealing with USB hotplug, and change unreigster_driver to 
fix the problem.
   unreigster_driver is better place to fix this issue. @Donny9 could you 
upstream the patch? so @SPRESENSE could veriy whether your change work in this 
case too.



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscr...@nuttx.apache.org

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org



Re: [PR] drivers/video: Update unlink() and video_uninitialize() operation [nuttx]

2024-03-11 Thread via GitHub


xiaoxiang781216 commented on code in PR #11008:
URL: https://github.com/apache/nuttx/pull/11008#discussion_r1519352890


##
drivers/video/video.c:
##
@@ -3488,7 +3494,16 @@ int video_register(FAR const char *devpath,
 
 int video_unregister(FAR const char *devpath)
 {
-  return unregister_driver(devpath);
+  int ret;
+  struct stat buf;
+
+  ret = nx_stat(devpath, , 1);

Review Comment:
   Ok, after compare the mainline with our local git, I found @Donny9 hit the 
similar issue when dealing with USB hotplug, and change unreigster_driver to 
fix the problem.
   unreigster_driver is better place to fix this issue. @Donny9 could you 
upstream the patch? so @SPRESENSE could verify whether your change work in this 
case too.



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscr...@nuttx.apache.org

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org



Re: [PR] drivers/video: Update unlink() and video_uninitialize() operation [nuttx]

2024-03-11 Thread via GitHub


xiaoxiang781216 commented on code in PR #11008:
URL: https://github.com/apache/nuttx/pull/11008#discussion_r1519352890


##
drivers/video/video.c:
##
@@ -3488,7 +3494,16 @@ int video_register(FAR const char *devpath,
 
 int video_unregister(FAR const char *devpath)
 {
-  return unregister_driver(devpath);
+  int ret;
+  struct stat buf;
+
+  ret = nx_stat(devpath, , 1);

Review Comment:
   Ok, after compare the mainline with our local git, I found the similar issue 
when dealing with USB hotplug, and change unreigster_driver to fix the problem.
   unreigster_driver is better place to fix this issue. @Donny9 could you 
upstream the patch? so @SPRESENSE could veriy whether your change work in this 
case too.



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscr...@nuttx.apache.org

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org



Re: [PR] drivers/video: Update for improvement and bug fix [nuttx]

2024-03-11 Thread via GitHub


SPRESENSE commented on code in PR #11859:
URL: https://github.com/apache/nuttx/pull/11859#discussion_r1519489829


##
drivers/video/isx019.c:
##
@@ -797,6 +811,122 @@ static const int32_t g_isx019_wbmode[] =
 
 #define NR_WBMODE (sizeof(g_isx019_wbmode) / sizeof(int32_t))
 
+static const int32_t g_isx019_iso[] =
+{
+  1000, /* ISO1 */
+  1200, /* ISO1.2 */
+  1600, /* ISO1.6 */
+  2000, /* ISO2 */
+  2500, /* ISO2.5 */
+  3000, /* ISO3 */
+  4000, /* ISO4 */
+  5000, /* ISO5 */
+  6000, /* ISO6 */
+  8000, /* ISO8 */
+  1,/* ISO10 */
+  12000,/* ISO12 */
+  16000,/* ISO16 */
+  2,/* ISO20 */
+  25000,/* ISO25 */
+  32000,/* ISO32 */
+  4,/* ISO40 */
+  5,/* ISO50 */
+  64000,/* ISO64 */
+  8,/* ISO80 */
+  10,   /* ISO100 */
+  125000,   /* ISO125 */
+  16,   /* ISO160 */
+  20,   /* ISO200 */
+  25,   /* ISO250 */
+  32,   /* ISO320 */
+  40,   /* ISO400 */
+  50,   /* ISO500 */
+  64,   /* ISO640 */
+  80,   /* ISO800 */
+  100,  /* ISO1000 */
+  125,  /* ISO1250 */
+  160,  /* ISO1600 */
+  200,  /* ISO2000 */
+  250,  /* ISO2500 */
+  320,  /* ISO3200 */
+  400,  /* ISO4000 */
+  500,  /* ISO5000 */
+};
+
+#define NR_ISO (sizeof(g_isx019_iso) / sizeof(int32_t))
+
+/* Gain values corresponding to each elements of g_isx019_iso table.

Review Comment:
   @hartmannathan Fixed it.



##
drivers/video/isx019.c:
##
@@ -797,6 +811,122 @@ static const int32_t g_isx019_wbmode[] =
 
 #define NR_WBMODE (sizeof(g_isx019_wbmode) / sizeof(int32_t))
 
+static const int32_t g_isx019_iso[] =
+{
+  1000, /* ISO1 */
+  1200, /* ISO1.2 */
+  1600, /* ISO1.6 */
+  2000, /* ISO2 */
+  2500, /* ISO2.5 */
+  3000, /* ISO3 */
+  4000, /* ISO4 */
+  5000, /* ISO5 */
+  6000, /* ISO6 */
+  8000, /* ISO8 */
+  1,/* ISO10 */
+  12000,/* ISO12 */
+  16000,/* ISO16 */
+  2,/* ISO20 */
+  25000,/* ISO25 */
+  32000,/* ISO32 */
+  4,/* ISO40 */
+  5,/* ISO50 */
+  64000,/* ISO64 */
+  8,/* ISO80 */
+  10,   /* ISO100 */
+  125000,   /* ISO125 */
+  16,   /* ISO160 */
+  20,   /* ISO200 */
+  25,   /* ISO250 */
+  32,   /* ISO320 */
+  40,   /* ISO400 */
+  50,   /* ISO500 */
+  64,   /* ISO640 */
+  80,   /* ISO800 */
+  100,  /* ISO1000 */
+  125,  /* ISO1250 */
+  160,  /* ISO1600 */
+  200,  /* ISO2000 */
+  250,  /* ISO2500 */
+  320,  /* ISO3200 */
+  400,  /* ISO4000 */
+  500,  /* ISO5000 */
+};
+
+#define NR_ISO (sizeof(g_isx019_iso) / sizeof(int32_t))
+
+/* Gain values corresponding to each elements of g_isx019_iso table.
+ * This needs to have the same size of g_isx019_iso.

Review Comment:
   @hartmannathan Fixed it.



##
drivers/video/isx019.c:
##
@@ -1265,9 +1377,22 @@ static int isx019_init(FAR struct imgsensor_s *sensor)
   fpga_init(priv);
   initialize_wbmode(priv);
   initialize_jpg_quality(priv);
-  store_default_value(priv);
+
+  /* Set initial gamma value for getting current value API. */
+
+  priv->gamma = 1000;
+
+  /* Because store_default_value() needs the clock ratio,
+   * clock_ratio has to be calulated first.

Review Comment:
   @hartmannathan Fixed it.



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscr...@nuttx.apache.org

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org



Re: [PR] drivers/video: Update for improvement and bug fix [nuttx]

2024-03-11 Thread via GitHub


SPRESENSE commented on code in PR #11859:
URL: https://github.com/apache/nuttx/pull/11859#discussion_r1519489123


##
include/nuttx/video/imgsensor.h:
##
@@ -34,49 +34,49 @@
 
 /* Camera parameter IDs */
 
-#define IMGSENSOR_ID_BRIGHTNESS   (0x)
-#define IMGSENSOR_ID_CONTRAST (0x0001)
-#define IMGSENSOR_ID_SATURATION   (0x0002)
-#define IMGSENSOR_ID_HUE  (0x0003)
-#define IMGSENSOR_ID_AUTO_WHITE_BALANCE   (0x0004)
-#define IMGSENSOR_ID_RED_BALANCE  (0x0005)
-#define IMGSENSOR_ID_BLUE_BALANCE (0x0006)
-#define IMGSENSOR_ID_GAMMA(0x0007)
-#define IMGSENSOR_ID_GAMMA_CURVE  (0x0008)
-#define IMGSENSOR_ID_EXPOSURE (0x0009)
-#define IMGSENSOR_ID_HFLIP_VIDEO  (0x000a)
-#define IMGSENSOR_ID_VFLIP_VIDEO  (0x000b)
-#define IMGSENSOR_ID_HFLIP_STILL  (0x000c)
-#define IMGSENSOR_ID_VFLIP_STILL  (0x000d)
-#define IMGSENSOR_ID_SHARPNESS(0x000e)
-#define IMGSENSOR_ID_COLOR_KILLER (0x000f)
-#define IMGSENSOR_ID_COLORFX  (0x0010)
-#define IMGSENSOR_ID_AUTOBRIGHTNESS   (0x0011)
-#define IMGSENSOR_ID_ROTATE   (0x0012)
-#define IMGSENSOR_ID_EXPOSURE_AUTO(0x0001)
-#define IMGSENSOR_ID_EXPOSURE_ABSOLUTE(0x00010001)
-#define IMGSENSOR_ID_FOCUS_ABSOLUTE   (0x00010002)
-#define IMGSENSOR_ID_FOCUS_RELATIVE   (0x00010003)
-#define IMGSENSOR_ID_FOCUS_AUTO   (0x00010004)
-#define IMGSENSOR_ID_ZOOM_ABSOLUTE(0x00010005)
-#define IMGSENSOR_ID_ZOOM_RELATIVE(0x00010006)
-#define IMGSENSOR_ID_ZOOM_CONTINUOUS  (0x00010007)
-#define IMGSENSOR_ID_IRIS_ABSOLUTE(0x00010008)
-#define IMGSENSOR_ID_IRIS_RELATIVE(0x00010009)
-#define IMGSENSOR_ID_AUTO_N_PRESET_WB (0x0001000a)
-#define IMGSENSOR_ID_WIDE_DYNAMIC_RANGE   (0x0001000b)
-#define IMGSENSOR_ID_IMG_STABILIZATION(0x0001000c)
-#define IMGSENSOR_ID_ISO_SENSITIVITY  (0x0001000d)
-#define IMGSENSOR_ID_ISO_SENSITIVITY_AUTO (0x0001000e)
-#define IMGSENSOR_ID_EXPOSURE_METERING(0x0001000f)
-#define IMGSENSOR_ID_SPOT_POSITION(0x00010016)
-#define IMGSENSOR_ID_3A_LOCK  (0x00010011)
-#define IMGSENSOR_ID_AUTO_FOCUS_START (0x00010012)
-#define IMGSENSOR_ID_AUTO_FOCUS_STOP  (0x00010013)
-#define IMGSENSOR_ID_3A_PARAMETER (0x00010014)
-#define IMGSENSOR_ID_3A_STATUS(0x00010015)
-#define IMGSENSOR_ID_FLASH_LED_MODE   (0x0002)
-#define IMGSENSOR_ID_JPEG_QUALITY (0x0003)
+#define IMGSENSOR_ID_BRIGHTNESS   (0x0100)

Review Comment:
   @xiaoxiang781216  Fixed definition.



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscr...@nuttx.apache.org

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org



[PR] sched/pthread/join: remove unused joininfo [nuttx]

2024-03-11 Thread via GitHub


anchao opened a new pull request, #11890:
URL: https://github.com/apache/nuttx/pull/11890

   ## Summary
   
   sched/pthread/join: remove unused joininfo
   
   remove unused joininfo, minor issue found from code reading
   
   Signed-off-by: chao an 
   
   
   ## Impact
   
   N/A
   
   ## Testing
   
   ci-check


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscr...@nuttx.apache.org

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org



Re: [PR] STM32H7 serial TX DMA fix [nuttx]

2024-03-11 Thread via GitHub


davids5 commented on PR #11871:
URL: https://github.com/apache/nuttx/pull/11871#issuecomment-1988110803

   @kk-thrane 
   
   I am glad you went through the `nxsem_trywait` and see the contrast now. 
   
   If you consider the foregrounds looping trying to transmit. I have concerns 
about the completion call back interrupting that looping.  So the CS protects 
that. Now there is the case of  `dev.dmatx.length` and `dev.dmatx.nlength` and 
how the ISR sets them when doing the second portion of the transfer. I believe 
there is a case where the DMA stm32_dmaresidual has not updated and 
`dev.dmatx.length` and `dev.dmatx.nlength` may be 0. So that is why the check 
is for the 3 elements. 
   
   Not accessing the `dev.xmit` was a conscious decision to not violate the 
encapsulation of the interface. Hence the call to  up_dma_txavailable() which 
calls out to the layer managing `dev.xmit`
   
   


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscr...@nuttx.apache.org

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org



[PR] libs/libc/string: fix memmem() boundary case when needle is at end of haystack [nuttx]

2024-03-11 Thread via GitHub


juniskane opened a new pull request, #11889:
URL: https://github.com/apache/nuttx/pull/11889

   ## Summary
   
   libs/libc/string: fix memmem() boundary case when needle is at end of 
haystack
   
   This fixes calls like memmem("hello", 5, "lo", 2);
   
   Also zero-length needle is deemed to exist at beginning of haystack. This 
behavior matches memmem() on Linux, FreeBSD, NetBSD and OpenBSD.
   
   ## Impact
   
   Bug fix. Zero-length needle was incorrectly accessing bytes of needle.
   
   ## Testing
   
   Passes there tests:
   
   ```
   void test_memmem(void)
   {
   char *haystack = "hello";
   char *s;
   
   s = memmem(haystack, 5, "hel", 3);
   assert(s == haystack);
   
   s = memmem(haystack, 5, "lo", 2);
   assert(s == haystack + 3);
   
   s = memmem(haystack, 5, "hello", 5);
   assert(s == haystack);
   
   /* Compare '\0' bytes at string ends. */
   s = memmem(haystack, 6, "o", 2);
   assert(s == haystack + 4);
   
   /* Must not find needle that is right after end of haystack. */
   s = memmem("helloX", 5, "X", 1);
   assert(s == NULL);
   
   /* Too long needle should return NULL. */
   s = memmem(haystack, 5, "hellohello", 10);
   assert(s == NULL);
   
   /* Zero length needle is deemed to reside at start of haystack. */
   s = memmem(haystack, 5, "", 0);
   assert(s == haystack);
   }
   ```
   


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscr...@nuttx.apache.org

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org



Re: [I] [Discussion]How to elegantly implement ALLSYMS feat in CMake build [nuttx]

2024-03-11 Thread via GitHub


xuxin930 commented on issue #11875:
URL: https://github.com/apache/nuttx/issues/11875#issuecomment-1988378243

   > How about adding multiple execution targets?
   
   Okay let me give it a try
   


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscr...@nuttx.apache.org

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org



Re: [PR] arch/xmc4 Add tickless support [nuttx]

2024-03-11 Thread via GitHub


nicolas71640 commented on code in PR #11737:
URL: https://github.com/apache/nuttx/pull/11737#discussion_r1519713127


##
arch/arm/src/xmc4/xmc4_tickless.c:
##
@@ -0,0 +1,576 @@
+/
+ * arch/arm/src/xmc4/xmc4_tickless.c
+ *
+ * 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.
+ *
+ /
+
+/
+ * Tickless OS Support.
+ *
+ * When CONFIG_SCHED_TICKLESS is enabled, all support for timer interrupts
+ * is suppressed and the platform specific code is expected to provide the
+ * following custom functions.
+ *
+ *   void up_timer_initialize(void): Initializes the timer facilities.
+ * Called early in the initialization sequence (by up_initialize()).
+ *   int up_timer_gettime(struct timespec *ts):  Returns the current
+ * time from the platform specific time source.
+ *   int up_timer_cancel(void):  Cancels the interval timer.
+ *   int up_timer_start(const struct timespec *ts): Start (or re-starts)
+ * the interval timer.
+ *
+ * The RTOS will provide the following interfaces for use by the platform-
+ * specific interval timer implementation:
+ *
+ *   void nxsched_timer_expiration(void):  Called by the platform-specific
+ * logic when the interval timer expires.
+ *
+ * NOTE
+ * Alarm option is NOT supported by XMC and never will.
+ * Hardware restrictions.
+ *
+ /
+
+/
+ * XMC Timer Usage
+ *
+ * This implementation uses two timers:
+ *  - One freerun timer to get the time since startup
+ *  - One oneshoe timer to wait the desired delay
+ *
+ * For now, user cannot choose the CCU used. This implementation uses the
+ * CCU40 for timing, and CCU41 for interval. Contributions are welcome
+ *
+ /
+
+/
+ * Included Files
+ /
+
+#include 
+
+#include 
+#include 
+#include 
+#include 
+#include 
+
+#include 
+#include 
+#include 
+
+#include "arm_internal.h"
+#include 
+#include "hardware/xmc4_scu.h"
+#include "hardware/xmc4_ccu4.h"
+#include "xmc4_ccu4.h"
+
+#ifdef CONFIG_SCHED_TICKLESS
+
+/
+ * Pre-processor Definitions
+ /
+
+/* Only alarm option can be supporter by xmc.
+ * Indeed, xmc CCU compare value cannot be updated
+ * on the flight. It's updated via shadow registers and
+ * these are loaded to compare value register only on overflow
+ */
+
+#ifdef CONFIG_SCHED_TICKLESS_ALARM
+# error Alarm support is not supported by xmc
+#endif
+
+/* The XMC only have 16 bits timers, so whatever the resolution this max is
+ * reached very quickly. Therefore we force the user to enable this max.
+ */
+
+#ifndef CONFIG_SCHED_TICKLESS_LIMIT_MAX_SLEEP
+# error XMC tickless feature need to have a max delay for sleep
+#endif
+
+/
+ * Private Types
+ /
+
+struct xmc4_tickless_s
+{
+  uint32_t overflow; /* Timer counter overflow */
+  uint32_t frequency;/* Frequency Timers */
+  volatile bool pending; /* True: pending task */
+  uint32_t period;   /* Interval period */
+};
+
+/
+ * Private Data
+ /
+
+static struct xmc4_tickless_s g_tickless;
+
+/
+ * Private Functions
+ /
+
+/

Re: [PR] drivers/video: Update unlink() and video_uninitialize() operation [nuttx]

2024-03-11 Thread via GitHub


Donny9 commented on code in PR #11008:
URL: https://github.com/apache/nuttx/pull/11008#discussion_r1519621769


##
drivers/video/video.c:
##
@@ -3488,7 +3494,16 @@ int video_register(FAR const char *devpath,
 
 int video_unregister(FAR const char *devpath)
 {
-  return unregister_driver(devpath);
+  int ret;
+  struct stat buf;
+
+  ret = nx_stat(devpath, , 1);

Review Comment:
   @SPRESENSE please refs to https://github.com/apache/nuttx/pull/11892



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscr...@nuttx.apache.org

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org



Re: [I] STM32H7 (& STM32F4): UART write issue [nuttx]

2024-03-11 Thread via GitHub


acassis commented on issue #11877:
URL: https://github.com/apache/nuttx/issues/11877#issuecomment-1988306785

   @maxikrie I think these differences between ESP32 and STM32 could happen 
because the former has internal HW FIFO and the later doesn't.
   
   More info about O_NONBLOCK please read the man pages:
   $ man 2 open
   $ man 2 fcntl
   
   Also I found this page with useful information about it: 
https://wiki.sei.cmu.edu/confluence/display/c/FIO32-C.+Do+not+perform+operations+on+devices+that+are+only+appropriate+for+files


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscr...@nuttx.apache.org

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org



Re: [PR] fs/driver: using nx_unlink to call unlink ops to release some resource [nuttx]

2024-03-11 Thread via GitHub


acassis commented on PR #11892:
URL: https://github.com/apache/nuttx/pull/11892#issuecomment-1988324671

   @Donny9 do you know if this driver reduces or increases the kernel size? 
Please include the change of memory usage before and after this patch.
   
   I think NuttX should include the memory report at end of compilation like 
zephyr does


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscr...@nuttx.apache.org

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org



Re: [I] STM32H7 (& STM32F4): UART write issue [nuttx]

2024-03-11 Thread via GitHub


maxikrie commented on issue #11877:
URL: https://github.com/apache/nuttx/issues/11877#issuecomment-1988330586

   @acassis Thanks a lot!


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscr...@nuttx.apache.org

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org



Re: [I] STM32H7 (& STM32F4): UART write issue [nuttx]

2024-03-11 Thread via GitHub


maxikrie closed issue #11877: STM32H7 (& STM32F4): UART write issue
URL: https://github.com/apache/nuttx/issues/11877


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscr...@nuttx.apache.org

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org



Re: [PR] V4l2 refactor [nuttx]

2024-03-11 Thread via GitHub


shizhenghui commented on PR #11887:
URL: https://github.com/apache/nuttx/pull/11887#issuecomment-1988393443

   Submitted to the nuttx apps 
repository:https://github.com/apache/nuttx-apps/pull/2326
   
   > @shizhenghui please fix compilation errors:
   > 
   > ```
   > camera_main.c: In function 'camera_main':
   > Error: camera_main.c:503:9: error: implicit declaration of function 
'video_initialize'; did you mean 'list_initialize'? 
[-Werror=implicit-function-declaration]
   >   503 |   ret = video_initialize("/dev/video");
   >   | ^~~~
   >   | list_initialize
   > Error: camera_main.c:761:3: error: implicit declaration of function 
'video_uninitialize'; did you mean 'mm_uninitialize'? 
[-Werror=implicit-function-declaration]
   >   761 |   video_uninitialize("/dev/video");
   >   |   ^~
   >   |   mm_uninitialize
   > ```
   
   


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscr...@nuttx.apache.org

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org



Re: [PR] tools/minidumpserver.py: support quit with gdb [nuttx]

2024-03-11 Thread via GitHub


xiaoxiang781216 merged PR #11888:
URL: https://github.com/apache/nuttx/pull/11888


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscr...@nuttx.apache.org

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org



[PR] camera_example: modify initialize interface after v4l2 refactor [nuttx-apps]

2024-03-11 Thread via GitHub


shizhenghui opened a new pull request, #2326:
URL: https://github.com/apache/nuttx-apps/pull/2326

   ## Summary
   
   Fix apps dependency,  see commit: https://github.com/apache/nuttx/pull/11887
   
   ## Impact
   
   NA
   
   ## Testing
   
   CI


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscr...@nuttx.apache.org

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org



Re: [I] CMake Support for The JH7110 Board [nuttx]

2024-03-11 Thread via GitHub


acassis commented on issue #11870:
URL: https://github.com/apache/nuttx/issues/11870#issuecomment-1988318412

   @theoparis thank you for your effort trying to add support for CMakefile to 
compile this board.
   
   As @anchao explained currently CMakefile has support only for building NuttX 
in FLAT mode (for MCUs without MPU), so PROTECTED mode (for MCUs with MPU) and 
KERNEL mode (processors with MMU) are not supported it.
   


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscr...@nuttx.apache.org

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org



[PR] sched/pthread: replace pthread_sem_give() to nxsem_post() to unify the post method [nuttx]

2024-03-11 Thread via GitHub


anchao opened a new pull request, #11891:
URL: https://github.com/apache/nuttx/pull/11891

   ## Summary
   
sched/pthread: replace pthread_sem_give() to nxsem_post() to unify the post 
method

replace pthread_sem_give() to nxsem_post() to unify the post method

Signed-off-by: chao an 
   
   
   ## Impact
   
   N/A
   
   ## Testing
   
   ci-check


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscr...@nuttx.apache.org

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org



Re: [PR] libs/libc/string: fix memmem() boundary case when needle is at end of haystack [nuttx]

2024-03-11 Thread via GitHub


acassis commented on PR #11889:
URL: https://github.com/apache/nuttx/pull/11889#issuecomment-1988333599

   @juniskane please include this test_memmem() to apps/testing/ostest


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscr...@nuttx.apache.org

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org



Re: [PR] V4l2 refactor [nuttx]

2024-03-11 Thread via GitHub


acassis commented on PR #11887:
URL: https://github.com/apache/nuttx/pull/11887#issuecomment-1988339862

   @shizhenghui please fix compilation errors:
   ```
   camera_main.c: In function 'camera_main':
   Error: camera_main.c:503:9: error: implicit declaration of function 
'video_initialize'; did you mean 'list_initialize'? 
[-Werror=implicit-function-declaration]
 503 |   ret = video_initialize("/dev/video");
 | ^~~~
 | list_initialize
   Error: camera_main.c:761:3: error: implicit declaration of function 
'video_uninitialize'; did you mean 'mm_uninitialize'? 
[-Werror=implicit-function-declaration]
 761 |   video_uninitialize("/dev/video");
 |   ^~
 |   mm_uninitialize
   ```


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscr...@nuttx.apache.org

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org



(nuttx) branch master updated (5ac401d941 -> 836715a2d6)

2024-03-11 Thread xiaoxiang
This is an automated email from the ASF dual-hosted git repository.

xiaoxiang pushed a change to branch master
in repository https://gitbox.apache.org/repos/asf/nuttx.git


from 5ac401d941 mm/kconfig: fix typo in MM_DEFAULT_ALIGNMENT
 add 836715a2d6 tools/minidumpserver.py: support quit with gdb

No new revisions were added by this update.

Summary of changes:
 tools/minidumpserver.py | 9 +++--
 1 file changed, 7 insertions(+), 2 deletions(-)



Re: [PR] arch/xmc4 Add tickless support [nuttx]

2024-03-11 Thread via GitHub


xiaoxiang781216 commented on PR #11737:
URL: https://github.com/apache/nuttx/pull/11737#issuecomment-1988399027

   @nicolas71640 please squash the change into one patch and fix the nxstyle 
issue reported by:
   
https://github.com/apache/nuttx/actions/runs/8233183407/job/22512126340?pr=11737


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscr...@nuttx.apache.org

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org



[PR] cmake: fix libxx header file search path issue and enable libxx for CMake build [nuttx]

2024-03-11 Thread via GitHub


xuxin930 opened a new pull request, #11893:
URL: https://github.com/apache/nuttx/pull/11893

   ## Summary
   In the original Makefile, we have `ARCHCXXFLAG` and `ARCHCFLAG` to 
distinguish the header file search paths of cxx files and c files.
   However, in the CMake `target_include_directory`, the target language 
**_CANNOT_** be distinguished by default.
   this causes the wrong header file search order.
   
   What I want to do is separate the header file references of the c++ standard 
library by language just like Makefile base.
   ```cmake
# In c++ standard library: export header
   set_property(
 TARGET nuttx
 APPEND
 PROPERTY NUTTX_CXX_INCLUDE_DIRECTORIES ${CMAKE_BINARY_DIR}/include/libcxx)
   
   # In target add_library_internal: automatically reference according to 
language
   target_include_directories(
   ${target}
   PRIVATE
  
$<$:$>>
 )
   ``` 
   ---
   and also fix several typo
   
   ## Impact
   libxx CMake build
   ## Testing
   CI build
   


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscr...@nuttx.apache.org

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org



Re: [PR] libs/libc/string: fix memmem() boundary case when needle is at end of haystack [nuttx]

2024-03-11 Thread via GitHub


juniskane commented on PR #11889:
URL: https://github.com/apache/nuttx/pull/11889#issuecomment-1988524141

   > @juniskane please include this test_memmem() to apps/testing/ostest
   
   I view ostest as testing RTOS features like semaphores, scheduler, threads 
etc. Maybe we should have a separate libc testing suite? We already have this 
under testing/ directory related to libc features:
   - arch_libc
   - atomic
   - fmemopen
   - scanftest
   - ostest/getopt.c
   Maybe unify these under one test application? Just an idea, someone else has 
to do the work, not me :)


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscr...@nuttx.apache.org

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org



Re: [PR] sched/pthread/join: remove unused joininfo [nuttx]

2024-03-11 Thread via GitHub


xiaoxiang781216 merged PR #11890:
URL: https://github.com/apache/nuttx/pull/11890


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscr...@nuttx.apache.org

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org



(nuttx) branch master updated: sched/pthread/join: remove unused joininfo

2024-03-11 Thread xiaoxiang
This is an automated email from the ASF dual-hosted git repository.

xiaoxiang pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/nuttx.git


The following commit(s) were added to refs/heads/master by this push:
 new 68c21df444 sched/pthread/join: remove unused joininfo
68c21df444 is described below

commit 68c21df444fef369a8ef77e94f1d28187c1f91e1
Author: chao an 
AuthorDate: Mon Mar 11 19:08:12 2024 +0800

sched/pthread/join: remove unused joininfo

remove unused joininfo, minor issue found from code reading

Signed-off-by: chao an 
---
 include/nuttx/sched.h| 1 -
 sched/pthread/pthread_findjoininfo.c | 2 --
 2 files changed, 3 deletions(-)

diff --git a/include/nuttx/sched.h b/include/nuttx/sched.h
index 35c7a1b5bb..780481e04d 100644
--- a/include/nuttx/sched.h
+++ b/include/nuttx/sched.h
@@ -714,7 +714,6 @@ struct pthread_tcb_s
 
   pthread_trampoline_t trampoline;   /* User-space pthread startup 
function */
   pthread_addr_t arg;/* Startup argument   
 */
-  FAR void *joininfo;/* Detach-able info to support join   
 */
   bool join_complete;/* Join was completed 
 */
 };
 #endif /* !CONFIG_DISABLE_PTHREAD */
diff --git a/sched/pthread/pthread_findjoininfo.c 
b/sched/pthread/pthread_findjoininfo.c
index 5250e55b43..41e4c73f87 100644
--- a/sched/pthread/pthread_findjoininfo.c
+++ b/sched/pthread/pthread_findjoininfo.c
@@ -82,8 +82,6 @@ int pthread_createjoininfo(FAR struct pthread_tcb_s *ptcb,
 
   /* Attach the join info to the TCB. */
 
-  ptcb->joininfo = (FAR void *)(*pjoin);
-
   (*pjoin)->next = NULL;
   if (!group->tg_jointail)
 {



Re: [PR] arch/xmc4 Add tickless support [nuttx]

2024-03-11 Thread via GitHub


xiaoxiang781216 commented on code in PR #11737:
URL: https://github.com/apache/nuttx/pull/11737#discussion_r1519784376


##
arch/arm/src/xmc4/xmc4_tickless.c:
##
@@ -0,0 +1,576 @@
+/
+ * arch/arm/src/xmc4/xmc4_tickless.c
+ *
+ * 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.
+ *
+ /
+
+/
+ * Tickless OS Support.
+ *
+ * When CONFIG_SCHED_TICKLESS is enabled, all support for timer interrupts
+ * is suppressed and the platform specific code is expected to provide the
+ * following custom functions.
+ *
+ *   void up_timer_initialize(void): Initializes the timer facilities.
+ * Called early in the initialization sequence (by up_initialize()).
+ *   int up_timer_gettime(struct timespec *ts):  Returns the current
+ * time from the platform specific time source.
+ *   int up_timer_cancel(void):  Cancels the interval timer.
+ *   int up_timer_start(const struct timespec *ts): Start (or re-starts)
+ * the interval timer.
+ *
+ * The RTOS will provide the following interfaces for use by the platform-
+ * specific interval timer implementation:
+ *
+ *   void nxsched_timer_expiration(void):  Called by the platform-specific
+ * logic when the interval timer expires.
+ *
+ * NOTE
+ * Alarm option is NOT supported by XMC and never will.
+ * Hardware restrictions.
+ *
+ /
+
+/
+ * XMC Timer Usage
+ *
+ * This implementation uses two timers:
+ *  - One freerun timer to get the time since startup
+ *  - One oneshoe timer to wait the desired delay
+ *
+ * For now, user cannot choose the CCU used. This implementation uses the
+ * CCU40 for timing, and CCU41 for interval. Contributions are welcome
+ *
+ /
+
+/
+ * Included Files
+ /
+
+#include 
+
+#include 
+#include 
+#include 
+#include 
+#include 
+
+#include 
+#include 
+#include 
+
+#include "arm_internal.h"
+#include 
+#include "hardware/xmc4_scu.h"
+#include "hardware/xmc4_ccu4.h"
+#include "xmc4_ccu4.h"
+
+#ifdef CONFIG_SCHED_TICKLESS
+
+/
+ * Pre-processor Definitions
+ /
+
+/* Only alarm option can be supporter by xmc.
+ * Indeed, xmc CCU compare value cannot be updated
+ * on the flight. It's updated via shadow registers and
+ * these are loaded to compare value register only on overflow
+ */
+
+#ifdef CONFIG_SCHED_TICKLESS_ALARM
+# error Alarm support is not supported by xmc
+#endif
+
+/* The XMC only have 16 bits timers, so whatever the resolution this max is
+ * reached very quickly. Therefore we force the user to enable this max.
+ */
+
+#ifndef CONFIG_SCHED_TICKLESS_LIMIT_MAX_SLEEP
+# error XMC tickless feature need to have a max delay for sleep
+#endif
+
+/
+ * Private Types
+ /
+
+struct xmc4_tickless_s
+{
+  uint32_t overflow; /* Timer counter overflow */
+  uint32_t frequency;/* Frequency Timers */
+  volatile bool pending; /* True: pending task */
+  uint32_t period;   /* Interval period */
+};
+
+/
+ * Private Data
+ /
+
+static struct xmc4_tickless_s g_tickless;
+
+/
+ * Private Functions
+ /
+

Re: [PR] libs/libc/string: fix memmem() boundary case when needle is at end of haystack [nuttx]

2024-03-11 Thread via GitHub


xiaoxiang781216 merged PR #11889:
URL: https://github.com/apache/nuttx/pull/11889


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscr...@nuttx.apache.org

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org



(nuttx) 01/15: drivers/video: Modify control id definition

2024-03-11 Thread jerpelea
This is an automated email from the ASF dual-hosted git repository.

jerpelea pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/nuttx.git

commit 75a0a08a4dd3d487b858e7e4ff7a8f7e4b753970
Author: SPRESENSE <41312067+sprese...@users.noreply.github.com>
AuthorDate: Wed Oct 11 20:53:43 2023 +0900

drivers/video: Modify control id definition

Modify control id definition to avoid duplication even if
the control ids belong to the same control class.
Also, not refer to control class in driver.
---
 drivers/video/video.c|  34 +++--
 include/nuttx/video/imgsensor.h  |  86 ++---
 include/nuttx/video/video_controls.h | 142 +--
 include/sys/videoio.h|   6 +-
 4 files changed, 142 insertions(+), 126 deletions(-)

diff --git a/drivers/video/video.c b/drivers/video/video.c
index 105e2d8745..069445ca30 100644
--- a/drivers/video/video.c
+++ b/drivers/video/video.c
@@ -53,8 +53,6 @@
 
 #define VIDEO_REMAINING_CAPNUM_INFINITY (-1)
 
-#define VIDEO_ID(x, y) (((x) << 16) | (y))
-
 /
  * Private Types
  /
@@ -2157,8 +2155,7 @@ static int video_query_ext_ctrl(FAR struct video_mng_s 
*vmng,
   attr->nr_of_dims = 0;
   memset(attr->dims, 0, sizeof(attr->dims));
 
-  if (attr->ctrl_class == V4L2_CTRL_CLASS_CAMERA &&
-  attr->id == V4L2_CID_SCENE_MODE)
+  if (attr->id == V4L2_CID_SCENE_MODE)
 {
   /* Scene mode is processed in only video driver. */
 
@@ -2172,9 +2169,7 @@ static int video_query_ext_ctrl(FAR struct video_mng_s 
*vmng,
 }
   else
 {
-  ret = IMGSENSOR_GET_SUPPORTED_VALUE(vmng->imgsensor,
-  VIDEO_ID(attr->ctrl_class, attr->id),
-  );
+  ret = IMGSENSOR_GET_SUPPORTED_VALUE(vmng->imgsensor, attr->id, );
   if (ret < 0)
 {
   return ret;
@@ -2209,8 +2204,7 @@ static int video_query_ext_ctrl(FAR struct video_mng_s 
*vmng,
 break;
 }
 
-  set_parameter_name(VIDEO_ID(attr->ctrl_class, attr->id),
- attr->name);
+  set_parameter_name(attr->id, attr->name);
 }
 
   return OK;
@@ -2229,8 +2223,7 @@ static int video_querymenu(FAR video_mng_t *vmng,
   return -EINVAL;
 }
 
-  if (menu->ctrl_class == V4L2_CTRL_CLASS_CAMERA &&
-  menu->id == V4L2_CID_SCENE_MODE)
+  if (menu->id == V4L2_CID_SCENE_MODE)
 {
   /* Scene mode is processed in only video driver. */
 
@@ -2244,8 +2237,8 @@ static int video_querymenu(FAR video_mng_t *vmng,
   else
 {
   ret = IMGSENSOR_GET_SUPPORTED_VALUE(vmng->imgsensor,
-  VIDEO_ID(menu->ctrl_class, menu->id),
-  );
+  menu->id,
+  );
   if (ret < 0)
 {
   return ret;
@@ -2351,7 +2344,7 @@ static int video_g_ext_ctrls(FAR struct video_mng_s *priv,
cnt++, control++)
 {
   ret = IMGSENSOR_GET_VALUE(priv->imgsensor,
-  VIDEO_ID(ctrls->ctrl_class, control->id),
+  control->id,
   control->size,
   (imgsensor_value_t *)>value64);
   if (ret < 0)
@@ -2488,15 +2481,14 @@ static int video_s_ext_ctrls(FAR struct video_mng_s 
*priv,
cnt < ctrls->count;
cnt++, control++)
 {
-  if (ctrls->ctrl_class == V4L2_CTRL_CLASS_CAMERA &&
-  control->id == V4L2_CID_SCENE_MODE)
+  if (control->id == V4L2_CID_SCENE_MODE)
 {
   ret = reflect_scene_parameter(priv, control->value);
 }
   else
 {
   ret = IMGSENSOR_SET_VALUE(priv->imgsensor,
-  VIDEO_ID(ctrls->ctrl_class, control->id),
+  control->id,
   control->size,
   (imgsensor_value_t)control->value64);
   if (ret == 0)
@@ -2504,7 +2496,7 @@ static int video_s_ext_ctrls(FAR struct video_mng_s *priv,
   if (priv->video_scene_mode == V4L2_SCENE_MODE_NONE)
 {
   save_scene_param(priv, V4L2_SCENE_MODE_NONE,
-VIDEO_ID(ctrls->ctrl_class, control->id),
+control->id,
 control);
 }
 }
@@ -2745,7 +2737,7 @@ static int video_g_ext_ctrls_scene(FAR video_mng_t *vmng,
cnt++, control++)
 {
   ret = read_scene_param(vmng, ctrls->mode,
-   VIDEO_ID(ctrls->control.ctrl_class, control->id),
+   control->id,
control);
   if (ret != OK)
 {
@@ -3060,9 +3052,7 @@ static int video_s_ext_ctrls_scene(FAR struct video_mng_s 
*vmng,
cnt < ctrls->control.count;
cnt++, control++)
 {
-  ret = save_scene_param(vmng, ctrls->mode,
-   VIDEO_ID(ctrls->control.ctrl_class, control->id),
-   

(nuttx) branch master updated (47026978bf -> bac0228825)

2024-03-11 Thread jerpelea
This is an automated email from the ASF dual-hosted git repository.

jerpelea pushed a change to branch master
in repository https://gitbox.apache.org/repos/asf/nuttx.git


from 47026978bf libs/libc/string: fix memmem() boundary case when needle is 
at end of haystack
 new 75a0a08a4d drivers/video: Modify control id definition
 new f1bc6aada3 drivers/video/isx019: Fix supported ISO sensitivity
 new fdf9f00952 drivers/video/isx012: Fix control type of some parameters
 new dc82022769 drivers/video/isx019: Fix control type of some parameters
 new 76e91a69f7 drivers/video/isx019: Fix maximum value of exposure time
 new 33f7923d72 drivers/video/isx019: Fix bug that initial exposure time is 
not correct
 new fd5c2d4922 drivers/video/isx019: Fix bug that read value is not correct
 new 865c88e34b drivers/video: Add elems setting
 new de3bee313e drivers/video/isx019: Fix control type about some parameters
 new 8f0ed67339 drivers/video/isx019: Fix mismatch bug of HUE value
 new ae970a8ed3 drivers/video: Fix bug that can not use scene mode
 new 2b04210b16 drivers/video/isx019: Fix default ISO sensitivity
 new baa2dc5cad drivers/video/isx019: Store initial gamma value
 new 3419f018a4 drivers/video/isx019: Delete unnecessary code
 new bac0228825 drivers/video/isx012: Fix buffer overrun of isx012_putreg()

The 15 revisions listed above as "new" are entirely new to this
repository and will be described in separate emails.  The revisions
listed as "add" were already present in the repository and have only
been added to this reference.


Summary of changes:
 drivers/video/isx012.c   |  20 +-
 drivers/video/isx019.c   | 392 +--
 drivers/video/isx019_range.h |   2 +-
 drivers/video/video.c|  81 
 include/nuttx/video/imgsensor.h  |  86 
 include/nuttx/video/video_controls.h | 142 +++--
 include/sys/videoio.h|   6 +-
 7 files changed, 462 insertions(+), 267 deletions(-)



(nuttx) 05/15: drivers/video/isx019: Fix maximum value of exposure time

2024-03-11 Thread jerpelea
This is an automated email from the ASF dual-hosted git repository.

jerpelea pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/nuttx.git

commit 76e91a69f78e4e4411fb3f342ae48a89ca16813c
Author: SPRESENSE <41312067+sprese...@users.noreply.github.com>
AuthorDate: Thu Dec 21 13:30:29 2023 +0900

drivers/video/isx019: Fix maximum value of exposure time

Modify maximum value of exposure time from 102000 to 2740
according to hardware specification.
---
 drivers/video/isx019_range.h | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/video/isx019_range.h b/drivers/video/isx019_range.h
index 35365a148e..9489c1fc12 100644
--- a/drivers/video/isx019_range.h
+++ b/drivers/video/isx019_range.h
@@ -77,7 +77,7 @@
 #define STEP_AE   (1)
 
 #define MIN_EXPOSURETIME(1)
-#define MAX_EXPOSURETIME(102000)
+#define MAX_EXPOSURETIME(2740)
 #define STEP_EXPOSURETIME   (1)
 
 #define MIN_WBMODE(0)



(nuttx) 02/15: drivers/video/isx019: Fix supported ISO sensitivity

2024-03-11 Thread jerpelea
This is an automated email from the ASF dual-hosted git repository.

jerpelea pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/nuttx.git

commit f1bc6aada3136e5503f593562e42727cfdf7c0b5
Author: SPRESENSE <41312067+sprese...@users.noreply.github.com>
AuthorDate: Tue Oct 17 10:09:40 2023 +0900

drivers/video/isx019: Fix supported ISO sensitivity

Support not continuous values but discrete values.
---
 drivers/video/isx019.c | 180 +++--
 1 file changed, 130 insertions(+), 50 deletions(-)

diff --git a/drivers/video/isx019.c b/drivers/video/isx019.c
index fd4796ef05..7ca13b53aa 100644
--- a/drivers/video/isx019.c
+++ b/drivers/video/isx019.c
@@ -221,7 +221,6 @@ struct isx019_dev_s
   uint8_t flip_still;
   isx019_rect_t clip_video;
   isx019_rect_t clip_still;
-  int32_t iso;
   double  gamma;
   int32_t jpg_quality;
   imgsensor_colorfx_t colorfx;
@@ -797,6 +796,96 @@ static const int32_t g_isx019_wbmode[] =
 
 #define NR_WBMODE (sizeof(g_isx019_wbmode) / sizeof(int32_t))
 
+static int32_t g_isx019_iso[] =
+{
+  1000, /* ISO1 */
+  1200, /* ISO1.2 */
+  1600, /* ISO1.6 */
+  2000, /* ISO2 */
+  2500, /* ISO2.5 */
+  3000, /* ISO3 */
+  4000, /* ISO4 */
+  5000, /* ISO5 */
+  6000, /* ISO6 */
+  8000, /* ISO8 */
+  1,/* ISO10 */
+  12000,/* ISO12 */
+  16000,/* ISO16 */
+  2,/* ISO20 */
+  25000,/* ISO25 */
+  32000,/* ISO32 */
+  4,/* ISO40 */
+  5,/* ISO50 */
+  64000,/* ISO64 */
+  8,/* ISO80 */
+  10,   /* ISO100 */
+  125000,   /* ISO125 */
+  16,   /* ISO160 */
+  20,   /* ISO200 */
+  25,   /* ISO250 */
+  32,   /* ISO320 */
+  40,   /* ISO400 */
+  50,   /* ISO500 */
+  64,   /* ISO640 */
+  80,   /* ISO800 */
+  100,  /* ISO1000 */
+  125,  /* ISO1250 */
+  160,  /* ISO1600 */
+  200,  /* ISO2000 */
+  250,  /* ISO2500 */
+  320,  /* ISO3200 */
+  400,  /* ISO4000 */
+  500,  /* ISO5000 */
+};
+
+#define NR_ISO (sizeof(g_isx019_iso) / sizeof(int32_t))
+
+/* Gain values corresponding to each element of g_isx019_iso table.
+ * This needs to have the same size as g_isx019_iso.
+ */
+
+static const uint8_t g_isx019_gain[] =
+{
+  1,   /* gain for ISO1 */
+  2,   /* gain for ISO1.2 */
+  3,   /* gain for ISO1.6 */
+  4,   /* gain for ISO2 */
+  5,   /* gain for ISO2.5 */
+  6,   /* gain for ISO3 */
+  7,   /* gain for ISO4 */
+  8,   /* gain for ISO5 */
+  9,   /* gain for ISO6 */
+  10,  /* gain for ISO8 */
+  11,  /* gain for ISO10 */
+  12,  /* gain for ISO12 */
+  13,  /* gain for ISO16 */
+  14,  /* gain for ISO20 */
+  15,  /* gain for ISO25 */
+  16,  /* gain for ISO32 */
+  17,  /* gain for ISO40 */
+  18,  /* gain for ISO50 */
+  19,  /* gain for ISO64 */
+  20,  /* gain for ISO80 */
+  21,  /* gain for ISO100 */
+  22,  /* gain for ISO125 */
+  23,  /* gain for ISO160 */
+  24,  /* gain for ISO200 */
+  25,  /* gain for ISO250 */
+  26,  /* gain for ISO320 */
+  27,  /* gain for ISO400 */
+  28,  /* gain for ISO500 */
+  29,  /* gain for ISO640 */
+  30,  /* gain for ISO800 */
+  31,  /* gain for ISO1000 */
+  32,  /* gain for ISO1250 */
+  33,  /* gain for ISO1600 */
+  34,  /* gain for ISO2000 */
+  35,  /* gain for ISO2500 */
+  36,  /* gain for ISO3200 */
+  37,  /* gain for ISO4000 */
+  38,  /* gain for ISO5000 */
+};
+
 /
  * Private Functions
  /
@@ -1875,9 +1964,11 @@ static int isx019_get_supported_value(FAR struct 
imgsensor_s *sensor,
 break;
 
   case IMGSENSOR_ID_ISO_SENSITIVITY:
-val->type = IMGSENSOR_CTRL_TYPE_INTEGER;
-SET_RANGE(val->u.range, MIN_ISO, MAX_ISO,
-STEP_ISO, def->iso);
+val->type = IMGSENSOR_CTRL_TYPE_INTEGER_MENU;
+SET_DISCRETE(val->u.discrete,
+ NR_ISO,
+ g_isx019_iso,
+ 0);
 break;
 
   case IMGSENSOR_ID_ISO_SENSITIVITY_AUTO:
@@ -2578,18 +2669,21 @@ static int set_3aparameter(FAR isx019_dev_t *priv,
   return OK;
 }
 
-static uint16_t calc_gain(double iso)
+static uint16_t get_gain_from_iso(int32_t iso)
 {
-  double gain;
+  int i;
 
-  gain = 1 + 10 * log(iso) / M_LN10;
+  for (i = 0; i < NR_ISO; i++)
+{
+  if (g_isx019_iso[i] == iso)
+{
+  break;
+}
+}
 
-  /* In the above formula, the unit of gain is dB.
-   * Because the register has the 0.1dB unit,
-   * return 10 times dB value.
-   */
+  /* Return gain corresponding to specified ISO sensitivity. */
 
-  return (uint16_t)(gain * 10);
+  return (uint16_t)g_isx019_gain[i];
 }
 
 static int set_iso(FAR isx019_dev_t *priv,
@@ -2601,10 +2695,9 @@ static int set_iso(FAR isx019_dev_t *priv,
* So, calculate gain from ISO 

(nuttx) 04/15: drivers/video/isx019: Fix control type of some parameters

2024-03-11 Thread jerpelea
This is an automated email from the ASF dual-hosted git repository.

jerpelea pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/nuttx.git

commit dc82022769a3721097fc07ca2aac923626e08dd0
Author: SPRESENSE <41312067+sprese...@users.noreply.github.com>
AuthorDate: Tue Oct 17 13:36:26 2023 +0900

drivers/video/isx019: Fix control type of some parameters

Fix control type of some parameters according to specification.
---
 drivers/video/isx019.c | 10 +-
 1 file changed, 5 insertions(+), 5 deletions(-)

diff --git a/drivers/video/isx019.c b/drivers/video/isx019.c
index 7ca13b53aa..ea089bd0ad 100644
--- a/drivers/video/isx019.c
+++ b/drivers/video/isx019.c
@@ -1882,7 +1882,7 @@ static int isx019_get_supported_value(FAR struct 
imgsensor_s *sensor,
 break;
 
   case IMGSENSOR_ID_AUTO_WHITE_BALANCE:
-val->type = IMGSENSOR_CTRL_TYPE_INTEGER;
+val->type = IMGSENSOR_CTRL_TYPE_BOOLEAN;
 SET_RANGE(val->u.range, MIN_AWB, MAX_AWB,
 STEP_AWB, def->awb);
 break;
@@ -1900,25 +1900,25 @@ static int isx019_get_supported_value(FAR struct 
imgsensor_s *sensor,
 break;
 
   case IMGSENSOR_ID_HFLIP_VIDEO:
-val->type = IMGSENSOR_CTRL_TYPE_INTEGER;
+val->type = IMGSENSOR_CTRL_TYPE_BOOLEAN;
 SET_RANGE(val->u.range, MIN_HFLIP, MAX_HFLIP,
 STEP_HFLIP, def->hflip_video);
 break;
 
   case IMGSENSOR_ID_VFLIP_VIDEO:
-val->type = IMGSENSOR_CTRL_TYPE_INTEGER;
+val->type = IMGSENSOR_CTRL_TYPE_BOOLEAN;
 SET_RANGE(val->u.range, MIN_VFLIP, MAX_VFLIP,
 STEP_VFLIP, def->vflip_video);
 break;
 
   case IMGSENSOR_ID_HFLIP_STILL:
-val->type = IMGSENSOR_CTRL_TYPE_INTEGER;
+val->type = IMGSENSOR_CTRL_TYPE_BOOLEAN;
 SET_RANGE(val->u.range, MIN_HFLIP, MAX_HFLIP,
 STEP_HFLIP, def->hflip_still);
 break;
 
   case IMGSENSOR_ID_VFLIP_STILL:
-val->type = IMGSENSOR_CTRL_TYPE_INTEGER;
+val->type = IMGSENSOR_CTRL_TYPE_BOOLEAN;
 SET_RANGE(val->u.range, MIN_VFLIP, MAX_VFLIP,
 STEP_VFLIP, def->hflip_still);
 break;



(nuttx) 06/15: drivers/video/isx019: Fix bug that initial exposure time is not correct

2024-03-11 Thread jerpelea
This is an automated email from the ASF dual-hosted git repository.

jerpelea pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/nuttx.git

commit 33f7923d7247fdbb34fe92821c9ef9e418533361
Author: SPRESENSE <41312067+sprese...@users.noreply.github.com>
AuthorDate: Thu Dec 21 13:40:57 2023 +0900

drivers/video/isx019: Fix bug that initial exposure time is not correct

Because exposure time calculation needs the cxd56xx clock value,
get the cxd56xx clock value before saving initial value.
---
 drivers/video/isx019.c | 7 ++-
 1 file changed, 6 insertions(+), 1 deletion(-)

diff --git a/drivers/video/isx019.c b/drivers/video/isx019.c
index ea089bd0ad..a763328c94 100644
--- a/drivers/video/isx019.c
+++ b/drivers/video/isx019.c
@@ -1354,9 +1354,14 @@ static int isx019_init(FAR struct imgsensor_s *sensor)
   fpga_init(priv);
   initialize_wbmode(priv);
   initialize_jpg_quality(priv);
-  store_default_value(priv);
+
+  /* Because store_default_value() needs the clock ratio,
+   * clock_ratio has to be calculated first.
+   */
+
   clk = board_isx019_get_master_clock();
   priv->clock_ratio = (float)clk / ISX019_STANDARD_MASTER_CLOCK;
+  store_default_value(priv);
 
   return OK;
 }



Re: [PR] drivers/video: Update for improvement and bug fix [nuttx]

2024-03-11 Thread via GitHub


jerpelea merged PR #11859:
URL: https://github.com/apache/nuttx/pull/11859


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscr...@nuttx.apache.org

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org



(nuttx) 08/15: drivers/video: Add elems setting

2024-03-11 Thread jerpelea
This is an automated email from the ASF dual-hosted git repository.

jerpelea pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/nuttx.git

commit 865c88e34b9e5e64e481c319bc3571e33175f25c
Author: SPRESENSE <41312067+sprese...@users.noreply.github.com>
AuthorDate: Thu Jan 18 16:51:02 2024 +0900

drivers/video: Add elems setting

Add elems setting to ioctl(VIDIOC_QUERY_EXT_CTRL)
for V4L2 compatibility.
---
 drivers/video/video.c | 1 +
 1 file changed, 1 insertion(+)

diff --git a/drivers/video/video.c b/drivers/video/video.c
index 069445ca30..c66e24a0aa 100644
--- a/drivers/video/video.c
+++ b/drivers/video/video.c
@@ -2152,6 +2152,7 @@ static int video_query_ext_ctrl(FAR struct video_mng_s 
*vmng,
 
   attr->flags  = 0;
   attr->elem_size  = 0;
+  attr->elems  = 1;
   attr->nr_of_dims = 0;
   memset(attr->dims, 0, sizeof(attr->dims));
 



(nuttx) 13/15: drivers/video/isx019: Store initial gamma value

2024-03-11 Thread jerpelea
This is an automated email from the ASF dual-hosted git repository.

jerpelea pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/nuttx.git

commit baa2dc5cad84c96f8a306916d36e5a190e007bf0
Author: SPRESENSE <41312067+sprese...@users.noreply.github.com>
AuthorDate: Mon Jan 22 19:13:29 2024 +0900

drivers/video/isx019: Store initial gamma value

Set initial gamma value to enable application to get
the correct initial gamma value.
---
 drivers/video/isx019.c | 4 
 1 file changed, 4 insertions(+)

diff --git a/drivers/video/isx019.c b/drivers/video/isx019.c
index bd3b18397a..1da6d4bb84 100644
--- a/drivers/video/isx019.c
+++ b/drivers/video/isx019.c
@@ -1396,6 +1396,10 @@ static int isx019_init(FAR struct imgsensor_s *sensor)
   initialize_wbmode(priv);
   initialize_jpg_quality(priv);
 
+  /* Set initial gamma value for getting current value API. */
+
+  priv->gamma = 1000;
+
   /* Because store_default_value() needs the clock ratio,
* clock_ratio has to be calculated first.
*/



(nuttx) 10/15: drivers/video/isx019: Fix mismatch bug of HUE value

2024-03-11 Thread jerpelea
This is an automated email from the ASF dual-hosted git repository.

jerpelea pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/nuttx.git

commit 8f0ed67339305e3d0c9f1fe11b9f0372b371c4cb
Author: SPRESENSE <41312067+sprese...@users.noreply.github.com>
AuthorDate: Mon Jan 22 14:04:11 2024 +0900

drivers/video/isx019: Fix mismatch bug of HUE value

Because the ratio between API value and ISX019 register value
is 128 : 90 about HUE, some different API values become the
same register value.
So, store the value specified by application in setting,
and return the stored value in getting so that the gotten value
is the same as the setting value by application.
---
 drivers/video/isx019.c | 60 +-
 1 file changed, 45 insertions(+), 15 deletions(-)

diff --git a/drivers/video/isx019.c b/drivers/video/isx019.c
index 07081bb3d8..e767eee8ec 100644
--- a/drivers/video/isx019.c
+++ b/drivers/video/isx019.c
@@ -236,6 +236,7 @@ struct isx019_dev_s
   isx019_rect_t clip_still;
   double  gamma;
   int32_t jpg_quality;
+  int32_t hue;
   imgsensor_colorfx_t colorfx;
 };
 
@@ -1403,6 +1404,10 @@ static int isx019_init(FAR struct imgsensor_s *sensor)
   priv->clock_ratio = (float)clk / ISX019_STANDARD_MASTER_CLOCK;
   store_default_value(priv);
 
+  /* Store initial HUE value for getting current value API. */
+
+  priv->hue = priv->default_value.hue;
+
   return OK;
 }
 
@@ -2094,16 +2099,6 @@ static int32_t convert_brightness_reg2is(int32_t val)
   return (val / 4);
 }
 
-static int32_t convert_hue_is2reg(int32_t val)
-{
-  return (val * 90) / 128;
-}
-
-static int32_t convert_hue_reg2is(int32_t val)
-{
-  return (val * 128) / 90;
-}
-
 static int32_t convert_hdr_is2reg(int32_t val)
 {
   int32_t ret = AEWDMODE_AUTO;
@@ -2180,11 +2175,6 @@ static convert_t get_reginfo(uint32_t id, bool is_set,
 cvrt = not_convert;
 break;
 
-  case IMGSENSOR_ID_HUE:
-SET_REGINFO_INT8(reg, CAT_PICTTUNE, UIHUE);
-cvrt = is_set ? convert_hue_is2reg : convert_hue_reg2is;
-break;
-
   case IMGSENSOR_ID_EXPOSURE:
 SET_REGINFO_INT8(reg, CAT_AEDGRM, EVSEL);
 cvrt = not_convert;
@@ -2207,6 +2197,23 @@ static convert_t get_reginfo(uint32_t id, bool is_set,
   return cvrt;
 }
 
+static int set_hue(FAR isx019_dev_t *priv,
+   imgsensor_value_t val)
+{
+  int ret;
+  int val32 = val.value32 * 90 / 128;
+
+  ret = isx019_i2c_write(priv, CAT_PICTTUNE, UIHUE, , 1);
+  if (ret == OK)
+{
+  /* Store value before conversion for get_hue(). */
+
+  priv->hue = val.value32;
+}
+
+  return ret;
+}
+
 static void set_flip(FAR uint8_t *flip, uint8_t direction, int32_t val)
 {
   DEBUGASSERT(flip);
@@ -3034,6 +3041,10 @@ static setvalue_t set_value_func(uint32_t id)
 
   switch (id)
 {
+  case IMGSENSOR_ID_HUE:
+func = set_hue;
+break;
+
   case IMGSENSOR_ID_GAMMA:
 func = set_gamma;
 break;
@@ -3117,6 +3128,21 @@ static setvalue_t set_value_func(uint32_t id)
   return func;
 }
 
+static int get_hue(FAR isx019_dev_t *priv,
+   FAR imgsensor_value_t *val)
+{
+  if (val == NULL)
+{
+  return -EINVAL;
+}
+
+  /* Return stored value without reading register. */
+
+  val->value32 = priv->hue;
+
+  return OK;
+}
+
 static int32_t get_flip(FAR uint8_t *flip, uint8_t direction)
 {
   DEBUGASSERT(flip);
@@ -3526,6 +3552,10 @@ static getvalue_t get_value_func(uint32_t id)
 
   switch (id)
 {
+  case IMGSENSOR_ID_HUE:
+func = get_hue;
+break;
+
   case IMGSENSOR_ID_GAMMA:
 func = get_gamma;
 break;



(nuttx) 12/15: drivers/video/isx019: Fix default ISO sensitivity

2024-03-11 Thread jerpelea
This is an automated email from the ASF dual-hosted git repository.

jerpelea pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/nuttx.git

commit 2b04210b16df8bb54cb715537efb8edd79ed171d
Author: SPRESENSE <41312067+sprese...@users.noreply.github.com>
AuthorDate: Mon Jan 22 19:03:20 2024 +0900

drivers/video/isx019: Fix default ISO sensitivity

ISX019's ISO sensitivity is in auto adjustment mode by default.
Then, default ISO sensitivity value should be auto adjusted value.
---
 drivers/video/isx019.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/video/isx019.c b/drivers/video/isx019.c
index e767eee8ec..bd3b18397a 100644
--- a/drivers/video/isx019.c
+++ b/drivers/video/isx019.c
@@ -2020,7 +2020,7 @@ static int isx019_get_supported_value(FAR struct 
imgsensor_s *sensor,
 SET_DISCRETE(val->u.discrete,
  NR_ISO,
  g_isx019_iso,
- 0);
+ def->iso);
 break;
 
   case IMGSENSOR_ID_ISO_SENSITIVITY_AUTO:



(nuttx) 09/15: drivers/video/isx019: Fix control type about some parameters

2024-03-11 Thread jerpelea
This is an automated email from the ASF dual-hosted git repository.

jerpelea pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/nuttx.git

commit de3bee313ed556688e49688aae07f2a8c049d71e
Author: SPRESENSE <41312067+sprese...@users.noreply.github.com>
AuthorDate: Fri Jan 19 10:59:17 2024 +0900

drivers/video/isx019: Fix control type about some parameters

About IMGSENSOR_ID_EXPOSURE_AUTO, IMGSENSOR_ID_ISO_SENSITIVITY_AUTO,
and IMGSENSOR_ID_EXPOSURE_METERING, enumerations are defined.
So, control type should be not integer but integer menu.
---
 drivers/video/isx019.c | 52 --
 1 file changed, 42 insertions(+), 10 deletions(-)

diff --git a/drivers/video/isx019.c b/drivers/video/isx019.c
index d7aa292414..07081bb3d8 100644
--- a/drivers/video/isx019.c
+++ b/drivers/video/isx019.c
@@ -810,7 +810,7 @@ static const int32_t g_isx019_wbmode[] =
 
 #define NR_WBMODE (sizeof(g_isx019_wbmode) / sizeof(int32_t))
 
-static int32_t g_isx019_iso[] =
+static const int32_t g_isx019_iso[] =
 {
   1000, /* ISO1 */
   1200, /* ISO1.2 */
@@ -900,6 +900,32 @@ static const uint8_t g_isx019_gain[] =
   38,  /* gain for ISO5000 */
 };
 
+static const int32_t g_isx019_iso_auto[] =
+{
+  IMGSENSOR_ISO_SENSITIVITY_MANUAL,
+  IMGSENSOR_ISO_SENSITIVITY_AUTO,
+};
+
+#define NR_ISO_AUTO (sizeof(g_isx019_iso_auto) / sizeof(int32_t))
+
+static const int32_t g_isx019_metering[] =
+{
+  IMGSENSOR_EXPOSURE_METERING_AVERAGE,
+  IMGSENSOR_EXPOSURE_METERING_CENTER_WEIGHTED,
+  IMGSENSOR_EXPOSURE_METERING_SPOT,
+  IMGSENSOR_EXPOSURE_METERING_MATRIX,
+};
+
+#define NR_METERING (sizeof(g_isx019_metering) / sizeof(int32_t))
+
+static const int32_t g_isx019_ae[] =
+{
+  IMGSENSOR_EXPOSURE_AUTO,
+  IMGSENSOR_EXPOSURE_MANUAL,
+};
+
+#define NR_AE (sizeof(g_isx019_ae) / sizeof(int32_t))
+
 /
  * Private Functions
  /
@@ -1957,9 +1983,11 @@ static int isx019_get_supported_value(FAR struct 
imgsensor_s *sensor,
 break;
 
   case IMGSENSOR_ID_EXPOSURE_AUTO:
-val->type = IMGSENSOR_CTRL_TYPE_INTEGER;
-SET_RANGE(val->u.range, MIN_AE, MAX_AE,
-STEP_AE, def->ae);
+val->type = IMGSENSOR_CTRL_TYPE_INTEGER_MENU;
+SET_DISCRETE(val->u.discrete,
+ NR_AE,
+ g_isx019_ae,
+ IMGSENSOR_EXPOSURE_AUTO);
 break;
 
   case IMGSENSOR_ID_EXPOSURE_ABSOLUTE:
@@ -1991,15 +2019,19 @@ static int isx019_get_supported_value(FAR struct 
imgsensor_s *sensor,
 break;
 
   case IMGSENSOR_ID_ISO_SENSITIVITY_AUTO:
-val->type = IMGSENSOR_CTRL_TYPE_INTEGER;
-SET_RANGE(val->u.range, MIN_AUTOISO, MAX_AUTOISO,
-STEP_AUTOISO, def->iso_auto);
+val->type = IMGSENSOR_CTRL_TYPE_INTEGER_MENU;
+SET_DISCRETE(val->u.discrete,
+ NR_ISO_AUTO,
+ g_isx019_iso_auto,
+ IMGSENSOR_ISO_SENSITIVITY_AUTO);
 break;
 
   case IMGSENSOR_ID_EXPOSURE_METERING:
-val->type = IMGSENSOR_CTRL_TYPE_INTEGER;
-SET_RANGE(val->u.range, MIN_METER, MAX_METER,
-STEP_METER, def->meter);
+val->type = IMGSENSOR_CTRL_TYPE_INTEGER_MENU;
+SET_DISCRETE(val->u.discrete,
+ NR_METERING,
+ g_isx019_metering,
+ IMGSENSOR_EXPOSURE_METERING_AVERAGE);
 break;
 
   case IMGSENSOR_ID_SPOT_POSITION:



Re: [PR] arch/xmc4 Add tickless support [nuttx]

2024-03-11 Thread via GitHub


xiaoxiang781216 commented on code in PR #11737:
URL: https://github.com/apache/nuttx/pull/11737#discussion_r1519784635


##
arch/arm/src/xmc4/xmc4_tickless.c:
##
@@ -0,0 +1,576 @@
+/
+ * arch/arm/src/xmc4/xmc4_tickless.c
+ *
+ * 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.
+ *
+ /
+
+/
+ * Tickless OS Support.
+ *
+ * When CONFIG_SCHED_TICKLESS is enabled, all support for timer interrupts
+ * is suppressed and the platform specific code is expected to provide the
+ * following custom functions.
+ *
+ *   void up_timer_initialize(void): Initializes the timer facilities.
+ * Called early in the initialization sequence (by up_initialize()).
+ *   int up_timer_gettime(struct timespec *ts):  Returns the current
+ * time from the platform specific time source.
+ *   int up_timer_cancel(void):  Cancels the interval timer.
+ *   int up_timer_start(const struct timespec *ts): Start (or re-starts)
+ * the interval timer.
+ *
+ * The RTOS will provide the following interfaces for use by the platform-
+ * specific interval timer implementation:
+ *
+ *   void nxsched_timer_expiration(void):  Called by the platform-specific
+ * logic when the interval timer expires.
+ *
+ * NOTE
+ * Alarm option is NOT supported by XMC and never will.
+ * Hardware restrictions.
+ *
+ /
+
+/
+ * XMC Timer Usage
+ *
+ * This implementation uses two timers:
+ *  - One freerun timer to get the time since startup
+ *  - One oneshoe timer to wait the desired delay
+ *
+ * For now, user cannot choose the CCU used. This implementation uses the
+ * CCU40 for timing, and CCU41 for interval. Contributions are welcome
+ *
+ /
+
+/
+ * Included Files
+ /
+
+#include 
+
+#include 
+#include 
+#include 
+#include 
+#include 
+
+#include 
+#include 
+#include 
+
+#include "arm_internal.h"
+#include 
+#include "hardware/xmc4_scu.h"
+#include "hardware/xmc4_ccu4.h"
+#include "xmc4_ccu4.h"
+
+#ifdef CONFIG_SCHED_TICKLESS
+
+/
+ * Pre-processor Definitions
+ /
+
+/* Only alarm option can be supporter by xmc.
+ * Indeed, xmc CCU compare value cannot be updated
+ * on the flight. It's updated via shadow registers and
+ * these are loaded to compare value register only on overflow
+ */
+
+#ifdef CONFIG_SCHED_TICKLESS_ALARM
+# error Alarm support is not supported by xmc
+#endif
+
+/* The XMC only have 16 bits timers, so whatever the resolution this max is
+ * reached very quickly. Therefore we force the user to enable this max.
+ */
+
+#ifndef CONFIG_SCHED_TICKLESS_LIMIT_MAX_SLEEP
+# error XMC tickless feature need to have a max delay for sleep
+#endif
+
+/
+ * Private Types
+ /
+
+struct xmc4_tickless_s
+{
+  uint32_t overflow; /* Timer counter overflow */
+  uint32_t frequency;/* Frequency Timers */
+  volatile bool pending; /* True: pending task */
+  uint32_t period;   /* Interval period */
+};
+
+/
+ * Private Data
+ /
+
+static struct xmc4_tickless_s g_tickless;
+
+/
+ * Private Functions
+ /
+

[PR] ostest: add test for libc memmem() function [nuttx-apps]

2024-03-11 Thread via GitHub


juniskane opened a new pull request, #2327:
URL: https://github.com/apache/nuttx-apps/pull/2327

   ## Summary
   
   ostest: add test for libc memmem() function
   
   See https://github.com/apache/nuttx/pull/11889
   
   ## Impact
   
   ## Testing
   
   


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscr...@nuttx.apache.org

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org



(nuttx) 14/15: drivers/video/isx019: Delete unnecessary code

2024-03-11 Thread jerpelea
This is an automated email from the ASF dual-hosted git repository.

jerpelea pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/nuttx.git

commit 3419f018a432ce33192d5423bd33314c731c15a8
Author: SPRESENSE <41312067+sprese...@users.noreply.github.com>
AuthorDate: Fri Jan 26 20:15:14 2024 +0900

drivers/video/isx019: Delete unnecessary code

Because of misunderstanding spec, unnecessary codes exist.
Delete them.
---
 drivers/video/isx019.c | 22 ++
 1 file changed, 2 insertions(+), 20 deletions(-)

diff --git a/drivers/video/isx019.c b/drivers/video/isx019.c
index 1da6d4bb84..794cbc3736 100644
--- a/drivers/video/isx019.c
+++ b/drivers/video/isx019.c
@@ -940,20 +940,11 @@ static int fpga_i2c_write(FAR isx019_dev_t *priv, uint8_t 
addr,
 
   DEBUGASSERT(size <= FPGA_I2C_REGSIZE_MAX);
 
-  config.frequency = ISX019_I2C_FREQUENCY;
-  config.address   = ISX019_I2C_SLVADDR;
-  config.addrlen   = ISX019_I2C_SLVADDR_LEN;
-
-  nxmutex_lock(>i2c_lock);
-
-  /* ISX019 requires that send read command to ISX019 before FPGA access. */
-
-  send_read_cmd(priv, , CAT_VERSION, ROM_VERSION, 1);
-
   config.frequency = FPGA_I2C_FREQUENCY;
   config.address   = FPGA_I2C_SLVADDR;
   config.addrlen   = FPGA_I2C_SLVADDR_LEN;
 
+  nxmutex_lock(>i2c_lock);
   buf[FPGA_I2C_OFFSET_ADDR] = addr;
   memcpy([FPGA_I2C_OFFSET_WRITEDATA], data, size);
   ret = i2c_write(priv->i2c,
@@ -973,20 +964,11 @@ static int fpga_i2c_read(FAR isx019_dev_t *priv, uint8_t 
addr,
 
   DEBUGASSERT(size <= FPGA_I2C_REGSIZE_MAX);
 
-  config.frequency = ISX019_I2C_FREQUENCY;
-  config.address   = ISX019_I2C_SLVADDR;
-  config.addrlen   = ISX019_I2C_SLVADDR_LEN;
-
-  nxmutex_lock(>i2c_lock);
-
-  /* ISX019 requires that send read command to ISX019 before FPGA access. */
-
-  send_read_cmd(priv, , CAT_VERSION, ROM_VERSION, 1);
-
   config.frequency = FPGA_I2C_FREQUENCY;
   config.address   = FPGA_I2C_SLVADDR;
   config.addrlen   = FPGA_I2C_SLVADDR_LEN;
 
+  nxmutex_lock(>i2c_lock);
   ret = i2c_write(priv->i2c,
   ,
   ,



(nuttx) 03/15: drivers/video/isx012: Fix control type of some parameters

2024-03-11 Thread jerpelea
This is an automated email from the ASF dual-hosted git repository.

jerpelea pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/nuttx.git

commit fdf9f009529b40e48842b6367fb08fab4513ffaf
Author: SPRESENSE <41312067+sprese...@users.noreply.github.com>
AuthorDate: Tue Oct 17 13:31:00 2023 +0900

drivers/video/isx012: Fix control type of some parameters

Fix control type of some parameters according to specification.
---
 drivers/video/isx012.c | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/drivers/video/isx012.c b/drivers/video/isx012.c
index cc6200bee2..5c4b69bb90 100644
--- a/drivers/video/isx012.c
+++ b/drivers/video/isx012.c
@@ -1764,7 +1764,7 @@ static int isx012_get_supported_value(FAR struct 
imgsensor_s *sensor,
 break;
 
   case IMGSENSOR_ID_CONTRAST:
-value->type  = IMGSENSOR_CTRL_TYPE_U8FIXEDPOINT_Q7;
+value->type  = IMGSENSOR_CTRL_TYPE_INTEGER;
 range->minimum   = ISX012_MIN_CONTRAST;
 range->maximum   = ISX012_MAX_CONTRAST;
 range->step  = ISX012_STEP_CONTRAST;
@@ -1808,7 +1808,7 @@ static int isx012_get_supported_value(FAR struct 
imgsensor_s *sensor,
 break;
 
   case IMGSENSOR_ID_EXPOSURE:
-value->type  = IMGSENSOR_CTRL_TYPE_INTEGER_TIMES_3;
+value->type  = IMGSENSOR_CTRL_TYPE_INTEGER;
 range->minimum   = ISX012_MIN_EXPOSURE;
 range->maximum   = ISX012_MAX_EXPOSURE;
 range->step  = ISX012_STEP_EXPOSURE;
@@ -1925,7 +1925,7 @@ static int isx012_get_supported_value(FAR struct 
imgsensor_s *sensor,
 break;
 
   case IMGSENSOR_ID_WIDE_DYNAMIC_RANGE:
-value->type  = IMGSENSOR_CTRL_TYPE_BOOLEAN;
+value->type  = IMGSENSOR_CTRL_TYPE_INTEGER;
 range->minimum   = ISX012_MIN_YGAMMA;
 range->maximum   = ISX012_MAX_YGAMMA;
 range->step  = ISX012_STEP_YGAMMA;



(nuttx) 07/15: drivers/video/isx019: Fix bug that read value is not correct

2024-03-11 Thread jerpelea
This is an automated email from the ASF dual-hosted git repository.

jerpelea pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/nuttx.git

commit fd5c2d49225cb51a6831c2f67925a4d4bed42e84
Author: SPRESENSE <41312067+sprese...@users.noreply.github.com>
AuthorDate: Thu Dec 21 15:26:35 2023 +0900

drivers/video/isx019: Fix bug that read value is not correct

About parameter whose register size is less than 4 bytes,
when transfer read value to API parameter, cast appropriately
to avoid the following problems.
- Read value includes garbage value
- Negative value becomes huge positive value
---
 drivers/video/isx019.c | 61 +++---
 1 file changed, 48 insertions(+), 13 deletions(-)

diff --git a/drivers/video/isx019.c b/drivers/video/isx019.c
index a763328c94..d7aa292414 100644
--- a/drivers/video/isx019.c
+++ b/drivers/video/isx019.c
@@ -99,14 +99,27 @@
 
 /* For set_value() and get_value() I/F */
 
-#define SET_REGINFO(a, c, o, s) do \
+#define SET_REGINFO(a, c, o, t, s) do \
   {  \
 (a)->category = (c); \
 (a)->offset   = (o); \
+(a)->type = (t); \
 (a)->size = (s); \
   }  \
 while (0);
 
+/* Register type, which represents the number of bits and
+ * whether it is signed or unsigned.
+ */
+
+#define ISX019_REGTYPE_INT8   (0)
+#define ISX019_REGTYPE_UINT8  (1)
+#define ISX019_REGTYPE_INT16  (2)
+
+#define SET_REGINFO_INT8(a, c, o) SET_REGINFO(a, c, o, ISX019_REGTYPE_INT8, 1)
+#define SET_REGINFO_UINT8(a, c, o) SET_REGINFO(a, c, o, ISX019_REGTYPE_UINT8, 
1)
+#define SET_REGINFO_INT16(a, c, o) SET_REGINFO(a, c, o, ISX019_REGTYPE_INT16, 
2)
+
 #define VALIDATE_RANGE(v, min, max, step) (((v) >= (min)) && \
((v) <= (max)) && \
(((v) - (min)) % (step) == 0))
@@ -239,6 +252,7 @@ struct isx019_reginfo_s
 {
   uint16_t category;
   uint16_t offset;
+  uint8_t  type;
   uint8_t  size;
 };
 
@@ -2040,12 +2054,12 @@ static int32_t not_convert(int32_t val)
 
 static int32_t convert_brightness_is2reg(int32_t val)
 {
-  return (val << 2);
+  return (val * 4);
 }
 
 static int32_t convert_brightness_reg2is(int32_t val)
 {
-  return (val >> 2);
+  return (val / 4);
 }
 
 static int32_t convert_hue_is2reg(int32_t val)
@@ -2119,38 +2133,38 @@ static convert_t get_reginfo(uint32_t id, bool is_set,
   switch (id)
 {
   case IMGSENSOR_ID_BRIGHTNESS:
-SET_REGINFO(reg, CAT_PICTTUNE, UIBRIGHTNESS, 2);
+SET_REGINFO_INT16(reg, CAT_PICTTUNE, UIBRIGHTNESS);
 cvrt = is_set ? convert_brightness_is2reg
   : convert_brightness_reg2is;
 break;
 
   case IMGSENSOR_ID_CONTRAST:
-SET_REGINFO(reg, CAT_PICTTUNE, UICONTRAST, 1);
+SET_REGINFO_UINT8(reg, CAT_PICTTUNE, UICONTRAST);
 cvrt = not_convert;
 break;
 
   case IMGSENSOR_ID_SATURATION:
-SET_REGINFO(reg, CAT_PICTTUNE, UISATURATION, 1);
+SET_REGINFO_UINT8(reg, CAT_PICTTUNE, UISATURATION);
 cvrt = not_convert;
 break;
 
   case IMGSENSOR_ID_HUE:
-SET_REGINFO(reg, CAT_PICTTUNE, UIHUE, 1);
+SET_REGINFO_INT8(reg, CAT_PICTTUNE, UIHUE);
 cvrt = is_set ? convert_hue_is2reg : convert_hue_reg2is;
 break;
 
   case IMGSENSOR_ID_EXPOSURE:
-SET_REGINFO(reg, CAT_AEDGRM, EVSEL, 1);
+SET_REGINFO_INT8(reg, CAT_AEDGRM, EVSEL);
 cvrt = not_convert;
 break;
 
   case IMGSENSOR_ID_SHARPNESS:
-SET_REGINFO(reg, CAT_PICTTUNE, UISHARPNESS, 1);
+SET_REGINFO_UINT8(reg, CAT_PICTTUNE, UISHARPNESS);
 cvrt = not_convert;
 break;
 
   case IMGSENSOR_ID_WIDE_DYNAMIC_RANGE:
-SET_REGINFO(reg, CAT_AEWD, AEWDMODE, 1);
+SET_REGINFO_UINT8(reg, CAT_AEWD, AEWDMODE);
 cvrt = is_set ? convert_hdr_is2reg : convert_hdr_reg2is;
 break;
 
@@ -3568,16 +3582,37 @@ static int isx019_get_value(FAR struct imgsensor_s 
*sensor,
   isx019_reginfo_t reg;
   convert_t cvrt;
   getvalue_t get;
-  int32_t val32;
+  union
+  {
+int32_t i32;
+int16_t i16;
+int8_t  i8;
+  } regval;
 
   DEBUGASSERT(val);
 
   cvrt = get_reginfo(id, false, );
   if (cvrt)
 {
+  memset(, 0, sizeof(regval));
   ret = isx019_i2c_read(priv,
-  reg.category, reg.offset, , reg.size);
-  val->value32 = cvrt(val32);
+  reg.category, reg.offset, , reg.size);
+
+  switch (reg.type)
+{
+  case ISX019_REGTYPE_INT8:
+regval.i32 = (int32_t)regval.i8;
+break;
+
+  case ISX019_REGTYPE_INT16:
+regval.i32 = (int32_t)regval.i16;
+ 

(nuttx) 11/15: drivers/video: Fix bug that can not use scene mode

2024-03-11 Thread jerpelea
This is an automated email from the ASF dual-hosted git repository.

jerpelea pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/nuttx.git

commit ae970a8ed3e42f38718413fa9dc67c83d3cf630f
Author: SPRESENSE <41312067+sprese...@users.noreply.github.com>
AuthorDate: Mon Jan 22 17:09:41 2024 +0900

drivers/video: Fix bug that can not use scene mode

Because the mode is set in scene parameter table,
All scene modes was recognized as disabled.
---
 drivers/video/video.c | 48 
 1 file changed, 28 insertions(+), 20 deletions(-)

diff --git a/drivers/video/video.c b/drivers/video/video.c
index c66e24a0aa..a661e9e5b5 100644
--- a/drivers/video/video.c
+++ b/drivers/video/video.c
@@ -839,6 +839,7 @@ static int initialize_scene_parameter(FAR video_mng_t *vmng,
   return -ENOMEM;
 }
 
+  sp->mode= mode;
   sp->brightness  = get_default_value(vmng, IMGSENSOR_ID_BRIGHTNESS);
   sp->contrast= get_default_value(vmng, IMGSENSOR_ID_CONTRAST);
   sp->saturation  = get_default_value(vmng, IMGSENSOR_ID_SATURATION);
@@ -898,51 +899,51 @@ static void initialize_scenes_parameter(FAR video_mng_t 
*vmng)
>video_scene_param[vmng->video_scence_num++]);
 #endif /* CONFIG_VIDEO_SCENE_BACKLIGHT */
 #ifdef CONFIG_VIDEO_SCENE_BEACHSNOW
-  initialize_scene_parameter(vmng, CONFIG_VIDEO_SCENE_BEACHSNOW,
+  initialize_scene_parameter(vmng, V4L2_SCENE_MODE_BEACH_SNOW,
   >video_scene_param[vmng->video_scence_num++]);
 #endif /* CONFIG_VIDEO_SCENE_BEACHSNOW */
 #ifdef CONFIG_VIDEO_SCENE_CANDLELIGHT
-  initialize_scene_parameter(vmng, CONFIG_VIDEO_SCENE_CANDLELIGHT,
+  initialize_scene_parameter(vmng, V4L2_SCENE_MODE_CANDLE_LIGHT,
 >video_scene_param[vmng->video_scence_num++]);
 #endif /* CONFIG_VIDEO_SCENE_CANDLELIGHT */
 #ifdef CONFIG_VIDEO_SCENE_DAWNDUSK
-  initialize_scene_parameter(vmng, CONFIG_VIDEO_SCENE_DAWNDUSK,
+  initialize_scene_parameter(vmng, V4L2_SCENE_MODE_DAWN_DUSK,
  >video_scene_param[vmng->video_scence_num++]);
 #endif /* CONFIG_VIDEO_SCENE_DAWNDUSK */
 #ifdef CONFIG_VIDEO_SCENE_FALLCOLORS
-  initialize_scene_parameter(vmng, CONFIG_VIDEO_SCENE_FALLCOLORS,
+  initialize_scene_parameter(vmng, V4L2_SCENE_MODE_FALL_COLORS,
>video_scene_param[vmng->video_scence_num++]);
 #endif /* CONFIG_VIDEO_SCENE_FALLCOLORS */
 #ifdef CONFIG_VIDEO_SCENE_FIREWORKS
-  initialize_scene_parameter(vmng, CONFIG_VIDEO_SCENE_FIREWORKS,
+  initialize_scene_parameter(vmng, V4L2_SCENE_MODE_FIREWORKS,
   >video_scene_param[vmng->video_scence_num++]);
 #endif /* CONFIG_VIDEO_SCENE_FIREWORKS */
 #ifdef CONFIG_VIDEO_SCENE_LANDSCAPE
-  initialize_scene_parameter(vmng, CONFIG_VIDEO_SCENE_LANDSCAPE,
+  initialize_scene_parameter(vmng, V4L2_SCENE_MODE_LANDSCAPE,
   >video_scene_param[vmng->video_scence_num++]);
 #endif /* CONFIG_VIDEO_SCENE_LANDSCAPE */
 #ifdef CONFIG_VIDEO_SCENE_NIGHT
-  initialize_scene_parameter(vmng, CONFIG_VIDEO_SCENE_NIGHT,
+  initialize_scene_parameter(vmng, V4L2_SCENE_MODE_NIGHT,
   >video_scene_param[vmng->video_scence_num++]);
 #endif /* CONFIG_VIDEO_SCENE_NIGHT */
 #ifdef CONFIG_VIDEO_SCENE_PARTYINDOOR
-  initialize_scene_parameter(vmng, CONFIG_VIDEO_SCENE_PARTYINDOOR,
+  initialize_scene_parameter(vmng, V4L2_SCENE_MODE_PARTY_INDOOR,
 >video_scene_param[vmng->video_scence_num++]);
 #endif /* CONFIG_VIDEO_SCENE_PARTYINDOOR */
 #ifdef CONFIG_VIDEO_SCENE_PORTRAIT
-  initialize_scene_parameter(vmng, CONFIG_VIDEO_SCENE_PORTRAIT,
+  initialize_scene_parameter(vmng, V4L2_SCENE_MODE_PORTRAIT,
  >video_scene_param[vmng->video_scence_num++]);
 #endif /* CONFIG_VIDEO_SCENE_PORTRAIT */
 #ifdef CONFIG_VIDEO_SCENE_SPORTS
-  initialize_scene_parameter(vmng, CONFIG_VIDEO_SCENE_SPORTS,
+  initialize_scene_parameter(vmng, V4L2_SCENE_MODE_SPORTS,
>video_scene_param[vmng->video_scence_num++]);
 #endif /* CONFIG_VIDEO_SCENE_SPORTS */
 #ifdef CONFIG_VIDEO_SCENE_SUNSET
-  initialize_scene_parameter(vmng, CONFIG_VIDEO_SCENE_SUNSET,
+  initialize_scene_parameter(vmng, V4L2_SCENE_MODE_SUNSET,
>video_scene_param[vmng->video_scence_num++]);
 #endif /* CONFIG_VIDEO_SCENE_SUNSET */
 #ifdef CONFIG_VIDEO_SCENE_TEXT
-  initialize_scene_parameter(vmng, CONFIG_VIDEO_SCENE_TEXT,
+  initialize_scene_parameter(vmng, V4L2_SCENE_MODE_TEXT,
  >video_scene_param[vmng->video_scence_num++]);
 #endif /* CONFIG_VIDEO_SCENE_TEXT */
 }
@@ -2344,16 +2345,23 @@ static int video_g_ext_ctrls(FAR struct video_mng_s 
*priv,
cnt < ctrls->count;
cnt++, control++)
 {
-  ret = IMGSENSOR_GET_VALUE(priv->imgsensor,
-  control->id,
-  control->size,
-  (imgsensor_value_t *)>value64);
-  if (ret < 0)
+  if (control->id == V4L2_CID_SCENE_MODE)
 {
-  /* Set cnt in that error occurred */
+  control->value = 

(nuttx) 15/15: drivers/video/isx012: Fix buffer overrun of isx012_putreg()

2024-03-11 Thread jerpelea
This is an automated email from the ASF dual-hosted git repository.

jerpelea pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/nuttx.git

commit bac0228825ee93af86b66ee1d69081f54b248d4c
Author: SPRESENSE <41312067+sprese...@users.noreply.github.com>
AuthorDate: Tue Dec 19 15:25:59 2023 +0900

drivers/video/isx012: Fix buffer overrun of isx012_putreg()

The maximum size of ISX012 register is 4 bytes.
So, extend temporary buffer size.

Detected by CodeSonar 141893
---
 drivers/video/isx012.c | 14 --
 1 file changed, 8 insertions(+), 6 deletions(-)

diff --git a/drivers/video/isx012.c b/drivers/video/isx012.c
index 5c4b69bb90..d612a689c7 100644
--- a/drivers/video/isx012.c
+++ b/drivers/video/isx012.c
@@ -216,7 +216,7 @@ typedef struct isx012_dev_s isx012_dev_t;
 static uint16_t isx012_getreg(FAR isx012_dev_t *priv,
   uint16_t regaddr, uint16_t regsize);
 static int isx012_putreg(FAR isx012_dev_t *priv, uint16_t regaddr,
- uint16_t regval, uint16_t regsize);
+ uint32_t regval, uint16_t regsize);
 static int isx012_putreglist(FAR isx012_dev_t *priv,
  FAR const isx012_reg_t *reglist, size_t nentries);
 #ifdef ISX012_CHECK_IN_DETAIL
@@ -676,8 +676,8 @@ static uint16_t isx012_getreg(FAR isx012_dev_t *priv,
   uint16_t regaddr, uint16_t regsize)
 {
   struct i2c_config_s config;
-  volatile uint16_t regval = 0;
-  volatile uint8_t buffer[2];
+  uint16_t regval = 0;
+  uint8_t buffer[2];
   int ret;
 
   /* Set up the I2C configuration */
@@ -719,12 +719,14 @@ static uint16_t isx012_getreg(FAR isx012_dev_t *priv,
 }
 
 static int isx012_putreg(FAR isx012_dev_t *priv,
- uint16_t regaddr, uint16_t regval, uint16_t regsize)
+ uint16_t regaddr, uint32_t regval, uint16_t regsize)
 {
   struct i2c_config_s config;
-  volatile uint8_t buffer[4];
+  uint8_t buffer[6];
   int ret;
 
+  DEBUGASSERT(regsize <= 4);
+
   /* Set up the I2C configuration */
 
   config.frequency = priv->i2c_freq;
@@ -779,7 +781,7 @@ static int isx012_chk_int_state(FAR isx012_dev_t *priv,
 uint32_t wait_time, uint32_t timeout)
 {
   int ret = 0;
-  volatile uint8_t data;
+  uint8_t data;
   uint32_t time = 0;
 
   nxsig_usleep(delay_time * 1000);



[PR] testing/getprime: allow running with zero threads [nuttx-apps]

2024-03-11 Thread via GitHub


juniskane opened a new pull request, #2328:
URL: https://github.com/apache/nuttx-apps/pull/2328

   ## Summary
   
   getprime can now run without creating any additional threads. This helps 
testing pthreads and measuring performance of directly searching primes from 
main thread versus creating one thread.
   
   Also don't misuse ASSERT() for checking command-line input coming from user.
   
   ## Impact
   
   ## Testing
   
   Tested with ox64:nsh board
   
   


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscr...@nuttx.apache.org

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org



(nuttx) branch master updated: libs/libc/string: fix memmem() boundary case when needle is at end of haystack

2024-03-11 Thread xiaoxiang
This is an automated email from the ASF dual-hosted git repository.

xiaoxiang pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/nuttx.git


The following commit(s) were added to refs/heads/master by this push:
 new 47026978bf libs/libc/string: fix memmem() boundary case when needle is 
at end of haystack
47026978bf is described below

commit 47026978bf7d1f3db6f86a98a8e6ba73024f9489
Author: Juha Niskanen 
AuthorDate: Mon Mar 11 12:40:43 2024 +0200

libs/libc/string: fix memmem() boundary case when needle is at end of 
haystack

This fixes calls like memmem("hello", 5, "lo", 2);

Also zero-length needle is deemed to exist at beginning of haystack.
This behavior matches memmem() on Linux, FreeBSD, NetBSD and OpenBSD.

Signed-off-by: Juha Niskanen 
---
 libs/libc/string/lib_memmem.c | 7 ++-
 1 file changed, 6 insertions(+), 1 deletion(-)

diff --git a/libs/libc/string/lib_memmem.c b/libs/libc/string/lib_memmem.c
index 77dbd4b357..f54ea9817c 100644
--- a/libs/libc/string/lib_memmem.c
+++ b/libs/libc/string/lib_memmem.c
@@ -51,12 +51,17 @@ FAR void *memmem(FAR const void *haystack, size_t 
haystacklen,
   size_t i;
   size_t y;
 
+  if (needlelen == 0)
+{
+  return (void *)haystack;
+}
+
   if (needlelen > haystacklen)
 {
   return NULL;
 }
 
-  for (i = 0; i < haystacklen - needlelen; i++)
+  for (i = 0; i <= haystacklen - needlelen; i++)
 {
   y = 0;
   while (h[i + y] == n[y])



[PR] docs/esp32c6: Add spiflash docs for esp32c6 [nuttx]

2024-03-11 Thread via GitHub


eren-terzioglu opened a new pull request, #11894:
URL: https://github.com/apache/nuttx/pull/11894

   ## Summary
   
   - docs/esp32c6: Remove sotest docs esp32c6
   - docs/esp32c3: Add spiflash docs esp32c3
   - docs/esp32c3: Remove sotest docs esp32c3
   - docs/esp32h2: Add spiflash docs esp32h2
   - docs/esp32h2: Remove sotest docs esp32h2
   
   ## Impact
   
   ESP32-H2, ESP32-C3, ESP32-C6
   
   ## Testing
   
   


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscr...@nuttx.apache.org

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org



Re: [PR] libs/libc/string: fix memmem() boundary case when needle is at end of haystack [nuttx]

2024-03-11 Thread via GitHub


acassis commented on PR #11889:
URL: https://github.com/apache/nuttx/pull/11889#issuecomment-1988584378

   @juniskane sounds like a google idea! @PetteriAimonen @xiaoxiang781216 What 
do you think?
   
   We could have a simple Pass/Fail suite with all tests. The ostest is more 
iterative testing tool to find issues.


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscr...@nuttx.apache.org

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org



Re: [PR] libs/libc/string: fix memmem() boundary case when needle is at end of haystack [nuttx]

2024-03-11 Thread via GitHub


juniskane commented on PR #11889:
URL: https://github.com/apache/nuttx/pull/11889#issuecomment-1988600012

   I crafted a commit to add this testcase to ostest, so that it is stored at 
least somewhere.


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscr...@nuttx.apache.org

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org



Re: [PR] libs/libc/string: fix memmem() boundary case when needle is at end of haystack [nuttx]

2024-03-11 Thread via GitHub


xiaoxiang781216 commented on PR #11889:
URL: https://github.com/apache/nuttx/pull/11889#issuecomment-1988639855

   > @juniskane sounds like a good idea! @PetteriAimonen @xiaoxiang781216 What 
do you think?
   > 
   > We could have a simple Pass/Fail suite with all tests. The ostest is more 
iterative testing tool to find issues.
   
   it's better to integrate libc-test and add this test into it:
   http://nsz.repo.hu/git/?p=libc-test;a=summary


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscr...@nuttx.apache.org

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org



Re: [PR] sched/pthread: replace pthread_sem_give() to nxsem_post() to unify the post method [nuttx]

2024-03-11 Thread via GitHub


xiaoxiang781216 merged PR #11891:
URL: https://github.com/apache/nuttx/pull/11891


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscr...@nuttx.apache.org

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org



Re: [PR] docs/esp32c6: Add spiflash docs for esp32c6 [nuttx]

2024-03-11 Thread via GitHub


xiaoxiang781216 merged PR #11894:
URL: https://github.com/apache/nuttx/pull/11894


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscr...@nuttx.apache.org

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org



(nuttx) branch master updated: docs/esp32c6: Add spiflash docs for esp32c6 docs/esp32c6: Remove sotest docs esp32c6 docs/esp32c3: Add spiflash docs esp32c3 docs/esp32c3: Remove sotest docs esp32c3 doc

2024-03-11 Thread xiaoxiang
This is an automated email from the ASF dual-hosted git repository.

xiaoxiang pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/nuttx.git


The following commit(s) were added to refs/heads/master by this push:
 new 61689237f6 docs/esp32c6: Add spiflash docs for esp32c6 docs/esp32c6: 
Remove sotest docs esp32c6 docs/esp32c3: Add spiflash docs esp32c3 
docs/esp32c3: Remove sotest docs esp32c3 docs/esp32h2: Add spiflash docs 
esp32h2 docs/esp32h2: Remove sotest docs esp32h2
61689237f6 is described below

commit 61689237f6883f66d0b8d6870b6a47ddaf00a98c
Author: Eren Terzioglu 
AuthorDate: Wed Mar 6 19:28:42 2024 +0300

docs/esp32c6: Add spiflash docs for esp32c6
docs/esp32c6: Remove sotest docs esp32c6
docs/esp32c3: Add spiflash docs esp32c3
docs/esp32c3: Remove sotest docs esp32c3
docs/esp32h2: Add spiflash docs esp32h2
docs/esp32h2: Remove sotest docs esp32h2
---
 .../risc-v/esp32c3/boards/esp32c3-generic/index.rst | 13 ++---
 Documentation/platforms/risc-v/esp32c3/index.rst|  2 +-
 .../risc-v/esp32c6/boards/esp32c6-devkit/index.rst  | 13 ++---
 Documentation/platforms/risc-v/esp32c6/index.rst|  2 +-
 .../risc-v/esp32h2/boards/esp32h2-devkit/index.rst  | 13 ++---
 Documentation/platforms/risc-v/esp32h2/index.rst|  2 +-
 6 files changed, 33 insertions(+), 12 deletions(-)

diff --git 
a/Documentation/platforms/risc-v/esp32c3/boards/esp32c3-generic/index.rst 
b/Documentation/platforms/risc-v/esp32c3/boards/esp32c3-generic/index.rst
index a94ba89c17..343cc8f58a 100644
--- a/Documentation/platforms/risc-v/esp32c3/boards/esp32c3-generic/index.rst
+++ b/Documentation/platforms/risc-v/esp32c3/boards/esp32c3-generic/index.rst
@@ -150,10 +150,17 @@ You can set an alarm, check its progress and receive a 
notification after it exp
 Alarm 0 is active with 10 seconds to expiration
 nsh> alarm_daemon: alarm 0 received
 
-sotest
---
+spiflash
+
+
+This config tests the external SPI that comes with the ESP32-C3 module 
connected
+through SPI1.
+
+By default a SmartFS file system is selected.
+Once booted you can use the following commands to mount the file system::
 
-This config is to run apps/examples/sotest.
+nsh> mksmartfs /dev/smart0
+nsh> mount -t smartfs /dev/smart0 /mnt
 
 timer
 -
diff --git a/Documentation/platforms/risc-v/esp32c3/index.rst 
b/Documentation/platforms/risc-v/esp32c3/index.rst
index 6902bd4a54..de181ca692 100644
--- a/Documentation/platforms/risc-v/esp32c3/index.rst
+++ b/Documentation/platforms/risc-v/esp32c3/index.rst
@@ -159,7 +159,7 @@ RSA  No
 RTC  Yes
 SHA  No
 SPI  No
-SPIFLASH No
+SPIFLASH Yes
 Timers   Yes
 TouchNo
 UART Yes
diff --git 
a/Documentation/platforms/risc-v/esp32c6/boards/esp32c6-devkit/index.rst 
b/Documentation/platforms/risc-v/esp32c6/boards/esp32c6-devkit/index.rst
index d5f130cfc6..86239315a4 100644
--- a/Documentation/platforms/risc-v/esp32c6/boards/esp32c6-devkit/index.rst
+++ b/Documentation/platforms/risc-v/esp32c6/boards/esp32c6-devkit/index.rst
@@ -185,10 +185,17 @@ You can set an alarm, check its progress and receive a 
notification after it exp
 Alarm 0 is active with 10 seconds to expiration
 nsh> alarm_daemon: alarm 0 received
 
-sotest
---
+spiflash
+
+
+This config tests the external SPI that comes with the ESP32-C6 module 
connected
+through SPI1.
+
+By default a SmartFS file system is selected.
+Once booted you can use the following commands to mount the file system::
 
-This config is to run apps/examples/sotest.
+nsh> mksmartfs /dev/smart0
+nsh> mount -t smartfs /dev/smart0 /mnt
 
 timer
 -
diff --git a/Documentation/platforms/risc-v/esp32c6/index.rst 
b/Documentation/platforms/risc-v/esp32c6/index.rst
index fe817c1e69..1be5e29067 100644
--- a/Documentation/platforms/risc-v/esp32c6/index.rst
+++ b/Documentation/platforms/risc-v/esp32c6/index.rst
@@ -167,7 +167,7 @@ SD/MMC   No
 SDIO No
 SHA  No
 SPI  No
-SPIFLASH No
+SPIFLASH Yes
 Timers   Yes
 UART Yes
 Watchdog Yes
diff --git 
a/Documentation/platforms/risc-v/esp32h2/boards/esp32h2-devkit/index.rst 
b/Documentation/platforms/risc-v/esp32h2/boards/esp32h2-devkit/index.rst
index 01e445fc78..3224f5a29f 100644
--- a/Documentation/platforms/risc-v/esp32h2/boards/esp32h2-devkit/index.rst
+++ b/Documentation/platforms/risc-v/esp32h2/boards/esp32h2-devkit/index.rst
@@ -184,10 +184,17 @@ You can set an alarm, check its progress and receive a 
notification after it exp
 Alarm 0 is active with 10 seconds to expiration
 nsh> alarm_daemon: alarm 0 received
 
-sotest
---
+spiflash
+
+
+This config tests the external SPI that comes with the ESP32-H2 module 
connected
+through SPI1.
+
+By default a SmartFS file system is selected.
+Once booted you can 

(nuttx) branch master updated: sched/pthread: replace pthread_sem_give() to nxsem_post() to unify the post method

2024-03-11 Thread xiaoxiang
This is an automated email from the ASF dual-hosted git repository.

xiaoxiang pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/nuttx.git


The following commit(s) were added to refs/heads/master by this push:
 new be482cd830 sched/pthread: replace pthread_sem_give() to nxsem_post() 
to unify the post method
be482cd830 is described below

commit be482cd830d72dd6a3b03840f6ce7698ee34377b
Author: chao an 
AuthorDate: Mon Mar 11 19:59:08 2024 +0800

sched/pthread: replace pthread_sem_give() to nxsem_post() to unify the post 
method

replace pthread_sem_give() to nxsem_post() to unify the post method

Signed-off-by: chao an 
---
 sched/pthread/pthread_completejoin.c | 2 +-
 sched/pthread/pthread_join.c | 2 +-
 2 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/sched/pthread/pthread_completejoin.c 
b/sched/pthread/pthread_completejoin.c
index 42656c1705..e87455ab1e 100644
--- a/sched/pthread/pthread_completejoin.c
+++ b/sched/pthread/pthread_completejoin.c
@@ -73,7 +73,7 @@ static bool pthread_notifywaiters(FAR struct join_s *pjoin)
 
   do
 {
-  status = pthread_sem_give(>exit_sem);
+  status = nxsem_post(>exit_sem);
   if (status == OK)
 {
   status = nxsem_get_value(>exit_sem, _waiting);
diff --git a/sched/pthread/pthread_join.c b/sched/pthread/pthread_join.c
index 9c27cde9aa..90c187deee 100644
--- a/sched/pthread/pthread_join.c
+++ b/sched/pthread/pthread_join.c
@@ -187,7 +187,7 @@ int pthread_join(pthread_t thread, FAR pthread_addr_t 
*pexit_value)
* will know that we have received the data.
*/
 
-  pthread_sem_give(>data_sem);
+  nxsem_post(>data_sem);
 
   /* Retake the join semaphore, we need to hold this when
* pthread_destroyjoin is called.



Re: [PR] arch/xmc4 Add tickless support [nuttx]

2024-03-11 Thread via GitHub


acassis commented on PR #11737:
URL: https://github.com/apache/nuttx/pull/11737#issuecomment-1988952824

   @nicolas71640 thank you very much for your investigation on these issues and 
for making things work! Kudos!!!


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscr...@nuttx.apache.org

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org



(nuttx) branch master updated: arch/xmc4 Add tickless support

2024-03-11 Thread acassis
This is an automated email from the ASF dual-hosted git repository.

acassis pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/nuttx.git


The following commit(s) were added to refs/heads/master by this push:
 new 63782c7ff2 arch/xmc4 Add tickless support
63782c7ff2 is described below

commit 63782c7ff277e861aad41e4c43a362304ab615df
Author: Nicolas Lemblé 
AuthorDate: Wed Feb 21 15:01:38 2024 +0100

arch/xmc4 Add tickless support
---
 arch/arm/Kconfig  |   1 +
 arch/arm/src/xmc4/Make.defs   |   3 +
 arch/arm/src/xmc4/xmc4_ccu4.c | 195 +
 arch/arm/src/xmc4/xmc4_ccu4.h |  64 +
 arch/arm/src/xmc4/xmc4_tickless.c | 574 ++
 5 files changed, 837 insertions(+)

diff --git a/arch/arm/Kconfig b/arch/arm/Kconfig
index b663dd3f49..d442eb6946 100644
--- a/arch/arm/Kconfig
+++ b/arch/arm/Kconfig
@@ -600,6 +600,7 @@ config ARCH_CHIP_XMC4
select ARCH_HAVE_I2CRESET
select ARM_HAVE_MPU_UNIFIED
select ARMV7M_HAVE_STACKCHECK
+   select ARCH_HAVE_TICKLESS
---help---
Infineon XMC4xxx(ARM Cortex-M4) architectures
 
diff --git a/arch/arm/src/xmc4/Make.defs b/arch/arm/src/xmc4/Make.defs
index 367ad7e629..2a3cb30852 100644
--- a/arch/arm/src/xmc4/Make.defs
+++ b/arch/arm/src/xmc4/Make.defs
@@ -25,6 +25,7 @@ include armv7-m/Make.defs
 CHIP_CSRCS  = xmc4_allocateheap.c xmc4_clockconfig.c xmc4_clockutils.c
 CHIP_CSRCS += xmc4_clrpend.c xmc4_flash.c xmc4_gpio.c xmc4_irq.c
 CHIP_CSRCS += xmc4_lowputc.c xmc4_serial.c xmc4_start.c xmc4_usic.c
+CHIP_CSRCS += xmc4_ccu4.c
 
 # Configuration-dependent Kinetis files
 
@@ -34,6 +35,8 @@ endif
 
 ifneq ($(CONFIG_SCHED_TICKLESS),y)
 CHIP_CSRCS += xmc4_timerisr.c
+else
+CHIP_CSRCS += xmc4_tickless.c
 endif
 
 ifeq ($(CONFIG_BUILD_PROTECTED),y)
diff --git a/arch/arm/src/xmc4/xmc4_ccu4.c b/arch/arm/src/xmc4/xmc4_ccu4.c
new file mode 100644
index 00..8d8519d099
--- /dev/null
+++ b/arch/arm/src/xmc4/xmc4_ccu4.c
@@ -0,0 +1,195 @@
+/
+ * arch/arm/src/xmc4/xmc4_ccu4.c
+ *
+ * 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.
+ *
+ /
+
+/
+ * XMC CCU Driver
+ *
+ * For now, this file contains only helper methods mandatory for xmc tickless
+ * feature. Contibutions are welcomed.
+ *
+ /
+
+/
+ * Included Files
+ /
+
+#include 
+#include 
+
+#include 
+#include 
+#include 
+
+#include "arm_internal.h"
+#include "hardware/xmc4_ccu4.h"
+#include "xmc4_ccu4.h"
+
+#define CCU4_NDIVIDERS 15
+
+static const uint8_t g_log2divider[CCU4_NDIVIDERS] =
+{
+1,  /* TIMER_CLOCK1 -> div2 */
+2,  /* TIMER_CLOCK1 -> div4 */
+3,  /* TIMER_CLOCK2 -> div8 */
+4,  /* TIMER_CLOCK2 -> div16 */
+5,  /* TIMER_CLOCK3 -> div32 */
+6,  /* TIMER_CLOCK3 -> div64 */
+7,  /* TIMER_CLOCK4 -> div128 */
+8,  /* TIMER_CLOCK4 -> div256 */
+9,  /* TIMER_CLOCK4 -> div512 */
+10, /* TIMER_CLOCK4 -> div1024 */
+11, /* TIMER_CLOCK4 -> div2048 */
+12, /* TIMER_CLOCK4 -> div4096 */
+13, /* TIMER_CLOCK4 -> div8192 */
+14, /* TIMER_CLOCK4 -> div16384 */
+15  /* TIMER_CLOCK4 -> div32769 */
+};
+
+/
+ * Private Functions
+ /
+
+/
+ * Name: xmc4_ccu4_divfreq_lookup
+ *
+ * Description:
+ *  Given the TC input frequency (Ftcin) and a divider index, return the
+ *  value of the divided frequency
+ *
+ * Input Parameters:
+ *   ftcin - TC input frequency
+ *   ndx   - Divider index
+ *
+ * Returned Value:
+ *   The divided frequency value
+ *
+ 

Re: [PR] arch/xmc4 Add tickless support [nuttx]

2024-03-11 Thread via GitHub


acassis merged PR #11737:
URL: https://github.com/apache/nuttx/pull/11737


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscr...@nuttx.apache.org

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org



Re: [I] Simulator export fails [nuttx]

2024-03-11 Thread via GitHub


acassis commented on issue #11863:
URL: https://github.com/apache/nuttx/issues/11863#issuecomment-1989058094

   @xuxin930 since you are fixing the CMake, could you please take a look?


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscr...@nuttx.apache.org

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org



Re: [PR] camera_example: modify initialize interface after v4l2 refactor [nuttx-apps]

2024-03-11 Thread via GitHub


acassis commented on PR #2326:
URL: https://github.com/apache/nuttx-apps/pull/2326#issuecomment-1989064623

   @shizhenghui please fix coding style check issue


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscr...@nuttx.apache.org

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org