Skip to content

Commit 07f52ee

Browse files
committed
Merge remote-tracking branch 'refs/remotes/mbedmicro/master' into dev_xxxx_xxx
2 parents 40a175b + 77e2316 commit 07f52ee

File tree

1,199 files changed

+209529
-32750
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

1,199 files changed

+209529
-32750
lines changed

README.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -68,6 +68,7 @@ STMicroelectronics:
6868
* [Nucleo-F334R8](https://developer.mbed.org/platforms/ST-Nucleo-F334R8/) (Cortex-M4F)
6969
* [Nucleo-F401RE](https://developer.mbed.org/platforms/ST-Nucleo-F401RE/) (Cortex-M4F)
7070
* [Nucleo-F411RE](https://developer.mbed.org/platforms/ST-Nucleo-F411RE/) (Cortex-M4F)
71+
* [Nucleo-L476RG](https://developer.mbed.org/platforms/ST-Nucleo-L476RG/) (Cortex-M4F)
7172
* STM32F4XX (Cortex-M4F)
7273
* STM32F3XX (Cortex-M4F)
7374
* STM32F0-Discovery (Cortex-M0)
@@ -76,6 +77,7 @@ STMicroelectronics:
7677
* STM32F4-Discovery (Cortex-M4F)
7778
* STM32F429-Discovery (Cortex-M4F)
7879
* STM32L0-Discovery (Cortex-M0+)
80+
* [STM32L4-Discovery](https://developer.mbed.org/platforms/ST-Discovery-L476VG/) (Cortex-M4F)
7981
* [Arch Max](https://developer.mbed.org/platforms/Seeed-Arch-Max/) (Cortex-M4F)
8082

8183

docs/BUILDING.md

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -135,11 +135,11 @@ LICENSE MANIFEST.in README.md libraries setup.py travis workspace_tools
135135
```
136136
Directory structure we are interested in:
137137
```
138-
mbed/workspace_tools/ - test suite scripts, build scripts etc.
139-
mbed/library/tests/ - mbed SDK tests,
140-
mbed/library/tests/mbed/ - tests for mbed SDK and peripherals tests,
141-
mbed/library/tests/net/echo/ - tests for Ethernet interface,
142-
mbed/library/tests/rtos/mbed/ - tests for RTOS.
138+
mbed/workspace_tools/ - test suite scripts, build scripts etc.
139+
mbed/libraries/tests/ - mbed SDK tests,
140+
mbed/libraries/tests/mbed/ - tests for mbed SDK and peripherals tests,
141+
mbed/libraries/tests/net/echo/ - tests for Ethernet interface,
142+
mbed/libraries/tests/rtos/mbed/ - tests for RTOS.
143143
```
144144

145145
### Workspace tools
@@ -334,7 +334,7 @@ Build successes:
334334

335335
* If you’re unsure which platforms and toolchains are supported please use switch ```-S``` to print simple matrix of platform to compiler dependencies.
336336
```
337-
$ python python build.py -S
337+
$ python build.py -S
338338
+-------------------------+-----------+-----------+-----------+-----------+-----------+-----------+------------+---------------+
339339
| Platform | ARM | uARM | GCC_ARM | IAR | GCC_CR | GCC_CS | GCC_CW_EWL | GCC_CW_NEWLIB |
340340
+-------------------------+-----------+-----------+-----------+-----------+-----------+-----------+------------+---------------+

docs/COMMITTERS.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
# Committing changes to mbedmicro/mbed
22
* Our current branching model is very simple. We are using ```master``` branch to merge all pull requests.
3-
* Based on stable ```SHA``` version of ```master``` branch we decide to release and att he same time ```tag``` our build release.
3+
* Based on stable ```SHA``` version of ```master``` branch we decide to release and at the same time ```tag``` our build release.
44
* Our current release versioning follows simple integer version: ```94```, ```95```, ```96``` etc.
55

66
# Committer Guide

docs/TESTING.md

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ Each test is supervised by python script called “host test” which will at le
88
## What is host test?
99
Test suite supports test supervisor concept. This concept is realized by separate Python script called ```host test```. Host tests can be found in ```mbed/workspace_tools/host_tests/``` directory. Note: In newer mbed versions (mbed OS) host tests will be separate library.
1010

11-
Host test script is executed in parallel with test runner to monitor test execution. Basic host test just monitors device's default serial port for test results returned by test runner. Simple tests will print test result on serial port. In other cases host tests can for example judge by test results returned by test runner is test passed or failed. It all depends on test itself.
11+
Host test script is executed in parallel with test runner to monitor test execution. Basic host test just monitors device's default serial port for test results returned by test runner. Simple tests will print test result on serial port. In other cases host tests can for example judge by test results returned by test runner if test passed or failed. It all depends on test itself.
1212

1313
In some cases host test can be TCP server echoing packets from test runner and judging packet loss. In other cases it can just check if values returned from accelerometer are actually valid (sane).
1414

@@ -37,7 +37,7 @@ After connecting boards to our host machine (PC) we can check which serial ports
3737
* ```NUCLEO_F103RB``` serial port is on ```COM11``` and disk drive is ```I:```.
3838
If you are working under Linux your port and disk could look like /dev/ttyACM5 and /media/usb5.
3939

40-
This information is needed to create ```muts_all.json``` configuration file. You can create in in ```mbed/workspace_tools/``` directory:
40+
This information is needed to create ```muts_all.json``` configuration file. You can create it in ```mbed/workspace_tools/``` directory:
4141
```
4242
$ touch muts_all.json
4343
```
@@ -289,13 +289,13 @@ $ python singletest.py -R -f RTOS
289289
```
290290

291291
* Shuffle your tests. We strongly encourage you to shuffle your test order each time you execute test suite script.
292-
Rationale: It is probable that tests executed in one particular order will pass and in other will fail. To shuffle your tests’ order please use option ```u``` (or ```--shuffle```):
292+
Rationale: It is probable that tests executed in one particular order will pass and in other will fail. To shuffle your tests’ order please use option ```-u``` (or ```--shuffle```):
293293
```
294294
$ python singletest.py -i test_spec.json -M muts_all.json --shuffle
295295
```
296-
Above command with force test script to randomly generate shuffle seed and shuffle test order execution. Note: Shuffle seed is float in ```[0.0, 1.0)```.
296+
Above command will force test script to randomly generate shuffle seed and shuffle test order execution. Note: Shuffle seed is float in ```[0.0, 1.0)```.
297297

298-
You can always recreate particular test order by forcing shuffle (```-u``` or ```--shuffle```} switch) and passing shuffle seed back to test suite using ```--shuffle-seed``` switch:
298+
You can always recreate particular test order by forcing shuffle (```-u``` or ```--shuffle``` switch) and passing shuffle seed back to test suite using ```--shuffle-seed``` switch:
299299
```
300300
$ python singletest.py -i test_spec.json -M muts_all.json --shuffle --shuffle-seed 0.4041028336
301301
```
@@ -311,7 +311,7 @@ Shuffle Seed: 0.4041028336
311311
Completed in 234.85 sec
312312
```
313313

314-
### Exmple of device configuration (one device connected to host computer)
314+
### Example of device configuration (one device connected to host computer)
315315

316316
This example will show you how to configure single device, run general tests or only peripheral tests. We will also show some real test result examples.
317317

@@ -597,7 +597,7 @@ Note: In dependency section we've added library ```CPPUTEST_LIBRARY``` which is
597597

598598
### Tests are now divided into two types:
599599
#### 'Hello world' tests
600-
First type of test cases we call 'hello world' tests. They do not dependent on CppUTest library and are monolithic programs usually composed of one main function. Yo can find this tests in below example directories:
600+
First type of test cases we call 'hello world' tests. They do not dependent on CppUTest library and are monolithic programs usually composed of one main function. You can find this tests in below example directories:
601601

602602
* ```mbed/libraries/tests/mbed/```
603603
* ```mbed/libraries/tests/net/```
@@ -767,12 +767,12 @@ TEST(BusOut_digitalout_write, led_1_nc_2_nc_nc_3)
767767
```
768768
769769
## Example
770-
In below example we will run two example unit tests that are now available. tests ```UT_1``` and ```UT_2``` are unit tests used for now only to check if mbed SDK works with CppUTest library and if tests are being executed. In future number of unit tests will increase, nothing is also should stop you from writing and executing your own unit tests!
770+
In below example we will run two example unit tests that are now available. tests ```UT_1``` and ```UT_2``` are unit tests used for now only to check if mbed SDK works with CppUTest library and if tests are being executed. In future number of unit tests will increase, nothing is also stopping you from writing and executing your own unit tests!
771771
772772
### Example configuration
773773
By default unit tests ```UT_1``` and ```UT_2``` are not automated - simply test suite will ignore them. Also we do not want to create dependency to CppUTest library each time someone executes automation.
774774
775-
Note: To compile ```UT_1``` and ```UT_2``` tests CppUTest library described above installation is needed and not all users wish to add UT libs to their project. Also new to mbed users may find it difficult. This is why unit testing is an extra feature active only after you deliberately install and enable needed components.
775+
Note: To compile ```UT_1``` and ```UT_2``` tests CppUTest library described above, installation is needed and not all users wish to add UT libs to their project. Also new to mbed users may find it difficult. This is why unit testing is an extra feature active only after you deliberately install and enable needed components.
776776
777777
Bellow snippet shows how to modify 'automated' flag so test suite will consider unit tests ```UT_1``` and ```UT_2``` as part of "automated test portfolio". Just change flag 'automated' from ```False``` to ```True```.
778778

libraries/USBHost/USBHost/TARGET_RENESAS/TARGET_RZ_A1H/ohci_wrapp_RZ_A1.c

Lines changed: 67 additions & 61 deletions
Original file line numberDiff line numberDiff line change
@@ -199,7 +199,6 @@ static int32_t iso_trans_doing(hced_t *p_ed, uint32_t index);
199199
static void chk_iso_td_done(genelal_ed_t *p_g_ed);
200200
static int32_t chk_iso_ed(genelal_ed_t *p_g_ed);
201201
static void iso_trans_setting(genelal_ed_t *p_g_ed, uint32_t index);
202-
static uint32_t iso_chk_starting_frame(genelal_ed_t *p_g_ed);
203202
static void iso_trans(genelal_ed_t *p_g_ed);
204203
#endif
205204
static void connect_check(void);
@@ -215,6 +214,7 @@ static usb_ohci_reg_t *p_usb_reg = &usb_reg;
215214
static usbisr_fnc_t *p_usbisr_cb = NULL;
216215
static osSemaphoreId semid_cb = NULL;
217216
static uint32_t connect_change = 0xFFFFFFFF;
217+
static uint32_t connect_status = 0;
218218
static uint32_t init_end = 0;
219219
static genelal_ed_t ctl_ed;
220220
static genelal_ed_t blk_ed;
@@ -283,13 +283,13 @@ osThreadDef(int_ed_task_4, osPriorityNormal, 512);
283283
static void iso_ed_task_1(void const * argument) {
284284
iso_ed_task(argument);
285285
}
286-
osThreadDef(iso_ed_task_1, osPriorityNormal, 512);
286+
osThreadDef(iso_ed_task_1, osPriorityAboveNormal, 512);
287287
#endif
288288
#if (ISO_TRANS_MAX_NUM >= 2)
289289
static void iso_ed_task_2(void const * argument) {
290290
iso_ed_task(argument);
291291
}
292-
osThreadDef(iso_ed_task_2, osPriorityNormal, 512);
292+
osThreadDef(iso_ed_task_2, osPriorityAboveNormal, 512);
293293
#endif
294294

295295
void ohciwrapp_init(usbisr_fnc_t *p_usbisr_fnc) {
@@ -878,25 +878,28 @@ static void control_trans(genelal_ed_t *p_g_ed) {
878878
p_g_ed->pipe_no = USB_HOST_PIPE0;
879879

880880
p_g_ed->trans_wait = 1;
881-
882-
if (td_info.direction == 0) {
883-
uint16_t Req = (p_td->currBufPtr[1] << 8) + p_td->currBufPtr[0];
884-
uint16_t Val = (p_td->currBufPtr[3] << 8) + p_td->currBufPtr[2];
885-
uint16_t Indx = (p_td->currBufPtr[5] << 8) + p_td->currBufPtr[4];
886-
uint16_t Len = (p_td->currBufPtr[7] << 8) + p_td->currBufPtr[6];
887-
888-
g_usbx_host_data_pointer[USB_HOST_PIPE0] = p_td->bufEnd;
889-
usbx_host_SetupStage(Req, Val, Indx, Len);
890-
} else if (td_info.direction == 1) {
891-
usbx_host_CtrlWriteStart(td_info.count, p_td->currBufPtr);
881+
if (connect_status == 0) {
882+
ohciwrapp_loc_TransEnd(p_g_ed->pipe_no, TD_CC_DEVICENOTRESPONDING);
892883
} else {
893-
usbx_host_CtrlReadStart(td_info.count, p_td->currBufPtr);
894-
}
884+
if (td_info.direction == 0) {
885+
uint16_t Req = (p_td->currBufPtr[1] << 8) + p_td->currBufPtr[0];
886+
uint16_t Val = (p_td->currBufPtr[3] << 8) + p_td->currBufPtr[2];
887+
uint16_t Indx = (p_td->currBufPtr[5] << 8) + p_td->currBufPtr[4];
888+
uint16_t Len = (p_td->currBufPtr[7] << 8) + p_td->currBufPtr[6];
889+
890+
g_usbx_host_data_pointer[USB_HOST_PIPE0] = p_td->bufEnd;
891+
usbx_host_SetupStage(Req, Val, Indx, Len);
892+
} else if (td_info.direction == 1) {
893+
usbx_host_CtrlWriteStart(td_info.count, p_td->currBufPtr);
894+
} else {
895+
usbx_host_CtrlReadStart(td_info.count, p_td->currBufPtr);
896+
}
895897

896-
(void)osSemaphoreWait(p_g_ed->semid_wait, CTL_TRANS_TIMEOUT);
897-
if (p_g_ed->trans_wait == 1) {
898-
p_g_ed->trans_wait = 0;
899-
RZA_IO_RegWrite_32(&p_td->control, TD_CC_DEVICENOTRESPONDING, TD_CTL_SHFT_CC, TD_CTL_MSK_CC);
898+
(void)osSemaphoreWait(p_g_ed->semid_wait, CTL_TRANS_TIMEOUT);
899+
if (p_g_ed->trans_wait == 1) {
900+
p_g_ed->trans_wait = 0;
901+
RZA_IO_RegWrite_32(&p_td->control, TD_CC_DEVICENOTRESPONDING, TD_CTL_SHFT_CC, TD_CTL_MSK_CC);
902+
}
900903
}
901904

902905
g_usbx_host_CmdStage &= (~USB_HOST_CMD_FIELD);
@@ -928,14 +931,18 @@ static void bulk_trans(genelal_ed_t *p_g_ed) {
928931
set_togle(p_g_ed->pipe_no, p_td, p_ed);
929932

930933
p_g_ed->trans_wait = 1;
931-
if (td_info.direction == 1) {
932-
usbx_host_start_send_transfer(p_g_ed->pipe_no, td_info.count, p_td->currBufPtr);
934+
if (connect_status == 0) {
935+
ohciwrapp_loc_TransEnd(p_g_ed->pipe_no, TD_CC_DEVICENOTRESPONDING);
933936
} else {
934-
usbx_host_start_receive_transfer(p_g_ed->pipe_no, td_info.count, p_td->currBufPtr);
935-
}
937+
if (td_info.direction == 1) {
938+
usbx_host_start_send_transfer(p_g_ed->pipe_no, td_info.count, p_td->currBufPtr);
939+
} else {
940+
usbx_host_start_receive_transfer(p_g_ed->pipe_no, td_info.count, p_td->currBufPtr);
941+
}
936942

937-
(void)osSemaphoreWait(p_g_ed->semid_wait, BLK_TRANS_TIMEOUT);
938-
usbx_host_stop_transfer(p_g_ed->pipe_no);
943+
(void)osSemaphoreWait(p_g_ed->semid_wait, BLK_TRANS_TIMEOUT);
944+
usbx_host_stop_transfer(p_g_ed->pipe_no);
945+
}
939946
}
940947

941948
static void int_trans_setting(genelal_ed_t *p_g_ed, uint32_t index) {
@@ -1023,10 +1030,14 @@ static void int_trans(genelal_ed_t *p_g_ed) {
10231030

10241031
get_td_info(p_g_ed, &td_info);
10251032
p_g_ed->trans_wait = 1;
1026-
if (td_info.direction == 1) {
1027-
usbx_host_start_send_transfer(p_g_ed->pipe_no, td_info.count, p_td->currBufPtr);
1033+
if (connect_status == 0) {
1034+
ohciwrapp_loc_TransEnd(p_g_ed->pipe_no, TD_CC_DEVICENOTRESPONDING);
10281035
} else {
1029-
usbx_host_start_receive_transfer(p_g_ed->pipe_no, td_info.count, p_td->currBufPtr);
1036+
if (td_info.direction == 1) {
1037+
usbx_host_start_send_transfer(p_g_ed->pipe_no, td_info.count, p_td->currBufPtr);
1038+
} else {
1039+
usbx_host_start_receive_transfer(p_g_ed->pipe_no, td_info.count, p_td->currBufPtr);
1040+
}
10301041
}
10311042
}
10321043

@@ -1089,7 +1100,6 @@ static void set_togle(uint32_t pipe, hctd_t *p_td, hced_t *p_ed) {
10891100
static void iso_ed_task(void const * argument) {
10901101
genelal_ed_t *p_iso_ed = &iso_ed[(uint32_t)argument];
10911102
uint32_t wait_cnt = 0;
1092-
uint32_t wait_time = 0;
10931103
hcca_t *p_hcca;
10941104
hced_t *p_ed;
10951105

@@ -1115,17 +1125,26 @@ static void iso_ed_task(void const * argument) {
11151125
if (p_iso_ed->p_curr_ed != NULL) {
11161126
while ((p_usb_reg->HcControl & OR_CONTROL_IE) != 0) {
11171127
if (chk_iso_ed(p_iso_ed) != 0) {
1118-
wait_time = iso_chk_starting_frame(p_iso_ed);
1119-
if (wait_time != 0) {
1120-
osDelay(wait_time);
1121-
p_usb_reg->HcFmNumber += wait_time;
1122-
p_usb_reg->HcFmNumber &= 0x0000FFFF;
1128+
hcisotd_t *p_isotd = (hcisotd_t *)p_iso_ed->p_curr_td;
1129+
uint32_t starting_frame = p_isotd->control & 0x0000FFFF;
1130+
uint32_t wait_time = 0;
1131+
uint32_t wk_HcFmNumber = p_usb_reg->HcFmNumber;
1132+
1133+
if (starting_frame > wk_HcFmNumber) {
1134+
wait_time = starting_frame - wk_HcFmNumber;
1135+
} else {
1136+
wait_time = (0xFFFF - wk_HcFmNumber) + starting_frame;
1137+
}
1138+
if ((wait_time >= 2) && (wait_time <= 1000)) {
1139+
for (int cnt = 0; cnt < (wait_time - 1); cnt++) {
1140+
osDelay(1);
1141+
p_usb_reg->HcFmNumber = (wk_HcFmNumber + cnt) & 0x0000FFFF;
1142+
}
11231143
}
11241144
p_iso_ed->psw_idx = 0;
11251145
iso_trans(p_iso_ed);
11261146
(void)osSemaphoreWait(p_iso_ed->semid_wait, osWaitForever);
1127-
usbx_host_stop_transfer(p_iso_ed->pipe_no);
1128-
wait_cnt = 1;
1147+
wait_cnt = 8;
11291148
} else {
11301149
if (wait_cnt > 0) {
11311150
wait_cnt--;
@@ -1234,18 +1253,6 @@ static void iso_trans_setting(genelal_ed_t *p_g_ed, uint32_t index) {
12341253
usbx_api_host_SetEndpointTable(td_info.devadr, user_table, wk_table);
12351254
}
12361255

1237-
static uint32_t iso_chk_starting_frame(genelal_ed_t *p_g_ed) {
1238-
hcisotd_t *p_isotd = (hcisotd_t *)p_g_ed->p_curr_td;
1239-
uint32_t starting_frame = p_isotd->control & 0x0000FFFF;
1240-
uint32_t wait_time = 0;
1241-
1242-
if ((p_g_ed->psw_idx == 0) && (starting_frame > p_usb_reg->HcFmNumber)) {
1243-
wait_time = starting_frame - p_usb_reg->HcFmNumber;
1244-
}
1245-
1246-
return wait_time;
1247-
}
1248-
12491256
static void iso_trans(genelal_ed_t *p_g_ed) {
12501257
hcisotd_t *p_isotd = (hcisotd_t *)p_g_ed->p_curr_td;
12511258
tdinfo_t td_info;
@@ -1268,10 +1275,14 @@ static void iso_trans(genelal_ed_t *p_g_ed) {
12681275

12691276
get_td_info(p_g_ed, &td_info);
12701277
p_g_ed->trans_wait = 1;
1271-
if (td_info.direction == 1) {
1272-
usbx_host_start_send_transfer(p_g_ed->pipe_no, data_size, (uint8_t *)buff_addr);
1278+
if (connect_status == 0) {
1279+
ohciwrapp_loc_TransEnd(p_g_ed->pipe_no, TD_CC_DEVICENOTRESPONDING);
12731280
} else {
1274-
usbx_host_start_receive_transfer(p_g_ed->pipe_no, data_size, (uint8_t *)buff_addr);
1281+
if (td_info.direction == 1) {
1282+
usbx_host_start_send_transfer(p_g_ed->pipe_no, data_size, (uint8_t *)buff_addr);
1283+
} else {
1284+
usbx_host_start_receive_transfer(p_g_ed->pipe_no, data_size, (uint8_t *)buff_addr);
1285+
}
12751286
}
12761287
}
12771288
#endif
@@ -1326,6 +1337,7 @@ static void connect_check(void) {
13261337
void ohciwrapp_loc_Connect(uint32_t type) {
13271338
uint32_t cnt;
13281339

1340+
connect_status = type;
13291341
connect_change = type;
13301342
if (type == 0) {
13311343
if (ctl_ed.trans_wait == 1) {
@@ -1445,11 +1457,7 @@ void ohciwrapp_loc_TransEnd(uint32_t pipe, uint32_t ConditionCode) {
14451457

14461458
if (p_isotd != NULL) {
14471459
usbx_host_stop_transfer(pipe);
1448-
if (p_usb_reg->HcFmNumber < 0x0000FFFF) {
1449-
p_usb_reg->HcFmNumber++;
1450-
} else {
1451-
p_usb_reg->HcFmNumber = 0;
1452-
}
1460+
p_usb_reg->HcFmNumber = ((p_isotd->control & 0x0000FFFF) + p_wait_ed->psw_idx) & 0x0000FFFF;
14531461

14541462
/* Size of packet */
14551463
p_isotd->offsetPSW[p_wait_ed->psw_idx] -= g_usbx_host_data_count[pipe];
@@ -1469,10 +1477,8 @@ void ohciwrapp_loc_TransEnd(uint32_t pipe, uint32_t ConditionCode) {
14691477
p_wait_ed->psw_idx++;
14701478
}
14711479
if (chk_iso_ed(p_wait_ed) != 0) {
1472-
if (iso_chk_starting_frame(p_wait_ed) == 0) {
1473-
iso_trans(p_wait_ed);
1474-
next_trans = 1;
1475-
}
1480+
iso_trans(p_wait_ed);
1481+
next_trans = 1;
14761482
}
14771483
if (next_trans == 0) {
14781484
p_wait_ed->trans_wait = 0;

0 commit comments

Comments
 (0)