Commit Graph

57 Commits

Author SHA1 Message Date
iabdalkader
1f1e2b59e9 common/csi: Add post-processing op.
Signed-off-by: iabdalkader <i.abdalkader@gmail.com>
2025-08-09 12:04:05 +02:00
iabdalkader
9112cf2aae misc: Clean-up CSI flags.
Signed-off-by: iabdalkader <i.abdalkader@gmail.com>
2025-08-09 12:00:59 +02:00
iabdalkader
451c1e7664 common/csi: Add support for custom resolutions.
Signed-off-by: iabdalkader <i.abdalkader@gmail.com>
2025-08-08 14:45:23 +02:00
iabdalkader
df5c767cb8 common/vospi: Fix synchronization issues.
- Abort if synchronization takes too long.
- Reinit SPI on transfer restart (fixes an issue on N6).
- Clean up vospi code.

Signed-off-by: iabdalkader <i.abdalkader@gmail.com>
2025-08-02 13:57:00 +02:00
iabdalkader
9bb174454b common/csi: Track elapsed time since last hard-reset.
Signed-off-by: iabdalkader <i.abdalkader@gmail.com>
2025-08-02 13:24:12 +02:00
Kwabena W. Agyeman
20839405a2 lib/imlib: Add transform support to GPU drivers. 2025-07-31 13:12:48 -07:00
iabdalkader
77289676d5 common/vospi: make vospi_restart() non-blocking.
Check if VOSPI_SYNC_MS has elapsed since the last abort instead
of delaying on every call. This avoids blocking other CSIs on
back-to-back resync's.

Signed-off-by: iabdalkader <i.abdalkader@gmail.com>
2025-07-27 15:37:03 +02:00
iabdalkader
9bcef8e17c common/csi: Add power-on time.
Can be used by driver to check for elapsed time since
power-on.

Signed-off-by: iabdalkader <i.abdalkader@gmail.com>
2025-07-27 15:01:45 +02:00
iabdalkader
0458db2130 misc: Use updated mutex API.
Signed-off-by: iabdalkader <i.abdalkader@gmail.com>
2025-07-25 20:20:57 +02:00
iabdalkader
2c4b318ff9 common/mutex: Use C11 atomic operations.
Use C11 atomic operations to implement the mutex instead
of hard-coded intrinsics. This generates more efficient
assembly on newer ARM architectures by taking advantage
of the new LDA/STL instructions (and their exclusive variants),
which avoid full memory barriers while still providing
memory ordering guarantees.

Signed-off-by: iabdalkader <i.abdalkader@gmail.com>
2025-07-25 20:20:54 +02:00
iabdalkader
ca5dcc8033 drivers: Use the new framebuffer API.
Signed-off-by: iabdalkader <i.abdalkader@gmail.com>
2025-07-23 18:24:55 +02:00
iabdalkader
af711cfc90 common: Use the new framebuffer API.
Signed-off-by: iabdalkader <i.abdalkader@gmail.com>
2025-07-23 18:24:55 +02:00
iabdalkader
9030b4b8dd common/csi: Refactor snapshot prologue.
Signed-off-by: iabdalkader <i.abdalkader@gmail.com>
2025-07-23 18:24:55 +02:00
iabdalkader
5d1f8860b1 imlib: Rework framebuffer management.
Signed-off-by: iabdalkader <i.abdalkader@gmail.com>
2025-07-23 18:24:52 +02:00
iabdalkader
50c9be73c8 common: Add SPSC lock-free queue.
Signed-off-by: iabdalkader <i.abdalkader@gmail.com>
2025-07-23 18:24:52 +02:00
Kwabena W. Agyeman
be72f87345 common: Add polarity config override. 2025-07-21 23:10:40 -07:00
iabdalkader
5306e93ab4 common/csi: Add function to print sensor name.
Signed-off-by: iabdalkader <i.abdalkader@gmail.com>
2025-07-16 22:42:36 +02:00
iabdalkader
a9d6567a18 common: Add common align and section align macro.
Signed-off-by: iabdalkader <i.abdalkader@gmail.com>
2025-07-16 11:18:51 +02:00
iabdalkader
330ad33582 common: Remove unused ringbuf.
Signed-off-by: iabdalkader <i.abdalkader@gmail.com>
2025-07-13 19:36:35 +02:00
iabdalkader
c8a486cbda common: Add container_of macro.
Signed-off-by: iabdalkader <i.abdalkader@gmail.com>
2025-07-12 17:12:34 +02:00
Kwabena W. Agyeman
f9f6eb0302 drivers/sensors: Remove OV5640 REV_Y special case. 2025-07-05 12:09:18 -07:00
iabdalkader
2040a0a000 common/csi: Decouple the clock from main CSI state.
This patch decouples the clock from the main CSI state,
further separating the CSI instance from the port's CSI
driver. Additionally, it allows CSIs to use different clocks,
in theory, though they must first be detected somehow in
order to switch clocks.

As a side effect of sharing the clock, set_frequency will be
called more frequently (the default call plus once per CSI).
However, the frequency is now checked, and the clock is only
reconfigured if the new frequency exceeds a configurable
tolerance.

Finally, get_clk_frequency now accepts a boolean to return
either the exact clock frequency, for sensors that require
it, or the nominal frequency.

Signed-off-by: iabdalkader <i.abdalkader@gmail.com>
2025-07-05 14:17:31 +02:00
iabdalkader
a008ecf707 misc: Add GCC minimum toolchain check for CM55.
Signed-off-by: iabdalkader <i.abdalkader@gmail.com>
2025-07-05 14:02:37 +02:00
iabdalkader
ecbdbdfde1 common/csi: Refactor omv_csi_init.
Signed-off-by: iabdalkader <i.abdalkader@gmail.com>
2025-07-02 18:12:34 +02:00
iabdalkader
b3832b86c1 common/csi: Fix CSI detection & init logic.
Simplify the detection logic and handle the case where
all detected sensors (one or more) are auxiliary.

Signed-off-by: iabdalkader <i.abdalkader@gmail.com>
2025-06-30 23:43:20 +02:00
iabdalkader
2119953d51 common/vospi: Implement abort.
Signed-off-by: iabdalkader <i.abdalkader@gmail.com>
2025-06-30 23:43:16 +02:00
iabdalkader
7f4e5e81c7 common/csi: Abort CSIs on soft-reboot.
Signed-off-by: iabdalkader <i.abdalkader@gmail.com>
2025-06-29 17:20:49 +02:00
iabdalkader
662950654e common/csi: Add CONFIG_DEINIT.
Signed-off-by: iabdalkader <i.abdalkader@gmail.com>
2025-06-29 17:20:49 +02:00
iabdalkader
90a568fde5 common/csi: Add power-on flag.
Signed-off-by: iabdalkader <i.abdalkader@gmail.com>
2025-06-29 17:20:49 +02:00
iabdalkader
58d69cd571 common/csi: Add shutdown op.
Signed-off-by: iabdalkader <i.abdalkader@gmail.com>
2025-06-29 17:20:49 +02:00
Ibrahim Abdelkader
81dd44aef4
Merge pull request #2735 from openmv/refactor_csi_init
Some checks are pending
🔥 Firmware Build / build-firmware (ARDUINO_GIGA) (push) Waiting to run
🔥 Firmware Build / build-firmware (ARDUINO_NANO_33_BLE_SENSE) (push) Waiting to run
🔥 Firmware Build / build-firmware (ARDUINO_NANO_RP2040_CONNECT) (push) Waiting to run
🔥 Firmware Build / build-firmware (ARDUINO_NICLA_VISION) (push) Waiting to run
🔥 Firmware Build / build-firmware (ARDUINO_PORTENTA_H7) (push) Waiting to run
🔥 Firmware Build / build-firmware (DOCKER) (push) Waiting to run
🔥 Firmware Build / build-firmware (OPENMV2) (push) Waiting to run
🔥 Firmware Build / build-firmware (OPENMV3) (push) Waiting to run
🔥 Firmware Build / build-firmware (OPENMV4) (push) Waiting to run
🔥 Firmware Build / build-firmware (OPENMV4P) (push) Waiting to run
🔥 Firmware Build / build-firmware (OPENMVPT) (push) Waiting to run
🔥 Firmware Build / build-firmware (OPENMV_AE3) (push) Waiting to run
🔥 Firmware Build / build-firmware (OPENMV_N6) (push) Waiting to run
🔥 Firmware Build / build-firmware (OPENMV_RT1060) (push) Waiting to run
🔥 Firmware Build / code-size-report (push) Blocked by required conditions
🔥 Firmware Build / stable-release (push) Blocked by required conditions
🔥 Firmware Build / development-release (push) Blocked by required conditions
misc: Refactor CSI initialization code.
2025-06-27 22:42:05 +03:00
Ibrahim Abdelkader
921dc51da5
Merge pull request #2739 from openmv/refactor_xalloc
common: Remove xalloc.
2025-06-27 22:39:48 +03:00
iabdalkader
fed264193d common/csi: Refactor sensor init.
Signed-off-by: iabdalkader <i.abdalkader@gmail.com>
2025-06-27 20:17:01 +02:00
iabdalkader
4ded9fba91 common: Remove xalloc.
Originally meant to abstract gc_collect but we could just use
m_alloc and friends. Also was meant to provide functions like
alloc0, alloc_maybe etc.. which are all available in MP anyway.

Signed-off-by: iabdalkader <i.abdalkader@gmail.com>
2025-06-27 14:50:16 +02:00
iabdalkader
a266ac33f1 ports/all: Fix calls on uninitialized CSIs.
Detection flag should be set after CSIs are detected in
the scanning code, and functions that loop over CSIs
should check it.

Signed-off-by: iabdalkader <i.abdalkader@gmail.com>
2025-06-27 10:03:48 +02:00
Kwabena W. Agyeman
30545d47b2 common/omv_csi: Enable conflicting sensors. 2025-06-27 09:29:55 +02:00
Kwabena W. Agyeman
176f32ab90 common/omv_csi: Fix default polarity configs.
The current order that these operate works for all sensors. Changing them
breaks various sensors.
2025-06-27 09:08:46 +02:00
Ibrahim Abdelkader
abd1a05919
Merge pull request #2731 from openmv/fix_snapshot_loop
Some checks are pending
🔥 Firmware Build / build-firmware (ARDUINO_GIGA) (push) Waiting to run
🔥 Firmware Build / build-firmware (ARDUINO_NANO_33_BLE_SENSE) (push) Waiting to run
🔥 Firmware Build / build-firmware (ARDUINO_NANO_RP2040_CONNECT) (push) Waiting to run
🔥 Firmware Build / build-firmware (ARDUINO_NICLA_VISION) (push) Waiting to run
🔥 Firmware Build / build-firmware (ARDUINO_PORTENTA_H7) (push) Waiting to run
🔥 Firmware Build / build-firmware (DOCKER) (push) Waiting to run
🔥 Firmware Build / build-firmware (OPENMV2) (push) Waiting to run
🔥 Firmware Build / build-firmware (OPENMV3) (push) Waiting to run
🔥 Firmware Build / build-firmware (OPENMV4) (push) Waiting to run
🔥 Firmware Build / build-firmware (OPENMV4P) (push) Waiting to run
🔥 Firmware Build / build-firmware (OPENMVPT) (push) Waiting to run
🔥 Firmware Build / build-firmware (OPENMV_AE3) (push) Waiting to run
🔥 Firmware Build / build-firmware (OPENMV_N6) (push) Waiting to run
🔥 Firmware Build / build-firmware (OPENMV_RT1060) (push) Waiting to run
🔥 Firmware Build / code-size-report (push) Blocked by required conditions
🔥 Firmware Build / stable-release (push) Blocked by required conditions
🔥 Firmware Build / development-release (push) Blocked by required conditions
drivers: Fix snapshot loop.
2025-06-26 22:03:32 +03:00
iabdalkader
65ac3ca2ea drivers: Fix snapshot loop.
Signed-off-by: iabdalkader <i.abdalkader@gmail.com>
2025-06-26 10:10:23 +02:00
iabdalkader
bc2a3372a6 common/csi: Refactor I2C scanning code.
This should be much faster as it starts with the most common
config: power-down active low, reset active low.

Signed-off-by: iabdalkader <i.abdalkader@gmail.com>
2025-06-25 21:27:49 +02:00
iabdalkader
3270272e11 common/csi: Add support for non-blocking flag.
Signed-off-by: iabdalkader <i.abdalkader@gmail.com>
2025-06-25 10:37:43 +02:00
iabdalkader
72410dfc8c common/csi: Add support for multiple CSIs.
Signed-off-by: iabdalkader <i.abdalkader@gmail.com>
2025-06-25 10:37:41 +02:00
Kwabena W. Agyeman
3984ec783f ports/stm32: Move VOSPI memory near DMA controller.
On the STM32N6 the DMA memory meant to be used with the SPI bus is
in the low-performance memory domain. Moving the DMA buffers and
linked list buffers there reduces the AHB cycle time by the DMA
controller making it more stable.
2025-06-24 10:19:31 -07:00
Kwabena W. Agyeman
1321c5d1a1 common: Remove legacy fixed vospi memory. 2025-06-24 10:19:31 -07:00
Kwabena W. Agyeman
fc0cc40a31 drivers/sensors/lepton: Update lepton driver with asynchronous fb.
The FLIR Lepton driver now continously receives frames in the background
that are stored in allocated frame buffers. On snapshot the stored frame
is post-processed to produce a color an image.

* Transpose now works allowing for image rotation with IMU.
* Bilinear scaling is now used when drawing at a higher res.
2025-06-24 10:19:29 -07:00
iabdalkader
5933198a14 common/csi: Refactor CSI I2C bus.
Signed-off-by: iabdalkader <i.abdalkader@gmail.com>
2025-06-23 14:13:57 +02:00
iabdalkader
fe2e2cd82a common: Rename omv_csi_get_clk_frequency.
Signed-off-by: iabdalkader <i.abdalkader@gmail.com>
2025-06-23 12:41:16 +02:00
iabdalkader
6526f9412b sensors: Add support for PixArt PS5520.
Signed-off-by: iabdalkader <i.abdalkader@gmail.com>
2025-06-10 14:36:33 +02:00
iabdalkader
93d8722fc1 misc: Bump firmware version. 2025-06-01 17:40:23 +02:00
iabdalkader
d52287e129 common: Refactor framebuffer API to accept a context. 2025-04-26 16:29:27 +03:00