Subversion Repositories freemyipod

Rev

Details | Last modification | View Log | RSS feed

Rev Author Line No. Line
881 theseven 1
#include "global.h"
2
#include "soc/s5l87xx/lcdif.h"
3
#include "interface/lcdif/lcdif.h"
4
#include "soc/s5l87xx/regs.h"
5
 
6
 
7
static void lcdif_init(const struct lcdif_instance* instance)
8
{
9
    LCDCON = LCDCON_INITVALUE;
10
    LCDPHTIME = 0;
11
}
12
 
13
static void lcdif_send_cmd(const struct lcdif_instance* instance, uint32_t cmd)
14
{
15
    while (LCDSTATUS & 0x10);
16
    LCDWCMD = cmd;
17
}
18
 
19
static void lcdif_send_data(const struct lcdif_instance* instance, uint32_t data)
20
{
21
    while (LCDSTATUS & 0x10);
22
    LCDWDATA = data;
23
}
24
 
25
static void lcdif_send_bulk(const struct lcdif_instance* instance, void* data, int words)
26
{
27
    uint16_t* in = (uint16_t*)data;
28
    while (words >= 4)
29
    {
30
        while (LCDSTATUS & 8);
31
        LCDWDATA = *in++;
32
        LCDWDATA = *in++;
33
        LCDWDATA = *in++;
34
        LCDWDATA = *in++;
35
        words -= 4;
36
    }
37
    while (LCDSTATUS & 8);
38
    while (words-- & 3) LCDWDATA = *in++;
39
}
40
 
41
static void lcdif_send_repeat(const struct lcdif_instance* instance, uint32_t data, int count)
42
{
43
    while (count >= 4)
44
    {
45
        while (LCDSTATUS & 8);
46
        LCDWDATA = data;
47
        LCDWDATA = data;
48
        LCDWDATA = data;
49
        LCDWDATA = data;
50
        count -= 4;
51
    }
52
    while (LCDSTATUS & 8);
53
    while (count-- & 3) LCDWDATA = data;
54
}
55
 
56
const struct lcdif_driver s5l87xx_lcdif_driver =
57
{
58
    .init = lcdif_init,
59
    .send_cmd = lcdif_send_cmd,
60
    .send_data = lcdif_send_data,
61
    .send_bulk = lcdif_send_bulk,
62
    .send_repeat = lcdif_send_repeat,
63
};