-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Added dummy conexant video encoder device
- Loading branch information
Showing
6 changed files
with
106 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,66 @@ | ||
// SPDX-License-Identifier: GPL-3.0-or-later | ||
|
||
// SPDX-FileCopyrightText: 2024 ergo720 | ||
|
||
#include "machine.hpp" | ||
|
||
#define MODULE_NAME conexant | ||
|
||
|
||
std::optional<uint16_t> | ||
conexant::quick_command(bool command) | ||
{ | ||
return 0; | ||
} | ||
|
||
std::optional<uint16_t> | ||
conexant::receive_byte() | ||
{ | ||
return 0; | ||
} | ||
|
||
std::optional<uint16_t> | ||
conexant::send_byte(uint8_t data) | ||
{ | ||
return 0; | ||
} | ||
|
||
std::optional<uint16_t> | ||
conexant::read_byte(uint8_t command) | ||
{ | ||
return m_regs[command]; | ||
} | ||
|
||
std::optional<uint16_t> | ||
conexant::write_byte(uint8_t command, uint8_t data) | ||
{ | ||
m_regs[command] = data; | ||
return 0; | ||
} | ||
|
||
std::optional<uint16_t> | ||
conexant::read_word(uint8_t command) | ||
{ | ||
return m_regs[command] | ((uint16_t)m_regs[command + 1] << 8); | ||
} | ||
|
||
std::optional<uint16_t> | ||
conexant::write_word(uint8_t command, uint16_t data) | ||
{ | ||
m_regs[command] = data & 0xFF; | ||
m_regs[command + 1] = data >> 8; | ||
return 0; | ||
} | ||
|
||
void | ||
conexant::reset() | ||
{ | ||
std::fill(std::begin(m_regs), std::end(m_regs), 0); | ||
} | ||
|
||
bool | ||
conexant::init() | ||
{ | ||
reset(); | ||
return true; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
// SPDX-License-Identifier: GPL-3.0-or-later | ||
|
||
// SPDX-FileCopyrightText: 2024 ergo720 | ||
|
||
#pragma once | ||
|
||
#include "smbus.hpp" | ||
|
||
|
||
class conexant : public smbus_device { | ||
public: | ||
conexant(log_module module_name) : smbus_device(module_name) {} | ||
bool init(); | ||
void deinit() override {} | ||
void reset(); | ||
std::optional<uint16_t> quick_command(bool command) override; | ||
std::optional<uint16_t> receive_byte() override; | ||
std::optional<uint16_t> send_byte(uint8_t data) override; | ||
std::optional<uint16_t> read_byte(uint8_t command) override; | ||
std::optional<uint16_t> write_byte(uint8_t command, uint8_t data) override; | ||
std::optional<uint16_t> read_word(uint8_t command) override; | ||
std::optional<uint16_t> write_word(uint8_t command, uint16_t data) override; | ||
|
||
private: | ||
uint8_t m_regs[256]; | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters