Commit 8205f13f authored by Federico Vaga's avatar Federico Vaga

sw:rt: now we support byte addressing for all memories

Signed-off-by: Federico Vaga's avatarFederico Vaga <federico.vaga@cern.ch>
parent 6928903b
...@@ -20,7 +20,6 @@ CONFIG_MOCKTURTLE_FRAMEWORK_ENABLE=y ...@@ -20,7 +20,6 @@ CONFIG_MOCKTURTLE_FRAMEWORK_ENABLE=y
CONFIG_MOCKTURTLE_FRAMEWORK_DEBUG_ENABLE=y CONFIG_MOCKTURTLE_FRAMEWORK_DEBUG_ENABLE=y
CONFIG_MOCKTURTLE_FRAMEWORK_VARIABLE_ENABLE=y CONFIG_MOCKTURTLE_FRAMEWORK_VARIABLE_ENABLE=y
# CONFIG_MOCKTURTLE_FRAMEWORK_BUFFER_ENABLE is not set # CONFIG_MOCKTURTLE_FRAMEWORK_BUFFER_ENABLE is not set
CONFIG_MOCKTURTLE_FRAMEWORK_32BIT_ALIGN=y
# #
# Mock Turtle library configuration # Mock Turtle library configuration
......
...@@ -20,7 +20,6 @@ CONFIG_MOCKTURTLE_FRAMEWORK_ENABLE=y ...@@ -20,7 +20,6 @@ CONFIG_MOCKTURTLE_FRAMEWORK_ENABLE=y
CONFIG_MOCKTURTLE_FRAMEWORK_DEBUG_ENABLE=y CONFIG_MOCKTURTLE_FRAMEWORK_DEBUG_ENABLE=y
CONFIG_MOCKTURTLE_FRAMEWORK_VARIABLE_ENABLE=y CONFIG_MOCKTURTLE_FRAMEWORK_VARIABLE_ENABLE=y
CONFIG_MOCKTURTLE_FRAMEWORK_BUFFER_ENABLE=y CONFIG_MOCKTURTLE_FRAMEWORK_BUFFER_ENABLE=y
CONFIG_MOCKTURTLE_FRAMEWORK_32BIT_ALIGN=y
# #
# Mock Turtle library configuration # Mock Turtle library configuration
......
...@@ -18,7 +18,6 @@ CONFIG_MOCKTURTLE_FRAMEWORK_ENABLE=y ...@@ -18,7 +18,6 @@ CONFIG_MOCKTURTLE_FRAMEWORK_ENABLE=y
CONFIG_MOCKTURTLE_FRAMEWORK_DEBUG_ENABLE=y CONFIG_MOCKTURTLE_FRAMEWORK_DEBUG_ENABLE=y
CONFIG_MOCKTURTLE_FRAMEWORK_VARIABLE_ENABLE=y CONFIG_MOCKTURTLE_FRAMEWORK_VARIABLE_ENABLE=y
CONFIG_MOCKTURTLE_FRAMEWORK_BUFFER_ENABLE=y CONFIG_MOCKTURTLE_FRAMEWORK_BUFFER_ENABLE=y
# CONFIG_MOCKTURTLE_FRAMEWORK_32BIT_ALIGN is not set
# #
# Mock Turtle library configuration # Mock Turtle library configuration
......
...@@ -20,7 +20,6 @@ CONFIG_MOCKTURTLE_FRAMEWORK_ENABLE=y ...@@ -20,7 +20,6 @@ CONFIG_MOCKTURTLE_FRAMEWORK_ENABLE=y
# CONFIG_MOCKTURTLE_FRAMEWORK_DEBUG_ENABLE is not set # CONFIG_MOCKTURTLE_FRAMEWORK_DEBUG_ENABLE is not set
# CONFIG_MOCKTURTLE_FRAMEWORK_VARIABLE_ENABLE is not set # CONFIG_MOCKTURTLE_FRAMEWORK_VARIABLE_ENABLE is not set
# CONFIG_MOCKTURTLE_FRAMEWORK_BUFFER_ENABLE is not set # CONFIG_MOCKTURTLE_FRAMEWORK_BUFFER_ENABLE is not set
CONFIG_MOCKTURTLE_FRAMEWORK_32BIT_ALIGN=y
# #
# Mock Turtle library configuration # Mock Turtle library configuration
......
...@@ -31,14 +31,6 @@ config MOCKTURTLE_FRAMEWORK_BUFFER_ENABLE ...@@ -31,14 +31,6 @@ config MOCKTURTLE_FRAMEWORK_BUFFER_ENABLE
help help
It enables the API for local buffers exchange with the host system. It enables the API for local buffers exchange with the host system.
config MOCKTURTLE_FRAMEWORK_32BIT_ALIGN
bool "Enable 32bit align in Mock Turtle framework"
depends on MOCKTURTLE_FRAMEWORK_ENABLE
default y
help
Enable this if Mock Turtle does not have byte addressing
support. If unsure: "yes".
comment "Mock Turtle library configuration" comment "Mock Turtle library configuration"
config MOCKTURTLE_LIBRARY_PRINT_ENABLE config MOCKTURTLE_LIBRARY_PRINT_ENABLE
......
...@@ -36,8 +36,8 @@ int rt_version_getter(struct trtl_proto_header *hin, void *pin, ...@@ -36,8 +36,8 @@ int rt_version_getter(struct trtl_proto_header *hin, void *pin,
hout->msg_id = TRTL_MSG_ID_VERS_ANS; hout->msg_id = TRTL_MSG_ID_VERS_ANS;
hout->len = sizeof(struct trtl_rt_version) / 4; hout->len = sizeof(struct trtl_rt_version) / 4;
rt_memcpy(dout, (uint32_t *)&_app->version, memcpy(dout, (uint32_t *)&_app->version,
sizeof(struct trtl_rt_version)); sizeof(struct trtl_rt_version));
return 0; return 0;
} }
...@@ -69,8 +69,8 @@ int rt_buffer_setter(struct trtl_proto_header *hin, void *pin, ...@@ -69,8 +69,8 @@ int rt_buffer_setter(struct trtl_proto_header *hin, void *pin,
index, size, _app->buffers[index].buf); index, size, _app->buffers[index].buf);
if (_app->buffers[index].len == size) { if (_app->buffers[index].len == size) {
rt_memcpy((uint32_t *)_app->buffers[index].buf, memcpy((uint32_t *)_app->buffers[index].buf,
&din[offset], size); &din[offset], size);
} else { } else {
pr_error("%s:%d structure %d len not correct %"PRId32" != %d\n\r", pr_error("%s:%d structure %d len not correct %"PRId32" != %d\n\r",
__func__, __LINE__, index, __func__, __LINE__, index,
...@@ -117,9 +117,9 @@ int rt_buffer_getter(struct trtl_proto_header *hin, void *pin, ...@@ -117,9 +117,9 @@ int rt_buffer_getter(struct trtl_proto_header *hin, void *pin,
index, size, _app->buffers[index].buf); index, size, _app->buffers[index].buf);
if (_app->buffers[index].len == size) { if (_app->buffers[index].len == size) {
rt_memcpy(&dout[offset], memcpy(&dout[offset],
(uint32_t *)_app->buffers[index].buf, (uint32_t *)_app->buffers[index].buf,
size); size);
} else { } else {
pr_error("%s: structure %d len not correct %"PRId32" != %d\n\r", pr_error("%s: structure %d len not correct %"PRId32" != %d\n\r",
__func__, index, _app->buffers[index].len, size); __func__, index, _app->buffers[index].len, size);
...@@ -294,7 +294,8 @@ static inline int rt_action_run(struct trtl_proto_header *hin, void *pin) ...@@ -294,7 +294,8 @@ static inline int rt_action_run(struct trtl_proto_header *hin, void *pin)
/* Do not write directly the header on the buffer because it does not /* Do not write directly the header on the buffer because it does not
work for fields size different than 32bit */ work for fields size different than 32bit */
pout = rt_proto_payload_get((void *) out_buf.data); pout = rt_proto_payload_get((void *) out_buf.data);
rt_memcpy((uint32_t *)&hout, (uint32_t *)hin, sizeof(struct trtl_proto_header)); memcpy((uint32_t *)&hout, (uint32_t *)hin,
sizeof(struct trtl_proto_header));
err = action(hin, pin, &hout, pout); err = action(hin, pin, &hout, pout);
if (err) if (err)
......
...@@ -51,7 +51,6 @@ extern struct rt_application *_app; ...@@ -51,7 +51,6 @@ extern struct rt_application *_app;
extern int rt_init(struct rt_application *app); extern int rt_init(struct rt_application *app);
extern void rt_get_time(uint32_t *seconds, uint32_t *cycles); extern void rt_get_time(uint32_t *seconds, uint32_t *cycles);
extern void rt_memcpy(uint32_t *dest, uint32_t *src, size_t n);
#endif #endif
/**@}*/ /**@}*/
...@@ -12,23 +12,6 @@ ...@@ -12,23 +12,6 @@
uint32_t msg_seq = 0; uint32_t msg_seq = 0;
struct rt_application *_app; struct rt_application *_app;
/**
* Some Mock Turtle version support only 32bit addressing.
* This memcpy implementation perform a 32bit aligned copy
* @param[out] dest destination buffer
* @param[in] src source buffer
* @param[in] n number of bytes
*/
void rt_memcpy(uint32_t *dest, uint32_t *src, size_t n)
{
int i;
for (i = 0; i < n / 4; ++i)
dest[i] = src[i];
}
/** /**
* It get the current time from the internal WRNC timer * It get the current time from the internal WRNC timer
* @param[out] seconds * @param[out] seconds
......
...@@ -85,7 +85,7 @@ void trtl_rt_mq_send_buf(unsigned int mq_idx, uint8_t msg_id, ...@@ -85,7 +85,7 @@ void trtl_rt_mq_send_buf(unsigned int mq_idx, uint8_t msg_id,
}; };
void *buf = _app->mq[mq_idx].buf; void *buf = _app->mq[mq_idx].buf;
rt_memcpy(rt_proto_payload_get(buf), data, n); memcpy(rt_proto_payload_get(buf), data, n);
rt_proto_header_set(buf, &hdr); rt_proto_header_set(buf, &hdr);
trtl_rt_mq_send(mq_idx, (sizeof(struct trtl_proto_header) / 4) + trtl_rt_mq_send(mq_idx, (sizeof(struct trtl_proto_header) / 4) +
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment