Skip to content

Commit b16aaca

Browse files
authored
Merge pull request #11118 from ganesh-ramachandran/m46b_newfeatures
Add new features to Toshiba's TMPM46B
2 parents 101ae73 + edf36fb commit b16aaca

File tree

18 files changed

+980
-295
lines changed

18 files changed

+980
-295
lines changed

targets/TARGET_TOSHIBA/TARGET_TMPM46B/Periph_Driver/src/tmpm46b_esg.c

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -244,8 +244,6 @@ FunctionalState ESG_GetIntStatus(void)
244244
*/
245245
void ESG_IPReset(void)
246246
{
247-
uint32_t iprst3 = 0U;
248-
249247
/* Disable write protection state of SRSTIPRST */
250248
TSB_SRST->PROTECT = SRST_PROTECT_DISABLE;
251249

targets/TARGET_TOSHIBA/TARGET_TMPM46B/analogin_api.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -76,7 +76,7 @@ uint16_t analogin_read_u16(analogin_t *obj)
7676
// Start ADC conversion
7777
ADC_Start(TSB_AD);
7878
// Wait until AD conversion complete
79-
while(ADC_GetConvertState(TSB_AD).Bit.NormalComplete != 1) {
79+
while (ADC_GetConvertState(TSB_AD).Bit.NormalComplete != 1) {
8080
// Do nothing
8181
}
8282
wait_us(30);

targets/TARGET_TOSHIBA/TARGET_TMPM46B/device.h

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,8 @@
1616
#ifndef MBED_DEVICE_H
1717
#define MBED_DEVICE_H
1818

19-
#define DEVICE_ID_LENGTH 32
19+
#define TRANSACTION_QUEUE_SIZE_SPI 4
20+
#define DEVICE_ID_LENGTH 32
2021

2122
#include "objects.h"
2223
#include <stddef.h>

targets/TARGET_TOSHIBA/TARGET_TMPM46B/device/TOOLCHAIN_ARM_STD/tmpm46bf10fg.sct

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -45,6 +45,6 @@ LR_IROM1 MBED_APP_START MBED_APP_SIZE ; load region size_region
4545
.ANY (+RW, +ZI)
4646
}
4747

48-
ARM_LIB_STACK (0x200001E0+0x80000) EMPTY -Stack_Size { ; stack
48+
ARM_LIB_STACK (0x20000000+0x80000) EMPTY -Stack_Size { ; stack
4949
}
5050
}

targets/TARGET_TOSHIBA/TARGET_TMPM46B/device/system_TMPM46B.c

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -317,13 +317,11 @@ void SystemInit(void)
317317
volatile uint32_t oscf = 0U;
318318
uint32_t wdte = 0U;
319319

320-
#if defined ( __CC_ARM )/*Enable FPU for Keil*/
321-
#if (__FPU_USED == 1) /* __FPU_USED is defined in core_cm4.h */
320+
#if (__FPU_USED == 1) /* __FPU_USED is defined in core_cm4.h */
322321
/* enable FPU if available and used */
323322
SCB->CPACR |= ((3UL << 10*2) | /* set CP10 Full Access */
324323
(3UL << 11*2) ); /* set CP11 Full Access */
325-
#endif
326-
#endif
324+
#endif
327325

328326
#if (WD_SETUP) /* Watchdog Setup */
329327
while (TSB_WD->FLG != 0U) {

targets/TARGET_TOSHIBA/TARGET_TMPM46B/flash_api.c

Lines changed: 26 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -18,34 +18,34 @@
1818
#include "mbed_critical.h"
1919
#include "tmpm46b_fc.h"
2020

21-
#define PROGRAM_WIRTE_MAX 16U /* Page program could be written 16 bytes/4 words once */
22-
#define SECTOR_SIZE 0x8000 /* (512 * 8) sectors */
23-
#define PAGE_SIZE 16U /* Page program size is 16 bytes */
21+
#define PROGRAM_WIRTE_MAX 16U // Page program could be written 16 bytes/4 words once
22+
#define SECTOR_SIZE 0x8000 // (512 * 8) sectors
23+
#define PAGE_SIZE 16U // Page program size is 16 bytes
2424

25-
#if defined ( __ICCARM__ ) /* IAR Compiler */
25+
#if defined ( __ICCARM__ ) // IAR Compiler
2626
#define FLASH_API_ROM ((uint32_t *)__section_begin("FLASH_CODE_ROM"))
2727
#define SIZE_FLASH_API ((uint32_t)__section_size("FLASH_CODE_ROM"))
2828
#define FLASH_API_RAM ((uint32_t *)__section_begin("FLASH_CODE_RAM"))
2929
#pragma section = "FLASH_CODE_RAM"
3030
#pragma section = "FLASH_CODE_ROM"
3131
#endif
3232

33-
#if defined ( __ICCARM__ ) /* IAR Compiler */
34-
static void Copy_Routine(uint32_t * dest, uint32_t * source, uint32_t size)
33+
#if defined ( __ICCARM__ ) // IAR Compiler
34+
static void Copy_Routine(uint32_t *dest, uint32_t *source, uint32_t size)
3535
{
3636
uint32_t *dest_addr, *source_addr, tmpsize;
3737
uint32_t i, tmps, tmpd, mask;
3838

39-
dest_addr = dest;
39+
dest_addr = dest;
4040
source_addr = source;
4141

4242
tmpsize = size >> 2U;
43-
for (i = 0U; i < tmpsize; i++) { /* 32bits copy */
43+
for (i = 0U; i < tmpsize; i++) { // 32bits copy
4444
*dest_addr = *source_addr;
4545
dest_addr++;
4646
source_addr++;
4747
}
48-
if (size & 0x00000003U) { /* if the last data size is not 0(maybe 1,2 or 3), copy the last data */
48+
if (size & 0x00000003U) { // if the last data size is not 0(maybe 1,2 or 3), copy the last data
4949
mask = 0xFFFFFF00U;
5050
i = size & 0x00000003U;
5151
tmps = *source_addr;
@@ -56,9 +56,9 @@ static void Copy_Routine(uint32_t * dest, uint32_t * source, uint32_t size)
5656
}
5757
tmps = tmps & (~mask);
5858
tmpd = tmpd & (mask);
59-
*dest_addr = tmps + tmpd; /* 32bits copy, but only change the bytes need to be changed */
59+
*dest_addr = tmps + tmpd; // 32bits copy, but only change the bytes need to be changed
6060
} else {
61-
/* Do nothing */
61+
// Do nothing
6262
}
6363
}
6464
#endif
@@ -69,7 +69,7 @@ int32_t flash_init(flash_t *obj)
6969
TSB_FC->PROGCR = 0x00000001U;
7070
TSB_FC->ERASECR = 0x00000007U;
7171
TSB_FC->AREASEL = 0x00000000U;
72-
#if defined ( __ICCARM__ ) /* IAR Compiler */
72+
#if defined ( __ICCARM__ ) // IAR Compiler
7373
Copy_Routine(FLASH_API_RAM, FLASH_API_ROM, SIZE_FLASH_API);
7474
#endif
7575
return 0;
@@ -80,36 +80,36 @@ int32_t flash_free(flash_t *obj)
8080
return 0;
8181
}
8282

83-
#if defined ( __ICCARM__ ) /* IAR Compiler */
83+
#if defined ( __ICCARM__ ) // IAR Compiler
8484
#pragma location = "FLASH_ROM"
8585
#endif
8686
int32_t flash_erase_sector(flash_t *obj, uint32_t address)
8787
{
8888
int status = FAIL;
89-
/* We need to prevent flash accesses during erase operation */
89+
// We need to prevent flash accesses during erase operation
9090
core_util_critical_section_enter();
9191

9292
if (FC_SUCCESS == FC_EraseBlock(address)) {
9393
status = SUCCESS;
9494
} else {
95-
/* Do nothing */
95+
// Do nothing
9696
}
9797
core_util_critical_section_exit();
9898
return status;
9999
}
100100

101-
#if defined ( __ICCARM__ ) /* IAR Compiler */
101+
#if defined ( __ICCARM__ ) // IAR Compiler
102102
#pragma location = "FLASH_ROM"
103103
#endif
104104
int32_t flash_program_page(flash_t *obj, uint32_t address, const uint8_t *data, uint32_t size)
105105
{
106106
int status = SUCCESS;
107107

108-
/* We need to prevent flash accesses during program operation */
108+
// We need to prevent flash accesses during program operation
109109
core_util_critical_section_enter();
110110
while (size > PROGRAM_WIRTE_MAX) {
111-
if (FC_SUCCESS == FC_WritePage((uint32_t)address, (uint32_t *)data)) { /* write one page every time */
112-
/* Do nothing */
111+
if (FC_SUCCESS == FC_WritePage((uint32_t)address, (uint32_t *)data)) { // write one page every time
112+
// Do nothing
113113
} else {
114114
status = FAIL;
115115
break;
@@ -118,8 +118,8 @@ int32_t flash_program_page(flash_t *obj, uint32_t address, const uint8_t *data,
118118
address = address + PROGRAM_WIRTE_MAX;
119119
data = data + PROGRAM_WIRTE_MAX;
120120
}
121-
if (FC_SUCCESS == FC_WritePage((uint32_t)address, (uint32_t *)data)) { /* write the last data, no more than one page */
122-
/* Do nothing */
121+
if (FC_SUCCESS == FC_WritePage((uint32_t)address, (uint32_t *)data)) { // write the last data, no more than one page
122+
// Do nothing
123123
} else {
124124
status = FAIL;
125125
}
@@ -128,7 +128,7 @@ int32_t flash_program_page(flash_t *obj, uint32_t address, const uint8_t *data,
128128
return status;
129129
}
130130

131-
#if defined ( __ICCARM__ ) /* IAR Compiler */
131+
#if defined ( __ICCARM__ ) // IAR Compiler
132132
#pragma location = "FLASH_ROM"
133133
#endif
134134
uint32_t flash_get_sector_size(const flash_t *obj, uint32_t address)
@@ -139,31 +139,31 @@ uint32_t flash_get_sector_size(const flash_t *obj, uint32_t address)
139139
return SECTOR_SIZE;
140140
}
141141

142-
#if defined ( __ICCARM__ ) /* IAR Compiler */
142+
#if defined ( __ICCARM__ ) // IAR Compiler
143143
#pragma location = "FLASH_ROM"
144144
#endif
145145
uint32_t flash_get_page_size(const flash_t *obj)
146146
{
147147
return PAGE_SIZE;
148148
}
149149

150-
#if defined ( __ICCARM__ ) /* IAR Compiler */
150+
#if defined ( __ICCARM__ ) // IAR Compiler
151151
#pragma location = "FLASH_ROM"
152152
#endif
153153
uint32_t flash_get_start_address(const flash_t *obj)
154154
{
155155
return FLASH_START_ADDR;
156156
}
157157

158-
#if defined ( __ICCARM__ ) /* IAR Compiler */
158+
#if defined ( __ICCARM__ ) // IAR Compiler
159159
#pragma location = "FLASH_ROM"
160160
#endif
161161
uint32_t flash_get_size(const flash_t *obj)
162162
{
163163
return FLASH_CHIP_SIZE;
164164
}
165165

166-
#if defined ( __ICCARM__ ) /* IAR Compiler */
166+
#if defined ( __ICCARM__ ) // IAR Compiler
167167
#pragma location = "FLASH_ROM"
168168
#endif
169169
uint8_t flash_get_erase_value(const flash_t *obj)
@@ -172,4 +172,3 @@ uint8_t flash_get_erase_value(const flash_t *obj)
172172

173173
return 0xFF;
174174
}
175-

targets/TARGET_TOSHIBA/TARGET_TMPM46B/gpio_irq_api.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -37,9 +37,9 @@ static gpio_irq_handler hal_irq_handler[CHANNEL_NUM] = {NULL};
3737

3838
static void INT_IRQHandler(PinName pin, GPIO_IRQName irq_id, uint32_t index)
3939
{
40-
uint32_t val;
40+
uint32_t val;
4141
GPIO_Port port;
42-
uint32_t mask;
42+
uint32_t mask;
4343

4444
port = (GPIO_Port)(pin >> 3);
4545
mask = 0x01 << (pin & 0x07);

0 commit comments

Comments
 (0)