-
Notifications
You must be signed in to change notification settings - Fork 6.7k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
drv: ft8xx: new coprocessor commands #82376
Open
hubertmis
wants to merge
2
commits into
zephyrproject-rtos:main
Choose a base branch
from
hubertmis:pr/ft8xx-update
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
+470
−3
Open
Changes from all commits
Commits
Show all changes
2 commits
Select commit
Hold shift + click to select a range
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -3,17 +3,25 @@ | |
# Copyright (c) 2020-2021 Hubert Miś <[email protected]> | ||
# SPDX-License-Identifier: Apache-2.0 | ||
|
||
config FT800 | ||
menuconfig FT800 | ||
bool "FT800 Embedded Video Engine driver" | ||
default y | ||
depends on DT_HAS_FTDI_FT800_ENABLED | ||
select SPI | ||
help | ||
Enable driver for FT800 controller. | ||
|
||
if FT800 | ||
|
||
config FT800_INIT_PRIORITY | ||
int "FT800 init priority" | ||
default 90 | ||
depends on FT800 | ||
help | ||
FT800 driver initialization priority in POST_KERNEL. | ||
|
||
module = FT800 | ||
module-str = FT800 | ||
source "subsys/logging/Kconfig.template.log_config" | ||
|
||
endif # FT800 |
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 |
---|---|---|
|
@@ -18,7 +18,12 @@ | |
enum { | ||
CMD_DLSTART = 0xffffff00, | ||
CMD_SWAP = 0xffffff01, | ||
CMD_BGCOLOR = 0xffffff09, | ||
CMD_FGCOLOR = 0xffffff0a, | ||
CMD_TEXT = 0xffffff0c, | ||
CMD_SLIDER = 0xffffff10, | ||
CMD_TOGGLE = 0xffffff12, | ||
CMD_TRACK = 0xffffff2c, | ||
CMD_NUMBER = 0xffffff2e, | ||
CMD_CALIBRATE = 0xffffff15, | ||
} ft8xx_cmd; | ||
|
@@ -73,6 +78,183 @@ void ft8xx_copro_cmd_swap(void) | |
ft8xx_copro_cmd(CMD_SWAP); | ||
} | ||
|
||
void ft8xx_copro_cmd_fgcolor(uint32_t c) | ||
{ | ||
const uint16_t cmd_size = sizeof(CMD_FGCOLOR) + | ||
sizeof(c); | ||
|
||
while (ram_cmd_freespace() < cmd_size) { | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Is this function a blocking call? Probably it should be refelected in documentation as well :) same goes for other functions as well. |
||
refresh_reg_cmd_read(); | ||
} | ||
|
||
ft8xx_wr32(FT800_RAM_CMD + reg_cmd_write, CMD_FGCOLOR); | ||
increase_reg_cmd_write(sizeof(CMD_FGCOLOR)); | ||
|
||
ft8xx_wr32(FT800_RAM_CMD + reg_cmd_write, c); | ||
increase_reg_cmd_write(sizeof(c)); | ||
|
||
flush_reg_cmd_write(); | ||
} | ||
|
||
void ft8xx_copro_cmd_bgcolor(uint32_t c) | ||
{ | ||
const uint16_t cmd_size = sizeof(CMD_BGCOLOR) + | ||
sizeof(c); | ||
|
||
while (ram_cmd_freespace() < cmd_size) { | ||
refresh_reg_cmd_read(); | ||
} | ||
|
||
ft8xx_wr32(FT800_RAM_CMD + reg_cmd_write, CMD_BGCOLOR); | ||
increase_reg_cmd_write(sizeof(CMD_BGCOLOR)); | ||
|
||
ft8xx_wr32(FT800_RAM_CMD + reg_cmd_write, c); | ||
increase_reg_cmd_write(sizeof(c)); | ||
|
||
flush_reg_cmd_write(); | ||
} | ||
|
||
void ft8xx_copro_cmd_slider(int16_t x, | ||
int16_t y, | ||
int16_t w, | ||
int16_t h, | ||
uint16_t options, | ||
uint16_t val, | ||
uint16_t range) | ||
{ | ||
size_t padding_bytes = 2; | ||
const uint16_t cmd_size = sizeof(CMD_SLIDER) + | ||
sizeof(x) + | ||
sizeof(y) + | ||
sizeof(w) + | ||
sizeof(h) + | ||
sizeof(options) + | ||
sizeof(val) + | ||
sizeof(range) + | ||
padding_bytes; | ||
|
||
while (ram_cmd_freespace() < cmd_size) { | ||
refresh_reg_cmd_read(); | ||
} | ||
|
||
ft8xx_wr32(FT800_RAM_CMD + reg_cmd_write, CMD_SLIDER); | ||
increase_reg_cmd_write(sizeof(CMD_SLIDER)); | ||
|
||
ft8xx_wr16(FT800_RAM_CMD + reg_cmd_write, x); | ||
increase_reg_cmd_write(sizeof(x)); | ||
|
||
ft8xx_wr16(FT800_RAM_CMD + reg_cmd_write, y); | ||
increase_reg_cmd_write(sizeof(y)); | ||
|
||
ft8xx_wr16(FT800_RAM_CMD + reg_cmd_write, w); | ||
increase_reg_cmd_write(sizeof(w)); | ||
|
||
ft8xx_wr16(FT800_RAM_CMD + reg_cmd_write, h); | ||
increase_reg_cmd_write(sizeof(h)); | ||
|
||
ft8xx_wr16(FT800_RAM_CMD + reg_cmd_write, options); | ||
increase_reg_cmd_write(sizeof(options)); | ||
|
||
ft8xx_wr16(FT800_RAM_CMD + reg_cmd_write, val); | ||
increase_reg_cmd_write(sizeof(val)); | ||
|
||
ft8xx_wr16(FT800_RAM_CMD + reg_cmd_write, range); | ||
increase_reg_cmd_write(sizeof(range) + padding_bytes); | ||
|
||
flush_reg_cmd_write(); | ||
} | ||
|
||
void ft8xx_copro_cmd_toggle(int16_t x, | ||
int16_t y, | ||
int16_t w, | ||
int16_t font, | ||
uint16_t options, | ||
uint16_t state, | ||
const char *s) | ||
{ | ||
const uint16_t str_bytes = strlen(s) + 1; | ||
const uint16_t padding_bytes = (4 - (str_bytes % 4)) % 4; | ||
const uint16_t cmd_size = sizeof(CMD_TOGGLE) + | ||
sizeof(x) + | ||
sizeof(y) + | ||
sizeof(w) + | ||
sizeof(font) + | ||
sizeof(options) + | ||
sizeof(state) + | ||
str_bytes + | ||
padding_bytes; | ||
|
||
while (ram_cmd_freespace() < cmd_size) { | ||
refresh_reg_cmd_read(); | ||
} | ||
|
||
ft8xx_wr32(FT800_RAM_CMD + reg_cmd_write, CMD_TOGGLE); | ||
increase_reg_cmd_write(sizeof(CMD_TOGGLE)); | ||
|
||
ft8xx_wr16(FT800_RAM_CMD + reg_cmd_write, x); | ||
increase_reg_cmd_write(sizeof(x)); | ||
|
||
ft8xx_wr16(FT800_RAM_CMD + reg_cmd_write, y); | ||
increase_reg_cmd_write(sizeof(y)); | ||
|
||
ft8xx_wr16(FT800_RAM_CMD + reg_cmd_write, w); | ||
increase_reg_cmd_write(sizeof(w)); | ||
|
||
ft8xx_wr16(FT800_RAM_CMD + reg_cmd_write, font); | ||
increase_reg_cmd_write(sizeof(font)); | ||
|
||
ft8xx_wr16(FT800_RAM_CMD + reg_cmd_write, options); | ||
increase_reg_cmd_write(sizeof(options)); | ||
|
||
ft8xx_wr16(FT800_RAM_CMD + reg_cmd_write, state); | ||
increase_reg_cmd_write(sizeof(state)); | ||
|
||
(void)ft8xx_drv_write(FT800_RAM_CMD + reg_cmd_write, s, str_bytes); | ||
increase_reg_cmd_write(str_bytes + padding_bytes); | ||
|
||
flush_reg_cmd_write(); | ||
} | ||
|
||
void ft8xx_copro_cmd_track(int16_t x, | ||
int16_t y, | ||
int16_t w, | ||
int16_t h, | ||
int16_t tag) | ||
{ | ||
size_t padding_bytes = 2; | ||
const uint16_t cmd_size = sizeof(CMD_TRACK) + | ||
sizeof(x) + | ||
sizeof(y) + | ||
sizeof(w) + | ||
sizeof(h) + | ||
sizeof(tag) + | ||
padding_bytes; | ||
|
||
while (ram_cmd_freespace() < cmd_size) { | ||
refresh_reg_cmd_read(); | ||
} | ||
|
||
ft8xx_wr32(FT800_RAM_CMD + reg_cmd_write, CMD_TRACK); | ||
increase_reg_cmd_write(sizeof(CMD_TRACK)); | ||
|
||
ft8xx_wr16(FT800_RAM_CMD + reg_cmd_write, x); | ||
increase_reg_cmd_write(sizeof(x)); | ||
|
||
ft8xx_wr16(FT800_RAM_CMD + reg_cmd_write, y); | ||
increase_reg_cmd_write(sizeof(y)); | ||
|
||
ft8xx_wr16(FT800_RAM_CMD + reg_cmd_write, w); | ||
increase_reg_cmd_write(sizeof(w)); | ||
|
||
ft8xx_wr16(FT800_RAM_CMD + reg_cmd_write, h); | ||
increase_reg_cmd_write(sizeof(h)); | ||
|
||
ft8xx_wr16(FT800_RAM_CMD + reg_cmd_write, tag); | ||
increase_reg_cmd_write(sizeof(tag) + padding_bytes); | ||
|
||
flush_reg_cmd_write(); | ||
} | ||
|
||
void ft8xx_copro_cmd_text(int16_t x, | ||
int16_t y, | ||
int16_t font, | ||
|
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
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
is c for
color
? would use the full term :)