mirror of
https://github.com/openmv/openmv.git
synced 2025-09-26 23:09:13 +08:00
misc: Use updated mutex API.
Signed-off-by: iabdalkader <i.abdalkader@gmail.com>
This commit is contained in:
parent
2c4b318ff9
commit
0458db2130
@ -173,7 +173,7 @@ void usbdbg_data_in(uint32_t size, usbdbg_write_callback_t write_callback) {
|
|||||||
// Return 0 if FB is locked or not ready.
|
// Return 0 if FB is locked or not ready.
|
||||||
uint32_t buffer[3] = { 0 };
|
uint32_t buffer[3] = { 0 };
|
||||||
// Try to lock FB. If header size == 0 frame is not ready
|
// Try to lock FB. If header size == 0 frame is not ready
|
||||||
if (mutex_try_lock_alternate(&JPEG_FB()->lock, MUTEX_TID_IDE)) {
|
if (mutex_try_lock_fair(&JPEG_FB()->lock, MUTEX_TID_IDE)) {
|
||||||
// If header size == 0 frame is not ready
|
// If header size == 0 frame is not ready
|
||||||
if (JPEG_FB()->size == 0) {
|
if (JPEG_FB()->size == 0) {
|
||||||
// unlock FB
|
// unlock FB
|
||||||
@ -249,7 +249,7 @@ void usbdbg_data_in(uint32_t size, usbdbg_write_callback_t write_callback) {
|
|||||||
|
|
||||||
// Limit the frames sent over USB to 20Hz.
|
// Limit the frames sent over USB to 20Hz.
|
||||||
if (ticks_diff_ms(last_update_ms) > 50 &&
|
if (ticks_diff_ms(last_update_ms) > 50 &&
|
||||||
mutex_try_lock_alternate(&JPEG_FB()->lock, MUTEX_TID_IDE)) {
|
mutex_try_lock_fair(&JPEG_FB()->lock, MUTEX_TID_IDE)) {
|
||||||
// If header size == 0 frame is not ready
|
// If header size == 0 frame is not ready
|
||||||
if (JPEG_FB()->size == 0) {
|
if (JPEG_FB()->size == 0) {
|
||||||
// unlock FB
|
// unlock FB
|
||||||
|
@ -248,7 +248,7 @@ void framebuffer_update_jpeg_buffer(image_t *src) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Lock the JPEG buffer.
|
// Lock the JPEG buffer.
|
||||||
if (!mutex_try_lock_alternate(&jpegbuffer.lock, MUTEX_TID_OMV)) {
|
if (!mutex_try_lock_fair(&jpegbuffer.lock, MUTEX_TID_OMV)) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -27,9 +27,9 @@
|
|||||||
#define __FRAMEBUFFER_H__
|
#define __FRAMEBUFFER_H__
|
||||||
#include <stdint.h>
|
#include <stdint.h>
|
||||||
#include "imlib.h"
|
#include "imlib.h"
|
||||||
#include "mutex.h"
|
|
||||||
#include "omv_common.h"
|
#include "omv_common.h"
|
||||||
#include "common/queue.h"
|
#include "common/queue.h"
|
||||||
|
#include "common/mutex.h"
|
||||||
|
|
||||||
#ifndef FRAMEBUFFER_ALIGNMENT
|
#ifndef FRAMEBUFFER_ALIGNMENT
|
||||||
#define FRAMEBUFFER_ALIGNMENT OMV_CACHE_LINE_SIZE
|
#define FRAMEBUFFER_ALIGNMENT OMV_CACHE_LINE_SIZE
|
||||||
@ -122,7 +122,7 @@ typedef struct jpegbuffer {
|
|||||||
int32_t enabled;
|
int32_t enabled;
|
||||||
int32_t quality;
|
int32_t quality;
|
||||||
uint8_t *pixels;
|
uint8_t *pixels;
|
||||||
omv_mutex_t lock;
|
mutex_t lock;
|
||||||
} jpegbuffer_t;
|
} jpegbuffer_t;
|
||||||
|
|
||||||
void framebuffer_init0();
|
void framebuffer_init0();
|
||||||
|
Loading…
Reference in New Issue
Block a user