kfree(buf);
}
+#define SOLO_OSD_WRITE_SIZE (16 * OSD_TEXT_MAX)
+
/* Should be called with enable_lock held */
int solo_osd_print(struct solo_enc_dev *solo_enc)
{
struct solo_dev *solo_dev = solo_enc->solo_dev;
unsigned char *str = solo_enc->osd_text;
u8 *buf = solo_enc->osd_buf;
- u32 reg = solo_reg_read(solo_dev, SOLO_VE_OSD_CH);
+ u32 reg;
const struct font_desc *vga = find_font("VGA8x16");
const unsigned char *vga_data;
- int len;
int i, j;
if (WARN_ON_ONCE(!vga))
return -ENODEV;
- len = strlen(str);
-
- if (len == 0) {
+ reg = solo_reg_read(solo_dev, SOLO_VE_OSD_CH);
+ if (!*str) {
/* Disable OSD on this channel */
reg &= ~(1 << solo_enc->ch);
- solo_reg_write(solo_dev, SOLO_VE_OSD_CH, reg);
- return 0;
+ goto out;
}
- memset(buf, 0, SOLO_EOSD_EXT_SIZE_MAX);
+ memset(buf, 0, SOLO_OSD_WRITE_SIZE);
vga_data = (const unsigned char *)vga->data;
- for (i = 0; i < len; i++) {
- unsigned char c = str[i];
-
+ for (i = 0; *str; i++, str++) {
for (j = 0; j < 16; j++) {
- buf[(j * 2) + (i % 2) + (i / 2 * 32)] =
- bitrev8(vga_data[(c * 16) + j]);
+ buf[(j << 1) | (i & 1) | ((i & ~1) << 4)] =
+ bitrev8(vga_data[(*str << 4) | j]);
}
}
solo_p2m_dma(solo_dev, 1, buf,
- SOLO_EOSD_EXT_ADDR +
- (solo_enc->ch * SOLO_EOSD_EXT_SIZE(solo_dev)),
- SOLO_EOSD_EXT_SIZE(solo_dev), 0, 0);
+ SOLO_EOSD_EXT_ADDR_CHAN(solo_dev, solo_enc->ch),
+ SOLO_OSD_WRITE_SIZE, 0, 0);
/* Enable OSD on this channel */
reg |= (1 << solo_enc->ch);
- solo_reg_write(solo_dev, SOLO_VE_OSD_CH, reg);
+out:
+ solo_reg_write(solo_dev, SOLO_VE_OSD_CH, reg);
return 0;
}