mirror of
https://github.com/ajouatom/openpilot.git
synced 2026-06-08 02:54:45 +08:00
* add cluster alpha * add dep * add dep * fix usb timeout * fix usb timeout * Improve error handling in USB frame transmission Refactor error handling and input draining in USB frame methods. * Refactor JPEG rendering logic in main.py Refactor JPEG rendering to improve readability and add logging. * Refactor _send_frame_no_ack method Refactor _send_frame_no_ack method for better readability and structure. * Update main.py * Update main.py * Update cluster_usb_display.py * Increase NUM_READERS from 25 to 40 * Add center_clock_text attribute to cluster model * Add replace import from dataclasses * Update main.py * Implement center clock drawing in cluster renderer Added a new method to draw the center clock on the cluster UI. * Update cluster_renderer.py * Simplify input draining condition in USB frame method Refactor input draining logic to improve readability. * Update main.py * Update cluster_renderer.py * Update main.py * Update cluster_usb_display.py * Implement performance profiling in cluster rendering Added profiling for rendering performance metrics in the cluster renderer. * Update cluster_renderer.py * Update cluster_renderer.py * Update cluster_renderer.py * Update main.py * Add CLUSTER_PROFILE_RGBA option to README Added environment variable for RGBA profile to cluster_run.py command. * fix replay * fix replay * add log * add log * add log * fix * fix * fix * fix * fix * fix * performance * performance * performance * performance * performance * performance * performance * performance * performance * performance * performance * process * process * process * process * remove dummy * fix ui * fix ui * fix ui * fix usb event monitor * fix usb event monitor * fix ui * fix ui * fix ui apply font * fix ui apply font * fix ui * fix ui * fix ui * fix ui * fix ui * fix ui * fix ui * fix ui * fix ui * fix ui * fix ui * fix ui * fix radar point * fix radar point * fix radar point * fix radar point * fix radar point * fix radar point * fix radar point * fix radar point * fix radar point * fix radar point * fix radar point * fix radar point * fix ui * fix ui * fix ui * fix ui * fix ui * fix ui * dark mode * dark mode * dark mode * cleanup * add bsd * bsd * lca * lca * lca * lca * lca * lca * lca * lca * move speed limit * profiler * perfomance * perfomance * perfomance * perfomance * perfomance * perfomance * perfomance * perfomance * perfomance * fps * perfomance * params * monit * add git info
71 lines
1.9 KiB
C++
71 lines
1.9 KiB
C++
#pragma once
|
|
|
|
#include <cstdint>
|
|
#include <cstring>
|
|
#include <string>
|
|
#include <atomic>
|
|
|
|
#define DEFAULT_SEGMENT_SIZE (1 * 1024 * 1024)
|
|
#define NUM_READERS 40//15
|
|
#define ALIGN(n) ((n + (8 - 1)) & -8)
|
|
|
|
#define UNUSED(x) (void)x
|
|
#define UNPACK64(higher, lower, input) do {uint64_t tmp = input; higher = tmp >> 32; lower = tmp & 0xFFFFFFFF;} while (0)
|
|
#define PACK64(output, higher, lower) output = ((uint64_t)higher << 32) | ((uint64_t)lower & 0xFFFFFFFF)
|
|
|
|
struct msgq_header_t {
|
|
uint64_t num_readers;
|
|
uint64_t write_pointer;
|
|
uint64_t write_uid;
|
|
uint64_t read_pointers[NUM_READERS];
|
|
uint64_t read_valids[NUM_READERS];
|
|
uint64_t read_uids[NUM_READERS];
|
|
};
|
|
|
|
struct msgq_queue_t {
|
|
std::atomic<uint64_t> *num_readers;
|
|
std::atomic<uint64_t> *write_pointer;
|
|
std::atomic<uint64_t> *write_uid;
|
|
std::atomic<uint64_t> *read_pointers[NUM_READERS];
|
|
std::atomic<uint64_t> *read_valids[NUM_READERS];
|
|
std::atomic<uint64_t> *read_uids[NUM_READERS];
|
|
char * mmap_p;
|
|
char * data;
|
|
size_t size;
|
|
int reader_id;
|
|
uint64_t read_uid_local;
|
|
uint64_t write_uid_local;
|
|
|
|
bool read_conflate;
|
|
std::string endpoint;
|
|
};
|
|
|
|
struct msgq_msg_t {
|
|
size_t size;
|
|
char * data;
|
|
};
|
|
|
|
struct msgq_pollitem_t {
|
|
msgq_queue_t *q;
|
|
int revents;
|
|
};
|
|
|
|
void msgq_wait_for_subscriber(msgq_queue_t *q);
|
|
void msgq_reset_reader(msgq_queue_t *q);
|
|
|
|
int msgq_msg_init_size(msgq_msg_t *msg, size_t size);
|
|
int msgq_msg_init_data(msgq_msg_t *msg, char * data, size_t size);
|
|
int msgq_msg_close(msgq_msg_t *msg);
|
|
|
|
int msgq_new_queue(msgq_queue_t * q, const char * path, size_t size);
|
|
void msgq_close_queue(msgq_queue_t *q);
|
|
void msgq_init_publisher(msgq_queue_t * q);
|
|
void msgq_init_subscriber(msgq_queue_t * q);
|
|
|
|
int msgq_msg_send(msgq_msg_t *msg, msgq_queue_t *q);
|
|
int msgq_msg_recv(msgq_msg_t *msg, msgq_queue_t *q);
|
|
int msgq_msg_ready(msgq_queue_t * q);
|
|
int msgq_poll(msgq_pollitem_t * items, size_t nitems, int timeout);
|
|
|
|
bool msgq_all_readers_updated(msgq_queue_t *q);
|