1
0
mirror of https://github.com/DigitalDevices/dddvb.git synced 2023-10-10 13:37:43 +02:00

clean up ddbread/write function names

This commit is contained in:
Ralph Metzler 2017-10-25 23:01:46 +02:00
parent 7bb6cf99e2
commit a385bcb70c
3 changed files with 32 additions and 22 deletions

View File

@ -32,10 +32,10 @@ u32 ddblreadl(struct ddb_link *link, u32 adr)
spin_lock_irqsave(&link->lock, flags); spin_lock_irqsave(&link->lock, flags);
gtlw(link); gtlw(link);
ddbwritel0(link, adr & 0xfffc, link->regs + 0x14); ddblwritel0(link, adr & 0xfffc, link->regs + 0x14);
ddbwritel0(link, 3, link->regs + 0x10); ddblwritel0(link, 3, link->regs + 0x10);
gtlw(link); gtlw(link);
val = ddbreadl0(link, link->regs + 0x1c); val = ddblreadl0(link, link->regs + 0x1c);
spin_unlock_irqrestore(&link->lock, flags); spin_unlock_irqrestore(&link->lock, flags);
return val; return val;
} }
@ -49,9 +49,9 @@ void ddblwritel(struct ddb_link *link, u32 val, u32 adr)
spin_lock_irqsave(&link->lock, flags); spin_lock_irqsave(&link->lock, flags);
gtlw(link); gtlw(link);
ddbwritel0(link, 0xf0000 | (adr & 0xfffc), link->regs + 0x14); ddblwritel0(link, 0xf0000 | (adr & 0xfffc), link->regs + 0x14);
ddbwritel0(link, val, link->regs + 0x18); ddblwritel0(link, val, link->regs + 0x18);
ddbwritel0(link, 1, link->regs + 0x10); ddblwritel0(link, 1, link->regs + 0x10);
spin_unlock_irqrestore(&link->lock, flags); spin_unlock_irqrestore(&link->lock, flags);
return; return;
} }
@ -67,10 +67,10 @@ u32 ddbreadl(struct ddb *dev, u32 adr)
spin_lock_irqsave(&link->lock, flags); spin_lock_irqsave(&link->lock, flags);
gtlw(link); gtlw(link);
ddbwritel0(link, adr & 0xfffc, link->regs + 0x14); ddblwritel0(link, adr & 0xfffc, link->regs + 0x14);
ddbwritel0(link, 3, link->regs + 0x10); ddblwritel0(link, 3, link->regs + 0x10);
gtlw(link); gtlw(link);
val = ddbreadl0(link, link->regs + 0x1c); val = ddblreadl0(link, link->regs + 0x1c);
spin_unlock_irqrestore(&link->lock, flags); spin_unlock_irqrestore(&link->lock, flags);
return val; return val;
} }
@ -86,9 +86,9 @@ void ddbwritel(struct ddb *dev, u32 val, u32 adr)
spin_lock_irqsave(&link->lock, flags); spin_lock_irqsave(&link->lock, flags);
gtlw(link); gtlw(link);
ddbwritel0(link, 0xf0000 | (adr & 0xfffc), link->regs + 0x14); ddblwritel0(link, 0xf0000 | (adr & 0xfffc), link->regs + 0x14);
ddbwritel0(link, val, link->regs + 0x18); ddblwritel0(link, val, link->regs + 0x18);
ddbwritel0(link, 1, link->regs + 0x10); ddblwritel0(link, 1, link->regs + 0x10);
spin_unlock_irqrestore(&link->lock, flags); spin_unlock_irqrestore(&link->lock, flags);
return; return;
} }

View File

@ -34,22 +34,32 @@ void gtlcpyfrom(struct ddb *dev, u8 *buf, u32 adr, long count);
void ddbcpyto(struct ddb *dev, u32 adr, void *src, long count); void ddbcpyto(struct ddb *dev, u32 adr, void *src, long count);
void ddbcpyfrom(struct ddb *dev, void *dst, u32 adr, long count); void ddbcpyfrom(struct ddb *dev, void *dst, u32 adr, long count);
static inline void ddbwriteb(struct ddb *dev, u32 val, u32 adr) static inline void ddbwriteb0(struct ddb *dev, u32 val, u32 adr)
{ {
writeb(val, (char *)(dev->regs + (adr))); writeb(val, (char *)(dev->regs + (adr)));
} }
static inline u32 ddbreadb(struct ddb *dev, u32 adr) static inline u32 ddbreadb0(struct ddb *dev, u32 adr)
{ {
return readb((char *)(dev->regs + (adr))); return readb((char *)(dev->regs + (adr)));
} }
static inline void ddbwritel0(struct ddb_link *link, u32 val, u32 adr) static inline void ddbwritel0(struct ddb *dev, u32 val, u32 adr)
{
writel(val, (char *)(dev->regs + (adr)));
}
static inline u32 ddbreadl0(struct ddb *dev, u32 adr)
{
return readl((char *)(dev->regs + (adr)));
}
static inline void ddblwritel0(struct ddb_link *link, u32 val, u32 adr)
{ {
writel(val, (char *)(link->dev->regs + (adr))); writel(val, (char *)(link->dev->regs + (adr)));
} }
static inline u32 ddbreadl0(struct ddb_link *link, u32 adr) static inline u32 ddblreadl0(struct ddb_link *link, u32 adr)
{ {
return readl((char *)(link->dev->regs + (adr))); return readl((char *)(link->dev->regs + (adr)));
} }
@ -60,7 +70,7 @@ static inline void gtlw(struct ddb_link *link)
u32 count = 0; u32 count = 0;
static u32 max; static u32 max;
while (1 & ddbreadl0(link, link->regs + 0x10)) { while (1 & ddblreadl0(link, link->regs + 0x10)) {
if (++count == 1024) { if (++count == 1024) {
pr_info("LTO\n"); pr_info("LTO\n");
break; break;
@ -70,13 +80,13 @@ static inline void gtlw(struct ddb_link *link)
max = count; max = count;
pr_info("TO=%u\n", max); pr_info("TO=%u\n", max);
} }
if (ddbreadl0(link, link->regs + 0x10) & 0x8000) if (ddblreadl0(link, link->regs + 0x10) & 0x8000)
pr_err("link error\n"); pr_err("link error\n");
} }
#else #else
static inline void gtlw(struct ddb_link *link) static inline void gtlw(struct ddb_link *link)
{ {
while (1 & ddbreadl0(link, link->regs + 0x10)) while (1 & ddblreadl0(link, link->regs + 0x10))
; ;
} }
#endif #endif

View File

@ -152,12 +152,12 @@ static int ns_set_pid(struct dvbnss *nss, u16 pid)
else else
ddbmemset(dev, off, 0x00, 0x400); ddbmemset(dev, off, 0x00, 0x400);
} else { } else {
u8 val = ddbreadb(dev, off + byte); u8 val = ddbreadb0(dev, off + byte);
if (pid & 0x8000) if (pid & 0x8000)
ddbwriteb(dev, val | bit, off + byte); ddbwriteb0(dev, val | bit, off + byte);
else else
ddbwriteb(dev, val & ~bit, off + byte); ddbwriteb0(dev, val & ~bit, off + byte);
} }
} }
#else #else