示例#1
0
void dbop_write_data(const int16_t* p_bytes, int count)
{
    
    const int32_t *data;
    if ((intptr_t)p_bytes & 0x3 || count == 1)
    {   /* need to do a single 16bit write beforehand if the address is
         * not word aligned or count is 1, switch to 16bit mode if needed */
        dbop_set_mode(16);
        DBOP_DOUT16 = *p_bytes++;
        if (!(--count))
            return;
    }
    /* from here, 32bit transfers are save
     * set it to transfer 4*(outputwidth) units at a time,
     * if bit 12 is set it only does 2 halfwords though (we never set it)
     * switch to 32bit output if needed */
    dbop_set_mode(32);
    data = (int32_t*)p_bytes;
    while (count > 1)
    {
        DBOP_DOUT32 = *data++;
        count -= 2;

        /* Wait if push fifo is full */
        while ((DBOP_STAT & (1<<6)) != 0);
    }
    /* While push fifo is not empty */
    while ((DBOP_STAT & (1<<10)) == 0);

    /* due to the 32bit alignment requirement or uneven count,
     * we possibly need to do a 16bit transfer at the end also */
    if (count > 0)
        dbop_write_data((int16_t*)data, 1);
}
示例#2
0
void lcd_write_cmd(int16_t cmd)
{
    unsigned short data = swap16(cmd);
    DBOP_TIMPOL_23 = 0xA12F0036;
    dbop_write_data(&data, 1);

    int delay = 32;
    do {
        nop;
    } while(delay--);

    DBOP_TIMPOL_23 = 0xA12FE037;
}
示例#3
0
void lcd_write_reg(int reg, int value)
{
    int16_t data = swap16(value);
    lcd_write_cmd(reg);
    dbop_write_data(&data, 1);
}