mirror of
https://github.com/Rockbox/rockbox.git
synced 2025-10-14 10:37:38 -04:00
hwstub/qeditor: add support for atomic read/writes
The current code assumed that READ/WRITE would produce atomic read/writes for 8/16/32-bit words, which in turned put assumption on the memcpy function. Since some memcpy implementation do not always guarantee such strong assumption, introduce two new operation READ/WRITE_ATOMIC which provide the necessary tools to do correct read and write to register in a single memory access. Change-Id: I37451bd5057bb0dcaf5a800d8aef8791c792a090
This commit is contained in:
parent
794169a18f
commit
cd04a5f1aa
12 changed files with 254 additions and 24 deletions
|
@ -266,7 +266,7 @@ bool HWStubDevice::ReadMem(soc_addr_t addr, size_t length, void *buffer)
|
|||
{
|
||||
if(!m_hwdev)
|
||||
return false;
|
||||
int ret = hwstub_rw_mem(m_hwdev, 1, addr, buffer, length);
|
||||
int ret = hwstub_rw_mem_atomic(m_hwdev, 1, addr, buffer, length);
|
||||
return ret >= 0 && (size_t)ret == length;
|
||||
}
|
||||
|
||||
|
@ -274,7 +274,7 @@ bool HWStubDevice::WriteMem(soc_addr_t addr, size_t length, void *buffer)
|
|||
{
|
||||
if(!m_hwdev)
|
||||
return false;
|
||||
int ret = hwstub_rw_mem(m_hwdev, 0, addr, buffer, length);
|
||||
int ret = hwstub_rw_mem_atomic(m_hwdev, 0, addr, buffer, length);
|
||||
return ret >= 0 && (size_t)ret == length;
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue