Skip to content

Commit fe9720f

Browse files
committed
Merge pull request #1626 from mtkrtk/rz_a1h_async_patch
[Renesas RZ/A1H] Enable asynchronous communications
2 parents 670e7bc + e96f6bf commit fe9720f

File tree

11 files changed

+1231
-224
lines changed

11 files changed

+1231
-224
lines changed

libraries/mbed/api/CThunk.h

Lines changed: 20 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@
2424

2525
#define CTHUNK_ADDRESS 1
2626

27-
#if defined(__CORTEX_M3) || defined(__CORTEX_M4) || defined(__thumb2__)
27+
#if (defined(__CORTEX_M3) || defined(__CORTEX_M4) || defined(__thumb2__)) && ! defined(__CORTEX_A9)
2828
#define CTHUNK_VARIABLES volatile uint32_t code[1]
2929
/**
3030
* CTHUNK disassembly for Cortex-M3/M4 (thumb2):
@@ -38,7 +38,7 @@
3838
*/
3939
#define CTHUNK_ASSIGMENT m_thunk.code[0] = 0x8007E89F
4040

41-
#elif defined(__CORTEX_M0PLUS) || defined(__CORTEX_M0)
41+
#elif defined(__CORTEX_M0PLUS) || defined(__CORTEX_M0) || defined(__CORTEX_A9)
4242
/*
4343
* CTHUNK disassembly for Cortex M0 (thumb):
4444
* * push {r0,r1,r2,r3,r4,lr} save touched registers and return address
@@ -194,6 +194,24 @@ class CThunk
194194
m_thunk.callback = (uint32_t)&m_callback;
195195
m_thunk.trampoline = (uint32_t)&trampoline;
196196

197+
#if defined(__CORTEX_A9)
198+
/* Data cache clean */
199+
/* Cache control */
200+
{
201+
uint32_t start_addr = (uint32_t)&m_thunk & 0xFFFFFFE0;
202+
uint32_t end_addr = (uint32_t)&m_thunk + sizeof(m_thunk);
203+
uint32_t addr;
204+
205+
/* Data cache clean and invalid */
206+
for (addr = start_addr; addr < end_addr; addr += 0x20) {
207+
__v7_clean_inv_dcache_mva((void *)addr);
208+
}
209+
/* Instruction cache invalid */
210+
__v7_inv_icache_all();
211+
__ca9u_inv_tlb_all();
212+
__v7_inv_btac();
213+
}
214+
#endif
197215
__ISB();
198216
__DSB();
199217
}

libraries/mbed/common/SPI.cpp

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -124,7 +124,12 @@ int SPI::queue_transfer(const void *tx_buffer, int tx_length, void *rx_buffer, i
124124
if (_transaction_buffer.full()) {
125125
return -1; // the buffer is full
126126
} else {
127+
__disable_irq();
127128
_transaction_buffer.push(transaction);
129+
if (!spi_active(&_spi)) {
130+
dequeue_transaction();
131+
}
132+
__enable_irq();
128133
return 0;
129134
}
130135
#else

libraries/mbed/targets/cmsis/TARGET_RENESAS/TARGET_RZ_A1H/MBRZA1H.h

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -754,11 +754,12 @@ typedef enum IRQn
754754
region.outer_norm_t = WB_WA; \
755755
region.mem_t = NORMAL; \
756756
region.sec_t = NON_SECURE; \
757-
region.xn_t = NON_EXECUTE; \
757+
region.xn_t = EXECUTE; \
758758
region.priv_t = RW; \
759759
region.user_t = RW; \
760760
region.sh_t = NON_SHARED; \
761761
__get_section_descriptor(&descriptor_l1, region);
762+
762763
//Sect_SO. Strongly-ordered (therefore shareable), not executable, rw, domain 0, base addr 0
763764
#define section_so(descriptor_l1, region) region.rg_t = SECTION; \
764765
region.domain = 0x0; \
@@ -788,7 +789,7 @@ typedef enum IRQn
788789
region.user_t = READ; \
789790
region.sh_t = NON_SHARED; \
790791
__get_section_descriptor(&descriptor_l1, region);
791-
792+
792793
//Sect_Device_RW. Sect_Device_RO, but writeable
793794
#define section_device_rw(descriptor_l1, region) region.rg_t = SECTION; \
794795
region.domain = 0x0; \
@@ -832,6 +833,7 @@ typedef enum IRQn
832833
region.user_t = RW; \
833834
region.sh_t = NON_SHARED; \
834835
__get_page_descriptor(&descriptor_l1, &descriptor_l2, region);
836+
835837

836838
/*@}*/ /* end of group Renesas_RZ_A1_MemoryMap */
837839

libraries/mbed/targets/hal/TARGET_RENESAS/TARGET_RZ_A1H/device.h

Lines changed: 29 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -24,45 +24,50 @@
2424
#endif
2525
/* <-Take measures about optimization problems of web compiler */
2626

27-
#define DEVICE_PORTIN 1
28-
#define DEVICE_PORTOUT 1
29-
#define DEVICE_PORTINOUT 1
27+
#define DEVICE_PORTIN 1
28+
#define DEVICE_PORTOUT 1
29+
#define DEVICE_PORTINOUT 1
3030

31-
#define DEVICE_INTERRUPTIN 1
31+
#define DEVICE_INTERRUPTIN 1
3232

33-
#define DEVICE_ANALOGIN 1
34-
#define DEVICE_ANALOGOUT 0
33+
#define DEVICE_ANALOGIN 1
34+
#define DEVICE_ANALOGOUT 0
3535

36-
#define DEVICE_SERIAL 1
37-
#define DEVICE_SERIAL_FC 1
36+
#define DEVICE_SERIAL 1
37+
#define DEVICE_SERIAL_FC 1
38+
#define DEVICE_SERIAL_ASYNCH 1
3839

39-
#define DEVICE_I2C 1
40-
#define DEVICE_I2CSLAVE 1
40+
#define DEVICE_I2C 1
41+
#define DEVICE_I2CSLAVE 1
42+
#define DEVICE_I2C_ASYNCH 1
4143

42-
#define DEVICE_SPI 1
43-
#define DEVICE_SPISLAVE 1
44+
#define DEVICE_SPI 1
45+
#define DEVICE_SPISLAVE 1
46+
#define DEVICE_SPI_ASYNCH 1
47+
#define TRANSACTION_QUEUE_SIZE_SPI 16
4448

45-
#define DEVICE_CAN 1
49+
#define DEVICE_CAN 1
4650

47-
#define DEVICE_RTC 1
51+
#define DEVICE_RTC 1
4852

49-
#define DEVICE_ETHERNET 1
53+
#define DEVICE_ETHERNET 1
5054

51-
#define DEVICE_PWMOUT 1
55+
#define DEVICE_PWMOUT 1
5256

53-
#define DEVICE_SEMIHOST 0
54-
#define DEVICE_LOCALFILESYSTEM 0
55-
#define DEVICE_ID_LENGTH 32
56-
#define DEVICE_MAC_OFFSET 20
57+
#define DEVICE_SEMIHOST 0
58+
#define DEVICE_LOCALFILESYSTEM 0
59+
#define DEVICE_ID_LENGTH 32
60+
#define DEVICE_MAC_OFFSET 20
5761

58-
#define DEVICE_SLEEP 0
62+
#define DEVICE_SLEEP 0
5963

60-
#define DEVICE_DEBUG_AWARENESS 0
64+
#define DEVICE_DEBUG_AWARENESS 0
6165

62-
#define DEVICE_STDIO_MESSAGES 1
66+
#define DEVICE_STDIO_MESSAGES 1
6367

64-
#define DEVICE_ERROR_PATTERN 1
68+
#define DEVICE_ERROR_PATTERN 1
6569

6670
#include "objects.h"
71+
#include "dma_api.h"
6772

6873
#endif

0 commit comments

Comments
 (0)