mirror of
https://github.com/MiSTer-devel/Main_MiSTer.git
synced 2026-05-31 03:04:12 +00:00
Support for CEC
* hdmi_cec * Improve HDMI CEC startup * hdmi_cec * Improve HDMI CEC startup * Use ADV7513 interrupt registers for CEC Set ADV7513 main 0xE1 to the CEC I2C map address, 0xE2 to 0x00 to power the CEC block, and 0xE3 |= 0x0E for CEC control setup. Keep HPD forced high through main 0xD6 = 0xC0 after the startup pulse, but clear main 0x94[7] so HPD does not drive the shared HDMI interrupt line. Clear main 0xA1[6] so the monitor-sense/video-active block stays powered; ADV7513 interrupt status registers 0x94-0x97 are only valid while that block is alive. Set main 0x95 = 0x07 to enable only CEC RX-ready interrupts, use main 0x97 to clear RX/TX interrupt latches, and clear 0x96/0x97 at init. Read CEC RX-ready from CEC map 0x49, keep CEC RX enabled with 0x4A = 0x08, release consumed RX slots through 0x4A, and remove fallback polling of RX length registers 0x25/0x37/0x48. Use main 0x97 bits for CEC TX done/retry/arbitration status, keep CEC TX disabled through 0x11 except while sending, and set the CEC clock divider 0x4E = 0x3D. Gate RX handling on fpga_get_hdmi_int() so normal CEC polling no longer performs DDC/CEC I2C reads unless the FPGA HDMI interrupt bit is asserted. Reply to CEC vendor/name discovery so displays can identify MiSTer after registration. --------- Co-authored-by: misteraddons <51079966+misteraddons@users.noreply.github.com>
This commit is contained in:
22
input.cpp
22
input.cpp
@@ -46,6 +46,17 @@ char joy_bnames[NUMBUTTONS][32] = {};
|
||||
int joy_bcount = 0;
|
||||
static struct pollfd pool[NUMDEV + 3];
|
||||
int xbe2_shift = 0;
|
||||
static volatile uint32_t input_activity_seq = 0;
|
||||
|
||||
static inline void input_mark_activity(void)
|
||||
{
|
||||
input_activity_seq++;
|
||||
}
|
||||
|
||||
uint32_t input_activity_get_seq(void)
|
||||
{
|
||||
return input_activity_seq;
|
||||
}
|
||||
|
||||
static bool gcdb_use_usb_bcd_device(uint16_t vid, uint16_t pid)
|
||||
{
|
||||
@@ -2078,6 +2089,13 @@ void input_uinp_destroy()
|
||||
}
|
||||
}
|
||||
|
||||
void input_cec_send_key(uint16_t key, bool pressed)
|
||||
{
|
||||
if (!key) return;
|
||||
input_mark_activity();
|
||||
user_io_kbd(key, pressed ? 1 : 0);
|
||||
}
|
||||
|
||||
static unsigned long uinp_repeat = 0;
|
||||
static struct input_event uinp_ev;
|
||||
static void uinp_send_key(uint16_t key, int press)
|
||||
@@ -5641,6 +5659,8 @@ int input_test(int getchar)
|
||||
memset(&ev, 0, sizeof(ev));
|
||||
if (read(pool[i].fd, &ev, sizeof(ev)) == sizeof(ev))
|
||||
{
|
||||
if (ev.type == EV_KEY || ev.type == EV_ABS || ev.type == EV_REL) input_mark_activity();
|
||||
|
||||
if (getchar)
|
||||
{
|
||||
if (ev.type == EV_KEY && ev.value >= 1)
|
||||
@@ -6138,6 +6158,8 @@ int input_test(int getchar)
|
||||
uint8_t data[4] = {};
|
||||
if (read(pool[i].fd, data, sizeof(data)))
|
||||
{
|
||||
input_mark_activity();
|
||||
|
||||
int edev = i;
|
||||
int dev = i;
|
||||
if (input[i].bind >= 0) edev = input[i].bind; // mouse to event
|
||||
|
||||
Reference in New Issue
Block a user