Commit Graph

80 Commits

Author SHA1 Message Date
iabdalkader
cc879d15b4 protocol: Introduce OMV protocol V2.
Signed-off-by: iabdalkader <i.abdalkader@gmail.com>
2025-09-21 20:26:49 +02:00
iabdalkader
91a01ee978 common/usbdbg: Remove obsolete protocol files.
Signed-off-by: iabdalkader <i.abdalkader@gmail.com>
2025-09-21 20:26:49 +02:00
iabdalkader
f205fe0219 common/mp_utils: Remove exec_bootscript.
Signed-off-by: iabdalkader <i.abdalkader@gmail.com>
2025-09-21 20:26:49 +02:00
iabdalkader
896e4164d1 common: Add circular buffer API for data streaming
Add a simple ring buffer implementation with claiming/committing,
consumption tracking, and automatic compaction when needed.

A better solution would be to implement Bip Buffer:
https://www.codeproject.com/Articles/3479/The-Bip-Buffer-The-Circular-Buffer-with-a-Twist

Signed-off-by: iabdalkader <i.abdalkader@gmail.com>
2025-09-21 20:26:49 +02:00
iabdalkader
9beb565882 common/mutex: Return true, if unlocked.
Signed-off-by: iabdalkader <i.abdalkader@gmail.com>
2025-09-19 00:06:15 +02:00
iabdalkader
1b59e95162 Revert "common/mutex: Clear tid when releasing mutex"
This reverts commit bb52288561.

Event though this fixes a deadlock in the new protocol, it
actually breaks fair locking as one side could lock multiple
times in a row.

Signed-off-by: iabdalkader <i.abdalkader@gmail.com>
2025-09-13 10:52:00 +02:00
iabdalkader
bb52288561 common/mutex: Clear tid when releasing mutex
Clear the thread ID to 0 when unlocking the mutex to prevent deadlock.
If the thread holding never reacquire it, other threads would be
permanently blocked with a stale thread ID.

Signed-off-by: iabdalkader <i.abdalkader@gmail.com>
2025-09-12 18:00:32 +02:00
iabdalkader
facd715c12 common: Add CRC HAL.
CRC-16 support.

Signed-off-by: iabdalkader <i.abdalkader@gmail.com>
2025-09-11 22:08:58 +02:00
iabdalkader
be25f116ab common: Skip embedded framebuffer header.
Not used for USBDBG.

Signed-off-by: iabdalkader <i.abdalkader@gmail.com>
2025-09-11 18:10:58 +02:00
iabdalkader
b1f81f7cdd common: Update framebuffer API.
Signed-off-by: iabdalkader <i.abdalkader@gmail.com>
2025-09-02 16:05:55 +02:00
iabdalkader
4d69dd396c boards/all: Rename JPEG buffer linker script variables.
Signed-off-by: iabdalkader <i.abdalkader@gmail.com>
2025-09-02 16:05:52 +02:00
Ibrahim Abdelkader
0e124a215d
Merge pull request #2825 from openmv/update_profiler
Some checks are pending
🔥 Firmware Build / build-firmware (0, ARDUINO_GIGA) (push) Waiting to run
🔥 Firmware Build / build-firmware (0, ARDUINO_NANO_33_BLE_SENSE) (push) Waiting to run
🔥 Firmware Build / build-firmware (0, ARDUINO_NANO_RP2040_CONNECT) (push) Waiting to run
🔥 Firmware Build / build-firmware (0, ARDUINO_NICLA_VISION) (push) Waiting to run
🔥 Firmware Build / build-firmware (0, ARDUINO_PORTENTA_H7) (push) Waiting to run
🔥 Firmware Build / build-firmware (0, DOCKER) (push) Waiting to run
🔥 Firmware Build / build-firmware (0, OPENMV2) (push) Waiting to run
🔥 Firmware Build / build-firmware (0, OPENMV3) (push) Waiting to run
🔥 Firmware Build / build-firmware (0, OPENMV4) (push) Waiting to run
🔥 Firmware Build / build-firmware (0, OPENMV4P) (push) Waiting to run
🔥 Firmware Build / build-firmware (0, OPENMVPT) (push) Waiting to run
🔥 Firmware Build / build-firmware (0, OPENMV_AE3) (push) Waiting to run
🔥 Firmware Build / build-firmware (0, OPENMV_N6) (push) Waiting to run
🔥 Firmware Build / build-firmware (0, OPENMV_RT1060) (push) Waiting to run
🔥 Firmware Build / build-firmware (1, OPENMV_N6) (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
common/profiler: Add get_size function.
2025-08-30 22:34:50 +03:00
iabdalkader
49f330f2dc common/profiler: Add get_size function.
Signed-off-by: iabdalkader <i.abdalkader@gmail.com>
2025-08-30 21:15:38 +02:00
Kwabena W. Agyeman
657c9a6325 common/usbdbg: Flush data from unsupported commands.
The removal of unused USB commands that are still sent by the IDE
causes tinyusb boards to crash on connect currently. Flushing the
excess received bytes for unknown commands solves this issue.
2025-08-24 21:34:02 -07:00
iabdalkader
872735212f common: Support reading profiling data via USB debug.
Signed-off-by: iabdalkader <i.abdalkader@gmail.com>
2025-08-24 16:57:11 +02:00
iabdalkader
e5cdccc72e common: Introduce profiling support.
This adds a simple code profiler that leverages both SysTick and
the Performance Monitoring Unit (PMU) available on Armv8.1-M cores.
SysTick provides a simple high-resolution timer source, while the PMU
offers a cycle counter and multiple configurable event counters that
can track low-level performance metrics such as cache misses, pipeline
stalls, etc... See the Armv8.1-M Performance Monitoring User Guide
for additional details.

Function-level instrumentation is enabled using -finstrument-functions
on select files to automatically record statistics on entry/exit.

Signed-off-by: iabdalkader <i.abdalkader@gmail.com>
2025-08-24 16:57:06 +02:00
iabdalkader
90bd11e937 common: Refactor TinyUSB debug interface implementation.
This commit refactors the TinyUSB debug interface with the following changes:

- Handle disabled IRQs.
- Replace global variables with centralized state.
- Add timeout, and validation for more robust transfers (as much as possible
  given the protocol limits).
- Remove obsolete/unsupported commands (attr read/write, script save etc..)

Signed-off-by: iabdalkader <i.abdalkader@gmail.com>
2025-08-23 20:16:09 +02:00
iabdalkader
7b4c545b47 common/csi: Move resolution table to csi struct.
This allows drivers to override standard resolutions,
or use custom ones, without affecting other CSIs.

Signed-off-by: iabdalkader <i.abdalkader@gmail.com>
2025-08-14 11:40:24 +02:00
Kwabena W. Agyeman
3908807509 drivers/sensors: Add calibration ioctl for the genx320. 2025-08-09 10:51:08 -07:00
Kwabena W. Agyeman
e591ccd735 drivers/sensors: Add RAW event output mode for the genx320. 2025-08-09 10:51:07 -07:00
Kwabena W. Agyeman
8a26e091c7 common/omv_csi: Add support for post_process positive value returns. 2025-08-09 09:52:27 -07:00
Kwabena W. Agyeman
ea0505d52e common/omv_csi: Allow IOCTLs to return positive values. 2025-08-09 09:32:10 -07:00
iabdalkader
efb4ff1ca7 common/csi: Use designated initializer for res table.
Signed-off-by: iabdalkader <i.abdalkader@gmail.com>
2025-08-09 18:03:32 +02:00
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