Go to the source code of this file.
Data Structures | |
struct | TBLCMDSET |
Macros | |
#define | BIT(n) ( 1<<(n) ) |
#define | BIT_MASK_LEN(len) (BIT(len)-1) |
#define | BIT_RNG(s, e) (BIT_MASK_LEN((e)-(s)+1) << (s)) |
#define | BM_CLR_MASK_V(x, mask) ( (x) & ~(mask) ) |
#define | BM_SET(x, mask) ( (x) |= (mask) ) |
#define | BM_CLR(x, mask) ( (x) &= ~(mask) ) |
#define | BM_IS_SET(x, mask) ( (x) & (mask) ) |
#define | BM_IS_CLR(x, mask) ( (~x) & (mask) ) |
#define | BM_FLIP(x, mask) ( (x) ^= (mask) ) |
#define | BIT_LOW_BIT(y) |
#define | BIT_HIGH_BIT(y) |
#define | COUNT_ARGS_IMPL2(_1, _2, _3, _4, _5, _6, _7, _8, _9, _10, _11, _12, _13, _14, _15, _16, _17, _18, _19, _20, N, ...) N |
#define | COUNT_ARGS_IMPL(args) COUNT_ARGS_IMPL2 args |
#define | COUNT_ARGS(...) COUNT_ARGS_IMPL((__VA_ARGS__, 20, 19, 18, 17, 16, 15, 14, 13, 12, 11, 10, 9, 8, 7, 6, 5, 4, 3, 2, 1, 0)) |
#define | MACRO_CHOOSE_HELPER2(base, count) base##count |
#define | MACRO_CHOOSE_HELPER1(base, count) MACRO_CHOOSE_HELPER2(base, count) |
#define | MACRO_CHOOSE_HELPER(base, count) MACRO_CHOOSE_HELPER1(base, count) |
#define | MACRO_GLUE(x, y) x y |
#define | VARARG(base, ...) MACRO_GLUE(MACRO_CHOOSE_HELPER(base, COUNT_ARGS(__VA_ARGS__)),(__VA_ARGS__)) |
#define | MV(m, v) (((v) << BIT_LOW_BIT(m)) & (m)) |
#define | MASK_VAL2(m, v) (MV(m,v)) |
#define | MASK_VAL4(m1, v1, m2, v2) (MV(m1,v1)|MV(m2,v2)) |
#define | MASK_VAL6(m1, v1, m2, v2, m3, v3) (MV(m1,v1)|MV(m2,v2)|MV(m3,v3)) |
#define | MASK_VAL8(m1, v1, m2, v2, m3, v3, m4, v4) (MV(m1,v1)|MV(m2,v2)|MV(m3,v3)|MV(m4,v4)) |
#define | MASK_VAL10(m1, v1, m2, v2, m3, v3, m4, v4, m5, v5) (MV(m1,v1)|MV(m2,v2)|MV(m3,v3)|MV(m4,v4)|MV(m5,v5)) |
#define | MASK_VAL12(m1, v1, m2, v2, m3, v3, m4, v4, m5, v5, m6, v6) (MV(m1,v1)|MV(m2,v2)|MV(m3,v3)|MV(m4,v4)|MV(m5,v5)|MV(m6,v6)) |
#define | MASK_VAL14(m1, v1, m2, v2, m3, v3, m4, v4, m5, v5, m6, v6, m7, v7) (MV(m1,v1)|MV(m2,v2)|MV(m3,v3)|MV(m4,v4)|MV(m5,v5)|MV(m6,v6)|MV(m7,v7)) |
#define | MASK_VAL16(m1, v1, m2, v2, m3, v3, m4, v4, m5, v5, m6, v6, m7, v7, m8, v8) (MV(m1,v1)|MV(m2,v2)|MV(m3,v3)|MV(m4,v4)|MV(m5,v5)|MV(m6,v6)|MV(m7,v7)|MV(m8,v8)) |
#define | MASK_VAL(...) VARARG(MASK_VAL, __VA_ARGS__) |
#define | REG_BASE_ADDR 0x800000 |
#define | REG_ADDR8(a) (*(volatile unsigned char*) (REG_BASE_ADDR + (a))) |
#define | REG_ADDR16(a) (*(volatile unsigned short*)(REG_BASE_ADDR + (a))) |
#define | REG_ADDR32(a) (*(volatile unsigned long*) (REG_BASE_ADDR + (a))) |
#define | write_reg8(addr, v) (*(volatile unsigned char*) (REG_BASE_ADDR + (addr)) = (unsigned char)(v)) |
#define | write_reg16(addr, v) (*(volatile unsigned short*) (REG_BASE_ADDR + (addr)) = (unsigned short)(v)) |
#define | write_reg32(addr, v) (*(volatile unsigned long*) (REG_BASE_ADDR + (addr)) = (v)) |
#define | read_reg8(addr) (*(volatile unsigned char*) (REG_BASE_ADDR + (addr))) |
#define | read_reg16(addr) (*(volatile unsigned short*)(REG_BASE_ADDR + (addr))) |
#define | read_reg32(addr) (*(volatile unsigned long*) (REG_BASE_ADDR + (addr))) |
#define | WRITE_REG8 write_reg8 |
#define | WRITE_REG16 write_reg16 |
#define | WRITE_REG32 write_reg32 |
#define | READ_REG8 read_reg8 |
#define | READ_REG16 read_reg16 |
#define | READ_REG32 read_reg32 |
#define | TCMD_UNDER_BOTH 0xc0 |
#define | TCMD_UNDER_RD 0x80 |
#define | TCMD_UNDER_WR 0x40 |
#define | TCMD_MASK 0x3f |
#define | TCMD_WRITE 0x3 |
#define | TCMD_WAIT 0x7 |
#define | TCMD_WAREG 0x8 |
Typedefs | |
typedef struct TBLCMDSET | TBLCMDSET |
Functions | |
int | LoadTblCmdSet (const TBLCMDSET *pt, int size) |
This function performs a series of operations of writing digital or analog registers according to a command table. More... | |
void | sub_wr_ana (unsigned int addr, unsigned char value, unsigned char e, unsigned char s) |
This function writes a byte data to analog register. More... | |
void | sub_wr (unsigned int addr, unsigned char value, unsigned char e, unsigned char s) |
This function writes a byte data to a specified analog register. More... | |
#define BIT | ( | n | ) | ( 1<<(n) ) |
define BIT operations
#define BIT_MASK_LEN | ( | len | ) | (BIT(len)-1) |
#define BIT_RNG | ( | s, | |
e | |||
) | (BIT_MASK_LEN((e)-(s)+1) << (s)) |
#define BM_CLR_MASK_V | ( | x, | |
mask | |||
) | ( (x) & ~(mask) ) |
#define BM_SET | ( | x, | |
mask | |||
) | ( (x) |= (mask) ) |
#define BM_CLR | ( | x, | |
mask | |||
) | ( (x) &= ~(mask) ) |
#define BM_IS_SET | ( | x, | |
mask | |||
) | ( (x) & (mask) ) |
#define BM_IS_CLR | ( | x, | |
mask | |||
) | ( (~x) & (mask) ) |
#define BM_FLIP | ( | x, | |
mask | |||
) | ( (x) ^= (mask) ) |
#define BIT_LOW_BIT | ( | y | ) |
define Reg operations
#define BIT_HIGH_BIT | ( | y | ) |
#define COUNT_ARGS_IMPL2 | ( | _1, | |
_2, | |||
_3, | |||
_4, | |||
_5, | |||
_6, | |||
_7, | |||
_8, | |||
_9, | |||
_10, | |||
_11, | |||
_12, | |||
_13, | |||
_14, | |||
_15, | |||
_16, | |||
_17, | |||
_18, | |||
_19, | |||
_20, | |||
N, | |||
... | |||
) | N |
#define COUNT_ARGS_IMPL | ( | args | ) | COUNT_ARGS_IMPL2 args |
#define COUNT_ARGS | ( | ... | ) | COUNT_ARGS_IMPL((__VA_ARGS__, 20, 19, 18, 17, 16, 15, 14, 13, 12, 11, 10, 9, 8, 7, 6, 5, 4, 3, 2, 1, 0)) |
#define MACRO_CHOOSE_HELPER2 | ( | base, | |
count | |||
) | base##count |
#define MACRO_CHOOSE_HELPER1 | ( | base, | |
count | |||
) | MACRO_CHOOSE_HELPER2(base, count) |
#define MACRO_CHOOSE_HELPER | ( | base, | |
count | |||
) | MACRO_CHOOSE_HELPER1(base, count) |
#define MACRO_GLUE | ( | x, | |
y | |||
) | x y |
#define VARARG | ( | base, | |
... | |||
) | MACRO_GLUE(MACRO_CHOOSE_HELPER(base, COUNT_ARGS(__VA_ARGS__)),(__VA_ARGS__)) |
#define MV | ( | m, | |
v | |||
) | (((v) << BIT_LOW_BIT(m)) & (m)) |
#define MASK_VAL2 | ( | m, | |
v | |||
) | (MV(m,v)) |
#define MASK_VAL10 | ( | m1, | |
v1, | |||
m2, | |||
v2, | |||
m3, | |||
v3, | |||
m4, | |||
v4, | |||
m5, | |||
v5 | |||
) | (MV(m1,v1)|MV(m2,v2)|MV(m3,v3)|MV(m4,v4)|MV(m5,v5)) |
#define MASK_VAL12 | ( | m1, | |
v1, | |||
m2, | |||
v2, | |||
m3, | |||
v3, | |||
m4, | |||
v4, | |||
m5, | |||
v5, | |||
m6, | |||
v6 | |||
) | (MV(m1,v1)|MV(m2,v2)|MV(m3,v3)|MV(m4,v4)|MV(m5,v5)|MV(m6,v6)) |
#define MASK_VAL14 | ( | m1, | |
v1, | |||
m2, | |||
v2, | |||
m3, | |||
v3, | |||
m4, | |||
v4, | |||
m5, | |||
v5, | |||
m6, | |||
v6, | |||
m7, | |||
v7 | |||
) | (MV(m1,v1)|MV(m2,v2)|MV(m3,v3)|MV(m4,v4)|MV(m5,v5)|MV(m6,v6)|MV(m7,v7)) |
#define MASK_VAL16 | ( | m1, | |
v1, | |||
m2, | |||
v2, | |||
m3, | |||
v3, | |||
m4, | |||
v4, | |||
m5, | |||
v5, | |||
m6, | |||
v6, | |||
m7, | |||
v7, | |||
m8, | |||
v8 | |||
) | (MV(m1,v1)|MV(m2,v2)|MV(m3,v3)|MV(m4,v4)|MV(m5,v5)|MV(m6,v6)|MV(m7,v7)|MV(m8,v8)) |
#define MASK_VAL | ( | ... | ) | VARARG(MASK_VAL, __VA_ARGS__) |
#define REG_BASE_ADDR 0x800000 |
Reg operations
#define REG_ADDR8 | ( | a | ) | (*(volatile unsigned char*) (REG_BASE_ADDR + (a))) |
#define REG_ADDR16 | ( | a | ) | (*(volatile unsigned short*)(REG_BASE_ADDR + (a))) |
#define REG_ADDR32 | ( | a | ) | (*(volatile unsigned long*) (REG_BASE_ADDR + (a))) |
#define write_reg8 | ( | addr, | |
v | |||
) | (*(volatile unsigned char*) (REG_BASE_ADDR + (addr)) = (unsigned char)(v)) |
#define write_reg16 | ( | addr, | |
v | |||
) | (*(volatile unsigned short*) (REG_BASE_ADDR + (addr)) = (unsigned short)(v)) |
#define write_reg32 | ( | addr, | |
v | |||
) | (*(volatile unsigned long*) (REG_BASE_ADDR + (addr)) = (v)) |
#define read_reg8 | ( | addr | ) | (*(volatile unsigned char*) (REG_BASE_ADDR + (addr))) |
#define read_reg16 | ( | addr | ) | (*(volatile unsigned short*)(REG_BASE_ADDR + (addr))) |
#define read_reg32 | ( | addr | ) | (*(volatile unsigned long*) (REG_BASE_ADDR + (addr))) |
#define WRITE_REG8 write_reg8 |
#define WRITE_REG16 write_reg16 |
#define WRITE_REG32 write_reg32 |
#define READ_REG8 read_reg8 |
#define READ_REG16 read_reg16 |
#define READ_REG32 read_reg32 |
#define TCMD_UNDER_BOTH 0xc0 |
#define TCMD_UNDER_RD 0x80 |
#define TCMD_UNDER_WR 0x40 |
#define TCMD_MASK 0x3f |
#define TCMD_WRITE 0x3 |
#define TCMD_WAIT 0x7 |
#define TCMD_WAREG 0x8 |
int LoadTblCmdSet | ( | const TBLCMDSET * | pt, |
int | size | ||
) |
This function performs a series of operations of writing digital or analog registers according to a command table.
[in] | pt | - pointer to a command table containing several writing commands |
[in] | size | - number of commands in the table |
void sub_wr_ana | ( | unsigned int | addr, |
unsigned char | value, | ||
unsigned char | e, | ||
unsigned char | s | ||
) |
This function writes a byte data to analog register.
[in] | addr | - the address of the analog register needs to write |
[in] | value | - the data will be written to the analog register |
[in] | e | - the end address of value |
[in] | s | - the start address of the value |
void sub_wr | ( | unsigned int | addr, |
unsigned char | value, | ||
unsigned char | e, | ||
unsigned char | s | ||
) |
This function writes a byte data to a specified analog register.
[in] | addr | - the address of the analog register needs to write |
[in] | value | - the data will be written to the analog register |
[in] | e | - the end address of value |
[in] | s | - the start address of the value |