Add inline implementations of arm bus_space_read/write_N().
Reviewed by: cognet
This commit is contained in:
parent
941436306a
commit
16e2dc663f
@ -65,10 +65,10 @@ static struct bus_space _base_tag = {
|
|||||||
generic_bs_barrier,
|
generic_bs_barrier,
|
||||||
|
|
||||||
/* read (single) */
|
/* read (single) */
|
||||||
generic_bs_r_1,
|
NULL, /* bs_r_1, Use inline code in bus.h */
|
||||||
generic_armv4_bs_r_2,
|
NULL, /* bs_r_2, Use inline code in bus.h */
|
||||||
generic_bs_r_4,
|
NULL, /* bs_r_4, Use inline code in bus.h */
|
||||||
NULL,
|
NULL, /* bs_r_8, Use inline code in bus.h */
|
||||||
|
|
||||||
/* read multiple */
|
/* read multiple */
|
||||||
generic_bs_rm_1,
|
generic_bs_rm_1,
|
||||||
@ -83,10 +83,10 @@ static struct bus_space _base_tag = {
|
|||||||
NULL,
|
NULL,
|
||||||
|
|
||||||
/* write (single) */
|
/* write (single) */
|
||||||
generic_bs_w_1,
|
NULL, /* bs_w_1, Use inline code in bus.h */
|
||||||
generic_armv4_bs_w_2,
|
NULL, /* bs_w_2, Use inline code in bus.h */
|
||||||
generic_bs_w_4,
|
NULL, /* bs_w_4, Use inline code in bus.h */
|
||||||
NULL,
|
NULL, /* bs_w_8, Use inline code in bus.h */
|
||||||
|
|
||||||
/* write multiple */
|
/* write multiple */
|
||||||
generic_bs_wm_1,
|
generic_bs_wm_1,
|
||||||
@ -119,10 +119,10 @@ static struct bus_space _base_tag = {
|
|||||||
NULL,
|
NULL,
|
||||||
|
|
||||||
/* read stream (single) */
|
/* read stream (single) */
|
||||||
NULL,
|
NULL, /* bs_r_1_s, Use inline code in bus.h */
|
||||||
NULL,
|
NULL, /* bs_r_2_s, Use inline code in bus.h */
|
||||||
NULL,
|
NULL, /* bs_r_4_s, Use inline code in bus.h */
|
||||||
NULL,
|
NULL, /* bs_r_8_s, Use inline code in bus.h */
|
||||||
|
|
||||||
/* read multiple stream */
|
/* read multiple stream */
|
||||||
NULL,
|
NULL,
|
||||||
@ -137,10 +137,10 @@ static struct bus_space _base_tag = {
|
|||||||
NULL,
|
NULL,
|
||||||
|
|
||||||
/* write stream (single) */
|
/* write stream (single) */
|
||||||
NULL,
|
NULL, /* bs_w_1_s, Use inline code in bus.h */
|
||||||
NULL,
|
NULL, /* bs_w_2_s, Use inline code in bus.h */
|
||||||
NULL,
|
NULL, /* bs_w_4_s, Use inline code in bus.h */
|
||||||
NULL,
|
NULL, /* bs_w_8_s, Use inline code in bus.h */
|
||||||
|
|
||||||
/* write multiple stream */
|
/* write multiple stream */
|
||||||
NULL,
|
NULL,
|
||||||
|
@ -252,10 +252,6 @@ struct bus_space {
|
|||||||
#define __bs_c(a,b) __CONCAT(a,b)
|
#define __bs_c(a,b) __CONCAT(a,b)
|
||||||
#define __bs_opname(op,size) __bs_c(__bs_c(__bs_c(bs_,op),_),size)
|
#define __bs_opname(op,size) __bs_c(__bs_c(__bs_c(bs_,op),_),size)
|
||||||
|
|
||||||
#define __bs_rs(sz, t, h, o) \
|
|
||||||
(*(t)->__bs_opname(r,sz))((t)->bs_cookie, h, o)
|
|
||||||
#define __bs_ws(sz, t, h, o, v) \
|
|
||||||
(*(t)->__bs_opname(w,sz))((t)->bs_cookie, h, o, v)
|
|
||||||
#define __bs_nonsingle(type, sz, t, h, o, a, c) \
|
#define __bs_nonsingle(type, sz, t, h, o, a, c) \
|
||||||
(*(t)->__bs_opname(type,sz))((t)->bs_cookie, h, o, a, c)
|
(*(t)->__bs_opname(type,sz))((t)->bs_cookie, h, o, a, c)
|
||||||
#define __bs_set(type, sz, t, h, o, v, c) \
|
#define __bs_set(type, sz, t, h, o, v, c) \
|
||||||
@ -272,6 +268,28 @@ struct bus_space {
|
|||||||
(*(t)->__bs_opname_s(type,sz))((t)->bs_cookie, h, o, a, c)
|
(*(t)->__bs_opname_s(type,sz))((t)->bs_cookie, h, o, a, c)
|
||||||
|
|
||||||
|
|
||||||
|
#define __generate_inline_bs_rs(IFN, MBR, TYP) \
|
||||||
|
static inline TYP \
|
||||||
|
IFN(bus_space_tag_t t, bus_space_handle_t h, bus_size_t o) \
|
||||||
|
{ \
|
||||||
|
\
|
||||||
|
if (__predict_true(t->MBR == NULL)) \
|
||||||
|
return (*(volatile TYP *)(h + o)); \
|
||||||
|
else \
|
||||||
|
return (t->MBR(t->bs_cookie, h, o)); \
|
||||||
|
}
|
||||||
|
|
||||||
|
#define __generate_inline_bs_ws(IFN, MBR, TYP) \
|
||||||
|
static inline void \
|
||||||
|
IFN(bus_space_tag_t t, bus_space_handle_t h, bus_size_t o, TYP v)\
|
||||||
|
{ \
|
||||||
|
\
|
||||||
|
if (__predict_true(t->MBR == NULL)) \
|
||||||
|
*(volatile TYP *)(h + o) = v; \
|
||||||
|
else \
|
||||||
|
t->MBR(t->bs_cookie, h, o, v); \
|
||||||
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Mapping and unmapping operations.
|
* Mapping and unmapping operations.
|
||||||
*/
|
*/
|
||||||
@ -304,15 +322,15 @@ struct bus_space {
|
|||||||
/*
|
/*
|
||||||
* Bus read (single) operations.
|
* Bus read (single) operations.
|
||||||
*/
|
*/
|
||||||
#define bus_space_read_1(t, h, o) __bs_rs(1,(t),(h),(o))
|
__generate_inline_bs_rs(bus_space_read_1, bs_r_1, uint8_t);
|
||||||
#define bus_space_read_2(t, h, o) __bs_rs(2,(t),(h),(o))
|
__generate_inline_bs_rs(bus_space_read_2, bs_r_2, uint16_t);
|
||||||
#define bus_space_read_4(t, h, o) __bs_rs(4,(t),(h),(o))
|
__generate_inline_bs_rs(bus_space_read_4, bs_r_4, uint32_t);
|
||||||
#define bus_space_read_8(t, h, o) __bs_rs(8,(t),(h),(o))
|
__generate_inline_bs_rs(bus_space_read_8, bs_r_8, uint64_t);
|
||||||
|
|
||||||
#define bus_space_read_stream_1(t, h, o) __bs_rs_s(1,(t), (h), (o))
|
__generate_inline_bs_rs(bus_space_read_stream_1, bs_r_1_s, uint8_t);
|
||||||
#define bus_space_read_stream_2(t, h, o) __bs_rs_s(2,(t), (h), (o))
|
__generate_inline_bs_rs(bus_space_read_stream_2, bs_r_2_s, uint16_t);
|
||||||
#define bus_space_read_stream_4(t, h, o) __bs_rs_s(4,(t), (h), (o))
|
__generate_inline_bs_rs(bus_space_read_stream_4, bs_r_4_s, uint32_t);
|
||||||
#define bus_space_read_stream_8(t, h, o) __bs_rs_s(8,8,(t),(h),(o))
|
__generate_inline_bs_rs(bus_space_read_stream_8, bs_r_8_s, uint64_t);
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Bus read multiple operations.
|
* Bus read multiple operations.
|
||||||
@ -361,15 +379,15 @@ struct bus_space {
|
|||||||
/*
|
/*
|
||||||
* Bus write (single) operations.
|
* Bus write (single) operations.
|
||||||
*/
|
*/
|
||||||
#define bus_space_write_1(t, h, o, v) __bs_ws(1,(t),(h),(o),(v))
|
__generate_inline_bs_ws(bus_space_write_1, bs_w_1, uint8_t);
|
||||||
#define bus_space_write_2(t, h, o, v) __bs_ws(2,(t),(h),(o),(v))
|
__generate_inline_bs_ws(bus_space_write_2, bs_w_2, uint16_t);
|
||||||
#define bus_space_write_4(t, h, o, v) __bs_ws(4,(t),(h),(o),(v))
|
__generate_inline_bs_ws(bus_space_write_4, bs_w_4, uint32_t);
|
||||||
#define bus_space_write_8(t, h, o, v) __bs_ws(8,(t),(h),(o),(v))
|
__generate_inline_bs_ws(bus_space_write_8, bs_w_8, uint64_t);
|
||||||
|
|
||||||
#define bus_space_write_stream_1(t, h, o, v) __bs_ws_s(1,(t),(h),(o),(v))
|
__generate_inline_bs_ws(bus_space_write_stream_1, bs_w_1_s, uint8_t);
|
||||||
#define bus_space_write_stream_2(t, h, o, v) __bs_ws_s(2,(t),(h),(o),(v))
|
__generate_inline_bs_ws(bus_space_write_stream_2, bs_w_2_s, uint16_t);
|
||||||
#define bus_space_write_stream_4(t, h, o, v) __bs_ws_s(4,(t),(h),(o),(v))
|
__generate_inline_bs_ws(bus_space_write_stream_4, bs_w_4_s, uint32_t);
|
||||||
#define bus_space_write_stream_8(t, h, o, v) __bs_ws_s(8,(t),(h),(o),(v))
|
__generate_inline_bs_ws(bus_space_write_stream_8, bs_w_8_s, uint64_t);
|
||||||
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
Loading…
Reference in New Issue
Block a user