2023-10-28 06:23:06 +00:00
|
|
|
/*
|
|
|
|
* mii_thread.h
|
|
|
|
*
|
|
|
|
* Copyright (C) 2023 Michel Pollet <buserror@gmail.com>
|
|
|
|
*
|
|
|
|
* SPDX-License-Identifier: MIT
|
|
|
|
*/
|
|
|
|
|
|
|
|
#pragma once
|
|
|
|
|
|
|
|
#include <stdint.h>
|
|
|
|
#include "fifo_declare.h"
|
|
|
|
|
2024-02-04 09:09:28 +00:00
|
|
|
enum mii_th_state_e {
|
2023-10-28 06:23:06 +00:00
|
|
|
SIGNAL_RESET,
|
|
|
|
SIGNAL_STOP,
|
|
|
|
SIGNAL_STEP,
|
|
|
|
SIGNAL_RUN,
|
|
|
|
};
|
|
|
|
|
|
|
|
typedef struct mii_th_signal_t {
|
2024-02-04 09:09:28 +00:00
|
|
|
uint8_t cmd;
|
|
|
|
uint8_t data;
|
2023-10-28 06:23:06 +00:00
|
|
|
} mii_th_signal_t;
|
|
|
|
|
|
|
|
DECLARE_FIFO(mii_th_signal_t, mii_th_fifo, 16);
|
|
|
|
DEFINE_FIFO(mii_th_signal_t, mii_th_fifo);
|
|
|
|
|
2024-02-12 16:56:38 +00:00
|
|
|
DECLARE_FIFO(char*, mii_th_msg_fifo, 16);
|
|
|
|
DEFINE_FIFO(char*, mii_th_msg_fifo);
|
|
|
|
|
|
|
|
typedef struct mii_thread_t {
|
|
|
|
pthread_t thread;
|
|
|
|
uint8_t state;
|
|
|
|
struct mii_t * mii;
|
|
|
|
mii_th_fifo_t signal;
|
|
|
|
mii_th_msg_fifo_t msg;
|
|
|
|
} mii_thread_t;
|
|
|
|
|
2023-10-28 06:23:06 +00:00
|
|
|
struct mii_t;
|
|
|
|
|
2024-01-20 12:05:26 +00:00
|
|
|
pthread_t
|
2024-02-04 09:09:28 +00:00
|
|
|
mii_threads_start(
|
2023-10-28 06:23:06 +00:00
|
|
|
struct mii_t *mii);
|
|
|
|
struct mii_th_fifo_t*
|
|
|
|
mii_thread_get_fifo(
|
|
|
|
struct mii_t *mii);
|
2024-01-20 12:05:26 +00:00
|
|
|
int
|
|
|
|
mii_thread_set_fps(
|
|
|
|
int timerfd,
|
|
|
|
float fps);
|