aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorYuji Mano <yuji.mano@am.sony.com>2009-01-06 03:30:02 -0800
committerYuji Mano <yuji.mano@am.sony.com>2009-01-06 03:30:02 -0800
commit6f62783e066f0872bbdf7d930b8de5f340d29fb1 (patch)
tree8cdae072de094855e0f88ed17028399cb9bbabc0
parentf7ba771b8305aab21a76f78d3309ca7718922824 (diff)
downloadmars-src-6f62783e066f0872bbdf7d930b8de5f340d29fb1.tar.gz
tests: Initial commit
Merge test suite branch-1.1.0 Signed-off-by: Yuji Mano <yuji.mano@am.sony.com>
-rw-r--r--tests/.gitignore11
-rw-r--r--tests/Makefile50
-rw-r--r--tests/README77
-rw-r--r--tests/TFI/Makefile28
-rw-r--r--tests/TFI/README14
-rw-r--r--tests/TFP/Makefile300
-rw-r--r--tests/TFP/TFP_01_001/Makefile28
-rw-r--r--tests/TFP/TFP_01_001/host.c41
-rw-r--r--tests/TFP/TFP_01_002/Makefile28
-rw-r--r--tests/TFP/TFP_01_002/host.c44
-rw-r--r--tests/TFP/TFP_01_003/Makefile28
-rw-r--r--tests/TFP/TFP_01_003/host.c65
-rw-r--r--tests/TFP/TFP_01_004/Makefile28
-rw-r--r--tests/TFP/TFP_01_004/host.c74
-rw-r--r--tests/TFP/TFP_01_005/Makefile28
-rw-r--r--tests/TFP/TFP_01_005/host.c39
-rw-r--r--tests/TFP/TFP_02_001/Makefile28
-rw-r--r--tests/TFP/TFP_02_001/host.c43
-rw-r--r--tests/TFP/TFP_02_002/Makefile28
-rw-r--r--tests/TFP/TFP_02_002/host.c64
-rw-r--r--tests/TFP/TFP_11_001/Makefile28
-rw-r--r--tests/TFP/TFP_11_001/host.c50
-rw-r--r--tests/TFP/TFP_11_001/mpu.c29
-rw-r--r--tests/TFP/TFP_11_002/Makefile28
-rw-r--r--tests/TFP/TFP_11_002/host.c55
-rw-r--r--tests/TFP/TFP_11_002/mpu.c29
-rw-r--r--tests/TFP/TFP_11_003/Makefile28
-rw-r--r--tests/TFP/TFP_11_003/host.c67
-rw-r--r--tests/TFP/TFP_11_003/mpu.c29
-rw-r--r--tests/TFP/TFP_11_004/Makefile28
-rw-r--r--tests/TFP/TFP_11_004/host.c65
-rw-r--r--tests/TFP/TFP_11_004/mpu.c29
-rw-r--r--tests/TFP/TFP_11_005/Makefile28
-rw-r--r--tests/TFP/TFP_11_005/host.c61
-rw-r--r--tests/TFP/TFP_11_005/mpu.c29
-rw-r--r--tests/TFP/TFP_11_006/Makefile28
-rw-r--r--tests/TFP/TFP_11_006/host.c77
-rw-r--r--tests/TFP/TFP_11_006/mpu.c29
-rw-r--r--tests/TFP/TFP_11_007/Makefile28
-rw-r--r--tests/TFP/TFP_11_007/host.c89
-rw-r--r--tests/TFP/TFP_11_007/mpu.c29
-rw-r--r--tests/TFP/TFP_11_008/Makefile28
-rw-r--r--tests/TFP/TFP_11_008/host.c63
-rw-r--r--tests/TFP/TFP_11_008/mpu.c35
-rw-r--r--tests/TFP/TFP_11_009/Makefile28
-rw-r--r--tests/TFP/TFP_11_009/host.c64
-rw-r--r--tests/TFP/TFP_11_009/mpu.c35
-rw-r--r--tests/TFP/TFP_11_010/Makefile28
-rw-r--r--tests/TFP/TFP_11_010/host.c63
-rw-r--r--tests/TFP/TFP_11_010/mpu.c35
-rw-r--r--tests/TFP/TFP_11_011/Makefile28
-rw-r--r--tests/TFP/TFP_11_011/host.c68
-rw-r--r--tests/TFP/TFP_11_011/mpu.c43
-rw-r--r--tests/TFP/TFP_12_001/Makefile28
-rw-r--r--tests/TFP/TFP_12_001/host.c50
-rw-r--r--tests/TFP/TFP_12_001/mpu.c29
-rw-r--r--tests/TFP/TFP_12_002/Makefile28
-rw-r--r--tests/TFP/TFP_12_002/host.c56
-rw-r--r--tests/TFP/TFP_12_002/mpu.c29
-rw-r--r--tests/TFP/TFP_12_003/Makefile28
-rw-r--r--tests/TFP/TFP_12_003/host.c77
-rw-r--r--tests/TFP/TFP_12_003/mpu.c29
-rw-r--r--tests/TFP/TFP_13_001/Makefile28
-rw-r--r--tests/TFP/TFP_13_001/host.c57
-rw-r--r--tests/TFP/TFP_13_001/mpu.c31
-rw-r--r--tests/TFP/TFP_13_002/Makefile28
-rw-r--r--tests/TFP/TFP_13_002/host.c68
-rw-r--r--tests/TFP/TFP_13_002/mpu.c37
-rw-r--r--tests/TFP/TFP_13_003/Makefile28
-rw-r--r--tests/TFP/TFP_13_003/host.c66
-rw-r--r--tests/TFP/TFP_13_003/mpu.c31
-rw-r--r--tests/TFP/TFP_13_004/Makefile28
-rw-r--r--tests/TFP/TFP_13_004/host.c104
-rw-r--r--tests/TFP/TFP_13_004/mpu1.c48
-rw-r--r--tests/TFP/TFP_13_004/mpu2.c40
-rw-r--r--tests/TFP/TFP_13_004/mpu3.c40
-rw-r--r--tests/TFP/TFP_13_005/Makefile28
-rw-r--r--tests/TFP/TFP_13_005/host.c75
-rw-r--r--tests/TFP/TFP_13_005/mpu.c31
-rw-r--r--tests/TFP/TFP_13_006/Makefile28
-rw-r--r--tests/TFP/TFP_13_006/host.c76
-rw-r--r--tests/TFP/TFP_13_006/mpu.c31
-rw-r--r--tests/TFP/TFP_13_007/Makefile28
-rw-r--r--tests/TFP/TFP_13_007/host.c71
-rw-r--r--tests/TFP/TFP_13_007/mpu.c31
-rw-r--r--tests/TFP/TFP_13_008/Makefile28
-rw-r--r--tests/TFP/TFP_13_008/host.c85
-rw-r--r--tests/TFP/TFP_13_008/mpu.c31
-rw-r--r--tests/TFP/TFP_14_001/Makefile28
-rw-r--r--tests/TFP/TFP_14_001/common.h24
-rw-r--r--tests/TFP/TFP_14_001/host.c75
-rw-r--r--tests/TFP/TFP_14_001/mpu.c41
-rw-r--r--tests/TFP/TFP_14_002/Makefile28
-rw-r--r--tests/TFP/TFP_14_002/host.c96
-rw-r--r--tests/TFP/TFP_14_002/mpu.c36
-rw-r--r--tests/TFP/TFP_15_001/Makefile28
-rw-r--r--tests/TFP/TFP_15_001/host.c76
-rw-r--r--tests/TFP/TFP_15_001/mpu.c37
-rw-r--r--tests/TFP/TFP_15_002/Makefile28
-rw-r--r--tests/TFP/TFP_15_002/host.c73
-rw-r--r--tests/TFP/TFP_15_002/mpu.c36
-rw-r--r--tests/TFP/TFP_17_001/Makefile28
-rw-r--r--tests/TFP/TFP_17_001/common.h26
-rw-r--r--tests/TFP/TFP_17_001/host.c74
-rw-r--r--tests/TFP/TFP_17_001/mpu.c43
-rw-r--r--tests/TFP/TFP_18_001/Makefile28
-rw-r--r--tests/TFP/TFP_18_001/cmd.h28
-rw-r--r--tests/TFP/TFP_18_001/host.c138
-rw-r--r--tests/TFP/TFP_18_001/mpu.c62
-rw-r--r--tests/TFP/TFP_18_002/Makefile28
-rw-r--r--tests/TFP/TFP_18_002/host.c121
-rw-r--r--tests/TFP/TFP_18_002/mpu1.c36
-rw-r--r--tests/TFP/TFP_18_002/mpu2.c43
-rw-r--r--tests/TFP/TFP_19_001/Makefile28
-rw-r--r--tests/TFP/TFP_19_001/host.c79
-rw-r--r--tests/TFP/TFP_19_001/mpu.c34
-rw-r--r--tests/TFP/TFP_1A_001/Makefile28
-rw-r--r--tests/TFP/TFP_1A_001/host.c61
-rw-r--r--tests/TFP/TFP_1A_001/mpu.c58
-rw-r--r--tests/TFP/TFP_21_001/Makefile28
-rw-r--r--tests/TFP/TFP_21_001/host.c48
-rw-r--r--tests/TFP/TFP_21_002/Makefile28
-rw-r--r--tests/TFP/TFP_21_002/host.c51
-rw-r--r--tests/TFP/TFP_21_003/Makefile28
-rw-r--r--tests/TFP/TFP_21_003/host.c72
-rw-r--r--tests/TFP/TFP_23_001/Makefile28
-rw-r--r--tests/TFP/TFP_23_001/host.c78
-rw-r--r--tests/TFP/TFP_23_001/mpu.c36
-rw-r--r--tests/TFP/TFP_23_002/Makefile28
-rw-r--r--tests/TFP/TFP_23_002/host.c88
-rw-r--r--tests/TFP/TFP_23_002/mpu.c49
-rw-r--r--tests/TFP/TFP_24_001/Makefile28
-rw-r--r--tests/TFP/TFP_24_001/host.c106
-rw-r--r--tests/TFP/TFP_24_001/mpu1.c36
-rw-r--r--tests/TFP/TFP_24_001/mpu2.c36
-rw-r--r--tests/TFP/TFP_24_002/Makefile28
-rw-r--r--tests/TFP/TFP_24_002/host.c123
-rw-r--r--tests/TFP/TFP_24_002/mpu1.c47
-rw-r--r--tests/TFP/TFP_24_002/mpu2.c36
-rw-r--r--tests/TFP/TFP_24_003/Makefile28
-rw-r--r--tests/TFP/TFP_24_003/host.c132
-rw-r--r--tests/TFP/TFP_24_003/mpu1.c57
-rw-r--r--tests/TFP/TFP_24_003/mpu2.c39
-rw-r--r--tests/TFP/TFP_25_001/Makefile28
-rw-r--r--tests/TFP/TFP_25_001/host.c83
-rw-r--r--tests/TFP/TFP_25_001/mpu.c40
-rw-r--r--tests/TFP/TFP_25_002/Makefile28
-rw-r--r--tests/TFP/TFP_25_002/host.c109
-rw-r--r--tests/TFP/TFP_25_002/mpu.c40
-rw-r--r--tests/TFP/TFP_26_001/Makefile28
-rw-r--r--tests/TFP/TFP_26_001/host.c105
-rw-r--r--tests/TFP/TFP_26_001/mpu1.c36
-rw-r--r--tests/TFP/TFP_26_001/mpu2.c36
-rw-r--r--tests/TFP/TFP_26_002/Makefile28
-rw-r--r--tests/TFP/TFP_26_002/host.c113
-rw-r--r--tests/TFP/TFP_26_002/mpu1.c55
-rw-r--r--tests/TFP/TFP_26_002/mpu2.c36
-rw-r--r--tests/TFP/TFP_31_001/Makefile28
-rw-r--r--tests/TFP/TFP_31_001/host.c104
-rw-r--r--tests/TFP/TFP_31_001/mpu.c55
-rw-r--r--tests/TFP/TFP_31_002/Makefile28
-rw-r--r--tests/TFP/TFP_31_002/host.c107
-rw-r--r--tests/TFP/TFP_31_003/Makefile28
-rw-r--r--tests/TFP/TFP_31_003/host.c104
-rw-r--r--tests/TFP/TFP_31_003/mpu.c55
-rw-r--r--tests/TFP/TFP_31_004/Makefile28
-rw-r--r--tests/TFP/TFP_31_004/host.c73
-rw-r--r--tests/TFP/TFP_33_001/Makefile28
-rw-r--r--tests/TFP/TFP_33_001/host.c92
-rw-r--r--tests/TFP/TFP_33_001/mpu.c41
-rw-r--r--tests/TFP/TFP_33_002/Makefile28
-rw-r--r--tests/TFP/TFP_33_002/host.c108
-rw-r--r--tests/TFP/TFP_33_002/mpu.c44
-rw-r--r--tests/TFP/TFP_33_003/Makefile28
-rw-r--r--tests/TFP/TFP_33_003/host.c124
-rw-r--r--tests/TFP/TFP_33_003/mpu1.c41
-rw-r--r--tests/TFP/TFP_33_003/mpu2.c44
-rw-r--r--tests/TFP/TFP_33_004/Makefile28
-rw-r--r--tests/TFP/TFP_33_004/host.c196
-rw-r--r--tests/TFP/TFP_33_004/mpu.c51
-rw-r--r--tests/TFP/TFP_33_005/Makefile28
-rw-r--r--tests/TFP/TFP_33_005/host.c227
-rw-r--r--tests/TFP/TFP_33_005/mpu.c48
-rw-r--r--tests/TFP/TFP_34_001/Makefile28
-rw-r--r--tests/TFP/TFP_34_001/host.c126
-rw-r--r--tests/TFP/TFP_34_001/mpu.c62
-rw-r--r--tests/TFP/TFP_34_002/Makefile28
-rw-r--r--tests/TFP/TFP_34_002/host.c182
-rw-r--r--tests/TFP/TFP_34_002/mpu.c40
-rw-r--r--tests/TFP/TFP_34_003/Makefile28
-rw-r--r--tests/TFP/TFP_34_003/host.c179
-rw-r--r--tests/TFP/TFP_34_003/mpu1.c62
-rw-r--r--tests/TFP/TFP_34_003/mpu2.c40
-rw-r--r--tests/TFP/TFP_34_004/Makefile28
-rw-r--r--tests/TFP/TFP_34_004/host.c133
-rw-r--r--tests/TFP/TFP_34_004/mpu.c43
-rw-r--r--tests/TFP/TFP_34_005/Makefile28
-rw-r--r--tests/TFP/TFP_34_005/host.c124
-rw-r--r--tests/TFP/TFP_34_005/mpu.c41
-rw-r--r--tests/TFP/TFP_34_006/Makefile28
-rw-r--r--tests/TFP/TFP_34_006/host.c224
-rw-r--r--tests/TFP/TFP_34_006/mpu.c51
-rw-r--r--tests/TFP/TFP_34_007/Makefile28
-rw-r--r--tests/TFP/TFP_34_007/host.c247
-rw-r--r--tests/TFP/TFP_34_007/mpu1.c41
-rw-r--r--tests/TFP/TFP_34_007/mpu2.c41
-rw-r--r--tests/TFP/TFP_34_007/mpu3.c38
-rw-r--r--tests/TFP/TFP_35_001/Makefile28
-rw-r--r--tests/TFP/TFP_35_001/host.c103
-rw-r--r--tests/TFP/TFP_35_001/mpu.c51
-rw-r--r--tests/TFP/TFP_35_002/Makefile28
-rw-r--r--tests/TFP/TFP_35_002/host.c125
-rw-r--r--tests/TFP/TFP_35_002/mpu.c37
-rw-r--r--tests/TFP/TFP_35_003/Makefile28
-rw-r--r--tests/TFP/TFP_35_003/host.c115
-rw-r--r--tests/TFP/TFP_35_003/mpu1.c51
-rw-r--r--tests/TFP/TFP_35_003/mpu2.c37
-rw-r--r--tests/TFP/TFP_35_004/Makefile28
-rw-r--r--tests/TFP/TFP_35_004/host.c112
-rw-r--r--tests/TFP/TFP_35_004/mpu.c40
-rw-r--r--tests/TFP/TFP_35_005/Makefile28
-rw-r--r--tests/TFP/TFP_35_005/host.c140
-rw-r--r--tests/TFP/TFP_35_005/mpu.c37
-rw-r--r--tests/TFP/TFP_35_006/Makefile28
-rw-r--r--tests/TFP/TFP_35_006/host.c135
-rw-r--r--tests/TFP/TFP_35_006/mpu1.c40
-rw-r--r--tests/TFP/TFP_35_006/mpu2.c37
-rw-r--r--tests/TFP/TFP_35_007/Makefile28
-rw-r--r--tests/TFP/TFP_35_007/host.c143
-rw-r--r--tests/TFP/TFP_35_007/mpu1.c46
-rw-r--r--tests/TFP/TFP_35_007/mpu2.c46
-rw-r--r--tests/TFP/TFP_35_008/Makefile28
-rw-r--r--tests/TFP/TFP_35_008/host.c197
-rw-r--r--tests/TFP/TFP_35_008/mpu.c43
-rw-r--r--tests/TFP/TFP_35_009/Makefile28
-rw-r--r--tests/TFP/TFP_35_009/host.c181
-rw-r--r--tests/TFP/TFP_35_009/mpu1.c46
-rw-r--r--tests/TFP/TFP_35_009/mpu2.c46
-rw-r--r--tests/TFP/TFP_35_009/mpu3.c43
-rw-r--r--tests/TFP/TFP_35_010/Makefile28
-rw-r--r--tests/TFP/TFP_35_010/host.c122
-rw-r--r--tests/TFP/TFP_35_010/mpu1.c56
-rw-r--r--tests/TFP/TFP_35_010/mpu2.c56
-rw-r--r--tests/TFP/TFP_35_011/Makefile28
-rw-r--r--tests/TFP/TFP_35_011/host.c197
-rw-r--r--tests/TFP/TFP_35_011/mpu.c37
-rw-r--r--tests/TFP/TFP_35_012/Makefile28
-rw-r--r--tests/TFP/TFP_35_012/host.c149
-rw-r--r--tests/TFP/TFP_35_012/mpu1.c56
-rw-r--r--tests/TFP/TFP_35_012/mpu2.c56
-rw-r--r--tests/TFP/TFP_35_012/mpu3.c37
-rw-r--r--tests/TFP/TFP_35_013/Makefile28
-rw-r--r--tests/TFP/TFP_35_013/host.c123
-rw-r--r--tests/TFP/TFP_35_013/mpu1.c56
-rw-r--r--tests/TFP/TFP_35_013/mpu2.c57
-rw-r--r--tests/TFP/TFP_35_014/Makefile28
-rw-r--r--tests/TFP/TFP_35_014/host.c199
-rw-r--r--tests/TFP/TFP_35_014/mpu.c37
-rw-r--r--tests/TFP/TFP_35_015/Makefile28
-rw-r--r--tests/TFP/TFP_35_015/host.c149
-rw-r--r--tests/TFP/TFP_35_015/mpu1.c56
-rw-r--r--tests/TFP/TFP_35_015/mpu2.c57
-rw-r--r--tests/TFP/TFP_35_015/mpu3.c37
-rw-r--r--tests/TFP/TFP_35_016/Makefile28
-rw-r--r--tests/TFP/TFP_35_016/host.c108
-rw-r--r--tests/TFP/TFP_35_016/mpu.c52
-rw-r--r--tests/TFP/TFP_35_017/Makefile28
-rw-r--r--tests/TFP/TFP_35_017/host.c134
-rw-r--r--tests/TFP/TFP_35_017/mpu.c37
-rw-r--r--tests/TFP/TFP_35_018/Makefile28
-rw-r--r--tests/TFP/TFP_35_018/host.c124
-rw-r--r--tests/TFP/TFP_35_018/mpu1.c52
-rw-r--r--tests/TFP/TFP_35_018/mpu2.c37
-rw-r--r--tests/TFP/TFP_36_001/Makefile28
-rw-r--r--tests/TFP/TFP_36_001/host.c103
-rw-r--r--tests/TFP/TFP_36_001/mpu.c58
-rw-r--r--tests/TFP/TFP_36_002/Makefile28
-rw-r--r--tests/TFP/TFP_36_002/host.c132
-rw-r--r--tests/TFP/TFP_36_002/mpu.c37
-rw-r--r--tests/TFP/TFP_36_003/Makefile28
-rw-r--r--tests/TFP/TFP_36_003/host.c116
-rw-r--r--tests/TFP/TFP_36_003/mpu1.c58
-rw-r--r--tests/TFP/TFP_36_003/mpu2.c37
-rw-r--r--tests/TFP/TFP_36_004/Makefile28
-rw-r--r--tests/TFP/TFP_36_004/host.c105
-rw-r--r--tests/TFP/TFP_36_004/mpu.c58
-rw-r--r--tests/TFP/TFP_36_005/Makefile28
-rw-r--r--tests/TFP/TFP_36_005/host.c149
-rw-r--r--tests/TFP/TFP_36_005/mpu.c37
-rw-r--r--tests/TFP/TFP_36_006/Makefile28
-rw-r--r--tests/TFP/TFP_36_006/host.c133
-rw-r--r--tests/TFP/TFP_36_006/mpu1.c58
-rw-r--r--tests/TFP/TFP_36_006/mpu2.c37
-rw-r--r--tests/TFP/TFP_36_007/Makefile28
-rw-r--r--tests/TFP/TFP_36_007/host.c122
-rw-r--r--tests/TFP/TFP_36_007/mpu1.c63
-rw-r--r--tests/TFP/TFP_36_007/mpu2.c63
-rw-r--r--tests/TFP/TFP_36_008/Makefile28
-rw-r--r--tests/TFP/TFP_36_008/host.c211
-rw-r--r--tests/TFP/TFP_36_008/mpu.c37
-rw-r--r--tests/TFP/TFP_36_009/Makefile28
-rw-r--r--tests/TFP/TFP_36_009/host.c151
-rw-r--r--tests/TFP/TFP_36_009/mpu1.c63
-rw-r--r--tests/TFP/TFP_36_009/mpu2.c63
-rw-r--r--tests/TFP/TFP_36_009/mpu3.c37
-rw-r--r--tests/TFP/TFP_36_010/Makefile28
-rw-r--r--tests/TFP/TFP_36_010/host.c123
-rw-r--r--tests/TFP/TFP_36_010/mpu1.c63
-rw-r--r--tests/TFP/TFP_36_010/mpu2.c64
-rw-r--r--tests/TFP/TFP_36_011/Makefile28
-rw-r--r--tests/TFP/TFP_36_011/host.c213
-rw-r--r--tests/TFP/TFP_36_011/mpu.c37
-rw-r--r--tests/TFP/TFP_36_012/Makefile28
-rw-r--r--tests/TFP/TFP_36_012/host.c150
-rw-r--r--tests/TFP/TFP_36_012/mpu1.c63
-rw-r--r--tests/TFP/TFP_36_012/mpu2.c64
-rw-r--r--tests/TFP/TFP_36_012/mpu3.c37
-rw-r--r--tests/TFP/TFP_41_001/Makefile28
-rw-r--r--tests/TFP/TFP_41_001/host.c116
-rw-r--r--tests/TFP/TFP_41_003/Makefile28
-rw-r--r--tests/TFP/TFP_41_003/host.c75
-rw-r--r--tests/TFP/TFP_43_001/Makefile28
-rw-r--r--tests/TFP/TFP_43_001/host.c102
-rw-r--r--tests/TFP/TFP_43_001/mpu.c50
-rw-r--r--tests/TFP/TFP_43_002/Makefile28
-rw-r--r--tests/TFP/TFP_43_002/host.c107
-rw-r--r--tests/TFP/TFP_43_002/mpu.c44
-rw-r--r--tests/TFP/TFP_43_003/Makefile28
-rw-r--r--tests/TFP/TFP_43_003/host.c97
-rw-r--r--tests/TFP/TFP_43_003/mpu1.c46
-rw-r--r--tests/TFP/TFP_43_003/mpu2.c50
-rw-r--r--tests/TFP/TFP_43_004/Makefile28
-rw-r--r--tests/TFP/TFP_43_004/host.c92
-rw-r--r--tests/TFP/TFP_43_004/mpu.c41
-rw-r--r--tests/TFP/TFP_43_005/Makefile28
-rw-r--r--tests/TFP/TFP_43_005/host.c89
-rw-r--r--tests/TFP/TFP_43_005/mpu.c50
-rw-r--r--tests/TFP/TFP_43_006/Makefile28
-rw-r--r--tests/TFP/TFP_43_006/host.c98
-rw-r--r--tests/TFP/TFP_43_006/mpu1.c46
-rw-r--r--tests/TFP/TFP_43_006/mpu2.c50
-rw-r--r--tests/TFP/TFP_43_007/Makefile28
-rw-r--r--tests/TFP/TFP_43_007/host.c98
-rw-r--r--tests/TFP/TFP_43_007/mpu1.c49
-rw-r--r--tests/TFP/TFP_43_007/mpu2.c50
-rw-r--r--tests/TFP/TFP_43_008/Makefile28
-rw-r--r--tests/TFP/TFP_43_008/host.c98
-rw-r--r--tests/TFP/TFP_43_008/mpu1.c49
-rw-r--r--tests/TFP/TFP_43_008/mpu2.c50
-rw-r--r--tests/TFP/TFP_43_009/Makefile28
-rw-r--r--tests/TFP/TFP_43_009/host.c144
-rw-r--r--tests/TFP/TFP_43_009/mpu1.c50
-rw-r--r--tests/TFP/TFP_43_009/mpu2.c44
-rw-r--r--tests/TFP/TFP_43_010/Makefile28
-rw-r--r--tests/TFP/TFP_43_010/host.c139
-rw-r--r--tests/TFP/TFP_43_010/mpu1.c49
-rw-r--r--tests/TFP/TFP_43_010/mpu2.c52
-rw-r--r--tests/TFP/TFP_43_011/Makefile28
-rw-r--r--tests/TFP/TFP_43_011/host.c97
-rw-r--r--tests/TFP/TFP_43_011/host_and_mpu.h24
-rw-r--r--tests/TFP/TFP_43_011/mpu1.c54
-rw-r--r--tests/TFP/TFP_43_011/mpu2.c47
-rw-r--r--tests/TFP/TFP_43_012/Makefile28
-rw-r--r--tests/TFP/TFP_43_012/host.c95
-rw-r--r--tests/TFP/TFP_43_012/host_and_mpu.h24
-rw-r--r--tests/TFP/TFP_43_012/mpu.c44
-rw-r--r--tests/TFP/TFP_43_013/Makefile28
-rw-r--r--tests/TFP/TFP_43_013/host.c83
-rw-r--r--tests/TFP/TFP_43_013/host_and_mpu.h24
-rw-r--r--tests/TFP/TFP_43_013/mpu.c53
-rw-r--r--tests/TFP/TFP_43_014/Makefile28
-rw-r--r--tests/TFP/TFP_43_014/host.c97
-rw-r--r--tests/TFP/TFP_43_014/host_and_mpu.h24
-rw-r--r--tests/TFP/TFP_43_014/mpu1.c54
-rw-r--r--tests/TFP/TFP_43_014/mpu2.c47
-rw-r--r--tests/TFP/TFP_43_015/Makefile28
-rw-r--r--tests/TFP/TFP_43_015/host.c83
-rw-r--r--tests/TFP/TFP_43_015/host_and_mpu.h24
-rw-r--r--tests/TFP/TFP_43_015/mpu.c56
-rw-r--r--tests/TFP/TFP_43_016/Makefile28
-rw-r--r--tests/TFP/TFP_43_016/host.c97
-rw-r--r--tests/TFP/TFP_43_016/host_and_mpu.h24
-rw-r--r--tests/TFP/TFP_43_016/mpu1.c57
-rw-r--r--tests/TFP/TFP_43_016/mpu2.c47
-rw-r--r--tests/TFP/TFP_43_017/Makefile28
-rw-r--r--tests/TFP/TFP_43_017/host.c83
-rw-r--r--tests/TFP/TFP_43_017/host_and_mpu.h24
-rw-r--r--tests/TFP/TFP_43_017/mpu.c56
-rw-r--r--tests/TFP/TFP_43_018/Makefile28
-rw-r--r--tests/TFP/TFP_43_018/host.c97
-rw-r--r--tests/TFP/TFP_43_018/host_and_mpu.h24
-rw-r--r--tests/TFP/TFP_43_018/mpu1.c57
-rw-r--r--tests/TFP/TFP_43_018/mpu2.c47
-rw-r--r--tests/TFP/TFP_45_001/Makefile28
-rw-r--r--tests/TFP/TFP_45_001/host.c95
-rw-r--r--tests/TFP/TFP_45_001/host_and_mpu.h24
-rw-r--r--tests/TFP/TFP_45_001/mpu.c53
-rw-r--r--tests/TFP/TFP_45_002/Makefile28
-rw-r--r--tests/TFP/TFP_45_002/host.c93
-rw-r--r--tests/TFP/TFP_45_002/host_and_mpu.h24
-rw-r--r--tests/TFP/TFP_45_002/mpu.c52
-rw-r--r--tests/TFP/TFP_45_003/Makefile28
-rw-r--r--tests/TFP/TFP_45_003/host.c104
-rw-r--r--tests/TFP/TFP_45_003/host_and_mpu.h24
-rw-r--r--tests/TFP/TFP_45_003/mpu1.c53
-rw-r--r--tests/TFP/TFP_45_003/mpu2.c53
-rw-r--r--tests/TFP/TFP_45_004/Makefile28
-rw-r--r--tests/TFP/TFP_45_004/host.c139
-rw-r--r--tests/TFP/TFP_45_004/mpu.c61
-rw-r--r--tests/TFP/TFP_45_005/Makefile28
-rw-r--r--tests/TFP/TFP_45_005/host.c140
-rw-r--r--tests/TFP/TFP_45_005/mpu.c51
-rw-r--r--tests/TFP/TFP_45_006/Makefile28
-rw-r--r--tests/TFP/TFP_45_006/host.c132
-rw-r--r--tests/TFP/TFP_45_006/mpu1.c51
-rw-r--r--tests/TFP/TFP_45_006/mpu2.c61
-rw-r--r--tests/TFP/TFP_45_007/Makefile28
-rw-r--r--tests/TFP/TFP_45_007/host.c141
-rw-r--r--tests/TFP/TFP_45_007/mpu.c47
-rw-r--r--tests/TFP/TFP_45_008/Makefile28
-rw-r--r--tests/TFP/TFP_45_008/host.c140
-rw-r--r--tests/TFP/TFP_45_008/mpu.c48
-rw-r--r--tests/TFP/TFP_45_009/Makefile28
-rw-r--r--tests/TFP/TFP_45_009/host.c86
-rw-r--r--tests/TFP/TFP_45_009/host_and_mpu.h25
-rw-r--r--tests/TFP/TFP_45_009/mpu.c49
-rw-r--r--tests/TFP/TFP_45_010/Makefile28
-rw-r--r--tests/TFP/TFP_45_010/host.c127
-rw-r--r--tests/TFP/TFP_45_010/mpu.c42
-rw-r--r--tests/TFP/TFP_45_011/Makefile28
-rw-r--r--tests/TFP/TFP_45_011/host.c107
-rw-r--r--tests/TFP/TFP_45_011/mpu.c56
-rw-r--r--tests/TFP/TFP_45_012/Makefile28
-rw-r--r--tests/TFP/TFP_45_012/host.c118
-rw-r--r--tests/TFP/TFP_45_012/mpu1.c56
-rw-r--r--tests/TFP/TFP_45_012/mpu2.c42
-rw-r--r--tests/TFP/TFP_45_013/Makefile28
-rw-r--r--tests/TFP/TFP_45_013/host.c147
-rw-r--r--tests/TFP/TFP_45_013/mpu.c54
-rw-r--r--tests/TFP/TFP_45_014/Makefile28
-rw-r--r--tests/TFP/TFP_45_014/host.c155
-rw-r--r--tests/TFP/TFP_45_014/mpu.c51
-rw-r--r--tests/TFP/TFP_45_015/Makefile28
-rw-r--r--tests/TFP/TFP_45_015/host.c86
-rw-r--r--tests/TFP/TFP_45_015/host_and_mpu.h25
-rw-r--r--tests/TFP/TFP_45_015/mpu1.c46
-rw-r--r--tests/TFP/TFP_45_015/mpu2.c46
-rw-r--r--tests/TFP/TFP_45_016/Makefile28
-rw-r--r--tests/TFP/TFP_45_016/host.c127
-rw-r--r--tests/TFP/TFP_45_016/mpu.c45
-rw-r--r--tests/TFP/TFP_45_017/Makefile28
-rw-r--r--tests/TFP/TFP_45_017/host.c119
-rw-r--r--tests/TFP/TFP_45_017/mpu1.c56
-rw-r--r--tests/TFP/TFP_45_017/mpu2.c45
-rw-r--r--tests/TFP/TFP_45_018/Makefile28
-rw-r--r--tests/TFP/TFP_45_018/host.c127
-rw-r--r--tests/TFP/TFP_45_018/mpu.c42
-rw-r--r--tests/TFP/TFP_45_019/Makefile28
-rw-r--r--tests/TFP/TFP_45_019/host.c107
-rw-r--r--tests/TFP/TFP_45_019/mpu.c56
-rw-r--r--tests/TFP/TFP_45_020/Makefile28
-rw-r--r--tests/TFP/TFP_45_020/host.c118
-rw-r--r--tests/TFP/TFP_45_020/mpu1.c56
-rw-r--r--tests/TFP/TFP_45_020/mpu2.c42
-rw-r--r--tests/TFP/TFP_45_021/Makefile28
-rw-r--r--tests/TFP/TFP_45_021/host.c127
-rw-r--r--tests/TFP/TFP_45_021/mpu.c45
-rw-r--r--tests/TFP/TFP_45_022/Makefile28
-rw-r--r--tests/TFP/TFP_45_022/host.c118
-rw-r--r--tests/TFP/TFP_45_022/mpu1.c56
-rw-r--r--tests/TFP/TFP_45_022/mpu2.c45
-rw-r--r--tests/TFP/TFP_46_001/Makefile28
-rw-r--r--tests/TFP/TFP_46_001/host.c95
-rw-r--r--tests/TFP/TFP_46_001/host_and_mpu.h24
-rw-r--r--tests/TFP/TFP_46_001/mpu.c53
-rw-r--r--tests/TFP/TFP_46_002/Makefile28
-rw-r--r--tests/TFP/TFP_46_002/host.c102
-rw-r--r--tests/TFP/TFP_46_002/host_and_mpu.h24
-rw-r--r--tests/TFP/TFP_46_002/mpu1.c56
-rw-r--r--tests/TFP/TFP_46_002/mpu2.c58
-rw-r--r--tests/TFP/TFP_46_003/Makefile28
-rw-r--r--tests/TFP/TFP_46_003/host.c108
-rw-r--r--tests/TFP/TFP_46_003/mpu.c59
-rw-r--r--tests/TFP/TFP_46_004/Makefile28
-rw-r--r--tests/TFP/TFP_46_004/host.c118
-rw-r--r--tests/TFP/TFP_46_004/mpu1.c59
-rw-r--r--tests/TFP/TFP_46_004/mpu2.c42
-rw-r--r--tests/TFP/TFP_46_005/Makefile28
-rw-r--r--tests/TFP/TFP_46_005/host.c118
-rw-r--r--tests/TFP/TFP_46_005/mpu1.c59
-rw-r--r--tests/TFP/TFP_46_005/mpu2.c45
-rw-r--r--tests/TFP/TFP_46_007/Makefile28
-rw-r--r--tests/TFP/TFP_46_007/host.c140
-rw-r--r--tests/TFP/TFP_46_007/mpu.c54
-rw-r--r--tests/TFP/TFP_46_008/Makefile28
-rw-r--r--tests/TFP/TFP_46_008/host.c108
-rw-r--r--tests/TFP/TFP_46_008/mpu.c59
-rw-r--r--tests/TFP/TFP_46_009/Makefile28
-rw-r--r--tests/TFP/TFP_46_009/host.c118
-rw-r--r--tests/TFP/TFP_46_009/mpu1.c59
-rw-r--r--tests/TFP/TFP_46_009/mpu2.c42
-rw-r--r--tests/TFP/TFP_46_010/Makefile28
-rw-r--r--tests/TFP/TFP_46_010/host.c118
-rw-r--r--tests/TFP/TFP_46_010/mpu1.c59
-rw-r--r--tests/TFP/TFP_46_010/mpu2.c45
-rw-r--r--tests/TFP/TFP_47_001/Makefile28
-rw-r--r--tests/TFP/TFP_47_001/host.c131
-rw-r--r--tests/TFP/TFP_47_001/mpu1.c54
-rw-r--r--tests/TFP/TFP_47_001/mpu2.c61
-rw-r--r--tests/TFP/TFP_48_001/Makefile28
-rw-r--r--tests/TFP/TFP_48_001/host.c104
-rw-r--r--tests/TFP/TFP_48_001/mpu.c54
-rw-r--r--tests/TFP/TFP_48_002/Makefile28
-rw-r--r--tests/TFP/TFP_48_002/host.c106
-rw-r--r--tests/TFP/TFP_48_002/mpu.c51
-rw-r--r--tests/TFP/TFP_48_003/Makefile28
-rw-r--r--tests/TFP/TFP_48_003/host.c109
-rw-r--r--tests/TFP/TFP_48_003/mpu1.c51
-rw-r--r--tests/TFP/TFP_48_003/mpu2.c54
-rw-r--r--tests/TFP/TFP_48_004/Makefile28
-rw-r--r--tests/TFP/TFP_48_004/host.c139
-rw-r--r--tests/TFP/TFP_48_004/mpu.c61
-rw-r--r--tests/TFP/TFP_48_005/Makefile28
-rw-r--r--tests/TFP/TFP_48_005/host.c140
-rw-r--r--tests/TFP/TFP_48_005/mpu.c51
-rw-r--r--tests/TFP/TFP_48_006/Makefile28
-rw-r--r--tests/TFP/TFP_48_006/host.c131
-rw-r--r--tests/TFP/TFP_48_006/mpu1.c51
-rw-r--r--tests/TFP/TFP_48_006/mpu2.c61
-rw-r--r--tests/TFP/TFP_49_001/Makefile28
-rw-r--r--tests/TFP/TFP_49_001/host.c88
-rw-r--r--tests/TFP/TFP_49_001/host_and_mpu.h24
-rw-r--r--tests/TFP/TFP_49_001/mpu.c60
-rw-r--r--tests/TFP/TFP_49_002/Makefile28
-rw-r--r--tests/TFP/TFP_49_002/host.c97
-rw-r--r--tests/TFP/TFP_49_002/host_and_mpu.h24
-rw-r--r--tests/TFP/TFP_49_002/mpu1.c63
-rw-r--r--tests/TFP/TFP_49_002/mpu2.c49
-rw-r--r--tests/TFP/TFP_49_003/Makefile28
-rw-r--r--tests/TFP/TFP_49_003/host.c139
-rw-r--r--tests/TFP/TFP_49_003/mpu.c54
-rw-r--r--tests/TFP/TFP_49_004/Makefile28
-rw-r--r--tests/TFP/TFP_49_004/host.c131
-rw-r--r--tests/TFP/TFP_49_004/mpu1.c54
-rw-r--r--tests/TFP/TFP_49_004/mpu2.c61
-rw-r--r--tests/TFP/TFP_4A_001/Makefile28
-rw-r--r--tests/TFP/TFP_4A_001/host.c90
-rw-r--r--tests/TFP/TFP_4A_001/mpu.c47
-rw-r--r--tests/TFP/TFP_4A_002/Makefile28
-rw-r--r--tests/TFP/TFP_4A_002/host.c92
-rw-r--r--tests/TFP/TFP_4A_002/mpu.c48
-rw-r--r--tests/TFP/TFP_4A_003/Makefile28
-rw-r--r--tests/TFP/TFP_4A_003/host.c105
-rw-r--r--tests/TFP/TFP_4A_003/mpu1.c48
-rw-r--r--tests/TFP/TFP_4A_003/mpu2.c47
-rw-r--r--tests/TFP/TFP_4A_004/Makefile28
-rw-r--r--tests/TFP/TFP_4A_004/host.c138
-rw-r--r--tests/TFP/TFP_4A_004/mpu.c54
-rw-r--r--tests/TFP/TFP_4A_005/Makefile28
-rw-r--r--tests/TFP/TFP_4A_005/host.c155
-rw-r--r--tests/TFP/TFP_4A_005/mpu.c49
-rw-r--r--tests/TFP/TFP_4A_006/Makefile28
-rw-r--r--tests/TFP/TFP_4A_006/host.c150
-rw-r--r--tests/TFP/TFP_4A_006/mpu1.c54
-rw-r--r--tests/TFP/TFP_4A_006/mpu2.c49
-rw-r--r--tests/TFP/TFP_4A_007/Makefile28
-rw-r--r--tests/TFP/TFP_4A_007/host.c90
-rw-r--r--tests/TFP/TFP_4A_007/host_and_mpu.h25
-rw-r--r--tests/TFP/TFP_4A_007/mpu.c49
-rw-r--r--tests/TFP/TFP_4A_008/Makefile28
-rw-r--r--tests/TFP/TFP_4A_008/host.c104
-rw-r--r--tests/TFP/TFP_4A_008/host_and_mpu.h24
-rw-r--r--tests/TFP/TFP_4A_008/mpu.c44
-rw-r--r--tests/TFP/TFP_4A_009/Makefile28
-rw-r--r--tests/TFP/TFP_4A_009/host.c108
-rw-r--r--tests/TFP/TFP_4A_009/host_and_mpu.h25
-rw-r--r--tests/TFP/TFP_4A_009/mpu1.c46
-rw-r--r--tests/TFP/TFP_4A_009/mpu2.c49
-rw-r--r--tests/TFP/TFP_4A_010/Makefile28
-rw-r--r--tests/TFP/TFP_4A_010/host.c108
-rw-r--r--tests/TFP/TFP_4A_010/mpu.c54
-rw-r--r--tests/TFP/TFP_4A_011/Makefile28
-rw-r--r--tests/TFP/TFP_4A_011/host.c128
-rw-r--r--tests/TFP/TFP_4A_011/mpu.c45
-rw-r--r--tests/TFP/TFP_4A_012/Makefile28
-rw-r--r--tests/TFP/TFP_4A_012/host.c121
-rw-r--r--tests/TFP/TFP_4A_012/mpu1.c54
-rw-r--r--tests/TFP/TFP_4A_012/mpu2.c45
-rw-r--r--tests/TFP/TFP_4A_013/Makefile28
-rw-r--r--tests/TFP/TFP_4A_013/host.c128
-rw-r--r--tests/TFP/TFP_4A_013/mpu.c48
-rw-r--r--tests/TFP/TFP_4A_014/Makefile28
-rw-r--r--tests/TFP/TFP_4A_014/host.c121
-rw-r--r--tests/TFP/TFP_4A_014/mpu1.c54
-rw-r--r--tests/TFP/TFP_4A_014/mpu2.c48
-rw-r--r--tests/TFP/TFP_4A_015/Makefile28
-rw-r--r--tests/TFP/TFP_4A_015/host.c108
-rw-r--r--tests/TFP/TFP_4A_015/mpu.c54
-rw-r--r--tests/TFP/TFP_4A_016/Makefile28
-rw-r--r--tests/TFP/TFP_4A_016/host.c128
-rw-r--r--tests/TFP/TFP_4A_016/mpu.c45
-rw-r--r--tests/TFP/TFP_4A_017/Makefile28
-rw-r--r--tests/TFP/TFP_4A_017/host.c121
-rw-r--r--tests/TFP/TFP_4A_017/mpu1.c54
-rw-r--r--tests/TFP/TFP_4A_017/mpu2.c45
-rw-r--r--tests/TFP/TFP_4A_018/Makefile28
-rw-r--r--tests/TFP/TFP_4A_018/host.c91
-rw-r--r--tests/TFP/TFP_4A_018/mpu.c46
-rw-r--r--tests/TFP/TFP_4A_019/Makefile28
-rw-r--r--tests/TFP/TFP_4A_019/host.c121
-rw-r--r--tests/TFP/TFP_4A_019/mpu1.c54
-rw-r--r--tests/TFP/TFP_4A_019/mpu2.c48
-rw-r--r--tests/TFP/TFP_4B_001/Makefile28
-rw-r--r--tests/TFP/TFP_4B_001/host.c90
-rw-r--r--tests/TFP/TFP_4B_001/mpu.c50
-rw-r--r--tests/TFP/TFP_4B_002/Makefile28
-rw-r--r--tests/TFP/TFP_4B_002/host.c105
-rw-r--r--tests/TFP/TFP_4B_002/mpu1.c48
-rw-r--r--tests/TFP/TFP_4B_002/mpu2.c51
-rw-r--r--tests/TFP/TFP_4B_003/Makefile28
-rw-r--r--tests/TFP/TFP_4B_003/host.c138
-rw-r--r--tests/TFP/TFP_4B_003/mpu.c57
-rw-r--r--tests/TFP/TFP_4B_004/Makefile28
-rw-r--r--tests/TFP/TFP_4B_004/host.c88
-rw-r--r--tests/TFP/TFP_4B_004/mpu.c43
-rw-r--r--tests/TFP/TFP_4B_005/Makefile28
-rw-r--r--tests/TFP/TFP_4B_005/host.c121
-rw-r--r--tests/TFP/TFP_4B_005/mpu1.c58
-rw-r--r--tests/TFP/TFP_4B_005/mpu2.c45
-rw-r--r--tests/TFP/TFP_4B_006/Makefile28
-rw-r--r--tests/TFP/TFP_4B_006/host.c121
-rw-r--r--tests/TFP/TFP_4B_006/mpu1.c58
-rw-r--r--tests/TFP/TFP_4B_006/mpu2.c48
-rw-r--r--tests/TFP/TFP_4B_007/Makefile28
-rw-r--r--tests/TFP/TFP_4B_007/host.c108
-rw-r--r--tests/TFP/TFP_4B_007/mpu.c58
-rw-r--r--tests/TFP/TFP_4B_008/Makefile28
-rw-r--r--tests/TFP/TFP_4B_008/host.c121
-rw-r--r--tests/TFP/TFP_4B_008/mpu1.c58
-rw-r--r--tests/TFP/TFP_4B_008/mpu2.c45
-rw-r--r--tests/TFP/TFP_4B_009/Makefile28
-rw-r--r--tests/TFP/TFP_4B_009/host.c121
-rw-r--r--tests/TFP/TFP_4B_009/mpu1.c58
-rw-r--r--tests/TFP/TFP_4B_009/mpu2.c48
-rw-r--r--tests/TFP/TFP_4C_001/Makefile28
-rw-r--r--tests/TFP/TFP_4C_001/host.c151
-rw-r--r--tests/TFP/TFP_4C_001/mpu1.c57
-rw-r--r--tests/TFP/TFP_4C_001/mpu2.c49
-rw-r--r--tests/TFP/TFP_4D_001/Makefile28
-rw-r--r--tests/TFP/TFP_4D_001/host.c90
-rw-r--r--tests/TFP/TFP_4D_001/mpu.c42
-rw-r--r--tests/TFP/TFP_4D_002/Makefile28
-rw-r--r--tests/TFP/TFP_4D_002/host.c95
-rw-r--r--tests/TFP/TFP_4D_002/mpu.c35
-rw-r--r--tests/TFP/TFP_4D_003/Makefile28
-rw-r--r--tests/TFP/TFP_4D_003/host.c89
-rw-r--r--tests/TFP/TFP_4D_003/mpu.c42
-rw-r--r--tests/TFP/TFP_4D_004/Makefile28
-rw-r--r--tests/TFP/TFP_4D_004/host.c138
-rw-r--r--tests/TFP/TFP_4D_004/mpu.c54
-rw-r--r--tests/TFP/TFP_4D_005/Makefile28
-rw-r--r--tests/TFP/TFP_4D_005/host.c156
-rw-r--r--tests/TFP/TFP_4D_005/mpu.c49
-rw-r--r--tests/TFP/TFP_4D_006/Makefile28
-rw-r--r--tests/TFP/TFP_4D_006/host.c150
-rw-r--r--tests/TFP/TFP_4D_006/mpu1.c54
-rw-r--r--tests/TFP/TFP_4D_006/mpu2.c49
-rw-r--r--tests/TFP/TFP_4E_001/Makefile28
-rw-r--r--tests/TFP/TFP_4E_001/host.c78
-rw-r--r--tests/TFP/TFP_4E_001/mpu.c44
-rw-r--r--tests/TFP/TFP_4E_002/Makefile28
-rw-r--r--tests/TFP/TFP_4E_002/host.c78
-rw-r--r--tests/TFP/TFP_4E_002/mpu.c44
-rw-r--r--tests/TFP/TFP_4E_003/Makefile28
-rw-r--r--tests/TFP/TFP_4E_003/host.c121
-rw-r--r--tests/TFP/TFP_4E_003/mpu1.c64
-rw-r--r--tests/TFP/TFP_4E_003/mpu2.c48
-rw-r--r--tests/TFP/TFP_4E_004/Makefile28
-rw-r--r--tests/TFP/TFP_4E_004/host.c138
-rw-r--r--tests/TFP/TFP_4E_004/mpu.c57
-rw-r--r--tests/TFP/TFP_4E_005/Makefile28
-rw-r--r--tests/TFP/TFP_4E_005/host.c150
-rw-r--r--tests/TFP/TFP_4E_005/mpu1.c57
-rw-r--r--tests/TFP/TFP_4E_005/mpu2.c49
-rw-r--r--tests/TFP/TFP_4E_006/Makefile28
-rw-r--r--tests/TFP/TFP_4E_006/host.c121
-rw-r--r--tests/TFP/TFP_4E_006/mpu1.c64
-rw-r--r--tests/TFP/TFP_4E_006/mpu2.c48
-rw-r--r--tests/TFP/TFP_4F_001/Makefile28
-rw-r--r--tests/TFP/TFP_4F_001/host.c85
-rw-r--r--tests/TFP/TFP_4F_001/host_and_mpu.h24
-rw-r--r--tests/TFP/TFP_4F_001/mpu.c57
-rw-r--r--tests/TFP/TFP_4F_002/Makefile28
-rw-r--r--tests/TFP/TFP_4F_002/host.c96
-rw-r--r--tests/TFP/TFP_4F_002/host_and_mpu.h24
-rw-r--r--tests/TFP/TFP_4F_002/mpu.c46
-rw-r--r--tests/TFP/TFP_4F_003/Makefile28
-rw-r--r--tests/TFP/TFP_4F_003/host.c97
-rw-r--r--tests/TFP/TFP_4F_003/host_and_mpu.h24
-rw-r--r--tests/TFP/TFP_4F_003/mpu1.c50
-rw-r--r--tests/TFP/TFP_4F_003/mpu2.c56
-rw-r--r--tests/TFP/TFP_4F_004/Makefile28
-rw-r--r--tests/TFP/TFP_4F_004/host.c90
-rw-r--r--tests/TFP/TFP_4F_004/mpu.c47
-rw-r--r--tests/TFP/TFP_4F_005/Makefile28
-rw-r--r--tests/TFP/TFP_4F_005/host.c92
-rw-r--r--tests/TFP/TFP_4F_005/mpu.c48
-rw-r--r--tests/TFP/TFP_4F_006/Makefile28
-rw-r--r--tests/TFP/TFP_4F_006/host.c105
-rw-r--r--tests/TFP/TFP_4F_006/mpu1.c48
-rw-r--r--tests/TFP/TFP_4F_006/mpu2.c48
-rw-r--r--tests/TFP/TFP_4F_007/Makefile28
-rw-r--r--tests/TFP/TFP_4F_007/host.c120
-rw-r--r--tests/TFP/TFP_4F_007/mpu.c50
-rw-r--r--tests/TFP/TFP_4F_008/Makefile28
-rw-r--r--tests/TFP/TFP_4F_008/host.c142
-rw-r--r--tests/TFP/TFP_4F_008/mpu.c45
-rw-r--r--tests/TFP/TFP_4F_009/Makefile28
-rw-r--r--tests/TFP/TFP_4F_009/host.c133
-rw-r--r--tests/TFP/TFP_4F_009/mpu1.c50
-rw-r--r--tests/TFP/TFP_4F_009/mpu2.c45
-rw-r--r--tests/TFP/TFP_4F_010/Makefile28
-rw-r--r--tests/TFP/TFP_4F_010/host.c108
-rw-r--r--tests/TFP/TFP_4F_010/mpu.c60
-rw-r--r--tests/TFP/TFP_4F_011/Makefile28
-rw-r--r--tests/TFP/TFP_4F_011/host.c133
-rw-r--r--tests/TFP/TFP_4F_011/mpu.c45
-rw-r--r--tests/TFP/TFP_4F_012/Makefile28
-rw-r--r--tests/TFP/TFP_4F_012/host.c127
-rw-r--r--tests/TFP/TFP_4F_012/mpu1.c54
-rw-r--r--tests/TFP/TFP_4F_012/mpu2.c45
-rw-r--r--tests/TFP/TFP_4F_013/Makefile28
-rw-r--r--tests/TFP/TFP_4F_013/host.c133
-rw-r--r--tests/TFP/TFP_4F_013/mpu.c48
-rw-r--r--tests/TFP/TFP_4F_014/Makefile28
-rw-r--r--tests/TFP/TFP_4F_014/host.c127
-rw-r--r--tests/TFP/TFP_4F_014/mpu1.c54
-rw-r--r--tests/TFP/TFP_4F_014/mpu2.c48
-rw-r--r--tests/TFP/TFP_4F_015/Makefile28
-rw-r--r--tests/TFP/TFP_4F_015/host.c108
-rw-r--r--tests/TFP/TFP_4F_015/mpu.c60
-rw-r--r--tests/TFP/TFP_4F_016/Makefile28
-rw-r--r--tests/TFP/TFP_4F_016/host.c133
-rw-r--r--tests/TFP/TFP_4F_016/mpu.c45
-rw-r--r--tests/TFP/TFP_4F_017/Makefile28
-rw-r--r--tests/TFP/TFP_4F_017/host.c127
-rw-r--r--tests/TFP/TFP_4F_017/mpu1.c54
-rw-r--r--tests/TFP/TFP_4F_017/mpu2.c45
-rw-r--r--tests/TFP/TFP_4F_018/Makefile28
-rw-r--r--tests/TFP/TFP_4F_018/host.c133
-rw-r--r--tests/TFP/TFP_4F_018/mpu.c48
-rw-r--r--tests/TFP/TFP_4F_019/Makefile28
-rw-r--r--tests/TFP/TFP_4F_019/host.c127
-rw-r--r--tests/TFP/TFP_4F_019/mpu1.c54
-rw-r--r--tests/TFP/TFP_4F_019/mpu2.c48
-rw-r--r--tests/TFP/TFP_4G_001/Makefile28
-rw-r--r--tests/TFP/TFP_4G_001/host.c85
-rw-r--r--tests/TFP/TFP_4G_001/host_and_mpu.h24
-rw-r--r--tests/TFP/TFP_4G_001/mpu.c60
-rw-r--r--tests/TFP/TFP_4G_002/Makefile28
-rw-r--r--tests/TFP/TFP_4G_002/host.c97
-rw-r--r--tests/TFP/TFP_4G_002/host_and_mpu.h24
-rw-r--r--tests/TFP/TFP_4G_002/mpu1.c50
-rw-r--r--tests/TFP/TFP_4G_002/mpu2.c59
-rw-r--r--tests/TFP/TFP_4G_003/Makefile28
-rw-r--r--tests/TFP/TFP_4G_003/host.c90
-rw-r--r--tests/TFP/TFP_4G_003/mpu.c50
-rw-r--r--tests/TFP/TFP_4G_004/Makefile28
-rw-r--r--tests/TFP/TFP_4G_004/host.c105
-rw-r--r--tests/TFP/TFP_4G_004/mpu1.c48
-rw-r--r--tests/TFP/TFP_4G_004/mpu2.c51
-rw-r--r--tests/TFP/TFP_4G_005/Makefile28
-rw-r--r--tests/TFP/TFP_4G_005/host.c90
-rw-r--r--tests/TFP/TFP_4G_005/host_and_mpu.h25
-rw-r--r--tests/TFP/TFP_4G_005/mpu.c49
-rw-r--r--tests/TFP/TFP_4G_006/Makefile28
-rw-r--r--tests/TFP/TFP_4G_006/host.c108
-rw-r--r--tests/TFP/TFP_4G_006/mpu.c64
-rw-r--r--tests/TFP/TFP_4G_007/Makefile28
-rw-r--r--tests/TFP/TFP_4G_007/host.c127
-rw-r--r--tests/TFP/TFP_4G_007/mpu1.c58
-rw-r--r--tests/TFP/TFP_4G_007/mpu2.c45
-rw-r--r--tests/TFP/TFP_4G_008/Makefile28
-rw-r--r--tests/TFP/TFP_4G_008/host.c127
-rw-r--r--tests/TFP/TFP_4G_008/mpu1.c57
-rw-r--r--tests/TFP/TFP_4G_008/mpu2.c48
-rw-r--r--tests/TFP/TFP_4G_009/Makefile28
-rw-r--r--tests/TFP/TFP_4G_009/host.c108
-rw-r--r--tests/TFP/TFP_4G_009/mpu.c64
-rw-r--r--tests/TFP/TFP_4G_010/Makefile28
-rw-r--r--tests/TFP/TFP_4G_010/host.c127
-rw-r--r--tests/TFP/TFP_4G_010/mpu1.c58
-rw-r--r--tests/TFP/TFP_4G_010/mpu2.c45
-rw-r--r--tests/TFP/TFP_4G_011/Makefile28
-rw-r--r--tests/TFP/TFP_4G_011/host.c127
-rw-r--r--tests/TFP/TFP_4G_011/mpu1.c57
-rw-r--r--tests/TFP/TFP_4G_011/mpu2.c48
-rw-r--r--tests/TFP/TFP_4H_001/Makefile28
-rw-r--r--tests/TFP/TFP_4H_001/host.c134
-rw-r--r--tests/TFP/TFP_4H_001/mpu1.c53
-rw-r--r--tests/TFP/TFP_4H_001/mpu2.c45
-rw-r--r--tests/TFP/TFP_4I_001/Makefile28
-rw-r--r--tests/TFP/TFP_4I_001/host.c85
-rw-r--r--tests/TFP/TFP_4I_001/host_and_mpu.h24
-rw-r--r--tests/TFP/TFP_4I_001/mpu.c57
-rw-r--r--tests/TFP/TFP_4I_002/Makefile28
-rw-r--r--tests/TFP/TFP_4I_002/host.c96
-rw-r--r--tests/TFP/TFP_4I_002/host_and_mpu.h24
-rw-r--r--tests/TFP/TFP_4I_002/mpu.c46
-rw-r--r--tests/TFP/TFP_4I_003/Makefile28
-rw-r--r--tests/TFP/TFP_4I_003/host.c97
-rw-r--r--tests/TFP/TFP_4I_003/host_and_mpu.h24
-rw-r--r--tests/TFP/TFP_4I_003/mpu1.c50
-rw-r--r--tests/TFP/TFP_4I_003/mpu2.c56
-rw-r--r--tests/TFP/TFP_4I_004/Makefile28
-rw-r--r--tests/TFP/TFP_4I_004/host.c78
-rw-r--r--tests/TFP/TFP_4I_004/mpu.c41
-rw-r--r--tests/TFP/TFP_4I_005/Makefile28
-rw-r--r--tests/TFP/TFP_4I_005/host.c59
-rw-r--r--tests/TFP/TFP_4I_006/Makefile28
-rw-r--r--tests/TFP/TFP_4I_006/host.c78
-rw-r--r--tests/TFP/TFP_4I_006/mpu.c41
-rw-r--r--tests/TFP/TFP_4I_007/Makefile28
-rw-r--r--tests/TFP/TFP_4I_007/host.c115
-rw-r--r--tests/TFP/TFP_4I_007/mpu.c53
-rw-r--r--tests/TFP/TFP_4I_008/Makefile28
-rw-r--r--tests/TFP/TFP_4I_008/host.c143
-rw-r--r--tests/TFP/TFP_4I_008/mpu.c45
-rw-r--r--tests/TFP/TFP_4I_009/Makefile28
-rw-r--r--tests/TFP/TFP_4I_009/host.c134
-rw-r--r--tests/TFP/TFP_4I_009/mpu1.c54
-rw-r--r--tests/TFP/TFP_4I_009/mpu2.c45
-rw-r--r--tests/TFP/TFP_4J_001/Makefile28
-rw-r--r--tests/TFP/TFP_4J_001/host.c85
-rw-r--r--tests/TFP/TFP_4J_001/host_and_mpu.h24
-rw-r--r--tests/TFP/TFP_4J_001/mpu.c60
-rw-r--r--tests/TFP/TFP_4J_002/Makefile28
-rw-r--r--tests/TFP/TFP_4J_002/host.c97
-rw-r--r--tests/TFP/TFP_4J_002/host_and_mpu.h24
-rw-r--r--tests/TFP/TFP_4J_002/mpu1.c50
-rw-r--r--tests/TFP/TFP_4J_002/mpu2.c58
-rw-r--r--tests/TFP/TFP_4J_003/Makefile28
-rw-r--r--tests/TFP/TFP_4J_003/host.c78
-rw-r--r--tests/TFP/TFP_4J_003/mpu.c44
-rw-r--r--tests/TFP/TFP_4J_004/Makefile28
-rw-r--r--tests/TFP/TFP_4J_004/host.c78
-rw-r--r--tests/TFP/TFP_4J_004/mpu.c44
-rw-r--r--tests/TFP/TFP_4J_006/Makefile28
-rw-r--r--tests/TFP/TFP_4J_006/host.c90
-rw-r--r--tests/TFP/TFP_4J_006/host_and_mpu.h25
-rw-r--r--tests/TFP/TFP_4J_006/mpu.c49
-rw-r--r--tests/TFP/TFP_4J_007/Makefile28
-rw-r--r--tests/TFP/TFP_4J_007/host.c134
-rw-r--r--tests/TFP/TFP_4J_007/mpu1.c56
-rw-r--r--tests/TFP/TFP_4J_007/mpu2.c45
-rw-r--r--tests/TFP/TFP_51_001/Makefile28
-rw-r--r--tests/TFP/TFP_51_001/host.c49
-rw-r--r--tests/TFP/TFP_51_002/Makefile28
-rw-r--r--tests/TFP/TFP_51_002/host.c52
-rw-r--r--tests/TFP/TFP_53_001/Makefile28
-rw-r--r--tests/TFP/TFP_53_001/host.c75
-rw-r--r--tests/TFP/TFP_53_001/mpu.c40
-rw-r--r--tests/TFP/TFP_53_002/Makefile28
-rw-r--r--tests/TFP/TFP_53_002/host.c75
-rw-r--r--tests/TFP/TFP_53_002/mpu.c54
-rw-r--r--tests/TFP/TFP_53_003/Makefile28
-rw-r--r--tests/TFP/TFP_53_003/host.c110
-rw-r--r--tests/TFP/TFP_53_003/mpu1.c43
-rw-r--r--tests/TFP/TFP_53_003/mpu2.c41
-rw-r--r--tests/TFP/TFP_53_004/Makefile28
-rw-r--r--tests/TFP/TFP_53_004/host.c83
-rw-r--r--tests/TFP/TFP_53_004/mpu.c38
-rw-r--r--tests/TFP/TFP_53_005/Makefile28
-rw-r--r--tests/TFP/TFP_53_005/host.c87
-rw-r--r--tests/TFP/TFP_53_005/mpu.c45
-rw-r--r--tests/TFP/TFP_53_006/Makefile28
-rw-r--r--tests/TFP/TFP_53_006/host.c87
-rw-r--r--tests/TFP/TFP_53_006/mpu.c45
-rw-r--r--tests/TFP/TFP_54_001/Makefile28
-rw-r--r--tests/TFP/TFP_54_001/host.c72
-rw-r--r--tests/TFP/TFP_54_001/mpu.c61
-rw-r--r--tests/TFP/TFP_54_002/Makefile28
-rw-r--r--tests/TFP/TFP_54_002/host.c127
-rw-r--r--tests/TFP/TFP_54_002/mpu1.c39
-rw-r--r--tests/TFP/TFP_54_002/mpu2.c43
-rw-r--r--tests/TFP/TFP_54_003/Makefile28
-rw-r--r--tests/TFP/TFP_54_003/host.c83
-rw-r--r--tests/TFP/TFP_54_003/mpu.c41
-rw-r--r--tests/TFP/TFP_61_001/Makefile28
-rw-r--r--tests/TFP/TFP_61_001/host.c73
-rw-r--r--tests/TFP/TFP_61_001/mpu.c46
-rw-r--r--tests/TFP/TFP_61_002/Makefile28
-rw-r--r--tests/TFP/TFP_61_002/host.c87
-rw-r--r--tests/TFP/TFP_61_002/mpu1.c35
-rw-r--r--tests/TFP/TFP_61_002/mpu2.c44
-rw-r--r--tests/TFP/TFP_62_001/Makefile28
-rw-r--r--tests/TFP/TFP_62_001/host.c76
-rw-r--r--tests/TFP/TFP_62_001/mpu.c40
-rw-r--r--tests/TFP/TFP_62_002/Makefile28
-rw-r--r--tests/TFP/TFP_62_002/host.c85
-rw-r--r--tests/TFP/TFP_62_002/mpu1.c39
-rw-r--r--tests/TFP/TFP_62_002/mpu2.c47
-rw-r--r--tests/TFP/TFP_63_001/Makefile28
-rw-r--r--tests/TFP/TFP_63_001/host.c76
-rw-r--r--tests/TFP/TFP_63_001/mpu.c40
-rw-r--r--tests/TFP/TFP_63_002/Makefile28
-rw-r--r--tests/TFP/TFP_63_002/host.c85
-rw-r--r--tests/TFP/TFP_63_002/mpu1.c40
-rw-r--r--tests/TFP/TFP_63_002/mpu2.c47
-rw-r--r--tests/TFP/TFP_63_003/Makefile28
-rw-r--r--tests/TFP/TFP_63_003/host.c76
-rw-r--r--tests/TFP/TFP_63_003/mpu.c39
-rw-r--r--tests/TFP/TFP_71_001/Makefile28
-rw-r--r--tests/TFP/TFP_71_001/host.c42
-rw-r--r--tests/TFP/TFP_71_003/Makefile28
-rw-r--r--tests/TFP/TFP_71_003/host.c74
-rw-r--r--tests/TFP/TFP_74_001/Makefile28
-rw-r--r--tests/TFP/TFP_74_001/host.c72
-rw-r--r--tests/TFP/TFP_74_002/Makefile28
-rw-r--r--tests/TFP/TFP_74_002/host.c90
-rw-r--r--tests/TFP/TFP_74_002/host_and_mpu.h30
-rw-r--r--tests/TFP/TFP_74_002/mpu.c69
-rw-r--r--tests/TFP/TFP_74_003/Makefile28
-rw-r--r--tests/TFP/TFP_74_003/host.c117
-rw-r--r--tests/TFP/TFP_74_003/host_and_mpu.h30
-rw-r--r--tests/TFP/TFP_74_003/mpu.c69
-rw-r--r--tests/TFP/TFP_75_001/Makefile28
-rw-r--r--tests/TFP/TFP_75_001/host.c80
-rw-r--r--tests/TFP/TFP_75_002/Makefile32
-rw-r--r--tests/TFP/TFP_75_002/host.c88
-rw-r--r--tests/TFP/TFP_75_002/host_and_mpu.h29
-rw-r--r--tests/TFP/TFP_75_002/mpu1.c72
-rw-r--r--tests/TFP/TFP_75_002/mpu2.c64
-rw-r--r--tests/TFP/TFP_75_003/Makefile28
-rw-r--r--tests/TFP/TFP_75_003/host.c91
-rw-r--r--tests/TFP/TFP_75_003/mpu.c48
-rw-r--r--tests/TFP/TFP_75_004/Makefile28
-rw-r--r--tests/TFP/TFP_75_004/host.c106
-rw-r--r--tests/TFP/TFP_75_004/mpu.c44
-rw-r--r--tests/TTF/Makefile39
-rw-r--r--tests/TTF/README7
-rw-r--r--tests/TTF/TTF_00_001/Makefile28
-rw-r--r--tests/TTF/TTF_00_001/host.c35
-rw-r--r--tests/TTF/TTF_00_002/Makefile28
-rw-r--r--tests/TTF/TTF_00_002/host.c33
-rw-r--r--tests/TTF/TTF_00_003/Makefile31
-rw-r--r--tests/TTF/TTF_00_003/host.c30
-rw-r--r--tests/TTF/TTF_00_004/Makefile28
-rw-r--r--tests/TTF/TTF_00_004/host.c32
-rw-r--r--tests/TTF/TTF_00_101/Makefile28
-rw-r--r--tests/TTF/TTF_00_101/host.c74
-rw-r--r--tests/TTF/TTF_00_101/mpu.c34
-rw-r--r--tests/TTF/TTF_00_102/Makefile28
-rw-r--r--tests/TTF/TTF_00_102/host.c72
-rw-r--r--tests/TTF/TTF_00_102/mpu.c34
-rw-r--r--tests/TTF/TTF_00_103/Makefile31
-rw-r--r--tests/TTF/TTF_00_103/host.c72
-rw-r--r--tests/TTF/TTF_00_103/mpu.c33
-rw-r--r--tests/TTF/TTF_00_104/Makefile28
-rw-r--r--tests/TTF/TTF_00_104/host.c72
-rw-r--r--tests/TTF/TTF_00_104/mpu.c39
-rw-r--r--tests/TTF/TTF_00_105/Makefile28
-rw-r--r--tests/TTF/TTF_00_105/host.c74
-rw-r--r--tests/TTF/TTF_00_105/mpu.c35
-rw-r--r--tests/TTF/TTF_00_106/Makefile28
-rw-r--r--tests/TTF/TTF_00_106/host.c124
-rw-r--r--tests/TTF/TTF_00_106/mpu.c51
-rw-r--r--tests/TTF/TTF_00_106/test.h31
-rw-r--r--tests/TTF/TTF_00_107/Makefile28
-rw-r--r--tests/TTF/TTF_00_107/host.c91
-rw-r--r--tests/TTF/TTF_00_107/mpu.c50
-rw-r--r--tests/include/common/mars_test.h108
-rw-r--r--tests/include/host/mars_test.h181
-rw-r--r--tests/include/mpu/mars_task_test.h31
-rw-r--r--tests/include/mpu/mars_test.h175
-rw-r--r--tests/scripts/config.mk96
-rw-r--r--tests/scripts/config_internal.mk30
-rw-r--r--tests/scripts/desc.sh63
-rw-r--r--tests/scripts/rules_class.mk44
-rw-r--r--tests/scripts/rules_item.mk69
-rw-r--r--tests/scripts/run.sh105
-rw-r--r--tests/scripts/run_classes.sh47
-rw-r--r--tests/scripts/run_functions73
-rw-r--r--tests/scripts/run_items.sh52
-rw-r--r--tests/scripts/tests.csv359
985 files changed, 58116 insertions, 0 deletions
diff --git a/tests/.gitignore b/tests/.gitignore
new file mode 100644
index 0000000..5a301f8
--- /dev/null
+++ b/tests/.gitignore
@@ -0,0 +1,11 @@
+#
+# NOTE! Don't add files that are generated in specific
+# subdirectories here. Add them in the ".gitignore" file
+# in that subdirectory instead.
+#
+*.o
+*eo
+*~*
+*.log
+*.task*
+
diff --git a/tests/Makefile b/tests/Makefile
new file mode 100644
index 0000000..8ee5b0a
--- /dev/null
+++ b/tests/Makefile
@@ -0,0 +1,50 @@
+#
+# Copyright 2008 Sony Corporation
+#
+#
+# Permission is hereby granted, free of charge, to any person obtaining a copy
+# of this software and associated documentation files (the "Software"), to deal
+# in the Software without restriction, including without limitation the rights
+# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+# copies of the Software, and to permit persons to whom the Software is
+# furnished to do so, subject to the following conditions:
+#
+# The above copyright notice and this permission notice shall be included in
+# all copies or substantial portions of the Software.
+#
+# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+# THE SOFTWARE.
+#
+
+top_srcdir = .
+test_classes = TFP
+extra_classes = TFI TTF
+
+include $(top_srcdir)/scripts/config.mk
+
+.PHONY: all build check clean distclean clean-top
+
+all: build
+
+build:
+ @for d in $(test_classes); do $(MAKE) -C $$d all || exit 1; done
+
+check:
+ @$(top_srcdir)/scripts/run_classes.sh $(test_classes)
+
+clean: clean-top
+ -for d in $(test_classes) $(extra_classes); do $(MAKE) -s -C $$d clean; done
+
+clean-top:
+ -rm -f .stamp*
+
+distclean: clean-top
+ -rm -f *~ scripts/*~ include/*/*~ check.log
+ -for d in $(test_classes) $(extra_classes); do $(MAKE) -s -C $$d distclean; done
+
+# EOF
diff --git a/tests/README b/tests/README
new file mode 100644
index 0000000..4f67a05
--- /dev/null
+++ b/tests/README
@@ -0,0 +1,77 @@
+MARS test suite
+
+
+* Running tests
+
+ Just do "make check" in each directory.
+
+ - If you do "make check" in the top directory, all tests in the test
+ suite will be run.
+
+ - If you do "make check" in each <test-class> directory, all tests
+ in the test class will be run.
+
+ - If you do "make check" in each <test-class>/<test-item> directory,
+ only the test item will be run.
+
+ Options below are available:
+
+ MARS_PREFIX=<mars-library-path>
+ MARS library path to be checked.
+ ARCH=<32-or-64> Host architecture.
+ MARS_SRC=<mars-source-path>
+ The absolute path to the MARS source
+ directory. If this option is specified, the
+ library in the <mars-source-path> is checked
+ instead of the installed one.
+
+ e.g.)
+
+ make ARCH=32 MARS_PREFIX=/opt/my-mars check
+
+* Adding a new test
+
+ 1. Create a new directory <test-class>/<test-item>.
+
+ # cd TFP
+ # mkdir TFP_12345
+
+ 2. Create a Makefile in the directory.
+
+ It is recommended to copy one of Makefiles in other directories.
+
+ # cp TFP_00001/Makefile TFP_12345
+
+ 3. Create source code in C language, in the <test-item> directory.
+
+ # cd TFP_12345
+ # ls
+ Makefile
+ host.c
+ mpu_task.c
+
+ 4. Modify the variable 'test_objs' in the Makefile, so that it
+ contains object files for your new test.
+
+ Each object must have one of the following suffixes:
+
+ .o host's object file
+ .mpu_eo MPU's native program
+ .task_eo MPU's MARS task
+
+ A MARS task object file named '<name>.task_eo' can be used by the
+ host program as 'extern spe_program_handle_t <name>_prog'.
+
+ The test program (host's 'main' function) must return zero if
+ succeeds, otherwise non-zero.
+
+ 5. Add definitions of <test-item> specific variables to the
+ Makefile, if needed:
+
+ timeout = <seconds> (default: 30)
+
+ 6. Add <test-item> to the variable 'test_items' in the
+ <test-class>/Makefile.
+
+---
+EOF
diff --git a/tests/TFI/Makefile b/tests/TFI/Makefile
new file mode 100644
index 0000000..69e6703
--- /dev/null
+++ b/tests/TFI/Makefile
@@ -0,0 +1,28 @@
+#
+# Copyright 2008 Sony Corporation
+#
+#
+# Permission is hereby granted, free of charge, to any person obtaining a copy
+# of this software and associated documentation files (the "Software"), to deal
+# in the Software without restriction, including without limitation the rights
+# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+# copies of the Software, and to permit persons to whom the Software is
+# furnished to do so, subject to the following conditions:
+#
+# The above copyright notice and this permission notice shall be included in
+# all copies or substantial portions of the Software.
+#
+# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+# THE SOFTWARE.
+#
+
+top_srcdir = ..
+test_items =
+
+include $(top_srcdir)/scripts/config_internal.mk
+include $(top_srcdir)/scripts/rules_class.mk
diff --git a/tests/TFI/README b/tests/TFI/README
new file mode 100644
index 0000000..6fc1479
--- /dev/null
+++ b/tests/TFI/README
@@ -0,0 +1,14 @@
+* Note
+
+ - This directory contains "tests for MARS internal functions".
+
+ o These internal tests require MARS source code and you need to
+ specify MARS_SRC= option to build and/or run them. See README in
+ the top directory for details.
+
+ o Use 'config_internal.mk' instead of 'config.mk' in Makefile.
+
+ o This directory isn't visited by top level Makefile.
+
+---
+EOF
diff --git a/tests/TFP/Makefile b/tests/TFP/Makefile
new file mode 100644
index 0000000..8338197
--- /dev/null
+++ b/tests/TFP/Makefile
@@ -0,0 +1,300 @@
+#
+# Copyright 2008 Sony Corporation
+#
+#
+# Permission is hereby granted, free of charge, to any person obtaining a copy
+# of this software and associated documentation files (the "Software"), to deal
+# in the Software without restriction, including without limitation the rights
+# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+# copies of the Software, and to permit persons to whom the Software is
+# furnished to do so, subject to the following conditions:
+#
+# The above copyright notice and this permission notice shall be included in
+# all copies or substantial portions of the Software.
+#
+# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+# THE SOFTWARE.
+#
+
+top_srcdir = ..
+test_items = \
+ TFP_01_001 \
+ TFP_01_002 \
+ TFP_01_003 \
+ TFP_01_004 \
+ TFP_01_005 \
+ TFP_02_001 \
+ TFP_02_002 \
+ TFP_11_001 \
+ TFP_11_002 \
+ TFP_11_003 \
+ TFP_11_004 \
+ TFP_11_005 \
+ TFP_11_006 \
+ TFP_11_007 \
+ TFP_11_008 \
+ TFP_11_009 \
+ TFP_11_010 \
+ TFP_11_011 \
+ TFP_12_001 \
+ TFP_12_002 \
+ TFP_12_003 \
+ TFP_13_001 \
+ TFP_13_002 \
+ TFP_13_003 \
+ TFP_13_004 \
+ TFP_13_005 \
+ TFP_13_006 \
+ TFP_13_007 \
+ TFP_13_008 \
+ TFP_14_001 \
+ TFP_14_002 \
+ TFP_15_001 \
+ TFP_15_002 \
+ TFP_17_001 \
+ TFP_18_001 \
+ TFP_18_002 \
+ TFP_19_001 \
+ TFP_1A_001 \
+ TFP_21_001 \
+ TFP_21_002 \
+ TFP_21_003 \
+ TFP_23_001 \
+ TFP_23_002 \
+ TFP_24_001 \
+ TFP_24_002 \
+ TFP_24_003 \
+ TFP_25_001 \
+ TFP_25_002 \
+ TFP_26_001 \
+ TFP_26_002 \
+ TFP_31_001 \
+ TFP_31_002 \
+ TFP_31_003 \
+ TFP_31_004 \
+ TFP_33_001 \
+ TFP_33_002 \
+ TFP_33_003 \
+ TFP_33_004 \
+ TFP_33_005 \
+ TFP_34_001 \
+ TFP_34_002 \
+ TFP_34_003 \
+ TFP_34_004 \
+ TFP_34_005 \
+ TFP_34_006 \
+ TFP_34_007 \
+ TFP_35_001 \
+ TFP_35_002 \
+ TFP_35_003 \
+ TFP_35_004 \
+ TFP_35_005 \
+ TFP_35_006 \
+ TFP_35_007 \
+ TFP_35_008 \
+ TFP_35_009 \
+ TFP_35_010 \
+ TFP_35_011 \
+ TFP_35_012 \
+ TFP_35_013 \
+ TFP_35_014 \
+ TFP_35_015 \
+ TFP_35_016 \
+ TFP_35_017 \
+ TFP_35_018 \
+ TFP_36_001 \
+ TFP_36_002 \
+ TFP_36_003 \
+ TFP_36_004 \
+ TFP_36_005 \
+ TFP_36_006 \
+ TFP_36_007 \
+ TFP_36_008 \
+ TFP_36_009 \
+ TFP_36_010 \
+ TFP_36_011 \
+ TFP_36_012 \
+ TFP_41_001 \
+ TFP_41_003 \
+ TFP_43_001 \
+ TFP_43_002 \
+ TFP_43_003 \
+ TFP_43_004 \
+ TFP_43_005 \
+ TFP_43_006 \
+ TFP_43_007 \
+ TFP_43_008 \
+ TFP_43_009 \
+ TFP_43_010 \
+ TFP_43_011 \
+ TFP_43_012 \
+ TFP_43_013 \
+ TFP_43_014 \
+ TFP_43_015 \
+ TFP_43_016 \
+ TFP_43_017 \
+ TFP_43_018 \
+ TFP_45_001 \
+ TFP_45_002 \
+ TFP_45_003 \
+ TFP_45_004 \
+ TFP_45_005 \
+ TFP_45_006 \
+ TFP_45_007 \
+ TFP_45_008 \
+ TFP_45_009 \
+ TFP_45_010 \
+ TFP_45_011 \
+ TFP_45_012 \
+ TFP_45_013 \
+ TFP_45_014 \
+ TFP_45_015 \
+ TFP_45_016 \
+ TFP_45_017 \
+ TFP_45_018 \
+ TFP_45_019 \
+ TFP_45_020 \
+ TFP_45_021 \
+ TFP_45_022 \
+ TFP_46_001 \
+ TFP_46_002 \
+ TFP_46_003 \
+ TFP_46_004 \
+ TFP_46_005 \
+ TFP_46_007 \
+ TFP_46_008 \
+ TFP_46_009 \
+ TFP_46_010 \
+ TFP_47_001 \
+ TFP_48_001 \
+ TFP_48_002 \
+ TFP_48_003 \
+ TFP_48_004 \
+ TFP_48_005 \
+ TFP_48_006 \
+ TFP_49_001 \
+ TFP_49_002 \
+ TFP_49_003 \
+ TFP_49_004 \
+ TFP_4A_001 \
+ TFP_4A_002 \
+ TFP_4A_003 \
+ TFP_4A_004 \
+ TFP_4A_005 \
+ TFP_4A_006 \
+ TFP_4A_007 \
+ TFP_4A_008 \
+ TFP_4A_009 \
+ TFP_4A_010 \
+ TFP_4A_011 \
+ TFP_4A_012 \
+ TFP_4A_013 \
+ TFP_4A_014 \
+ TFP_4A_015 \
+ TFP_4A_016 \
+ TFP_4A_017 \
+ TFP_4A_018 \
+ TFP_4A_019 \
+ TFP_4B_001 \
+ TFP_4B_002 \
+ TFP_4B_003 \
+ TFP_4B_004 \
+ TFP_4B_005 \
+ TFP_4B_006 \
+ TFP_4B_007 \
+ TFP_4B_008 \
+ TFP_4B_009 \
+ TFP_4C_001 \
+ TFP_4D_001 \
+ TFP_4D_002 \
+ TFP_4D_003 \
+ TFP_4D_004 \
+ TFP_4D_005 \
+ TFP_4D_006 \
+ TFP_4E_001 \
+ TFP_4E_002 \
+ TFP_4E_003 \
+ TFP_4E_004 \
+ TFP_4E_005 \
+ TFP_4E_006 \
+ TFP_4F_001 \
+ TFP_4F_002 \
+ TFP_4F_003 \
+ TFP_4F_004 \
+ TFP_4F_005 \
+ TFP_4F_006 \
+ TFP_4F_007 \
+ TFP_4F_008 \
+ TFP_4F_009 \
+ TFP_4F_010 \
+ TFP_4F_011 \
+ TFP_4F_012 \
+ TFP_4F_013 \
+ TFP_4F_014 \
+ TFP_4F_015 \
+ TFP_4F_016 \
+ TFP_4F_017 \
+ TFP_4F_018 \
+ TFP_4F_019 \
+ TFP_4G_001 \
+ TFP_4G_002 \
+ TFP_4G_003 \
+ TFP_4G_004 \
+ TFP_4G_005 \
+ TFP_4G_006 \
+ TFP_4G_007 \
+ TFP_4G_008 \
+ TFP_4G_009 \
+ TFP_4G_010 \
+ TFP_4G_011 \
+ TFP_4H_001 \
+ TFP_4I_001 \
+ TFP_4I_002 \
+ TFP_4I_003 \
+ TFP_4I_004 \
+ TFP_4I_005 \
+ TFP_4I_006 \
+ TFP_4I_007 \
+ TFP_4I_008 \
+ TFP_4I_009 \
+ TFP_4J_001 \
+ TFP_4J_002 \
+ TFP_4J_003 \
+ TFP_4J_004 \
+ TFP_4J_006 \
+ TFP_4J_007 \
+ TFP_51_001 \
+ TFP_51_002 \
+ TFP_53_001 \
+ TFP_53_002 \
+ TFP_53_003 \
+ TFP_53_004 \
+ TFP_53_005 \
+ TFP_53_006 \
+ TFP_54_001 \
+ TFP_54_002 \
+ TFP_54_003 \
+ TFP_61_001 \
+ TFP_61_002 \
+ TFP_62_001 \
+ TFP_62_002 \
+ TFP_63_001 \
+ TFP_63_002 \
+ TFP_63_003 \
+ TFP_71_001 \
+ TFP_71_003 \
+ TFP_74_001 \
+ TFP_74_002 \
+ TFP_74_003 \
+ TFP_75_001 \
+ TFP_75_002 \
+ TFP_75_003 \
+ TFP_75_004
+
+include $(top_srcdir)/scripts/config.mk
+include $(top_srcdir)/scripts/rules_class.mk
diff --git a/tests/TFP/TFP_01_001/Makefile b/tests/TFP/TFP_01_001/Makefile
new file mode 100644
index 0000000..43ba573
--- /dev/null
+++ b/tests/TFP/TFP_01_001/Makefile
@@ -0,0 +1,28 @@
+#
+# Copyright 2008 Sony Corporation
+#
+#
+# Permission is hereby granted, free of charge, to any person obtaining a copy
+# of this software and associated documentation files (the "Software"), to deal
+# in the Software without restriction, including without limitation the rights
+# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+# copies of the Software, and to permit persons to whom the Software is
+# furnished to do so, subject to the following conditions:
+#
+# The above copyright notice and this permission notice shall be included in
+# all copies or substantial portions of the Software.
+#
+# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+# THE SOFTWARE.
+#
+
+top_srcdir = ../..
+test_objs = host.o
+
+include $(top_srcdir)/scripts/config.mk
+include $(top_srcdir)/scripts/rules_item.mk
diff --git a/tests/TFP/TFP_01_001/host.c b/tests/TFP/TFP_01_001/host.c
new file mode 100644
index 0000000..a215113
--- /dev/null
+++ b/tests/TFP/TFP_01_001/host.c
@@ -0,0 +1,41 @@
+/*
+ * Copyright 2008 Sony Corporation
+ *
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a copy
+ * of this software and associated documentation files (the "Software"), to deal
+ * in the Software without restriction, including without limitation the rights
+ * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+ * copies of the Software, and to permit persons to whom the Software is
+ * furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included in
+ * all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+ * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+ * THE SOFTWARE.
+ */
+
+#include <libspe2.h>
+#include <mars/mars.h>
+#include <mars_test.h>
+
+static struct mars_context *mars;
+
+int main(void)
+{
+ int ret;
+
+ ret = mars_context_create(&mars, 1, 0);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+
+ ret = mars_context_destroy(mars);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+
+ return 0;
+}
diff --git a/tests/TFP/TFP_01_002/Makefile b/tests/TFP/TFP_01_002/Makefile
new file mode 100644
index 0000000..43ba573
--- /dev/null
+++ b/tests/TFP/TFP_01_002/Makefile
@@ -0,0 +1,28 @@
+#
+# Copyright 2008 Sony Corporation
+#
+#
+# Permission is hereby granted, free of charge, to any person obtaining a copy
+# of this software and associated documentation files (the "Software"), to deal
+# in the Software without restriction, including without limitation the rights
+# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+# copies of the Software, and to permit persons to whom the Software is
+# furnished to do so, subject to the following conditions:
+#
+# The above copyright notice and this permission notice shall be included in
+# all copies or substantial portions of the Software.
+#
+# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+# THE SOFTWARE.
+#
+
+top_srcdir = ../..
+test_objs = host.o
+
+include $(top_srcdir)/scripts/config.mk
+include $(top_srcdir)/scripts/rules_item.mk
diff --git a/tests/TFP/TFP_01_002/host.c b/tests/TFP/TFP_01_002/host.c
new file mode 100644
index 0000000..61ca56e
--- /dev/null
+++ b/tests/TFP/TFP_01_002/host.c
@@ -0,0 +1,44 @@
+/*
+ * Copyright 2008 Sony Corporation
+ *
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a copy
+ * of this software and associated documentation files (the "Software"), to deal
+ * in the Software without restriction, including without limitation the rights
+ * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+ * copies of the Software, and to permit persons to whom the Software is
+ * furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included in
+ * all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+ * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+ * THE SOFTWARE.
+ */
+
+#include <libspe2.h>
+#include <mars/mars.h>
+#include <mars_test.h>
+
+static struct mars_context *mars;
+
+int main(void)
+{
+ int ret;
+ int spe_cnt = spe_cpu_info_get(SPE_COUNT_PHYSICAL_SPES, -1);
+
+ ret = mars_context_create(&mars, spe_cnt, 0);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+
+ ret = mars_context_destroy(mars);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+
+ return 0;
+}
+
+
diff --git a/tests/TFP/TFP_01_003/Makefile b/tests/TFP/TFP_01_003/Makefile
new file mode 100644
index 0000000..43ba573
--- /dev/null
+++ b/tests/TFP/TFP_01_003/Makefile
@@ -0,0 +1,28 @@
+#
+# Copyright 2008 Sony Corporation
+#
+#
+# Permission is hereby granted, free of charge, to any person obtaining a copy
+# of this software and associated documentation files (the "Software"), to deal
+# in the Software without restriction, including without limitation the rights
+# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+# copies of the Software, and to permit persons to whom the Software is
+# furnished to do so, subject to the following conditions:
+#
+# The above copyright notice and this permission notice shall be included in
+# all copies or substantial portions of the Software.
+#
+# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+# THE SOFTWARE.
+#
+
+top_srcdir = ../..
+test_objs = host.o
+
+include $(top_srcdir)/scripts/config.mk
+include $(top_srcdir)/scripts/rules_item.mk
diff --git a/tests/TFP/TFP_01_003/host.c b/tests/TFP/TFP_01_003/host.c
new file mode 100644
index 0000000..cd073c3
--- /dev/null
+++ b/tests/TFP/TFP_01_003/host.c
@@ -0,0 +1,65 @@
+/*
+ * Copyright 2008 Sony Corporation
+ *
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a copy
+ * of this software and associated documentation files (the "Software"), to deal
+ * in the Software without restriction, including without limitation the rights
+ * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+ * copies of the Software, and to permit persons to whom the Software is
+ * furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included in
+ * all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+ * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+ * THE SOFTWARE.
+ */
+
+#include <pthread.h>
+#include <libspe2.h>
+#include <mars/mars.h>
+#include <mars_test.h>
+
+#define THREAD_COUNT 16
+
+static pthread_t thread_handles[THREAD_COUNT];
+static struct mars_context *mars_contexts[THREAD_COUNT];
+
+void *thread_proc(void *arg)
+{
+ int ret;
+
+ ret = mars_context_create(
+ &mars_contexts[mars_ptr_to_ea(arg)],
+ 1,
+ 0);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+
+ ret = mars_context_destroy(mars_contexts[mars_ptr_to_ea(arg)]);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+
+ return NULL;
+}
+
+int main(void)
+{
+ int i;
+
+ for (i = 0; i < THREAD_COUNT; i++)
+ pthread_create(
+ &thread_handles[i],
+ NULL,
+ thread_proc,
+ (void *)(intptr_t)i);
+
+ for (i = 0; i < THREAD_COUNT; i++)
+ pthread_join(thread_handles[i], NULL);
+
+ return 0;
+}
diff --git a/tests/TFP/TFP_01_004/Makefile b/tests/TFP/TFP_01_004/Makefile
new file mode 100644
index 0000000..43ba573
--- /dev/null
+++ b/tests/TFP/TFP_01_004/Makefile
@@ -0,0 +1,28 @@
+#
+# Copyright 2008 Sony Corporation
+#
+#
+# Permission is hereby granted, free of charge, to any person obtaining a copy
+# of this software and associated documentation files (the "Software"), to deal
+# in the Software without restriction, including without limitation the rights
+# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+# copies of the Software, and to permit persons to whom the Software is
+# furnished to do so, subject to the following conditions:
+#
+# The above copyright notice and this permission notice shall be included in
+# all copies or substantial portions of the Software.
+#
+# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+# THE SOFTWARE.
+#
+
+top_srcdir = ../..
+test_objs = host.o
+
+include $(top_srcdir)/scripts/config.mk
+include $(top_srcdir)/scripts/rules_item.mk
diff --git a/tests/TFP/TFP_01_004/host.c b/tests/TFP/TFP_01_004/host.c
new file mode 100644
index 0000000..74e7be4
--- /dev/null
+++ b/tests/TFP/TFP_01_004/host.c
@@ -0,0 +1,74 @@
+/*
+ * Copyright 2008 Sony Corporation
+ *
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a copy
+ * of this software and associated documentation files (the "Software"), to deal
+ * in the Software without restriction, including without limitation the rights
+ * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+ * copies of the Software, and to permit persons to whom the Software is
+ * furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included in
+ * all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+ * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+ * THE SOFTWARE.
+ */
+
+#include <pthread.h>
+#include <libspe2.h>
+#include <mars/mars.h>
+#include <mars_test.h>
+
+#define THREAD_COUNT 16
+
+static pthread_t thread_handles_1[THREAD_COUNT];
+static pthread_t thread_handles_2[THREAD_COUNT];
+static struct mars_context *mars_contexts_1[THREAD_COUNT];
+static struct mars_context *mars_contexts_2[THREAD_COUNT];
+
+void *thread_proc(void *arg)
+{
+ int ret;
+
+ ret = mars_context_create((struct mars_context **)arg, 1, 0);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+
+ ret = mars_context_destroy(*((struct mars_context **)arg));
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+
+ return NULL;
+}
+
+int main(void)
+{
+ int i;
+
+ for (i = 0; i < THREAD_COUNT; i++)
+ pthread_create(
+ &thread_handles_1[i],
+ NULL,
+ thread_proc,
+ (void *)&mars_contexts_1[i]);
+
+ for (i = 0; i < THREAD_COUNT; i++)
+ pthread_create(
+ &thread_handles_2[i],
+ NULL,
+ thread_proc,
+ (void *)&mars_contexts_2[i]);
+
+ for (i = 0; i < THREAD_COUNT; i++)
+ pthread_join(thread_handles_1[i], NULL);
+
+ for (i = 0; i < THREAD_COUNT; i++)
+ pthread_join(thread_handles_2[i], NULL);
+
+ return 0;
+}
diff --git a/tests/TFP/TFP_01_005/Makefile b/tests/TFP/TFP_01_005/Makefile
new file mode 100644
index 0000000..43ba573
--- /dev/null
+++ b/tests/TFP/TFP_01_005/Makefile
@@ -0,0 +1,28 @@
+#
+# Copyright 2008 Sony Corporation
+#
+#
+# Permission is hereby granted, free of charge, to any person obtaining a copy
+# of this software and associated documentation files (the "Software"), to deal
+# in the Software without restriction, including without limitation the rights
+# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+# copies of the Software, and to permit persons to whom the Software is
+# furnished to do so, subject to the following conditions:
+#
+# The above copyright notice and this permission notice shall be included in
+# all copies or substantial portions of the Software.
+#
+# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+# THE SOFTWARE.
+#
+
+top_srcdir = ../..
+test_objs = host.o
+
+include $(top_srcdir)/scripts/config.mk
+include $(top_srcdir)/scripts/rules_item.mk
diff --git a/tests/TFP/TFP_01_005/host.c b/tests/TFP/TFP_01_005/host.c
new file mode 100644
index 0000000..5f05bed
--- /dev/null
+++ b/tests/TFP/TFP_01_005/host.c
@@ -0,0 +1,39 @@
+/*
+ * Copyright (C) 2008 Sony Computer Entertainment Inc.
+ *
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a copy
+ * of this software and associated documentation files (the "Software"), to deal
+ * in the Software without restriction, including without limitation the rights
+ * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+ * copies of the Software, and to permit persons to whom the Software is
+ * furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included in
+ * all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+ * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+ * THE SOFTWARE.
+ */
+
+#include <libspe2.h>
+#include <mars/mars.h>
+#include <mars_test.h>
+
+static struct mars_context *mars1, *mars2;
+
+int main(void)
+{
+ MARS_TEST_ASSERT_ERROR(mars_context_create(&mars1, 0, 1), MARS_SUCCESS);
+ MARS_TEST_ASSERT_ERROR(mars_context_create(&mars2, 0, 1), MARS_SUCCESS);
+ MARS_TEST_ASSERT(mars1 == mars2);
+ MARS_TEST_ASSERT_ERROR(mars_context_destroy(mars2), MARS_SUCCESS);
+ MARS_TEST_ASSERT_ERROR(mars_context_destroy(mars1), MARS_SUCCESS);
+
+ return 0;
+}
diff --git a/tests/TFP/TFP_02_001/Makefile b/tests/TFP/TFP_02_001/Makefile
new file mode 100644
index 0000000..43ba573
--- /dev/null
+++ b/tests/TFP/TFP_02_001/Makefile
@@ -0,0 +1,28 @@
+#
+# Copyright 2008 Sony Corporation
+#
+#
+# Permission is hereby granted, free of charge, to any person obtaining a copy
+# of this software and associated documentation files (the "Software"), to deal
+# in the Software without restriction, including without limitation the rights
+# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+# copies of the Software, and to permit persons to whom the Software is
+# furnished to do so, subject to the following conditions:
+#
+# The above copyright notice and this permission notice shall be included in
+# all copies or substantial portions of the Software.
+#
+# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+# THE SOFTWARE.
+#
+
+top_srcdir = ../..
+test_objs = host.o
+
+include $(top_srcdir)/scripts/config.mk
+include $(top_srcdir)/scripts/rules_item.mk
diff --git a/tests/TFP/TFP_02_001/host.c b/tests/TFP/TFP_02_001/host.c
new file mode 100644
index 0000000..a315f56
--- /dev/null
+++ b/tests/TFP/TFP_02_001/host.c
@@ -0,0 +1,43 @@
+/*
+ * Copyright 2008 Sony Corporation
+ *
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a copy
+ * of this software and associated documentation files (the "Software"), to deal
+ * in the Software without restriction, including without limitation the rights
+ * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+ * copies of the Software, and to permit persons to whom the Software is
+ * furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included in
+ * all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+ * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+ * THE SOFTWARE.
+ */
+
+#include <libspe2.h>
+#include <mars/mars.h>
+#include <mars_test.h>
+
+static struct mars_context *mars;
+
+int main(void)
+{
+ int ret;
+ int spe_cnt = spe_cpu_info_get(SPE_COUNT_PHYSICAL_SPES, -1);
+
+ ret = mars_context_create(&mars, spe_cnt, 0);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+
+ ret = mars_context_destroy(mars);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+
+ return 0;
+}
+
diff --git a/tests/TFP/TFP_02_002/Makefile b/tests/TFP/TFP_02_002/Makefile
new file mode 100644
index 0000000..43ba573
--- /dev/null
+++ b/tests/TFP/TFP_02_002/Makefile
@@ -0,0 +1,28 @@
+#
+# Copyright 2008 Sony Corporation
+#
+#
+# Permission is hereby granted, free of charge, to any person obtaining a copy
+# of this software and associated documentation files (the "Software"), to deal
+# in the Software without restriction, including without limitation the rights
+# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+# copies of the Software, and to permit persons to whom the Software is
+# furnished to do so, subject to the following conditions:
+#
+# The above copyright notice and this permission notice shall be included in
+# all copies or substantial portions of the Software.
+#
+# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+# THE SOFTWARE.
+#
+
+top_srcdir = ../..
+test_objs = host.o
+
+include $(top_srcdir)/scripts/config.mk
+include $(top_srcdir)/scripts/rules_item.mk
diff --git a/tests/TFP/TFP_02_002/host.c b/tests/TFP/TFP_02_002/host.c
new file mode 100644
index 0000000..83dc217
--- /dev/null
+++ b/tests/TFP/TFP_02_002/host.c
@@ -0,0 +1,64 @@
+/*
+ * Copyright 2008 Sony Corporation
+ *
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a copy
+ * of this software and associated documentation files (the "Software"), to deal
+ * in the Software without restriction, including without limitation the rights
+ * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+ * copies of the Software, and to permit persons to whom the Software is
+ * furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included in
+ * all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+ * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+ * THE SOFTWARE.
+ */
+
+#include <pthread.h>
+#include <libspe2.h>
+#include <mars/mars.h>
+#include <mars_test.h>
+
+#define THREAD_COUNT 16
+
+static pthread_t thread_handles[THREAD_COUNT];
+static struct mars_context *mars_contexts[THREAD_COUNT];
+
+void *thread_proc(void *arg)
+{
+ int ret;
+
+ ret = mars_context_create(
+ &mars_contexts[mars_ptr_to_ea(arg)],
+ 1,
+ 0);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+
+ ret = mars_context_destroy(mars_contexts[mars_ptr_to_ea(arg)]);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+
+ return NULL;
+}
+
+int main(void)
+{
+ int i;
+
+ for (i = 0; i < THREAD_COUNT; i++)
+ pthread_create(&thread_handles[i],
+ NULL,
+ thread_proc,
+ (void *)(intptr_t)i);
+
+ for (i = 0; i < THREAD_COUNT; i++)
+ pthread_join(thread_handles[i], NULL);
+
+ return 0;
+}
diff --git a/tests/TFP/TFP_11_001/Makefile b/tests/TFP/TFP_11_001/Makefile
new file mode 100644
index 0000000..432135a
--- /dev/null
+++ b/tests/TFP/TFP_11_001/Makefile
@@ -0,0 +1,28 @@
+#
+# Copyright 2008 Sony Corporation
+#
+#
+# Permission is hereby granted, free of charge, to any person obtaining a copy
+# of this software and associated documentation files (the "Software"), to deal
+# in the Software without restriction, including without limitation the rights
+# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+# copies of the Software, and to permit persons to whom the Software is
+# furnished to do so, subject to the following conditions:
+#
+# The above copyright notice and this permission notice shall be included in
+# all copies or substantial portions of the Software.
+#
+# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+# THE SOFTWARE.
+#
+
+top_srcdir = ../..
+test_objs = host.o mpu.task_eo
+
+include $(top_srcdir)/scripts/config.mk
+include $(top_srcdir)/scripts/rules_item.mk
diff --git a/tests/TFP/TFP_11_001/host.c b/tests/TFP/TFP_11_001/host.c
new file mode 100644
index 0000000..5b54eb4
--- /dev/null
+++ b/tests/TFP/TFP_11_001/host.c
@@ -0,0 +1,50 @@
+/*
+ * Copyright 2008 Sony Corporation
+ *
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a copy
+ * of this software and associated documentation files (the "Software"), to deal
+ * in the Software without restriction, including without limitation the rights
+ * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+ * copies of the Software, and to permit persons to whom the Software is
+ * furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included in
+ * all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+ * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+ * THE SOFTWARE.
+ */
+
+#include <libspe2.h>
+#include <mars/mars.h>
+#include <mars_test.h>
+
+extern spe_program_handle_t mpu_prog;
+
+static struct mars_context *mars;
+static struct mars_task_id task_id;
+
+int main(void)
+{
+ int ret;
+
+ ret = mars_context_create(&mars, 1, 0);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+
+ ret = mars_task_create(mars, &task_id, NULL, mpu_prog.elf_image, 0);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+
+ ret = mars_task_destroy(&task_id);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+
+ ret = mars_context_destroy(mars);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+
+ return 0;
+}
diff --git a/tests/TFP/TFP_11_001/mpu.c b/tests/TFP/TFP_11_001/mpu.c
new file mode 100644
index 0000000..c26f42b
--- /dev/null
+++ b/tests/TFP/TFP_11_001/mpu.c
@@ -0,0 +1,29 @@
+/*
+ * Copyright 2008 Sony Corporation
+ *
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a copy
+ * of this software and associated documentation files (the "Software"), to deal
+ * in the Software without restriction, including without limitation the rights
+ * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+ * copies of the Software, and to permit persons to whom the Software is
+ * furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included in
+ * all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+ * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+ * THE SOFTWARE.
+ */
+
+#include <mars/mars.h>
+
+int mars_task_main(const struct mars_task_args *task_args)
+{
+ return 0;
+}
diff --git a/tests/TFP/TFP_11_002/Makefile b/tests/TFP/TFP_11_002/Makefile
new file mode 100644
index 0000000..432135a
--- /dev/null
+++ b/tests/TFP/TFP_11_002/Makefile
@@ -0,0 +1,28 @@
+#
+# Copyright 2008 Sony Corporation
+#
+#
+# Permission is hereby granted, free of charge, to any person obtaining a copy
+# of this software and associated documentation files (the "Software"), to deal
+# in the Software without restriction, including without limitation the rights
+# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+# copies of the Software, and to permit persons to whom the Software is
+# furnished to do so, subject to the following conditions:
+#
+# The above copyright notice and this permission notice shall be included in
+# all copies or substantial portions of the Software.
+#
+# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+# THE SOFTWARE.
+#
+
+top_srcdir = ../..
+test_objs = host.o mpu.task_eo
+
+include $(top_srcdir)/scripts/config.mk
+include $(top_srcdir)/scripts/rules_item.mk
diff --git a/tests/TFP/TFP_11_002/host.c b/tests/TFP/TFP_11_002/host.c
new file mode 100644
index 0000000..082e251
--- /dev/null
+++ b/tests/TFP/TFP_11_002/host.c
@@ -0,0 +1,55 @@
+/*
+ * Copyright 2008 Sony Corporation
+ *
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a copy
+ * of this software and associated documentation files (the "Software"), to deal
+ * in the Software without restriction, including without limitation the rights
+ * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+ * copies of the Software, and to permit persons to whom the Software is
+ * furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included in
+ * all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+ * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+ * THE SOFTWARE.
+ */
+
+#include <libspe2.h>
+#include <mars/mars.h>
+#include <mars_test.h>
+
+extern spe_program_handle_t mpu_prog;
+
+static struct mars_context *mars;
+static struct mars_task_id task_id;
+
+int main(void)
+{
+ int ret;
+
+ ret = mars_context_create(&mars, 1, 0);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+
+ ret = mars_task_create(
+ mars,
+ &task_id,
+ NULL,
+ mpu_prog.elf_image,
+ MARS_TASK_CONTEXT_SAVE_ALL);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+
+ ret = mars_task_destroy(&task_id);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+
+ ret = mars_context_destroy(mars);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+
+ return 0;
+}
diff --git a/tests/TFP/TFP_11_002/mpu.c b/tests/TFP/TFP_11_002/mpu.c
new file mode 100644
index 0000000..c26f42b
--- /dev/null
+++ b/tests/TFP/TFP_11_002/mpu.c
@@ -0,0 +1,29 @@
+/*
+ * Copyright 2008 Sony Corporation
+ *
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a copy
+ * of this software and associated documentation files (the "Software"), to deal
+ * in the Software without restriction, including without limitation the rights
+ * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+ * copies of the Software, and to permit persons to whom the Software is
+ * furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included in
+ * all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+ * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+ * THE SOFTWARE.
+ */
+
+#include <mars/mars.h>
+
+int mars_task_main(const struct mars_task_args *task_args)
+{
+ return 0;
+}
diff --git a/tests/TFP/TFP_11_003/Makefile b/tests/TFP/TFP_11_003/Makefile
new file mode 100644
index 0000000..432135a
--- /dev/null
+++ b/tests/TFP/TFP_11_003/Makefile
@@ -0,0 +1,28 @@
+#
+# Copyright 2008 Sony Corporation
+#
+#
+# Permission is hereby granted, free of charge, to any person obtaining a copy
+# of this software and associated documentation files (the "Software"), to deal
+# in the Software without restriction, including without limitation the rights
+# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+# copies of the Software, and to permit persons to whom the Software is
+# furnished to do so, subject to the following conditions:
+#
+# The above copyright notice and this permission notice shall be included in
+# all copies or substantial portions of the Software.
+#
+# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+# THE SOFTWARE.
+#
+
+top_srcdir = ../..
+test_objs = host.o mpu.task_eo
+
+include $(top_srcdir)/scripts/config.mk
+include $(top_srcdir)/scripts/rules_item.mk
diff --git a/tests/TFP/TFP_11_003/host.c b/tests/TFP/TFP_11_003/host.c
new file mode 100644
index 0000000..82fa3f9
--- /dev/null
+++ b/tests/TFP/TFP_11_003/host.c
@@ -0,0 +1,67 @@
+/*
+ * Copyright 2008 Sony Corporation
+ *
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a copy
+ * of this software and associated documentation files (the "Software"), to deal
+ * in the Software without restriction, including without limitation the rights
+ * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+ * copies of the Software, and to permit persons to whom the Software is
+ * furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included in
+ * all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+ * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+ * THE SOFTWARE.
+ */
+
+#include <libspe2.h>
+#include <mars/mars.h>
+#include <mars_test.h>
+
+#define MAX_TASKS 256
+
+extern spe_program_handle_t mpu_prog;
+
+static struct mars_context *mars;
+static struct mars_task_id task_ids[MAX_TASKS];
+
+int main(void)
+{
+ int i, ret;
+ int spe_cnt = spe_cpu_info_get(SPE_COUNT_PHYSICAL_SPES, -1);
+
+ MARS_TEST_ASSERT(spe_cnt <= MAX_TASKS);
+
+ if (spe_cnt > MAX_TASKS)
+ spe_cnt = MAX_TASKS;
+
+ ret = mars_context_create(&mars, spe_cnt, 0);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+
+ for (i = 0; i < spe_cnt; i++) {
+ ret = mars_task_create(
+ mars,
+ &task_ids[i],
+ NULL,
+ mpu_prog.elf_image,
+ 0);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+ }
+
+ for (i = 0; i < spe_cnt; i++) {
+ ret = mars_task_destroy(&task_ids[i]);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+ }
+
+ ret = mars_context_destroy(mars);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+
+ return 0;
+}
diff --git a/tests/TFP/TFP_11_003/mpu.c b/tests/TFP/TFP_11_003/mpu.c
new file mode 100644
index 0000000..c26f42b
--- /dev/null
+++ b/tests/TFP/TFP_11_003/mpu.c
@@ -0,0 +1,29 @@
+/*
+ * Copyright 2008 Sony Corporation
+ *
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a copy
+ * of this software and associated documentation files (the "Software"), to deal
+ * in the Software without restriction, including without limitation the rights
+ * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+ * copies of the Software, and to permit persons to whom the Software is
+ * furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included in
+ * all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+ * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+ * THE SOFTWARE.
+ */
+
+#include <mars/mars.h>
+
+int mars_task_main(const struct mars_task_args *task_args)
+{
+ return 0;
+}
diff --git a/tests/TFP/TFP_11_004/Makefile b/tests/TFP/TFP_11_004/Makefile
new file mode 100644
index 0000000..432135a
--- /dev/null
+++ b/tests/TFP/TFP_11_004/Makefile
@@ -0,0 +1,28 @@
+#
+# Copyright 2008 Sony Corporation
+#
+#
+# Permission is hereby granted, free of charge, to any person obtaining a copy
+# of this software and associated documentation files (the "Software"), to deal
+# in the Software without restriction, including without limitation the rights
+# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+# copies of the Software, and to permit persons to whom the Software is
+# furnished to do so, subject to the following conditions:
+#
+# The above copyright notice and this permission notice shall be included in
+# all copies or substantial portions of the Software.
+#
+# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+# THE SOFTWARE.
+#
+
+top_srcdir = ../..
+test_objs = host.o mpu.task_eo
+
+include $(top_srcdir)/scripts/config.mk
+include $(top_srcdir)/scripts/rules_item.mk
diff --git a/tests/TFP/TFP_11_004/host.c b/tests/TFP/TFP_11_004/host.c
new file mode 100644
index 0000000..af3c07f
--- /dev/null
+++ b/tests/TFP/TFP_11_004/host.c
@@ -0,0 +1,65 @@
+/*
+ * Copyright 2008 Sony Corporation
+ *
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a copy
+ * of this software and associated documentation files (the "Software"), to deal
+ * in the Software without restriction, including without limitation the rights
+ * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+ * copies of the Software, and to permit persons to whom the Software is
+ * furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included in
+ * all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+ * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+ * THE SOFTWARE.
+ */
+
+#include <libspe2.h>
+#include <mars/mars.h>
+#include <mars_test.h>
+
+#define MAX_TASKS 256
+
+extern spe_program_handle_t mpu_prog;
+
+static struct mars_context *mars;
+static struct mars_task_id task_ids[MAX_TASKS];
+
+int main(void)
+{
+ int i, ret;
+ int spe_cnt = spe_cpu_info_get(SPE_COUNT_PHYSICAL_SPES, -1);
+ int task_count = spe_cnt + 1;
+
+ MARS_TEST_ASSERT(task_count <= MAX_TASKS);
+
+ ret = mars_context_create(&mars, spe_cnt, 0);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+
+ for (i = 0; i < task_count; i++) {
+ ret = mars_task_create(
+ mars,
+ &task_ids[i],
+ NULL,
+ mpu_prog.elf_image,
+ 0);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+ }
+
+ for (i = 0; i < task_count; i++) {
+ ret = mars_task_destroy(&task_ids[i]);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+ }
+
+ ret = mars_context_destroy(mars);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+
+ return 0;
+}
diff --git a/tests/TFP/TFP_11_004/mpu.c b/tests/TFP/TFP_11_004/mpu.c
new file mode 100644
index 0000000..c26f42b
--- /dev/null
+++ b/tests/TFP/TFP_11_004/mpu.c
@@ -0,0 +1,29 @@
+/*
+ * Copyright 2008 Sony Corporation
+ *
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a copy
+ * of this software and associated documentation files (the "Software"), to deal
+ * in the Software without restriction, including without limitation the rights
+ * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+ * copies of the Software, and to permit persons to whom the Software is
+ * furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included in
+ * all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+ * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+ * THE SOFTWARE.
+ */
+
+#include <mars/mars.h>
+
+int mars_task_main(const struct mars_task_args *task_args)
+{
+ return 0;
+}
diff --git a/tests/TFP/TFP_11_005/Makefile b/tests/TFP/TFP_11_005/Makefile
new file mode 100644
index 0000000..432135a
--- /dev/null
+++ b/tests/TFP/TFP_11_005/Makefile
@@ -0,0 +1,28 @@
+#
+# Copyright 2008 Sony Corporation
+#
+#
+# Permission is hereby granted, free of charge, to any person obtaining a copy
+# of this software and associated documentation files (the "Software"), to deal
+# in the Software without restriction, including without limitation the rights
+# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+# copies of the Software, and to permit persons to whom the Software is
+# furnished to do so, subject to the following conditions:
+#
+# The above copyright notice and this permission notice shall be included in
+# all copies or substantial portions of the Software.
+#
+# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+# THE SOFTWARE.
+#
+
+top_srcdir = ../..
+test_objs = host.o mpu.task_eo
+
+include $(top_srcdir)/scripts/config.mk
+include $(top_srcdir)/scripts/rules_item.mk
diff --git a/tests/TFP/TFP_11_005/host.c b/tests/TFP/TFP_11_005/host.c
new file mode 100644
index 0000000..f0e587d
--- /dev/null
+++ b/tests/TFP/TFP_11_005/host.c
@@ -0,0 +1,61 @@
+/*
+ * Copyright 2008 Sony Corporation
+ *
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a copy
+ * of this software and associated documentation files (the "Software"), to deal
+ * in the Software without restriction, including without limitation the rights
+ * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+ * copies of the Software, and to permit persons to whom the Software is
+ * furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included in
+ * all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+ * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+ * THE SOFTWARE.
+ */
+
+#include <libspe2.h>
+#include <mars/mars.h>
+#include <mars_test.h>
+
+#define MARS_WORKLOAD_MAX 1500
+
+extern spe_program_handle_t mpu_prog;
+
+static struct mars_context *mars;
+static struct mars_task_id task_ids[MARS_WORKLOAD_MAX];
+
+int main(void)
+{
+ int i, ret;
+
+ ret = mars_context_create(&mars, 0, 0);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+
+ for (i = 0; i < MARS_WORKLOAD_MAX; i++) {
+ ret = mars_task_create(
+ mars,
+ &task_ids[i],
+ NULL,
+ mpu_prog.elf_image,
+ 0);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+ }
+
+ for (i = 0; i < MARS_WORKLOAD_MAX; i++) {
+ ret = mars_task_destroy(&task_ids[i]);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+ }
+
+ ret = mars_context_destroy(mars);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+
+ return 0;
+}
diff --git a/tests/TFP/TFP_11_005/mpu.c b/tests/TFP/TFP_11_005/mpu.c
new file mode 100644
index 0000000..c26f42b
--- /dev/null
+++ b/tests/TFP/TFP_11_005/mpu.c
@@ -0,0 +1,29 @@
+/*
+ * Copyright 2008 Sony Corporation
+ *
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a copy
+ * of this software and associated documentation files (the "Software"), to deal
+ * in the Software without restriction, including without limitation the rights
+ * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+ * copies of the Software, and to permit persons to whom the Software is
+ * furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included in
+ * all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+ * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+ * THE SOFTWARE.
+ */
+
+#include <mars/mars.h>
+
+int mars_task_main(const struct mars_task_args *task_args)
+{
+ return 0;
+}
diff --git a/tests/TFP/TFP_11_006/Makefile b/tests/TFP/TFP_11_006/Makefile
new file mode 100644
index 0000000..432135a
--- /dev/null
+++ b/tests/TFP/TFP_11_006/Makefile
@@ -0,0 +1,28 @@
+#
+# Copyright 2008 Sony Corporation
+#
+#
+# Permission is hereby granted, free of charge, to any person obtaining a copy
+# of this software and associated documentation files (the "Software"), to deal
+# in the Software without restriction, including without limitation the rights
+# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+# copies of the Software, and to permit persons to whom the Software is
+# furnished to do so, subject to the following conditions:
+#
+# The above copyright notice and this permission notice shall be included in
+# all copies or substantial portions of the Software.
+#
+# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+# THE SOFTWARE.
+#
+
+top_srcdir = ../..
+test_objs = host.o mpu.task_eo
+
+include $(top_srcdir)/scripts/config.mk
+include $(top_srcdir)/scripts/rules_item.mk
diff --git a/tests/TFP/TFP_11_006/host.c b/tests/TFP/TFP_11_006/host.c
new file mode 100644
index 0000000..bfbb7e6
--- /dev/null
+++ b/tests/TFP/TFP_11_006/host.c
@@ -0,0 +1,77 @@
+/*
+ * Copyright 2008 Sony Corporation
+ *
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a copy
+ * of this software and associated documentation files (the "Software"), to deal
+ * in the Software without restriction, including without limitation the rights
+ * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+ * copies of the Software, and to permit persons to whom the Software is
+ * furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included in
+ * all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+ * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+ * THE SOFTWARE.
+ */
+
+#include <pthread.h>
+#include <libspe2.h>
+#include <mars/mars.h>
+#include <mars_test.h>
+
+#define TASK_COUNT 16
+
+extern spe_program_handle_t mpu_prog;
+
+static struct mars_context *mars;
+static struct mars_task_id task_ids[TASK_COUNT];
+static pthread_t thread_handles[TASK_COUNT];
+
+void *thread_proc(void *arg)
+{
+ int ret;
+
+ ret = mars_task_create(
+ mars,
+ (struct mars_task_id *)arg,
+ NULL,
+ mpu_prog.elf_image,
+ 0);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+
+ ret = mars_task_destroy((struct mars_task_id *)arg);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+
+ return NULL;
+}
+
+int main(void)
+{
+ int i, ret;
+ int spe_cnt = spe_cpu_info_get(SPE_COUNT_PHYSICAL_SPES, -1);
+
+ ret = mars_context_create(&mars, spe_cnt, 0);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+
+ for (i = 0; i < TASK_COUNT; i++)
+ pthread_create(
+ &thread_handles[i],
+ NULL,
+ thread_proc,
+ (void *)&task_ids[i]);
+
+ for (i = 0; i < TASK_COUNT; i++)
+ pthread_join(thread_handles[i], NULL);
+
+ ret = mars_context_destroy(mars);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+
+ return 0;
+}
diff --git a/tests/TFP/TFP_11_006/mpu.c b/tests/TFP/TFP_11_006/mpu.c
new file mode 100644
index 0000000..c26f42b
--- /dev/null
+++ b/tests/TFP/TFP_11_006/mpu.c
@@ -0,0 +1,29 @@
+/*
+ * Copyright 2008 Sony Corporation
+ *
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a copy
+ * of this software and associated documentation files (the "Software"), to deal
+ * in the Software without restriction, including without limitation the rights
+ * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+ * copies of the Software, and to permit persons to whom the Software is
+ * furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included in
+ * all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+ * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+ * THE SOFTWARE.
+ */
+
+#include <mars/mars.h>
+
+int mars_task_main(const struct mars_task_args *task_args)
+{
+ return 0;
+}
diff --git a/tests/TFP/TFP_11_007/Makefile b/tests/TFP/TFP_11_007/Makefile
new file mode 100644
index 0000000..432135a
--- /dev/null
+++ b/tests/TFP/TFP_11_007/Makefile
@@ -0,0 +1,28 @@
+#
+# Copyright 2008 Sony Corporation
+#
+#
+# Permission is hereby granted, free of charge, to any person obtaining a copy
+# of this software and associated documentation files (the "Software"), to deal
+# in the Software without restriction, including without limitation the rights
+# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+# copies of the Software, and to permit persons to whom the Software is
+# furnished to do so, subject to the following conditions:
+#
+# The above copyright notice and this permission notice shall be included in
+# all copies or substantial portions of the Software.
+#
+# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+# THE SOFTWARE.
+#
+
+top_srcdir = ../..
+test_objs = host.o mpu.task_eo
+
+include $(top_srcdir)/scripts/config.mk
+include $(top_srcdir)/scripts/rules_item.mk
diff --git a/tests/TFP/TFP_11_007/host.c b/tests/TFP/TFP_11_007/host.c
new file mode 100644
index 0000000..ac876c0
--- /dev/null
+++ b/tests/TFP/TFP_11_007/host.c
@@ -0,0 +1,89 @@
+/*
+ * Copyright 2008 Sony Corporation
+ *
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a copy
+ * of this software and associated documentation files (the "Software"), to deal
+ * in the Software without restriction, including without limitation the rights
+ * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+ * copies of the Software, and to permit persons to whom the Software is
+ * furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included in
+ * all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+ * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+ * THE SOFTWARE.
+ */
+
+#include <pthread.h>
+#include <libspe2.h>
+#include <mars/mars.h>
+#include <mars_test.h>
+
+#define TASK_COUNT 16
+
+extern spe_program_handle_t mpu_prog;
+
+static struct mars_context *mars;
+static struct mars_task_id task_ids_1[TASK_COUNT];
+static struct mars_task_id task_ids_2[TASK_COUNT];
+static pthread_t thread_handles_1[TASK_COUNT];
+static pthread_t thread_handles_2[TASK_COUNT];
+
+void *thread_proc(void *arg)
+{
+ int ret;
+
+ ret = mars_task_create(
+ mars,
+ (struct mars_task_id *)arg,
+ NULL,
+ mpu_prog.elf_image,
+ 0);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+
+ ret = mars_task_destroy((struct mars_task_id *)arg);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+
+ return NULL;
+}
+
+int main(void)
+{
+ int i, ret;
+ int spe_cnt = spe_cpu_info_get(SPE_COUNT_PHYSICAL_SPES, -1);
+
+ ret = mars_context_create(&mars, spe_cnt, 0);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+
+ for (i = 0; i < TASK_COUNT; i++)
+ pthread_create(
+ &thread_handles_1[i],
+ NULL,
+ thread_proc,
+ (void *)&task_ids_1[i]);
+
+ for (i = 0; i < TASK_COUNT; i++)
+ pthread_create(
+ &thread_handles_2[i],
+ NULL,
+ thread_proc,
+ (void *)&task_ids_2[i]);
+
+ for (i = 0; i < TASK_COUNT; i++)
+ pthread_join(thread_handles_1[i], NULL);
+
+ for (i = 0; i < TASK_COUNT; i++)
+ pthread_join(thread_handles_2[i], NULL);
+
+ ret = mars_context_destroy(mars);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+
+ return 0;
+}
diff --git a/tests/TFP/TFP_11_007/mpu.c b/tests/TFP/TFP_11_007/mpu.c
new file mode 100644
index 0000000..c26f42b
--- /dev/null
+++ b/tests/TFP/TFP_11_007/mpu.c
@@ -0,0 +1,29 @@
+/*
+ * Copyright 2008 Sony Corporation
+ *
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a copy
+ * of this software and associated documentation files (the "Software"), to deal
+ * in the Software without restriction, including without limitation the rights
+ * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+ * copies of the Software, and to permit persons to whom the Software is
+ * furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included in
+ * all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+ * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+ * THE SOFTWARE.
+ */
+
+#include <mars/mars.h>
+
+int mars_task_main(const struct mars_task_args *task_args)
+{
+ return 0;
+}
diff --git a/tests/TFP/TFP_11_008/Makefile b/tests/TFP/TFP_11_008/Makefile
new file mode 100644
index 0000000..432135a
--- /dev/null
+++ b/tests/TFP/TFP_11_008/Makefile
@@ -0,0 +1,28 @@
+#
+# Copyright 2008 Sony Corporation
+#
+#
+# Permission is hereby granted, free of charge, to any person obtaining a copy
+# of this software and associated documentation files (the "Software"), to deal
+# in the Software without restriction, including without limitation the rights
+# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+# copies of the Software, and to permit persons to whom the Software is
+# furnished to do so, subject to the following conditions:
+#
+# The above copyright notice and this permission notice shall be included in
+# all copies or substantial portions of the Software.
+#
+# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+# THE SOFTWARE.
+#
+
+top_srcdir = ../..
+test_objs = host.o mpu.task_eo
+
+include $(top_srcdir)/scripts/config.mk
+include $(top_srcdir)/scripts/rules_item.mk
diff --git a/tests/TFP/TFP_11_008/host.c b/tests/TFP/TFP_11_008/host.c
new file mode 100644
index 0000000..410bcbe
--- /dev/null
+++ b/tests/TFP/TFP_11_008/host.c
@@ -0,0 +1,63 @@
+/*
+ * Copyright 2008 Sony Corporation
+ *
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a copy
+ * of this software and associated documentation files (the "Software"), to deal
+ * in the Software without restriction, including without limitation the rights
+ * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+ * copies of the Software, and to permit persons to whom the Software is
+ * furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included in
+ * all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+ * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+ * THE SOFTWARE.
+ */
+
+#include <libspe2.h>
+#include <mars/mars.h>
+#include <mars_test.h>
+
+extern spe_program_handle_t mpu_prog;
+
+static struct mars_context *mars;
+static struct mars_task_id task_id;
+
+int main(void)
+{
+ int exit_code, ret;
+
+ ret = mars_context_create(&mars, 1, 0);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+
+ ret = mars_task_create(
+ mars,
+ &task_id,
+ NULL,
+ mpu_prog.elf_image,
+ MARS_TASK_CONTEXT_SAVE_ALL);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+
+ ret = mars_task_schedule(&task_id, NULL, 0);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+
+ ret = mars_task_wait(&task_id, &exit_code);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+
+ MARS_TEST_ASSERT_EQUAL(exit_code, 0);
+
+ ret = mars_task_destroy(&task_id);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+
+ ret = mars_context_destroy(mars);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+
+ return 0;
+}
diff --git a/tests/TFP/TFP_11_008/mpu.c b/tests/TFP/TFP_11_008/mpu.c
new file mode 100644
index 0000000..4d78b2b
--- /dev/null
+++ b/tests/TFP/TFP_11_008/mpu.c
@@ -0,0 +1,35 @@
+/*
+ * Copyright 2008 Sony Corporation
+ *
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a copy
+ * of this software and associated documentation files (the "Software"), to deal
+ * in the Software without restriction, including without limitation the rights
+ * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+ * copies of the Software, and to permit persons to whom the Software is
+ * furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included in
+ * all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+ * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+ * THE SOFTWARE.
+ */
+
+#include <string.h>
+#include <mars/mars.h>
+#include "mars_task_test.h"
+
+int mars_task_main(const struct mars_task_args *task_args)
+{
+ MARS_TEST_ASSERT(mars_task_get_name() == NULL);
+
+ mars_task_exit(0);
+
+ return 0;
+}
diff --git a/tests/TFP/TFP_11_009/Makefile b/tests/TFP/TFP_11_009/Makefile
new file mode 100644
index 0000000..432135a
--- /dev/null
+++ b/tests/TFP/TFP_11_009/Makefile
@@ -0,0 +1,28 @@
+#
+# Copyright 2008 Sony Corporation
+#
+#
+# Permission is hereby granted, free of charge, to any person obtaining a copy
+# of this software and associated documentation files (the "Software"), to deal
+# in the Software without restriction, including without limitation the rights
+# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+# copies of the Software, and to permit persons to whom the Software is
+# furnished to do so, subject to the following conditions:
+#
+# The above copyright notice and this permission notice shall be included in
+# all copies or substantial portions of the Software.
+#
+# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+# THE SOFTWARE.
+#
+
+top_srcdir = ../..
+test_objs = host.o mpu.task_eo
+
+include $(top_srcdir)/scripts/config.mk
+include $(top_srcdir)/scripts/rules_item.mk
diff --git a/tests/TFP/TFP_11_009/host.c b/tests/TFP/TFP_11_009/host.c
new file mode 100644
index 0000000..25c4ac5
--- /dev/null
+++ b/tests/TFP/TFP_11_009/host.c
@@ -0,0 +1,64 @@
+/*
+ * Copyright 2008 Sony Corporation
+ *
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a copy
+ * of this software and associated documentation files (the "Software"), to deal
+ * in the Software without restriction, including without limitation the rights
+ * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+ * copies of the Software, and to permit persons to whom the Software is
+ * furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included in
+ * all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+ * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+ * THE SOFTWARE.
+ */
+
+#include <libspe2.h>
+#include <mars/mars.h>
+#include <mars_test.h>
+
+extern spe_program_handle_t mpu_prog;
+
+static struct mars_context *mars;
+static struct mars_task_id task_id;
+
+int main(void)
+{
+ int exit_code, ret;
+
+ ret = mars_context_create(&mars, 1, 0);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+
+ ret = mars_task_create(
+ mars,
+ &task_id,
+ "",
+ mpu_prog.elf_image,
+ MARS_TASK_CONTEXT_SAVE_ALL);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+
+ ret = mars_task_schedule(&task_id, NULL, 0);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+
+ ret = mars_task_wait(&task_id, &exit_code);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+
+ MARS_TEST_ASSERT_EQUAL(exit_code, 0);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+
+ ret = mars_task_destroy(&task_id);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+
+ ret = mars_context_destroy(mars);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+
+ return 0;
+}
diff --git a/tests/TFP/TFP_11_009/mpu.c b/tests/TFP/TFP_11_009/mpu.c
new file mode 100644
index 0000000..4d78b2b
--- /dev/null
+++ b/tests/TFP/TFP_11_009/mpu.c
@@ -0,0 +1,35 @@
+/*
+ * Copyright 2008 Sony Corporation
+ *
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a copy
+ * of this software and associated documentation files (the "Software"), to deal
+ * in the Software without restriction, including without limitation the rights
+ * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+ * copies of the Software, and to permit persons to whom the Software is
+ * furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included in
+ * all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+ * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+ * THE SOFTWARE.
+ */
+
+#include <string.h>
+#include <mars/mars.h>
+#include "mars_task_test.h"
+
+int mars_task_main(const struct mars_task_args *task_args)
+{
+ MARS_TEST_ASSERT(mars_task_get_name() == NULL);
+
+ mars_task_exit(0);
+
+ return 0;
+}
diff --git a/tests/TFP/TFP_11_010/Makefile b/tests/TFP/TFP_11_010/Makefile
new file mode 100644
index 0000000..432135a
--- /dev/null
+++ b/tests/TFP/TFP_11_010/Makefile
@@ -0,0 +1,28 @@
+#
+# Copyright 2008 Sony Corporation
+#
+#
+# Permission is hereby granted, free of charge, to any person obtaining a copy
+# of this software and associated documentation files (the "Software"), to deal
+# in the Software without restriction, including without limitation the rights
+# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+# copies of the Software, and to permit persons to whom the Software is
+# furnished to do so, subject to the following conditions:
+#
+# The above copyright notice and this permission notice shall be included in
+# all copies or substantial portions of the Software.
+#
+# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+# THE SOFTWARE.
+#
+
+top_srcdir = ../..
+test_objs = host.o mpu.task_eo
+
+include $(top_srcdir)/scripts/config.mk
+include $(top_srcdir)/scripts/rules_item.mk
diff --git a/tests/TFP/TFP_11_010/host.c b/tests/TFP/TFP_11_010/host.c
new file mode 100644
index 0000000..c6c46e6
--- /dev/null
+++ b/tests/TFP/TFP_11_010/host.c
@@ -0,0 +1,63 @@
+/*
+ * Copyright 2008 Sony Corporation
+ *
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a copy
+ * of this software and associated documentation files (the "Software"), to deal
+ * in the Software without restriction, including without limitation the rights
+ * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+ * copies of the Software, and to permit persons to whom the Software is
+ * furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included in
+ * all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+ * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+ * THE SOFTWARE.
+ */
+
+#include <libspe2.h>
+#include <mars/mars.h>
+#include <mars_test.h>
+
+extern spe_program_handle_t mpu_prog;
+
+static struct mars_context *mars;
+static struct mars_task_id task_id;
+
+int main(void)
+{
+ int exit_code, ret;
+
+ ret = mars_context_create(&mars, 1, 0);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+
+ ret = mars_task_create(
+ mars,
+ &task_id,
+ "a",
+ mpu_prog.elf_image,
+ MARS_TASK_CONTEXT_SAVE_ALL);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+
+ ret = mars_task_schedule(&task_id, NULL, 0);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+
+ ret = mars_task_wait(&task_id, &exit_code);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+
+ MARS_TEST_ASSERT_EQUAL(exit_code, 0);
+
+ ret = mars_task_destroy(&task_id);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+
+ ret = mars_context_destroy(mars);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+
+ return 0;
+}
diff --git a/tests/TFP/TFP_11_010/mpu.c b/tests/TFP/TFP_11_010/mpu.c
new file mode 100644
index 0000000..375e05e
--- /dev/null
+++ b/tests/TFP/TFP_11_010/mpu.c
@@ -0,0 +1,35 @@
+/*
+ * Copyright 2008 Sony Corporation
+ *
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a copy
+ * of this software and associated documentation files (the "Software"), to deal
+ * in the Software without restriction, including without limitation the rights
+ * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+ * copies of the Software, and to permit persons to whom the Software is
+ * furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included in
+ * all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+ * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+ * THE SOFTWARE.
+ */
+
+#include <string.h>
+#include <mars/mars.h>
+#include "mars_task_test.h"
+
+int mars_task_main(const struct mars_task_args *task_args)
+{
+ MARS_TEST_ASSERT(strcmp(mars_task_get_name(), "a") == 0);
+
+ mars_task_exit(0);
+
+ return 0;
+}
diff --git a/tests/TFP/TFP_11_011/Makefile b/tests/TFP/TFP_11_011/Makefile
new file mode 100644
index 0000000..432135a
--- /dev/null
+++ b/tests/TFP/TFP_11_011/Makefile
@@ -0,0 +1,28 @@
+#
+# Copyright 2008 Sony Corporation
+#
+#
+# Permission is hereby granted, free of charge, to any person obtaining a copy
+# of this software and associated documentation files (the "Software"), to deal
+# in the Software without restriction, including without limitation the rights
+# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+# copies of the Software, and to permit persons to whom the Software is
+# furnished to do so, subject to the following conditions:
+#
+# The above copyright notice and this permission notice shall be included in
+# all copies or substantial portions of the Software.
+#
+# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+# THE SOFTWARE.
+#
+
+top_srcdir = ../..
+test_objs = host.o mpu.task_eo
+
+include $(top_srcdir)/scripts/config.mk
+include $(top_srcdir)/scripts/rules_item.mk
diff --git a/tests/TFP/TFP_11_011/host.c b/tests/TFP/TFP_11_011/host.c
new file mode 100644
index 0000000..0640035
--- /dev/null
+++ b/tests/TFP/TFP_11_011/host.c
@@ -0,0 +1,68 @@
+/*
+ * Copyright 2008 Sony Corporation
+ *
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a copy
+ * of this software and associated documentation files (the "Software"), to deal
+ * in the Software without restriction, including without limitation the rights
+ * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+ * copies of the Software, and to permit persons to whom the Software is
+ * furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included in
+ * all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+ * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+ * THE SOFTWARE.
+ */
+
+#include <libspe2.h>
+#include <mars/mars.h>
+#include <mars_test.h>
+
+extern spe_program_handle_t mpu_prog;
+
+static struct mars_context *mars;
+static struct mars_task_id task_id;
+static char name[MARS_TASK_NAME_LEN_MAX];
+
+int main(void)
+{
+ int i, exit_code, ret;
+
+ ret = mars_context_create(&mars, 1, 0);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+
+ for (i = 0; i < MARS_TASK_NAME_LEN_MAX-1; i++)
+ name[i] = 'A'+i;
+ name[MARS_TASK_NAME_LEN_MAX-1] = '\0';
+
+ ret = mars_task_create(
+ mars,
+ &task_id,
+ name,
+ mpu_prog.elf_image,
+ MARS_TASK_CONTEXT_SAVE_ALL);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+
+ ret = mars_task_schedule(&task_id, NULL, 0);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+
+ ret = mars_task_wait(&task_id, &exit_code);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+
+ MARS_TEST_ASSERT_EQUAL(exit_code, 0);
+
+ ret = mars_task_destroy(&task_id);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+
+ ret = mars_context_destroy(mars);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+
+ return 0;
+}
diff --git a/tests/TFP/TFP_11_011/mpu.c b/tests/TFP/TFP_11_011/mpu.c
new file mode 100644
index 0000000..f746589
--- /dev/null
+++ b/tests/TFP/TFP_11_011/mpu.c
@@ -0,0 +1,43 @@
+/*
+ * Copyright 2008 Sony Corporation
+ *
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a copy
+ * of this software and associated documentation files (the "Software"), to deal
+ * in the Software without restriction, including without limitation the rights
+ * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+ * copies of the Software, and to permit persons to whom the Software is
+ * furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included in
+ * all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+ * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+ * THE SOFTWARE.
+ */
+
+#include <string.h>
+#include <mars/mars.h>
+#include "mars_task_test.h"
+
+static char name[MARS_TASK_NAME_LEN_MAX];
+
+int mars_task_main(const struct mars_task_args *task_args)
+{
+ int i;
+
+ for (i = 0; i < MARS_TASK_NAME_LEN_MAX-1; i++)
+ name[i] = 'A'+i;
+ name[MARS_TASK_NAME_LEN_MAX-1] = '\0';
+
+ MARS_TEST_ASSERT(strcmp(mars_task_get_name(), name) == 0);
+
+ mars_task_exit(0);
+
+ return 0;
+}
diff --git a/tests/TFP/TFP_12_001/Makefile b/tests/TFP/TFP_12_001/Makefile
new file mode 100644
index 0000000..432135a
--- /dev/null
+++ b/tests/TFP/TFP_12_001/Makefile
@@ -0,0 +1,28 @@
+#
+# Copyright 2008 Sony Corporation
+#
+#
+# Permission is hereby granted, free of charge, to any person obtaining a copy
+# of this software and associated documentation files (the "Software"), to deal
+# in the Software without restriction, including without limitation the rights
+# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+# copies of the Software, and to permit persons to whom the Software is
+# furnished to do so, subject to the following conditions:
+#
+# The above copyright notice and this permission notice shall be included in
+# all copies or substantial portions of the Software.
+#
+# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+# THE SOFTWARE.
+#
+
+top_srcdir = ../..
+test_objs = host.o mpu.task_eo
+
+include $(top_srcdir)/scripts/config.mk
+include $(top_srcdir)/scripts/rules_item.mk
diff --git a/tests/TFP/TFP_12_001/host.c b/tests/TFP/TFP_12_001/host.c
new file mode 100644
index 0000000..5b54eb4
--- /dev/null
+++ b/tests/TFP/TFP_12_001/host.c
@@ -0,0 +1,50 @@
+/*
+ * Copyright 2008 Sony Corporation
+ *
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a copy
+ * of this software and associated documentation files (the "Software"), to deal
+ * in the Software without restriction, including without limitation the rights
+ * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+ * copies of the Software, and to permit persons to whom the Software is
+ * furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included in
+ * all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+ * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+ * THE SOFTWARE.
+ */
+
+#include <libspe2.h>
+#include <mars/mars.h>
+#include <mars_test.h>
+
+extern spe_program_handle_t mpu_prog;
+
+static struct mars_context *mars;
+static struct mars_task_id task_id;
+
+int main(void)
+{
+ int ret;
+
+ ret = mars_context_create(&mars, 1, 0);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+
+ ret = mars_task_create(mars, &task_id, NULL, mpu_prog.elf_image, 0);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+
+ ret = mars_task_destroy(&task_id);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+
+ ret = mars_context_destroy(mars);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+
+ return 0;
+}
diff --git a/tests/TFP/TFP_12_001/mpu.c b/tests/TFP/TFP_12_001/mpu.c
new file mode 100644
index 0000000..c26f42b
--- /dev/null
+++ b/tests/TFP/TFP_12_001/mpu.c
@@ -0,0 +1,29 @@
+/*
+ * Copyright 2008 Sony Corporation
+ *
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a copy
+ * of this software and associated documentation files (the "Software"), to deal
+ * in the Software without restriction, including without limitation the rights
+ * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+ * copies of the Software, and to permit persons to whom the Software is
+ * furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included in
+ * all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+ * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+ * THE SOFTWARE.
+ */
+
+#include <mars/mars.h>
+
+int mars_task_main(const struct mars_task_args *task_args)
+{
+ return 0;
+}
diff --git a/tests/TFP/TFP_12_002/Makefile b/tests/TFP/TFP_12_002/Makefile
new file mode 100644
index 0000000..432135a
--- /dev/null
+++ b/tests/TFP/TFP_12_002/Makefile
@@ -0,0 +1,28 @@
+#
+# Copyright 2008 Sony Corporation
+#
+#
+# Permission is hereby granted, free of charge, to any person obtaining a copy
+# of this software and associated documentation files (the "Software"), to deal
+# in the Software without restriction, including without limitation the rights
+# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+# copies of the Software, and to permit persons to whom the Software is
+# furnished to do so, subject to the following conditions:
+#
+# The above copyright notice and this permission notice shall be included in
+# all copies or substantial portions of the Software.
+#
+# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+# THE SOFTWARE.
+#
+
+top_srcdir = ../..
+test_objs = host.o mpu.task_eo
+
+include $(top_srcdir)/scripts/config.mk
+include $(top_srcdir)/scripts/rules_item.mk
diff --git a/tests/TFP/TFP_12_002/host.c b/tests/TFP/TFP_12_002/host.c
new file mode 100644
index 0000000..4e61ff7
--- /dev/null
+++ b/tests/TFP/TFP_12_002/host.c
@@ -0,0 +1,56 @@
+/*
+ * Copyright 2008 Sony Corporation
+ *
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a copy
+ * of this software and associated documentation files (the "Software"), to deal
+ * in the Software without restriction, including without limitation the rights
+ * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+ * copies of the Software, and to permit persons to whom the Software is
+ * furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included in
+ * all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+ * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+ * THE SOFTWARE.
+ */
+
+#include <libspe2.h>
+#include <mars/mars.h>
+#include <mars_test.h>
+
+extern spe_program_handle_t mpu_prog;
+
+static struct mars_context *mars;
+static struct mars_task_id task_id;
+
+int main(void)
+{
+ int exit_code, ret;
+
+ ret = mars_context_create(&mars, 1, 0);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+
+ ret = mars_task_create(mars, &task_id, NULL, mpu_prog.elf_image, 0);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+
+ ret = mars_task_schedule(&task_id, NULL, 0);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+
+ ret = mars_task_wait(&task_id, &exit_code);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+
+ ret = mars_task_destroy(&task_id);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+
+ ret = mars_context_destroy(mars);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+
+ return 0;
+}
diff --git a/tests/TFP/TFP_12_002/mpu.c b/tests/TFP/TFP_12_002/mpu.c
new file mode 100644
index 0000000..c26f42b
--- /dev/null
+++ b/tests/TFP/TFP_12_002/mpu.c
@@ -0,0 +1,29 @@
+/*
+ * Copyright 2008 Sony Corporation
+ *
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a copy
+ * of this software and associated documentation files (the "Software"), to deal
+ * in the Software without restriction, including without limitation the rights
+ * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+ * copies of the Software, and to permit persons to whom the Software is
+ * furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included in
+ * all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+ * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+ * THE SOFTWARE.
+ */
+
+#include <mars/mars.h>
+
+int mars_task_main(const struct mars_task_args *task_args)
+{
+ return 0;
+}
diff --git a/tests/TFP/TFP_12_003/Makefile b/tests/TFP/TFP_12_003/Makefile
new file mode 100644
index 0000000..432135a
--- /dev/null
+++ b/tests/TFP/TFP_12_003/Makefile
@@ -0,0 +1,28 @@
+#
+# Copyright 2008 Sony Corporation
+#
+#
+# Permission is hereby granted, free of charge, to any person obtaining a copy
+# of this software and associated documentation files (the "Software"), to deal
+# in the Software without restriction, including without limitation the rights
+# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+# copies of the Software, and to permit persons to whom the Software is
+# furnished to do so, subject to the following conditions:
+#
+# The above copyright notice and this permission notice shall be included in
+# all copies or substantial portions of the Software.
+#
+# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+# THE SOFTWARE.
+#
+
+top_srcdir = ../..
+test_objs = host.o mpu.task_eo
+
+include $(top_srcdir)/scripts/config.mk
+include $(top_srcdir)/scripts/rules_item.mk
diff --git a/tests/TFP/TFP_12_003/host.c b/tests/TFP/TFP_12_003/host.c
new file mode 100644
index 0000000..bfbb7e6
--- /dev/null
+++ b/tests/TFP/TFP_12_003/host.c
@@ -0,0 +1,77 @@
+/*
+ * Copyright 2008 Sony Corporation
+ *
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a copy
+ * of this software and associated documentation files (the "Software"), to deal
+ * in the Software without restriction, including without limitation the rights
+ * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+ * copies of the Software, and to permit persons to whom the Software is
+ * furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included in
+ * all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+ * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+ * THE SOFTWARE.
+ */
+
+#include <pthread.h>
+#include <libspe2.h>
+#include <mars/mars.h>
+#include <mars_test.h>
+
+#define TASK_COUNT 16
+
+extern spe_program_handle_t mpu_prog;
+
+static struct mars_context *mars;
+static struct mars_task_id task_ids[TASK_COUNT];
+static pthread_t thread_handles[TASK_COUNT];
+
+void *thread_proc(void *arg)
+{
+ int ret;
+
+ ret = mars_task_create(
+ mars,
+ (struct mars_task_id *)arg,
+ NULL,
+ mpu_prog.elf_image,
+ 0);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+
+ ret = mars_task_destroy((struct mars_task_id *)arg);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+
+ return NULL;
+}
+
+int main(void)
+{
+ int i, ret;
+ int spe_cnt = spe_cpu_info_get(SPE_COUNT_PHYSICAL_SPES, -1);
+
+ ret = mars_context_create(&mars, spe_cnt, 0);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+
+ for (i = 0; i < TASK_COUNT; i++)
+ pthread_create(
+ &thread_handles[i],
+ NULL,
+ thread_proc,
+ (void *)&task_ids[i]);
+
+ for (i = 0; i < TASK_COUNT; i++)
+ pthread_join(thread_handles[i], NULL);
+
+ ret = mars_context_destroy(mars);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+
+ return 0;
+}
diff --git a/tests/TFP/TFP_12_003/mpu.c b/tests/TFP/TFP_12_003/mpu.c
new file mode 100644
index 0000000..c26f42b
--- /dev/null
+++ b/tests/TFP/TFP_12_003/mpu.c
@@ -0,0 +1,29 @@
+/*
+ * Copyright 2008 Sony Corporation
+ *
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a copy
+ * of this software and associated documentation files (the "Software"), to deal
+ * in the Software without restriction, including without limitation the rights
+ * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+ * copies of the Software, and to permit persons to whom the Software is
+ * furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included in
+ * all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+ * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+ * THE SOFTWARE.
+ */
+
+#include <mars/mars.h>
+
+int mars_task_main(const struct mars_task_args *task_args)
+{
+ return 0;
+}
diff --git a/tests/TFP/TFP_13_001/Makefile b/tests/TFP/TFP_13_001/Makefile
new file mode 100644
index 0000000..432135a
--- /dev/null
+++ b/tests/TFP/TFP_13_001/Makefile
@@ -0,0 +1,28 @@
+#
+# Copyright 2008 Sony Corporation
+#
+#
+# Permission is hereby granted, free of charge, to any person obtaining a copy
+# of this software and associated documentation files (the "Software"), to deal
+# in the Software without restriction, including without limitation the rights
+# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+# copies of the Software, and to permit persons to whom the Software is
+# furnished to do so, subject to the following conditions:
+#
+# The above copyright notice and this permission notice shall be included in
+# all copies or substantial portions of the Software.
+#
+# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+# THE SOFTWARE.
+#
+
+top_srcdir = ../..
+test_objs = host.o mpu.task_eo
+
+include $(top_srcdir)/scripts/config.mk
+include $(top_srcdir)/scripts/rules_item.mk
diff --git a/tests/TFP/TFP_13_001/host.c b/tests/TFP/TFP_13_001/host.c
new file mode 100644
index 0000000..21ef804
--- /dev/null
+++ b/tests/TFP/TFP_13_001/host.c
@@ -0,0 +1,57 @@
+/*
+ * Copyright 2008 Sony Corporation
+ *
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a copy
+ * of this software and associated documentation files (the "Software"), to deal
+ * in the Software without restriction, including without limitation the rights
+ * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+ * copies of the Software, and to permit persons to whom the Software is
+ * furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included in
+ * all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+ * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+ * THE SOFTWARE.
+ */
+
+#include <libspe2.h>
+#include <mars/mars.h>
+#include <mars_test.h>
+
+extern spe_program_handle_t mpu_prog;
+
+static struct mars_context *mars;
+static struct mars_task_id task_id;
+
+int main(void)
+{
+ int exit_code, ret;
+
+ ret = mars_context_create(&mars, 1, 0);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+
+ ret = mars_task_create(mars, &task_id, "017", mpu_prog.elf_image, 0);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+
+ ret = mars_task_schedule(&task_id, NULL, 0);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+
+ ret = mars_task_wait(&task_id, &exit_code);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+ MARS_TEST_ASSERT_EQUAL(exit_code, 0xABCDEF01);
+
+ ret = mars_task_destroy(&task_id);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+
+ ret = mars_context_destroy(mars);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+
+ return 0;
+}
diff --git a/tests/TFP/TFP_13_001/mpu.c b/tests/TFP/TFP_13_001/mpu.c
new file mode 100644
index 0000000..63b1e22
--- /dev/null
+++ b/tests/TFP/TFP_13_001/mpu.c
@@ -0,0 +1,31 @@
+/*
+ * Copyright 2008 Sony Corporation
+ *
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a copy
+ * of this software and associated documentation files (the "Software"), to deal
+ * in the Software without restriction, including without limitation the rights
+ * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+ * copies of the Software, and to permit persons to whom the Software is
+ * furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included in
+ * all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+ * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+ * THE SOFTWARE.
+ */
+
+#include <mars/mars.h>
+
+int mars_task_main(const struct mars_task_args *task_args)
+{
+ mars_task_exit(0xABCDEF01);
+
+ return 0;
+}
diff --git a/tests/TFP/TFP_13_002/Makefile b/tests/TFP/TFP_13_002/Makefile
new file mode 100644
index 0000000..432135a
--- /dev/null
+++ b/tests/TFP/TFP_13_002/Makefile
@@ -0,0 +1,28 @@
+#
+# Copyright 2008 Sony Corporation
+#
+#
+# Permission is hereby granted, free of charge, to any person obtaining a copy
+# of this software and associated documentation files (the "Software"), to deal
+# in the Software without restriction, including without limitation the rights
+# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+# copies of the Software, and to permit persons to whom the Software is
+# furnished to do so, subject to the following conditions:
+#
+# The above copyright notice and this permission notice shall be included in
+# all copies or substantial portions of the Software.
+#
+# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+# THE SOFTWARE.
+#
+
+top_srcdir = ../..
+test_objs = host.o mpu.task_eo
+
+include $(top_srcdir)/scripts/config.mk
+include $(top_srcdir)/scripts/rules_item.mk
diff --git a/tests/TFP/TFP_13_002/host.c b/tests/TFP/TFP_13_002/host.c
new file mode 100644
index 0000000..41294c2
--- /dev/null
+++ b/tests/TFP/TFP_13_002/host.c
@@ -0,0 +1,68 @@
+/*
+ * Copyright 2008 Sony Corporation
+ *
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a copy
+ * of this software and associated documentation files (the "Software"), to deal
+ * in the Software without restriction, including without limitation the rights
+ * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+ * copies of the Software, and to permit persons to whom the Software is
+ * furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included in
+ * all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+ * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+ * THE SOFTWARE.
+ */
+
+#include <libspe2.h>
+#include <mars/mars.h>
+#include <mars_test.h>
+
+extern spe_program_handle_t mpu_prog;
+
+static struct mars_context *mars;
+static struct mars_task_id task_id;
+static struct mars_task_args task_args;
+
+int main(void)
+{
+ int exit_code, ret;
+
+ ret = mars_context_create(&mars, 1, 0);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+
+ ret = mars_task_create(mars, &task_id, "13002", mpu_prog.elf_image, 0);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+#if __BYTE_ORDER == __BIG_ENDIAN
+ task_args.type.u64[0] = 0x0123456789ABCDEFULL;
+ task_args.type.u64[1] = 0x123456789ABCDEF0ULL;
+ task_args.type.u64[2] = 0x23456789ABCDEF01ULL;
+ task_args.type.u64[3] = 0x3456789ABCDEF012ULL;
+#elif __BYTE_ORDER == __LITTLE_ENDIAN
+ task_args.type.u64[0] = 0xEFCDAB8967452301ULL;
+ task_args.type.u64[1] = 0xF0DEBC9A78563412ULL;
+ task_args.type.u64[2] = 0x01EFCDAB89674523ULL;
+ task_args.type.u64[3] = 0x12F0DEBC9A785634ULL;
+#endif
+ ret = mars_task_schedule(&task_id, &task_args, 0);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+
+ ret = mars_task_wait(&task_id, &exit_code);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+ MARS_TEST_ASSERT_EQUAL(exit_code, 0x01234567);
+
+ ret = mars_task_destroy(&task_id);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+
+ ret = mars_context_destroy(mars);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+
+ return 0;
+}
diff --git a/tests/TFP/TFP_13_002/mpu.c b/tests/TFP/TFP_13_002/mpu.c
new file mode 100644
index 0000000..5314314
--- /dev/null
+++ b/tests/TFP/TFP_13_002/mpu.c
@@ -0,0 +1,37 @@
+/*
+ * Copyright 2008 Sony Corporation
+ *
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a copy
+ * of this software and associated documentation files (the "Software"), to deal
+ * in the Software without restriction, including without limitation the rights
+ * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+ * copies of the Software, and to permit persons to whom the Software is
+ * furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included in
+ * all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+ * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+ * THE SOFTWARE.
+ */
+
+#include <mars/mars.h>
+#include <mars_task_test.h>
+
+int mars_task_main(const struct mars_task_args *task_args)
+{
+ MARS_TEST_ASSERT(task_args->type.u64[0] == 0x0123456789ABCDEFULL);
+ MARS_TEST_ASSERT(task_args->type.u64[1] == 0x123456789ABCDEF0ULL);
+ MARS_TEST_ASSERT(task_args->type.u64[2] == 0x23456789ABCDEF01ULL);
+ MARS_TEST_ASSERT(task_args->type.u64[3] == 0x3456789ABCDEF012ULL);
+
+ mars_task_exit(0x01234567);
+
+ return 0;
+}
diff --git a/tests/TFP/TFP_13_003/Makefile b/tests/TFP/TFP_13_003/Makefile
new file mode 100644
index 0000000..432135a
--- /dev/null
+++ b/tests/TFP/TFP_13_003/Makefile
@@ -0,0 +1,28 @@
+#
+# Copyright 2008 Sony Corporation
+#
+#
+# Permission is hereby granted, free of charge, to any person obtaining a copy
+# of this software and associated documentation files (the "Software"), to deal
+# in the Software without restriction, including without limitation the rights
+# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+# copies of the Software, and to permit persons to whom the Software is
+# furnished to do so, subject to the following conditions:
+#
+# The above copyright notice and this permission notice shall be included in
+# all copies or substantial portions of the Software.
+#
+# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+# THE SOFTWARE.
+#
+
+top_srcdir = ../..
+test_objs = host.o mpu.task_eo
+
+include $(top_srcdir)/scripts/config.mk
+include $(top_srcdir)/scripts/rules_item.mk
diff --git a/tests/TFP/TFP_13_003/host.c b/tests/TFP/TFP_13_003/host.c
new file mode 100644
index 0000000..239e68e
--- /dev/null
+++ b/tests/TFP/TFP_13_003/host.c
@@ -0,0 +1,66 @@
+/*
+ * Copyright 2008 Sony Corporation
+ *
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a copy
+ * of this software and associated documentation files (the "Software"), to deal
+ * in the Software without restriction, including without limitation the rights
+ * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+ * copies of the Software, and to permit persons to whom the Software is
+ * furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included in
+ * all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+ * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+ * THE SOFTWARE.
+ */
+
+#include <libspe2.h>
+#include <mars/mars.h>
+#include <mars_test.h>
+
+extern spe_program_handle_t mpu_prog;
+
+static struct mars_context *mars;
+static struct mars_task_id task_id;
+
+int main(void)
+{
+ int exit_code = 0, ret;
+
+ ret = mars_context_create(&mars, 1, 0);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+
+ ret = mars_task_create(mars, &task_id, "019", mpu_prog.elf_image, 0);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+
+ ret = mars_task_schedule(&task_id, NULL, 0);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+
+ ret = mars_task_wait(&task_id, &exit_code);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+ MARS_TEST_ASSERT_EQUAL(exit_code, 0x01234567);
+
+ exit_code = 0;
+
+ ret = mars_task_schedule(&task_id, NULL, 255);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+
+ ret = mars_task_wait(&task_id, &exit_code);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+ MARS_TEST_ASSERT_EQUAL(exit_code, 0x01234567);
+
+ ret = mars_task_destroy(&task_id);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+
+ ret = mars_context_destroy(mars);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+
+ return 0;
+}
diff --git a/tests/TFP/TFP_13_003/mpu.c b/tests/TFP/TFP_13_003/mpu.c
new file mode 100644
index 0000000..24820c4
--- /dev/null
+++ b/tests/TFP/TFP_13_003/mpu.c
@@ -0,0 +1,31 @@
+/*
+ * Copyright 2008 Sony Corporation
+ *
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a copy
+ * of this software and associated documentation files (the "Software"), to deal
+ * in the Software without restriction, including without limitation the rights
+ * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+ * copies of the Software, and to permit persons to whom the Software is
+ * furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included in
+ * all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+ * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+ * THE SOFTWARE.
+ */
+
+#include <mars/mars.h>
+
+int mars_task_main(const struct mars_task_args *task_args)
+{
+ mars_task_exit(0x01234567);
+
+ return 0;
+}
diff --git a/tests/TFP/TFP_13_004/Makefile b/tests/TFP/TFP_13_004/Makefile
new file mode 100644
index 0000000..72cf999
--- /dev/null
+++ b/tests/TFP/TFP_13_004/Makefile
@@ -0,0 +1,28 @@
+#
+# Copyright 2008 Sony Corporation
+#
+#
+# Permission is hereby granted, free of charge, to any person obtaining a copy
+# of this software and associated documentation files (the "Software"), to deal
+# in the Software without restriction, including without limitation the rights
+# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+# copies of the Software, and to permit persons to whom the Software is
+# furnished to do so, subject to the following conditions:
+#
+# The above copyright notice and this permission notice shall be included in
+# all copies or substantial portions of the Software.
+#
+# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+# THE SOFTWARE.
+#
+
+top_srcdir = ../..
+test_objs = host.o mpu1.task_eo mpu2.task_eo mpu3.task_eo
+
+include $(top_srcdir)/scripts/config.mk
+include $(top_srcdir)/scripts/rules_item.mk
diff --git a/tests/TFP/TFP_13_004/host.c b/tests/TFP/TFP_13_004/host.c
new file mode 100644
index 0000000..ab0ba42
--- /dev/null
+++ b/tests/TFP/TFP_13_004/host.c
@@ -0,0 +1,104 @@
+/*
+ * Copyright 2008 Sony Corporation
+ *
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a copy
+ * of this software and associated documentation files (the "Software"), to deal
+ * in the Software without restriction, including without limitation the rights
+ * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+ * copies of the Software, and to permit persons to whom the Software is
+ * furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included in
+ * all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+ * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+ * THE SOFTWARE.
+ */
+
+#include <libspe2.h>
+#include <mars/mars.h>
+#include <mars_test.h>
+
+#define MAX_TASK_COUNT 256
+
+extern spe_program_handle_t mpu1_prog, mpu2_prog, mpu3_prog;
+
+static struct mars_context *mars;
+static struct mars_task_id task_ids[MAX_TASK_COUNT], task_id_1, task_id_255;
+static struct mars_task_args task_args;
+static uint32_t conductor __attribute__((aligned(128)));
+static uint32_t started_prioritized_task __attribute__((aligned(128)));
+
+int main(void)
+{
+ int i, exit_code, ret;
+ uint32_t spe_cnt;
+
+ spe_cnt = spe_cpu_info_get(SPE_COUNT_PHYSICAL_SPES, -1);
+ MARS_TEST_ASSERT(spe_cnt <= MAX_TASK_COUNT);
+
+ ret = mars_context_create(&mars, spe_cnt, 0);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+
+ task_args.type.u64[0] = mars_ptr_to_ea(&conductor);
+ task_args.type.u64[1] = mars_ptr_to_ea(&started_prioritized_task);
+
+ for (i = 0; i < spe_cnt; i++) {
+ ret = mars_task_create(mars, &task_ids[i], "13004",
+ mpu1_prog.elf_image, MARS_TASK_CONTEXT_SAVE_ALL);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+
+ task_args.type.u64[2] = i;
+ ret = mars_task_schedule(&task_ids[i], &task_args, 0);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+ }
+
+ mars_test_counter_wait(&conductor, spe_cnt);
+
+ ret = mars_task_create(mars, &task_id_1, "13004",
+ mpu2_prog.elf_image, 0);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+
+ ret = mars_task_schedule(&task_id_1, &task_args, 1);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+
+ ret = mars_task_create(mars, &task_id_255, "13004",
+ mpu3_prog.elf_image, 0);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+
+ ret = mars_task_schedule(&task_id_255, &task_args, 255);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+
+ mars_test_counter_set(&conductor, 0);
+
+ ret = mars_task_wait(&task_id_255, &exit_code);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+
+ ret = mars_task_destroy(&task_id_255);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+
+ ret = mars_task_wait(&task_id_1, &exit_code);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+
+ ret = mars_task_destroy(&task_id_1);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+
+ for (i = 0; i < spe_cnt; i++) {
+ ret = mars_task_wait(&task_ids[i], &exit_code);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+
+ ret = mars_task_destroy(&task_ids[i]);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+ }
+
+ ret = mars_context_destroy(mars);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+
+ return 0;
+}
diff --git a/tests/TFP/TFP_13_004/mpu1.c b/tests/TFP/TFP_13_004/mpu1.c
new file mode 100644
index 0000000..ee69087
--- /dev/null
+++ b/tests/TFP/TFP_13_004/mpu1.c
@@ -0,0 +1,48 @@
+/*
+ * Copyright 2008 Sony Corporation
+ *
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a copy
+ * of this software and associated documentation files (the "Software"), to deal
+ * in the Software without restriction, including without limitation the rights
+ * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+ * copies of the Software, and to permit persons to whom the Software is
+ * furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included in
+ * all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+ * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+ * THE SOFTWARE.
+ */
+
+#include <spu_mfcio.h>
+#include <mars/mars.h>
+#include "mars_task_test.h"
+#include <stdio.h>
+
+int mars_task_main(const struct mars_task_args *task_args)
+{
+ uint64_t conductor_ea = task_args->type.u64[0];
+ uint64_t started_prioritized_task_ea = task_args->type.u64[1];
+ uint32_t index = task_args->type.u64[2];
+
+ mars_test_counter_add(conductor_ea, 1);
+ mars_test_counter_wait(conductor_ea, 0);
+
+ /* At this point, all SPEs are running a task */
+ if (index == 0) {
+ /* So, let's yield one SPE */
+ int ret = mars_task_yield();
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+ }
+
+ mars_test_counter_wait(started_prioritized_task_ea, 2);
+
+ return 0;
+}
diff --git a/tests/TFP/TFP_13_004/mpu2.c b/tests/TFP/TFP_13_004/mpu2.c
new file mode 100644
index 0000000..de141b3
--- /dev/null
+++ b/tests/TFP/TFP_13_004/mpu2.c
@@ -0,0 +1,40 @@
+/*
+ * Copyright 2008 Sony Corporation
+ *
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a copy
+ * of this software and associated documentation files (the "Software"), to deal
+ * in the Software without restriction, including without limitation the rights
+ * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+ * copies of the Software, and to permit persons to whom the Software is
+ * furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included in
+ * all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+ * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+ * THE SOFTWARE.
+ */
+
+#include <spu_mfcio.h>
+#include <mars/mars.h>
+#include "mars_test.h"
+
+int mars_task_main(const struct mars_task_args *task_args)
+{
+ uint64_t started_prioritized_task_ea = task_args->type.u64[1];
+ uint32_t order;
+
+ order = mars_test_counter_add(started_prioritized_task_ea, 1);
+
+ /* This task is scheduled with priority=1
+ so, must be run after the one with priority=255 */
+ MARS_TEST_ASSERT_EQUAL(order, 2);
+
+ return 0;
+}
diff --git a/tests/TFP/TFP_13_004/mpu3.c b/tests/TFP/TFP_13_004/mpu3.c
new file mode 100644
index 0000000..54cf859
--- /dev/null
+++ b/tests/TFP/TFP_13_004/mpu3.c
@@ -0,0 +1,40 @@
+/*
+ * Copyright 2008 Sony Corporation
+ *
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a copy
+ * of this software and associated documentation files (the "Software"), to deal
+ * in the Software without restriction, including without limitation the rights
+ * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+ * copies of the Software, and to permit persons to whom the Software is
+ * furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included in
+ * all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+ * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+ * THE SOFTWARE.
+ */
+
+#include <spu_mfcio.h>
+#include <mars/mars.h>
+#include "mars_test.h"
+
+int mars_task_main(const struct mars_task_args *task_args)
+{
+ uint64_t started_prioritized_task_ea = task_args->type.u64[1];
+ uint32_t order;
+
+ order = mars_test_counter_add(started_prioritized_task_ea, 1);
+
+ /* This task is scheduled with priority=255
+ so, must be run before the one with priority=1 */
+ MARS_TEST_ASSERT_EQUAL(order, 1);
+
+ return 0;
+}
diff --git a/tests/TFP/TFP_13_005/Makefile b/tests/TFP/TFP_13_005/Makefile
new file mode 100644
index 0000000..432135a
--- /dev/null
+++ b/tests/TFP/TFP_13_005/Makefile
@@ -0,0 +1,28 @@
+#
+# Copyright 2008 Sony Corporation
+#
+#
+# Permission is hereby granted, free of charge, to any person obtaining a copy
+# of this software and associated documentation files (the "Software"), to deal
+# in the Software without restriction, including without limitation the rights
+# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+# copies of the Software, and to permit persons to whom the Software is
+# furnished to do so, subject to the following conditions:
+#
+# The above copyright notice and this permission notice shall be included in
+# all copies or substantial portions of the Software.
+#
+# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+# THE SOFTWARE.
+#
+
+top_srcdir = ../..
+test_objs = host.o mpu.task_eo
+
+include $(top_srcdir)/scripts/config.mk
+include $(top_srcdir)/scripts/rules_item.mk
diff --git a/tests/TFP/TFP_13_005/host.c b/tests/TFP/TFP_13_005/host.c
new file mode 100644
index 0000000..5137988
--- /dev/null
+++ b/tests/TFP/TFP_13_005/host.c
@@ -0,0 +1,75 @@
+/*
+ * Copyright 2008 Sony Corporation
+ *
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a copy
+ * of this software and associated documentation files (the "Software"), to deal
+ * in the Software without restriction, including without limitation the rights
+ * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+ * copies of the Software, and to permit persons to whom the Software is
+ * furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included in
+ * all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+ * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+ * THE SOFTWARE.
+ */
+
+#include <libspe2.h>
+#include <mars/mars.h>
+#include <mars_test.h>
+
+#define MAX_TASK_COUNT 256
+
+extern spe_program_handle_t mpu_prog;
+
+static struct mars_context *mars;
+static struct mars_task_id task_ids[MAX_TASK_COUNT];
+
+int main(void)
+{
+ int i, exit_code, ret;
+
+ int spe_cnt = spe_cpu_info_get(SPE_COUNT_PHYSICAL_SPES, -1);
+
+ MARS_TEST_ASSERT(spe_cnt <= MAX_TASK_COUNT);
+
+ ret = mars_context_create(&mars, spe_cnt, 0);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+
+ for (i = 0; i < spe_cnt; i++) {
+ ret = mars_task_create(
+ mars,
+ &task_ids[i],
+ "13005",
+ mpu_prog.elf_image,
+ 0);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+ }
+
+ for (i = 0; i < spe_cnt; i++) {
+ ret = mars_task_schedule(&task_ids[i], NULL, 0);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+ }
+
+ for (i = 0; i < spe_cnt; i++) {
+ ret = mars_task_wait(&task_ids[i], &exit_code);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+ }
+
+ for (i = 0; i < spe_cnt; i++) {
+ ret = mars_task_destroy(&task_ids[i]);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+ }
+
+ ret = mars_context_destroy(mars);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+
+ return 0;
+}
diff --git a/tests/TFP/TFP_13_005/mpu.c b/tests/TFP/TFP_13_005/mpu.c
new file mode 100644
index 0000000..143a198
--- /dev/null
+++ b/tests/TFP/TFP_13_005/mpu.c
@@ -0,0 +1,31 @@
+/*
+ * Copyright 2008 Sony Corporation
+ *
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a copy
+ * of this software and associated documentation files (the "Software"), to deal
+ * in the Software without restriction, including without limitation the rights
+ * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+ * copies of the Software, and to permit persons to whom the Software is
+ * furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included in
+ * all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+ * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+ * THE SOFTWARE.
+ */
+
+#include <mars/mars.h>
+
+int mars_task_main(const struct mars_task_args *task_args)
+{
+ mars_task_exit(0);
+
+ return 0;
+}
diff --git a/tests/TFP/TFP_13_006/Makefile b/tests/TFP/TFP_13_006/Makefile
new file mode 100644
index 0000000..432135a
--- /dev/null
+++ b/tests/TFP/TFP_13_006/Makefile
@@ -0,0 +1,28 @@
+#
+# Copyright 2008 Sony Corporation
+#
+#
+# Permission is hereby granted, free of charge, to any person obtaining a copy
+# of this software and associated documentation files (the "Software"), to deal
+# in the Software without restriction, including without limitation the rights
+# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+# copies of the Software, and to permit persons to whom the Software is
+# furnished to do so, subject to the following conditions:
+#
+# The above copyright notice and this permission notice shall be included in
+# all copies or substantial portions of the Software.
+#
+# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+# THE SOFTWARE.
+#
+
+top_srcdir = ../..
+test_objs = host.o mpu.task_eo
+
+include $(top_srcdir)/scripts/config.mk
+include $(top_srcdir)/scripts/rules_item.mk
diff --git a/tests/TFP/TFP_13_006/host.c b/tests/TFP/TFP_13_006/host.c
new file mode 100644
index 0000000..b6be946
--- /dev/null
+++ b/tests/TFP/TFP_13_006/host.c
@@ -0,0 +1,76 @@
+/*
+ * Copyright 2008 Sony Corporation
+ *
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a copy
+ * of this software and associated documentation files (the "Software"), to deal
+ * in the Software without restriction, including without limitation the rights
+ * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+ * copies of the Software, and to permit persons to whom the Software is
+ * furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included in
+ * all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+ * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+ * THE SOFTWARE.
+ */
+
+#include <libspe2.h>
+#include <mars/mars.h>
+#include <mars_test.h>
+
+#define MAX_TASK_COUNT 256
+
+extern spe_program_handle_t mpu_prog;
+
+static struct mars_context *mars;
+static struct mars_task_id task_ids[MAX_TASK_COUNT];
+
+int main(void)
+{
+ int i, exit_code, ret;
+
+ int spe_cnt = spe_cpu_info_get(SPE_COUNT_PHYSICAL_SPES, -1);
+
+ int task_count = spe_cnt + 1;
+
+ MARS_TEST_ASSERT(task_count <= MAX_TASK_COUNT);
+
+ ret = mars_context_create(&mars, spe_cnt, 0);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+
+ for (i = 0; i < task_count; i++) {
+ ret = mars_task_create(
+ mars,
+ &task_ids[i],
+ "13006",
+ mpu_prog.elf_image, 0);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+ }
+
+ for (i = 0; i < task_count; i++) {
+ ret = mars_task_schedule(&task_ids[i], NULL, 0);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+ }
+
+ for (i = 0; i < task_count; i++) {
+ ret = mars_task_wait(&task_ids[i], &exit_code);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+ }
+
+ for (i = 0; i < task_count; i++) {
+ ret = mars_task_destroy(&task_ids[i]);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+ }
+
+ ret = mars_context_destroy(mars);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+
+ return 0;
+}
diff --git a/tests/TFP/TFP_13_006/mpu.c b/tests/TFP/TFP_13_006/mpu.c
new file mode 100644
index 0000000..143a198
--- /dev/null
+++ b/tests/TFP/TFP_13_006/mpu.c
@@ -0,0 +1,31 @@
+/*
+ * Copyright 2008 Sony Corporation
+ *
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a copy
+ * of this software and associated documentation files (the "Software"), to deal
+ * in the Software without restriction, including without limitation the rights
+ * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+ * copies of the Software, and to permit persons to whom the Software is
+ * furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included in
+ * all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+ * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+ * THE SOFTWARE.
+ */
+
+#include <mars/mars.h>
+
+int mars_task_main(const struct mars_task_args *task_args)
+{
+ mars_task_exit(0);
+
+ return 0;
+}
diff --git a/tests/TFP/TFP_13_007/Makefile b/tests/TFP/TFP_13_007/Makefile
new file mode 100644
index 0000000..432135a
--- /dev/null
+++ b/tests/TFP/TFP_13_007/Makefile
@@ -0,0 +1,28 @@
+#
+# Copyright 2008 Sony Corporation
+#
+#
+# Permission is hereby granted, free of charge, to any person obtaining a copy
+# of this software and associated documentation files (the "Software"), to deal
+# in the Software without restriction, including without limitation the rights
+# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+# copies of the Software, and to permit persons to whom the Software is
+# furnished to do so, subject to the following conditions:
+#
+# The above copyright notice and this permission notice shall be included in
+# all copies or substantial portions of the Software.
+#
+# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+# THE SOFTWARE.
+#
+
+top_srcdir = ../..
+test_objs = host.o mpu.task_eo
+
+include $(top_srcdir)/scripts/config.mk
+include $(top_srcdir)/scripts/rules_item.mk
diff --git a/tests/TFP/TFP_13_007/host.c b/tests/TFP/TFP_13_007/host.c
new file mode 100644
index 0000000..83ef02d
--- /dev/null
+++ b/tests/TFP/TFP_13_007/host.c
@@ -0,0 +1,71 @@
+/*
+ * Copyright 2008 Sony Corporation
+ *
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a copy
+ * of this software and associated documentation files (the "Software"), to deal
+ * in the Software without restriction, including without limitation the rights
+ * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+ * copies of the Software, and to permit persons to whom the Software is
+ * furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included in
+ * all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+ * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+ * THE SOFTWARE.
+ */
+
+#include <libspe2.h>
+#include <mars/mars.h>
+#include <mars_test.h>
+
+#define MARS_WORKLOAD_MAX 1500
+
+extern spe_program_handle_t mpu_prog;
+
+static struct mars_context *mars;
+static struct mars_task_id task_ids[MARS_WORKLOAD_MAX];
+
+int main(void)
+{
+ int i, exit_code, ret;
+
+ ret = mars_context_create(&mars, 0, 0);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+
+ for (i = 0; i < MARS_WORKLOAD_MAX; i++) {
+ ret = mars_task_create(
+ mars,
+ &task_ids[i],
+ "13007",
+ mpu_prog.elf_image,
+ 0);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+ }
+
+ for (i = 0; i < MARS_WORKLOAD_MAX; i++) {
+ ret = mars_task_schedule(&task_ids[i], NULL, 0);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+ }
+
+ for (i = 0; i < MARS_WORKLOAD_MAX; i++) {
+ ret = mars_task_wait(&task_ids[i], &exit_code);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+ }
+
+ for (i = 0; i < MARS_WORKLOAD_MAX; i++) {
+ ret = mars_task_destroy(&task_ids[i]);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+ }
+
+ ret = mars_context_destroy(mars);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+
+ return 0;
+}
diff --git a/tests/TFP/TFP_13_007/mpu.c b/tests/TFP/TFP_13_007/mpu.c
new file mode 100644
index 0000000..143a198
--- /dev/null
+++ b/tests/TFP/TFP_13_007/mpu.c
@@ -0,0 +1,31 @@
+/*
+ * Copyright 2008 Sony Corporation
+ *
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a copy
+ * of this software and associated documentation files (the "Software"), to deal
+ * in the Software without restriction, including without limitation the rights
+ * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+ * copies of the Software, and to permit persons to whom the Software is
+ * furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included in
+ * all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+ * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+ * THE SOFTWARE.
+ */
+
+#include <mars/mars.h>
+
+int mars_task_main(const struct mars_task_args *task_args)
+{
+ mars_task_exit(0);
+
+ return 0;
+}
diff --git a/tests/TFP/TFP_13_008/Makefile b/tests/TFP/TFP_13_008/Makefile
new file mode 100644
index 0000000..432135a
--- /dev/null
+++ b/tests/TFP/TFP_13_008/Makefile
@@ -0,0 +1,28 @@
+#
+# Copyright 2008 Sony Corporation
+#
+#
+# Permission is hereby granted, free of charge, to any person obtaining a copy
+# of this software and associated documentation files (the "Software"), to deal
+# in the Software without restriction, including without limitation the rights
+# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+# copies of the Software, and to permit persons to whom the Software is
+# furnished to do so, subject to the following conditions:
+#
+# The above copyright notice and this permission notice shall be included in
+# all copies or substantial portions of the Software.
+#
+# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+# THE SOFTWARE.
+#
+
+top_srcdir = ../..
+test_objs = host.o mpu.task_eo
+
+include $(top_srcdir)/scripts/config.mk
+include $(top_srcdir)/scripts/rules_item.mk
diff --git a/tests/TFP/TFP_13_008/host.c b/tests/TFP/TFP_13_008/host.c
new file mode 100644
index 0000000..8aa5af2
--- /dev/null
+++ b/tests/TFP/TFP_13_008/host.c
@@ -0,0 +1,85 @@
+/*
+ * Copyright 2008 Sony Corporation
+ *
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a copy
+ * of this software and associated documentation files (the "Software"), to deal
+ * in the Software without restriction, including without limitation the rights
+ * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+ * copies of the Software, and to permit persons to whom the Software is
+ * furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included in
+ * all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+ * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+ * THE SOFTWARE.
+ */
+
+#include <pthread.h>
+#include <libspe2.h>
+#include <mars/mars.h>
+#include <mars_test.h>
+
+#define THREAD_COUNT 16
+
+extern spe_program_handle_t mpu_prog;
+
+static struct mars_context *mars;
+static struct mars_task_id task_ids[THREAD_COUNT];
+static pthread_t threads[THREAD_COUNT];
+
+void *thread_proc(void *arg)
+{
+ int ret;
+
+ ret = mars_task_schedule(&task_ids[mars_ptr_to_ea(arg)], NULL, 0);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+
+ return NULL;
+}
+
+int main(void)
+{
+ int i, exit_code, ret;
+
+ ret = mars_context_create(&mars, 0, 0);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+
+ for (i = 0; i < THREAD_COUNT; i++) {
+ ret = mars_task_create(
+ mars,
+ &task_ids[i],
+ "13008",
+ mpu_prog.elf_image,
+ 0);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+ }
+
+ for (i = 0; i < THREAD_COUNT; i++)
+ pthread_create(
+ &threads[i],
+ NULL,
+ thread_proc,
+ (void *)(uintptr_t)i);
+
+ for (i = 0; i < THREAD_COUNT; i++) {
+ pthread_join(threads[i], NULL);
+
+ ret = mars_task_wait(&task_ids[i], &exit_code);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+
+ ret = mars_task_destroy(&task_ids[i]);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+ }
+
+ ret = mars_context_destroy(mars);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+
+ return 0;
+}
diff --git a/tests/TFP/TFP_13_008/mpu.c b/tests/TFP/TFP_13_008/mpu.c
new file mode 100644
index 0000000..143a198
--- /dev/null
+++ b/tests/TFP/TFP_13_008/mpu.c
@@ -0,0 +1,31 @@
+/*
+ * Copyright 2008 Sony Corporation
+ *
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a copy
+ * of this software and associated documentation files (the "Software"), to deal
+ * in the Software without restriction, including without limitation the rights
+ * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+ * copies of the Software, and to permit persons to whom the Software is
+ * furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included in
+ * all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+ * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+ * THE SOFTWARE.
+ */
+
+#include <mars/mars.h>
+
+int mars_task_main(const struct mars_task_args *task_args)
+{
+ mars_task_exit(0);
+
+ return 0;
+}
diff --git a/tests/TFP/TFP_14_001/Makefile b/tests/TFP/TFP_14_001/Makefile
new file mode 100644
index 0000000..432135a
--- /dev/null
+++ b/tests/TFP/TFP_14_001/Makefile
@@ -0,0 +1,28 @@
+#
+# Copyright 2008 Sony Corporation
+#
+#
+# Permission is hereby granted, free of charge, to any person obtaining a copy
+# of this software and associated documentation files (the "Software"), to deal
+# in the Software without restriction, including without limitation the rights
+# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+# copies of the Software, and to permit persons to whom the Software is
+# furnished to do so, subject to the following conditions:
+#
+# The above copyright notice and this permission notice shall be included in
+# all copies or substantial portions of the Software.
+#
+# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+# THE SOFTWARE.
+#
+
+top_srcdir = ../..
+test_objs = host.o mpu.task_eo
+
+include $(top_srcdir)/scripts/config.mk
+include $(top_srcdir)/scripts/rules_item.mk
diff --git a/tests/TFP/TFP_14_001/common.h b/tests/TFP/TFP_14_001/common.h
new file mode 100644
index 0000000..c49c401
--- /dev/null
+++ b/tests/TFP/TFP_14_001/common.h
@@ -0,0 +1,24 @@
+/*
+ * Copyright (C) 2008 Sony Computer Entertainment Inc.
+ *
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a copy
+ * of this software and associated documentation files (the "Software"), to deal
+ * in the Software without restriction, including without limitation the rights
+ * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+ * copies of the Software, and to permit persons to whom the Software is
+ * furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included in
+ * all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+ * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+ * THE SOFTWARE.
+ */
+
+#define MAGIC_UINT32 0x89ABCDEF
diff --git a/tests/TFP/TFP_14_001/host.c b/tests/TFP/TFP_14_001/host.c
new file mode 100644
index 0000000..c435e0e
--- /dev/null
+++ b/tests/TFP/TFP_14_001/host.c
@@ -0,0 +1,75 @@
+/*
+ * Copyright (C) 2008 Sony Computer Entertainment Inc.
+ *
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a copy
+ * of this software and associated documentation files (the "Software"), to deal
+ * in the Software without restriction, including without limitation the rights
+ * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+ * copies of the Software, and to permit persons to whom the Software is
+ * furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included in
+ * all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+ * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+ * THE SOFTWARE.
+ */
+
+#include <mars/mars.h>
+#include <libspe2.h>
+#include <mars_test.h>
+#include "common.h"
+
+extern spe_program_handle_t mpu_prog;
+
+static struct mars_context *mars_ctx;
+static struct mars_task_id task_id;
+static struct mars_task_args task_args;
+
+static uint32_t shared_resource __attribute__((aligned(16)));
+
+int main(void)
+{
+ int ret;
+ int32_t exit_code;
+ uint32_t tb_freq;
+
+ ret = mars_test_get_timebase_freq(&tb_freq);
+ MARS_TEST_ASSERT_EQUAL(ret, 0);
+
+ ret = mars_context_create(&mars_ctx, 0, 0);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+
+ ret = mars_task_create(mars_ctx, &task_id, NULL,
+ mpu_prog.elf_image, MARS_TASK_CONTEXT_SAVE_ALL);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+
+ task_args.type.u64[0] = mars_ptr_to_ea(&shared_resource);
+ task_args.type.u64[1] = tb_freq;
+ ret = mars_task_schedule(&task_id, &task_args, 0);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+
+ /* wiat MPU task to run */
+ mars_test_counter_wait(&shared_resource, 1);
+
+ ret = mars_task_wait(&task_id, &exit_code);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+ MARS_TEST_ASSERT_ERROR(exit_code, 0);
+ MARS_TEST_ASSERT_EQUAL(shared_resource, MAGIC_UINT32);
+
+ ret = mars_task_destroy(&task_id);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+
+ ret = mars_context_destroy(mars_ctx);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+
+ return 0;
+}
+
+
diff --git a/tests/TFP/TFP_14_001/mpu.c b/tests/TFP/TFP_14_001/mpu.c
new file mode 100644
index 0000000..e98ba62
--- /dev/null
+++ b/tests/TFP/TFP_14_001/mpu.c
@@ -0,0 +1,41 @@
+/*
+ * Copyright (C) 2008 Sony Computer Entertainment Inc.
+ *
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a copy
+ * of this software and associated documentation files (the "Software"), to deal
+ * in the Software without restriction, including without limitation the rights
+ * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+ * copies of the Software, and to permit persons to whom the Software is
+ * furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included in
+ * all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+ * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+ * THE SOFTWARE.
+ */
+
+#include <mars/mars.h>
+#include <mars_test.h>
+#include <spu_mfcio.h>
+#include "common.h"
+
+int mars_task_main(const struct mars_task_args *task_args)
+{
+ uint64_t shared_resource_ea = task_args->type.u64[0];
+ uint32_t tb_freq = task_args->type.u64[1];
+
+ mars_test_counter_set(shared_resource_ea, 1);
+
+ mars_test_sleep(tb_freq, 1);
+
+ mars_test_counter_set(shared_resource_ea, MAGIC_UINT32);
+
+ return 0;
+}
diff --git a/tests/TFP/TFP_14_002/Makefile b/tests/TFP/TFP_14_002/Makefile
new file mode 100644
index 0000000..432135a
--- /dev/null
+++ b/tests/TFP/TFP_14_002/Makefile
@@ -0,0 +1,28 @@
+#
+# Copyright 2008 Sony Corporation
+#
+#
+# Permission is hereby granted, free of charge, to any person obtaining a copy
+# of this software and associated documentation files (the "Software"), to deal
+# in the Software without restriction, including without limitation the rights
+# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+# copies of the Software, and to permit persons to whom the Software is
+# furnished to do so, subject to the following conditions:
+#
+# The above copyright notice and this permission notice shall be included in
+# all copies or substantial portions of the Software.
+#
+# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+# THE SOFTWARE.
+#
+
+top_srcdir = ../..
+test_objs = host.o mpu.task_eo
+
+include $(top_srcdir)/scripts/config.mk
+include $(top_srcdir)/scripts/rules_item.mk
diff --git a/tests/TFP/TFP_14_002/host.c b/tests/TFP/TFP_14_002/host.c
new file mode 100644
index 0000000..6d0ee9e
--- /dev/null
+++ b/tests/TFP/TFP_14_002/host.c
@@ -0,0 +1,96 @@
+/*
+ * Copyright 2008 Sony Corporation
+ *
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a copy
+ * of this software and associated documentation files (the "Software"), to deal
+ * in the Software without restriction, including without limitation the rights
+ * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+ * copies of the Software, and to permit persons to whom the Software is
+ * furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included in
+ * all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+ * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+ * THE SOFTWARE.
+ */
+
+#include <pthread.h>
+#include <unistd.h>
+#include <libspe2.h>
+#include <mars/mars.h>
+#include <mars_test.h>
+
+#define THREAD_COUNT 16
+
+extern spe_program_handle_t mpu_prog;
+
+static struct mars_context *mars;
+static struct mars_task_id task_id;
+static struct mars_task_args task_args;
+static pthread_t threads[THREAD_COUNT];
+static int finished[THREAD_COUNT];
+
+void *thread_proc(void *arg)
+{
+ int exit_code, ret;
+
+ ret = mars_task_wait(&task_id, &exit_code);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+ MARS_TEST_ASSERT_EQUAL(exit_code, 0);
+
+ finished[mars_ptr_to_ea(arg)] = 1;
+
+ return NULL;
+}
+
+int main(void)
+{
+ int i, ret;
+ uint32_t tb_freq;
+
+ ret = mars_test_get_timebase_freq(&tb_freq);
+ MARS_TEST_ASSERT_EQUAL(ret, 0);
+
+ ret = mars_context_create(&mars, 0, 0);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+
+ ret = mars_task_create(mars, &task_id, "14002", mpu_prog.elf_image, 0);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+
+ task_args.type.u32[0] = tb_freq;
+ ret = mars_task_schedule(&task_id, &task_args, 0);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+
+ for (i = 0; i < THREAD_COUNT; i++) {
+ finished[i] = 0;
+
+ pthread_create(
+ &threads[i],
+ NULL,
+ thread_proc,
+ (void *)(uintptr_t)i);
+ }
+
+ sleep(2);
+
+ for (i = 0; i < THREAD_COUNT; i++) {
+ MARS_TEST_ASSERT(finished[i]);
+
+ pthread_join(threads[i], NULL);
+ }
+
+ ret = mars_task_destroy(&task_id);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+
+ ret = mars_context_destroy(mars);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+
+ return 0;
+}
diff --git a/tests/TFP/TFP_14_002/mpu.c b/tests/TFP/TFP_14_002/mpu.c
new file mode 100644
index 0000000..15f6f76
--- /dev/null
+++ b/tests/TFP/TFP_14_002/mpu.c
@@ -0,0 +1,36 @@
+/*
+ * Copyright 2008 Sony Corporation
+ *
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a copy
+ * of this software and associated documentation files (the "Software"), to deal
+ * in the Software without restriction, including without limitation the rights
+ * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+ * copies of the Software, and to permit persons to whom the Software is
+ * furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included in
+ * all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+ * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+ * THE SOFTWARE.
+ */
+
+#include <mars/mars.h>
+#include <mars_test.h>
+
+int mars_task_main(const struct mars_task_args *task_args)
+{
+ uint32_t tb_freq = task_args->type.u32[0];
+
+ mars_test_sleep(tb_freq, 1);
+
+ mars_task_exit(0);
+
+ return 0;
+}
diff --git a/tests/TFP/TFP_15_001/Makefile b/tests/TFP/TFP_15_001/Makefile
new file mode 100644
index 0000000..432135a
--- /dev/null
+++ b/tests/TFP/TFP_15_001/Makefile
@@ -0,0 +1,28 @@
+#
+# Copyright 2008 Sony Corporation
+#
+#
+# Permission is hereby granted, free of charge, to any person obtaining a copy
+# of this software and associated documentation files (the "Software"), to deal
+# in the Software without restriction, including without limitation the rights
+# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+# copies of the Software, and to permit persons to whom the Software is
+# furnished to do so, subject to the following conditions:
+#
+# The above copyright notice and this permission notice shall be included in
+# all copies or substantial portions of the Software.
+#
+# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+# THE SOFTWARE.
+#
+
+top_srcdir = ../..
+test_objs = host.o mpu.task_eo
+
+include $(top_srcdir)/scripts/config.mk
+include $(top_srcdir)/scripts/rules_item.mk
diff --git a/tests/TFP/TFP_15_001/host.c b/tests/TFP/TFP_15_001/host.c
new file mode 100644
index 0000000..fc2a744
--- /dev/null
+++ b/tests/TFP/TFP_15_001/host.c
@@ -0,0 +1,76 @@
+/*
+ * Copyright (C) 2008 Sony Computer Entertainment Inc.
+ *
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a copy
+ * of this software and associated documentation files (the "Software"), to deal
+ * in the Software without restriction, including without limitation the rights
+ * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+ * copies of the Software, and to permit persons to whom the Software is
+ * furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included in
+ * all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+ * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+ * THE SOFTWARE.
+ */
+
+#include <mars/mars.h>
+#include <libspe2.h>
+#include <mars_test.h>
+
+extern spe_program_handle_t mpu_prog;
+
+static struct mars_context *mars_ctx;
+static struct mars_task_id task_id;
+static struct mars_task_args task_args;
+static uint32_t shared_resource __attribute__((aligned(128)));
+
+int main(void)
+{
+ int ret;
+ int32_t exit_code;
+
+ ret = mars_context_create(&mars_ctx, 0, 0);
+ MARS_TEST_ASSERT_EQUAL(ret, MARS_SUCCESS);
+
+ ret = mars_task_create(mars_ctx, &task_id, NULL,
+ mpu_prog.elf_image, MARS_TASK_CONTEXT_SAVE_ALL);
+ MARS_TEST_ASSERT_EQUAL(ret, MARS_SUCCESS);
+
+ task_args.type.u64[0] = mars_ptr_to_ea(&shared_resource);
+ ret = mars_task_schedule(&task_id, &task_args, 0);
+ MARS_TEST_ASSERT_EQUAL(ret, MARS_SUCCESS);
+
+ mars_test_counter_wait(&shared_resource, 1);
+
+ ret = mars_task_try_wait(&task_id, &exit_code);
+ MARS_TEST_ASSERT_EQUAL(ret, MARS_ERROR_BUSY);
+
+ mars_test_counter_set(&shared_resource, 2);
+
+ ret = mars_task_wait(&task_id, &exit_code);
+ MARS_TEST_ASSERT_EQUAL(ret, MARS_SUCCESS);
+ MARS_TEST_ASSERT_EQUAL(exit_code, 0);
+
+ /* Does mars_task_try_wait succeed againt the task already finished? */
+ ret = mars_task_try_wait(&task_id, &exit_code);
+ MARS_TEST_ASSERT_EQUAL(ret, MARS_SUCCESS);
+ MARS_TEST_ASSERT_EQUAL(exit_code, 0);
+
+ ret = mars_task_destroy(&task_id);
+ MARS_TEST_ASSERT_EQUAL(ret, MARS_SUCCESS);
+
+ ret = mars_context_destroy(mars_ctx);
+ MARS_TEST_ASSERT_EQUAL(ret, MARS_SUCCESS);
+
+ return 0;
+}
+
+
diff --git a/tests/TFP/TFP_15_001/mpu.c b/tests/TFP/TFP_15_001/mpu.c
new file mode 100644
index 0000000..0a984dd
--- /dev/null
+++ b/tests/TFP/TFP_15_001/mpu.c
@@ -0,0 +1,37 @@
+/*
+ * Copyright (C) 2008 Sony Computer Entertainment Inc.
+ *
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a copy
+ * of this software and associated documentation files (the "Software"), to deal
+ * in the Software without restriction, including without limitation the rights
+ * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+ * copies of the Software, and to permit persons to whom the Software is
+ * furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included in
+ * all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+ * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+ * THE SOFTWARE.
+ */
+
+#include <mars/mars.h>
+#include <mars_test.h>
+
+int mars_task_main(const struct mars_task_args *task_args)
+{
+ uint64_t shared_resource_ea = task_args->type.u64[0];
+
+ mars_test_counter_set(shared_resource_ea, 1);
+
+ /* wait for ready to finish */
+ mars_test_counter_wait(shared_resource_ea, 2);
+
+ return 0;
+}
diff --git a/tests/TFP/TFP_15_002/Makefile b/tests/TFP/TFP_15_002/Makefile
new file mode 100644
index 0000000..432135a
--- /dev/null
+++ b/tests/TFP/TFP_15_002/Makefile
@@ -0,0 +1,28 @@
+#
+# Copyright 2008 Sony Corporation
+#
+#
+# Permission is hereby granted, free of charge, to any person obtaining a copy
+# of this software and associated documentation files (the "Software"), to deal
+# in the Software without restriction, including without limitation the rights
+# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+# copies of the Software, and to permit persons to whom the Software is
+# furnished to do so, subject to the following conditions:
+#
+# The above copyright notice and this permission notice shall be included in
+# all copies or substantial portions of the Software.
+#
+# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+# THE SOFTWARE.
+#
+
+top_srcdir = ../..
+test_objs = host.o mpu.task_eo
+
+include $(top_srcdir)/scripts/config.mk
+include $(top_srcdir)/scripts/rules_item.mk
diff --git a/tests/TFP/TFP_15_002/host.c b/tests/TFP/TFP_15_002/host.c
new file mode 100644
index 0000000..482eb48
--- /dev/null
+++ b/tests/TFP/TFP_15_002/host.c
@@ -0,0 +1,73 @@
+/*
+ * Copyright (C) 2008 Sony Computer Entertainment Inc.
+ *
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a copy
+ * of this software and associated documentation files (the "Software"), to deal
+ * in the Software without restriction, including without limitation the rights
+ * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+ * copies of the Software, and to permit persons to whom the Software is
+ * furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included in
+ * all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+ * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+ * THE SOFTWARE.
+ */
+
+#include <mars/mars.h>
+#include <libspe2.h>
+#include <mars_test.h>
+
+extern spe_program_handle_t mpu_prog;
+
+static struct mars_context *mars_ctx;
+static struct mars_task_id task_id;
+static struct mars_task_args task_args;
+
+static uint32_t shared_resource __attribute__((aligned(128)));
+
+int main(void)
+{
+ int ret;
+ int32_t exit_code;
+
+ ret = mars_context_create(&mars_ctx, 0, 0);
+ MARS_TEST_ASSERT_EQUAL(ret, MARS_SUCCESS);
+
+ ret = mars_task_create(mars_ctx, &task_id, NULL,
+ mpu_prog.elf_image, MARS_TASK_CONTEXT_SAVE_ALL);
+ MARS_TEST_ASSERT_EQUAL(ret, MARS_SUCCESS);
+
+ task_args.type.u64[0] = mars_ptr_to_ea(&shared_resource);
+ ret = mars_task_schedule(&task_id, &task_args, 0);
+ MARS_TEST_ASSERT_EQUAL(ret, MARS_SUCCESS);
+
+ mars_test_counter_wait(&shared_resource, 1);
+
+ /* Does mars_task_try_wait work correctly againt a task alive? */
+ ret = mars_task_try_wait(&task_id, &exit_code);
+ MARS_TEST_ASSERT_EQUAL(ret, MARS_ERROR_BUSY);
+
+ mars_test_counter_set(&shared_resource, 2);
+
+ ret = mars_task_wait(&task_id, &exit_code);
+ MARS_TEST_ASSERT_EQUAL(ret, MARS_SUCCESS);
+ MARS_TEST_ASSERT_EQUAL(exit_code, 0);
+
+ ret = mars_task_destroy(&task_id);
+ MARS_TEST_ASSERT_EQUAL(ret, MARS_SUCCESS);
+
+ ret = mars_context_destroy(mars_ctx);
+ MARS_TEST_ASSERT_EQUAL(ret, MARS_SUCCESS);
+
+ return 0;
+}
+
+
diff --git a/tests/TFP/TFP_15_002/mpu.c b/tests/TFP/TFP_15_002/mpu.c
new file mode 100644
index 0000000..d6ee8cd
--- /dev/null
+++ b/tests/TFP/TFP_15_002/mpu.c
@@ -0,0 +1,36 @@
+/*
+ * Copyright (C) 2008 Sony Computer Entertainment Inc.
+ *
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a copy
+ * of this software and associated documentation files (the "Software"), to deal
+ * in the Software without restriction, including without limitation the rights
+ * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+ * copies of the Software, and to permit persons to whom the Software is
+ * furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included in
+ * all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+ * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+ * THE SOFTWARE.
+ */
+
+#include <mars/mars.h>
+#include <mars_test.h>
+
+int mars_task_main(const struct mars_task_args *task_args)
+{
+ uint64_t shared_resource_ea = task_args->type.u64[0];
+
+ mars_test_counter_set(shared_resource_ea, 1);
+
+ mars_test_counter_wait(shared_resource_ea, 2);
+
+ return 0;
+}
diff --git a/tests/TFP/TFP_17_001/Makefile b/tests/TFP/TFP_17_001/Makefile
new file mode 100644
index 0000000..432135a
--- /dev/null
+++ b/tests/TFP/TFP_17_001/Makefile
@@ -0,0 +1,28 @@
+#
+# Copyright 2008 Sony Corporation
+#
+#
+# Permission is hereby granted, free of charge, to any person obtaining a copy
+# of this software and associated documentation files (the "Software"), to deal
+# in the Software without restriction, including without limitation the rights
+# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+# copies of the Software, and to permit persons to whom the Software is
+# furnished to do so, subject to the following conditions:
+#
+# The above copyright notice and this permission notice shall be included in
+# all copies or substantial portions of the Software.
+#
+# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+# THE SOFTWARE.
+#
+
+top_srcdir = ../..
+test_objs = host.o mpu.task_eo
+
+include $(top_srcdir)/scripts/config.mk
+include $(top_srcdir)/scripts/rules_item.mk
diff --git a/tests/TFP/TFP_17_001/common.h b/tests/TFP/TFP_17_001/common.h
new file mode 100644
index 0000000..1dec3fb
--- /dev/null
+++ b/tests/TFP/TFP_17_001/common.h
@@ -0,0 +1,26 @@
+/*
+ * Copyright (C) 2008 Sony Computer Entertainment Inc.
+ *
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a copy
+ * of this software and associated documentation files (the "Software"), to deal
+ * in the Software without restriction, including without limitation the rights
+ * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+ * copies of the Software, and to permit persons to whom the Software is
+ * furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included in
+ * all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+ * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+ * THE SOFTWARE.
+ */
+
+#define MAGIC_INT32 0x01234567
+#define MAGIC_UINT32 0x89ABCDEF
+
diff --git a/tests/TFP/TFP_17_001/host.c b/tests/TFP/TFP_17_001/host.c
new file mode 100644
index 0000000..7de3434
--- /dev/null
+++ b/tests/TFP/TFP_17_001/host.c
@@ -0,0 +1,74 @@
+/*
+ * Copyright (C) 2008 Sony Computer Entertainment Inc.
+ *
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a copy
+ * of this software and associated documentation files (the "Software"), to deal
+ * in the Software without restriction, including without limitation the rights
+ * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+ * copies of the Software, and to permit persons to whom the Software is
+ * furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included in
+ * all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+ * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+ * THE SOFTWARE.
+ */
+
+#include <unistd.h>
+#include <libspe2.h>
+#include <mars/mars.h>
+#include <mars_test.h>
+#include "common.h"
+
+extern spe_program_handle_t mpu_prog;
+
+static struct mars_context *mars_ctx;
+static struct mars_task_id task_id;
+static struct mars_task_args task_args;
+static uint32_t shared_resource __attribute__((aligned(16))) = MAGIC_UINT32;
+
+int main(void)
+{
+ int ret;
+ int32_t exit_code;
+
+ ret = mars_context_create(&mars_ctx, 0, 0);
+ MARS_TEST_ASSERT_EQUAL(ret, MARS_SUCCESS);
+
+ ret = mars_task_create(mars_ctx, &task_id, NULL,
+ mpu_prog.elf_image, MARS_TASK_CONTEXT_SAVE_ALL);
+ MARS_TEST_ASSERT_EQUAL(ret, MARS_SUCCESS);
+
+ task_args.type.u64[0] = mars_ptr_to_ea(&shared_resource);
+
+ ret = mars_task_schedule(&task_id, &task_args, 0);
+ MARS_TEST_ASSERT_EQUAL(ret, MARS_SUCCESS);
+
+ ret = mars_task_wait(&task_id, &exit_code);
+ MARS_TEST_ASSERT_EQUAL(ret, MARS_SUCCESS);
+
+ /* if exit_code != MAGIC_INT32, it means the MPU task didn't exit with
+ mars_task_exit */
+ MARS_TEST_ASSERT_EQUAL(exit_code, MAGIC_INT32);
+
+ sleep(1);
+
+ MARS_TEST_ASSERT_EQUAL(shared_resource, MAGIC_UINT32);
+
+ ret = mars_task_destroy(&task_id);
+ MARS_TEST_ASSERT_EQUAL(ret, MARS_SUCCESS);
+
+ ret = mars_context_destroy(mars_ctx);
+ MARS_TEST_ASSERT_EQUAL(ret, MARS_SUCCESS);
+
+ return 0;
+}
+
+
diff --git a/tests/TFP/TFP_17_001/mpu.c b/tests/TFP/TFP_17_001/mpu.c
new file mode 100644
index 0000000..1311829
--- /dev/null
+++ b/tests/TFP/TFP_17_001/mpu.c
@@ -0,0 +1,43 @@
+/*
+ * Copyright (C) 2008 Sony Computer Entertainment Inc.
+ *
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a copy
+ * of this software and associated documentation files (the "Software"), to deal
+ * in the Software without restriction, including without limitation the rights
+ * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+ * copies of the Software, and to permit persons to whom the Software is
+ * furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included in
+ * all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+ * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+ * THE SOFTWARE.
+ */
+
+#include <spu_mfcio.h>
+#include <mars/mars.h>
+#include "common.h"
+
+static uint32_t shared_resource __attribute__((aligned(16)));
+
+int mars_task_main(const struct mars_task_args *task_args)
+{
+ uint64_t shared_resource_ea = task_args->type.u64[0];
+
+ mars_task_exit(MAGIC_INT32);
+
+ shared_resource = 0;
+ mfc_put(&shared_resource,
+ shared_resource_ea, sizeof(uint32_t), 0, 0, 0);
+ mfc_write_tag_mask(1 << 0);
+ mfc_read_tag_status_all();
+
+ return 0;
+}
diff --git a/tests/TFP/TFP_18_001/Makefile b/tests/TFP/TFP_18_001/Makefile
new file mode 100644
index 0000000..432135a
--- /dev/null
+++ b/tests/TFP/TFP_18_001/Makefile
@@ -0,0 +1,28 @@
+#
+# Copyright 2008 Sony Corporation
+#
+#
+# Permission is hereby granted, free of charge, to any person obtaining a copy
+# of this software and associated documentation files (the "Software"), to deal
+# in the Software without restriction, including without limitation the rights
+# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+# copies of the Software, and to permit persons to whom the Software is
+# furnished to do so, subject to the following conditions:
+#
+# The above copyright notice and this permission notice shall be included in
+# all copies or substantial portions of the Software.
+#
+# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+# THE SOFTWARE.
+#
+
+top_srcdir = ../..
+test_objs = host.o mpu.task_eo
+
+include $(top_srcdir)/scripts/config.mk
+include $(top_srcdir)/scripts/rules_item.mk
diff --git a/tests/TFP/TFP_18_001/cmd.h b/tests/TFP/TFP_18_001/cmd.h
new file mode 100644
index 0000000..22d5b06
--- /dev/null
+++ b/tests/TFP/TFP_18_001/cmd.h
@@ -0,0 +1,28 @@
+/*
+ * Copyright (C) 2008 Sony Computer Entertainment Inc.
+ *
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a copy
+ * of this software and associated documentation files (the "Software"), to deal
+ * in the Software without restriction, including without limitation the rights
+ * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+ * copies of the Software, and to permit persons to whom the Software is
+ * furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included in
+ * all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+ * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+ * THE SOFTWARE.
+ */
+
+#define CMD_NOP 0
+#define CMD_HELLO 1
+#define CMD_EXIT 2
+#define CMD_YIELD 3
+
diff --git a/tests/TFP/TFP_18_001/host.c b/tests/TFP/TFP_18_001/host.c
new file mode 100644
index 0000000..0ad561f
--- /dev/null
+++ b/tests/TFP/TFP_18_001/host.c
@@ -0,0 +1,138 @@
+/*
+ * Copyright (C) 2008 Sony Computer Entertainment Inc.
+ *
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a copy
+ * of this software and associated documentation files (the "Software"), to deal
+ * in the Software without restriction, including without limitation the rights
+ * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+ * copies of the Software, and to permit persons to whom the Software is
+ * furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included in
+ * all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+ * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+ * THE SOFTWARE.
+ */
+
+#include <mars/mars.h>
+#include <libspe2.h>
+#include <mars_test.h>
+#include <unistd.h>
+#include "cmd.h"
+
+#define FAST_DMA_ALIGN 128
+#define NUM_TASK 32
+
+#define TASK_STATE_SLEEPING 0
+#define TASK_STATE_RUNNING 1
+
+extern spe_program_handle_t mpu_prog;
+
+static struct mars_context *mars_ctx;
+static struct mars_task_id task_id[NUM_TASK];
+static struct mars_task_args task_args;
+
+struct aligned_int {
+ int32_t val;
+ int8_t pad[FAST_DMA_ALIGN - sizeof(int32_t)];
+};
+
+struct aligned_int cmd[NUM_TASK] __attribute__((aligned(FAST_DMA_ALIGN)));
+struct aligned_int res[NUM_TASK] __attribute__((aligned(FAST_DMA_ALIGN)));
+
+int is_running(int task)
+{
+ res[task].val = 0;
+ cmd[task].val = CMD_HELLO;
+
+ /* wait enough time to get reply from the MARS task */
+ usleep(100);
+
+ cmd[task].val = CMD_NOP;
+ return res[task].val;
+}
+
+int main(void)
+{
+ int i, ret, num_mpu, state[NUM_TASK], yield_target,
+ running_task, yielded_task;
+ int32_t exit_code;
+
+ num_mpu = spe_cpu_info_get(SPE_COUNT_PHYSICAL_SPES, -1);
+ MARS_TEST_ASSERT(num_mpu > 0);
+ MARS_TEST_ASSERT(num_mpu < NUM_TASK);
+
+ ret = mars_context_create(&mars_ctx, 0, 0);
+ MARS_TEST_ASSERT_EQUAL(ret, MARS_SUCCESS);
+
+ for (i = 0; i < NUM_TASK; i++) {
+ ret = mars_task_create(mars_ctx, &task_id[i], NULL,
+ mpu_prog.elf_image, MARS_TASK_CONTEXT_SAVE_ALL);
+ MARS_TEST_ASSERT_EQUAL(ret, MARS_SUCCESS);
+
+ cmd[i].val = CMD_NOP;
+ task_args.type.u64[0] = mars_ptr_to_ea(&cmd[i].val);
+ task_args.type.u64[1] = mars_ptr_to_ea(&res[i].val);
+ ret = mars_task_schedule(&task_id[i], &task_args, 0);
+ MARS_TEST_ASSERT_EQUAL(ret, MARS_SUCCESS);
+ }
+
+ /* Check status of all tasks */
+ running_task = 0;
+ yield_target = 0;
+ for (i = 0; i < NUM_TASK; i++) {
+ if (is_running(i)) {
+ state[i] = TASK_STATE_RUNNING;
+ running_task++;
+ yield_target = i;
+ } else {
+ state[i] = TASK_STATE_SLEEPING;
+ }
+ }
+ MARS_TEST_ASSERT_EQUAL(running_task, num_mpu);
+
+ /* Command one running task to yield */
+ cmd[yield_target].val = CMD_YIELD;
+
+ /* sleep enough time to MARS task switch */
+ sleep(1);
+
+ /* Check status of all tasks again */
+ yielded_task = 0;
+ for (i = 0; i < NUM_TASK; i++) {
+ if (is_running(i) && (state[i] == TASK_STATE_SLEEPING))
+ yielded_task++;
+ }
+
+ /* The task issued yield must be sleeping and
+ only one task which have been sleeping must be running */
+ MARS_TEST_ASSERT(!is_running(yield_target));
+ MARS_TEST_ASSERT_EQUAL(yielded_task, 1);
+
+ /* Command all tasks to exit */
+ for (i = 0; i < NUM_TASK; i++)
+ cmd[i].val = CMD_EXIT;
+
+ /* Join all tasks */
+ for (i = 0; i < NUM_TASK; i++) {
+ ret = mars_task_wait(&task_id[i], &exit_code);
+ MARS_TEST_ASSERT_EQUAL(ret, 0);
+ MARS_TEST_ASSERT_EQUAL(exit_code, 0);
+
+ ret = mars_task_destroy(&task_id[i]);
+ MARS_TEST_ASSERT_EQUAL(ret, MARS_SUCCESS);
+ }
+
+ ret = mars_context_destroy(mars_ctx);
+ MARS_TEST_ASSERT_EQUAL(ret, MARS_SUCCESS);
+
+ return 0;
+}
+
diff --git a/tests/TFP/TFP_18_001/mpu.c b/tests/TFP/TFP_18_001/mpu.c
new file mode 100644
index 0000000..f1bdffc
--- /dev/null
+++ b/tests/TFP/TFP_18_001/mpu.c
@@ -0,0 +1,62 @@
+/*
+ * Copyright (C) 2008 Sony Computer Entertainment Inc.
+ *
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a copy
+ * of this software and associated documentation files (the "Software"), to deal
+ * in the Software without restriction, including without limitation the rights
+ * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+ * copies of the Software, and to permit persons to whom the Software is
+ * furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included in
+ * all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+ * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+ * THE SOFTWARE.
+ */
+
+#include <mars/mars.h>
+#include <spu_mfcio.h>
+#include <mars_task_test.h>
+#include "cmd.h"
+
+#define FAST_DMA_ALIGN 128
+
+static int32_t cmd __attribute__((aligned(FAST_DMA_ALIGN)));
+static int32_t res __attribute__((aligned(FAST_DMA_ALIGN)));
+
+int mars_task_main(const struct mars_task_args *task_args)
+{
+ int ret;
+ uint64_t cmd_ea = task_args->type.u64[0];
+ uint64_t res_ea = task_args->type.u64[1];
+
+ for (;;) {
+ mfc_get(&cmd, cmd_ea, sizeof(int32_t), 0, 0, 0);
+ mfc_write_tag_mask(1);
+ mfc_read_tag_status_all();
+
+ if (cmd == CMD_NOP)
+ continue;
+ if (cmd == CMD_EXIT)
+ break;
+ if (cmd == CMD_YIELD) {
+ ret = mars_task_yield();
+ MARS_TEST_ASSERT_EQUAL(ret, MARS_SUCCESS);
+ } else {
+ MARS_TEST_ASSERT_EQUAL(cmd, CMD_HELLO);
+ res = 1;
+ mfc_put(&res, res_ea, sizeof(int32_t), 0, 0, 0);
+ mfc_write_tag_mask(1);
+ mfc_read_tag_status_all();
+ }
+ }
+
+ return 0;
+}
diff --git a/tests/TFP/TFP_18_002/Makefile b/tests/TFP/TFP_18_002/Makefile
new file mode 100644
index 0000000..ecbce33
--- /dev/null
+++ b/tests/TFP/TFP_18_002/Makefile
@@ -0,0 +1,28 @@
+#
+# Copyright 2008 Sony Corporation
+#
+#
+# Permission is hereby granted, free of charge, to any person obtaining a copy
+# of this software and associated documentation files (the "Software"), to deal
+# in the Software without restriction, including without limitation the rights
+# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+# copies of the Software, and to permit persons to whom the Software is
+# furnished to do so, subject to the following conditions:
+#
+# The above copyright notice and this permission notice shall be included in
+# all copies or substantial portions of the Software.
+#
+# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+# THE SOFTWARE.
+#
+
+top_srcdir = ../..
+test_objs = host.o mpu1.task_eo mpu2.task_eo
+
+include $(top_srcdir)/scripts/config.mk
+include $(top_srcdir)/scripts/rules_item.mk
diff --git a/tests/TFP/TFP_18_002/host.c b/tests/TFP/TFP_18_002/host.c
new file mode 100644
index 0000000..1506790
--- /dev/null
+++ b/tests/TFP/TFP_18_002/host.c
@@ -0,0 +1,121 @@
+/*
+ * Copyright 2008 Sony Corporation
+ *
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a copy
+ * of this software and associated documentation files (the "Software"), to deal
+ * in the Software without restriction, including without limitation the rights
+ * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+ * copies of the Software, and to permit persons to whom the Software is
+ * furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included in
+ * all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+ * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+ * THE SOFTWARE.
+ */
+
+#include <pthread.h>
+#include <unistd.h>
+#include <sys/time.h>
+#include <libspe2.h>
+#include <mars/mars.h>
+#include <mars_test.h>
+
+#define MAX_TASK_COUNT 256
+#define VALID_TIME 10000
+
+extern spe_program_handle_t mpu1_prog, mpu2_prog;
+
+static struct mars_context *mars;
+static struct mars_task_id task_ids[MAX_TASK_COUNT];
+static struct mars_task_args task_args;
+static pthread_t threads[2];
+static long long times[2];
+static struct mars_task_args triggers[2] __attribute__((aligned(16)));
+
+long long int get_ticks()
+{
+ struct timeval tv;
+
+ gettimeofday(&tv, NULL);
+ return (long long int)tv.tv_sec*1000000 + tv.tv_usec;
+}
+
+void *thread_proc(void *arg)
+{
+ mars_test_counter_wait(&triggers[(int)(intptr_t)arg].type.u32[0], 1);
+
+ times[(int)(intptr_t)arg] = get_ticks();
+
+ return NULL;
+}
+
+int main(void)
+{
+ int i, exit_code, ret;
+ uint32_t tb_freq;
+
+ int spe_cnt = spe_cpu_info_get(SPE_COUNT_PHYSICAL_SPES, -1);
+
+ MARS_TEST_ASSERT(spe_cnt <= MAX_TASK_COUNT);
+
+ ret = mars_test_get_timebase_freq(&tb_freq);
+ MARS_TEST_ASSERT_EQUAL(ret, 0);
+
+ ret = mars_context_create(&mars, spe_cnt, 0);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+
+ for (i = 0; i < spe_cnt; i++) {
+ ret = mars_task_create(
+ mars,
+ &task_ids[i],
+ "18002",
+ (i < spe_cnt-1) ?
+ mpu1_prog.elf_image :
+ mpu2_prog.elf_image,
+ MARS_TASK_CONTEXT_SAVE_ALL);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+ }
+
+ triggers[0].type.u32[0] = 0;
+ triggers[1].type.u32[0] = 0;
+
+ pthread_create(&threads[0], NULL, thread_proc, (void *)(intptr_t)0);
+ pthread_create(&threads[1], NULL, thread_proc, (void *)(intptr_t)1);
+
+ task_args.type.u32[0] = tb_freq;
+ task_args.type.u64[1] = mars_ptr_to_ea(&triggers[0]);
+ task_args.type.u64[2] = mars_ptr_to_ea(&triggers[1]);
+
+ for (i = 0; i < spe_cnt; i++)
+ ret = mars_task_schedule(&task_ids[i], &task_args, 0);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+
+ for (i = 0; i < spe_cnt; i++) {
+ ret = mars_task_wait(&task_ids[i], &exit_code);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+ MARS_TEST_ASSERT_EQUAL(exit_code, 0);
+ }
+
+ pthread_join(threads[0], NULL);
+ pthread_join(threads[1], NULL);
+
+ for (i = 0; i < spe_cnt; i++) {
+ ret = mars_task_destroy(&task_ids[i]);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+ }
+
+ ret = mars_context_destroy(mars);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+
+ MARS_TEST_ASSERT(times[1]-times[0] < VALID_TIME);
+
+ return 0;
+}
diff --git a/tests/TFP/TFP_18_002/mpu1.c b/tests/TFP/TFP_18_002/mpu1.c
new file mode 100644
index 0000000..083c3f1
--- /dev/null
+++ b/tests/TFP/TFP_18_002/mpu1.c
@@ -0,0 +1,36 @@
+/*
+ * Copyright 2008 Sony Corporation
+ *
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a copy
+ * of this software and associated documentation files (the "Software"), to deal
+ * in the Software without restriction, including without limitation the rights
+ * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+ * copies of the Software, and to permit persons to whom the Software is
+ * furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included in
+ * all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+ * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+ * THE SOFTWARE.
+ */
+
+#include <mars_task_test.h>
+#include <mars/mars.h>
+
+int mars_task_main(const struct mars_task_args *task_args)
+{
+ uint32_t tb_freq = task_args->type.u32[0];
+
+ mars_test_sleep(tb_freq, 2);
+
+ mars_task_exit(0);
+
+ return 0;
+}
diff --git a/tests/TFP/TFP_18_002/mpu2.c b/tests/TFP/TFP_18_002/mpu2.c
new file mode 100644
index 0000000..d02aff2
--- /dev/null
+++ b/tests/TFP/TFP_18_002/mpu2.c
@@ -0,0 +1,43 @@
+/*
+ * Copyright 2008 Sony Corporation
+ *
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a copy
+ * of this software and associated documentation files (the "Software"), to deal
+ * in the Software without restriction, including without limitation the rights
+ * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+ * copies of the Software, and to permit persons to whom the Software is
+ * furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included in
+ * all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+ * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+ * THE SOFTWARE.
+ */
+
+#include <mars_task_test.h>
+#include <mars/mars.h>
+
+int mars_task_main(const struct mars_task_args *task_args)
+{
+ int ret;
+ uint64_t trigger0_ea = task_args->type.u64[1];
+ uint64_t trigger1_ea = task_args->type.u64[2];
+
+ mars_test_counter_set(trigger0_ea, 1);
+
+ ret = mars_task_yield();
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+
+ mars_test_counter_set(trigger1_ea, 1);
+
+ mars_task_exit(0);
+
+ return 0;
+}
diff --git a/tests/TFP/TFP_19_001/Makefile b/tests/TFP/TFP_19_001/Makefile
new file mode 100644
index 0000000..432135a
--- /dev/null
+++ b/tests/TFP/TFP_19_001/Makefile
@@ -0,0 +1,28 @@
+#
+# Copyright 2008 Sony Corporation
+#
+#
+# Permission is hereby granted, free of charge, to any person obtaining a copy
+# of this software and associated documentation files (the "Software"), to deal
+# in the Software without restriction, including without limitation the rights
+# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+# copies of the Software, and to permit persons to whom the Software is
+# furnished to do so, subject to the following conditions:
+#
+# The above copyright notice and this permission notice shall be included in
+# all copies or substantial portions of the Software.
+#
+# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+# THE SOFTWARE.
+#
+
+top_srcdir = ../..
+test_objs = host.o mpu.task_eo
+
+include $(top_srcdir)/scripts/config.mk
+include $(top_srcdir)/scripts/rules_item.mk
diff --git a/tests/TFP/TFP_19_001/host.c b/tests/TFP/TFP_19_001/host.c
new file mode 100644
index 0000000..c31de92
--- /dev/null
+++ b/tests/TFP/TFP_19_001/host.c
@@ -0,0 +1,79 @@
+/*
+ * Copyright 2008 Sony Corporation
+ *
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a copy
+ * of this software and associated documentation files (the "Software"), to deal
+ * in the Software without restriction, including without limitation the rights
+ * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+ * copies of the Software, and to permit persons to whom the Software is
+ * furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included in
+ * all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+ * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+ * THE SOFTWARE.
+ */
+
+#include <libspe2.h>
+#include <mars/mars.h>
+#include <mars_test.h>
+
+#define MAX_TASK_COUNT 256
+
+extern spe_program_handle_t mpu_prog;
+
+static struct mars_context *mars;
+static struct mars_task_id task_ids[MAX_TASK_COUNT];
+static struct mars_task_args task_args;
+
+int main(void)
+{
+ int i, exit_code, ret;
+
+ int spe_cnt = spe_cpu_info_get(SPE_COUNT_PHYSICAL_SPES, -1);
+
+ MARS_TEST_ASSERT(spe_cnt <= MAX_TASK_COUNT);
+
+ ret = mars_context_create(&mars, spe_cnt, 0);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+
+ for (i = 0; i < spe_cnt; i++) {
+ ret = mars_task_create(
+ mars,
+ &task_ids[i],
+ "19001",
+ mpu_prog.elf_image,
+ 0);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+ }
+
+ task_args.type.u64[0] = spe_cnt;
+
+ for (i = 0; i < spe_cnt; i++) {
+ ret = mars_task_schedule(&task_ids[i], &task_args, 0);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+ }
+
+ for (i = 0; i < spe_cnt; i++) {
+ ret = mars_task_wait(&task_ids[i], &exit_code);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+ MARS_TEST_ASSERT_EQUAL(exit_code, 0);
+ }
+
+ for (i = 0; i < spe_cnt; i++) {
+ ret = mars_task_destroy(&task_ids[i]);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+ }
+
+ ret = mars_context_destroy(mars);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+
+ return 0;
+}
diff --git a/tests/TFP/TFP_19_001/mpu.c b/tests/TFP/TFP_19_001/mpu.c
new file mode 100644
index 0000000..d861be0
--- /dev/null
+++ b/tests/TFP/TFP_19_001/mpu.c
@@ -0,0 +1,34 @@
+/*
+ * Copyright 2008 Sony Corporation
+ *
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a copy
+ * of this software and associated documentation files (the "Software"), to deal
+ * in the Software without restriction, including without limitation the rights
+ * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+ * copies of the Software, and to permit persons to whom the Software is
+ * furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included in
+ * all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+ * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+ * THE SOFTWARE.
+ */
+
+#include <mars/mars.h>
+#include "mars_task_test.h"
+
+int mars_task_main(const struct mars_task_args *task_args)
+{
+ MARS_TEST_ASSERT(mars_task_get_kernel_id() <= task_args->type.u64[0]);
+
+ mars_task_exit(0);
+
+ return 0;
+}
diff --git a/tests/TFP/TFP_1A_001/Makefile b/tests/TFP/TFP_1A_001/Makefile
new file mode 100644
index 0000000..432135a
--- /dev/null
+++ b/tests/TFP/TFP_1A_001/Makefile
@@ -0,0 +1,28 @@
+#
+# Copyright 2008 Sony Corporation
+#
+#
+# Permission is hereby granted, free of charge, to any person obtaining a copy
+# of this software and associated documentation files (the "Software"), to deal
+# in the Software without restriction, including without limitation the rights
+# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+# copies of the Software, and to permit persons to whom the Software is
+# furnished to do so, subject to the following conditions:
+#
+# The above copyright notice and this permission notice shall be included in
+# all copies or substantial portions of the Software.
+#
+# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+# THE SOFTWARE.
+#
+
+top_srcdir = ../..
+test_objs = host.o mpu.task_eo
+
+include $(top_srcdir)/scripts/config.mk
+include $(top_srcdir)/scripts/rules_item.mk
diff --git a/tests/TFP/TFP_1A_001/host.c b/tests/TFP/TFP_1A_001/host.c
new file mode 100644
index 0000000..cbdac76
--- /dev/null
+++ b/tests/TFP/TFP_1A_001/host.c
@@ -0,0 +1,61 @@
+/*
+ * Copyright 2008 Sony Corporation
+ *
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a copy
+ * of this software and associated documentation files (the "Software"), to deal
+ * in the Software without restriction, including without limitation the rights
+ * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+ * copies of the Software, and to permit persons to whom the Software is
+ * furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included in
+ * all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+ * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+ * THE SOFTWARE.
+ */
+
+#include <libspe2.h>
+#include <mars/mars.h>
+#include <mars_test.h>
+
+extern spe_program_handle_t mpu_prog;
+
+static struct mars_context *mars;
+static struct mars_task_id task_id __attribute__((aligned(16)));
+static struct mars_task_args task_args;
+
+int main(void)
+{
+ int exit_code, ret;
+
+ ret = mars_context_create(&mars, 1, 0);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+
+ ret = mars_task_create(mars, &task_id, "1A001", mpu_prog.elf_image, 0);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+
+ task_args.type.u64[0] = mars_ptr_to_ea(&task_id);
+
+ ret = mars_task_schedule(&task_id, &task_args, 0);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+
+ ret = mars_task_wait(&task_id, &exit_code);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+
+ MARS_TEST_ASSERT_EQUAL(exit_code, 0);
+
+ ret = mars_task_destroy(&task_id);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+
+ ret = mars_context_destroy(mars);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+
+ return 0;
+}
diff --git a/tests/TFP/TFP_1A_001/mpu.c b/tests/TFP/TFP_1A_001/mpu.c
new file mode 100644
index 0000000..1ef0f51
--- /dev/null
+++ b/tests/TFP/TFP_1A_001/mpu.c
@@ -0,0 +1,58 @@
+/*
+ * Copyright 2008 Sony Corporation
+ *
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a copy
+ * of this software and associated documentation files (the "Software"), to deal
+ * in the Software without restriction, including without limitation the rights
+ * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+ * copies of the Software, and to permit persons to whom the Software is
+ * furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included in
+ * all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+ * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+ * THE SOFTWARE.
+ */
+
+#include <string.h>
+#include <spu_mfcio.h>
+#include <mars/mars.h>
+#include "mars_task_test.h"
+
+static inline void dma_wait(uint32_t tag)
+{
+ mfc_write_tag_mask(1 << tag);
+ mfc_write_tag_update_all();
+ mfc_read_tag_status();
+ mfc_sync(tag);
+}
+
+static inline void dma_get_and_wait(void *ls, uint64_t ea,
+ uint32_t size, uint32_t tag)
+{
+ mfc_get((volatile void *)ls, ea, size, tag, 0, 0);
+ dma_wait(tag);
+}
+
+static struct mars_task_id task_id __attribute__((aligned(16)));
+
+int mars_task_main(const struct mars_task_args *task_args)
+{
+ uint64_t task_id_ea = task_args->type.u64[0];
+
+ dma_get_and_wait(&task_id, task_id_ea, sizeof(task_id), 0);
+
+ MARS_TEST_ASSERT(
+ memcmp(mars_task_get_id(), &task_id, sizeof(task_id)) == 0);
+
+ mars_task_exit(0);
+
+ return 0;
+}
diff --git a/tests/TFP/TFP_21_001/Makefile b/tests/TFP/TFP_21_001/Makefile
new file mode 100644
index 0000000..43ba573
--- /dev/null
+++ b/tests/TFP/TFP_21_001/Makefile
@@ -0,0 +1,28 @@
+#
+# Copyright 2008 Sony Corporation
+#
+#
+# Permission is hereby granted, free of charge, to any person obtaining a copy
+# of this software and associated documentation files (the "Software"), to deal
+# in the Software without restriction, including without limitation the rights
+# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+# copies of the Software, and to permit persons to whom the Software is
+# furnished to do so, subject to the following conditions:
+#
+# The above copyright notice and this permission notice shall be included in
+# all copies or substantial portions of the Software.
+#
+# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+# THE SOFTWARE.
+#
+
+top_srcdir = ../..
+test_objs = host.o
+
+include $(top_srcdir)/scripts/config.mk
+include $(top_srcdir)/scripts/rules_item.mk
diff --git a/tests/TFP/TFP_21_001/host.c b/tests/TFP/TFP_21_001/host.c
new file mode 100644
index 0000000..79169e2
--- /dev/null
+++ b/tests/TFP/TFP_21_001/host.c
@@ -0,0 +1,48 @@
+/*
+ * Copyright 2008 Sony Corporation
+ *
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a copy
+ * of this software and associated documentation files (the "Software"), to deal
+ * in the Software without restriction, including without limitation the rights
+ * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+ * copies of the Software, and to permit persons to whom the Software is
+ * furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included in
+ * all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+ * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+ * THE SOFTWARE.
+ */
+
+#include <libspe2.h>
+#include <mars/mars.h>
+#include <mars_test.h>
+
+static struct mars_context *mars;
+static uint64_t barrier;
+
+int main(void)
+{
+ int ret;
+
+ ret = mars_context_create(&mars, 0, 0);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+
+ ret = mars_task_barrier_create(mars, &barrier, 1);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+
+ ret = mars_task_barrier_destroy(barrier);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+
+ ret = mars_context_destroy(mars);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+
+ return 0;
+}
diff --git a/tests/TFP/TFP_21_002/Makefile b/tests/TFP/TFP_21_002/Makefile
new file mode 100644
index 0000000..43ba573
--- /dev/null
+++ b/tests/TFP/TFP_21_002/Makefile
@@ -0,0 +1,28 @@
+#
+# Copyright 2008 Sony Corporation
+#
+#
+# Permission is hereby granted, free of charge, to any person obtaining a copy
+# of this software and associated documentation files (the "Software"), to deal
+# in the Software without restriction, including without limitation the rights
+# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+# copies of the Software, and to permit persons to whom the Software is
+# furnished to do so, subject to the following conditions:
+#
+# The above copyright notice and this permission notice shall be included in
+# all copies or substantial portions of the Software.
+#
+# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+# THE SOFTWARE.
+#
+
+top_srcdir = ../..
+test_objs = host.o
+
+include $(top_srcdir)/scripts/config.mk
+include $(top_srcdir)/scripts/rules_item.mk
diff --git a/tests/TFP/TFP_21_002/host.c b/tests/TFP/TFP_21_002/host.c
new file mode 100644
index 0000000..f8c1e52
--- /dev/null
+++ b/tests/TFP/TFP_21_002/host.c
@@ -0,0 +1,51 @@
+/*
+ * Copyright 2008 Sony Corporation
+ *
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a copy
+ * of this software and associated documentation files (the "Software"), to deal
+ * in the Software without restriction, including without limitation the rights
+ * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+ * copies of the Software, and to permit persons to whom the Software is
+ * furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included in
+ * all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+ * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+ * THE SOFTWARE.
+ */
+
+#include <mars/mars.h>
+#include <libspe2.h>
+#include <mars_test.h>
+
+#define NUM_TASKS MARS_TASK_BARRIER_WAIT_MAX
+
+static struct mars_context *mars_ctx;
+static uint64_t barrier;
+
+int main(void)
+{
+ int ret;
+
+ ret = mars_context_create(&mars_ctx, 0, 0);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+
+ ret = mars_task_barrier_create(mars_ctx, &barrier, NUM_TASKS);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+
+ ret = mars_task_barrier_destroy(barrier);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+
+ ret = mars_context_destroy(mars_ctx);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+
+ return 0;
+}
+
diff --git a/tests/TFP/TFP_21_003/Makefile b/tests/TFP/TFP_21_003/Makefile
new file mode 100644
index 0000000..43ba573
--- /dev/null
+++ b/tests/TFP/TFP_21_003/Makefile
@@ -0,0 +1,28 @@
+#
+# Copyright 2008 Sony Corporation
+#
+#
+# Permission is hereby granted, free of charge, to any person obtaining a copy
+# of this software and associated documentation files (the "Software"), to deal
+# in the Software without restriction, including without limitation the rights
+# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+# copies of the Software, and to permit persons to whom the Software is
+# furnished to do so, subject to the following conditions:
+#
+# The above copyright notice and this permission notice shall be included in
+# all copies or substantial portions of the Software.
+#
+# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+# THE SOFTWARE.
+#
+
+top_srcdir = ../..
+test_objs = host.o
+
+include $(top_srcdir)/scripts/config.mk
+include $(top_srcdir)/scripts/rules_item.mk
diff --git a/tests/TFP/TFP_21_003/host.c b/tests/TFP/TFP_21_003/host.c
new file mode 100644
index 0000000..d611988
--- /dev/null
+++ b/tests/TFP/TFP_21_003/host.c
@@ -0,0 +1,72 @@
+/*
+ * Copyright 2008 Sony Corporation
+ *
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a copy
+ * of this software and associated documentation files (the "Software"), to deal
+ * in the Software without restriction, including without limitation the rights
+ * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+ * copies of the Software, and to permit persons to whom the Software is
+ * furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included in
+ * all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+ * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+ * THE SOFTWARE.
+ */
+
+#include <pthread.h>
+#include <libspe2.h>
+#include <mars/mars.h>
+#include <mars_test.h>
+
+#define THREAD_COUNT 16
+
+static pthread_t threads[THREAD_COUNT];
+static struct mars_context *mars;
+static uint64_t barriers[THREAD_COUNT];
+
+void *thread_proc(void *arg)
+{
+ int ret;
+
+ ret = mars_task_barrier_create(
+ mars,
+ &barriers[mars_ptr_to_ea(arg)],
+ 1);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+
+ ret = mars_task_barrier_destroy(barriers[mars_ptr_to_ea(arg)]);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+
+ return NULL;
+}
+
+int main(void)
+{
+ int i, ret;
+
+ ret = mars_context_create(&mars, 0, 0);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+
+ for (i = 0; i < THREAD_COUNT; i++)
+ pthread_create(
+ &threads[i],
+ NULL,
+ thread_proc,
+ (void *)(uintptr_t)i);
+
+ for (i = 0; i < THREAD_COUNT; i++)
+ pthread_join(threads[i], NULL);
+
+ ret = mars_context_destroy(mars);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+
+ return 0;
+}
diff --git a/tests/TFP/TFP_23_001/Makefile b/tests/TFP/TFP_23_001/Makefile
new file mode 100644
index 0000000..432135a
--- /dev/null
+++ b/tests/TFP/TFP_23_001/Makefile
@@ -0,0 +1,28 @@
+#
+# Copyright 2008 Sony Corporation
+#
+#
+# Permission is hereby granted, free of charge, to any person obtaining a copy
+# of this software and associated documentation files (the "Software"), to deal
+# in the Software without restriction, including without limitation the rights
+# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+# copies of the Software, and to permit persons to whom the Software is
+# furnished to do so, subject to the following conditions:
+#
+# The above copyright notice and this permission notice shall be included in
+# all copies or substantial portions of the Software.
+#
+# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+# THE SOFTWARE.
+#
+
+top_srcdir = ../..
+test_objs = host.o mpu.task_eo
+
+include $(top_srcdir)/scripts/config.mk
+include $(top_srcdir)/scripts/rules_item.mk
diff --git a/tests/TFP/TFP_23_001/host.c b/tests/TFP/TFP_23_001/host.c
new file mode 100644
index 0000000..d890fab
--- /dev/null
+++ b/tests/TFP/TFP_23_001/host.c
@@ -0,0 +1,78 @@
+/*
+ * Copyright 2008 Sony Corporation
+ *
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a copy
+ * of this software and associated documentation files (the "Software"), to deal
+ * in the Software without restriction, including without limitation the rights
+ * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+ * copies of the Software, and to permit persons to whom the Software is
+ * furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included in
+ * all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+ * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+ * THE SOFTWARE.
+ */
+
+#include <mars/mars.h>
+#include <libspe2.h>
+#include <mars_test.h>
+
+#define NUM_TASKS MARS_TASK_BARRIER_WAIT_MAX
+
+extern spe_program_handle_t mpu_prog;
+
+static struct mars_context *mars_ctx;
+static struct mars_task_id task_id[NUM_TASKS];
+static struct mars_task_args task_args[NUM_TASKS];
+static uint64_t barrier[NUM_TASKS];
+
+int main(void)
+{
+ int ret, i, count;
+ int32_t exit_code;
+
+ ret = mars_context_create(&mars_ctx, 0, 0);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+
+ for (i = 0; i < NUM_TASKS; i++) {
+ ret = mars_task_barrier_create(mars_ctx, &barrier[i], i + 1);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+
+ /* create tasks and notify */
+ for (count = 0; count < i + 1; count++) {
+ ret = mars_task_create(mars_ctx, &task_id[count], NULL,
+ mpu_prog.elf_image, MARS_TASK_CONTEXT_SAVE_ALL);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+
+ task_args[count].type.u64[0] = barrier[i];
+ ret = mars_task_schedule(
+ &task_id[count], &task_args[count], 0);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+ }
+
+ for (count = 0; count < i + 1; count++) {
+ ret = mars_task_wait(&task_id[count], &exit_code);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+ MARS_TEST_ASSERT_ERROR(exit_code, MARS_SUCCESS);
+
+ ret = mars_task_destroy(&task_id[count]);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+ }
+ ret = mars_task_barrier_destroy(barrier[i]);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+ }
+
+ ret = mars_context_destroy(mars_ctx);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+
+ return 0;
+}
+
diff --git a/tests/TFP/TFP_23_001/mpu.c b/tests/TFP/TFP_23_001/mpu.c
new file mode 100644
index 0000000..c6abb4f
--- /dev/null
+++ b/tests/TFP/TFP_23_001/mpu.c
@@ -0,0 +1,36 @@
+/*
+ * Copyright 2008 Sony Corporation
+ *
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a copy
+ * of this software and associated documentation files (the "Software"), to deal
+ * in the Software without restriction, including without limitation the rights
+ * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+ * copies of the Software, and to permit persons to whom the Software is
+ * furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included in
+ * all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+ * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+ * THE SOFTWARE.
+ */
+
+#include <mars/mars.h>
+#include <mars_task_test.h>
+
+int mars_task_main(const struct mars_task_args *task_args)
+{
+ int ret;
+ uint64_t barrier_ea = task_args->type.u64[0];
+
+ ret = mars_task_barrier_notify(barrier_ea);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+
+ return 0;
+}
diff --git a/tests/TFP/TFP_23_002/Makefile b/tests/TFP/TFP_23_002/Makefile
new file mode 100644
index 0000000..432135a
--- /dev/null
+++ b/tests/TFP/TFP_23_002/Makefile
@@ -0,0 +1,28 @@
+#
+# Copyright 2008 Sony Corporation
+#
+#
+# Permission is hereby granted, free of charge, to any person obtaining a copy
+# of this software and associated documentation files (the "Software"), to deal
+# in the Software without restriction, including without limitation the rights
+# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+# copies of the Software, and to permit persons to whom the Software is
+# furnished to do so, subject to the following conditions:
+#
+# The above copyright notice and this permission notice shall be included in
+# all copies or substantial portions of the Software.
+#
+# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+# THE SOFTWARE.
+#
+
+top_srcdir = ../..
+test_objs = host.o mpu.task_eo
+
+include $(top_srcdir)/scripts/config.mk
+include $(top_srcdir)/scripts/rules_item.mk
diff --git a/tests/TFP/TFP_23_002/host.c b/tests/TFP/TFP_23_002/host.c
new file mode 100644
index 0000000..19912c0
--- /dev/null
+++ b/tests/TFP/TFP_23_002/host.c
@@ -0,0 +1,88 @@
+/*
+ * Copyright 2008 Sony Corporation
+ *
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a copy
+ * of this software and associated documentation files (the "Software"), to deal
+ * in the Software without restriction, including without limitation the rights
+ * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+ * copies of the Software, and to permit persons to whom the Software is
+ * furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included in
+ * all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+ * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+ * THE SOFTWARE.
+ */
+
+#include <unistd.h>
+#include <mars/mars.h>
+#include <libspe2.h>
+#include <mars_test.h>
+
+#define WAIT_NUM (MARS_TASK_BARRIER_WAIT_MAX / 2)
+#define NUM_TASKS (WAIT_NUM * 2)
+
+extern spe_program_handle_t mpu_prog;
+
+static struct mars_context *mars_ctx;
+static struct mars_task_id task_id[NUM_TASKS];
+static struct mars_task_args task_args[NUM_TASKS];
+static uint64_t barrier;
+static uint32_t notify[32] __attribute((aligned(128)));
+static uint32_t shared_ret[NUM_TASKS * 4] __attribute((aligned(16)));
+
+
+int main(void)
+{
+ int ret, count, num_success;
+
+ ret = mars_context_create(&mars_ctx, 0, 0);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+
+ notify[0] = 0;
+
+ ret = mars_task_barrier_create(mars_ctx,
+ &barrier, WAIT_NUM);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+
+ /* create tasks and notify */
+ for (count = 0; count < NUM_TASKS; count++) {
+ shared_ret[count * 4] = 0;
+ ret = mars_task_create(mars_ctx, &task_id[count], NULL,
+ mpu_prog.elf_image, MARS_TASK_CONTEXT_SAVE_ALL);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+
+ task_args[count].type.u64[0] = barrier;
+ task_args[count].type.u64[1] =
+ mars_ptr_to_ea(&notify);
+ task_args[count].type.u64[2] =
+ mars_ptr_to_ea(&shared_ret[count * 4]);
+ ret = mars_task_schedule(
+ &task_id[count], &task_args[count], 0);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+ }
+
+ sleep(1);
+ /* mars_task_barrier_notify at the same time */
+ mars_test_counter_set(&notify[0], 1);
+ sleep(1);
+
+ /* check notify count */
+ num_success = 0;
+ for (count = 0; count < NUM_TASKS; count++) {
+ if (shared_ret[count * 4] == 1)
+ num_success++;
+ }
+ MARS_TEST_ASSERT_EQUAL(num_success, WAIT_NUM);
+
+ /* blocking MPU tasks can not be destroyed by host */
+ exit(0);
+}
+
diff --git a/tests/TFP/TFP_23_002/mpu.c b/tests/TFP/TFP_23_002/mpu.c
new file mode 100644
index 0000000..653b508
--- /dev/null
+++ b/tests/TFP/TFP_23_002/mpu.c
@@ -0,0 +1,49 @@
+/*
+ * Copyright 2008 Sony Corporation
+ *
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a copy
+ * of this software and associated documentation files (the "Software"), to deal
+ * in the Software without restriction, including without limitation the rights
+ * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+ * copies of the Software, and to permit persons to whom the Software is
+ * furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included in
+ * all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+ * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+ * THE SOFTWARE.
+ */
+
+#include <mars/mars.h>
+#include <mars_task_test.h>
+#include <spu_mfcio.h>
+
+static uint32_t shared_ret __attribute((aligned(16)));
+
+int mars_task_main(const struct mars_task_args *task_args)
+{
+ int ret;
+ uint64_t barrier_ea = task_args->type.u64[0];
+ uint64_t notify_ea = task_args->type.u64[1];
+ uint64_t shared_ret_ea = task_args->type.u64[2];
+
+ mars_test_counter_wait(notify_ea, 1);
+
+ ret = mars_task_barrier_notify(barrier_ea);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+
+ /* if program reaches here, shared_resource'll be updated */
+ shared_ret = 1;
+ mfc_put(&shared_ret, shared_ret_ea, sizeof(uint32_t), 0, 0, 0);
+ mfc_write_tag_mask(1 << 0);
+ mfc_read_tag_status_all();
+
+ return 0;
+}
diff --git a/tests/TFP/TFP_24_001/Makefile b/tests/TFP/TFP_24_001/Makefile
new file mode 100644
index 0000000..ecbce33
--- /dev/null
+++ b/tests/TFP/TFP_24_001/Makefile
@@ -0,0 +1,28 @@
+#
+# Copyright 2008 Sony Corporation
+#
+#
+# Permission is hereby granted, free of charge, to any person obtaining a copy
+# of this software and associated documentation files (the "Software"), to deal
+# in the Software without restriction, including without limitation the rights
+# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+# copies of the Software, and to permit persons to whom the Software is
+# furnished to do so, subject to the following conditions:
+#
+# The above copyright notice and this permission notice shall be included in
+# all copies or substantial portions of the Software.
+#
+# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+# THE SOFTWARE.
+#
+
+top_srcdir = ../..
+test_objs = host.o mpu1.task_eo mpu2.task_eo
+
+include $(top_srcdir)/scripts/config.mk
+include $(top_srcdir)/scripts/rules_item.mk
diff --git a/tests/TFP/TFP_24_001/host.c b/tests/TFP/TFP_24_001/host.c
new file mode 100644
index 0000000..fe739ac
--- /dev/null
+++ b/tests/TFP/TFP_24_001/host.c
@@ -0,0 +1,106 @@
+/*
+ * Copyright 2008 Sony Corporation
+ *
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a copy
+ * of this software and associated documentation files (the "Software"), to deal
+ * in the Software without restriction, including without limitation the rights
+ * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+ * copies of the Software, and to permit persons to whom the Software is
+ * furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included in
+ * all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+ * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+ * THE SOFTWARE.
+ */
+
+#include <unistd.h>
+#include <mars/mars.h>
+#include <libspe2.h>
+#include <mars_test.h>
+
+#define NUM_TASKS MARS_TASK_BARRIER_WAIT_MAX
+
+extern spe_program_handle_t mpu1_prog;
+extern spe_program_handle_t mpu2_prog;
+
+static struct mars_context *mars_ctx;
+static struct mars_task_id task1_id, task_id[NUM_TASKS];
+static struct mars_task_args task1_args, task_args[NUM_TASKS];
+static uint64_t barrier[NUM_TASKS];
+
+#define CHK_NUM 3
+static uint32_t chk_num[] = {
+ 1,
+ NUM_TASKS / 2,
+ NUM_TASKS,
+};
+
+int main(void)
+{
+ int ret, i, count;
+ int32_t exit_code;
+
+ ret = mars_context_create(&mars_ctx, 0, 0);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+
+ for (i = 0; i < CHK_NUM; i++) {
+ ret = mars_task_barrier_create(mars_ctx,
+ &barrier[i], chk_num[i]);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+
+ /* create tasks and notify */
+ for (count = 0; count < chk_num[i]; count++) {
+ ret = mars_task_create(mars_ctx, &task_id[count], NULL,
+ mpu2_prog.elf_image, MARS_TASK_CONTEXT_SAVE_ALL);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+
+ task_args[count].type.u64[0] = barrier[i];
+ ret = mars_task_schedule(
+ &task_id[count], &task_args[count], 0);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+ }
+
+ /* create wait task */
+ ret = mars_task_create(mars_ctx, &task1_id, NULL,
+ mpu1_prog.elf_image, MARS_TASK_CONTEXT_SAVE_ALL);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+
+ task1_args.type.u64[0] = barrier[i];
+ ret = mars_task_schedule(
+ &task1_id, &task1_args, 0);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+
+ /* bariier condition is already met, should not be blocked */
+ ret = mars_task_wait(&task1_id, &exit_code);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+ MARS_TEST_ASSERT_ERROR(exit_code, MARS_SUCCESS);
+
+ ret = mars_task_destroy(&task1_id);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+
+ for (count = 0; count < chk_num[i]; count++) {
+ ret = mars_task_wait(&task_id[count], &exit_code);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+ MARS_TEST_ASSERT_ERROR(exit_code, MARS_SUCCESS);
+
+ ret = mars_task_destroy(&task_id[count]);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+ }
+ ret = mars_task_barrier_destroy(barrier[i]);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+ }
+
+ ret = mars_context_destroy(mars_ctx);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+
+ return 0;
+}
+
diff --git a/tests/TFP/TFP_24_001/mpu1.c b/tests/TFP/TFP_24_001/mpu1.c
new file mode 100644
index 0000000..599b53a
--- /dev/null
+++ b/tests/TFP/TFP_24_001/mpu1.c
@@ -0,0 +1,36 @@
+/*
+ * Copyright 2008 Sony Corporation
+ *
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a copy
+ * of this software and associated documentation files (the "Software"), to deal
+ * in the Software without restriction, including without limitation the rights
+ * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+ * copies of the Software, and to permit persons to whom the Software is
+ * furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included in
+ * all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+ * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+ * THE SOFTWARE.
+ */
+
+#include <mars/mars.h>
+#include <mars_task_test.h>
+
+int mars_task_main(const struct mars_task_args *task_args)
+{
+ int ret;
+ uint64_t barrier_ea = task_args->type.u64[0];
+
+ ret = mars_task_barrier_wait(barrier_ea);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+
+ return 0;
+}
diff --git a/tests/TFP/TFP_24_001/mpu2.c b/tests/TFP/TFP_24_001/mpu2.c
new file mode 100644
index 0000000..c6abb4f
--- /dev/null
+++ b/tests/TFP/TFP_24_001/mpu2.c
@@ -0,0 +1,36 @@
+/*
+ * Copyright 2008 Sony Corporation
+ *
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a copy
+ * of this software and associated documentation files (the "Software"), to deal
+ * in the Software without restriction, including without limitation the rights
+ * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+ * copies of the Software, and to permit persons to whom the Software is
+ * furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included in
+ * all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+ * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+ * THE SOFTWARE.
+ */
+
+#include <mars/mars.h>
+#include <mars_task_test.h>
+
+int mars_task_main(const struct mars_task_args *task_args)
+{
+ int ret;
+ uint64_t barrier_ea = task_args->type.u64[0];
+
+ ret = mars_task_barrier_notify(barrier_ea);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+
+ return 0;
+}
diff --git a/tests/TFP/TFP_24_002/Makefile b/tests/TFP/TFP_24_002/Makefile
new file mode 100644
index 0000000..ecbce33
--- /dev/null
+++ b/tests/TFP/TFP_24_002/Makefile
@@ -0,0 +1,28 @@
+#
+# Copyright 2008 Sony Corporation
+#
+#
+# Permission is hereby granted, free of charge, to any person obtaining a copy
+# of this software and associated documentation files (the "Software"), to deal
+# in the Software without restriction, including without limitation the rights
+# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+# copies of the Software, and to permit persons to whom the Software is
+# furnished to do so, subject to the following conditions:
+#
+# The above copyright notice and this permission notice shall be included in
+# all copies or substantial portions of the Software.
+#
+# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+# THE SOFTWARE.
+#
+
+top_srcdir = ../..
+test_objs = host.o mpu1.task_eo mpu2.task_eo
+
+include $(top_srcdir)/scripts/config.mk
+include $(top_srcdir)/scripts/rules_item.mk
diff --git a/tests/TFP/TFP_24_002/host.c b/tests/TFP/TFP_24_002/host.c
new file mode 100644
index 0000000..0ce5f99
--- /dev/null
+++ b/tests/TFP/TFP_24_002/host.c
@@ -0,0 +1,123 @@
+/*
+ * Copyright 2008 Sony Corporation
+ *
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a copy
+ * of this software and associated documentation files (the "Software"), to deal
+ * in the Software without restriction, including without limitation the rights
+ * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+ * copies of the Software, and to permit persons to whom the Software is
+ * furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included in
+ * all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+ * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+ * THE SOFTWARE.
+ */
+
+#include <unistd.h>
+#include <mars/mars.h>
+#include <libspe2.h>
+#include <mars_test.h>
+
+#define NUM_TASKS MARS_TASK_BARRIER_WAIT_MAX
+
+extern spe_program_handle_t mpu1_prog;
+extern spe_program_handle_t mpu2_prog;
+
+static struct mars_context *mars_ctx;
+static struct mars_task_id task1_id, task_id[NUM_TASKS];
+static struct mars_task_args task1_args, task_args[NUM_TASKS];
+static uint64_t barrier[NUM_TASKS];
+static uint32_t shared_resource __attribute((aligned(16)));
+
+#define CHK_NUM 3
+static uint32_t chk_num[] = {
+ 1,
+ NUM_TASKS / 2,
+ NUM_TASKS,
+};
+
+int main(void)
+{
+ int ret, i, count;
+ int32_t exit_code;
+
+ ret = mars_context_create(&mars_ctx, 0, 0);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+
+ for (i = 0; i < CHK_NUM; i++) {
+ shared_resource = 0;
+
+ ret = mars_task_barrier_create(mars_ctx,
+ &barrier[i], chk_num[i]);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+
+ /* create wait task */
+ ret = mars_task_create(mars_ctx, &task1_id, NULL,
+ mpu1_prog.elf_image, MARS_TASK_CONTEXT_SAVE_ALL);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+
+ task1_args.type.u64[0] = barrier[i];
+ task1_args.type.u64[1] = mars_ptr_to_ea(&shared_resource);
+ ret = mars_task_schedule(&task1_id, &task1_args, 0);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+
+ /* create tasks and notify */
+ for (count = 0; count < chk_num[i]; count++) {
+ ret = mars_task_create(mars_ctx, &task_id[count], NULL,
+ mpu2_prog.elf_image, MARS_TASK_CONTEXT_SAVE_ALL);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+
+ task_args[count].type.u64[0] = barrier[i];
+
+ /* not schedule the last one task */
+ if (count != chk_num[i] - 1) {
+ ret = mars_task_schedule(
+ &task_id[count], &task_args[count], 0);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+ }
+ }
+
+ /* check if mpu task is waiting */
+ sleep(1);
+ MARS_TEST_ASSERT_EQUAL(shared_resource, 0);
+
+ /* schedule the last one */
+ count--;
+ ret = mars_task_schedule(
+ &task_id[count], &task_args[count], 0);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+
+ /* check if wait task will exit */
+ ret = mars_task_wait(&task1_id, &exit_code);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+ MARS_TEST_ASSERT_ERROR(exit_code, MARS_SUCCESS);
+
+ ret = mars_task_destroy(&task1_id);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+
+ for (count = 0; count < chk_num[i]; count++) {
+ ret = mars_task_wait(&task_id[count], &exit_code);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+ MARS_TEST_ASSERT_ERROR(exit_code, MARS_SUCCESS);
+
+ ret = mars_task_destroy(&task_id[count]);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+ }
+ ret = mars_task_barrier_destroy(barrier[i]);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+ }
+
+ ret = mars_context_destroy(mars_ctx);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+
+ return 0;
+}
+
diff --git a/tests/TFP/TFP_24_002/mpu1.c b/tests/TFP/TFP_24_002/mpu1.c
new file mode 100644
index 0000000..89472b9
--- /dev/null
+++ b/tests/TFP/TFP_24_002/mpu1.c
@@ -0,0 +1,47 @@
+/*
+ * Copyright 2008 Sony Corporation
+ *
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a copy
+ * of this software and associated documentation files (the "Software"), to deal
+ * in the Software without restriction, including without limitation the rights
+ * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+ * copies of the Software, and to permit persons to whom the Software is
+ * furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included in
+ * all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+ * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+ * THE SOFTWARE.
+ */
+
+#include <mars/mars.h>
+#include <mars_task_test.h>
+#include <spu_mfcio.h>
+
+static uint32_t shared_resource __attribute((aligned(16)));
+
+int mars_task_main(const struct mars_task_args *task_args)
+{
+ int ret;
+ uint64_t barrier_ea = task_args->type.u64[0];
+ uint64_t shared_resource_ea = task_args->type.u64[1];
+
+ ret = mars_task_barrier_wait(barrier_ea);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+
+ /* if program reaches here, shared_resource'll be updated */
+ shared_resource = 1;
+ mfc_put(&shared_resource, shared_resource_ea,
+ sizeof(uint32_t), 0, 0, 0);
+ mfc_write_tag_mask(1 << 0);
+ mfc_read_tag_status_all();
+
+ return 0;
+}
diff --git a/tests/TFP/TFP_24_002/mpu2.c b/tests/TFP/TFP_24_002/mpu2.c
new file mode 100644
index 0000000..c6abb4f
--- /dev/null
+++ b/tests/TFP/TFP_24_002/mpu2.c
@@ -0,0 +1,36 @@
+/*
+ * Copyright 2008 Sony Corporation
+ *
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a copy
+ * of this software and associated documentation files (the "Software"), to deal
+ * in the Software without restriction, including without limitation the rights
+ * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+ * copies of the Software, and to permit persons to whom the Software is
+ * furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included in
+ * all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+ * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+ * THE SOFTWARE.
+ */
+
+#include <mars/mars.h>
+#include <mars_task_test.h>
+
+int mars_task_main(const struct mars_task_args *task_args)
+{
+ int ret;
+ uint64_t barrier_ea = task_args->type.u64[0];
+
+ ret = mars_task_barrier_notify(barrier_ea);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+
+ return 0;
+}
diff --git a/tests/TFP/TFP_24_003/Makefile b/tests/TFP/TFP_24_003/Makefile
new file mode 100644
index 0000000..ecbce33
--- /dev/null
+++ b/tests/TFP/TFP_24_003/Makefile
@@ -0,0 +1,28 @@
+#
+# Copyright 2008 Sony Corporation
+#
+#
+# Permission is hereby granted, free of charge, to any person obtaining a copy
+# of this software and associated documentation files (the "Software"), to deal
+# in the Software without restriction, including without limitation the rights
+# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+# copies of the Software, and to permit persons to whom the Software is
+# furnished to do so, subject to the following conditions:
+#
+# The above copyright notice and this permission notice shall be included in
+# all copies or substantial portions of the Software.
+#
+# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+# THE SOFTWARE.
+#
+
+top_srcdir = ../..
+test_objs = host.o mpu1.task_eo mpu2.task_eo
+
+include $(top_srcdir)/scripts/config.mk
+include $(top_srcdir)/scripts/rules_item.mk
diff --git a/tests/TFP/TFP_24_003/host.c b/tests/TFP/TFP_24_003/host.c
new file mode 100644
index 0000000..c4fa523
--- /dev/null
+++ b/tests/TFP/TFP_24_003/host.c
@@ -0,0 +1,132 @@
+/*
+ * Copyright 2008 Sony Corporation
+ *
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a copy
+ * of this software and associated documentation files (the "Software"), to deal
+ * in the Software without restriction, including without limitation the rights
+ * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+ * copies of the Software, and to permit persons to whom the Software is
+ * furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included in
+ * all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+ * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+ * THE SOFTWARE.
+ */
+
+#include <unistd.h>
+#include <mars/mars.h>
+#include <libspe2.h>
+#include <mars_test.h>
+
+#define NUM_TASKS MARS_TASK_BARRIER_WAIT_MAX
+
+extern spe_program_handle_t mpu1_prog;
+extern spe_program_handle_t mpu2_prog;
+
+#define CHK_NUM 2
+static uint32_t chk_num[] = {
+ NUM_TASKS / 2,
+ NUM_TASKS
+};
+
+static struct mars_context *mars_ctx;
+static struct mars_task_id task1_id[NUM_TASKS], task2_id;
+static struct mars_task_args task1_args, task2_args;
+static uint64_t barrier[CHK_NUM];
+static uint32_t shared_resource __attribute((aligned(16)));
+
+int main(void)
+{
+ int ret, i, count;
+ int32_t exit_code;
+
+ ret = mars_context_create(&mars_ctx, 0, 0);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+
+ for (i = 0; i < CHK_NUM; i++) {
+ shared_resource = 0;
+
+ ret = mars_task_barrier_create(mars_ctx,
+ &barrier[i], chk_num[i]);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+
+ /* run notify/wait tasks */
+ for (count = 0; count < chk_num[i] - 1; count++) {
+ ret = mars_task_create(mars_ctx,
+ &task1_id[count], NULL,
+ mpu1_prog.elf_image,
+ MARS_TASK_CONTEXT_SAVE_ALL);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+
+ task1_args.type.u64[0] = barrier[i];
+ task1_args.type.u64[1] =
+ mars_ptr_to_ea(&shared_resource);
+ ret = mars_task_schedule(&task1_id[count],
+ &task1_args, 0);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+ }
+
+ /* check if mpu task is waiting */
+ sleep(1);
+ MARS_TEST_ASSERT_EQUAL(shared_resource, 0);
+
+ /* notify */
+ ret = mars_task_create(mars_ctx, &task2_id, NULL,
+ mpu2_prog.elf_image, MARS_TASK_CONTEXT_SAVE_ALL);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+
+ task2_args.type.u64[0] = barrier[i];
+ ret = mars_task_schedule(&task2_id, &task2_args, 0);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+
+ ret = mars_task_wait(&task2_id, &exit_code);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+ MARS_TEST_ASSERT_ERROR(exit_code, MARS_SUCCESS);
+
+ sleep(1);
+ /* check if mpu tasks still run */
+ MARS_TEST_ASSERT_EQUAL(shared_resource, 1);
+ for (count = 0; count < chk_num[i] - 1; count++) {
+ ret = mars_task_try_wait(&task1_id[count], &exit_code);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_ERROR_BUSY);
+ }
+
+ /* 2nd notify */
+ task2_args.type.u64[0] = barrier[i];
+ ret = mars_task_schedule(&task2_id, &task2_args, 0);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+
+ ret = mars_task_wait(&task2_id, &exit_code);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+ MARS_TEST_ASSERT_ERROR(exit_code, MARS_SUCCESS);
+
+ for (count = 0; count < chk_num[i] - 1; count++) {
+ ret = mars_task_wait(&task1_id[count], &exit_code);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+ MARS_TEST_ASSERT_ERROR(exit_code, MARS_SUCCESS);
+
+ ret = mars_task_destroy(&task1_id[count]);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+ }
+
+ ret = mars_task_destroy(&task2_id);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+
+ ret = mars_task_barrier_destroy(barrier[i]);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+ }
+
+ ret = mars_context_destroy(mars_ctx);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+
+ return 0;
+}
+
diff --git a/tests/TFP/TFP_24_003/mpu1.c b/tests/TFP/TFP_24_003/mpu1.c
new file mode 100644
index 0000000..5309642
--- /dev/null
+++ b/tests/TFP/TFP_24_003/mpu1.c
@@ -0,0 +1,57 @@
+/*
+ * Copyright 2008 Sony Corporation
+ *
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a copy
+ * of this software and associated documentation files (the "Software"), to deal
+ * in the Software without restriction, including without limitation the rights
+ * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+ * copies of the Software, and to permit persons to whom the Software is
+ * furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included in
+ * all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+ * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+ * THE SOFTWARE.
+ */
+
+#include <mars/mars.h>
+#include <mars_task_test.h>
+#include <spu_mfcio.h>
+
+static uint32_t shared_resource __attribute((aligned(16)));
+
+int mars_task_main(const struct mars_task_args *task_args)
+{
+ int ret;
+ uint64_t barrier_ea = task_args->type.u64[0];
+ uint64_t shared_resource_ea = task_args->type.u64[1];
+
+ /* 1st notify/barrier */
+ ret = mars_task_barrier_notify(barrier_ea);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+
+ ret = mars_task_barrier_wait(barrier_ea);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+
+ shared_resource = 1;
+ mfc_put(&shared_resource, shared_resource_ea,
+ sizeof(uint32_t), 0, 0, 0);
+ mfc_write_tag_mask(1 << 0);
+ mfc_read_tag_status_all();
+
+ /* 2nd notify/barrier */
+ ret = mars_task_barrier_notify(barrier_ea);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+
+ ret = mars_task_barrier_wait(barrier_ea);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+
+ return 0;
+}
diff --git a/tests/TFP/TFP_24_003/mpu2.c b/tests/TFP/TFP_24_003/mpu2.c
new file mode 100644
index 0000000..df95371
--- /dev/null
+++ b/tests/TFP/TFP_24_003/mpu2.c
@@ -0,0 +1,39 @@
+/*
+ * Copyright 2008 Sony Corporation
+ *
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a copy
+ * of this software and associated documentation files (the "Software"), to deal
+ * in the Software without restriction, including without limitation the rights
+ * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+ * copies of the Software, and to permit persons to whom the Software is
+ * furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included in
+ * all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+ * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+ * THE SOFTWARE.
+ */
+
+#include <mars/mars.h>
+#include <mars_task_test.h>
+
+int mars_task_main(const struct mars_task_args *task_args)
+{
+ int ret;
+ uint64_t barrier_ea = task_args->type.u64[0];
+
+ ret = mars_task_barrier_notify(barrier_ea);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+
+ ret = mars_task_barrier_wait(barrier_ea);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+
+ return 0;
+}
diff --git a/tests/TFP/TFP_25_001/Makefile b/tests/TFP/TFP_25_001/Makefile
new file mode 100644
index 0000000..432135a
--- /dev/null
+++ b/tests/TFP/TFP_25_001/Makefile
@@ -0,0 +1,28 @@
+#
+# Copyright 2008 Sony Corporation
+#
+#
+# Permission is hereby granted, free of charge, to any person obtaining a copy
+# of this software and associated documentation files (the "Software"), to deal
+# in the Software without restriction, including without limitation the rights
+# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+# copies of the Software, and to permit persons to whom the Software is
+# furnished to do so, subject to the following conditions:
+#
+# The above copyright notice and this permission notice shall be included in
+# all copies or substantial portions of the Software.
+#
+# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+# THE SOFTWARE.
+#
+
+top_srcdir = ../..
+test_objs = host.o mpu.task_eo
+
+include $(top_srcdir)/scripts/config.mk
+include $(top_srcdir)/scripts/rules_item.mk
diff --git a/tests/TFP/TFP_25_001/host.c b/tests/TFP/TFP_25_001/host.c
new file mode 100644
index 0000000..e9b0102
--- /dev/null
+++ b/tests/TFP/TFP_25_001/host.c
@@ -0,0 +1,83 @@
+/*
+ * Copyright 2008 Sony Corporation
+ *
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a copy
+ * of this software and associated documentation files (the "Software"), to deal
+ * in the Software without restriction, including without limitation the rights
+ * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+ * copies of the Software, and to permit persons to whom the Software is
+ * furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included in
+ * all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+ * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+ * THE SOFTWARE.
+ */
+
+#include <mars/mars.h>
+#include <libspe2.h>
+#include <mars_test.h>
+
+#define NUM_TASKS MARS_TASK_BARRIER_WAIT_MAX
+
+extern spe_program_handle_t mpu_prog;
+
+static struct mars_context *mars_ctx;
+static struct mars_task_id task_id[NUM_TASKS];
+static struct mars_task_args task_args[NUM_TASKS];
+static uint64_t barrier[NUM_TASKS];
+
+int main(void)
+{
+ int ret, i, count;
+ int32_t exit_code;
+ uint32_t busy;
+
+ ret = mars_context_create(&mars_ctx, 0, 0);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+
+ for (i = 1; i < NUM_TASKS; i++) {
+ ret = mars_task_barrier_create(mars_ctx, &barrier[i], i);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+
+ /* create tasks and notify */
+ for (count = 0; count < NUM_TASKS; count++) {
+ ret = mars_task_create(mars_ctx,
+ &task_id[count], NULL,
+ mpu_prog.elf_image,
+ MARS_TASK_CONTEXT_SAVE_ALL);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+
+ busy = count < i ? 0 : 1;
+ task_args[count].type.u64[0] = barrier[i];
+ task_args[count].type.u64[1] = busy;
+
+ ret = mars_task_schedule(
+ &task_id[count], &task_args[count], 0);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+
+ ret = mars_task_wait(&task_id[count],
+ &exit_code);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+ MARS_TEST_ASSERT_ERROR(exit_code, MARS_SUCCESS);
+
+ ret = mars_task_destroy(&task_id[count]);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+ }
+ ret = mars_task_barrier_destroy(barrier[i]);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+ }
+
+ ret = mars_context_destroy(mars_ctx);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+
+ return 0;
+}
+
diff --git a/tests/TFP/TFP_25_001/mpu.c b/tests/TFP/TFP_25_001/mpu.c
new file mode 100644
index 0000000..05b5acd
--- /dev/null
+++ b/tests/TFP/TFP_25_001/mpu.c
@@ -0,0 +1,40 @@
+/*
+ * Copyright 2008 Sony Corporation
+ *
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a copy
+ * of this software and associated documentation files (the "Software"), to deal
+ * in the Software without restriction, including without limitation the rights
+ * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+ * copies of the Software, and to permit persons to whom the Software is
+ * furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included in
+ * all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+ * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+ * THE SOFTWARE.
+ */
+
+#include <mars/mars.h>
+#include <mars_task_test.h>
+
+int mars_task_main(const struct mars_task_args *task_args)
+{
+ int ret;
+ uint64_t barrier_ea = task_args->type.u64[0];
+ uint64_t busy = task_args->type.u64[1];
+
+ ret = mars_task_barrier_try_notify(barrier_ea);
+ if (busy)
+ MARS_TEST_ASSERT_ERROR(ret, MARS_ERROR_BUSY);
+ else
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+
+ return 0;
+}
diff --git a/tests/TFP/TFP_25_002/Makefile b/tests/TFP/TFP_25_002/Makefile
new file mode 100644
index 0000000..432135a
--- /dev/null
+++ b/tests/TFP/TFP_25_002/Makefile
@@ -0,0 +1,28 @@
+#
+# Copyright 2008 Sony Corporation
+#
+#
+# Permission is hereby granted, free of charge, to any person obtaining a copy
+# of this software and associated documentation files (the "Software"), to deal
+# in the Software without restriction, including without limitation the rights
+# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+# copies of the Software, and to permit persons to whom the Software is
+# furnished to do so, subject to the following conditions:
+#
+# The above copyright notice and this permission notice shall be included in
+# all copies or substantial portions of the Software.
+#
+# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+# THE SOFTWARE.
+#
+
+top_srcdir = ../..
+test_objs = host.o mpu.task_eo
+
+include $(top_srcdir)/scripts/config.mk
+include $(top_srcdir)/scripts/rules_item.mk
diff --git a/tests/TFP/TFP_25_002/host.c b/tests/TFP/TFP_25_002/host.c
new file mode 100644
index 0000000..3785653
--- /dev/null
+++ b/tests/TFP/TFP_25_002/host.c
@@ -0,0 +1,109 @@
+/*
+ * Copyright 2008 Sony Corporation
+ *
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a copy
+ * of this software and associated documentation files (the "Software"), to deal
+ * in the Software without restriction, including without limitation the rights
+ * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+ * copies of the Software, and to permit persons to whom the Software is
+ * furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included in
+ * all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+ * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+ * THE SOFTWARE.
+ */
+
+#include <unistd.h>
+#include <mars/mars.h>
+#include <libspe2.h>
+#include <mars_test.h>
+
+#define NUM_TASKS MARS_TASK_BARRIER_WAIT_MAX
+
+extern spe_program_handle_t mpu_prog;
+
+static struct mars_context *mars_ctx;
+static struct mars_task_id task_id[NUM_TASKS];
+static struct mars_task_args task_args[NUM_TASKS];
+static uint64_t barrier[NUM_TASKS];
+static uint32_t notify[32] __attribute((aligned(128)));
+
+#define CHK_NUM 5
+static uint32_t chk_num[] = {
+ 1,
+ NUM_TASKS / 2,
+ NUM_TASKS,
+ NUM_TASKS,
+ NUM_TASKS
+};
+
+int main(void)
+{
+ int ret, i, count, num_success;
+ int32_t exit_code;
+
+ ret = mars_context_create(&mars_ctx, 0, 0);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+
+ for (i = 0; i < CHK_NUM; i++) {
+ notify[0] = 0;
+
+ ret = mars_task_barrier_create(mars_ctx,
+ &barrier[i], chk_num[i]);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+
+ /* create tasks and notify */
+ for (count = 0; count < NUM_TASKS; count++) {
+ ret = mars_task_create(mars_ctx, &task_id[count], NULL,
+ mpu_prog.elf_image, MARS_TASK_CONTEXT_SAVE_ALL);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+
+ task_args[count].type.u64[0] = barrier[i];
+ task_args[count].type.u64[1] =
+ mars_ptr_to_ea(&notify);
+ ret = mars_task_schedule(
+ &task_id[count], &task_args[count], 0);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+ }
+
+ sleep(1);
+ /* mars_task_barrier_notify at the same time */
+ mars_test_counter_set(&notify[0], 1);
+ sleep(1);
+
+ /* check */
+ num_success = 0;
+ for (count = 0; count < NUM_TASKS; count++) {
+ ret = mars_task_wait(&task_id[count], &exit_code);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+ if (exit_code == MARS_SUCCESS)
+ num_success++;
+ else if (exit_code != MARS_ERROR_BUSY)
+ MARS_TEST_ASSERT_EQUAL(exit_code, 0);
+ }
+
+ MARS_TEST_ASSERT_EQUAL(num_success, chk_num[i]);
+
+ for (count = 0; count < NUM_TASKS; count++) {
+
+ ret = mars_task_destroy(&task_id[count]);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+ }
+ ret = mars_task_barrier_destroy(barrier[i]);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+ }
+
+ ret = mars_context_destroy(mars_ctx);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+
+ return 0;
+}
+
diff --git a/tests/TFP/TFP_25_002/mpu.c b/tests/TFP/TFP_25_002/mpu.c
new file mode 100644
index 0000000..e73e1fa
--- /dev/null
+++ b/tests/TFP/TFP_25_002/mpu.c
@@ -0,0 +1,40 @@
+/*
+ * Copyright 2008 Sony Corporation
+ *
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a copy
+ * of this software and associated documentation files (the "Software"), to deal
+ * in the Software without restriction, including without limitation the rights
+ * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+ * copies of the Software, and to permit persons to whom the Software is
+ * furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included in
+ * all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+ * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+ * THE SOFTWARE.
+ */
+
+#include <mars/mars.h>
+#include <mars_task_test.h>
+#include <spu_mfcio.h>
+
+int mars_task_main(const struct mars_task_args *task_args)
+{
+ int ret;
+ uint64_t barrier_ea = task_args->type.u64[0];
+ uint64_t notify_ea = task_args->type.u64[1];
+
+ mars_test_counter_wait(notify_ea, 1);
+
+ ret = mars_task_barrier_try_notify(barrier_ea);
+ mars_task_exit(ret);
+
+ return 0;
+}
diff --git a/tests/TFP/TFP_26_001/Makefile b/tests/TFP/TFP_26_001/Makefile
new file mode 100644
index 0000000..ecbce33
--- /dev/null
+++ b/tests/TFP/TFP_26_001/Makefile
@@ -0,0 +1,28 @@
+#
+# Copyright 2008 Sony Corporation
+#
+#
+# Permission is hereby granted, free of charge, to any person obtaining a copy
+# of this software and associated documentation files (the "Software"), to deal
+# in the Software without restriction, including without limitation the rights
+# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+# copies of the Software, and to permit persons to whom the Software is
+# furnished to do so, subject to the following conditions:
+#
+# The above copyright notice and this permission notice shall be included in
+# all copies or substantial portions of the Software.
+#
+# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+# THE SOFTWARE.
+#
+
+top_srcdir = ../..
+test_objs = host.o mpu1.task_eo mpu2.task_eo
+
+include $(top_srcdir)/scripts/config.mk
+include $(top_srcdir)/scripts/rules_item.mk
diff --git a/tests/TFP/TFP_26_001/host.c b/tests/TFP/TFP_26_001/host.c
new file mode 100644
index 0000000..91aeacf
--- /dev/null
+++ b/tests/TFP/TFP_26_001/host.c
@@ -0,0 +1,105 @@
+/*
+ * Copyright 2008 Sony Corporation
+ *
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a copy
+ * of this software and associated documentation files (the "Software"), to deal
+ * in the Software without restriction, including without limitation the rights
+ * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+ * copies of the Software, and to permit persons to whom the Software is
+ * furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included in
+ * all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+ * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+ * THE SOFTWARE.
+ */
+
+#include <unistd.h>
+#include <mars/mars.h>
+#include <libspe2.h>
+#include <mars_test.h>
+
+#define NUM_TASKS MARS_TASK_BARRIER_WAIT_MAX
+
+extern spe_program_handle_t mpu1_prog;
+extern spe_program_handle_t mpu2_prog;
+
+static struct mars_context *mars_ctx;
+static struct mars_task_id task1_id, task2_id;
+static struct mars_task_args task1_args, task2_args;
+static uint64_t barrier[NUM_TASKS];
+
+#define CHK_NUM 3
+static uint32_t chk_num[] = {
+ 1,
+ NUM_TASKS / 2,
+ NUM_TASKS,
+};
+
+int main(void)
+{
+ int ret, i, count;
+ int32_t exit_code;
+
+ ret = mars_context_create(&mars_ctx, 0, 0);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+
+ for (i = 0; i < CHK_NUM; i++) {
+ ret = mars_task_barrier_create(mars_ctx,
+ &barrier[i], chk_num[i]);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+
+ /* create tasks and notify */
+ for (count = 0; count < chk_num[i]; count++) {
+ ret = mars_task_create(mars_ctx, &task2_id, NULL,
+ mpu2_prog.elf_image, MARS_TASK_CONTEXT_SAVE_ALL);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+
+ task2_args.type.u64[0] = barrier[i];
+ ret = mars_task_schedule(
+ &task2_id, &task2_args, 0);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+
+ ret = mars_task_wait(&task2_id, &exit_code);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+ MARS_TEST_ASSERT_ERROR(exit_code, MARS_SUCCESS);
+
+ ret = mars_task_destroy(&task2_id);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+ }
+
+ /* create wait task */
+ ret = mars_task_create(mars_ctx, &task1_id, NULL,
+ mpu1_prog.elf_image, MARS_TASK_CONTEXT_SAVE_ALL);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+
+ task1_args.type.u64[0] = barrier[i];
+ ret = mars_task_schedule(
+ &task1_id, &task1_args, 0);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+
+ /* bariier condition is already met, try_wait returns SUCCESS */
+ ret = mars_task_wait(&task1_id, &exit_code);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+ MARS_TEST_ASSERT_ERROR(exit_code, MARS_SUCCESS);
+
+ ret = mars_task_destroy(&task1_id);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+
+ ret = mars_task_barrier_destroy(barrier[i]);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+ }
+
+ ret = mars_context_destroy(mars_ctx);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+
+ return 0;
+}
+
diff --git a/tests/TFP/TFP_26_001/mpu1.c b/tests/TFP/TFP_26_001/mpu1.c
new file mode 100644
index 0000000..8f0030c
--- /dev/null
+++ b/tests/TFP/TFP_26_001/mpu1.c
@@ -0,0 +1,36 @@
+/*
+ * Copyright 2008 Sony Corporation
+ *
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a copy
+ * of this software and associated documentation files (the "Software"), to deal
+ * in the Software without restriction, including without limitation the rights
+ * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+ * copies of the Software, and to permit persons to whom the Software is
+ * furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included in
+ * all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+ * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+ * THE SOFTWARE.
+ */
+
+#include <mars/mars.h>
+#include <mars_task_test.h>
+
+int mars_task_main(const struct mars_task_args *task_args)
+{
+ int ret;
+ uint64_t barrier_ea = task_args->type.u64[0];
+
+ ret = mars_task_barrier_try_wait(barrier_ea);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+
+ return 0;
+}
diff --git a/tests/TFP/TFP_26_001/mpu2.c b/tests/TFP/TFP_26_001/mpu2.c
new file mode 100644
index 0000000..c6abb4f
--- /dev/null
+++ b/tests/TFP/TFP_26_001/mpu2.c
@@ -0,0 +1,36 @@
+/*
+ * Copyright 2008 Sony Corporation
+ *
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a copy
+ * of this software and associated documentation files (the "Software"), to deal
+ * in the Software without restriction, including without limitation the rights
+ * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+ * copies of the Software, and to permit persons to whom the Software is
+ * furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included in
+ * all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+ * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+ * THE SOFTWARE.
+ */
+
+#include <mars/mars.h>
+#include <mars_task_test.h>
+
+int mars_task_main(const struct mars_task_args *task_args)
+{
+ int ret;
+ uint64_t barrier_ea = task_args->type.u64[0];
+
+ ret = mars_task_barrier_notify(barrier_ea);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+
+ return 0;
+}
diff --git a/tests/TFP/TFP_26_002/Makefile b/tests/TFP/TFP_26_002/Makefile
new file mode 100644
index 0000000..ecbce33
--- /dev/null
+++ b/tests/TFP/TFP_26_002/Makefile
@@ -0,0 +1,28 @@
+#
+# Copyright 2008 Sony Corporation
+#
+#
+# Permission is hereby granted, free of charge, to any person obtaining a copy
+# of this software and associated documentation files (the "Software"), to deal
+# in the Software without restriction, including without limitation the rights
+# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+# copies of the Software, and to permit persons to whom the Software is
+# furnished to do so, subject to the following conditions:
+#
+# The above copyright notice and this permission notice shall be included in
+# all copies or substantial portions of the Software.
+#
+# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+# THE SOFTWARE.
+#
+
+top_srcdir = ../..
+test_objs = host.o mpu1.task_eo mpu2.task_eo
+
+include $(top_srcdir)/scripts/config.mk
+include $(top_srcdir)/scripts/rules_item.mk
diff --git a/tests/TFP/TFP_26_002/host.c b/tests/TFP/TFP_26_002/host.c
new file mode 100644
index 0000000..f2990ad
--- /dev/null
+++ b/tests/TFP/TFP_26_002/host.c
@@ -0,0 +1,113 @@
+/*
+ * Copyright 2008 Sony Corporation
+ *
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a copy
+ * of this software and associated documentation files (the "Software"), to deal
+ * in the Software without restriction, including without limitation the rights
+ * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+ * copies of the Software, and to permit persons to whom the Software is
+ * furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included in
+ * all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+ * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+ * THE SOFTWARE.
+ */
+
+#include <unistd.h>
+#include <mars/mars.h>
+#include <libspe2.h>
+#include <mars_test.h>
+
+#define NUM_TASKS MARS_TASK_BARRIER_WAIT_MAX
+
+extern spe_program_handle_t mpu1_prog;
+extern spe_program_handle_t mpu2_prog;
+
+static struct mars_context *mars_ctx;
+static struct mars_task_id task1_id, task_id[NUM_TASKS];
+static struct mars_task_args task1_args, task_args[NUM_TASKS];
+static uint64_t barrier[NUM_TASKS];
+static uint32_t shared_resource __attribute((aligned(16)));
+
+#define CHK_NUM 3
+static uint32_t chk_num[] = {
+ 1,
+ NUM_TASKS / 2,
+ NUM_TASKS,
+};
+
+int main(void)
+{
+ int ret, i, count;
+ int32_t exit_code;
+
+ ret = mars_context_create(&mars_ctx, 0, 0);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+
+ for (i = 0; i < CHK_NUM; i++) {
+ shared_resource = 0;
+
+ ret = mars_task_barrier_create(mars_ctx,
+ &barrier[i], chk_num[i]);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+
+ /* create wait task */
+ ret = mars_task_create(mars_ctx, &task1_id, NULL,
+ mpu1_prog.elf_image, MARS_TASK_CONTEXT_SAVE_ALL);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+
+ task1_args.type.u64[0] = barrier[i];
+ task1_args.type.u64[1] = mars_ptr_to_ea(&shared_resource);
+ ret = mars_task_schedule(
+ &task1_id, &task1_args, 0);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+
+ sleep(1);
+ /* check if barrier_try_wait is still BUSY */
+ MARS_TEST_ASSERT_EQUAL(shared_resource, 0);
+
+ /* create tasks and notify */
+ for (count = 0; count < chk_num[i]; count++) {
+ ret = mars_task_create(mars_ctx, &task_id[count], NULL,
+ mpu2_prog.elf_image, MARS_TASK_CONTEXT_SAVE_ALL);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+
+ task_args[count].type.u64[0] = barrier[i];
+ ret = mars_task_schedule(
+ &task_id[count], &task_args[count], 0);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+ }
+
+ ret = mars_task_wait(&task1_id, &exit_code);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+ MARS_TEST_ASSERT_ERROR(exit_code, MARS_SUCCESS);
+
+ ret = mars_task_destroy(&task1_id);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+
+ for (count = 0; count < chk_num[i]; count++) {
+ ret = mars_task_wait(&task_id[count], &exit_code);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+ MARS_TEST_ASSERT_ERROR(exit_code, MARS_SUCCESS);
+
+ ret = mars_task_destroy(&task_id[count]);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+ }
+ ret = mars_task_barrier_destroy(barrier[i]);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+ }
+
+ ret = mars_context_destroy(mars_ctx);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+
+ return 0;
+}
+
diff --git a/tests/TFP/TFP_26_002/mpu1.c b/tests/TFP/TFP_26_002/mpu1.c
new file mode 100644
index 0000000..62a51a1
--- /dev/null
+++ b/tests/TFP/TFP_26_002/mpu1.c
@@ -0,0 +1,55 @@
+/*
+ * Copyright 2008 Sony Corporation
+ *
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a copy
+ * of this software and associated documentation files (the "Software"), to deal
+ * in the Software without restriction, including without limitation the rights
+ * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+ * copies of the Software, and to permit persons to whom the Software is
+ * furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included in
+ * all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+ * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+ * THE SOFTWARE.
+ */
+
+#include <mars/mars.h>
+#include <mars_task_test.h>
+#include <spu_mfcio.h>
+
+
+static uint32_t shared_resource __attribute((aligned(16)));
+
+int mars_task_main(const struct mars_task_args *task_args)
+{
+ int ret;
+ uint64_t barrier_ea = task_args->type.u64[0];
+ uint64_t shared_resource_ea = task_args->type.u64[1];
+
+ while (1) {
+ ret = mars_task_barrier_try_wait(barrier_ea);
+ if (ret == MARS_SUCCESS)
+ break;
+ else if (ret == MARS_ERROR_BUSY)
+ continue;
+ else
+ MARS_TEST_ASSERT_ERROR(ret, 0);
+ }
+
+ /* if program reaches here, shared_resource'll be updated */
+ shared_resource = 1;
+ mfc_put(&shared_resource, shared_resource_ea,
+ sizeof(uint32_t), 0, 0, 0);
+ mfc_write_tag_mask(1 << 0);
+ mfc_read_tag_status_all();
+
+ return 0;
+}
diff --git a/tests/TFP/TFP_26_002/mpu2.c b/tests/TFP/TFP_26_002/mpu2.c
new file mode 100644
index 0000000..c6abb4f
--- /dev/null
+++ b/tests/TFP/TFP_26_002/mpu2.c
@@ -0,0 +1,36 @@
+/*
+ * Copyright 2008 Sony Corporation
+ *
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a copy
+ * of this software and associated documentation files (the "Software"), to deal
+ * in the Software without restriction, including without limitation the rights
+ * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+ * copies of the Software, and to permit persons to whom the Software is
+ * furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included in
+ * all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+ * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+ * THE SOFTWARE.
+ */
+
+#include <mars/mars.h>
+#include <mars_task_test.h>
+
+int mars_task_main(const struct mars_task_args *task_args)
+{
+ int ret;
+ uint64_t barrier_ea = task_args->type.u64[0];
+
+ ret = mars_task_barrier_notify(barrier_ea);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+
+ return 0;
+}
diff --git a/tests/TFP/TFP_31_001/Makefile b/tests/TFP/TFP_31_001/Makefile
new file mode 100644
index 0000000..432135a
--- /dev/null
+++ b/tests/TFP/TFP_31_001/Makefile
@@ -0,0 +1,28 @@
+#
+# Copyright 2008 Sony Corporation
+#
+#
+# Permission is hereby granted, free of charge, to any person obtaining a copy
+# of this software and associated documentation files (the "Software"), to deal
+# in the Software without restriction, including without limitation the rights
+# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+# copies of the Software, and to permit persons to whom the Software is
+# furnished to do so, subject to the following conditions:
+#
+# The above copyright notice and this permission notice shall be included in
+# all copies or substantial portions of the Software.
+#
+# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+# THE SOFTWARE.
+#
+
+top_srcdir = ../..
+test_objs = host.o mpu.task_eo
+
+include $(top_srcdir)/scripts/config.mk
+include $(top_srcdir)/scripts/rules_item.mk
diff --git a/tests/TFP/TFP_31_001/host.c b/tests/TFP/TFP_31_001/host.c
new file mode 100644
index 0000000..e3f3801
--- /dev/null
+++ b/tests/TFP/TFP_31_001/host.c
@@ -0,0 +1,104 @@
+/*
+ * Copyright 2008 Sony Corporation
+ *
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a copy
+ * of this software and associated documentation files (the "Software"), to deal
+ * in the Software without restriction, including without limitation the rights
+ * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+ * copies of the Software, and to permit persons to whom the Software is
+ * furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included in
+ * all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+ * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+ * THE SOFTWARE.
+ */
+
+#include <mars/mars.h>
+#include <libspe2.h>
+#include <mars_test.h>
+
+extern spe_program_handle_t mpu_prog;
+
+static struct mars_context *mars_ctx;
+static struct mars_task_id task_id;
+static struct mars_task_args task_args;
+/*
+ * 0: MARS_TASK_EVENT_FLAG_CLEAR_AUTO MARS_TASK_EVENT_FLAG_MASK_AND
+ * 1: MARS_TASK_EVENT_FLAG_CLEAR_AUTO MARS_TASK_EVENT_FLAG_MASK_OR
+ * 2: MARS_TASK_EVENT_FLAG_CLEAR_MANUAL MARS_TASK_EVENT_FLAG_MASK_AND
+ * 3: MARS_TASK_EVENT_FLAG_CLEAR_MANUAL MARS_TASK_EVENT_FLAG_MASK_OR
+ */
+static uint64_t host_to_mpu[4];
+
+#define EVENT_FLAG_SIZE 32
+
+static void check_event_task(uint64_t ev_and, uint64_t ev_or)
+{
+ int ret;
+ int32_t exit_code;
+
+ ret = mars_task_create(mars_ctx, &task_id, NULL,
+ mpu_prog.elf_image, MARS_TASK_CONTEXT_SAVE_ALL);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+
+ task_args.type.u64[0] = ev_and;
+ task_args.type.u64[1] = ev_or;
+ ret = mars_task_schedule(&task_id, &task_args, 0);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+
+ ret = mars_task_wait(&task_id, &exit_code);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+ MARS_TEST_ASSERT_ERROR(exit_code, MARS_SUCCESS);
+
+ ret = mars_task_destroy(&task_id);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+}
+
+int main(void)
+{
+ int ret, i;
+
+ ret = mars_context_create(&mars_ctx, 0, 0);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+
+ for (i = 0; i < 2; i++) {
+ /* CLEAR_AUTO */
+ ret = mars_task_event_flag_create(
+ mars_ctx,
+ &host_to_mpu[i],
+ MARS_TASK_EVENT_FLAG_HOST_TO_MPU,
+ MARS_TASK_EVENT_FLAG_CLEAR_AUTO);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+
+ /* CLEAR_MANUAL */
+ ret = mars_task_event_flag_create(
+ mars_ctx,
+ &host_to_mpu[i + 2],
+ MARS_TASK_EVENT_FLAG_HOST_TO_MPU,
+ MARS_TASK_EVENT_FLAG_CLEAR_MANUAL);
+ }
+
+ check_event_task(host_to_mpu[0], host_to_mpu[1]);
+ check_event_task(host_to_mpu[2], host_to_mpu[3]);
+
+ for (i = 0; i < 2; i++) {
+ ret = mars_task_event_flag_destroy(host_to_mpu[i]);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+ ret = mars_task_event_flag_destroy(host_to_mpu[i + 2]);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+ }
+
+ ret = mars_context_destroy(mars_ctx);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+
+ return 0;
+}
+
diff --git a/tests/TFP/TFP_31_001/mpu.c b/tests/TFP/TFP_31_001/mpu.c
new file mode 100644
index 0000000..45e81b9
--- /dev/null
+++ b/tests/TFP/TFP_31_001/mpu.c
@@ -0,0 +1,55 @@
+/*
+ * Copyright 2008 Sony Corporation
+ *
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a copy
+ * of this software and associated documentation files (the "Software"), to deal
+ * in the Software without restriction, including without limitation the rights
+ * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+ * copies of the Software, and to permit persons to whom the Software is
+ * furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included in
+ * all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+ * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+ * THE SOFTWARE.
+ */
+
+#include <mars/mars.h>
+#include <mars_task_test.h>
+
+#define EVENT_FLAG_SIZE 32
+
+int mars_task_main(const struct mars_task_args *task_args)
+{
+ int ret, i;
+ uint64_t host_to_mpu_and_ea = task_args->type.u64[0];
+ uint64_t host_to_mpu_or_ea = task_args->type.u64[1];
+ uint32_t chk_bit;
+
+ chk_bit = 1;
+ for (i = 0; i < EVENT_FLAG_SIZE; i++) {
+ /* MASK_AND */
+ ret = mars_task_event_flag_try_wait(
+ host_to_mpu_and_ea,
+ chk_bit,
+ MARS_TASK_EVENT_FLAG_MASK_AND, NULL);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_ERROR_BUSY);
+
+ /* MASK_OR */
+ ret = mars_task_event_flag_try_wait(
+ host_to_mpu_or_ea,
+ chk_bit,
+ MARS_TASK_EVENT_FLAG_MASK_OR, NULL);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_ERROR_BUSY);
+
+ chk_bit <<= 1;
+ }
+ return 0;
+}
diff --git a/tests/TFP/TFP_31_002/Makefile b/tests/TFP/TFP_31_002/Makefile
new file mode 100644
index 0000000..43ba573
--- /dev/null
+++ b/tests/TFP/TFP_31_002/Makefile
@@ -0,0 +1,28 @@
+#
+# Copyright 2008 Sony Corporation
+#
+#
+# Permission is hereby granted, free of charge, to any person obtaining a copy
+# of this software and associated documentation files (the "Software"), to deal
+# in the Software without restriction, including without limitation the rights
+# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+# copies of the Software, and to permit persons to whom the Software is
+# furnished to do so, subject to the following conditions:
+#
+# The above copyright notice and this permission notice shall be included in
+# all copies or substantial portions of the Software.
+#
+# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+# THE SOFTWARE.
+#
+
+top_srcdir = ../..
+test_objs = host.o
+
+include $(top_srcdir)/scripts/config.mk
+include $(top_srcdir)/scripts/rules_item.mk
diff --git a/tests/TFP/TFP_31_002/host.c b/tests/TFP/TFP_31_002/host.c
new file mode 100644
index 0000000..54dc198
--- /dev/null
+++ b/tests/TFP/TFP_31_002/host.c
@@ -0,0 +1,107 @@
+/*
+ * Copyright 2008 Sony Corporation
+ *
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a copy
+ * of this software and associated documentation files (the "Software"), to deal
+ * in the Software without restriction, including without limitation the rights
+ * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+ * copies of the Software, and to permit persons to whom the Software is
+ * furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included in
+ * all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+ * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+ * THE SOFTWARE.
+ */
+
+#include <unistd.h>
+#include <mars/mars.h>
+#include <libspe2.h>
+#include <mars_test.h>
+
+extern spe_program_handle_t mpu_prog;
+
+static struct mars_context *mars_ctx;
+/*
+ * 0: MARS_TASK_EVENT_FLAG_CLEAR_AUTO MARS_TASK_EVENT_FLAG_MASK_AND
+ * 1: MARS_TASK_EVENT_FLAG_CLEAR_AUTO MARS_TASK_EVENT_FLAG_MASK_OR
+ * 2: MARS_TASK_EVENT_FLAG_CLEAR_MANUAL MARS_TASK_EVENT_FLAG_MASK_AND
+ * 3: MARS_TASK_EVENT_FLAG_CLEAR_MANUAL MARS_TASK_EVENT_FLAG_MASK_OR
+ */
+static uint64_t mpu_to_host[4];
+
+#define EVENT_FLAG_SIZE 32
+
+static void check_flag(uint64_t ev1, uint64_t ev2)
+{
+ int ret, i;
+ uint32_t chk_bit;
+
+ chk_bit = 1;
+ for (i = 0; i < EVENT_FLAG_SIZE; i++) {
+ /* MASK_AND */
+ ret = mars_task_event_flag_try_wait(
+ ev1,
+ chk_bit,
+ MARS_TASK_EVENT_FLAG_MASK_AND, NULL);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_ERROR_BUSY);
+
+ /* MASK_OR */
+ ret = mars_task_event_flag_try_wait(
+ ev2,
+ chk_bit,
+ MARS_TASK_EVENT_FLAG_MASK_OR, NULL);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_ERROR_BUSY);
+
+ chk_bit <<= 1;
+ }
+}
+
+int main(void)
+{
+ int ret, i;
+
+ ret = mars_context_create(&mars_ctx, 0, 0);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+
+ for (i = 0; i < 2; i++) {
+ /* CLEAR_AUTO */
+ ret = mars_task_event_flag_create(
+ mars_ctx,
+ &mpu_to_host[i],
+ MARS_TASK_EVENT_FLAG_MPU_TO_HOST,
+ MARS_TASK_EVENT_FLAG_CLEAR_AUTO);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+
+ /* CLEAR_MANUAL */
+ ret = mars_task_event_flag_create(
+ mars_ctx,
+ &mpu_to_host[i + 2],
+ MARS_TASK_EVENT_FLAG_MPU_TO_HOST,
+ MARS_TASK_EVENT_FLAG_CLEAR_MANUAL);
+ }
+
+ /* check event flags */
+ check_flag(mpu_to_host[0], mpu_to_host[1]);
+ check_flag(mpu_to_host[2], mpu_to_host[3]);
+
+ for (i = 0; i < 2; i++) {
+ ret = mars_task_event_flag_destroy(mpu_to_host[i]);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+ ret = mars_task_event_flag_destroy(mpu_to_host[i + 2]);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+ }
+
+ ret = mars_context_destroy(mars_ctx);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+
+ return 0;
+}
+
diff --git a/tests/TFP/TFP_31_003/Makefile b/tests/TFP/TFP_31_003/Makefile
new file mode 100644
index 0000000..432135a
--- /dev/null
+++ b/tests/TFP/TFP_31_003/Makefile
@@ -0,0 +1,28 @@
+#
+# Copyright 2008 Sony Corporation
+#
+#
+# Permission is hereby granted, free of charge, to any person obtaining a copy
+# of this software and associated documentation files (the "Software"), to deal
+# in the Software without restriction, including without limitation the rights
+# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+# copies of the Software, and to permit persons to whom the Software is
+# furnished to do so, subject to the following conditions:
+#
+# The above copyright notice and this permission notice shall be included in
+# all copies or substantial portions of the Software.
+#
+# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+# THE SOFTWARE.
+#
+
+top_srcdir = ../..
+test_objs = host.o mpu.task_eo
+
+include $(top_srcdir)/scripts/config.mk
+include $(top_srcdir)/scripts/rules_item.mk
diff --git a/tests/TFP/TFP_31_003/host.c b/tests/TFP/TFP_31_003/host.c
new file mode 100644
index 0000000..661aea7
--- /dev/null
+++ b/tests/TFP/TFP_31_003/host.c
@@ -0,0 +1,104 @@
+/*
+ * Copyright 2008 Sony Corporation
+ *
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a copy
+ * of this software and associated documentation files (the "Software"), to deal
+ * in the Software without restriction, including without limitation the rights
+ * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+ * copies of the Software, and to permit persons to whom the Software is
+ * furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included in
+ * all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+ * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+ * THE SOFTWARE.
+ */
+
+#include <mars/mars.h>
+#include <libspe2.h>
+#include <mars_test.h>
+
+extern spe_program_handle_t mpu_prog;
+
+static struct mars_context *mars_ctx;
+static struct mars_task_id task_id;
+static struct mars_task_args task_args;
+/*
+ * 0: MARS_TASK_EVENT_FLAG_CLEAR_AUTO MARS_TASK_EVENT_FLAG_MASK_AND
+ * 1: MARS_TASK_EVENT_FLAG_CLEAR_AUTO MARS_TASK_EVENT_FLAG_MASK_OR
+ * 2: MARS_TASK_EVENT_FLAG_CLEAR_MANUAL MARS_TASK_EVENT_FLAG_MASK_AND
+ * 3: MARS_TASK_EVENT_FLAG_CLEAR_MANUAL MARS_TASK_EVENT_FLAG_MASK_OR
+ */
+static uint64_t mpu_to_mpu[4];
+
+#define EVENT_FLAG_SIZE 32
+
+static void check_event_task(uint64_t ev_and, uint64_t ev_or)
+{
+ int ret;
+ int32_t exit_code;
+
+ ret = mars_task_create(mars_ctx, &task_id, NULL,
+ mpu_prog.elf_image, MARS_TASK_CONTEXT_SAVE_ALL);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+
+ task_args.type.u64[0] = ev_and;
+ task_args.type.u64[1] = ev_or;
+ ret = mars_task_schedule(&task_id, &task_args, 0);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+
+ ret = mars_task_wait(&task_id, &exit_code);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+ MARS_TEST_ASSERT_ERROR(exit_code, MARS_SUCCESS);
+
+ ret = mars_task_destroy(&task_id);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+}
+
+int main(void)
+{
+ int ret, i;
+
+ ret = mars_context_create(&mars_ctx, 0, 0);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+
+ for (i = 0; i < 2; i++) {
+ /* CLEAR_AUTO */
+ ret = mars_task_event_flag_create(
+ mars_ctx,
+ &mpu_to_mpu[i],
+ MARS_TASK_EVENT_FLAG_MPU_TO_MPU,
+ MARS_TASK_EVENT_FLAG_CLEAR_AUTO);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+
+ /* CLEAR_MANUAL */
+ ret = mars_task_event_flag_create(
+ mars_ctx,
+ &mpu_to_mpu[i + 2],
+ MARS_TASK_EVENT_FLAG_MPU_TO_MPU,
+ MARS_TASK_EVENT_FLAG_CLEAR_MANUAL);
+ }
+
+ check_event_task(mpu_to_mpu[0], mpu_to_mpu[1]);
+ check_event_task(mpu_to_mpu[2], mpu_to_mpu[3]);
+
+ for (i = 0; i < 2; i++) {
+ ret = mars_task_event_flag_destroy(mpu_to_mpu[i]);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+ ret = mars_task_event_flag_destroy(mpu_to_mpu[i + 2]);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+ }
+
+ ret = mars_context_destroy(mars_ctx);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+
+ return 0;
+}
+
diff --git a/tests/TFP/TFP_31_003/mpu.c b/tests/TFP/TFP_31_003/mpu.c
new file mode 100644
index 0000000..32611b6
--- /dev/null
+++ b/tests/TFP/TFP_31_003/mpu.c
@@ -0,0 +1,55 @@
+/*
+ * Copyright 2008 Sony Corporation
+ *
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a copy
+ * of this software and associated documentation files (the "Software"), to deal
+ * in the Software without restriction, including without limitation the rights
+ * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+ * copies of the Software, and to permit persons to whom the Software is
+ * furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included in
+ * all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+ * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+ * THE SOFTWARE.
+ */
+
+#include <mars/mars.h>
+#include <mars_task_test.h>
+
+#define EVENT_FLAG_SIZE 32
+
+int mars_task_main(const struct mars_task_args *task_args)
+{
+ int ret, i;
+ uint64_t mpu_to_mpu_and_ea = task_args->type.u64[0];
+ uint64_t mpu_to_mpu_or_ea = task_args->type.u64[1];
+ uint32_t chk_bit;
+
+ chk_bit = 1;
+ for (i = 0; i < EVENT_FLAG_SIZE; i++) {
+ /* MASK_AND */
+ ret = mars_task_event_flag_try_wait(
+ mpu_to_mpu_and_ea,
+ chk_bit,
+ MARS_TASK_EVENT_FLAG_MASK_AND, NULL);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_ERROR_BUSY);
+
+ /* MASK_OR */
+ ret = mars_task_event_flag_try_wait(
+ mpu_to_mpu_or_ea,
+ chk_bit,
+ MARS_TASK_EVENT_FLAG_MASK_OR, NULL);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_ERROR_BUSY);
+
+ chk_bit <<= 1;
+ }
+ return 0;
+}
diff --git a/tests/TFP/TFP_31_004/Makefile b/tests/TFP/TFP_31_004/Makefile
new file mode 100644
index 0000000..43ba573
--- /dev/null
+++ b/tests/TFP/TFP_31_004/Makefile
@@ -0,0 +1,28 @@
+#
+# Copyright 2008 Sony Corporation
+#
+#
+# Permission is hereby granted, free of charge, to any person obtaining a copy
+# of this software and associated documentation files (the "Software"), to deal
+# in the Software without restriction, including without limitation the rights
+# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+# copies of the Software, and to permit persons to whom the Software is
+# furnished to do so, subject to the following conditions:
+#
+# The above copyright notice and this permission notice shall be included in
+# all copies or substantial portions of the Software.
+#
+# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+# THE SOFTWARE.
+#
+
+top_srcdir = ../..
+test_objs = host.o
+
+include $(top_srcdir)/scripts/config.mk
+include $(top_srcdir)/scripts/rules_item.mk
diff --git a/tests/TFP/TFP_31_004/host.c b/tests/TFP/TFP_31_004/host.c
new file mode 100644
index 0000000..d44ebce
--- /dev/null
+++ b/tests/TFP/TFP_31_004/host.c
@@ -0,0 +1,73 @@
+/*
+ * Copyright 2008 Sony Corporation
+ *
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a copy
+ * of this software and associated documentation files (the "Software"), to deal
+ * in the Software without restriction, including without limitation the rights
+ * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+ * copies of the Software, and to permit persons to whom the Software is
+ * furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included in
+ * all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+ * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+ * THE SOFTWARE.
+ */
+
+#include <pthread.h>
+#include <libspe2.h>
+#include <mars/mars.h>
+#include <mars_test.h>
+
+#define THREAD_COUNT 16
+
+static pthread_t threads[THREAD_COUNT];
+static struct mars_context *mars;
+static uint64_t flags[THREAD_COUNT];
+
+void *thread_proc(void *arg)
+{
+ int ret;
+
+ ret = mars_task_event_flag_create(
+ mars,
+ &flags[mars_ptr_to_ea(arg)],
+ MARS_TASK_EVENT_FLAG_HOST_TO_MPU,
+ MARS_TASK_EVENT_FLAG_CLEAR_AUTO);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+
+ ret = mars_task_event_flag_destroy(flags[mars_ptr_to_ea(arg)]);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+
+ return NULL;
+}
+
+int main(void)
+{
+ int i, ret;
+
+ ret = mars_context_create(&mars, 0, 0);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+
+ for (i = 0; i < THREAD_COUNT; i++)
+ pthread_create(
+ &threads[i],
+ NULL,
+ thread_proc,
+ (void *)(uintptr_t)i);
+
+ for (i = 0; i < THREAD_COUNT; i++)
+ pthread_join(threads[i], NULL);
+
+ ret = mars_context_destroy(mars);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+
+ return 0;
+}
diff --git a/tests/TFP/TFP_33_001/Makefile b/tests/TFP/TFP_33_001/Makefile
new file mode 100644
index 0000000..432135a
--- /dev/null
+++ b/tests/TFP/TFP_33_001/Makefile
@@ -0,0 +1,28 @@
+#
+# Copyright 2008 Sony Corporation
+#
+#
+# Permission is hereby granted, free of charge, to any person obtaining a copy
+# of this software and associated documentation files (the "Software"), to deal
+# in the Software without restriction, including without limitation the rights
+# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+# copies of the Software, and to permit persons to whom the Software is
+# furnished to do so, subject to the following conditions:
+#
+# The above copyright notice and this permission notice shall be included in
+# all copies or substantial portions of the Software.
+#
+# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+# THE SOFTWARE.
+#
+
+top_srcdir = ../..
+test_objs = host.o mpu.task_eo
+
+include $(top_srcdir)/scripts/config.mk
+include $(top_srcdir)/scripts/rules_item.mk
diff --git a/tests/TFP/TFP_33_001/host.c b/tests/TFP/TFP_33_001/host.c
new file mode 100644
index 0000000..155536a
--- /dev/null
+++ b/tests/TFP/TFP_33_001/host.c
@@ -0,0 +1,92 @@
+/*
+ * Copyright 2008 Sony Corporation
+ *
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a copy
+ * of this software and associated documentation files (the "Software"), to deal
+ * in the Software without restriction, including without limitation the rights
+ * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+ * copies of the Software, and to permit persons to whom the Software is
+ * furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included in
+ * all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+ * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+ * THE SOFTWARE.
+ */
+
+#include <unistd.h>
+#include <mars/mars.h>
+#include <libspe2.h>
+#include <mars_test.h>
+
+#define EVENT_FLAG_SIZE 32
+extern spe_program_handle_t mpu_prog;
+static struct mars_context *mars_ctx;
+static struct mars_task_id task_id;
+static struct mars_task_args task_args;
+static uint64_t host_to_mpu;
+
+int main(void)
+{
+ int ret, i;
+ int32_t exit_code;
+ uint32_t chk_bit;
+
+ ret = mars_context_create(&mars_ctx, 0, 0);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+
+ ret = mars_task_event_flag_create(
+ mars_ctx,
+ &host_to_mpu,
+ MARS_TASK_EVENT_FLAG_HOST_TO_MPU,
+ MARS_TASK_EVENT_FLAG_CLEAR_AUTO);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+
+ /* set all event flag */
+ ret = mars_task_event_flag_set(host_to_mpu, (uint32_t)~0);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+
+ sleep(1);
+ /* clear bit and check */
+ chk_bit = 0x01;
+ for (i = 0; i < EVENT_FLAG_SIZE; i++) {
+ ret = mars_task_event_flag_clear(host_to_mpu, chk_bit);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+
+ ret = mars_task_create(mars_ctx, &task_id, NULL,
+ mpu_prog.elf_image,
+ MARS_TASK_CONTEXT_SAVE_ALL);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+
+ task_args.type.u64[0] = host_to_mpu;
+ task_args.type.u64[1] = (uint64_t)chk_bit;
+
+ ret = mars_task_schedule(&task_id, &task_args, 0);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+
+ ret = mars_task_wait(&task_id, &exit_code);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+ MARS_TEST_ASSERT_ERROR(exit_code, MARS_SUCCESS);
+
+ ret = mars_task_destroy(&task_id);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+
+ chk_bit <<= 1;
+ }
+
+ ret = mars_task_event_flag_destroy(host_to_mpu);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+
+ ret = mars_context_destroy(mars_ctx);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+
+ return 0;
+}
+
diff --git a/tests/TFP/TFP_33_001/mpu.c b/tests/TFP/TFP_33_001/mpu.c
new file mode 100644
index 0000000..9871a58
--- /dev/null
+++ b/tests/TFP/TFP_33_001/mpu.c
@@ -0,0 +1,41 @@
+/*
+ * Copyright 2008 Sony Corporation
+ *
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a copy
+ * of this software and associated documentation files (the "Software"), to deal
+ * in the Software without restriction, including without limitation the rights
+ * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+ * copies of the Software, and to permit persons to whom the Software is
+ * furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included in
+ * all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+ * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+ * THE SOFTWARE.
+ */
+
+#include <mars/mars.h>
+#include <mars_task_test.h>
+
+int mars_task_main(const struct mars_task_args *task_args)
+{
+ int ret;
+ uint64_t host_to_mpu_ea = task_args->type.u64[0];
+ uint32_t chk_bit = (uint32_t)task_args->type.u64[1];
+
+ ret = mars_task_event_flag_try_wait(
+ host_to_mpu_ea,
+ chk_bit,
+ MARS_TASK_EVENT_FLAG_MASK_AND, NULL);
+ /* if chk_bit is cleard, try_wait returns BUSY */
+ MARS_TEST_ASSERT_ERROR(ret, MARS_ERROR_BUSY);
+
+ return 0;
+}
diff --git a/tests/TFP/TFP_33_002/Makefile b/tests/TFP/TFP_33_002/Makefile
new file mode 100644
index 0000000..432135a
--- /dev/null
+++ b/tests/TFP/TFP_33_002/Makefile
@@ -0,0 +1,28 @@
+#
+# Copyright 2008 Sony Corporation
+#
+#
+# Permission is hereby granted, free of charge, to any person obtaining a copy
+# of this software and associated documentation files (the "Software"), to deal
+# in the Software without restriction, including without limitation the rights
+# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+# copies of the Software, and to permit persons to whom the Software is
+# furnished to do so, subject to the following conditions:
+#
+# The above copyright notice and this permission notice shall be included in
+# all copies or substantial portions of the Software.
+#
+# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+# THE SOFTWARE.
+#
+
+top_srcdir = ../..
+test_objs = host.o mpu.task_eo
+
+include $(top_srcdir)/scripts/config.mk
+include $(top_srcdir)/scripts/rules_item.mk
diff --git a/tests/TFP/TFP_33_002/host.c b/tests/TFP/TFP_33_002/host.c
new file mode 100644
index 0000000..5548faf
--- /dev/null
+++ b/tests/TFP/TFP_33_002/host.c
@@ -0,0 +1,108 @@
+/*
+ * Copyright 2008 Sony Corporation
+ *
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a copy
+ * of this software and associated documentation files (the "Software"), to deal
+ * in the Software without restriction, including without limitation the rights
+ * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+ * copies of the Software, and to permit persons to whom the Software is
+ * furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included in
+ * all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+ * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+ * THE SOFTWARE.
+ */
+
+#include <mars/mars.h>
+#include <libspe2.h>
+#include <mars_test.h>
+
+#define EVENT_FLAG_SIZE 32
+extern spe_program_handle_t mpu_prog;
+static struct mars_context *mars_ctx;
+static struct mars_task_id task_id;
+static struct mars_task_args task_args;
+static uint64_t mpu_to_host;
+
+int main(void)
+{
+ int ret, i;
+ int32_t exit_code;
+ uint32_t chk_bit;
+
+ ret = mars_context_create(&mars_ctx, 0, 0);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+
+ ret = mars_task_event_flag_create(
+ mars_ctx,
+ &mpu_to_host,
+ MARS_TASK_EVENT_FLAG_MPU_TO_HOST,
+ MARS_TASK_EVENT_FLAG_CLEAR_AUTO);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+
+ /* set all event flag */
+ ret = mars_task_create(mars_ctx, &task_id, NULL,
+ mpu_prog.elf_image,
+ MARS_TASK_CONTEXT_SAVE_ALL);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+
+ task_args.type.u64[0] = mpu_to_host;
+ task_args.type.u64[1] = (uint64_t)0; /* set all bits */
+ ret = mars_task_schedule(&task_id, &task_args, 0);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+
+ ret = mars_task_wait(&task_id, &exit_code);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+ MARS_TEST_ASSERT_ERROR(exit_code, MARS_SUCCESS);
+
+ ret = mars_task_destroy(&task_id);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+
+ chk_bit = 0x01;
+ for (i = 0; i < EVENT_FLAG_SIZE; i++) {
+ /* create mars task */
+ ret = mars_task_create(mars_ctx, &task_id, NULL,
+ mpu_prog.elf_image,
+ MARS_TASK_CONTEXT_SAVE_ALL);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+
+ task_args.type.u64[0] = mpu_to_host;
+ task_args.type.u64[1] = (uint64_t)chk_bit;
+ ret = mars_task_schedule(&task_id, &task_args, 0);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+
+ ret = mars_task_wait(&task_id, &exit_code);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+ MARS_TEST_ASSERT_ERROR(exit_code, MARS_SUCCESS);
+
+ /* check bit */
+ ret = mars_task_event_flag_try_wait(
+ mpu_to_host,
+ chk_bit,
+ MARS_TASK_EVENT_FLAG_MASK_AND, NULL);
+ /* if chk_bit is cleard, try_wait returns BUSY */
+ MARS_TEST_ASSERT_ERROR(ret, MARS_ERROR_BUSY);
+
+ ret = mars_task_destroy(&task_id);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+
+ chk_bit <<= 1;
+ }
+
+ ret = mars_task_event_flag_destroy(mpu_to_host);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+
+ ret = mars_context_destroy(mars_ctx);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+
+ return 0;
+}
+
diff --git a/tests/TFP/TFP_33_002/mpu.c b/tests/TFP/TFP_33_002/mpu.c
new file mode 100644
index 0000000..cfd09c7
--- /dev/null
+++ b/tests/TFP/TFP_33_002/mpu.c
@@ -0,0 +1,44 @@
+/*
+ * Copyright 2008 Sony Corporation
+ *
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a copy
+ * of this software and associated documentation files (the "Software"), to deal
+ * in the Software without restriction, including without limitation the rights
+ * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+ * copies of the Software, and to permit persons to whom the Software is
+ * furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included in
+ * all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+ * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+ * THE SOFTWARE.
+ */
+
+#include <mars/mars.h>
+#include <mars_task_test.h>
+
+int mars_task_main(const struct mars_task_args *task_args)
+{
+ int ret;
+ uint64_t mpu_to_host_ea = task_args->type.u64[0];
+ uint32_t chk_bit = (uint32_t)task_args->type.u64[1];
+
+ if (!chk_bit) {
+ /* set all bit */
+ ret = mars_task_event_flag_set(mpu_to_host_ea, (uint32_t)~0);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+ } else {
+ /* clear bit */
+ ret = mars_task_event_flag_clear(mpu_to_host_ea, chk_bit);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+ }
+
+ return 0;
+}
diff --git a/tests/TFP/TFP_33_003/Makefile b/tests/TFP/TFP_33_003/Makefile
new file mode 100644
index 0000000..ecbce33
--- /dev/null
+++ b/tests/TFP/TFP_33_003/Makefile
@@ -0,0 +1,28 @@
+#
+# Copyright 2008 Sony Corporation
+#
+#
+# Permission is hereby granted, free of charge, to any person obtaining a copy
+# of this software and associated documentation files (the "Software"), to deal
+# in the Software without restriction, including without limitation the rights
+# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+# copies of the Software, and to permit persons to whom the Software is
+# furnished to do so, subject to the following conditions:
+#
+# The above copyright notice and this permission notice shall be included in
+# all copies or substantial portions of the Software.
+#
+# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+# THE SOFTWARE.
+#
+
+top_srcdir = ../..
+test_objs = host.o mpu1.task_eo mpu2.task_eo
+
+include $(top_srcdir)/scripts/config.mk
+include $(top_srcdir)/scripts/rules_item.mk
diff --git a/tests/TFP/TFP_33_003/host.c b/tests/TFP/TFP_33_003/host.c
new file mode 100644
index 0000000..fd2de1e
--- /dev/null
+++ b/tests/TFP/TFP_33_003/host.c
@@ -0,0 +1,124 @@
+/*
+ * Copyright 2008 Sony Corporation
+ *
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a copy
+ * of this software and associated documentation files (the "Software"), to deal
+ * in the Software without restriction, including without limitation the rights
+ * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+ * copies of the Software, and to permit persons to whom the Software is
+ * furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included in
+ * all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+ * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+ * THE SOFTWARE.
+ */
+
+#include <unistd.h>
+#include <mars/mars.h>
+#include <libspe2.h>
+#include <mars_test.h>
+
+#define EVENT_FLAG_SIZE 32
+extern spe_program_handle_t mpu1_prog;
+extern spe_program_handle_t mpu2_prog;
+
+static struct mars_context *mars_ctx;
+static struct mars_task_id task1_id, task2_id;
+static struct mars_task_args task1_args, task2_args;
+static uint64_t mpu_to_mpu;
+
+int main(void)
+{
+ int ret, i;
+ int32_t exit_code;
+ uint32_t chk_bit;
+
+ ret = mars_context_create(&mars_ctx, 0, 0);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+
+ ret = mars_task_event_flag_create(
+ mars_ctx,
+ &mpu_to_mpu,
+ MARS_TASK_EVENT_FLAG_MPU_TO_MPU,
+ MARS_TASK_EVENT_FLAG_CLEAR_AUTO);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+
+ /* set all event flag */
+ ret = mars_task_create(mars_ctx, &task2_id, NULL,
+ mpu2_prog.elf_image,
+ MARS_TASK_CONTEXT_SAVE_ALL);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+
+ task2_args.type.u64[0] = mpu_to_mpu;
+ task2_args.type.u64[1] = (uint64_t)0; /* set all bits */
+ ret = mars_task_schedule(&task2_id, &task2_args, 0);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+
+ ret = mars_task_wait(&task2_id, &exit_code);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+ MARS_TEST_ASSERT_ERROR(exit_code, MARS_SUCCESS);
+
+ ret = mars_task_destroy(&task2_id);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+
+ sleep(1);
+ /* clear bit and check */
+ chk_bit = 0x01;
+ for (i = 0; i < EVENT_FLAG_SIZE; i++) {
+ /* create set flag task */
+ ret = mars_task_create(mars_ctx, &task2_id, NULL,
+ mpu2_prog.elf_image,
+ MARS_TASK_CONTEXT_SAVE_ALL);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+
+ task2_args.type.u64[0] = mpu_to_mpu;
+ task2_args.type.u64[1] = (uint64_t)chk_bit;
+ ret = mars_task_schedule(&task2_id, &task2_args, 0);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+
+ ret = mars_task_wait(&task2_id, &exit_code);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+ MARS_TEST_ASSERT_ERROR(exit_code, MARS_SUCCESS);
+
+ /* create wait task */
+ ret = mars_task_create(mars_ctx, &task1_id, NULL,
+ mpu1_prog.elf_image,
+ MARS_TASK_CONTEXT_SAVE_ALL);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+
+ task1_args.type.u64[0] = mpu_to_mpu;
+ task1_args.type.u64[1] = (uint64_t)chk_bit;
+
+ ret = mars_task_schedule(&task1_id, &task1_args, 0);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+
+ ret = mars_task_wait(&task1_id, &exit_code);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+ MARS_TEST_ASSERT_ERROR(exit_code, MARS_SUCCESS);
+
+ ret = mars_task_destroy(&task1_id);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+
+ ret = mars_task_destroy(&task2_id);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+
+ chk_bit <<= 1;
+ }
+
+ ret = mars_task_event_flag_destroy(mpu_to_mpu);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+
+ ret = mars_context_destroy(mars_ctx);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+
+ return 0;
+}
+
diff --git a/tests/TFP/TFP_33_003/mpu1.c b/tests/TFP/TFP_33_003/mpu1.c
new file mode 100644
index 0000000..2f788ba
--- /dev/null
+++ b/tests/TFP/TFP_33_003/mpu1.c
@@ -0,0 +1,41 @@
+/*
+ * Copyright 2008 Sony Corporation
+ *
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a copy
+ * of this software and associated documentation files (the "Software"), to deal
+ * in the Software without restriction, including without limitation the rights
+ * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+ * copies of the Software, and to permit persons to whom the Software is
+ * furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included in
+ * all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+ * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+ * THE SOFTWARE.
+ */
+
+#include <mars/mars.h>
+#include <mars_task_test.h>
+
+int mars_task_main(const struct mars_task_args *task_args)
+{
+ int ret;
+ uint64_t mpu_to_mpu_ea = task_args->type.u64[0];
+ uint32_t chk_bit = (uint32_t)task_args->type.u64[1];
+
+ ret = mars_task_event_flag_try_wait(
+ mpu_to_mpu_ea,
+ chk_bit,
+ MARS_TASK_EVENT_FLAG_MASK_AND, NULL);
+ /* if chk_bit is cleard, try_wait returns BUSY */
+ MARS_TEST_ASSERT_ERROR(ret, MARS_ERROR_BUSY);
+
+ return 0;
+}
diff --git a/tests/TFP/TFP_33_003/mpu2.c b/tests/TFP/TFP_33_003/mpu2.c
new file mode 100644
index 0000000..c543204
--- /dev/null
+++ b/tests/TFP/TFP_33_003/mpu2.c
@@ -0,0 +1,44 @@
+/*
+ * Copyright 2008 Sony Corporation
+ *
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a copy
+ * of this software and associated documentation files (the "Software"), to deal
+ * in the Software without restriction, including without limitation the rights
+ * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+ * copies of the Software, and to permit persons to whom the Software is
+ * furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included in
+ * all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+ * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+ * THE SOFTWARE.
+ */
+
+#include <mars/mars.h>
+#include <mars_task_test.h>
+
+int mars_task_main(const struct mars_task_args *task_args)
+{
+ int ret;
+ uint64_t mpu_to_mpu_ea = task_args->type.u64[0];
+ uint32_t chk_bit = (uint32_t)task_args->type.u64[1];
+
+ if (!chk_bit) {
+ /* set all bit */
+ ret = mars_task_event_flag_set(mpu_to_mpu_ea, (uint32_t)~0);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+ } else {
+ /* clear bit */
+ ret = mars_task_event_flag_clear(mpu_to_mpu_ea, chk_bit);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+ }
+
+ return 0;
+}
diff --git a/tests/TFP/TFP_33_004/Makefile b/tests/TFP/TFP_33_004/Makefile
new file mode 100644
index 0000000..432135a
--- /dev/null
+++ b/tests/TFP/TFP_33_004/Makefile
@@ -0,0 +1,28 @@
+#
+# Copyright 2008 Sony Corporation
+#
+#
+# Permission is hereby granted, free of charge, to any person obtaining a copy
+# of this software and associated documentation files (the "Software"), to deal
+# in the Software without restriction, including without limitation the rights
+# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+# copies of the Software, and to permit persons to whom the Software is
+# furnished to do so, subject to the following conditions:
+#
+# The above copyright notice and this permission notice shall be included in
+# all copies or substantial portions of the Software.
+#
+# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+# THE SOFTWARE.
+#
+
+top_srcdir = ../..
+test_objs = host.o mpu.task_eo
+
+include $(top_srcdir)/scripts/config.mk
+include $(top_srcdir)/scripts/rules_item.mk
diff --git a/tests/TFP/TFP_33_004/host.c b/tests/TFP/TFP_33_004/host.c
new file mode 100644
index 0000000..4004ab4
--- /dev/null
+++ b/tests/TFP/TFP_33_004/host.c
@@ -0,0 +1,196 @@
+/*
+ * Copyright 2008 Sony Corporation
+ *
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a copy
+ * of this software and associated documentation files (the "Software"), to deal
+ * in the Software without restriction, including without limitation the rights
+ * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+ * copies of the Software, and to permit persons to whom the Software is
+ * furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included in
+ * all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+ * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+ * THE SOFTWARE.
+ */
+
+#include <pthread.h>
+#include <unistd.h>
+#include <mars/mars.h>
+#include <libspe2.h>
+#include <mars_test.h>
+
+#define EVENT_FLAG_SIZE 32
+extern spe_program_handle_t mpu_prog;
+#define NUM_PATTERNS 5
+static uint32_t pattern[] = {
+ 0x00000001UL,
+ 0x0000CAFEUL,
+ 0x10203040UL,
+ 0x5A5A5A5AUL,
+ 0xFFFFFFFFUL
+};
+static struct mars_context *mars_ctx;
+static struct mars_task_id task_id;
+static struct mars_task_args task_args;
+static struct mars_task_args thread_args[EVENT_FLAG_SIZE];
+static uint64_t host_to_mpu[NUM_PATTERNS];
+
+static pthread_t thread[EVENT_FLAG_SIZE];
+static pthread_barrier_t barrier;
+
+static void *thread_proc(void *ptr)
+{
+ int ret;
+ struct mars_task_args *task_args = (struct mars_task_args *)ptr;
+ uint32_t i = (uint32_t)task_args->type.u32[0];
+ uint32_t chk_bit = task_args->type.u32[1];
+
+ /* wait */
+ pthread_barrier_wait(&barrier);
+
+ /* clear bits */
+ ret = mars_task_event_flag_clear(
+ host_to_mpu[i],
+ chk_bit
+ );
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+
+ return NULL;
+}
+
+int main(void)
+{
+ int ret, i, bits;
+ int32_t exit_code;
+ uint32_t chk_bit, pat;
+
+ ret = mars_context_create(&mars_ctx, 0, 0);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+
+ /* clear each bits one bye one */
+ for (i = 0; i < NUM_PATTERNS; i++) {
+ ret = mars_task_create(mars_ctx, &task_id, NULL,
+ mpu_prog.elf_image,
+ MARS_TASK_CONTEXT_SAVE_ALL);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+
+ ret = mars_task_event_flag_create(
+ mars_ctx,
+ &host_to_mpu[i],
+ MARS_TASK_EVENT_FLAG_HOST_TO_MPU,
+ MARS_TASK_EVENT_FLAG_CLEAR_AUTO);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+
+ /* set all event flag */
+ ret = mars_task_event_flag_set(host_to_mpu[i], (uint32_t)~0);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+
+ /* create barrier */
+ pat = pattern[i];
+ for (bits = 0; pat; pat >>= 1)
+ if (pat & 0x01)
+ bits++;
+ pthread_barrier_init(&barrier, NULL, bits);
+
+ /* create threads */
+ chk_bit = 0x01;
+ pat = pattern[i];
+ for (bits = 0; pat; bits++, pat >>= 1) {
+ if (pat & 0x01) {
+ thread_args[bits].type.u32[0] = (uint32_t)i;
+ thread_args[bits].type.u32[1] = chk_bit;
+ pthread_create(&thread[bits], NULL,
+ thread_proc, &thread_args[bits]);
+ }
+ chk_bit <<= 1;
+ }
+
+ pat = pattern[i];
+ for (bits = 0; pat; bits++, pat >>= 1) {
+ if (pat & 0x01)
+ pthread_join(thread[bits], NULL);
+ }
+
+ pthread_barrier_destroy(&barrier);
+
+ /* check event flag */
+ task_args.type.u64[0] = host_to_mpu[i];
+ task_args.type.u64[1] = (uint64_t)pattern[i];
+ ret = mars_task_schedule(&task_id, &task_args, 0);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+
+ ret = mars_task_wait(&task_id, &exit_code);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+ MARS_TEST_ASSERT_ERROR(exit_code, MARS_SUCCESS);
+
+ ret = mars_task_destroy(&task_id);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+
+ ret = mars_task_event_flag_destroy(host_to_mpu[i]);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+ }
+ /* clear same bits from multi threads*/
+ for (i = 0; i < NUM_PATTERNS; i++) {
+ ret = mars_task_create(mars_ctx, &task_id, NULL,
+ mpu_prog.elf_image,
+ MARS_TASK_CONTEXT_SAVE_ALL);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+
+ ret = mars_task_event_flag_create(
+ mars_ctx,
+ &host_to_mpu[i],
+ MARS_TASK_EVENT_FLAG_HOST_TO_MPU,
+ MARS_TASK_EVENT_FLAG_CLEAR_AUTO);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+
+ /* set all event flag */
+ ret = mars_task_event_flag_set(host_to_mpu[i], (uint32_t)~0);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+
+ /* create barrier */
+ pthread_barrier_init(&barrier, NULL, EVENT_FLAG_SIZE);
+
+ /* create threads */
+ for (bits = 0; bits < EVENT_FLAG_SIZE; bits++) {
+ thread_args[bits].type.u32[0] = (uint32_t)i;
+ thread_args[bits].type.u32[1] = pattern[i];
+ pthread_create(&thread[bits], NULL,
+ thread_proc, &thread_args[bits]);
+ }
+
+ for (bits = 0; bits < EVENT_FLAG_SIZE; bits++)
+ pthread_join(thread[bits], NULL);
+
+ pthread_barrier_destroy(&barrier);
+
+ /* check event flag */
+ task_args.type.u64[0] = host_to_mpu[i];
+ task_args.type.u64[1] = (uint64_t)pattern[i];
+ ret = mars_task_schedule(&task_id, &task_args, 0);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+
+ ret = mars_task_wait(&task_id, &exit_code);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+ MARS_TEST_ASSERT_ERROR(exit_code, MARS_SUCCESS);
+
+ ret = mars_task_destroy(&task_id);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+
+ ret = mars_task_event_flag_destroy(host_to_mpu[i]);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+ }
+
+ ret = mars_context_destroy(mars_ctx);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+
+ return 0;
+}
+
diff --git a/tests/TFP/TFP_33_004/mpu.c b/tests/TFP/TFP_33_004/mpu.c
new file mode 100644
index 0000000..da92e8b
--- /dev/null
+++ b/tests/TFP/TFP_33_004/mpu.c
@@ -0,0 +1,51 @@
+/*
+ * Copyright 2008 Sony Corporation
+ *
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a copy
+ * of this software and associated documentation files (the "Software"), to deal
+ * in the Software without restriction, including without limitation the rights
+ * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+ * copies of the Software, and to permit persons to whom the Software is
+ * furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included in
+ * all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+ * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+ * THE SOFTWARE.
+ */
+
+#include <mars/mars.h>
+#include <mars_task_test.h>
+
+#define EVENT_FLAG_SIZE 32
+
+int mars_task_main(const struct mars_task_args *task_args)
+{
+ int ret, i;
+ uint64_t host_to_mpu_ea = task_args->type.u64[0];
+ uint32_t pat = (uint32_t)task_args->type.u64[1];
+ uint32_t chk_bit;
+
+ chk_bit = 0x01;
+ for (i = 0; i < EVENT_FLAG_SIZE; i++, pat >>= 1) {
+ ret = mars_task_event_flag_try_wait(
+ host_to_mpu_ea,
+ chk_bit,
+ MARS_TASK_EVENT_FLAG_MASK_AND, NULL);
+ if (pat & 0x01)
+ /* if chk_bit is cleared, try_wait returns BUSY */
+ MARS_TEST_ASSERT_ERROR(ret, MARS_ERROR_BUSY);
+ else
+ /* other bis should not be cleared */
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+ chk_bit <<= 1;
+ }
+ return 0;
+}
diff --git a/tests/TFP/TFP_33_005/Makefile b/tests/TFP/TFP_33_005/Makefile
new file mode 100644
index 0000000..432135a
--- /dev/null
+++ b/tests/TFP/TFP_33_005/Makefile
@@ -0,0 +1,28 @@
+#
+# Copyright 2008 Sony Corporation
+#
+#
+# Permission is hereby granted, free of charge, to any person obtaining a copy
+# of this software and associated documentation files (the "Software"), to deal
+# in the Software without restriction, including without limitation the rights
+# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+# copies of the Software, and to permit persons to whom the Software is
+# furnished to do so, subject to the following conditions:
+#
+# The above copyright notice and this permission notice shall be included in
+# all copies or substantial portions of the Software.
+#
+# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+# THE SOFTWARE.
+#
+
+top_srcdir = ../..
+test_objs = host.o mpu.task_eo
+
+include $(top_srcdir)/scripts/config.mk
+include $(top_srcdir)/scripts/rules_item.mk
diff --git a/tests/TFP/TFP_33_005/host.c b/tests/TFP/TFP_33_005/host.c
new file mode 100644
index 0000000..292f612
--- /dev/null
+++ b/tests/TFP/TFP_33_005/host.c
@@ -0,0 +1,227 @@
+/*
+ * Copyright 2008 Sony Corporation
+ *
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a copy
+ * of this software and associated documentation files (the "Software"), to deal
+ * in the Software without restriction, including without limitation the rights
+ * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+ * copies of the Software, and to permit persons to whom the Software is
+ * furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included in
+ * all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+ * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+ * THE SOFTWARE.
+ */
+
+#include <unistd.h>
+#include <mars/mars.h>
+#include <libspe2.h>
+#include <mars_test.h>
+
+#define EVENT_FLAG_SIZE 32
+
+extern spe_program_handle_t mpu_prog;
+#define NUM_PATTERNS 5
+static uint32_t pattern[] = {
+ 0x00000001UL,
+ 0x0000CAFEUL,
+ 0x10203040UL,
+ 0x5A5A5A5AUL,
+ 0xFFFFFFFFUL
+};
+static struct mars_context *mars_ctx;
+static struct mars_task_id task1_id, task_id[EVENT_FLAG_SIZE];
+static struct mars_task_args task1_args, task_args[EVENT_FLAG_SIZE];
+static uint64_t mpu_to_host[NUM_PATTERNS];
+static uint32_t notify[32] __attribute((aligned(128)));
+
+static void check_flag(uint32_t id, uint32_t pat)
+{
+ int ret, i;
+ uint32_t chk_bit;
+
+ chk_bit = 0x01;
+ for (i = 0; i < EVENT_FLAG_SIZE; i++, pat >>= 1) {
+ ret = mars_task_event_flag_try_wait(
+ mpu_to_host[id],
+ chk_bit,
+ MARS_TASK_EVENT_FLAG_MASK_AND, NULL);
+ if (pat & 0x01)
+ /* if chk_bit is cleard, try_wait returns BUSY */
+ MARS_TEST_ASSERT_ERROR(ret, MARS_ERROR_BUSY);
+ else
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+ chk_bit <<= 1;
+ }
+}
+
+int main(void)
+{
+ int ret, i, bits;
+ int32_t exit_code;
+ uint32_t chk_bit, pat;
+
+ ret = mars_context_create(&mars_ctx, 0, 0);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+
+ /* clear bits one by one */
+ for (i = 0; i < NUM_PATTERNS; i++) {
+ notify[0] = 0;
+
+ ret = mars_task_event_flag_create(
+ mars_ctx,
+ &mpu_to_host[i],
+ MARS_TASK_EVENT_FLAG_MPU_TO_HOST,
+ MARS_TASK_EVENT_FLAG_CLEAR_AUTO);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+
+ /* set all flags */
+ ret = mars_task_create(mars_ctx, &task1_id, NULL,
+ mpu_prog.elf_image,
+ MARS_TASK_CONTEXT_SAVE_ALL);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+
+ task1_args.type.u64[0] = mpu_to_host[i];
+ task1_args.type.u64[1] = (uint64_t)0;
+ task1_args.type.u64[2] = mars_ptr_to_ea(&notify);
+ ret = mars_task_schedule(&task1_id, &task1_args, 0);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+
+ ret = mars_task_wait(&task1_id, &exit_code);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+ MARS_TEST_ASSERT_ERROR(exit_code, MARS_SUCCESS);
+
+ ret = mars_task_destroy(&task1_id);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+
+ /* create mpu tasks */
+ chk_bit = 0x01;
+ pat = pattern[i];
+ for (bits = 0; pat; bits++, chk_bit <<= 1, pat >>= 1) {
+ if (!(pat & 0x01))
+ continue;
+
+ ret = mars_task_create(mars_ctx, &task_id[bits], NULL,
+ mpu_prog.elf_image,
+ MARS_TASK_CONTEXT_SAVE_ALL);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+
+ task_args[bits].type.u64[0] = mpu_to_host[i];
+ task_args[bits].type.u64[1] = (uint64_t)chk_bit;
+ task_args[bits].type.u64[2] =
+ mars_ptr_to_ea(&notify);
+
+ ret = mars_task_schedule(&task_id[bits],
+ &task_args[bits], 0);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+ }
+
+ sleep(1);
+ /* start mpu tasks at the same time */
+ mars_test_counter_set(&notify[0], 1);
+
+ pat = pattern[i];
+ for (bits = 0; pat; bits++, pat >>= 1) {
+ if (pat & 0x01) {
+ ret = mars_task_wait(&task_id[bits],
+ &exit_code);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+ MARS_TEST_ASSERT_ERROR(exit_code, MARS_SUCCESS);
+ }
+ }
+
+ /* check event flag */
+ check_flag(i, pattern[i]);
+
+ pat = pattern[i];
+ for (bits = 0; pat; bits++, pat >>= 1) {
+ if (pat & 0x01) {
+ ret = mars_task_destroy(&task_id[bits]);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+ }
+ }
+ ret = mars_task_event_flag_destroy(mpu_to_host[i]);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+ }
+ /* clear same bits by multi task */
+ for (i = 0; i < NUM_PATTERNS; i++) {
+ notify[0] = 0;
+
+ ret = mars_task_event_flag_create(
+ mars_ctx,
+ &mpu_to_host[i],
+ MARS_TASK_EVENT_FLAG_MPU_TO_HOST,
+ MARS_TASK_EVENT_FLAG_CLEAR_AUTO);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+
+ /* set all flags */
+ ret = mars_task_create(mars_ctx, &task1_id, NULL,
+ mpu_prog.elf_image,
+ MARS_TASK_CONTEXT_SAVE_ALL);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+
+ task1_args.type.u64[0] = mpu_to_host[i];
+ task1_args.type.u64[1] = (uint64_t)0;
+ task1_args.type.u64[2] = mars_ptr_to_ea(&notify);
+ ret = mars_task_schedule(&task1_id, &task1_args, 0);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+
+ ret = mars_task_wait(&task1_id, &exit_code);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+ MARS_TEST_ASSERT_ERROR(exit_code, MARS_SUCCESS);
+
+ ret = mars_task_destroy(&task1_id);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+
+ /* create mpu tasks */
+ for (bits = 0; bits < EVENT_FLAG_SIZE; bits++) {
+ ret = mars_task_create(mars_ctx, &task_id[bits], NULL,
+ mpu_prog.elf_image,
+ MARS_TASK_CONTEXT_SAVE_ALL);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+
+ task_args[bits].type.u64[0] = mpu_to_host[i];
+ task_args[bits].type.u64[1] = (uint64_t)pattern[i];
+ task_args[bits].type.u64[2] =
+ mars_ptr_to_ea(&notify);
+
+ ret = mars_task_schedule(&task_id[bits],
+ &task_args[bits], 0);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+ }
+
+ sleep(1);
+ /* start mpu tasks at the same time */
+ mars_test_counter_set(&notify[0], 1);
+
+ for (bits = 0; bits < EVENT_FLAG_SIZE; bits++) {
+ ret = mars_task_wait(&task_id[bits], &exit_code);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+ MARS_TEST_ASSERT_ERROR(exit_code, MARS_SUCCESS);
+ }
+
+ /* check event flag */
+ check_flag(i, pattern[i]);
+
+ for (bits = 0; bits < EVENT_FLAG_SIZE; bits++) {
+ ret = mars_task_destroy(&task_id[bits]);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+ }
+ ret = mars_task_event_flag_destroy(mpu_to_host[i]);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+ }
+
+ ret = mars_context_destroy(mars_ctx);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+
+ return 0;
+}
+
diff --git a/tests/TFP/TFP_33_005/mpu.c b/tests/TFP/TFP_33_005/mpu.c
new file mode 100644
index 0000000..6144904
--- /dev/null
+++ b/tests/TFP/TFP_33_005/mpu.c
@@ -0,0 +1,48 @@
+/*
+ * Copyright 2008 Sony Corporation
+ *
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a copy
+ * of this software and associated documentation files (the "Software"), to deal
+ * in the Software without restriction, including without limitation the rights
+ * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+ * copies of the Software, and to permit persons to whom the Software is
+ * furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included in
+ * all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+ * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+ * THE SOFTWARE.
+ */
+
+#include <mars/mars.h>
+#include <mars_task_test.h>
+#include <spu_mfcio.h>
+
+int mars_task_main(const struct mars_task_args *task_args)
+{
+ int ret;
+ uint64_t mpu_to_host_ea = task_args->type.u64[0];
+ uint32_t chk_bit = (uint32_t)task_args->type.u64[1];
+ uint64_t notify_ea = task_args->type.u64[2];
+
+ if (!chk_bit) {
+ /* set all bits */
+ ret = mars_task_event_flag_set(mpu_to_host_ea, (uint32_t)~0);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+ return 0;
+ }
+
+ mars_test_counter_wait(notify_ea, 1);
+
+ ret = mars_task_event_flag_clear(mpu_to_host_ea, chk_bit);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+
+ return 0;
+}
diff --git a/tests/TFP/TFP_34_001/Makefile b/tests/TFP/TFP_34_001/Makefile
new file mode 100644
index 0000000..432135a
--- /dev/null
+++ b/tests/TFP/TFP_34_001/Makefile
@@ -0,0 +1,28 @@
+#
+# Copyright 2008 Sony Corporation
+#
+#
+# Permission is hereby granted, free of charge, to any person obtaining a copy
+# of this software and associated documentation files (the "Software"), to deal
+# in the Software without restriction, including without limitation the rights
+# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+# copies of the Software, and to permit persons to whom the Software is
+# furnished to do so, subject to the following conditions:
+#
+# The above copyright notice and this permission notice shall be included in
+# all copies or substantial portions of the Software.
+#
+# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+# THE SOFTWARE.
+#
+
+top_srcdir = ../..
+test_objs = host.o mpu.task_eo
+
+include $(top_srcdir)/scripts/config.mk
+include $(top_srcdir)/scripts/rules_item.mk
diff --git a/tests/TFP/TFP_34_001/host.c b/tests/TFP/TFP_34_001/host.c
new file mode 100644
index 0000000..c454892
--- /dev/null
+++ b/tests/TFP/TFP_34_001/host.c
@@ -0,0 +1,126 @@
+/*
+ * Copyright 2008 Sony Corporation
+ *
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a copy
+ * of this software and associated documentation files (the "Software"), to deal
+ * in the Software without restriction, including without limitation the rights
+ * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+ * copies of the Software, and to permit persons to whom the Software is
+ * furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included in
+ * all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+ * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+ * THE SOFTWARE.
+ */
+
+#include <mars/mars.h>
+#include <libspe2.h>
+#include <mars_test.h>
+
+#define EVENT_FLAG_SIZE 32
+
+extern spe_program_handle_t mpu_prog;
+
+static struct mars_context *mars_ctx;
+static struct mars_task_id task_id;
+static struct mars_task_args task_args;
+/*
+ * 0: MARS_TASK_EVENT_FLAG_CLEAR_AUTO MARS_TASK_EVENT_FLAG_MASK_AND
+ * 1: MARS_TASK_EVENT_FLAG_CLEAR_AUTO MARS_TASK_EVENT_FLAG_MASK_OR
+ * 2: MARS_TASK_EVENT_FLAG_CLEAR_MANUAL MARS_TASK_EVENT_FLAG_MASK_AND
+ * 3: MARS_TASK_EVENT_FLAG_CLEAR_MANUAL MARS_TASK_EVENT_FLAG_MASK_OR
+ */
+static uint64_t host_to_mpu[EVENT_FLAG_SIZE][4];
+
+
+static void check_event_task(uint64_t ev_and, uint64_t ev_or, uint32_t chk_bit)
+{
+ int ret;
+ int32_t exit_code;
+
+ ret = mars_task_create(mars_ctx, &task_id, NULL,
+ mpu_prog.elf_image, MARS_TASK_CONTEXT_SAVE_ALL);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+
+ task_args.type.u64[0] = ev_and;
+ task_args.type.u64[1] = ev_or;
+ task_args.type.u64[2] = (uint64_t)chk_bit;
+ ret = mars_task_schedule(&task_id, &task_args, 0);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+
+ ret = mars_task_wait(&task_id, &exit_code);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+ MARS_TEST_ASSERT_ERROR(exit_code, MARS_SUCCESS);
+
+ ret = mars_task_destroy(&task_id);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+}
+
+int main(void)
+{
+ int ret, i, j;
+ uint32_t chk_bit;
+
+ ret = mars_context_create(&mars_ctx, 0, 0);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+
+ for (i = 0; i < EVENT_FLAG_SIZE; i++) {
+ for (j = 0; j < 2; j++) {
+ /* CLEAR_AUTO */
+ ret = mars_task_event_flag_create(
+ mars_ctx,
+ &host_to_mpu[i][j],
+ MARS_TASK_EVENT_FLAG_HOST_TO_MPU,
+ MARS_TASK_EVENT_FLAG_CLEAR_AUTO);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+
+ /* CLEAR_MANUAL */
+ ret = mars_task_event_flag_create(
+ mars_ctx,
+ &host_to_mpu[i][j + 2],
+ MARS_TASK_EVENT_FLAG_HOST_TO_MPU,
+ MARS_TASK_EVENT_FLAG_CLEAR_MANUAL);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+ }
+ }
+
+ chk_bit = 1;
+ for (i = 0; i < EVENT_FLAG_SIZE; i++) {
+ for (j = 0; j < 4; j++) {
+ ret = mars_task_event_flag_set(
+ host_to_mpu[i][j], chk_bit);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+ }
+ check_event_task(host_to_mpu[i][0],
+ host_to_mpu[i][1], chk_bit);
+ check_event_task(host_to_mpu[i][2],
+ host_to_mpu[i][3], chk_bit);
+
+ chk_bit <<= 1;
+ }
+
+ for (i = 0; i < EVENT_FLAG_SIZE; i++) {
+ for (j = 0; j < 2; j++) {
+ ret = mars_task_event_flag_destroy(
+ host_to_mpu[i][j]);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+ ret = mars_task_event_flag_destroy(
+ host_to_mpu[i][j + 2]);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+ }
+ }
+
+ ret = mars_context_destroy(mars_ctx);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+
+ return 0;
+}
+
diff --git a/tests/TFP/TFP_34_001/mpu.c b/tests/TFP/TFP_34_001/mpu.c
new file mode 100644
index 0000000..1e0e761
--- /dev/null
+++ b/tests/TFP/TFP_34_001/mpu.c
@@ -0,0 +1,62 @@
+/*
+ * Copyright 2008 Sony Corporation
+ *
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a copy
+ * of this software and associated documentation files (the "Software"), to deal
+ * in the Software without restriction, including without limitation the rights
+ * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+ * copies of the Software, and to permit persons to whom the Software is
+ * furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included in
+ * all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+ * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+ * THE SOFTWARE.
+ */
+
+#include <mars/mars.h>
+#include <mars_task_test.h>
+
+#define EVENT_FLAG_SIZE 32
+
+int mars_task_main(const struct mars_task_args *task_args)
+{
+ int ret, i;
+ uint64_t host_to_mpu_and_ea = task_args->type.u64[0];
+ uint64_t host_to_mpu_or_ea = task_args->type.u64[1];
+ uint32_t flag = (uint32_t)task_args->type.u64[2];
+ uint32_t chk_bit;
+
+ chk_bit = 1;
+ for (i = 0; i < EVENT_FLAG_SIZE; i++) {
+ /* MASK_AND */
+ ret = mars_task_event_flag_try_wait(
+ host_to_mpu_and_ea,
+ chk_bit,
+ MARS_TASK_EVENT_FLAG_MASK_AND, NULL);
+ if (chk_bit == flag)
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+ else
+ MARS_TEST_ASSERT_ERROR(ret, MARS_ERROR_BUSY);
+
+ /* MASK_OR */
+ ret = mars_task_event_flag_try_wait(
+ host_to_mpu_or_ea,
+ chk_bit,
+ MARS_TASK_EVENT_FLAG_MASK_OR, NULL);
+ if (chk_bit == flag)
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+ else
+ MARS_TEST_ASSERT_ERROR(ret, MARS_ERROR_BUSY);
+
+ chk_bit <<= 1;
+ }
+ return 0;
+}
diff --git a/tests/TFP/TFP_34_002/Makefile b/tests/TFP/TFP_34_002/Makefile
new file mode 100644
index 0000000..432135a
--- /dev/null
+++ b/tests/TFP/TFP_34_002/Makefile
@@ -0,0 +1,28 @@
+#
+# Copyright 2008 Sony Corporation
+#
+#
+# Permission is hereby granted, free of charge, to any person obtaining a copy
+# of this software and associated documentation files (the "Software"), to deal
+# in the Software without restriction, including without limitation the rights
+# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+# copies of the Software, and to permit persons to whom the Software is
+# furnished to do so, subject to the following conditions:
+#
+# The above copyright notice and this permission notice shall be included in
+# all copies or substantial portions of the Software.
+#
+# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+# THE SOFTWARE.
+#
+
+top_srcdir = ../..
+test_objs = host.o mpu.task_eo
+
+include $(top_srcdir)/scripts/config.mk
+include $(top_srcdir)/scripts/rules_item.mk
diff --git a/tests/TFP/TFP_34_002/host.c b/tests/TFP/TFP_34_002/host.c
new file mode 100644
index 0000000..d308ca9
--- /dev/null
+++ b/tests/TFP/TFP_34_002/host.c
@@ -0,0 +1,182 @@
+/*
+ * Copyright 2008 Sony Corporation
+ *
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a copy
+ * of this software and associated documentation files (the "Software"), to deal
+ * in the Software without restriction, including without limitation the rights
+ * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+ * copies of the Software, and to permit persons to whom the Software is
+ * furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included in
+ * all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+ * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+ * THE SOFTWARE.
+ */
+
+#include <unistd.h>
+#include <mars/mars.h>
+#include <libspe2.h>
+#include <mars_test.h>
+
+#define EVENT_FLAG_SIZE 32
+
+extern spe_program_handle_t mpu_prog;
+
+static struct mars_context *mars_ctx;
+/*
+ * 0: MARS_TASK_EVENT_FLAG_CLEAR_AUTO
+ * 1: MARS_TASK_EVENT_FLAG_CLEAR_MANUAL
+ */
+static struct mars_task_id task_id[EVENT_FLAG_SIZE][2];
+static struct mars_task_args task_args;
+/*
+ * 0: MARS_TASK_EVENT_FLAG_CLEAR_AUTO MARS_TASK_EVENT_FLAG_MASK_AND
+ * 1: MARS_TASK_EVENT_FLAG_CLEAR_AUTO MARS_TASK_EVENT_FLAG_MASK_OR
+ * 2: MARS_TASK_EVENT_FLAG_CLEAR_MANUAL MARS_TASK_EVENT_FLAG_MASK_AND
+ * 3: MARS_TASK_EVENT_FLAG_CLEAR_MANUAL MARS_TASK_EVENT_FLAG_MASK_OR
+ */
+static uint64_t mpu_to_host[EVENT_FLAG_SIZE][4];
+
+
+static void check_flag(uint64_t ev_and, uint64_t ev_or, uint32_t flag)
+{
+ int ret, i;
+ uint32_t chk_bit;
+
+ chk_bit = 1;
+ for (i = 0; i < EVENT_FLAG_SIZE; i++) {
+ /* MASK_AND */
+ ret = mars_task_event_flag_try_wait(
+ ev_and,
+ chk_bit,
+ MARS_TASK_EVENT_FLAG_MASK_AND, NULL);
+ if (chk_bit == flag)
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+ else
+ MARS_TEST_ASSERT_ERROR(ret, MARS_ERROR_BUSY);
+
+ /* MASK_OR */
+ ret = mars_task_event_flag_try_wait(
+ ev_or,
+ chk_bit,
+ MARS_TASK_EVENT_FLAG_MASK_OR, NULL);
+ if (chk_bit == flag)
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+ else
+ MARS_TEST_ASSERT_ERROR(ret, MARS_ERROR_BUSY);
+
+ chk_bit <<= 1;
+ }
+
+}
+
+int main(void)
+{
+ int ret, i, j;
+ int32_t exit_code;
+ uint32_t chk_bit;
+
+ ret = mars_context_create(&mars_ctx, 0, 0);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+
+ for (i = 0; i < EVENT_FLAG_SIZE; i++) {
+ for (j = 0; j < 2; j++) {
+ /* CLEAR_AUTO */
+ ret = mars_task_event_flag_create(
+ mars_ctx,
+ &mpu_to_host[i][j],
+ MARS_TASK_EVENT_FLAG_MPU_TO_HOST,
+ MARS_TASK_EVENT_FLAG_CLEAR_AUTO);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+
+ /* CLEAR_MANUAL */
+ ret = mars_task_event_flag_create(
+ mars_ctx,
+ &mpu_to_host[i][j + 2],
+ MARS_TASK_EVENT_FLAG_MPU_TO_HOST,
+ MARS_TASK_EVENT_FLAG_CLEAR_MANUAL);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+ }
+ }
+
+ chk_bit = 1;
+ for (i = 0; i < EVENT_FLAG_SIZE; i++) {
+ /* AUTO */
+ ret = mars_task_create(mars_ctx, &task_id[i][0], NULL,
+ mpu_prog.elf_image, MARS_TASK_CONTEXT_SAVE_ALL);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+
+ task_args.type.u64[0] = mpu_to_host[i][0];
+ task_args.type.u64[1] = mpu_to_host[i][1];
+ task_args.type.u64[2] = (uint64_t)chk_bit;
+ ret = mars_task_schedule(&task_id[i][0], &task_args, 0);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+
+ /* MANUAL */
+ ret = mars_task_create(mars_ctx, &task_id[i][1], NULL,
+ mpu_prog.elf_image, MARS_TASK_CONTEXT_SAVE_ALL);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+
+ task_args.type.u64[0] = mpu_to_host[i][2];
+ task_args.type.u64[1] = mpu_to_host[i][3];
+ task_args.type.u64[2] = (uint64_t)chk_bit;
+ ret = mars_task_schedule(&task_id[i][1], &task_args, 0);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+
+ chk_bit <<= 1;
+ }
+
+ /* wait for flag set */
+ sleep(1);
+
+ chk_bit = 1;
+ for (i = 0; i < EVENT_FLAG_SIZE; i++) {
+ check_flag(mpu_to_host[i][0],
+ mpu_to_host[i][1], chk_bit);
+ check_flag(mpu_to_host[i][2],
+ mpu_to_host[i][3], chk_bit);
+
+ chk_bit <<= 1;
+ }
+
+ for (i = 0; i < EVENT_FLAG_SIZE; i++) {
+ ret = mars_task_wait(&task_id[i][0], &exit_code);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+ MARS_TEST_ASSERT_ERROR(exit_code, MARS_SUCCESS);
+
+ ret = mars_task_wait(&task_id[i][1], &exit_code);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+ MARS_TEST_ASSERT_ERROR(exit_code, MARS_SUCCESS);
+
+ ret = mars_task_destroy(&task_id[i][0]);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+
+ ret = mars_task_destroy(&task_id[i][1]);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+ }
+
+ for (i = 0; i < EVENT_FLAG_SIZE; i++) {
+ for (j = 0; j < 2; j++) {
+ ret = mars_task_event_flag_destroy(
+ mpu_to_host[i][j]);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+ ret = mars_task_event_flag_destroy(
+ mpu_to_host[i][j + 2]);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+ }
+ }
+
+ ret = mars_context_destroy(mars_ctx);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+
+ return 0;
+}
+
diff --git a/tests/TFP/TFP_34_002/mpu.c b/tests/TFP/TFP_34_002/mpu.c
new file mode 100644
index 0000000..36e405a
--- /dev/null
+++ b/tests/TFP/TFP_34_002/mpu.c
@@ -0,0 +1,40 @@
+/*
+ * Copyright 2008 Sony Corporation
+ *
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a copy
+ * of this software and associated documentation files (the "Software"), to deal
+ * in the Software without restriction, including without limitation the rights
+ * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+ * copies of the Software, and to permit persons to whom the Software is
+ * furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included in
+ * all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+ * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+ * THE SOFTWARE.
+ */
+
+#include <mars/mars.h>
+#include <mars_task_test.h>
+
+int mars_task_main(const struct mars_task_args *task_args)
+{
+ int ret;
+ uint64_t mpu_to_host_and_ea = task_args->type.u64[0];
+ uint64_t mpu_to_host_or_ea = task_args->type.u64[1];
+ uint32_t chk_bit = (uint32_t)task_args->type.u64[2];
+
+ ret = mars_task_event_flag_set(mpu_to_host_and_ea, chk_bit);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+ ret = mars_task_event_flag_set(mpu_to_host_or_ea, chk_bit);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+
+ return 0;
+}
diff --git a/tests/TFP/TFP_34_003/Makefile b/tests/TFP/TFP_34_003/Makefile
new file mode 100644
index 0000000..ecbce33
--- /dev/null
+++ b/tests/TFP/TFP_34_003/Makefile
@@ -0,0 +1,28 @@
+#
+# Copyright 2008 Sony Corporation
+#
+#
+# Permission is hereby granted, free of charge, to any person obtaining a copy
+# of this software and associated documentation files (the "Software"), to deal
+# in the Software without restriction, including without limitation the rights
+# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+# copies of the Software, and to permit persons to whom the Software is
+# furnished to do so, subject to the following conditions:
+#
+# The above copyright notice and this permission notice shall be included in
+# all copies or substantial portions of the Software.
+#
+# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+# THE SOFTWARE.
+#
+
+top_srcdir = ../..
+test_objs = host.o mpu1.task_eo mpu2.task_eo
+
+include $(top_srcdir)/scripts/config.mk
+include $(top_srcdir)/scripts/rules_item.mk
diff --git a/tests/TFP/TFP_34_003/host.c b/tests/TFP/TFP_34_003/host.c
new file mode 100644
index 0000000..1c793ec
--- /dev/null
+++ b/tests/TFP/TFP_34_003/host.c
@@ -0,0 +1,179 @@
+/*
+ * Copyright 2008 Sony Corporation
+ *
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a copy
+ * of this software and associated documentation files (the "Software"), to deal
+ * in the Software without restriction, including without limitation the rights
+ * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+ * copies of the Software, and to permit persons to whom the Software is
+ * furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included in
+ * all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+ * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+ * THE SOFTWARE.
+ */
+
+#include <unistd.h>
+#include <mars/mars.h>
+#include <libspe2.h>
+#include <mars_test.h>
+
+#define EVENT_FLAG_SIZE 32
+
+extern spe_program_handle_t mpu1_prog;
+extern spe_program_handle_t mpu2_prog;
+
+static struct mars_context *mars_ctx;
+static struct mars_task_id task1_id;
+static struct mars_task_args task1_args;
+/*
+ * 0: MARS_TASK_EVENT_FLAG_CLEAR_AUTO
+ * 1: MARS_TASK_EVENT_FLAG_CLEAR_MANUAL
+ */
+static struct mars_task_id task2_id[EVENT_FLAG_SIZE][2];
+static struct mars_task_args task2_args;
+/*
+ * 0: MARS_TASK_EVENT_FLAG_CLEAR_AUTO MARS_TASK_EVENT_FLAG_MASK_AND
+ * 1: MARS_TASK_EVENT_FLAG_CLEAR_AUTO MARS_TASK_EVENT_FLAG_MASK_OR
+ * 2: MARS_TASK_EVENT_FLAG_CLEAR_MANUAL MARS_TASK_EVENT_FLAG_MASK_AND
+ * 3: MARS_TASK_EVENT_FLAG_CLEAR_MANUAL MARS_TASK_EVENT_FLAG_MASK_OR
+ */
+static uint64_t mpu_to_mpu[EVENT_FLAG_SIZE][4];
+
+
+static void check_event_task(uint64_t ev_and, uint64_t ev_or, uint32_t chk_bit)
+{
+ int ret;
+ int32_t exit_code;
+
+ ret = mars_task_create(mars_ctx, &task1_id, NULL,
+ mpu1_prog.elf_image, MARS_TASK_CONTEXT_SAVE_ALL);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+
+ task1_args.type.u64[0] = ev_and;
+ task1_args.type.u64[1] = ev_or;
+ task1_args.type.u64[2] = (uint64_t)chk_bit;
+ ret = mars_task_schedule(&task1_id, &task1_args, 0);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+
+ ret = mars_task_wait(&task1_id, &exit_code);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+ MARS_TEST_ASSERT_ERROR(exit_code, MARS_SUCCESS);
+
+ ret = mars_task_destroy(&task1_id);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+}
+
+int main(void)
+{
+ int ret, i, j;
+ uint32_t chk_bit;
+ int32_t exit_code;
+
+ ret = mars_context_create(&mars_ctx, 0, 0);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+
+ for (i = 0; i < EVENT_FLAG_SIZE; i++) {
+ for (j = 0; j < 2; j++) {
+ /* CLEAR_AUTO */
+ ret = mars_task_event_flag_create(
+ mars_ctx,
+ &mpu_to_mpu[i][j],
+ MARS_TASK_EVENT_FLAG_MPU_TO_MPU,
+ MARS_TASK_EVENT_FLAG_CLEAR_AUTO);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+
+ /* CLEAR_MANUAL */
+ ret = mars_task_event_flag_create(
+ mars_ctx,
+ &mpu_to_mpu[i][j + 2],
+ MARS_TASK_EVENT_FLAG_MPU_TO_MPU,
+ MARS_TASK_EVENT_FLAG_CLEAR_MANUAL);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+ }
+ }
+
+ chk_bit = 1;
+ for (i = 0; i < EVENT_FLAG_SIZE; i++) {
+ /* create set task */
+ /* AUTO */
+ ret = mars_task_create(mars_ctx, &task2_id[i][0], NULL,
+ mpu2_prog.elf_image, MARS_TASK_CONTEXT_SAVE_ALL);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+
+ task2_args.type.u64[0] = mpu_to_mpu[i][0];
+ task2_args.type.u64[1] = mpu_to_mpu[i][1];
+ task2_args.type.u64[2] = (uint64_t)chk_bit;
+ ret = mars_task_schedule(&task2_id[i][0], &task2_args, 0);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+
+ /* MANUAL */
+ ret = mars_task_create(mars_ctx, &task2_id[i][1], NULL,
+ mpu2_prog.elf_image, MARS_TASK_CONTEXT_SAVE_ALL);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+
+ task2_args.type.u64[0] = mpu_to_mpu[i][2];
+ task2_args.type.u64[1] = mpu_to_mpu[i][3];
+ task2_args.type.u64[2] = (uint64_t)chk_bit;
+ ret = mars_task_schedule(&task2_id[i][1], &task2_args, 0);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+
+ chk_bit <<= 1;
+ }
+
+ /* wait for flag_set */
+ sleep(1);
+
+ /* check flags */
+ chk_bit = 1;
+ for (i = 0; i < EVENT_FLAG_SIZE; i++) {
+ /* create check task */
+ check_event_task(mpu_to_mpu[i][0],
+ mpu_to_mpu[i][1], chk_bit);
+ check_event_task(mpu_to_mpu[i][2],
+ mpu_to_mpu[i][3], chk_bit);
+
+ chk_bit <<= 1;
+ }
+
+ for (i = 0; i < EVENT_FLAG_SIZE; i++) {
+ ret = mars_task_wait(&task2_id[i][0], &exit_code);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+ MARS_TEST_ASSERT_ERROR(exit_code, MARS_SUCCESS);
+
+ ret = mars_task_wait(&task2_id[i][1], &exit_code);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+ MARS_TEST_ASSERT_ERROR(exit_code, MARS_SUCCESS);
+
+ ret = mars_task_destroy(&task2_id[i][0]);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+
+ ret = mars_task_destroy(&task2_id[i][1]);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+ }
+
+ for (i = 0; i < EVENT_FLAG_SIZE; i++) {
+ for (j = 0; j < 2; j++) {
+ ret = mars_task_event_flag_destroy(
+ mpu_to_mpu[i][j]);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+ ret = mars_task_event_flag_destroy(
+ mpu_to_mpu[i][j + 2]);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+ }
+ }
+
+ ret = mars_context_destroy(mars_ctx);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+
+ return 0;
+}
+
diff --git a/tests/TFP/TFP_34_003/mpu1.c b/tests/TFP/TFP_34_003/mpu1.c
new file mode 100644
index 0000000..cb6ffd7
--- /dev/null
+++ b/tests/TFP/TFP_34_003/mpu1.c
@@ -0,0 +1,62 @@
+/*
+ * Copyright 2008 Sony Corporation
+ *
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a copy
+ * of this software and associated documentation files (the "Software"), to deal
+ * in the Software without restriction, including without limitation the rights
+ * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+ * copies of the Software, and to permit persons to whom the Software is
+ * furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included in
+ * all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+ * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+ * THE SOFTWARE.
+ */
+
+#include <mars/mars.h>
+#include <mars_task_test.h>
+
+#define EVENT_FLAG_SIZE 32
+
+int mars_task_main(const struct mars_task_args *task_args)
+{
+ int ret, i;
+ uint64_t mpu_to_mpu_and_ea = task_args->type.u64[0];
+ uint64_t mpu_to_mpu_or_ea = task_args->type.u64[1];
+ uint32_t flag = (uint32_t)task_args->type.u64[2];
+ uint32_t chk_bit;
+
+ chk_bit = 1;
+ for (i = 0; i < EVENT_FLAG_SIZE; i++) {
+ /* MASK_AND */
+ ret = mars_task_event_flag_try_wait(
+ mpu_to_mpu_and_ea,
+ chk_bit,
+ MARS_TASK_EVENT_FLAG_MASK_AND, NULL);
+ if (chk_bit == flag)
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+ else
+ MARS_TEST_ASSERT_ERROR(ret, MARS_ERROR_BUSY);
+
+ /* MASK_OR */
+ ret = mars_task_event_flag_try_wait(
+ mpu_to_mpu_or_ea,
+ chk_bit,
+ MARS_TASK_EVENT_FLAG_MASK_OR, NULL);
+ if (chk_bit == flag)
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+ else
+ MARS_TEST_ASSERT_ERROR(ret, MARS_ERROR_BUSY);
+
+ chk_bit <<= 1;
+ }
+ return 0;
+}
diff --git a/tests/TFP/TFP_34_003/mpu2.c b/tests/TFP/TFP_34_003/mpu2.c
new file mode 100644
index 0000000..698027a
--- /dev/null
+++ b/tests/TFP/TFP_34_003/mpu2.c
@@ -0,0 +1,40 @@
+/*
+ * Copyright 2008 Sony Corporation
+ *
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a copy
+ * of this software and associated documentation files (the "Software"), to deal
+ * in the Software without restriction, including without limitation the rights
+ * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+ * copies of the Software, and to permit persons to whom the Software is
+ * furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included in
+ * all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+ * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+ * THE SOFTWARE.
+ */
+
+#include <mars/mars.h>
+#include <mars_task_test.h>
+
+int mars_task_main(const struct mars_task_args *task_args)
+{
+ int ret;
+ uint64_t mpu_to_mpu_and_ea = task_args->type.u64[0];
+ uint64_t mpu_to_mpu_or_ea = task_args->type.u64[1];
+ uint32_t chk_bit = (uint32_t)task_args->type.u64[2];
+
+ ret = mars_task_event_flag_set(mpu_to_mpu_and_ea, chk_bit);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+ ret = mars_task_event_flag_set(mpu_to_mpu_or_ea, chk_bit);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+
+ return 0;
+}
diff --git a/tests/TFP/TFP_34_004/Makefile b/tests/TFP/TFP_34_004/Makefile
new file mode 100644
index 0000000..432135a
--- /dev/null
+++ b/tests/TFP/TFP_34_004/Makefile
@@ -0,0 +1,28 @@
+#
+# Copyright 2008 Sony Corporation
+#
+#
+# Permission is hereby granted, free of charge, to any person obtaining a copy
+# of this software and associated documentation files (the "Software"), to deal
+# in the Software without restriction, including without limitation the rights
+# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+# copies of the Software, and to permit persons to whom the Software is
+# furnished to do so, subject to the following conditions:
+#
+# The above copyright notice and this permission notice shall be included in
+# all copies or substantial portions of the Software.
+#
+# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+# THE SOFTWARE.
+#
+
+top_srcdir = ../..
+test_objs = host.o mpu.task_eo
+
+include $(top_srcdir)/scripts/config.mk
+include $(top_srcdir)/scripts/rules_item.mk
diff --git a/tests/TFP/TFP_34_004/host.c b/tests/TFP/TFP_34_004/host.c
new file mode 100644
index 0000000..2d15719
--- /dev/null
+++ b/tests/TFP/TFP_34_004/host.c
@@ -0,0 +1,133 @@
+/*
+ * Copyright 2008 Sony Corporation
+ *
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a copy
+ * of this software and associated documentation files (the "Software"), to deal
+ * in the Software without restriction, including without limitation the rights
+ * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+ * copies of the Software, and to permit persons to whom the Software is
+ * furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included in
+ * all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+ * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+ * THE SOFTWARE.
+ */
+
+#include <pthread.h>
+#include <unistd.h>
+#include <mars/mars.h>
+#include <libspe2.h>
+#include <mars_test.h>
+
+#define EVENT_FLAG_SIZE 32
+
+extern spe_program_handle_t mpu_prog;
+#define NUM_PATTERNS 5
+static uint32_t pattern[NUM_PATTERNS] = {
+ 0x00000001UL,
+ 0x0000CAFEUL,
+ 0x01010101UL,
+ 0x5A5A5A5AUL,
+ 0xFFFFFFFFUL
+};
+static struct mars_context *mars_ctx;
+static struct mars_task_id task_id;
+static struct mars_task_args task_args, thread_args[EVENT_FLAG_SIZE];
+static uint64_t host_to_mpu[NUM_PATTERNS];
+static uint32_t shared_resource __attribute((aligned(16)));
+
+static pthread_t thread[EVENT_FLAG_SIZE];
+
+static void *thread_proc(void *ptr)
+{
+ int ret;
+ struct mars_task_args *task_args = (struct mars_task_args *)ptr;
+ uint32_t i = (uint32_t)task_args->type.u32[0];
+ uint32_t chk_bit = task_args->type.u32[1];
+
+ while (!shared_resource)
+ usleep(100);
+
+ ret = mars_task_event_flag_set(
+ host_to_mpu[i], chk_bit);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+
+ return NULL;
+}
+
+int main(void)
+{
+ int ret, i, bits;
+ uint32_t chk_bit, pat;
+ int32_t exit_code;
+
+ ret = mars_context_create(&mars_ctx, 0, 0);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+
+ for (i = 0; i < NUM_PATTERNS; i++) {
+ shared_resource = 0;
+ ret = mars_task_event_flag_create(
+ mars_ctx,
+ &host_to_mpu[i],
+ MARS_TASK_EVENT_FLAG_HOST_TO_MPU,
+ MARS_TASK_EVENT_FLAG_CLEAR_AUTO);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+
+ chk_bit = 0x01;
+ pat = pattern[i];
+ for (bits = 0; pat ; bits++, pat >>= 1) {
+ if (pat & 0x01) {
+ thread_args[bits].type.u32[0] = (uint32_t)i;
+ thread_args[bits].type.u32[1] = chk_bit;
+ pthread_create(&thread[bits], NULL,
+ thread_proc, &thread_args[bits]);
+ }
+ chk_bit <<= 1;
+ }
+
+ sleep(1);
+ /* set event flags */
+ shared_resource = 1;
+
+ pat = pattern[i];
+ for (bits = 0; pat ; bits++, pat >>= 1) {
+ if (pat & 0x01)
+ pthread_join(thread[bits], NULL);
+ }
+
+ ret = mars_task_create(mars_ctx, &task_id, NULL,
+ mpu_prog.elf_image,
+ MARS_TASK_CONTEXT_SAVE_ALL);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+
+ task_args.type.u64[0] = host_to_mpu[i];
+ task_args.type.u64[1] = (uint64_t)pattern[i];
+
+ ret = mars_task_schedule(&task_id, &task_args, 0);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+
+ ret = mars_task_wait(&task_id, &exit_code);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+ MARS_TEST_ASSERT_ERROR(exit_code, MARS_SUCCESS);
+
+ ret = mars_task_destroy(&task_id);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+
+ ret = mars_task_event_flag_destroy(host_to_mpu[i]);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+ }
+
+ ret = mars_context_destroy(mars_ctx);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+
+ return 0;
+}
+
diff --git a/tests/TFP/TFP_34_004/mpu.c b/tests/TFP/TFP_34_004/mpu.c
new file mode 100644
index 0000000..4a51012
--- /dev/null
+++ b/tests/TFP/TFP_34_004/mpu.c
@@ -0,0 +1,43 @@
+/*
+ * Copyright 2008 Sony Corporation
+ *
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a copy
+ * of this software and associated documentation files (the "Software"), to deal
+ * in the Software without restriction, including without limitation the rights
+ * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+ * copies of the Software, and to permit persons to whom the Software is
+ * furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included in
+ * all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+ * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+ * THE SOFTWARE.
+ */
+
+#include <mars/mars.h>
+#include <mars_task_test.h>
+
+int mars_task_main(const struct mars_task_args *task_args)
+{
+ int ret;
+ uint64_t host_to_mpu_ea = task_args->type.u64[0];
+ uint32_t chk_bit = (uint32_t)task_args->type.u64[1];
+ uint32_t val = 0;
+
+ ret = mars_task_event_flag_try_wait(
+ host_to_mpu_ea,
+ chk_bit,
+ MARS_TASK_EVENT_FLAG_MASK_OR, &val);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+
+ MARS_TEST_ASSERT_EQUAL(chk_bit, val);
+
+ return 0;
+}
diff --git a/tests/TFP/TFP_34_005/Makefile b/tests/TFP/TFP_34_005/Makefile
new file mode 100644
index 0000000..432135a
--- /dev/null
+++ b/tests/TFP/TFP_34_005/Makefile
@@ -0,0 +1,28 @@
+#
+# Copyright 2008 Sony Corporation
+#
+#
+# Permission is hereby granted, free of charge, to any person obtaining a copy
+# of this software and associated documentation files (the "Software"), to deal
+# in the Software without restriction, including without limitation the rights
+# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+# copies of the Software, and to permit persons to whom the Software is
+# furnished to do so, subject to the following conditions:
+#
+# The above copyright notice and this permission notice shall be included in
+# all copies or substantial portions of the Software.
+#
+# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+# THE SOFTWARE.
+#
+
+top_srcdir = ../..
+test_objs = host.o mpu.task_eo
+
+include $(top_srcdir)/scripts/config.mk
+include $(top_srcdir)/scripts/rules_item.mk
diff --git a/tests/TFP/TFP_34_005/host.c b/tests/TFP/TFP_34_005/host.c
new file mode 100644
index 0000000..cd2c22a
--- /dev/null
+++ b/tests/TFP/TFP_34_005/host.c
@@ -0,0 +1,124 @@
+/*
+ * Copyright 2008 Sony Corporation
+ *
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a copy
+ * of this software and associated documentation files (the "Software"), to deal
+ * in the Software without restriction, including without limitation the rights
+ * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+ * copies of the Software, and to permit persons to whom the Software is
+ * furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included in
+ * all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+ * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+ * THE SOFTWARE.
+ */
+
+#include <unistd.h>
+#include <mars/mars.h>
+#include <libspe2.h>
+#include <mars_test.h>
+
+#define EVENT_FLAG_SIZE 32
+
+extern spe_program_handle_t mpu_prog;
+#define NUM_PATTERNS 5
+static uint32_t pattern[NUM_PATTERNS] = {
+ 0x00000001UL,
+ 0x0000CAFEUL,
+ 0x01010101UL,
+ 0x5A5A5A5AUL,
+ 0xFFFFFFFFUL
+};
+static struct mars_context *mars_ctx;
+static struct mars_task_id task_id[EVENT_FLAG_SIZE];
+static struct mars_task_args task_args;
+static uint64_t mpu_to_host[NUM_PATTERNS];
+static uint32_t notify[32] __attribute((aligned(128)));
+
+
+static void check_flag(int id, uint32_t chk_bit)
+{
+ int ret;
+ uint32_t val = 0;
+
+ ret = mars_task_event_flag_try_wait(
+ mpu_to_host[id],
+ chk_bit,
+ MARS_TASK_EVENT_FLAG_MASK_OR, &val);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+
+ MARS_TEST_ASSERT_EQUAL(chk_bit, val);
+}
+
+int main(void)
+{
+ int ret, i, bits;
+ uint32_t chk_bit, pat;
+ int32_t exit_code;
+
+ ret = mars_context_create(&mars_ctx, 0, 0);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+
+ for (i = 0; i < NUM_PATTERNS; i++) {
+ notify[0] = 0;
+ ret = mars_task_event_flag_create(
+ mars_ctx,
+ &mpu_to_host[i],
+ MARS_TASK_EVENT_FLAG_MPU_TO_HOST,
+ MARS_TASK_EVENT_FLAG_CLEAR_AUTO);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+
+ chk_bit = 0x01;
+ pat = pattern[i];
+ for (bits = 0; pat; bits++, pat >>= 1, chk_bit <<= 1) {
+ if (!(pat & 0x01))
+ continue;
+ ret = mars_task_create(mars_ctx, &task_id[bits], NULL,
+ mpu_prog.elf_image,
+ MARS_TASK_CONTEXT_SAVE_ALL);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+
+ /* mpu tasks will set event_flags */
+ task_args.type.u64[0] = mpu_to_host[i];
+ task_args.type.u64[1] = (uint64_t)chk_bit;
+ task_args.type.u64[2] = mars_ptr_to_ea(&notify);
+ ret = mars_task_schedule(&task_id[bits], &task_args, 0);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+ }
+
+ sleep(1);
+ /* start all tasks */
+ mars_test_counter_set(&notify[0], 1);
+
+ pat = pattern[i];
+ for (bits = 0; pat; bits++, pat >>= 1) {
+ if (!(pat & 0x01))
+ continue;
+ ret = mars_task_wait(&task_id[bits], &exit_code);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+ MARS_TEST_ASSERT_ERROR(exit_code, MARS_SUCCESS);
+
+ ret = mars_task_destroy(&task_id[bits]);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+ }
+
+ check_flag(i, pattern[i]);
+
+ ret = mars_task_event_flag_destroy(mpu_to_host[i]);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+ }
+
+ ret = mars_context_destroy(mars_ctx);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+
+ return 0;
+}
+
diff --git a/tests/TFP/TFP_34_005/mpu.c b/tests/TFP/TFP_34_005/mpu.c
new file mode 100644
index 0000000..37cbd0b
--- /dev/null
+++ b/tests/TFP/TFP_34_005/mpu.c
@@ -0,0 +1,41 @@
+/*
+ * Copyright 2008 Sony Corporation
+ *
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a copy
+ * of this software and associated documentation files (the "Software"), to deal
+ * in the Software without restriction, including without limitation the rights
+ * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+ * copies of the Software, and to permit persons to whom the Software is
+ * furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included in
+ * all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+ * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+ * THE SOFTWARE.
+ */
+
+#include <mars/mars.h>
+#include <mars_task_test.h>
+#include <spu_mfcio.h>
+
+int mars_task_main(const struct mars_task_args *task_args)
+{
+ int ret;
+ uint64_t mpu_to_host_ea = task_args->type.u64[0];
+ uint32_t chk_bit = (uint32_t)task_args->type.u64[1];
+ uint64_t notify_ea = task_args->type.u64[2];
+
+ mars_test_counter_wait(notify_ea, 1);
+
+ ret = mars_task_event_flag_set(mpu_to_host_ea, chk_bit);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+
+ return 0;
+}
diff --git a/tests/TFP/TFP_34_006/Makefile b/tests/TFP/TFP_34_006/Makefile
new file mode 100644
index 0000000..432135a
--- /dev/null
+++ b/tests/TFP/TFP_34_006/Makefile
@@ -0,0 +1,28 @@
+#
+# Copyright 2008 Sony Corporation
+#
+#
+# Permission is hereby granted, free of charge, to any person obtaining a copy
+# of this software and associated documentation files (the "Software"), to deal
+# in the Software without restriction, including without limitation the rights
+# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+# copies of the Software, and to permit persons to whom the Software is
+# furnished to do so, subject to the following conditions:
+#
+# The above copyright notice and this permission notice shall be included in
+# all copies or substantial portions of the Software.
+#
+# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+# THE SOFTWARE.
+#
+
+top_srcdir = ../..
+test_objs = host.o mpu.task_eo
+
+include $(top_srcdir)/scripts/config.mk
+include $(top_srcdir)/scripts/rules_item.mk
diff --git a/tests/TFP/TFP_34_006/host.c b/tests/TFP/TFP_34_006/host.c
new file mode 100644
index 0000000..6ed9313
--- /dev/null
+++ b/tests/TFP/TFP_34_006/host.c
@@ -0,0 +1,224 @@
+/*
+ * Copyright 2008 Sony Corporation
+ *
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a copy
+ * of this software and associated documentation files (the "Software"), to deal
+ * in the Software without restriction, including without limitation the rights
+ * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+ * copies of the Software, and to permit persons to whom the Software is
+ * furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included in
+ * all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+ * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+ * THE SOFTWARE.
+ */
+
+#include <pthread.h>
+#include <unistd.h>
+#include <mars/mars.h>
+#include <libspe2.h>
+#include <mars_test.h>
+
+#define EVENT_FLAG_SIZE 32
+
+extern spe_program_handle_t mpu_prog;
+#define DEFAULT_PATTERN 0xA5A5C3C3UL
+#define NUM_PATTERNS 5
+static uint32_t pattern[] = {
+ 0x00000001UL,
+ 0x0000CAFEUL,
+ 0x10203040UL,
+ 0x5A5A5A5AUL,
+ 0xFFFFFFFFUL
+};
+static struct mars_context *mars_ctx;
+static struct mars_task_id task_id;
+static struct mars_task_args task_args;
+static struct mars_task_args thread_args[EVENT_FLAG_SIZE];
+static uint64_t host_to_mpu[NUM_PATTERNS];
+
+static pthread_t thread[EVENT_FLAG_SIZE];
+static pthread_barrier_t barrier;
+
+static void *thread1_proc(void *ptr)
+{
+ int ret;
+ struct mars_task_args *task_args = (struct mars_task_args *)ptr;
+ uint32_t i = (uint32_t)task_args->type.u32[0];
+ uint32_t chk_bit = task_args->type.u32[1];
+
+ /* wait */
+ pthread_barrier_wait(&barrier);
+
+ /* clear bits */
+ ret = mars_task_event_flag_set(
+ host_to_mpu[i],
+ chk_bit
+ );
+ return NULL;
+}
+static void *thread2_proc(void *ptr)
+{
+ int ret;
+ struct mars_task_args *task_args = (struct mars_task_args *)ptr;
+ uint32_t i = (uint32_t)task_args->type.u32[0];
+ uint32_t chk_bit = task_args->type.u32[1];
+
+ /* wait */
+ pthread_barrier_wait(&barrier);
+
+ /* clear bits */
+ ret = mars_task_event_flag_clear(
+ host_to_mpu[i],
+ chk_bit
+ );
+ return NULL;
+}
+
+int main(void)
+{
+ int ret, i, bits;
+ int32_t exit_code;
+ uint32_t chk_bit, pat;
+
+ ret = mars_context_create(&mars_ctx, 0, 0);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+
+ /* set and clear bits one by one */
+ for (i = 0; i < NUM_PATTERNS; i++) {
+ ret = mars_task_create(mars_ctx, &task_id, NULL,
+ mpu_prog.elf_image,
+ MARS_TASK_CONTEXT_SAVE_ALL);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+
+ ret = mars_task_event_flag_create(
+ mars_ctx,
+ &host_to_mpu[i],
+ MARS_TASK_EVENT_FLAG_HOST_TO_MPU,
+ MARS_TASK_EVENT_FLAG_CLEAR_AUTO);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+
+ /* set event flag to DEFAULT_PATTERN */
+ ret = mars_task_event_flag_set(host_to_mpu[i], DEFAULT_PATTERN);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+
+ /* create barrier */
+ pthread_barrier_init(&barrier, NULL, EVENT_FLAG_SIZE);
+
+ /* create threads */
+ chk_bit = 0x01;
+ pat = pattern[i];
+ for (bits = 0; bits < EVENT_FLAG_SIZE ; bits++) {
+ thread_args[bits].type.u32[0] = (uint32_t)i;
+ thread_args[bits].type.u32[1] = chk_bit;
+ if (pat & 0x01) {
+ /* set */
+ pthread_create(&thread[bits], NULL,
+ thread1_proc, &thread_args[bits]);
+ } else {
+ /* clear */
+ pthread_create(&thread[bits], NULL,
+ thread2_proc, &thread_args[bits]);
+ }
+ pat >>= 1;
+ chk_bit <<= 1;
+ }
+
+ for (bits = 0; bits < EVENT_FLAG_SIZE ; bits++)
+ pthread_join(thread[bits], NULL);
+
+ pthread_barrier_destroy(&barrier);
+
+ /* check event flag */
+ task_args.type.u64[0] = host_to_mpu[i];
+ task_args.type.u64[1] = (uint64_t)pattern[i];
+ ret = mars_task_schedule(&task_id, &task_args, 0);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+
+ ret = mars_task_wait(&task_id, &exit_code);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+ MARS_TEST_ASSERT_ERROR(exit_code, MARS_SUCCESS);
+
+ ret = mars_task_destroy(&task_id);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+
+ ret = mars_task_event_flag_destroy(host_to_mpu[i]);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+ }
+ /* set and clear same bits by mutil threads */
+ for (i = 0; i < NUM_PATTERNS; i++) {
+ ret = mars_task_create(mars_ctx, &task_id, NULL,
+ mpu_prog.elf_image,
+ MARS_TASK_CONTEXT_SAVE_ALL);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+
+ ret = mars_task_event_flag_create(
+ mars_ctx,
+ &host_to_mpu[i],
+ MARS_TASK_EVENT_FLAG_HOST_TO_MPU,
+ MARS_TASK_EVENT_FLAG_CLEAR_AUTO);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+
+ /* set event flag to DEFAULT_PATTERN */
+ ret = mars_task_event_flag_set(host_to_mpu[i], DEFAULT_PATTERN);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+
+ /* create barrier */
+ pthread_barrier_init(&barrier, NULL, EVENT_FLAG_SIZE);
+
+ /* create threads */
+ chk_bit = 0x01;
+ pat = pattern[i];
+ for (bits = 0; bits < EVENT_FLAG_SIZE ; bits++) {
+ thread_args[bits].type.u32[0] = (uint32_t)i;
+ if (pat & 0x01) {
+ /* set */
+ thread_args[bits].type.u32[1] = pattern[i];
+ pthread_create(&thread[bits], NULL,
+ thread1_proc, &thread_args[bits]);
+ } else {
+ /* clear */
+ thread_args[bits].type.u32[1] = ~(pattern[i]);
+ pthread_create(&thread[bits], NULL,
+ thread2_proc, &thread_args[bits]);
+ }
+ pat >>= 1;
+ chk_bit <<= 1;
+ }
+
+ for (bits = 0; bits < EVENT_FLAG_SIZE ; bits++)
+ pthread_join(thread[bits], NULL);
+
+ pthread_barrier_destroy(&barrier);
+
+ /* check event flag */
+ task_args.type.u64[0] = host_to_mpu[i];
+ task_args.type.u64[1] = (uint64_t)pattern[i];
+ ret = mars_task_schedule(&task_id, &task_args, 0);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+
+ ret = mars_task_wait(&task_id, &exit_code);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+ MARS_TEST_ASSERT_ERROR(exit_code, MARS_SUCCESS);
+
+ ret = mars_task_destroy(&task_id);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+
+ ret = mars_task_event_flag_destroy(host_to_mpu[i]);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+ }
+
+ ret = mars_context_destroy(mars_ctx);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+
+ return 0;
+}
+
diff --git a/tests/TFP/TFP_34_006/mpu.c b/tests/TFP/TFP_34_006/mpu.c
new file mode 100644
index 0000000..8d724bd
--- /dev/null
+++ b/tests/TFP/TFP_34_006/mpu.c
@@ -0,0 +1,51 @@
+/*
+ * Copyright 2008 Sony Corporation
+ *
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a copy
+ * of this software and associated documentation files (the "Software"), to deal
+ * in the Software without restriction, including without limitation the rights
+ * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+ * copies of the Software, and to permit persons to whom the Software is
+ * furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included in
+ * all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+ * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+ * THE SOFTWARE.
+ */
+
+#include <mars/mars.h>
+#include <mars_task_test.h>
+
+#define EVENT_FLAG_SIZE 32
+
+int mars_task_main(const struct mars_task_args *task_args)
+{
+ int ret, i;
+ uint64_t host_to_mpu_ea = task_args->type.u64[0];
+ uint32_t pat = (uint32_t)task_args->type.u64[1];
+ uint32_t chk_bit;
+
+ chk_bit = 0x01;
+ for (i = 0; i < EVENT_FLAG_SIZE; i++, pat >>= 1) {
+ ret = mars_task_event_flag_try_wait(
+ host_to_mpu_ea,
+ chk_bit,
+ MARS_TASK_EVENT_FLAG_MASK_AND, NULL);
+ if (pat & 0x01)
+ /* if chk_bit is set, try_wait returns SUCCESS */
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+ else
+ /* if chk_bit is cleared, try_wait returns BUSY */
+ MARS_TEST_ASSERT_ERROR(ret, MARS_ERROR_BUSY);
+ chk_bit <<= 1;
+ }
+ return 0;
+}
diff --git a/tests/TFP/TFP_34_007/Makefile b/tests/TFP/TFP_34_007/Makefile
new file mode 100644
index 0000000..72cf999
--- /dev/null
+++ b/tests/TFP/TFP_34_007/Makefile
@@ -0,0 +1,28 @@
+#
+# Copyright 2008 Sony Corporation
+#
+#
+# Permission is hereby granted, free of charge, to any person obtaining a copy
+# of this software and associated documentation files (the "Software"), to deal
+# in the Software without restriction, including without limitation the rights
+# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+# copies of the Software, and to permit persons to whom the Software is
+# furnished to do so, subject to the following conditions:
+#
+# The above copyright notice and this permission notice shall be included in
+# all copies or substantial portions of the Software.
+#
+# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+# THE SOFTWARE.
+#
+
+top_srcdir = ../..
+test_objs = host.o mpu1.task_eo mpu2.task_eo mpu3.task_eo
+
+include $(top_srcdir)/scripts/config.mk
+include $(top_srcdir)/scripts/rules_item.mk
diff --git a/tests/TFP/TFP_34_007/host.c b/tests/TFP/TFP_34_007/host.c
new file mode 100644
index 0000000..d91e435
--- /dev/null
+++ b/tests/TFP/TFP_34_007/host.c
@@ -0,0 +1,247 @@
+/*
+ * Copyright 2008 Sony Corporation
+ *
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a copy
+ * of this software and associated documentation files (the "Software"), to deal
+ * in the Software without restriction, including without limitation the rights
+ * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+ * copies of the Software, and to permit persons to whom the Software is
+ * furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included in
+ * all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+ * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+ * THE SOFTWARE.
+ */
+
+#include <unistd.h>
+#include <mars/mars.h>
+#include <libspe2.h>
+#include <mars_test.h>
+
+#define EVENT_FLAG_SIZE 32
+
+extern spe_program_handle_t mpu1_prog;
+extern spe_program_handle_t mpu2_prog;
+extern spe_program_handle_t mpu3_prog;
+#define DEFAULT_PATTERN 0xA5A5C3C3UL
+#define NUM_PATTERNS 5
+static uint32_t pattern[] = {
+ 0x00000001UL,
+ 0x0000CAFEUL,
+ 0x10203040UL,
+ 0x5A5A5A5AUL,
+ 0xFFFFFFFFUL
+};
+static struct mars_context *mars_ctx;
+static struct mars_task_id task3_id, task_id[EVENT_FLAG_SIZE];
+static struct mars_task_args task3_args, task_args[EVENT_FLAG_SIZE];
+static uint64_t mpu_to_host[NUM_PATTERNS];
+static uint32_t notify[32] __attribute((aligned(128)));
+
+static void check_flag(uint32_t id, uint32_t pat)
+{
+ int ret, i;
+ uint32_t chk_bit;
+
+ chk_bit = 0x01;
+ for (i = 0; i < EVENT_FLAG_SIZE; i++, pat >>= 1) {
+ ret = mars_task_event_flag_try_wait(
+ mpu_to_host[id],
+ chk_bit,
+ MARS_TASK_EVENT_FLAG_MASK_AND, NULL);
+ if (pat & 0x01)
+ /* if chk_bit is set, try_wait returns SCCESS */
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+ else
+ /* if chk_bit is cleared, try_wait returns BUSY */
+ MARS_TEST_ASSERT_ERROR(ret, MARS_ERROR_BUSY);
+ chk_bit <<= 1;
+ }
+}
+
+int main(void)
+{
+ int ret, i, bits;
+ int32_t exit_code;
+ uint32_t chk_bit, pat;
+
+ ret = mars_context_create(&mars_ctx, 0, 0);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+
+ /* set/clear bit one by one */
+ for (i = 0; i < NUM_PATTERNS; i++) {
+ notify[0] = 0;
+
+ ret = mars_task_event_flag_create(
+ mars_ctx,
+ &mpu_to_host[i],
+ MARS_TASK_EVENT_FLAG_MPU_TO_HOST,
+ MARS_TASK_EVENT_FLAG_CLEAR_AUTO);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+
+ /* set event flag to DEFAULT_PATTERN */
+ ret = mars_task_create(mars_ctx, &task3_id, NULL,
+ mpu3_prog.elf_image,
+ MARS_TASK_CONTEXT_SAVE_ALL);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+
+ task3_args.type.u64[0] = mpu_to_host[i];
+ task3_args.type.u64[1] = (uint64_t)DEFAULT_PATTERN;
+ ret = mars_task_schedule(&task3_id, &task3_args, 0);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+
+ ret = mars_task_wait(&task3_id, &exit_code);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+ MARS_TEST_ASSERT_ERROR(exit_code, MARS_SUCCESS);
+
+ ret = mars_task_destroy(&task3_id);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+
+ /* create mpu tasks */
+ chk_bit = 0x01;
+ pat = pattern[i];
+ for (bits = 0; bits < EVENT_FLAG_SIZE; bits++) {
+ if (pat & 0x01) {
+ /* set task */
+ ret = mars_task_create(mars_ctx, &task_id[bits],
+ NULL, mpu1_prog.elf_image,
+ MARS_TASK_CONTEXT_SAVE_ALL);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+ } else {
+ /* clear task */
+ ret = mars_task_create(mars_ctx, &task_id[bits],
+ NULL, mpu2_prog.elf_image,
+ MARS_TASK_CONTEXT_SAVE_ALL);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+ }
+
+ task_args[bits].type.u64[0] = mpu_to_host[i];
+ task_args[bits].type.u64[1] = (uint64_t)chk_bit;
+ task_args[bits].type.u64[2] =
+ mars_ptr_to_ea(&notify);
+
+ ret = mars_task_schedule(&task_id[bits],
+ &task_args[bits], 0);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+ pat >>= 1;
+ chk_bit <<= 1;
+ }
+
+ sleep(1);
+ /* start mpu tasks at the same time */
+ mars_test_counter_set(&notify[0], 1);
+
+ for (bits = 0; bits < EVENT_FLAG_SIZE; bits++) {
+ ret = mars_task_wait(&task_id[bits], &exit_code);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+ MARS_TEST_ASSERT_ERROR(exit_code, MARS_SUCCESS);
+ }
+
+ /* check event flag */
+ check_flag(i, pattern[i]);
+
+ for (bits = 0; bits < EVENT_FLAG_SIZE; bits++) {
+ ret = mars_task_destroy(&task_id[bits]);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+ }
+ ret = mars_task_event_flag_destroy(mpu_to_host[i]);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+ }
+ /* set/clear same bits by multi task */
+ for (i = 0; i < NUM_PATTERNS; i++) {
+ notify[0] = 0;
+
+ ret = mars_task_event_flag_create(
+ mars_ctx,
+ &mpu_to_host[i],
+ MARS_TASK_EVENT_FLAG_MPU_TO_HOST,
+ MARS_TASK_EVENT_FLAG_CLEAR_AUTO);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+
+ /* set event flag to DEFAULT_PATTERN */
+ ret = mars_task_create(mars_ctx, &task3_id, NULL,
+ mpu3_prog.elf_image,
+ MARS_TASK_CONTEXT_SAVE_ALL);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+
+ task3_args.type.u64[0] = mpu_to_host[i];
+ task3_args.type.u64[1] = (uint64_t)DEFAULT_PATTERN;
+ ret = mars_task_schedule(&task3_id, &task3_args, 0);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+
+ ret = mars_task_wait(&task3_id, &exit_code);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+ MARS_TEST_ASSERT_ERROR(exit_code, MARS_SUCCESS);
+
+ ret = mars_task_destroy(&task3_id);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+
+ /* create mpu tasks */
+ chk_bit = 0x01;
+ pat = pattern[i];
+ for (bits = 0; bits < EVENT_FLAG_SIZE; bits++) {
+ if (pat & 0x01) {
+ /* set task */
+ ret = mars_task_create(mars_ctx, &task_id[bits],
+ NULL, mpu1_prog.elf_image,
+ MARS_TASK_CONTEXT_SAVE_ALL);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+
+ task_args[bits].type.u64[1] =
+ (uint64_t)pattern[i];
+ } else {
+ /* clear task */
+ ret = mars_task_create(mars_ctx, &task_id[bits],
+ NULL, mpu2_prog.elf_image,
+ MARS_TASK_CONTEXT_SAVE_ALL);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+ task_args[bits].type.u64[1] =
+ (uint64_t)(uint32_t)~(pattern[i]);
+ }
+
+ task_args[bits].type.u64[0] = mpu_to_host[i];
+ task_args[bits].type.u64[2] =
+ mars_ptr_to_ea(&notify);
+
+ ret = mars_task_schedule(&task_id[bits],
+ &task_args[bits], 0);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+ pat >>= 1;
+ chk_bit <<= 1;
+ }
+
+ sleep(1);
+ /* start mpu tasks at the same time */
+ mars_test_counter_set(&notify[0], 1);
+
+ for (bits = 0; bits < EVENT_FLAG_SIZE; bits++) {
+ ret = mars_task_wait(&task_id[bits], &exit_code);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+ MARS_TEST_ASSERT_ERROR(exit_code, MARS_SUCCESS);
+ }
+
+ /* check event flag */
+ check_flag(i, pattern[i]);
+
+ for (bits = 0; bits < EVENT_FLAG_SIZE; bits++) {
+ ret = mars_task_destroy(&task_id[bits]);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+ }
+ ret = mars_task_event_flag_destroy(mpu_to_host[i]);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+ }
+
+ ret = mars_context_destroy(mars_ctx);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+
+ return 0;
+}
+
diff --git a/tests/TFP/TFP_34_007/mpu1.c b/tests/TFP/TFP_34_007/mpu1.c
new file mode 100644
index 0000000..37cbd0b
--- /dev/null
+++ b/tests/TFP/TFP_34_007/mpu1.c
@@ -0,0 +1,41 @@
+/*
+ * Copyright 2008 Sony Corporation
+ *
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a copy
+ * of this software and associated documentation files (the "Software"), to deal
+ * in the Software without restriction, including without limitation the rights
+ * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+ * copies of the Software, and to permit persons to whom the Software is
+ * furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included in
+ * all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+ * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+ * THE SOFTWARE.
+ */
+
+#include <mars/mars.h>
+#include <mars_task_test.h>
+#include <spu_mfcio.h>
+
+int mars_task_main(const struct mars_task_args *task_args)
+{
+ int ret;
+ uint64_t mpu_to_host_ea = task_args->type.u64[0];
+ uint32_t chk_bit = (uint32_t)task_args->type.u64[1];
+ uint64_t notify_ea = task_args->type.u64[2];
+
+ mars_test_counter_wait(notify_ea, 1);
+
+ ret = mars_task_event_flag_set(mpu_to_host_ea, chk_bit);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+
+ return 0;
+}
diff --git a/tests/TFP/TFP_34_007/mpu2.c b/tests/TFP/TFP_34_007/mpu2.c
new file mode 100644
index 0000000..b7f2d5f
--- /dev/null
+++ b/tests/TFP/TFP_34_007/mpu2.c
@@ -0,0 +1,41 @@
+/*
+ * Copyright 2008 Sony Corporation
+ *
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a copy
+ * of this software and associated documentation files (the "Software"), to deal
+ * in the Software without restriction, including without limitation the rights
+ * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+ * copies of the Software, and to permit persons to whom the Software is
+ * furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included in
+ * all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+ * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+ * THE SOFTWARE.
+ */
+
+#include <mars/mars.h>
+#include <mars_task_test.h>
+#include <spu_mfcio.h>
+
+int mars_task_main(const struct mars_task_args *task_args)
+{
+ int ret;
+ uint64_t mpu_to_host_ea = task_args->type.u64[0];
+ uint32_t chk_bit = (uint32_t)task_args->type.u64[1];
+ uint64_t notify_ea = task_args->type.u64[2];
+
+ mars_test_counter_wait(notify_ea, 1);
+
+ ret = mars_task_event_flag_clear(mpu_to_host_ea, chk_bit);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+
+ return 0;
+}
diff --git a/tests/TFP/TFP_34_007/mpu3.c b/tests/TFP/TFP_34_007/mpu3.c
new file mode 100644
index 0000000..70b5689
--- /dev/null
+++ b/tests/TFP/TFP_34_007/mpu3.c
@@ -0,0 +1,38 @@
+/*
+ * Copyright 2008 Sony Corporation
+ *
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a copy
+ * of this software and associated documentation files (the "Software"), to deal
+ * in the Software without restriction, including without limitation the rights
+ * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+ * copies of the Software, and to permit persons to whom the Software is
+ * furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included in
+ * all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+ * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+ * THE SOFTWARE.
+ */
+
+#include <mars/mars.h>
+#include <mars_task_test.h>
+#include <spu_mfcio.h>
+
+int mars_task_main(const struct mars_task_args *task_args)
+{
+ int ret;
+ uint64_t mpu_to_host_ea = task_args->type.u64[0];
+ uint32_t chk_bits = (uint32_t)task_args->type.u64[1];
+
+ ret = mars_task_event_flag_set(mpu_to_host_ea, chk_bits);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+
+ return 0;
+}
diff --git a/tests/TFP/TFP_35_001/Makefile b/tests/TFP/TFP_35_001/Makefile
new file mode 100644
index 0000000..432135a
--- /dev/null
+++ b/tests/TFP/TFP_35_001/Makefile
@@ -0,0 +1,28 @@
+#
+# Copyright 2008 Sony Corporation
+#
+#
+# Permission is hereby granted, free of charge, to any person obtaining a copy
+# of this software and associated documentation files (the "Software"), to deal
+# in the Software without restriction, including without limitation the rights
+# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+# copies of the Software, and to permit persons to whom the Software is
+# furnished to do so, subject to the following conditions:
+#
+# The above copyright notice and this permission notice shall be included in
+# all copies or substantial portions of the Software.
+#
+# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+# THE SOFTWARE.
+#
+
+top_srcdir = ../..
+test_objs = host.o mpu.task_eo
+
+include $(top_srcdir)/scripts/config.mk
+include $(top_srcdir)/scripts/rules_item.mk
diff --git a/tests/TFP/TFP_35_001/host.c b/tests/TFP/TFP_35_001/host.c
new file mode 100644
index 0000000..7d2dc73
--- /dev/null
+++ b/tests/TFP/TFP_35_001/host.c
@@ -0,0 +1,103 @@
+/*
+ * Copyright 2008 Sony Corporation
+ *
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a copy
+ * of this software and associated documentation files (the "Software"), to deal
+ * in the Software without restriction, including without limitation the rights
+ * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+ * copies of the Software, and to permit persons to whom the Software is
+ * furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included in
+ * all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+ * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+ * THE SOFTWARE.
+ */
+
+#include <unistd.h>
+#include <mars/mars.h>
+#include <libspe2.h>
+#include <mars_test.h>
+
+extern spe_program_handle_t mpu_prog;
+#define NUM_PATTERNS 3
+static uint32_t pattern[NUM_PATTERNS][2] = {
+ { 8, 0x000000FFUL },
+ { 16, 0x0000FFFFUL },
+ { 32, 0xFFFFFFFFUL }
+};
+static struct mars_context *mars_ctx;
+static struct mars_task_id task_id;
+static struct mars_task_args task_args;
+static uint64_t host_to_mpu[NUM_PATTERNS];
+static uint32_t shared_resource __attribute__((aligned(16)));
+
+int main(void)
+{
+ int ret, i, bits;
+ uint32_t chk_bit;
+ int32_t exit_code;
+
+ ret = mars_context_create(&mars_ctx, 0, 0);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+
+ for (i = 0; i < NUM_PATTERNS; i++) {
+ shared_resource = 0;
+ ret = mars_task_event_flag_create(
+ mars_ctx,
+ &host_to_mpu[i],
+ MARS_TASK_EVENT_FLAG_HOST_TO_MPU,
+ MARS_TASK_EVENT_FLAG_CLEAR_AUTO);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+
+ ret = mars_task_create(mars_ctx, &task_id, NULL,
+ mpu_prog.elf_image, MARS_TASK_CONTEXT_SAVE_ALL);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+
+ task_args.type.u64[0] = host_to_mpu[i];
+ task_args.type.u64[1] = (uint64_t)pattern[i][1];
+ task_args.type.u64[2] = mars_ptr_to_ea(&shared_resource);
+ ret = mars_task_schedule(&task_id, &task_args, 0);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+
+ chk_bit = 0x01;
+ for (bits = 0; bits < pattern[i][0] - 1; bits++) {
+ ret = mars_task_event_flag_set(
+ host_to_mpu[i], chk_bit);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+ chk_bit <<= 1;
+ }
+ sleep(1);
+ /* check if mpu task doesn't returen MARS_SUCCESS */
+ MARS_TEST_ASSERT_EQUAL(shared_resource, 0);
+
+ /* set last one bit */
+ ret = mars_task_event_flag_set(
+ host_to_mpu[i], chk_bit);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+
+ ret = mars_task_wait(&task_id, &exit_code);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+ MARS_TEST_ASSERT_ERROR(exit_code, MARS_SUCCESS);
+
+ ret = mars_task_destroy(&task_id);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+
+ ret = mars_task_event_flag_destroy(host_to_mpu[i]);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+ }
+
+
+ ret = mars_context_destroy(mars_ctx);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+
+ return 0;
+}
+
diff --git a/tests/TFP/TFP_35_001/mpu.c b/tests/TFP/TFP_35_001/mpu.c
new file mode 100644
index 0000000..b0a40e2
--- /dev/null
+++ b/tests/TFP/TFP_35_001/mpu.c
@@ -0,0 +1,51 @@
+/*
+ * Copyright 2008 Sony Corporation
+ *
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a copy
+ * of this software and associated documentation files (the "Software"), to deal
+ * in the Software without restriction, including without limitation the rights
+ * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+ * copies of the Software, and to permit persons to whom the Software is
+ * furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included in
+ * all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+ * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+ * THE SOFTWARE.
+ */
+
+#include <mars/mars.h>
+#include <mars_task_test.h>
+#include <spu_mfcio.h>
+
+static uint32_t shared_resource __attribute((aligned(16)));
+
+int mars_task_main(const struct mars_task_args *task_args)
+{
+ int ret;
+ uint64_t host_to_mpu_ea = task_args->type.u64[0];
+ uint32_t chk_bit = (uint32_t)task_args->type.u64[1];
+ uint64_t shared_resource_ea = task_args->type.u64[2];
+
+ ret = mars_task_event_flag_wait(
+ host_to_mpu_ea,
+ chk_bit,
+ MARS_TASK_EVENT_FLAG_MASK_AND, NULL);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+
+ /* if program reaches here, shared_resource'll be updated */
+ shared_resource = 1;
+ mfc_put(&shared_resource, shared_resource_ea,
+ sizeof(uint32_t), 0, 0, 0);
+ mfc_write_tag_mask(1 << 0);
+ mfc_read_tag_status_all();
+
+ return 0;
+}
diff --git a/tests/TFP/TFP_35_002/Makefile b/tests/TFP/TFP_35_002/Makefile
new file mode 100644
index 0000000..432135a
--- /dev/null
+++ b/tests/TFP/TFP_35_002/Makefile
@@ -0,0 +1,28 @@
+#
+# Copyright 2008 Sony Corporation
+#
+#
+# Permission is hereby granted, free of charge, to any person obtaining a copy
+# of this software and associated documentation files (the "Software"), to deal
+# in the Software without restriction, including without limitation the rights
+# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+# copies of the Software, and to permit persons to whom the Software is
+# furnished to do so, subject to the following conditions:
+#
+# The above copyright notice and this permission notice shall be included in
+# all copies or substantial portions of the Software.
+#
+# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+# THE SOFTWARE.
+#
+
+top_srcdir = ../..
+test_objs = host.o mpu.task_eo
+
+include $(top_srcdir)/scripts/config.mk
+include $(top_srcdir)/scripts/rules_item.mk
diff --git a/tests/TFP/TFP_35_002/host.c b/tests/TFP/TFP_35_002/host.c
new file mode 100644
index 0000000..853eae2
--- /dev/null
+++ b/tests/TFP/TFP_35_002/host.c
@@ -0,0 +1,125 @@
+/*
+ * Copyright 2008 Sony Corporation
+ *
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a copy
+ * of this software and associated documentation files (the "Software"), to deal
+ * in the Software without restriction, including without limitation the rights
+ * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+ * copies of the Software, and to permit persons to whom the Software is
+ * furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included in
+ * all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+ * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+ * THE SOFTWARE.
+ */
+
+#include <pthread.h>
+#include <mars/mars.h>
+#include <libspe2.h>
+#include <mars_test.h>
+
+#define EVENT_FLAG_SIZE 32
+
+extern spe_program_handle_t mpu_prog;
+#define NUM_PATTERNS 3
+static uint32_t pattern[NUM_PATTERNS][2] = {
+ { 8, 0x000000FFUL },
+ { 16, 0x0000FFFFUL },
+ { 32, 0xFFFFFFFFUL }
+};
+static struct mars_context *mars_ctx;
+static struct mars_task_id task_id[EVENT_FLAG_SIZE];
+static struct mars_task_args task_args, thread_args[NUM_PATTERNS];
+static uint64_t mpu_to_host[NUM_PATTERNS];
+static pthread_t thread[NUM_PATTERNS];
+static uint32_t shared_resource __attribute((aligned(16)));
+
+static void *thread_proc(void *ptr)
+{
+ int ret;
+ struct mars_task_args *task_args = (struct mars_task_args *)ptr;
+ uint32_t i = (uint32_t)task_args->type.u32[0];
+ uint32_t chk_bit = task_args->type.u32[1];
+
+ ret = mars_task_event_flag_wait(
+ mpu_to_host[i],
+ chk_bit,
+ MARS_TASK_EVENT_FLAG_MASK_AND, NULL);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+
+ /* if program reaches here, shared_resource'll be updated */
+ shared_resource = 1;
+
+ return NULL;
+}
+
+int main(void)
+{
+ int ret, i, bits;
+ uint32_t chk_bit;
+ int32_t exit_code;
+
+ ret = mars_context_create(&mars_ctx, 0, 0);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+
+ for (i = 0; i < NUM_PATTERNS; i++) {
+ shared_resource = 0;
+ ret = mars_task_event_flag_create(
+ mars_ctx,
+ &mpu_to_host[i],
+ MARS_TASK_EVENT_FLAG_MPU_TO_HOST,
+ MARS_TASK_EVENT_FLAG_CLEAR_AUTO);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+
+ thread_args[i].type.u32[0] = (uint32_t)i;
+ thread_args[i].type.u32[1] = pattern[i][1];
+ pthread_create(&thread[i], NULL,
+ thread_proc, &thread_args[i]);
+
+ chk_bit = 0x01;
+ for (bits = 0; bits < pattern[i][0]; bits++) {
+ ret = mars_task_create(mars_ctx, &task_id[bits], NULL,
+ mpu_prog.elf_image,
+ MARS_TASK_CONTEXT_SAVE_ALL);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+
+ /* mpu tasks will set event_flags */
+ task_args.type.u64[0] = mpu_to_host[i];
+ task_args.type.u64[1] = (uint64_t)chk_bit;
+ ret = mars_task_schedule(&task_id[bits], &task_args, 0);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+
+ ret = mars_task_wait(&task_id[bits], &exit_code);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+ MARS_TEST_ASSERT_ERROR(exit_code, MARS_SUCCESS);
+
+ ret = mars_task_destroy(&task_id[bits]);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+
+ /* check if flag_wait doesn't return */
+ if (bits != (pattern[i][0] - 1))
+ MARS_TEST_ASSERT_EQUAL(shared_resource, 0);
+
+ chk_bit <<= 1;
+ }
+
+ pthread_join(thread[i], NULL);
+
+ ret = mars_task_event_flag_destroy(mpu_to_host[i]);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+ }
+
+ ret = mars_context_destroy(mars_ctx);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+
+ return 0;
+}
+
diff --git a/tests/TFP/TFP_35_002/mpu.c b/tests/TFP/TFP_35_002/mpu.c
new file mode 100644
index 0000000..4fdbceb
--- /dev/null
+++ b/tests/TFP/TFP_35_002/mpu.c
@@ -0,0 +1,37 @@
+/*
+ * Copyright 2008 Sony Corporation
+ *
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a copy
+ * of this software and associated documentation files (the "Software"), to deal
+ * in the Software without restriction, including without limitation the rights
+ * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+ * copies of the Software, and to permit persons to whom the Software is
+ * furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included in
+ * all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+ * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+ * THE SOFTWARE.
+ */
+
+#include <mars/mars.h>
+#include <mars_task_test.h>
+
+int mars_task_main(const struct mars_task_args *task_args)
+{
+ int ret;
+ uint64_t mpu_to_host_ea = task_args->type.u64[0];
+ uint32_t chk_bit = (uint32_t)task_args->type.u64[1];
+
+ ret = mars_task_event_flag_set(mpu_to_host_ea, chk_bit);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+
+ return 0;
+}
diff --git a/tests/TFP/TFP_35_003/Makefile b/tests/TFP/TFP_35_003/Makefile
new file mode 100644
index 0000000..ecbce33
--- /dev/null
+++ b/tests/TFP/TFP_35_003/Makefile
@@ -0,0 +1,28 @@
+#
+# Copyright 2008 Sony Corporation
+#
+#
+# Permission is hereby granted, free of charge, to any person obtaining a copy
+# of this software and associated documentation files (the "Software"), to deal
+# in the Software without restriction, including without limitation the rights
+# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+# copies of the Software, and to permit persons to whom the Software is
+# furnished to do so, subject to the following conditions:
+#
+# The above copyright notice and this permission notice shall be included in
+# all copies or substantial portions of the Software.
+#
+# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+# THE SOFTWARE.
+#
+
+top_srcdir = ../..
+test_objs = host.o mpu1.task_eo mpu2.task_eo
+
+include $(top_srcdir)/scripts/config.mk
+include $(top_srcdir)/scripts/rules_item.mk
diff --git a/tests/TFP/TFP_35_003/host.c b/tests/TFP/TFP_35_003/host.c
new file mode 100644
index 0000000..7e22075
--- /dev/null
+++ b/tests/TFP/TFP_35_003/host.c
@@ -0,0 +1,115 @@
+/*
+ * Copyright 2008 Sony Corporation
+ *
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a copy
+ * of this software and associated documentation files (the "Software"), to deal
+ * in the Software without restriction, including without limitation the rights
+ * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+ * copies of the Software, and to permit persons to whom the Software is
+ * furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included in
+ * all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+ * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+ * THE SOFTWARE.
+ */
+
+#include <unistd.h>
+#include <mars/mars.h>
+#include <libspe2.h>
+#include <mars_test.h>
+
+extern spe_program_handle_t mpu1_prog;
+extern spe_program_handle_t mpu2_prog;
+#define NUM_PATTERNS 3
+static uint32_t pattern[NUM_PATTERNS][2] = {
+ { 8, 0x000000FFUL },
+ { 16, 0x0000FFFFUL },
+ { 32, 0xFFFFFFFFUL }
+};
+static struct mars_context *mars_ctx;
+static struct mars_task_id task1_id, task2_id;
+static struct mars_task_args task1_args, task2_args;
+static uint64_t mpu_to_mpu[NUM_PATTERNS];
+static uint32_t shared_resource __attribute__((aligned(16)));
+
+int main(void)
+{
+ int ret, i, bits;
+ uint32_t chk_bit;
+ int32_t exit_code;
+
+ ret = mars_context_create(&mars_ctx, 0, 0);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+
+ for (i = 0; i < NUM_PATTERNS; i++) {
+ shared_resource = 0;
+ ret = mars_task_event_flag_create(
+ mars_ctx,
+ &mpu_to_mpu[i],
+ MARS_TASK_EVENT_FLAG_MPU_TO_MPU,
+ MARS_TASK_EVENT_FLAG_CLEAR_AUTO);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+
+ ret = mars_task_create(mars_ctx, &task1_id, NULL,
+ mpu1_prog.elf_image, MARS_TASK_CONTEXT_SAVE_ALL);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+
+ task1_args.type.u64[0] = mpu_to_mpu[i];
+ task1_args.type.u64[1] = (uint64_t)pattern[i][1];
+ task1_args.type.u64[2] = mars_ptr_to_ea(&shared_resource);
+ ret = mars_task_schedule(&task1_id, &task1_args, 0);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+
+ chk_bit = 0x01;
+ for (bits = 0; bits < pattern[i][0]; bits++) {
+ ret = mars_task_create(mars_ctx, &task2_id, NULL,
+ mpu2_prog.elf_image,
+ MARS_TASK_CONTEXT_SAVE_ALL);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+
+ /* mpu tasks will set event_flags */
+ task2_args.type.u64[0] = mpu_to_mpu[i];
+ task2_args.type.u64[1] = (uint64_t)chk_bit;
+ ret = mars_task_schedule(&task2_id, &task2_args, 0);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+
+ ret = mars_task_wait(&task2_id, &exit_code);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+ MARS_TEST_ASSERT_ERROR(exit_code, MARS_SUCCESS);
+
+ ret = mars_task_destroy(&task2_id);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+
+ /* check if flag_wait is blockking */
+ if (bits != (pattern[i][0] - 1))
+ MARS_TEST_ASSERT_EQUAL(shared_resource, 0);
+
+ chk_bit <<= 1;
+ }
+
+ /* check if wait task is finished */
+ ret = mars_task_wait(&task1_id, &exit_code);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+ MARS_TEST_ASSERT_ERROR(exit_code, MARS_SUCCESS);
+
+ ret = mars_task_destroy(&task1_id);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+
+ ret = mars_task_event_flag_destroy(mpu_to_mpu[i]);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+ }
+
+ ret = mars_context_destroy(mars_ctx);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+
+ return 0;
+}
+
diff --git a/tests/TFP/TFP_35_003/mpu1.c b/tests/TFP/TFP_35_003/mpu1.c
new file mode 100644
index 0000000..a122784
--- /dev/null
+++ b/tests/TFP/TFP_35_003/mpu1.c
@@ -0,0 +1,51 @@
+/*
+ * Copyright 2008 Sony Corporation
+ *
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a copy
+ * of this software and associated documentation files (the "Software"), to deal
+ * in the Software without restriction, including without limitation the rights
+ * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+ * copies of the Software, and to permit persons to whom the Software is
+ * furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included in
+ * all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+ * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+ * THE SOFTWARE.
+ */
+
+#include <mars/mars.h>
+#include <mars_task_test.h>
+#include <spu_mfcio.h>
+
+static uint32_t shared_resource __attribute((aligned(16)));
+
+int mars_task_main(const struct mars_task_args *task_args)
+{
+ int ret;
+ uint64_t mpu_to_mpu_ea = task_args->type.u64[0];
+ uint32_t chk_bit = (uint32_t)task_args->type.u64[1];
+ uint64_t shared_resource_ea = task_args->type.u64[2];
+
+ ret = mars_task_event_flag_wait(
+ mpu_to_mpu_ea,
+ chk_bit,
+ MARS_TASK_EVENT_FLAG_MASK_AND, NULL);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+
+ /* if program reaches here, shared_resource'll be updated */
+ shared_resource = 1;
+ mfc_put(&shared_resource, shared_resource_ea,
+ sizeof(uint32_t), 0, 0, 0);
+ mfc_write_tag_mask(1 << 0);
+ mfc_read_tag_status_all();
+
+ return 0;
+}
diff --git a/tests/TFP/TFP_35_003/mpu2.c b/tests/TFP/TFP_35_003/mpu2.c
new file mode 100644
index 0000000..65f3252
--- /dev/null
+++ b/tests/TFP/TFP_35_003/mpu2.c
@@ -0,0 +1,37 @@
+/*
+ * Copyright 2008 Sony Corporation
+ *
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a copy
+ * of this software and associated documentation files (the "Software"), to deal
+ * in the Software without restriction, including without limitation the rights
+ * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+ * copies of the Software, and to permit persons to whom the Software is
+ * furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included in
+ * all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+ * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+ * THE SOFTWARE.
+ */
+
+#include <mars/mars.h>
+#include <mars_task_test.h>
+
+int mars_task_main(const struct mars_task_args *task_args)
+{
+ int ret;
+ uint64_t mpu_to_mpu_ea = task_args->type.u64[0];
+ uint32_t chk_bit = (uint32_t)task_args->type.u64[1];
+
+ ret = mars_task_event_flag_set(mpu_to_mpu_ea, chk_bit);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+
+ return 0;
+}
diff --git a/tests/TFP/TFP_35_004/Makefile b/tests/TFP/TFP_35_004/Makefile
new file mode 100644
index 0000000..432135a
--- /dev/null
+++ b/tests/TFP/TFP_35_004/Makefile
@@ -0,0 +1,28 @@
+#
+# Copyright 2008 Sony Corporation
+#
+#
+# Permission is hereby granted, free of charge, to any person obtaining a copy
+# of this software and associated documentation files (the "Software"), to deal
+# in the Software without restriction, including without limitation the rights
+# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+# copies of the Software, and to permit persons to whom the Software is
+# furnished to do so, subject to the following conditions:
+#
+# The above copyright notice and this permission notice shall be included in
+# all copies or substantial portions of the Software.
+#
+# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+# THE SOFTWARE.
+#
+
+top_srcdir = ../..
+test_objs = host.o mpu.task_eo
+
+include $(top_srcdir)/scripts/config.mk
+include $(top_srcdir)/scripts/rules_item.mk
diff --git a/tests/TFP/TFP_35_004/host.c b/tests/TFP/TFP_35_004/host.c
new file mode 100644
index 0000000..f059361
--- /dev/null
+++ b/tests/TFP/TFP_35_004/host.c
@@ -0,0 +1,112 @@
+/*
+ * Copyright 2008 Sony Corporation
+ *
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a copy
+ * of this software and associated documentation files (the "Software"), to deal
+ * in the Software without restriction, including without limitation the rights
+ * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+ * copies of the Software, and to permit persons to whom the Software is
+ * furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included in
+ * all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+ * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+ * THE SOFTWARE.
+ */
+
+#include <unistd.h>
+#include <mars/mars.h>
+#include <libspe2.h>
+#include <mars_test.h>
+
+#define EVENT_FLAG_SIZE 32
+
+extern spe_program_handle_t mpu_prog;
+#define NUM_PATTERNS 3
+static uint32_t pattern[NUM_PATTERNS] = {
+ 0x000000F0UL,
+ 0x0000CAFEUL,
+ 0xFFFFFFFFUL
+};
+static struct mars_context *mars_ctx;
+static struct mars_task_id task_id[NUM_PATTERNS][EVENT_FLAG_SIZE];
+static struct mars_task_args task_args;
+static uint64_t host_to_mpu[NUM_PATTERNS][EVENT_FLAG_SIZE];
+
+int main(void)
+{
+ int ret, i, bits;
+ uint32_t chk_bit, pat;
+ int32_t exit_code;
+
+ ret = mars_context_create(&mars_ctx, 0, 0);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+
+ for (i = 0; i < NUM_PATTERNS; i++) {
+ /* create all wait task */
+ pat = pattern[i];
+ for (bits = 0; pat; bits++, pat >>= 1) {
+ if (!(pat & 0x01))
+ continue;
+ ret = mars_task_event_flag_create(
+ mars_ctx,
+ &host_to_mpu[i][bits],
+ MARS_TASK_EVENT_FLAG_HOST_TO_MPU,
+ MARS_TASK_EVENT_FLAG_CLEAR_AUTO);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+
+ ret = mars_task_create(mars_ctx, &task_id[i][bits],
+ NULL, mpu_prog.elf_image,
+ MARS_TASK_CONTEXT_SAVE_ALL);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+
+ task_args.type.u64[0] = host_to_mpu[i][bits];
+ task_args.type.u64[1] = (uint64_t)pattern[i];
+ ret = mars_task_schedule(&task_id[i][bits],
+ &task_args, 0);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+ }
+
+ sleep(1);
+ chk_bit = 0x01;
+ /* set flags */
+ pat = pattern[i];
+ for (bits = 0; pat; bits++, pat >>= 1, chk_bit <<= 1) {
+ if (!(pat & 0x01))
+ continue;
+ ret = mars_task_event_flag_set(
+ host_to_mpu[i][bits], chk_bit);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+ }
+
+ /* check if all tasks done */
+ pat = pattern[i];
+ for (bits = 0; pat; bits++, pat >>= 1) {
+ if (!(pat & 0x01))
+ continue;
+ ret = mars_task_wait(&task_id[i][bits], &exit_code);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+ MARS_TEST_ASSERT_ERROR(exit_code, MARS_SUCCESS);
+
+ ret = mars_task_destroy(&task_id[i][bits]);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+
+ ret = mars_task_event_flag_destroy(
+ host_to_mpu[i][bits]);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+ }
+ }
+
+ ret = mars_context_destroy(mars_ctx);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+
+ return 0;
+}
+
diff --git a/tests/TFP/TFP_35_004/mpu.c b/tests/TFP/TFP_35_004/mpu.c
new file mode 100644
index 0000000..31da7a7
--- /dev/null
+++ b/tests/TFP/TFP_35_004/mpu.c
@@ -0,0 +1,40 @@
+/*
+ * Copyright 2008 Sony Corporation
+ *
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a copy
+ * of this software and associated documentation files (the "Software"), to deal
+ * in the Software without restriction, including without limitation the rights
+ * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+ * copies of the Software, and to permit persons to whom the Software is
+ * furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included in
+ * all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+ * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+ * THE SOFTWARE.
+ */
+
+#include <mars/mars.h>
+#include <mars_task_test.h>
+
+int mars_task_main(const struct mars_task_args *task_args)
+{
+ int ret;
+ uint64_t host_to_mpu_ea = task_args->type.u64[0];
+ uint32_t chk_bit = (uint32_t)task_args->type.u64[1];
+
+ ret = mars_task_event_flag_wait(
+ host_to_mpu_ea,
+ chk_bit,
+ MARS_TASK_EVENT_FLAG_MASK_OR, NULL);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+
+ return 0;
+}
diff --git a/tests/TFP/TFP_35_005/Makefile b/tests/TFP/TFP_35_005/Makefile
new file mode 100644
index 0000000..432135a
--- /dev/null
+++ b/tests/TFP/TFP_35_005/Makefile
@@ -0,0 +1,28 @@
+#
+# Copyright 2008 Sony Corporation
+#
+#
+# Permission is hereby granted, free of charge, to any person obtaining a copy
+# of this software and associated documentation files (the "Software"), to deal
+# in the Software without restriction, including without limitation the rights
+# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+# copies of the Software, and to permit persons to whom the Software is
+# furnished to do so, subject to the following conditions:
+#
+# The above copyright notice and this permission notice shall be included in
+# all copies or substantial portions of the Software.
+#
+# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+# THE SOFTWARE.
+#
+
+top_srcdir = ../..
+test_objs = host.o mpu.task_eo
+
+include $(top_srcdir)/scripts/config.mk
+include $(top_srcdir)/scripts/rules_item.mk
diff --git a/tests/TFP/TFP_35_005/host.c b/tests/TFP/TFP_35_005/host.c
new file mode 100644
index 0000000..ce76f97
--- /dev/null
+++ b/tests/TFP/TFP_35_005/host.c
@@ -0,0 +1,140 @@
+/*
+ * Copyright 2008 Sony Corporation
+ *
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a copy
+ * of this software and associated documentation files (the "Software"), to deal
+ * in the Software without restriction, including without limitation the rights
+ * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+ * copies of the Software, and to permit persons to whom the Software is
+ * furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included in
+ * all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+ * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+ * THE SOFTWARE.
+ */
+
+#include <unistd.h>
+#include <pthread.h>
+#include <mars/mars.h>
+#include <libspe2.h>
+#include <mars_test.h>
+
+#define EVENT_FLAG_SIZE 32
+
+extern spe_program_handle_t mpu_prog;
+#define NUM_PATTERNS 3
+static uint32_t pattern[NUM_PATTERNS] = {
+ 0x00000001UL,
+ 0x0000CAFEUL,
+ 0xFFFFFFFFUL
+};
+static struct mars_context *mars_ctx;
+static struct mars_task_id task_id[NUM_PATTERNS][EVENT_FLAG_SIZE];
+static struct mars_task_args task_args;
+static struct mars_task_args thread_args[NUM_PATTERNS][EVENT_FLAG_SIZE];
+static uint64_t mpu_to_host[NUM_PATTERNS][EVENT_FLAG_SIZE];
+static pthread_t thread[NUM_PATTERNS][EVENT_FLAG_SIZE];
+
+static void *thread_proc(void *ptr)
+{
+ int ret;
+ struct mars_task_args *task_args = (struct mars_task_args *)ptr;
+ uint32_t i = (uint32_t)task_args->type.u32[0];
+ uint32_t bits = (uint32_t)task_args->type.u32[1];
+ uint32_t chk_bit = task_args->type.u32[2];
+
+ ret = mars_task_event_flag_wait(
+ mpu_to_host[i][bits],
+ chk_bit,
+ MARS_TASK_EVENT_FLAG_MASK_OR, NULL);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+
+ return NULL;
+}
+
+int main(void)
+{
+ int ret, i, bits;
+ uint32_t chk_bit, pat;
+ int32_t exit_code;
+
+ ret = mars_context_create(&mars_ctx, 0, 0);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+
+ for (i = 0; i < NUM_PATTERNS; i++) {
+ /* create wait threads */
+ pat = pattern[i];
+ for (bits = 0; pat ; bits++, pat >>= 1) {
+ if (!(pat & 0x01))
+ continue;
+ ret = mars_task_event_flag_create(
+ mars_ctx,
+ &mpu_to_host[i][bits],
+ MARS_TASK_EVENT_FLAG_MPU_TO_HOST,
+ MARS_TASK_EVENT_FLAG_CLEAR_AUTO);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+
+ thread_args[i][bits].type.u32[0] = (uint32_t)i;
+ thread_args[i][bits].type.u32[1] = (uint32_t)bits;
+ thread_args[i][bits].type.u32[2] = pattern[i];
+ pthread_create(&thread[i][bits], NULL,
+ thread_proc, &thread_args[i][bits]);
+ }
+ sleep(1);
+
+ /* run mpu task */
+ chk_bit = 0x01;
+ pat = pattern[i];
+ for (bits = 0; pat ; bits++, pat >>= 1, chk_bit <<= 1) {
+ if (!(pat & 0x01))
+ continue;
+ ret = mars_task_create(mars_ctx, &task_id[i][bits],
+ NULL,
+ mpu_prog.elf_image,
+ MARS_TASK_CONTEXT_SAVE_ALL);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+
+ /* mpu tasks will set event_flags */
+ task_args.type.u64[0] = mpu_to_host[i][bits];
+ task_args.type.u64[1] = (uint64_t)chk_bit;
+ ret = mars_task_schedule(&task_id[i][bits],
+ &task_args, 0);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+
+ ret = mars_task_wait(&task_id[i][bits], &exit_code);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+ MARS_TEST_ASSERT_ERROR(exit_code, MARS_SUCCESS);
+ }
+ /* check all threads done */
+ pat = pattern[i];
+ for (bits = 0; pat ; bits++, pat >>= 1) {
+ if (pat & 0x01)
+ pthread_join(thread[i][bits], NULL);
+ }
+ pat = pattern[i];
+ for (bits = 0; pat; bits++, pat >>= 1) {
+ if (pat & 0x01) {
+ ret = mars_task_destroy(&task_id[i][bits]);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+
+ ret = mars_task_event_flag_destroy(
+ mpu_to_host[i][bits]);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+ }
+ }
+ }
+
+ ret = mars_context_destroy(mars_ctx);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+
+ return 0;
+}
+
diff --git a/tests/TFP/TFP_35_005/mpu.c b/tests/TFP/TFP_35_005/mpu.c
new file mode 100644
index 0000000..4fdbceb
--- /dev/null
+++ b/tests/TFP/TFP_35_005/mpu.c
@@ -0,0 +1,37 @@
+/*
+ * Copyright 2008 Sony Corporation
+ *
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a copy
+ * of this software and associated documentation files (the "Software"), to deal
+ * in the Software without restriction, including without limitation the rights
+ * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+ * copies of the Software, and to permit persons to whom the Software is
+ * furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included in
+ * all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+ * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+ * THE SOFTWARE.
+ */
+
+#include <mars/mars.h>
+#include <mars_task_test.h>
+
+int mars_task_main(const struct mars_task_args *task_args)
+{
+ int ret;
+ uint64_t mpu_to_host_ea = task_args->type.u64[0];
+ uint32_t chk_bit = (uint32_t)task_args->type.u64[1];
+
+ ret = mars_task_event_flag_set(mpu_to_host_ea, chk_bit);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+
+ return 0;
+}
diff --git a/tests/TFP/TFP_35_006/Makefile b/tests/TFP/TFP_35_006/Makefile
new file mode 100644
index 0000000..ecbce33
--- /dev/null
+++ b/tests/TFP/TFP_35_006/Makefile
@@ -0,0 +1,28 @@
+#
+# Copyright 2008 Sony Corporation
+#
+#
+# Permission is hereby granted, free of charge, to any person obtaining a copy
+# of this software and associated documentation files (the "Software"), to deal
+# in the Software without restriction, including without limitation the rights
+# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+# copies of the Software, and to permit persons to whom the Software is
+# furnished to do so, subject to the following conditions:
+#
+# The above copyright notice and this permission notice shall be included in
+# all copies or substantial portions of the Software.
+#
+# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+# THE SOFTWARE.
+#
+
+top_srcdir = ../..
+test_objs = host.o mpu1.task_eo mpu2.task_eo
+
+include $(top_srcdir)/scripts/config.mk
+include $(top_srcdir)/scripts/rules_item.mk
diff --git a/tests/TFP/TFP_35_006/host.c b/tests/TFP/TFP_35_006/host.c
new file mode 100644
index 0000000..6adf917
--- /dev/null
+++ b/tests/TFP/TFP_35_006/host.c
@@ -0,0 +1,135 @@
+/*
+ * Copyright 2008 Sony Corporation
+ *
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a copy
+ * of this software and associated documentation files (the "Software"), to deal
+ * in the Software without restriction, including without limitation the rights
+ * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+ * copies of the Software, and to permit persons to whom the Software is
+ * furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included in
+ * all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+ * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+ * THE SOFTWARE.
+ */
+
+#include <unistd.h>
+#include <mars/mars.h>
+#include <libspe2.h>
+#include <mars_test.h>
+
+#define EVENT_FLAG_SIZE 32
+
+extern spe_program_handle_t mpu1_prog;
+extern spe_program_handle_t mpu2_prog;
+#define NUM_PATTERNS 3
+static uint32_t pattern[NUM_PATTERNS] = {
+ 0x000000F0UL,
+ 0x0000CAFEUL,
+ 0xFFFFFFFFUL
+};
+static struct mars_context *mars_ctx;
+static struct mars_task_id task1_id[NUM_PATTERNS][EVENT_FLAG_SIZE];
+static struct mars_task_id task2_id[NUM_PATTERNS][EVENT_FLAG_SIZE];
+static struct mars_task_args task1_args, task2_args;
+static uint64_t mpu_to_mpu[NUM_PATTERNS][EVENT_FLAG_SIZE];
+
+int main(void)
+{
+ int ret, i, bits;
+ uint32_t chk_bit, pat;
+ int32_t exit_code;
+
+ ret = mars_context_create(&mars_ctx, 0, 0);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+
+ for (i = 0; i < NUM_PATTERNS; i++) {
+ /* create all wait task */
+ pat = pattern[i];
+ for (bits = 0; pat; bits++, pat >>= 1) {
+ if (!(pat & 0x01))
+ continue;
+ ret = mars_task_event_flag_create(
+ mars_ctx,
+ &mpu_to_mpu[i][bits],
+ MARS_TASK_EVENT_FLAG_MPU_TO_MPU,
+ MARS_TASK_EVENT_FLAG_CLEAR_AUTO);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+
+ ret = mars_task_create(mars_ctx, &task1_id[i][bits],
+ NULL, mpu1_prog.elf_image,
+ MARS_TASK_CONTEXT_SAVE_ALL);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+
+ task1_args.type.u64[0] = mpu_to_mpu[i][bits];
+ task1_args.type.u64[1] = (uint64_t)pattern[i];
+ ret = mars_task_schedule(&task1_id[i][bits],
+ &task1_args, 0);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+ }
+
+ sleep(1);
+ chk_bit = 0x01;
+ /* set flags */
+ pat = pattern[i];
+ for (bits = 0; pat; bits++, pat >>= 1, chk_bit <<= 1) {
+ if (!(pat & 0x01))
+ continue;
+ ret = mars_task_create(mars_ctx, &task2_id[i][bits],
+ NULL,
+ mpu2_prog.elf_image,
+ MARS_TASK_CONTEXT_SAVE_ALL);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+
+ /* mpu tasks will set event_flags */
+ task2_args.type.u64[0] = mpu_to_mpu[i][bits];
+ task2_args.type.u64[1] = (uint64_t)chk_bit;
+ ret = mars_task_schedule(&task2_id[i][bits],
+ &task2_args, 0);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+
+ ret = mars_task_wait(&task2_id[i][bits], &exit_code);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+ MARS_TEST_ASSERT_ERROR(exit_code, MARS_SUCCESS);
+ }
+
+ /* check if all tasks done */
+ pat = pattern[i];
+ for (bits = 0; pat; bits++, pat >>= 1) {
+ if (!(pat & 0x01))
+ continue;
+ ret = mars_task_wait(&task1_id[i][bits], &exit_code);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+ MARS_TEST_ASSERT_ERROR(exit_code, MARS_SUCCESS);
+
+ ret = mars_task_destroy(&task1_id[i][bits]);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+ }
+
+ pat = pattern[i];
+ for (bits = 0; pat; bits++, pat >>= 1) {
+ if (pat & 0x01) {
+ ret = mars_task_destroy(&task2_id[i][bits]);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+
+ ret = mars_task_event_flag_destroy(
+ mpu_to_mpu[i][bits]);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+ }
+ }
+ }
+
+ ret = mars_context_destroy(mars_ctx);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+
+ return 0;
+}
+
diff --git a/tests/TFP/TFP_35_006/mpu1.c b/tests/TFP/TFP_35_006/mpu1.c
new file mode 100644
index 0000000..700150e
--- /dev/null
+++ b/tests/TFP/TFP_35_006/mpu1.c
@@ -0,0 +1,40 @@
+/*
+ * Copyright 2008 Sony Corporation
+ *
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a copy
+ * of this software and associated documentation files (the "Software"), to deal
+ * in the Software without restriction, including without limitation the rights
+ * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+ * copies of the Software, and to permit persons to whom the Software is
+ * furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included in
+ * all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+ * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+ * THE SOFTWARE.
+ */
+
+#include <mars/mars.h>
+#include <mars_task_test.h>
+
+int mars_task_main(const struct mars_task_args *task_args)
+{
+ int ret;
+ uint64_t mpu_to_mpu_ea = task_args->type.u64[0];
+ uint32_t chk_bit = (uint32_t)task_args->type.u64[1];
+
+ ret = mars_task_event_flag_wait(
+ mpu_to_mpu_ea,
+ chk_bit,
+ MARS_TASK_EVENT_FLAG_MASK_OR, NULL);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+
+ return 0;
+}
diff --git a/tests/TFP/TFP_35_006/mpu2.c b/tests/TFP/TFP_35_006/mpu2.c
new file mode 100644
index 0000000..65f3252
--- /dev/null
+++ b/tests/TFP/TFP_35_006/mpu2.c
@@ -0,0 +1,37 @@
+/*
+ * Copyright 2008 Sony Corporation
+ *
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a copy
+ * of this software and associated documentation files (the "Software"), to deal
+ * in the Software without restriction, including without limitation the rights
+ * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+ * copies of the Software, and to permit persons to whom the Software is
+ * furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included in
+ * all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+ * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+ * THE SOFTWARE.
+ */
+
+#include <mars/mars.h>
+#include <mars_task_test.h>
+
+int mars_task_main(const struct mars_task_args *task_args)
+{
+ int ret;
+ uint64_t mpu_to_mpu_ea = task_args->type.u64[0];
+ uint32_t chk_bit = (uint32_t)task_args->type.u64[1];
+
+ ret = mars_task_event_flag_set(mpu_to_mpu_ea, chk_bit);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+
+ return 0;
+}
diff --git a/tests/TFP/TFP_35_007/Makefile b/tests/TFP/TFP_35_007/Makefile
new file mode 100644
index 0000000..ecbce33
--- /dev/null
+++ b/tests/TFP/TFP_35_007/Makefile
@@ -0,0 +1,28 @@
+#
+# Copyright 2008 Sony Corporation
+#
+#
+# Permission is hereby granted, free of charge, to any person obtaining a copy
+# of this software and associated documentation files (the "Software"), to deal
+# in the Software without restriction, including without limitation the rights
+# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+# copies of the Software, and to permit persons to whom the Software is
+# furnished to do so, subject to the following conditions:
+#
+# The above copyright notice and this permission notice shall be included in
+# all copies or substantial portions of the Software.
+#
+# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+# THE SOFTWARE.
+#
+
+top_srcdir = ../..
+test_objs = host.o mpu1.task_eo mpu2.task_eo
+
+include $(top_srcdir)/scripts/config.mk
+include $(top_srcdir)/scripts/rules_item.mk
diff --git a/tests/TFP/TFP_35_007/host.c b/tests/TFP/TFP_35_007/host.c
new file mode 100644
index 0000000..5dabbdc
--- /dev/null
+++ b/tests/TFP/TFP_35_007/host.c
@@ -0,0 +1,143 @@
+/*
+ * Copyright 2008 Sony Corporation
+ *
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a copy
+ * of this software and associated documentation files (the "Software"), to deal
+ * in the Software without restriction, including without limitation the rights
+ * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+ * copies of the Software, and to permit persons to whom the Software is
+ * furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included in
+ * all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+ * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+ * THE SOFTWARE.
+ */
+
+#include <unistd.h>
+#include <mars/mars.h>
+#include <libspe2.h>
+#include <mars_test.h>
+
+#define FLAG_WAIT_USEC 10000 /* 10ms */
+
+#define EVENT_FLAG_SIZE 32
+extern spe_program_handle_t mpu1_prog;
+extern spe_program_handle_t mpu2_prog;
+#define NUM_PATTERNS 3
+static uint32_t pattern[NUM_PATTERNS][2] = {
+/* pattern or chk_bit */
+ { 0x00000001UL, 0x00000001UL },
+ { 0x0000CAFEUL, 0x00008000UL },
+ { 0x10203040UL, 0x10000000UL }
+};
+static struct mars_context *mars_ctx;
+static struct mars_task_id task_id;
+static struct mars_task_args task_args;
+static uint64_t host_to_mpu[NUM_PATTERNS];
+static uint32_t notify[32] __attribute((aligned(128)));
+
+int main(void)
+{
+ int ret, i;
+ int32_t exit_code;
+
+ ret = mars_context_create(&mars_ctx, 0, 0);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+
+ /* wait conditon AND */
+ for (i = 0; i < NUM_PATTERNS; i++) {
+ notify[0] = 0;
+ ret = mars_task_event_flag_create(
+ mars_ctx,
+ &host_to_mpu[i],
+ MARS_TASK_EVENT_FLAG_HOST_TO_MPU,
+ MARS_TASK_EVENT_FLAG_CLEAR_AUTO);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+
+ ret = mars_task_create(mars_ctx, &task_id, NULL,
+ mpu1_prog.elf_image,
+ MARS_TASK_CONTEXT_SAVE_ALL);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+
+ task_args.type.u64[0] = host_to_mpu[i];
+ task_args.type.u64[1] = (uint64_t)pattern[i][0];
+ task_args.type.u64[2] = mars_ptr_to_ea(&notify);
+
+ ret = mars_task_schedule(&task_id, &task_args, 0);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+
+ /* set all bits for and wait condition */
+ ret = mars_task_event_flag_set(host_to_mpu[i], pattern[i][0]);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+ mars_test_counter_set(&notify[0], 1);
+
+ /* wait mars_task_event_flag_wait done */
+ usleep(FLAG_WAIT_USEC);
+ MARS_TEST_ASSERT_EQUAL(notify[0], 2);
+
+ ret = mars_task_wait(&task_id, &exit_code);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+ MARS_TEST_ASSERT_ERROR(exit_code, MARS_SUCCESS);
+
+ ret = mars_task_destroy(&task_id);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+
+ ret = mars_task_event_flag_destroy(host_to_mpu[i]);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+ }
+ /* wait conditon OR */
+ for (i = 0; i < NUM_PATTERNS; i++) {
+ notify[0] = 0;
+ ret = mars_task_event_flag_create(
+ mars_ctx,
+ &host_to_mpu[i],
+ MARS_TASK_EVENT_FLAG_HOST_TO_MPU,
+ MARS_TASK_EVENT_FLAG_CLEAR_AUTO);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+
+ ret = mars_task_create(mars_ctx, &task_id, NULL,
+ mpu2_prog.elf_image,
+ MARS_TASK_CONTEXT_SAVE_ALL);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+
+ task_args.type.u64[0] = host_to_mpu[i];
+ task_args.type.u64[1] = (uint64_t)pattern[i][0];
+ task_args.type.u64[2] = mars_ptr_to_ea(&notify);
+
+ ret = mars_task_schedule(&task_id, &task_args, 0);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+
+ /* set one bits for or wait condition */
+ ret = mars_task_event_flag_set(host_to_mpu[i], pattern[i][1]);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+ mars_test_counter_set(&notify[0], 1);
+
+ /* wait mars_task_event_flag_wait done */
+ usleep(FLAG_WAIT_USEC);
+ MARS_TEST_ASSERT_EQUAL(notify[0], 2);
+
+ ret = mars_task_wait(&task_id, &exit_code);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+ MARS_TEST_ASSERT_ERROR(exit_code, MARS_SUCCESS);
+
+ ret = mars_task_destroy(&task_id);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+
+ ret = mars_task_event_flag_destroy(host_to_mpu[i]);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+ }
+
+ ret = mars_context_destroy(mars_ctx);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+
+ return 0;
+}
+
diff --git a/tests/TFP/TFP_35_007/mpu1.c b/tests/TFP/TFP_35_007/mpu1.c
new file mode 100644
index 0000000..e3c36e8
--- /dev/null
+++ b/tests/TFP/TFP_35_007/mpu1.c
@@ -0,0 +1,46 @@
+/*
+ * Copyright 2008 Sony Corporation
+ *
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a copy
+ * of this software and associated documentation files (the "Software"), to deal
+ * in the Software without restriction, including without limitation the rights
+ * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+ * copies of the Software, and to permit persons to whom the Software is
+ * furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included in
+ * all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+ * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+ * THE SOFTWARE.
+ */
+
+#include <mars/mars.h>
+#include <mars_task_test.h>
+#include <spu_mfcio.h>
+
+int mars_task_main(const struct mars_task_args *task_args)
+{
+ int ret;
+ uint64_t host_to_mpu_ea = task_args->type.u64[0];
+ uint32_t chk_bit = (uint32_t)task_args->type.u64[1];
+ uint64_t notify_ea = task_args->type.u64[2];
+
+ mars_test_counter_wait(notify_ea, 1);
+
+ ret = mars_task_event_flag_wait(
+ host_to_mpu_ea,
+ chk_bit,
+ MARS_TASK_EVENT_FLAG_MASK_AND, NULL);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+
+ mars_test_counter_set(notify_ea, 2);
+
+ return 0;
+}
diff --git a/tests/TFP/TFP_35_007/mpu2.c b/tests/TFP/TFP_35_007/mpu2.c
new file mode 100644
index 0000000..259d93b
--- /dev/null
+++ b/tests/TFP/TFP_35_007/mpu2.c
@@ -0,0 +1,46 @@
+/*
+ * Copyright 2008 Sony Corporation
+ *
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a copy
+ * of this software and associated documentation files (the "Software"), to deal
+ * in the Software without restriction, including without limitation the rights
+ * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+ * copies of the Software, and to permit persons to whom the Software is
+ * furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included in
+ * all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+ * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+ * THE SOFTWARE.
+ */
+
+#include <mars/mars.h>
+#include <mars_task_test.h>
+#include <spu_mfcio.h>
+
+int mars_task_main(const struct mars_task_args *task_args)
+{
+ int ret;
+ uint64_t host_to_mpu_ea = task_args->type.u64[0];
+ uint32_t chk_bit = (uint32_t)task_args->type.u64[1];
+ uint64_t notify_ea = task_args->type.u64[2];
+
+ mars_test_counter_wait(notify_ea, 1);
+
+ ret = mars_task_event_flag_wait(
+ host_to_mpu_ea,
+ chk_bit,
+ MARS_TASK_EVENT_FLAG_MASK_OR, NULL);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+
+ mars_test_counter_set(notify_ea, 2);
+
+ return 0;
+}
diff --git a/tests/TFP/TFP_35_008/Makefile b/tests/TFP/TFP_35_008/Makefile
new file mode 100644
index 0000000..432135a
--- /dev/null
+++ b/tests/TFP/TFP_35_008/Makefile
@@ -0,0 +1,28 @@
+#
+# Copyright 2008 Sony Corporation
+#
+#
+# Permission is hereby granted, free of charge, to any person obtaining a copy
+# of this software and associated documentation files (the "Software"), to deal
+# in the Software without restriction, including without limitation the rights
+# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+# copies of the Software, and to permit persons to whom the Software is
+# furnished to do so, subject to the following conditions:
+#
+# The above copyright notice and this permission notice shall be included in
+# all copies or substantial portions of the Software.
+#
+# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+# THE SOFTWARE.
+#
+
+top_srcdir = ../..
+test_objs = host.o mpu.task_eo
+
+include $(top_srcdir)/scripts/config.mk
+include $(top_srcdir)/scripts/rules_item.mk
diff --git a/tests/TFP/TFP_35_008/host.c b/tests/TFP/TFP_35_008/host.c
new file mode 100644
index 0000000..31357f5
--- /dev/null
+++ b/tests/TFP/TFP_35_008/host.c
@@ -0,0 +1,197 @@
+/*
+ * Copyright 2008 Sony Corporation
+ *
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a copy
+ * of this software and associated documentation files (the "Software"), to deal
+ * in the Software without restriction, including without limitation the rights
+ * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+ * copies of the Software, and to permit persons to whom the Software is
+ * furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included in
+ * all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+ * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+ * THE SOFTWARE.
+ */
+
+#include <pthread.h>
+#include <unistd.h>
+#include <mars/mars.h>
+#include <libspe2.h>
+#include <mars_test.h>
+
+#define FLAG_WAIT_USEC 10000 /* 10ms */
+
+#define EVENT_FLAG_SIZE 32
+
+extern spe_program_handle_t mpu_prog;
+#define NUM_PATTERNS 3
+static uint32_t pattern[NUM_PATTERNS][2] = {
+/* pattern or chk_bit */
+ { 0x00000001UL, 0x00000001UL },
+ { 0x0000CAFEUL, 0x00008000UL },
+ { 0x10203040UL, 0x10000000UL }
+};
+static struct mars_context *mars_ctx;
+static struct mars_task_id task_id;
+static struct mars_task_args task_args, thread_args;
+static uint64_t mpu_to_host[NUM_PATTERNS];
+static uint32_t notify[32] __attribute((aligned(128)));
+
+static pthread_t thread;
+
+static void *thread1_proc(void *ptr)
+{
+ int ret;
+ struct mars_task_args *task_args = (struct mars_task_args *)ptr;
+ uint32_t i = (uint32_t)task_args->type.u32[0];
+ uint32_t chk_bit = task_args->type.u32[1];
+
+ mars_test_counter_wait(&notify[0], 2);
+
+ ret = mars_task_event_flag_wait(
+ mpu_to_host[i],
+ chk_bit,
+ MARS_TASK_EVENT_FLAG_MASK_AND, NULL);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+
+ mars_test_counter_set(&notify[0], 3);
+
+ return NULL;
+}
+static void *thread2_proc(void *ptr)
+{
+ int ret;
+ struct mars_task_args *task_args = (struct mars_task_args *)ptr;
+ uint32_t i = (uint32_t)task_args->type.u32[0];
+ uint32_t chk_bit = task_args->type.u32[1];
+
+ mars_test_counter_wait(&notify[0], 2);
+
+ ret = mars_task_event_flag_wait(
+ mpu_to_host[i],
+ chk_bit,
+ MARS_TASK_EVENT_FLAG_MASK_OR, NULL);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+
+ mars_test_counter_set(&notify[0], 3);
+
+ return NULL;
+}
+
+int main(void)
+{
+ int ret, i;
+ int32_t exit_code;
+
+ ret = mars_context_create(&mars_ctx, 0, 0);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+
+ /* wait condition AND */
+ for (i = 0; i < NUM_PATTERNS; i++) {
+ notify[0] = 0;
+ ret = mars_task_event_flag_create(
+ mars_ctx,
+ &mpu_to_host[i],
+ MARS_TASK_EVENT_FLAG_MPU_TO_HOST,
+ MARS_TASK_EVENT_FLAG_CLEAR_AUTO);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+
+ thread_args.type.u32[0] = (uint32_t)i;
+ thread_args.type.u32[1] = (uint32_t)pattern[i][0];
+ pthread_create(&thread, NULL, thread1_proc, &thread_args);
+
+ /* create mpu task */
+ ret = mars_task_create(mars_ctx, &task_id, NULL,
+ mpu_prog.elf_image,
+ MARS_TASK_CONTEXT_SAVE_ALL);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+
+ /* mpu tasks will set event_flags for and wait condition */
+ task_args.type.u64[0] = mpu_to_host[i];
+ task_args.type.u64[1] = (uint64_t)pattern[i][0];
+ task_args.type.u64[2] = mars_ptr_to_ea(&notify);
+ ret = mars_task_schedule(&task_id, &task_args, 0);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+
+ /* start mars_task_event_flag_set by mpu */
+ mars_test_counter_set(&notify[0], 1);
+
+ /* wait mars_task_event_flag_wait done */
+ usleep(FLAG_WAIT_USEC);
+ /* if notify is 3, mars_task_event_flag_wait is done */
+ MARS_TEST_ASSERT_EQUAL(notify[0], 3);
+
+ ret = mars_task_wait(&task_id, &exit_code);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+ MARS_TEST_ASSERT_ERROR(exit_code, MARS_SUCCESS);
+
+ ret = mars_task_destroy(&task_id);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+
+ pthread_join(thread, NULL);
+
+ ret = mars_task_event_flag_destroy(mpu_to_host[i]);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+ }
+ /* wait condition OR */
+ for (i = 0; i < NUM_PATTERNS; i++) {
+ notify[0] = 0;
+ ret = mars_task_event_flag_create(
+ mars_ctx,
+ &mpu_to_host[i],
+ MARS_TASK_EVENT_FLAG_MPU_TO_HOST,
+ MARS_TASK_EVENT_FLAG_CLEAR_AUTO);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+
+ thread_args.type.u32[0] = (uint32_t)i;
+ thread_args.type.u32[1] = (uint32_t)pattern[i][0];
+ pthread_create(&thread, NULL, thread2_proc, &thread_args);
+
+ /* create mpu task */
+ ret = mars_task_create(mars_ctx, &task_id, NULL,
+ mpu_prog.elf_image,
+ MARS_TASK_CONTEXT_SAVE_ALL);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+
+ /* mpu tasks will set event_flag for or wait condition */
+ task_args.type.u64[0] = mpu_to_host[i];
+ task_args.type.u64[1] = (uint64_t)pattern[i][1];
+ task_args.type.u64[2] = mars_ptr_to_ea(&notify);
+ ret = mars_task_schedule(&task_id, &task_args, 0);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+
+ /* start mars_task_event_flag_set by mpu */
+ mars_test_counter_set(&notify[0], 1);
+
+ /* wait mars_task_event_flag_wait done */
+ usleep(FLAG_WAIT_USEC);
+ /* if notify is 3, mars_task_event_flag_wait is done */
+ MARS_TEST_ASSERT_EQUAL(notify[0], 3);
+
+ ret = mars_task_wait(&task_id, &exit_code);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+ MARS_TEST_ASSERT_ERROR(exit_code, MARS_SUCCESS);
+
+ ret = mars_task_destroy(&task_id);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+
+ pthread_join(thread, NULL);
+
+ ret = mars_task_event_flag_destroy(mpu_to_host[i]);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+ }
+
+ ret = mars_context_destroy(mars_ctx);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+
+ return 0;
+}
+
diff --git a/tests/TFP/TFP_35_008/mpu.c b/tests/TFP/TFP_35_008/mpu.c
new file mode 100644
index 0000000..17c9975
--- /dev/null
+++ b/tests/TFP/TFP_35_008/mpu.c
@@ -0,0 +1,43 @@
+/*
+ * Copyright 2008 Sony Corporation
+ *
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a copy
+ * of this software and associated documentation files (the "Software"), to deal
+ * in the Software without restriction, including without limitation the rights
+ * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+ * copies of the Software, and to permit persons to whom the Software is
+ * furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included in
+ * all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+ * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+ * THE SOFTWARE.
+ */
+
+#include <mars/mars.h>
+#include <mars_task_test.h>
+#include <spu_mfcio.h>
+
+int mars_task_main(const struct mars_task_args *task_args)
+{
+ int ret;
+ uint64_t mpu_to_host_ea = task_args->type.u64[0];
+ uint32_t chk_bit = (uint32_t)task_args->type.u64[1];
+ uint64_t notify_ea = task_args->type.u64[2];
+
+ mars_test_counter_wait(notify_ea, 1);
+
+ ret = mars_task_event_flag_set(mpu_to_host_ea, chk_bit);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+
+ mars_test_counter_set(notify_ea, 2);
+
+ return 0;
+}
diff --git a/tests/TFP/TFP_35_009/Makefile b/tests/TFP/TFP_35_009/Makefile
new file mode 100644
index 0000000..72cf999
--- /dev/null
+++ b/tests/TFP/TFP_35_009/Makefile
@@ -0,0 +1,28 @@
+#
+# Copyright 2008 Sony Corporation
+#
+#
+# Permission is hereby granted, free of charge, to any person obtaining a copy
+# of this software and associated documentation files (the "Software"), to deal
+# in the Software without restriction, including without limitation the rights
+# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+# copies of the Software, and to permit persons to whom the Software is
+# furnished to do so, subject to the following conditions:
+#
+# The above copyright notice and this permission notice shall be included in
+# all copies or substantial portions of the Software.
+#
+# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+# THE SOFTWARE.
+#
+
+top_srcdir = ../..
+test_objs = host.o mpu1.task_eo mpu2.task_eo mpu3.task_eo
+
+include $(top_srcdir)/scripts/config.mk
+include $(top_srcdir)/scripts/rules_item.mk
diff --git a/tests/TFP/TFP_35_009/host.c b/tests/TFP/TFP_35_009/host.c
new file mode 100644
index 0000000..6d60592
--- /dev/null
+++ b/tests/TFP/TFP_35_009/host.c
@@ -0,0 +1,181 @@
+/*
+ * Copyright 2008 Sony Corporation
+ *
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a copy
+ * of this software and associated documentation files (the "Software"), to deal
+ * in the Software without restriction, including without limitation the rights
+ * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+ * copies of the Software, and to permit persons to whom the Software is
+ * furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included in
+ * all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+ * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+ * THE SOFTWARE.
+ */
+
+#include <unistd.h>
+#include <mars/mars.h>
+#include <libspe2.h>
+#include <mars_test.h>
+
+#define FLAG_WAIT_USEC 10000 /* 10ms */
+
+#define EVENT_FLAG_SIZE 32
+extern spe_program_handle_t mpu1_prog;
+extern spe_program_handle_t mpu2_prog;
+extern spe_program_handle_t mpu3_prog;
+#define NUM_PATTERNS 3
+static uint32_t pattern[NUM_PATTERNS][2] = {
+/* pattern or chk_bit */
+ { 0x00000001UL, 0x00000001UL },
+ { 0x0000CAFEUL, 0x00008000UL },
+ { 0x10203040UL, 0x10000000UL }
+};
+static struct mars_context *mars_ctx;
+static struct mars_task_id task_id, task3_id;
+static struct mars_task_args task_args, task3_args;
+static uint64_t mpu_to_mpu[NUM_PATTERNS];
+static uint32_t notify[32] __attribute((aligned(128)));
+
+int main(void)
+{
+ int ret, i;
+ int32_t exit_code;
+
+ ret = mars_context_create(&mars_ctx, 0, 0);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+
+ /* wait conditon AND */
+ for (i = 0; i < NUM_PATTERNS; i++) {
+ notify[0] = 0;
+ ret = mars_task_event_flag_create(
+ mars_ctx,
+ &mpu_to_mpu[i],
+ MARS_TASK_EVENT_FLAG_MPU_TO_MPU,
+ MARS_TASK_EVENT_FLAG_CLEAR_AUTO);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+
+ ret = mars_task_create(mars_ctx, &task_id, NULL,
+ mpu1_prog.elf_image,
+ MARS_TASK_CONTEXT_SAVE_ALL);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+
+ task_args.type.u64[0] = mpu_to_mpu[i];
+ task_args.type.u64[1] = (uint64_t)pattern[i][0];
+ task_args.type.u64[2] = mars_ptr_to_ea(&notify);
+
+ ret = mars_task_schedule(&task_id, &task_args, 0);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+
+ /* create flag_set task */
+ ret = mars_task_create(mars_ctx, &task3_id, NULL,
+ mpu3_prog.elf_image,
+ MARS_TASK_CONTEXT_SAVE_ALL);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+
+ /* the tasks will set event_flags for and wait condition */
+ task3_args.type.u64[0] = mpu_to_mpu[i];
+ task3_args.type.u64[1] = (uint64_t)pattern[i][0];
+ task3_args.type.u64[2] = mars_ptr_to_ea(&notify);
+ ret = mars_task_schedule(&task3_id, &task3_args, 0);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+
+ /* start mars_task_event_flag_set by mpu */
+ mars_test_counter_set(&notify[0], 1);
+
+ /* wait mars_task_event_flag_wait done */
+ usleep(FLAG_WAIT_USEC);
+ MARS_TEST_ASSERT_EQUAL(notify[0], 3);
+
+ ret = mars_task_wait(&task_id, &exit_code);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+ MARS_TEST_ASSERT_ERROR(exit_code, MARS_SUCCESS);
+
+ ret = mars_task_destroy(&task_id);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+
+ ret = mars_task_wait(&task3_id, &exit_code);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+ MARS_TEST_ASSERT_ERROR(exit_code, MARS_SUCCESS);
+
+ ret = mars_task_destroy(&task3_id);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+
+ ret = mars_task_event_flag_destroy(mpu_to_mpu[i]);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+ }
+ /* wait conditon OR */
+ for (i = 0; i < NUM_PATTERNS; i++) {
+ notify[0] = 0;
+ ret = mars_task_event_flag_create(
+ mars_ctx,
+ &mpu_to_mpu[i],
+ MARS_TASK_EVENT_FLAG_MPU_TO_MPU,
+ MARS_TASK_EVENT_FLAG_CLEAR_AUTO);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+
+ ret = mars_task_create(mars_ctx, &task_id, NULL,
+ mpu2_prog.elf_image,
+ MARS_TASK_CONTEXT_SAVE_ALL);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+
+ task_args.type.u64[0] = mpu_to_mpu[i];
+ task_args.type.u64[1] = (uint64_t)pattern[i][0];
+ task_args.type.u64[2] = mars_ptr_to_ea(&notify);
+
+ ret = mars_task_schedule(&task_id, &task_args, 0);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+
+ /* create flag_set task */
+ ret = mars_task_create(mars_ctx, &task3_id, NULL,
+ mpu3_prog.elf_image,
+ MARS_TASK_CONTEXT_SAVE_ALL);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+
+ /* the tasks will set event_flag for or wait condition */
+ task3_args.type.u64[0] = mpu_to_mpu[i];
+ task3_args.type.u64[1] = (uint64_t)pattern[i][1];
+ task3_args.type.u64[2] = mars_ptr_to_ea(&notify);
+ ret = mars_task_schedule(&task3_id, &task3_args, 0);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+
+ /* start mars_task_event_flag_set by mpu */
+ mars_test_counter_set(&notify[0], 1);
+
+
+ /* wait mars_task_event_flag_wait done */
+ usleep(FLAG_WAIT_USEC);
+ MARS_TEST_ASSERT_EQUAL(notify[0], 3);
+
+ ret = mars_task_wait(&task_id, &exit_code);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+ MARS_TEST_ASSERT_ERROR(exit_code, MARS_SUCCESS);
+
+ ret = mars_task_destroy(&task_id);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+
+ ret = mars_task_wait(&task3_id, &exit_code);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+ MARS_TEST_ASSERT_ERROR(exit_code, MARS_SUCCESS);
+
+ ret = mars_task_destroy(&task3_id);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+
+ ret = mars_task_event_flag_destroy(mpu_to_mpu[i]);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+ }
+
+ ret = mars_context_destroy(mars_ctx);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+
+ return 0;
+}
+
diff --git a/tests/TFP/TFP_35_009/mpu1.c b/tests/TFP/TFP_35_009/mpu1.c
new file mode 100644
index 0000000..77896c1
--- /dev/null
+++ b/tests/TFP/TFP_35_009/mpu1.c
@@ -0,0 +1,46 @@
+/*
+ * Copyright 2008 Sony Corporation
+ *
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a copy
+ * of this software and associated documentation files (the "Software"), to deal
+ * in the Software without restriction, including without limitation the rights
+ * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+ * copies of the Software, and to permit persons to whom the Software is
+ * furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included in
+ * all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+ * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+ * THE SOFTWARE.
+ */
+
+#include <mars/mars.h>
+#include <mars_task_test.h>
+#include <spu_mfcio.h>
+
+int mars_task_main(const struct mars_task_args *task_args)
+{
+ int ret;
+ uint64_t mpu_to_mpu_ea = task_args->type.u64[0];
+ uint32_t chk_bit = (uint32_t)task_args->type.u64[1];
+ uint64_t notify_ea = task_args->type.u64[2];
+
+ mars_test_counter_wait(notify_ea, 2);
+
+ ret = mars_task_event_flag_wait(
+ mpu_to_mpu_ea,
+ chk_bit,
+ MARS_TASK_EVENT_FLAG_MASK_AND, NULL);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+
+ mars_test_counter_set(notify_ea, 3);
+
+ return 0;
+}
diff --git a/tests/TFP/TFP_35_009/mpu2.c b/tests/TFP/TFP_35_009/mpu2.c
new file mode 100644
index 0000000..6d3acdc
--- /dev/null
+++ b/tests/TFP/TFP_35_009/mpu2.c
@@ -0,0 +1,46 @@
+/*
+ * Copyright 2008 Sony Corporation
+ *
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a copy
+ * of this software and associated documentation files (the "Software"), to deal
+ * in the Software without restriction, including without limitation the rights
+ * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+ * copies of the Software, and to permit persons to whom the Software is
+ * furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included in
+ * all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+ * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+ * THE SOFTWARE.
+ */
+
+#include <mars/mars.h>
+#include <mars_task_test.h>
+#include <spu_mfcio.h>
+
+int mars_task_main(const struct mars_task_args *task_args)
+{
+ int ret;
+ uint64_t mpu_to_mpu_ea = task_args->type.u64[0];
+ uint32_t chk_bit = (uint32_t)task_args->type.u64[1];
+ uint64_t notify_ea = task_args->type.u64[2];
+
+ mars_test_counter_wait(notify_ea, 2);
+
+ ret = mars_task_event_flag_wait(
+ mpu_to_mpu_ea,
+ chk_bit,
+ MARS_TASK_EVENT_FLAG_MASK_OR, NULL);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+
+ mars_test_counter_set(notify_ea, 3);
+
+ return 0;
+}
diff --git a/tests/TFP/TFP_35_009/mpu3.c b/tests/TFP/TFP_35_009/mpu3.c
new file mode 100644
index 0000000..fa969f3
--- /dev/null
+++ b/tests/TFP/TFP_35_009/mpu3.c
@@ -0,0 +1,43 @@
+/*
+ * Copyright 2008 Sony Corporation
+ *
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a copy
+ * of this software and associated documentation files (the "Software"), to deal
+ * in the Software without restriction, including without limitation the rights
+ * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+ * copies of the Software, and to permit persons to whom the Software is
+ * furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included in
+ * all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+ * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+ * THE SOFTWARE.
+ */
+
+#include <mars/mars.h>
+#include <mars_task_test.h>
+#include <spu_mfcio.h>
+
+int mars_task_main(const struct mars_task_args *task_args)
+{
+ int ret;
+ uint64_t mpu_to_mpu_ea = task_args->type.u64[0];
+ uint32_t chk_bit = (uint32_t)task_args->type.u64[1];
+ uint64_t notify_ea = task_args->type.u64[2];
+
+ mars_test_counter_wait(notify_ea, 1);
+
+ ret = mars_task_event_flag_set(mpu_to_mpu_ea, chk_bit);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+
+ mars_test_counter_set(notify_ea, 2);
+
+ return 0;
+}
diff --git a/tests/TFP/TFP_35_010/Makefile b/tests/TFP/TFP_35_010/Makefile
new file mode 100644
index 0000000..ecbce33
--- /dev/null
+++ b/tests/TFP/TFP_35_010/Makefile
@@ -0,0 +1,28 @@
+#
+# Copyright 2008 Sony Corporation
+#
+#
+# Permission is hereby granted, free of charge, to any person obtaining a copy
+# of this software and associated documentation files (the "Software"), to deal
+# in the Software without restriction, including without limitation the rights
+# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+# copies of the Software, and to permit persons to whom the Software is
+# furnished to do so, subject to the following conditions:
+#
+# The above copyright notice and this permission notice shall be included in
+# all copies or substantial portions of the Software.
+#
+# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+# THE SOFTWARE.
+#
+
+top_srcdir = ../..
+test_objs = host.o mpu1.task_eo mpu2.task_eo
+
+include $(top_srcdir)/scripts/config.mk
+include $(top_srcdir)/scripts/rules_item.mk
diff --git a/tests/TFP/TFP_35_010/host.c b/tests/TFP/TFP_35_010/host.c
new file mode 100644
index 0000000..9a1a2dc
--- /dev/null
+++ b/tests/TFP/TFP_35_010/host.c
@@ -0,0 +1,122 @@
+/*
+ * Copyright 2008 Sony Corporation
+ *
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a copy
+ * of this software and associated documentation files (the "Software"), to deal
+ * in the Software without restriction, including without limitation the rights
+ * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+ * copies of the Software, and to permit persons to whom the Software is
+ * furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included in
+ * all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+ * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+ * THE SOFTWARE.
+ */
+
+#include <unistd.h>
+#include <mars/mars.h>
+#include <libspe2.h>
+#include <mars_test.h>
+
+extern spe_program_handle_t mpu1_prog;
+extern spe_program_handle_t mpu2_prog;
+#define NUM_PATTERNS 3
+static uint32_t pattern[NUM_PATTERNS][2] = {
+/* pattern or chk_bit */
+ { 0x00000001UL, 0x01UL },
+ { 0x0000CAFEUL, 0x00008000UL },
+ { 0x10203040UL, 0x10000000UL }
+};
+static struct mars_context *mars_ctx;
+static struct mars_task_id task1_id, task2_id;
+static struct mars_task_args task1_args, task2_args;
+static uint64_t host_to_mpu_and[NUM_PATTERNS];
+static uint64_t host_to_mpu_or[NUM_PATTERNS];
+
+int main(void)
+{
+ int ret, i;
+ int32_t exit_code;
+
+ ret = mars_context_create(&mars_ctx, 0, 0);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+
+ for (i = 0; i < NUM_PATTERNS; i++) {
+ ret = mars_task_event_flag_create(
+ mars_ctx,
+ &host_to_mpu_and[i],
+ MARS_TASK_EVENT_FLAG_HOST_TO_MPU,
+ MARS_TASK_EVENT_FLAG_CLEAR_AUTO);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+
+ ret = mars_task_event_flag_create(
+ mars_ctx,
+ &host_to_mpu_or[i],
+ MARS_TASK_EVENT_FLAG_HOST_TO_MPU,
+ MARS_TASK_EVENT_FLAG_CLEAR_AUTO);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+
+ ret = mars_task_create(mars_ctx, &task1_id, NULL,
+ mpu1_prog.elf_image, MARS_TASK_CONTEXT_SAVE_ALL);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+
+ ret = mars_task_create(mars_ctx, &task2_id, NULL,
+ mpu2_prog.elf_image, MARS_TASK_CONTEXT_SAVE_ALL);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+
+ task1_args.type.u64[0] = host_to_mpu_and[i];
+ task1_args.type.u64[1] = (uint64_t)pattern[i][0];
+ ret = mars_task_schedule(&task1_id, &task1_args, 0);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+
+ task2_args.type.u64[0] = host_to_mpu_or[i];
+ task2_args.type.u64[1] = (uint64_t)pattern[i][0];
+ ret = mars_task_schedule(&task2_id, &task2_args, 0);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+
+ sleep(1);
+
+ /* set bits for AND wait condition */
+ ret = mars_task_event_flag_set(host_to_mpu_and[i],
+ pattern[i][0]);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+ /* set bit for OR wait condition */
+ ret = mars_task_event_flag_set(host_to_mpu_or[i],
+ pattern[i][1]);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+
+ ret = mars_task_wait(&task1_id, &exit_code);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+ MARS_TEST_ASSERT_ERROR(exit_code, MARS_SUCCESS);
+
+ ret = mars_task_wait(&task2_id, &exit_code);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+ MARS_TEST_ASSERT_ERROR(exit_code, MARS_SUCCESS);
+
+ ret = mars_task_destroy(&task1_id);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+
+ ret = mars_task_destroy(&task2_id);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+
+ ret = mars_task_event_flag_destroy(host_to_mpu_and[i]);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+
+ ret = mars_task_event_flag_destroy(host_to_mpu_or[i]);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+ }
+
+ ret = mars_context_destroy(mars_ctx);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+
+ return 0;
+}
+
diff --git a/tests/TFP/TFP_35_010/mpu1.c b/tests/TFP/TFP_35_010/mpu1.c
new file mode 100644
index 0000000..1c8bff1
--- /dev/null
+++ b/tests/TFP/TFP_35_010/mpu1.c
@@ -0,0 +1,56 @@
+/*
+ * Copyright 2008 Sony Corporation
+ *
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a copy
+ * of this software and associated documentation files (the "Software"), to deal
+ * in the Software without restriction, including without limitation the rights
+ * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+ * copies of the Software, and to permit persons to whom the Software is
+ * furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included in
+ * all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+ * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+ * THE SOFTWARE.
+ */
+
+#include <mars/mars.h>
+#include <mars_task_test.h>
+
+int mars_task_main(const struct mars_task_args *task_args)
+{
+ int ret;
+ uint64_t host_to_mpu_ea = task_args->type.u64[0];
+ uint32_t flags = (uint32_t)task_args->type.u64[1];
+ uint32_t chk_bit;
+
+ /* wait condition AND */
+ ret = mars_task_event_flag_wait(
+ host_to_mpu_ea,
+ flags,
+ MARS_TASK_EVENT_FLAG_MASK_AND, NULL);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+
+ /* check if all bits are cleard */
+ chk_bit = 0x01;
+ while (flags) {
+ if (flags & 0x01) {
+ ret = mars_task_event_flag_try_wait(
+ host_to_mpu_ea,
+ chk_bit,
+ MARS_TASK_EVENT_FLAG_MASK_OR, NULL);
+ /* if bit == 0, try_wait returns BUSY */
+ MARS_TEST_ASSERT_ERROR(ret, MARS_ERROR_BUSY);
+ }
+ flags >>= 1;
+ chk_bit <<= 1;
+ }
+ return 0;
+}
diff --git a/tests/TFP/TFP_35_010/mpu2.c b/tests/TFP/TFP_35_010/mpu2.c
new file mode 100644
index 0000000..b31b30b
--- /dev/null
+++ b/tests/TFP/TFP_35_010/mpu2.c
@@ -0,0 +1,56 @@
+/*
+ * Copyright 2008 Sony Corporation
+ *
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a copy
+ * of this software and associated documentation files (the "Software"), to deal
+ * in the Software without restriction, including without limitation the rights
+ * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+ * copies of the Software, and to permit persons to whom the Software is
+ * furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included in
+ * all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+ * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+ * THE SOFTWARE.
+ */
+
+#include <mars/mars.h>
+#include <mars_task_test.h>
+
+int mars_task_main(const struct mars_task_args *task_args)
+{
+ int ret;
+ uint64_t host_to_mpu_ea = task_args->type.u64[0];
+ uint32_t flags = (uint32_t)task_args->type.u64[1];
+ uint32_t chk_bit;
+
+ /* wait condition OR */
+ ret = mars_task_event_flag_wait(
+ host_to_mpu_ea,
+ flags,
+ MARS_TASK_EVENT_FLAG_MASK_OR, NULL);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+
+ /* check if all bits are cleard */
+ chk_bit = 0x01;
+ while (flags) {
+ if (flags & 0x01) {
+ ret = mars_task_event_flag_try_wait(
+ host_to_mpu_ea,
+ chk_bit,
+ MARS_TASK_EVENT_FLAG_MASK_OR, NULL);
+ /* if bit == 0, try_wait returns BUSY */
+ MARS_TEST_ASSERT_ERROR(ret, MARS_ERROR_BUSY);
+ }
+ flags >>= 1;
+ chk_bit <<= 1;
+ }
+ return 0;
+}
diff --git a/tests/TFP/TFP_35_011/Makefile b/tests/TFP/TFP_35_011/Makefile
new file mode 100644
index 0000000..432135a
--- /dev/null
+++ b/tests/TFP/TFP_35_011/Makefile
@@ -0,0 +1,28 @@
+#
+# Copyright 2008 Sony Corporation
+#
+#
+# Permission is hereby granted, free of charge, to any person obtaining a copy
+# of this software and associated documentation files (the "Software"), to deal
+# in the Software without restriction, including without limitation the rights
+# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+# copies of the Software, and to permit persons to whom the Software is
+# furnished to do so, subject to the following conditions:
+#
+# The above copyright notice and this permission notice shall be included in
+# all copies or substantial portions of the Software.
+#
+# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+# THE SOFTWARE.
+#
+
+top_srcdir = ../..
+test_objs = host.o mpu.task_eo
+
+include $(top_srcdir)/scripts/config.mk
+include $(top_srcdir)/scripts/rules_item.mk
diff --git a/tests/TFP/TFP_35_011/host.c b/tests/TFP/TFP_35_011/host.c
new file mode 100644
index 0000000..24be4d9
--- /dev/null
+++ b/tests/TFP/TFP_35_011/host.c
@@ -0,0 +1,197 @@
+/*
+ * Copyright 2008 Sony Corporation
+ *
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a copy
+ * of this software and associated documentation files (the "Software"), to deal
+ * in the Software without restriction, including without limitation the rights
+ * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+ * copies of the Software, and to permit persons to whom the Software is
+ * furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included in
+ * all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+ * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+ * THE SOFTWARE.
+ */
+
+#include <pthread.h>
+#include <mars/mars.h>
+#include <libspe2.h>
+#include <mars_test.h>
+
+#define EVENT_FLAG_SIZE 32
+
+extern spe_program_handle_t mpu_prog;
+#define NUM_PATTERNS 3
+static uint32_t pattern[NUM_PATTERNS][2] = {
+/* pattern or chk_bit */
+ { 0x00000001UL, 0x01UL },
+ { 0x0000CAFEUL, 0x00008000UL },
+ { 0x10203040UL, 0x10000000UL }
+};
+static struct mars_context *mars_ctx;
+static struct mars_task_id task1_id, task2_id;
+static struct mars_task_args task1_args, task2_args;
+static struct mars_task_args thread1_args, thread2_args;
+static uint64_t mpu_to_host_and[NUM_PATTERNS];
+static uint64_t mpu_to_host_or[NUM_PATTERNS];
+static pthread_t thread1, thread2;
+
+static void *thread1_proc(void *ptr)
+{
+ int ret;
+ struct mars_task_args *task_args = (struct mars_task_args *)ptr;
+ uint32_t id = (uint32_t)task_args->type.u32[0];
+ uint32_t flags = task_args->type.u32[1];
+ uint32_t chk_bit;
+
+ /* wait condition AND */
+ ret = mars_task_event_flag_wait(
+ mpu_to_host_and[id],
+ flags,
+ MARS_TASK_EVENT_FLAG_MASK_AND, NULL);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+
+ /* check if all bits are cleard */
+ chk_bit = 0x01;
+ while (flags) {
+ if (flags & 0x01) {
+ ret = mars_task_event_flag_try_wait(
+ mpu_to_host_and[id],
+ chk_bit,
+ MARS_TASK_EVENT_FLAG_MASK_OR, NULL);
+ /* if bit == 0, try_wait returns BUSY */
+ MARS_TEST_ASSERT_ERROR(ret, MARS_ERROR_BUSY);
+ }
+ flags >>= 1;
+ chk_bit <<= 1;
+ }
+
+ return NULL;
+}
+
+static void *thread2_proc(void *ptr)
+{
+ int ret;
+ struct mars_task_args *task_args = (struct mars_task_args *)ptr;
+ uint32_t id = (uint32_t)task_args->type.u32[0];
+ uint32_t flags = task_args->type.u32[1];
+ uint32_t chk_bit;
+
+ /* wait condition OR */
+ ret = mars_task_event_flag_wait(
+ mpu_to_host_or[id],
+ flags,
+ MARS_TASK_EVENT_FLAG_MASK_OR, NULL);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+
+ /* check if all bits are cleard */
+ chk_bit = 0x01;
+ while (flags) {
+ if (flags & 0x01) {
+ ret = mars_task_event_flag_try_wait(
+ mpu_to_host_or[id],
+ chk_bit,
+ MARS_TASK_EVENT_FLAG_MASK_OR, NULL);
+ /* if bit == 0, try_wait returns BUSY */
+ MARS_TEST_ASSERT_ERROR(ret, MARS_ERROR_BUSY);
+ }
+ flags >>= 1;
+ chk_bit <<= 1;
+ }
+
+ return NULL;
+}
+
+int main(void)
+{
+ int ret, i;
+ int32_t exit_code;
+
+ ret = mars_context_create(&mars_ctx, 0, 0);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+
+ for (i = 0; i < NUM_PATTERNS; i++) {
+ ret = mars_task_event_flag_create(
+ mars_ctx,
+ &mpu_to_host_and[i],
+ MARS_TASK_EVENT_FLAG_MPU_TO_HOST,
+ MARS_TASK_EVENT_FLAG_CLEAR_AUTO);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+
+ ret = mars_task_event_flag_create(
+ mars_ctx,
+ &mpu_to_host_or[i],
+ MARS_TASK_EVENT_FLAG_MPU_TO_HOST,
+ MARS_TASK_EVENT_FLAG_CLEAR_AUTO);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+
+ ret = mars_task_create(mars_ctx, &task1_id, NULL,
+ mpu_prog.elf_image,
+ MARS_TASK_CONTEXT_SAVE_ALL);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+
+ ret = mars_task_create(mars_ctx, &task2_id, NULL,
+ mpu_prog.elf_image,
+ MARS_TASK_CONTEXT_SAVE_ALL);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+
+ thread1_args.type.u32[0] = (uint32_t)i;
+ thread1_args.type.u32[1] = pattern[i][0];
+ pthread_create(&thread1, NULL,
+ thread1_proc, &thread1_args);
+
+ thread2_args.type.u32[0] = (uint32_t)i;
+ thread2_args.type.u32[1] = pattern[i][0];
+ pthread_create(&thread2, NULL,
+ thread2_proc, &thread2_args);
+
+ /* set flags AND condition */
+ task1_args.type.u64[0] = mpu_to_host_and[i];
+ task1_args.type.u64[1] = (uint64_t)pattern[i][0];
+ ret = mars_task_schedule(&task1_id, &task1_args, 0);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+
+ /* set flags OR conditon */
+ task2_args.type.u64[0] = mpu_to_host_or[i];
+ task2_args.type.u64[1] = (uint64_t)pattern[i][1];
+ ret = mars_task_schedule(&task2_id, &task2_args, 0);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+
+ pthread_join(thread1, NULL);
+ pthread_join(thread2, NULL);
+
+ ret = mars_task_wait(&task1_id, &exit_code);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+ MARS_TEST_ASSERT_ERROR(exit_code, MARS_SUCCESS);
+
+ ret = mars_task_wait(&task2_id, &exit_code);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+ MARS_TEST_ASSERT_ERROR(exit_code, MARS_SUCCESS);
+
+ ret = mars_task_destroy(&task1_id);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+
+ ret = mars_task_destroy(&task2_id);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+
+ ret = mars_task_event_flag_destroy(mpu_to_host_and[i]);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+
+ ret = mars_task_event_flag_destroy(mpu_to_host_or[i]);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+ }
+
+ ret = mars_context_destroy(mars_ctx);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+
+ return 0;
+}
+
diff --git a/tests/TFP/TFP_35_011/mpu.c b/tests/TFP/TFP_35_011/mpu.c
new file mode 100644
index 0000000..4fdbceb
--- /dev/null
+++ b/tests/TFP/TFP_35_011/mpu.c
@@ -0,0 +1,37 @@
+/*
+ * Copyright 2008 Sony Corporation
+ *
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a copy
+ * of this software and associated documentation files (the "Software"), to deal
+ * in the Software without restriction, including without limitation the rights
+ * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+ * copies of the Software, and to permit persons to whom the Software is
+ * furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included in
+ * all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+ * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+ * THE SOFTWARE.
+ */
+
+#include <mars/mars.h>
+#include <mars_task_test.h>
+
+int mars_task_main(const struct mars_task_args *task_args)
+{
+ int ret;
+ uint64_t mpu_to_host_ea = task_args->type.u64[0];
+ uint32_t chk_bit = (uint32_t)task_args->type.u64[1];
+
+ ret = mars_task_event_flag_set(mpu_to_host_ea, chk_bit);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+
+ return 0;
+}
diff --git a/tests/TFP/TFP_35_012/Makefile b/tests/TFP/TFP_35_012/Makefile
new file mode 100644
index 0000000..72cf999
--- /dev/null
+++ b/tests/TFP/TFP_35_012/Makefile
@@ -0,0 +1,28 @@
+#
+# Copyright 2008 Sony Corporation
+#
+#
+# Permission is hereby granted, free of charge, to any person obtaining a copy
+# of this software and associated documentation files (the "Software"), to deal
+# in the Software without restriction, including without limitation the rights
+# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+# copies of the Software, and to permit persons to whom the Software is
+# furnished to do so, subject to the following conditions:
+#
+# The above copyright notice and this permission notice shall be included in
+# all copies or substantial portions of the Software.
+#
+# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+# THE SOFTWARE.
+#
+
+top_srcdir = ../..
+test_objs = host.o mpu1.task_eo mpu2.task_eo mpu3.task_eo
+
+include $(top_srcdir)/scripts/config.mk
+include $(top_srcdir)/scripts/rules_item.mk
diff --git a/tests/TFP/TFP_35_012/host.c b/tests/TFP/TFP_35_012/host.c
new file mode 100644
index 0000000..a00be48
--- /dev/null
+++ b/tests/TFP/TFP_35_012/host.c
@@ -0,0 +1,149 @@
+/*
+ * Copyright 2008 Sony Corporation
+ *
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a copy
+ * of this software and associated documentation files (the "Software"), to deal
+ * in the Software without restriction, including without limitation the rights
+ * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+ * copies of the Software, and to permit persons to whom the Software is
+ * furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included in
+ * all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+ * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+ * THE SOFTWARE.
+ */
+
+#include <unistd.h>
+#include <mars/mars.h>
+#include <libspe2.h>
+#include <mars_test.h>
+
+extern spe_program_handle_t mpu1_prog;
+extern spe_program_handle_t mpu2_prog;
+extern spe_program_handle_t mpu3_prog;
+#define NUM_PATTERNS 3
+static uint32_t pattern[NUM_PATTERNS][2] = {
+/* pattern or chk_bit */
+ { 0x00000001UL, 0x01UL },
+ { 0x0000CAFEUL, 0x00008000UL },
+ { 0x10203040UL, 0x10000000UL }
+};
+static struct mars_context *mars_ctx;
+static struct mars_task_id task1_id, task2_id, task3_id;
+static struct mars_task_args task1_args, task2_args, task3_args;
+static uint64_t mpu_to_mpu_and[NUM_PATTERNS];
+static uint64_t mpu_to_mpu_or[NUM_PATTERNS];
+
+int main(void)
+{
+ int ret, i;
+ int32_t exit_code;
+
+ ret = mars_context_create(&mars_ctx, 0, 0);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+
+ for (i = 0; i < NUM_PATTERNS; i++) {
+ ret = mars_task_event_flag_create(
+ mars_ctx,
+ &mpu_to_mpu_and[i],
+ MARS_TASK_EVENT_FLAG_MPU_TO_MPU,
+ MARS_TASK_EVENT_FLAG_CLEAR_AUTO);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+
+ ret = mars_task_event_flag_create(
+ mars_ctx,
+ &mpu_to_mpu_or[i],
+ MARS_TASK_EVENT_FLAG_MPU_TO_MPU,
+ MARS_TASK_EVENT_FLAG_CLEAR_AUTO);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+
+ ret = mars_task_create(mars_ctx, &task1_id, NULL,
+ mpu1_prog.elf_image, MARS_TASK_CONTEXT_SAVE_ALL);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+
+ ret = mars_task_create(mars_ctx, &task2_id, NULL,
+ mpu2_prog.elf_image, MARS_TASK_CONTEXT_SAVE_ALL);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+
+ task1_args.type.u64[0] = mpu_to_mpu_and[i];
+ task1_args.type.u64[1] = (uint64_t)pattern[i][0];
+ ret = mars_task_schedule(&task1_id, &task1_args, 0);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+
+ task2_args.type.u64[0] = mpu_to_mpu_or[i];
+ task2_args.type.u64[1] = (uint64_t)pattern[i][0];
+ ret = mars_task_schedule(&task2_id, &task2_args, 0);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+
+ sleep(1);
+
+ /* set bits for AND wait condition */
+ ret = mars_task_create(mars_ctx, &task3_id, NULL,
+ mpu3_prog.elf_image, MARS_TASK_CONTEXT_SAVE_ALL);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+
+ task3_args.type.u64[0] = mpu_to_mpu_and[i];
+ task3_args.type.u64[1] = (uint64_t)pattern[i][0]; /* AND */
+ ret = mars_task_schedule(&task3_id, &task3_args, 0);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+
+ ret = mars_task_wait(&task3_id, &exit_code);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+ MARS_TEST_ASSERT_ERROR(exit_code, MARS_SUCCESS);
+
+ ret = mars_task_destroy(&task3_id);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+
+ /* set bit for OR wait condition */
+ ret = mars_task_create(mars_ctx, &task3_id, NULL,
+ mpu3_prog.elf_image, MARS_TASK_CONTEXT_SAVE_ALL);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+
+ task3_args.type.u64[0] = mpu_to_mpu_or[i];
+ task3_args.type.u64[1] = (uint64_t)pattern[i][1]; /* OR */
+ ret = mars_task_schedule(&task3_id, &task3_args, 0);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+
+ ret = mars_task_wait(&task3_id, &exit_code);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+ MARS_TEST_ASSERT_ERROR(exit_code, MARS_SUCCESS);
+
+ ret = mars_task_destroy(&task3_id);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+
+ /* wait for flag_wait task */
+ ret = mars_task_wait(&task1_id, &exit_code);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+ MARS_TEST_ASSERT_ERROR(exit_code, MARS_SUCCESS);
+
+ ret = mars_task_wait(&task2_id, &exit_code);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+ MARS_TEST_ASSERT_ERROR(exit_code, MARS_SUCCESS);
+
+ ret = mars_task_destroy(&task1_id);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+
+ ret = mars_task_destroy(&task2_id);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+
+ ret = mars_task_event_flag_destroy(mpu_to_mpu_and[i]);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+
+ ret = mars_task_event_flag_destroy(mpu_to_mpu_or[i]);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+ }
+
+ ret = mars_context_destroy(mars_ctx);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+
+ return 0;
+}
+
diff --git a/tests/TFP/TFP_35_012/mpu1.c b/tests/TFP/TFP_35_012/mpu1.c
new file mode 100644
index 0000000..8267945
--- /dev/null
+++ b/tests/TFP/TFP_35_012/mpu1.c
@@ -0,0 +1,56 @@
+/*
+ * Copyright 2008 Sony Corporation
+ *
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a copy
+ * of this software and associated documentation files (the "Software"), to deal
+ * in the Software without restriction, including without limitation the rights
+ * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+ * copies of the Software, and to permit persons to whom the Software is
+ * furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included in
+ * all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+ * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+ * THE SOFTWARE.
+ */
+
+#include <mars/mars.h>
+#include <mars_task_test.h>
+
+int mars_task_main(const struct mars_task_args *task_args)
+{
+ int ret;
+ uint64_t mpu_to_mpu_ea = task_args->type.u64[0];
+ uint32_t flags = (uint32_t)task_args->type.u64[1];
+ uint32_t chk_bit;
+
+ /* wait condition AND */
+ ret = mars_task_event_flag_wait(
+ mpu_to_mpu_ea,
+ flags,
+ MARS_TASK_EVENT_FLAG_MASK_AND, NULL);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+
+ /* check if all bits are cleard */
+ chk_bit = 0x01;
+ while (flags) {
+ if (flags & 0x01) {
+ ret = mars_task_event_flag_try_wait(
+ mpu_to_mpu_ea,
+ chk_bit,
+ MARS_TASK_EVENT_FLAG_MASK_OR, NULL);
+ /* if bit == 0, try_wait returns BUSY */
+ MARS_TEST_ASSERT_ERROR(ret, MARS_ERROR_BUSY);
+ }
+ flags >>= 1;
+ chk_bit <<= 1;
+ }
+ return 0;
+}
diff --git a/tests/TFP/TFP_35_012/mpu2.c b/tests/TFP/TFP_35_012/mpu2.c
new file mode 100644
index 0000000..320e161
--- /dev/null
+++ b/tests/TFP/TFP_35_012/mpu2.c
@@ -0,0 +1,56 @@
+/*
+ * Copyright 2008 Sony Corporation
+ *
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a copy
+ * of this software and associated documentation files (the "Software"), to deal
+ * in the Software without restriction, including without limitation the rights
+ * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+ * copies of the Software, and to permit persons to whom the Software is
+ * furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included in
+ * all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+ * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+ * THE SOFTWARE.
+ */
+
+#include <mars/mars.h>
+#include <mars_task_test.h>
+
+int mars_task_main(const struct mars_task_args *task_args)
+{
+ int ret;
+ uint64_t mpu_to_mpu_ea = task_args->type.u64[0];
+ uint32_t flags = (uint32_t)task_args->type.u64[1];
+ uint32_t chk_bit;
+
+ /* wait condition OR */
+ ret = mars_task_event_flag_wait(
+ mpu_to_mpu_ea,
+ flags,
+ MARS_TASK_EVENT_FLAG_MASK_OR, NULL);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+
+ /* check if all bits are cleard */
+ chk_bit = 0x01;
+ while (flags) {
+ if (flags & 0x01) {
+ ret = mars_task_event_flag_try_wait(
+ mpu_to_mpu_ea,
+ chk_bit,
+ MARS_TASK_EVENT_FLAG_MASK_OR, NULL);
+ /* if bit == 0, try_wait returns BUSY */
+ MARS_TEST_ASSERT_ERROR(ret, MARS_ERROR_BUSY);
+ }
+ flags >>= 1;
+ chk_bit <<= 1;
+ }
+ return 0;
+}
diff --git a/tests/TFP/TFP_35_012/mpu3.c b/tests/TFP/TFP_35_012/mpu3.c
new file mode 100644
index 0000000..65f3252
--- /dev/null
+++ b/tests/TFP/TFP_35_012/mpu3.c
@@ -0,0 +1,37 @@
+/*
+ * Copyright 2008 Sony Corporation
+ *
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a copy
+ * of this software and associated documentation files (the "Software"), to deal
+ * in the Software without restriction, including without limitation the rights
+ * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+ * copies of the Software, and to permit persons to whom the Software is
+ * furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included in
+ * all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+ * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+ * THE SOFTWARE.
+ */
+
+#include <mars/mars.h>
+#include <mars_task_test.h>
+
+int mars_task_main(const struct mars_task_args *task_args)
+{
+ int ret;
+ uint64_t mpu_to_mpu_ea = task_args->type.u64[0];
+ uint32_t chk_bit = (uint32_t)task_args->type.u64[1];
+
+ ret = mars_task_event_flag_set(mpu_to_mpu_ea, chk_bit);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+
+ return 0;
+}
diff --git a/tests/TFP/TFP_35_013/Makefile b/tests/TFP/TFP_35_013/Makefile
new file mode 100644
index 0000000..ecbce33
--- /dev/null
+++ b/tests/TFP/TFP_35_013/Makefile
@@ -0,0 +1,28 @@
+#
+# Copyright 2008 Sony Corporation
+#
+#
+# Permission is hereby granted, free of charge, to any person obtaining a copy
+# of this software and associated documentation files (the "Software"), to deal
+# in the Software without restriction, including without limitation the rights
+# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+# copies of the Software, and to permit persons to whom the Software is
+# furnished to do so, subject to the following conditions:
+#
+# The above copyright notice and this permission notice shall be included in
+# all copies or substantial portions of the Software.
+#
+# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+# THE SOFTWARE.
+#
+
+top_srcdir = ../..
+test_objs = host.o mpu1.task_eo mpu2.task_eo
+
+include $(top_srcdir)/scripts/config.mk
+include $(top_srcdir)/scripts/rules_item.mk
diff --git a/tests/TFP/TFP_35_013/host.c b/tests/TFP/TFP_35_013/host.c
new file mode 100644
index 0000000..6eff47d
--- /dev/null
+++ b/tests/TFP/TFP_35_013/host.c
@@ -0,0 +1,123 @@
+/*
+ * Copyright 2008 Sony Corporation
+ *
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a copy
+ * of this software and associated documentation files (the "Software"), to deal
+ * in the Software without restriction, including without limitation the rights
+ * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+ * copies of the Software, and to permit persons to whom the Software is
+ * furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included in
+ * all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+ * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+ * THE SOFTWARE.
+ */
+
+#include <unistd.h>
+#include <mars/mars.h>
+#include <libspe2.h>
+#include <mars_test.h>
+
+extern spe_program_handle_t mpu1_prog;
+extern spe_program_handle_t mpu2_prog;
+#define NUM_PATTERNS 3
+static uint32_t pattern[NUM_PATTERNS][2] = {
+/* pattern or chk_bit */
+ { 0x00000001UL, 0x00000001UL },
+ { 0x0000CAFEUL, 0x00008000UL },
+ { 0x10203040UL, 0x10000000UL }
+};
+static struct mars_context *mars_ctx;
+static struct mars_task_id task1_id, task2_id;
+static struct mars_task_args task1_args, task2_args;
+static uint64_t host_to_mpu_and[NUM_PATTERNS];
+static uint64_t host_to_mpu_or[NUM_PATTERNS];
+
+int main(void)
+{
+ int ret, i;
+ int32_t exit_code;
+
+ ret = mars_context_create(&mars_ctx, 0, 0);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+
+ for (i = 0; i < NUM_PATTERNS; i++) {
+ ret = mars_task_event_flag_create(
+ mars_ctx,
+ &host_to_mpu_and[i],
+ MARS_TASK_EVENT_FLAG_HOST_TO_MPU,
+ MARS_TASK_EVENT_FLAG_CLEAR_MANUAL);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+
+ ret = mars_task_event_flag_create(
+ mars_ctx,
+ &host_to_mpu_or[i],
+ MARS_TASK_EVENT_FLAG_HOST_TO_MPU,
+ MARS_TASK_EVENT_FLAG_CLEAR_MANUAL);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+
+ ret = mars_task_create(mars_ctx, &task1_id, NULL,
+ mpu1_prog.elf_image, MARS_TASK_CONTEXT_SAVE_ALL);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+
+ ret = mars_task_create(mars_ctx, &task2_id, NULL,
+ mpu2_prog.elf_image, MARS_TASK_CONTEXT_SAVE_ALL);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+
+ task1_args.type.u64[0] = host_to_mpu_and[i];
+ task1_args.type.u64[1] = (uint64_t)pattern[i][0];
+ ret = mars_task_schedule(&task1_id, &task1_args, 0);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+
+ task2_args.type.u64[0] = host_to_mpu_or[i];
+ task2_args.type.u64[1] = (uint64_t)pattern[i][0];
+ task2_args.type.u64[2] = (uint64_t)pattern[i][1];
+ ret = mars_task_schedule(&task2_id, &task2_args, 0);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+
+ sleep(1);
+
+ /* set bits for AND wait condition */
+ ret = mars_task_event_flag_set(host_to_mpu_and[i],
+ pattern[i][0]);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+ /* set bit for OR wait condition */
+ ret = mars_task_event_flag_set(host_to_mpu_or[i],
+ pattern[i][1]);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+
+ ret = mars_task_wait(&task1_id, &exit_code);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+ MARS_TEST_ASSERT_ERROR(exit_code, MARS_SUCCESS);
+
+ ret = mars_task_wait(&task2_id, &exit_code);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+ MARS_TEST_ASSERT_ERROR(exit_code, MARS_SUCCESS);
+
+ ret = mars_task_destroy(&task1_id);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+
+ ret = mars_task_destroy(&task2_id);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+
+ ret = mars_task_event_flag_destroy(host_to_mpu_and[i]);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+
+ ret = mars_task_event_flag_destroy(host_to_mpu_or[i]);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+ }
+
+ ret = mars_context_destroy(mars_ctx);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+
+ return 0;
+}
+
diff --git a/tests/TFP/TFP_35_013/mpu1.c b/tests/TFP/TFP_35_013/mpu1.c
new file mode 100644
index 0000000..9cfbada
--- /dev/null
+++ b/tests/TFP/TFP_35_013/mpu1.c
@@ -0,0 +1,56 @@
+/*
+ * Copyright 2008 Sony Corporation
+ *
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a copy
+ * of this software and associated documentation files (the "Software"), to deal
+ * in the Software without restriction, including without limitation the rights
+ * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+ * copies of the Software, and to permit persons to whom the Software is
+ * furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included in
+ * all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+ * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+ * THE SOFTWARE.
+ */
+
+#include <mars/mars.h>
+#include <mars_task_test.h>
+
+int mars_task_main(const struct mars_task_args *task_args)
+{
+ int ret;
+ uint64_t host_to_mpu_ea = task_args->type.u64[0];
+ uint32_t flags = (uint32_t)task_args->type.u64[1];
+ uint32_t chk_bit;
+
+ /* wait condition AND */
+ ret = mars_task_event_flag_wait(
+ host_to_mpu_ea,
+ flags,
+ MARS_TASK_EVENT_FLAG_MASK_AND, NULL);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+
+ /* check if all bits are cleard */
+ chk_bit = 0x01;
+ while (flags) {
+ if (flags & 0x01) {
+ ret = mars_task_event_flag_try_wait(
+ host_to_mpu_ea,
+ chk_bit,
+ MARS_TASK_EVENT_FLAG_MASK_AND, NULL);
+ /* if bit == 1, try_wait returns SUCCESS */
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+ }
+ flags >>= 1;
+ chk_bit <<= 1;
+ }
+ return 0;
+}
diff --git a/tests/TFP/TFP_35_013/mpu2.c b/tests/TFP/TFP_35_013/mpu2.c
new file mode 100644
index 0000000..c862fdb
--- /dev/null
+++ b/tests/TFP/TFP_35_013/mpu2.c
@@ -0,0 +1,57 @@
+/*
+ * Copyright 2008 Sony Corporation
+ *
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a copy
+ * of this software and associated documentation files (the "Software"), to deal
+ * in the Software without restriction, including without limitation the rights
+ * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+ * copies of the Software, and to permit persons to whom the Software is
+ * furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included in
+ * all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+ * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+ * THE SOFTWARE.
+ */
+
+#include <mars/mars.h>
+#include <mars_task_test.h>
+
+int mars_task_main(const struct mars_task_args *task_args)
+{
+ int ret;
+ uint64_t host_to_mpu_ea = task_args->type.u64[0];
+ uint32_t flags = (uint32_t)task_args->type.u64[1];
+ uint32_t set_flags = (uint32_t)task_args->type.u64[2];
+ uint32_t chk_bit;
+
+ /* wait condition OR */
+ ret = mars_task_event_flag_wait(
+ host_to_mpu_ea,
+ flags,
+ MARS_TASK_EVENT_FLAG_MASK_OR, NULL);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+
+ /* check if all bits are cleard */
+ chk_bit = 0x01;
+ while (set_flags) {
+ if (set_flags & 0x01) {
+ ret = mars_task_event_flag_try_wait(
+ host_to_mpu_ea,
+ chk_bit,
+ MARS_TASK_EVENT_FLAG_MASK_AND, NULL);
+ /* if bit == 1, try_wait returns SUCCESS */
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+ }
+ set_flags >>= 1;
+ chk_bit <<= 1;
+ }
+ return 0;
+}
diff --git a/tests/TFP/TFP_35_014/Makefile b/tests/TFP/TFP_35_014/Makefile
new file mode 100644
index 0000000..432135a
--- /dev/null
+++ b/tests/TFP/TFP_35_014/Makefile
@@ -0,0 +1,28 @@
+#
+# Copyright 2008 Sony Corporation
+#
+#
+# Permission is hereby granted, free of charge, to any person obtaining a copy
+# of this software and associated documentation files (the "Software"), to deal
+# in the Software without restriction, including without limitation the rights
+# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+# copies of the Software, and to permit persons to whom the Software is
+# furnished to do so, subject to the following conditions:
+#
+# The above copyright notice and this permission notice shall be included in
+# all copies or substantial portions of the Software.
+#
+# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+# THE SOFTWARE.
+#
+
+top_srcdir = ../..
+test_objs = host.o mpu.task_eo
+
+include $(top_srcdir)/scripts/config.mk
+include $(top_srcdir)/scripts/rules_item.mk
diff --git a/tests/TFP/TFP_35_014/host.c b/tests/TFP/TFP_35_014/host.c
new file mode 100644
index 0000000..22a5a16
--- /dev/null
+++ b/tests/TFP/TFP_35_014/host.c
@@ -0,0 +1,199 @@
+/*
+ * Copyright 2008 Sony Corporation
+ *
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a copy
+ * of this software and associated documentation files (the "Software"), to deal
+ * in the Software without restriction, including without limitation the rights
+ * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+ * copies of the Software, and to permit persons to whom the Software is
+ * furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included in
+ * all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+ * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+ * THE SOFTWARE.
+ */
+
+#include <pthread.h>
+#include <mars/mars.h>
+#include <libspe2.h>
+#include <mars_test.h>
+
+#define EVENT_FLAG_SIZE 32
+
+extern spe_program_handle_t mpu_prog;
+#define NUM_PATTERNS 3
+static uint32_t pattern[NUM_PATTERNS][2] = {
+/* pattern or chk_bit */
+ { 0x00000001UL, 0x00000001UL },
+ { 0x0000CAFEUL, 0x00008000UL },
+ { 0x10203040UL, 0x10000000UL }
+};
+static struct mars_context *mars_ctx;
+static struct mars_task_id task1_id, task2_id;
+static struct mars_task_args task1_args, task2_args;
+static struct mars_task_args thread1_args, thread2_args;
+static uint64_t mpu_to_host_and[NUM_PATTERNS];
+static uint64_t mpu_to_host_or[NUM_PATTERNS];
+static pthread_t thread1, thread2;
+
+static void *thread1_proc(void *ptr)
+{
+ int ret;
+ struct mars_task_args *task_args = (struct mars_task_args *)ptr;
+ uint32_t id = (uint32_t)task_args->type.u32[0];
+ uint32_t flags = task_args->type.u32[1];
+ uint32_t chk_bit;
+
+ /* wait condition AND */
+ ret = mars_task_event_flag_wait(
+ mpu_to_host_and[id],
+ flags,
+ MARS_TASK_EVENT_FLAG_MASK_AND, NULL);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+
+ /* check if all bits are cleard */
+ chk_bit = 0x01;
+ while (flags) {
+ if (flags & 0x01) {
+ ret = mars_task_event_flag_try_wait(
+ mpu_to_host_and[id],
+ chk_bit,
+ MARS_TASK_EVENT_FLAG_MASK_AND, NULL);
+ /* if bit == 1, try_wait returns SUCCESS */
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+ }
+ flags >>= 1;
+ chk_bit <<= 1;
+ }
+
+ return NULL;
+}
+
+static void *thread2_proc(void *ptr)
+{
+ int ret;
+ struct mars_task_args *task_args = (struct mars_task_args *)ptr;
+ uint32_t id = (uint32_t)task_args->type.u32[0];
+ uint32_t flags = task_args->type.u32[1];
+ uint32_t set_flags = task_args->type.u32[2];
+ uint32_t chk_bit;
+
+ /* wait condition OR */
+ ret = mars_task_event_flag_wait(
+ mpu_to_host_or[id],
+ flags,
+ MARS_TASK_EVENT_FLAG_MASK_OR, NULL);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+
+ /* check if all bits are cleard */
+ chk_bit = 0x01;
+ while (set_flags) {
+ if (set_flags & 0x01) {
+ ret = mars_task_event_flag_try_wait(
+ mpu_to_host_or[id],
+ chk_bit,
+ MARS_TASK_EVENT_FLAG_MASK_AND, NULL);
+ /* if bit == 1, try_wait returns SUCCESS */
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+ }
+ set_flags >>= 1;
+ chk_bit <<= 1;
+ }
+
+ return NULL;
+}
+
+int main(void)
+{
+ int ret, i;
+ int32_t exit_code;
+
+ ret = mars_context_create(&mars_ctx, 0, 0);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+
+ for (i = 0; i < NUM_PATTERNS; i++) {
+ ret = mars_task_event_flag_create(
+ mars_ctx,
+ &mpu_to_host_and[i],
+ MARS_TASK_EVENT_FLAG_MPU_TO_HOST,
+ MARS_TASK_EVENT_FLAG_CLEAR_MANUAL);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+
+ ret = mars_task_event_flag_create(
+ mars_ctx,
+ &mpu_to_host_or[i],
+ MARS_TASK_EVENT_FLAG_MPU_TO_HOST,
+ MARS_TASK_EVENT_FLAG_CLEAR_MANUAL);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+
+ ret = mars_task_create(mars_ctx, &task1_id, NULL,
+ mpu_prog.elf_image,
+ MARS_TASK_CONTEXT_SAVE_ALL);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+
+ ret = mars_task_create(mars_ctx, &task2_id, NULL,
+ mpu_prog.elf_image,
+ MARS_TASK_CONTEXT_SAVE_ALL);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+
+ thread1_args.type.u32[0] = (uint32_t)i;
+ thread1_args.type.u32[1] = pattern[i][0];
+ pthread_create(&thread1, NULL,
+ thread1_proc, &thread1_args);
+
+ thread2_args.type.u32[0] = (uint32_t)i;
+ thread2_args.type.u32[1] = pattern[i][0]; /* wait */
+ thread2_args.type.u32[2] = pattern[i][1]; /* set */
+ pthread_create(&thread2, NULL,
+ thread2_proc, &thread2_args);
+
+ /* set flags AND condition */
+ task1_args.type.u64[0] = mpu_to_host_and[i];
+ task1_args.type.u64[1] = (uint64_t)pattern[i][0];
+ ret = mars_task_schedule(&task1_id, &task1_args, 0);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+
+ /* set flags OR conditon */
+ task2_args.type.u64[0] = mpu_to_host_or[i];
+ task2_args.type.u64[1] = (uint64_t)pattern[i][1];
+ ret = mars_task_schedule(&task2_id, &task2_args, 0);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+
+ pthread_join(thread1, NULL);
+ pthread_join(thread2, NULL);
+
+ ret = mars_task_wait(&task1_id, &exit_code);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+ MARS_TEST_ASSERT_ERROR(exit_code, MARS_SUCCESS);
+
+ ret = mars_task_wait(&task2_id, &exit_code);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+ MARS_TEST_ASSERT_ERROR(exit_code, MARS_SUCCESS);
+
+ ret = mars_task_destroy(&task1_id);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+
+ ret = mars_task_destroy(&task2_id);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+
+ ret = mars_task_event_flag_destroy(mpu_to_host_and[i]);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+
+ ret = mars_task_event_flag_destroy(mpu_to_host_or[i]);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+ }
+
+ ret = mars_context_destroy(mars_ctx);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+
+ return 0;
+}
+
diff --git a/tests/TFP/TFP_35_014/mpu.c b/tests/TFP/TFP_35_014/mpu.c
new file mode 100644
index 0000000..4fdbceb
--- /dev/null
+++ b/tests/TFP/TFP_35_014/mpu.c
@@ -0,0 +1,37 @@
+/*
+ * Copyright 2008 Sony Corporation
+ *
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a copy
+ * of this software and associated documentation files (the "Software"), to deal
+ * in the Software without restriction, including without limitation the rights
+ * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+ * copies of the Software, and to permit persons to whom the Software is
+ * furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included in
+ * all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+ * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+ * THE SOFTWARE.
+ */
+
+#include <mars/mars.h>
+#include <mars_task_test.h>
+
+int mars_task_main(const struct mars_task_args *task_args)
+{
+ int ret;
+ uint64_t mpu_to_host_ea = task_args->type.u64[0];
+ uint32_t chk_bit = (uint32_t)task_args->type.u64[1];
+
+ ret = mars_task_event_flag_set(mpu_to_host_ea, chk_bit);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+
+ return 0;
+}
diff --git a/tests/TFP/TFP_35_015/Makefile b/tests/TFP/TFP_35_015/Makefile
new file mode 100644
index 0000000..72cf999
--- /dev/null
+++ b/tests/TFP/TFP_35_015/Makefile
@@ -0,0 +1,28 @@
+#
+# Copyright 2008 Sony Corporation
+#
+#
+# Permission is hereby granted, free of charge, to any person obtaining a copy
+# of this software and associated documentation files (the "Software"), to deal
+# in the Software without restriction, including without limitation the rights
+# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+# copies of the Software, and to permit persons to whom the Software is
+# furnished to do so, subject to the following conditions:
+#
+# The above copyright notice and this permission notice shall be included in
+# all copies or substantial portions of the Software.
+#
+# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+# THE SOFTWARE.
+#
+
+top_srcdir = ../..
+test_objs = host.o mpu1.task_eo mpu2.task_eo mpu3.task_eo
+
+include $(top_srcdir)/scripts/config.mk
+include $(top_srcdir)/scripts/rules_item.mk
diff --git a/tests/TFP/TFP_35_015/host.c b/tests/TFP/TFP_35_015/host.c
new file mode 100644
index 0000000..7d71347
--- /dev/null
+++ b/tests/TFP/TFP_35_015/host.c
@@ -0,0 +1,149 @@
+/*
+ * Copyright 2008 Sony Corporation
+ *
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a copy
+ * of this software and associated documentation files (the "Software"), to deal
+ * in the Software without restriction, including without limitation the rights
+ * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+ * copies of the Software, and to permit persons to whom the Software is
+ * furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included in
+ * all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+ * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+ * THE SOFTWARE.
+ */
+
+#include <unistd.h>
+#include <mars/mars.h>
+#include <libspe2.h>
+#include <mars_test.h>
+
+extern spe_program_handle_t mpu1_prog;
+extern spe_program_handle_t mpu2_prog;
+extern spe_program_handle_t mpu3_prog;
+#define NUM_PATTERNS 3
+static uint32_t pattern[NUM_PATTERNS][2] = {
+/* pattern or chk_bit */
+ { 0x00000001UL, 0x00000001UL },
+ { 0x0000CAFEUL, 0x00008000UL },
+ { 0x10203040UL, 0x10000000UL }
+};
+static struct mars_context *mars_ctx;
+static struct mars_task_id task1_id, task2_id, task3_id;
+static struct mars_task_args task1_args, task2_args, task3_args;
+static uint64_t mpu_to_mpu_and[NUM_PATTERNS];
+static uint64_t mpu_to_mpu_or[NUM_PATTERNS];
+
+int main(void)
+{
+ int ret, i;
+ int32_t exit_code;
+
+ ret = mars_context_create(&mars_ctx, 0, 0);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+
+ for (i = 0; i < NUM_PATTERNS; i++) {
+ ret = mars_task_event_flag_create(
+ mars_ctx,
+ &mpu_to_mpu_and[i],
+ MARS_TASK_EVENT_FLAG_MPU_TO_MPU,
+ MARS_TASK_EVENT_FLAG_CLEAR_MANUAL);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+
+ ret = mars_task_event_flag_create(
+ mars_ctx,
+ &mpu_to_mpu_or[i],
+ MARS_TASK_EVENT_FLAG_MPU_TO_MPU,
+ MARS_TASK_EVENT_FLAG_CLEAR_MANUAL);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+
+ ret = mars_task_create(mars_ctx, &task1_id, NULL,
+ mpu1_prog.elf_image, MARS_TASK_CONTEXT_SAVE_ALL);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+
+ ret = mars_task_create(mars_ctx, &task2_id, NULL,
+ mpu2_prog.elf_image, MARS_TASK_CONTEXT_SAVE_ALL);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+
+ task1_args.type.u64[0] = mpu_to_mpu_and[i];
+ task1_args.type.u64[1] = (uint64_t)pattern[i][0];
+ ret = mars_task_schedule(&task1_id, &task1_args, 0);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+
+ task2_args.type.u64[0] = mpu_to_mpu_or[i];
+ task2_args.type.u64[1] = (uint64_t)pattern[i][0];
+ task2_args.type.u64[2] = (uint64_t)pattern[i][1];
+ ret = mars_task_schedule(&task2_id, &task2_args, 0);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+
+ sleep(1);
+
+ /* set bits for AND wait condition */
+ ret = mars_task_create(mars_ctx, &task3_id, NULL,
+ mpu3_prog.elf_image, MARS_TASK_CONTEXT_SAVE_ALL);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+
+ task3_args.type.u64[0] = mpu_to_mpu_and[i];
+ task3_args.type.u64[1] = (uint64_t)pattern[i][0]; /* AND */
+ ret = mars_task_schedule(&task3_id, &task3_args, 0);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+
+ ret = mars_task_wait(&task3_id, &exit_code);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+ MARS_TEST_ASSERT_ERROR(exit_code, MARS_SUCCESS);
+
+ ret = mars_task_destroy(&task3_id);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+
+ /* set bit for OR wait condition */
+ ret = mars_task_create(mars_ctx, &task3_id, NULL,
+ mpu3_prog.elf_image, MARS_TASK_CONTEXT_SAVE_ALL);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+
+ task3_args.type.u64[0] = mpu_to_mpu_or[i];
+ task3_args.type.u64[1] = (uint64_t)pattern[i][1]; /* OR */
+ ret = mars_task_schedule(&task3_id, &task3_args, 0);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+
+ ret = mars_task_wait(&task3_id, &exit_code);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+ MARS_TEST_ASSERT_ERROR(exit_code, MARS_SUCCESS);
+
+ ret = mars_task_destroy(&task3_id);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+
+ /* wait flag_wait task */
+ ret = mars_task_wait(&task1_id, &exit_code);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+ MARS_TEST_ASSERT_ERROR(exit_code, MARS_SUCCESS);
+
+ ret = mars_task_wait(&task2_id, &exit_code);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+ MARS_TEST_ASSERT_ERROR(exit_code, MARS_SUCCESS);
+
+ ret = mars_task_destroy(&task1_id);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+
+ ret = mars_task_destroy(&task2_id);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+
+ ret = mars_task_event_flag_destroy(mpu_to_mpu_and[i]);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+ ret = mars_task_event_flag_destroy(mpu_to_mpu_or[i]);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+ }
+
+ ret = mars_context_destroy(mars_ctx);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+
+ return 0;
+}
+
diff --git a/tests/TFP/TFP_35_015/mpu1.c b/tests/TFP/TFP_35_015/mpu1.c
new file mode 100644
index 0000000..a820799
--- /dev/null
+++ b/tests/TFP/TFP_35_015/mpu1.c
@@ -0,0 +1,56 @@
+/*
+ * Copyright 2008 Sony Corporation
+ *
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a copy
+ * of this software and associated documentation files (the "Software"), to deal
+ * in the Software without restriction, including without limitation the rights
+ * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+ * copies of the Software, and to permit persons to whom the Software is
+ * furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included in
+ * all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+ * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+ * THE SOFTWARE.
+ */
+
+#include <mars/mars.h>
+#include <mars_task_test.h>
+
+int mars_task_main(const struct mars_task_args *task_args)
+{
+ int ret;
+ uint64_t mpu_to_mpu_ea = task_args->type.u64[0];
+ uint32_t flags = (uint32_t)task_args->type.u64[1];
+ uint32_t chk_bit;
+
+ /* wait condition AND */
+ ret = mars_task_event_flag_wait(
+ mpu_to_mpu_ea,
+ flags,
+ MARS_TASK_EVENT_FLAG_MASK_AND, NULL);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+
+ /* check if all bits are cleard */
+ chk_bit = 0x01;
+ while (flags) {
+ if (flags & 0x01) {
+ ret = mars_task_event_flag_try_wait(
+ mpu_to_mpu_ea,
+ chk_bit,
+ MARS_TASK_EVENT_FLAG_MASK_AND, NULL);
+ /* if bit == 1, try_wait returns SUCCESS */
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+ }
+ flags >>= 1;
+ chk_bit <<= 1;
+ }
+ return 0;
+}
diff --git a/tests/TFP/TFP_35_015/mpu2.c b/tests/TFP/TFP_35_015/mpu2.c
new file mode 100644
index 0000000..15bc476
--- /dev/null
+++ b/tests/TFP/TFP_35_015/mpu2.c
@@ -0,0 +1,57 @@
+/*
+ * Copyright 2008 Sony Corporation
+ *
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a copy
+ * of this software and associated documentation files (the "Software"), to deal
+ * in the Software without restriction, including without limitation the rights
+ * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+ * copies of the Software, and to permit persons to whom the Software is
+ * furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included in
+ * all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+ * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+ * THE SOFTWARE.
+ */
+
+#include <mars/mars.h>
+#include <mars_task_test.h>
+
+int mars_task_main(const struct mars_task_args *task_args)
+{
+ int ret;
+ uint64_t mpu_to_mpu_ea = task_args->type.u64[0];
+ uint32_t flags = (uint32_t)task_args->type.u64[1];
+ uint32_t set_flags = (uint32_t)task_args->type.u64[2];
+ uint32_t chk_bit;
+
+ /* wait condition OR */
+ ret = mars_task_event_flag_wait(
+ mpu_to_mpu_ea,
+ flags,
+ MARS_TASK_EVENT_FLAG_MASK_OR, NULL);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+
+ /* check if all bits are cleard */
+ chk_bit = 0x01;
+ while (set_flags) {
+ if (set_flags & 0x01) {
+ ret = mars_task_event_flag_try_wait(
+ mpu_to_mpu_ea,
+ chk_bit,
+ MARS_TASK_EVENT_FLAG_MASK_AND, NULL);
+ /* if bit == 1, try_wait returns SUCCESS */
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+ }
+ set_flags >>= 1;
+ chk_bit <<= 1;
+ }
+ return 0;
+}
diff --git a/tests/TFP/TFP_35_015/mpu3.c b/tests/TFP/TFP_35_015/mpu3.c
new file mode 100644
index 0000000..65f3252
--- /dev/null
+++ b/tests/TFP/TFP_35_015/mpu3.c
@@ -0,0 +1,37 @@
+/*
+ * Copyright 2008 Sony Corporation
+ *
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a copy
+ * of this software and associated documentation files (the "Software"), to deal
+ * in the Software without restriction, including without limitation the rights
+ * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+ * copies of the Software, and to permit persons to whom the Software is
+ * furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included in
+ * all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+ * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+ * THE SOFTWARE.
+ */
+
+#include <mars/mars.h>
+#include <mars_task_test.h>
+
+int mars_task_main(const struct mars_task_args *task_args)
+{
+ int ret;
+ uint64_t mpu_to_mpu_ea = task_args->type.u64[0];
+ uint32_t chk_bit = (uint32_t)task_args->type.u64[1];
+
+ ret = mars_task_event_flag_set(mpu_to_mpu_ea, chk_bit);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+
+ return 0;
+}
diff --git a/tests/TFP/TFP_35_016/Makefile b/tests/TFP/TFP_35_016/Makefile
new file mode 100644
index 0000000..432135a
--- /dev/null
+++ b/tests/TFP/TFP_35_016/Makefile
@@ -0,0 +1,28 @@
+#
+# Copyright 2008 Sony Corporation
+#
+#
+# Permission is hereby granted, free of charge, to any person obtaining a copy
+# of this software and associated documentation files (the "Software"), to deal
+# in the Software without restriction, including without limitation the rights
+# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+# copies of the Software, and to permit persons to whom the Software is
+# furnished to do so, subject to the following conditions:
+#
+# The above copyright notice and this permission notice shall be included in
+# all copies or substantial portions of the Software.
+#
+# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+# THE SOFTWARE.
+#
+
+top_srcdir = ../..
+test_objs = host.o mpu.task_eo
+
+include $(top_srcdir)/scripts/config.mk
+include $(top_srcdir)/scripts/rules_item.mk
diff --git a/tests/TFP/TFP_35_016/host.c b/tests/TFP/TFP_35_016/host.c
new file mode 100644
index 0000000..71f4a39
--- /dev/null
+++ b/tests/TFP/TFP_35_016/host.c
@@ -0,0 +1,108 @@
+/*
+ * Copyright 2008 Sony Corporation
+ *
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a copy
+ * of this software and associated documentation files (the "Software"), to deal
+ * in the Software without restriction, including without limitation the rights
+ * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+ * copies of the Software, and to permit persons to whom the Software is
+ * furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included in
+ * all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+ * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+ * THE SOFTWARE.
+ */
+
+#include <unistd.h>
+#include <mars/mars.h>
+#include <libspe2.h>
+#include <mars_test.h>
+
+#define TASK_MAX MARS_TASK_EVENT_FLAG_WAIT_MAX
+
+#define EVENT_FLAG_SIZE 32
+extern spe_program_handle_t mpu_prog;
+#define NUM_PATTERNS 5
+static uint32_t pattern[] = {
+ 0x00000001UL,
+ 0x0000CAFEUL,
+ 0x10203040UL,
+ 0x5A5A5A5AUL,
+ 0xFFFFFFFFUL
+};
+static struct mars_context *mars_ctx;
+static struct mars_task_id task_id[TASK_MAX];
+static struct mars_task_args task_args;
+static uint64_t host_to_mpu[NUM_PATTERNS];
+static uint32_t shared_resource[TASK_MAX * 4] __attribute((aligned(16)));
+
+int main(void)
+{
+ int ret, i, count;
+ int32_t exit_code;
+
+ ret = mars_context_create(&mars_ctx, 0, 0);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+
+ for (i = 0; i < NUM_PATTERNS; i++) {
+ ret = mars_task_event_flag_create(
+ mars_ctx,
+ &host_to_mpu[i],
+ MARS_TASK_EVENT_FLAG_HOST_TO_MPU,
+ MARS_TASK_EVENT_FLAG_CLEAR_AUTO);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+
+ /* create mpu tasks */
+ for (count = 0; count < TASK_MAX; count++) {
+ shared_resource[count * 4] = 0;
+ ret = mars_task_create(mars_ctx, &task_id[count], NULL,
+ mpu_prog.elf_image,
+ MARS_TASK_CONTEXT_SAVE_ALL);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+
+ task_args.type.u64[0] = host_to_mpu[i];
+ task_args.type.u64[1] = (uint64_t)pattern[i];
+ task_args.type.u64[2] =
+ mars_ptr_to_ea(&shared_resource[count * 4]);
+
+ ret = mars_task_schedule(&task_id[count],
+ &task_args, 0);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+ }
+
+ sleep(1);
+ /* check if all tasks are waiting */
+ for (count = 0; count < TASK_MAX; count++)
+ MARS_TEST_ASSERT_EQUAL(shared_resource[count * 4], 0);
+
+ /* set event flag */
+ ret = mars_task_event_flag_set(host_to_mpu[i], pattern[i]);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+
+ /* check if all waiting condition is satisfied */
+ for (count = 0; count < TASK_MAX; count++) {
+ ret = mars_task_wait(&task_id[count], &exit_code);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+ MARS_TEST_ASSERT_ERROR(exit_code, MARS_SUCCESS);
+
+ ret = mars_task_destroy(&task_id[count]);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+ }
+ ret = mars_task_event_flag_destroy(host_to_mpu[i]);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+ }
+
+ ret = mars_context_destroy(mars_ctx);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+
+ return 0;
+}
+
diff --git a/tests/TFP/TFP_35_016/mpu.c b/tests/TFP/TFP_35_016/mpu.c
new file mode 100644
index 0000000..3dbf0b8
--- /dev/null
+++ b/tests/TFP/TFP_35_016/mpu.c
@@ -0,0 +1,52 @@
+/*
+ * Copyright 2008 Sony Corporation
+ *
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a copy
+ * of this software and associated documentation files (the "Software"), to deal
+ * in the Software without restriction, including without limitation the rights
+ * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+ * copies of the Software, and to permit persons to whom the Software is
+ * furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included in
+ * all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+ * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+ * THE SOFTWARE.
+ */
+
+#include <mars/mars.h>
+#include <mars_task_test.h>
+#include <spu_mfcio.h>
+
+static uint32_t shared_resource __attribute((aligned(16)));
+
+int mars_task_main(const struct mars_task_args *task_args)
+{
+ int ret;
+ uint64_t host_to_mpu_ea = task_args->type.u64[0];
+ uint32_t chk_bit = (uint32_t)task_args->type.u64[1];
+ uint64_t shared_resource_ea = task_args->type.u64[2];
+
+ ret = mars_task_event_flag_wait(
+ host_to_mpu_ea,
+ chk_bit,
+ MARS_TASK_EVENT_FLAG_MASK_AND, NULL);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+
+ /* if program reaches here, shared_resource'll be updated */
+ shared_resource = 1;
+ mfc_put(&shared_resource, shared_resource_ea,
+ sizeof(uint32_t), 0, 0, 0);
+ mfc_write_tag_mask(1 << 0);
+ mfc_read_tag_status_all();
+
+
+ return 0;
+}
diff --git a/tests/TFP/TFP_35_017/Makefile b/tests/TFP/TFP_35_017/Makefile
new file mode 100644
index 0000000..432135a
--- /dev/null
+++ b/tests/TFP/TFP_35_017/Makefile
@@ -0,0 +1,28 @@
+#
+# Copyright 2008 Sony Corporation
+#
+#
+# Permission is hereby granted, free of charge, to any person obtaining a copy
+# of this software and associated documentation files (the "Software"), to deal
+# in the Software without restriction, including without limitation the rights
+# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+# copies of the Software, and to permit persons to whom the Software is
+# furnished to do so, subject to the following conditions:
+#
+# The above copyright notice and this permission notice shall be included in
+# all copies or substantial portions of the Software.
+#
+# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+# THE SOFTWARE.
+#
+
+top_srcdir = ../..
+test_objs = host.o mpu.task_eo
+
+include $(top_srcdir)/scripts/config.mk
+include $(top_srcdir)/scripts/rules_item.mk
diff --git a/tests/TFP/TFP_35_017/host.c b/tests/TFP/TFP_35_017/host.c
new file mode 100644
index 0000000..edb0874
--- /dev/null
+++ b/tests/TFP/TFP_35_017/host.c
@@ -0,0 +1,134 @@
+/*
+ * Copyright 2008 Sony Corporation
+ *
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a copy
+ * of this software and associated documentation files (the "Software"), to deal
+ * in the Software without restriction, including without limitation the rights
+ * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+ * copies of the Software, and to permit persons to whom the Software is
+ * furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included in
+ * all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+ * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+ * THE SOFTWARE.
+ */
+
+#include <pthread.h>
+#include <unistd.h>
+#include <mars/mars.h>
+#include <libspe2.h>
+#include <mars_test.h>
+
+#define TASK_MAX MARS_TASK_EVENT_FLAG_WAIT_MAX
+
+#define EVENT_FLAG_SIZE 32
+
+extern spe_program_handle_t mpu_prog;
+#define NUM_PATTERNS 5
+static uint32_t pattern[] = {
+ 0x00000001UL,
+ 0x0000CAFEUL,
+ 0x10203040UL,
+ 0x5A5A5A5AUL,
+ 0xFFFFFFFFUL
+};
+static struct mars_context *mars_ctx;
+static struct mars_task_id task_id;
+static struct mars_task_args task_args, thread_args[TASK_MAX];
+static uint64_t mpu_to_host[NUM_PATTERNS];
+static uint32_t shared_resource[TASK_MAX] __attribute((aligned(16)));
+
+static pthread_t thread[TASK_MAX];
+
+static void *thread_proc(void *ptr)
+{
+ int ret;
+ struct mars_task_args *task_args = (struct mars_task_args *)ptr;
+ uint32_t i = (uint32_t)task_args->type.u32[0];
+ uint32_t chk_bit = task_args->type.u32[1];
+ uint32_t count = (uint32_t)task_args->type.u32[2];
+
+ ret = mars_task_event_flag_wait(
+ mpu_to_host[i],
+ chk_bit,
+ MARS_TASK_EVENT_FLAG_MASK_AND, NULL);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+
+ /* if program reaches here, shared_resource'll be updated */
+ shared_resource[count] = 1;
+
+ return NULL;
+}
+
+int main(void)
+{
+ int ret, i, count;
+ int32_t exit_code;
+
+ ret = mars_context_create(&mars_ctx, 0, 0);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+
+ for (i = 0; i < NUM_PATTERNS; i++) {
+ /* use CLEAR_MANUAL sice there is no wait queue for host-side waits */
+ ret = mars_task_event_flag_create(
+ mars_ctx,
+ &mpu_to_host[i],
+ MARS_TASK_EVENT_FLAG_MPU_TO_HOST,
+ MARS_TASK_EVENT_FLAG_CLEAR_MANUAL);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+
+ /* create ppe threads */
+ for (count = 0; count < TASK_MAX; count++) {
+ shared_resource[count] = 0;
+ thread_args[count].type.u32[0] = (uint32_t)i;
+ thread_args[count].type.u32[1] = (uint32_t)pattern[i];
+ thread_args[count].type.u32[2] = (uint32_t)count;
+ pthread_create(&thread[count], NULL,
+ thread_proc, &thread_args[count]);
+ }
+
+ sleep(1);
+ /* check if all threads are waiting */
+ for (count = 0; count < TASK_MAX; count++)
+ MARS_TEST_ASSERT_EQUAL(shared_resource[count], 0);
+
+ /* create mars task and set event flag */
+ ret = mars_task_create(mars_ctx, &task_id, NULL,
+ mpu_prog.elf_image,
+ MARS_TASK_CONTEXT_SAVE_ALL);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+
+ task_args.type.u64[0] = mpu_to_host[i];
+ task_args.type.u64[1] = (uint64_t)pattern[i];
+ ret = mars_task_schedule(&task_id, &task_args, 0);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+
+ ret = mars_task_wait(&task_id, &exit_code);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+ MARS_TEST_ASSERT_ERROR(exit_code, MARS_SUCCESS);
+
+ /* check if all waiting conditon is satisfied */
+ for (count = 0; count < TASK_MAX; count++)
+ pthread_join(thread[count], NULL);
+
+ ret = mars_task_destroy(&task_id);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+
+ ret = mars_task_event_flag_destroy(mpu_to_host[i]);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+ }
+
+ ret = mars_context_destroy(mars_ctx);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+
+ return 0;
+}
+
diff --git a/tests/TFP/TFP_35_017/mpu.c b/tests/TFP/TFP_35_017/mpu.c
new file mode 100644
index 0000000..4fdbceb
--- /dev/null
+++ b/tests/TFP/TFP_35_017/mpu.c
@@ -0,0 +1,37 @@
+/*
+ * Copyright 2008 Sony Corporation
+ *
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a copy
+ * of this software and associated documentation files (the "Software"), to deal
+ * in the Software without restriction, including without limitation the rights
+ * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+ * copies of the Software, and to permit persons to whom the Software is
+ * furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included in
+ * all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+ * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+ * THE SOFTWARE.
+ */
+
+#include <mars/mars.h>
+#include <mars_task_test.h>
+
+int mars_task_main(const struct mars_task_args *task_args)
+{
+ int ret;
+ uint64_t mpu_to_host_ea = task_args->type.u64[0];
+ uint32_t chk_bit = (uint32_t)task_args->type.u64[1];
+
+ ret = mars_task_event_flag_set(mpu_to_host_ea, chk_bit);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+
+ return 0;
+}
diff --git a/tests/TFP/TFP_35_018/Makefile b/tests/TFP/TFP_35_018/Makefile
new file mode 100644
index 0000000..ecbce33
--- /dev/null
+++ b/tests/TFP/TFP_35_018/Makefile
@@ -0,0 +1,28 @@
+#
+# Copyright 2008 Sony Corporation
+#
+#
+# Permission is hereby granted, free of charge, to any person obtaining a copy
+# of this software and associated documentation files (the "Software"), to deal
+# in the Software without restriction, including without limitation the rights
+# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+# copies of the Software, and to permit persons to whom the Software is
+# furnished to do so, subject to the following conditions:
+#
+# The above copyright notice and this permission notice shall be included in
+# all copies or substantial portions of the Software.
+#
+# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+# THE SOFTWARE.
+#
+
+top_srcdir = ../..
+test_objs = host.o mpu1.task_eo mpu2.task_eo
+
+include $(top_srcdir)/scripts/config.mk
+include $(top_srcdir)/scripts/rules_item.mk
diff --git a/tests/TFP/TFP_35_018/host.c b/tests/TFP/TFP_35_018/host.c
new file mode 100644
index 0000000..709ac45
--- /dev/null
+++ b/tests/TFP/TFP_35_018/host.c
@@ -0,0 +1,124 @@
+/*
+ * Copyright 2008 Sony Corporation
+ *
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a copy
+ * of this software and associated documentation files (the "Software"), to deal
+ * in the Software without restriction, including without limitation the rights
+ * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+ * copies of the Software, and to permit persons to whom the Software is
+ * furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included in
+ * all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+ * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+ * THE SOFTWARE.
+ */
+
+#include <unistd.h>
+#include <mars/mars.h>
+#include <libspe2.h>
+#include <mars_test.h>
+
+#define TASK_MAX MARS_TASK_EVENT_FLAG_WAIT_MAX
+
+#define EVENT_FLAG_SIZE 32
+extern spe_program_handle_t mpu1_prog;
+extern spe_program_handle_t mpu2_prog;
+#define NUM_PATTERNS 5
+static uint32_t pattern[NUM_PATTERNS] = {
+ 0x00000001UL,
+ 0x0000CAFEUL,
+ 0x10203040UL,
+ 0x5A5A5A5AUL,
+ 0xFFFFFFFFUL
+};
+static struct mars_context *mars_ctx;
+static struct mars_task_id task_id[TASK_MAX], task2_id;
+static struct mars_task_args task_args, task2_args;
+static uint64_t mpu_to_mpu[NUM_PATTERNS];
+static uint32_t shared_resource[TASK_MAX * 4] __attribute((aligned(16)));
+
+int main(void)
+{
+ int ret, i, count;
+ int32_t exit_code;
+
+ ret = mars_context_create(&mars_ctx, 0, 0);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+
+ for (i = 0; i < NUM_PATTERNS; i++) {
+ ret = mars_task_event_flag_create(
+ mars_ctx,
+ &mpu_to_mpu[i],
+ MARS_TASK_EVENT_FLAG_MPU_TO_MPU,
+ MARS_TASK_EVENT_FLAG_CLEAR_AUTO);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+
+ /* create wait mpu tasks */
+ for (count = 0; count < TASK_MAX; count++) {
+ shared_resource[count * 4] = 0;
+ ret = mars_task_create(mars_ctx, &task_id[count], NULL,
+ mpu1_prog.elf_image,
+ MARS_TASK_CONTEXT_SAVE_ALL);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+
+ task_args.type.u64[0] = mpu_to_mpu[i];
+ task_args.type.u64[1] = (uint64_t)pattern[i];
+ task_args.type.u64[2] =
+ mars_ptr_to_ea(&shared_resource[count * 4]);
+
+ ret = mars_task_schedule(&task_id[count],
+ &task_args, 0);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+ }
+
+ sleep(1);
+ /* check if all tasks are waiting */
+ for (count = 0; count < TASK_MAX; count++)
+ MARS_TEST_ASSERT_EQUAL(shared_resource[count * 4], 0);
+
+ /* create set flag task */
+ ret = mars_task_create(mars_ctx, &task2_id, NULL,
+ mpu2_prog.elf_image,
+ MARS_TASK_CONTEXT_SAVE_ALL);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+
+ task2_args.type.u64[0] = mpu_to_mpu[i];
+ task2_args.type.u64[1] = (uint64_t)pattern[i];
+ ret = mars_task_schedule(&task2_id, &task2_args, 0);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+
+ ret = mars_task_wait(&task2_id, &exit_code);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+ MARS_TEST_ASSERT_ERROR(exit_code, MARS_SUCCESS);
+
+ /* check if all waiting condition is satisfied */
+ for (count = 0; count < TASK_MAX; count++) {
+ ret = mars_task_wait(&task_id[count], &exit_code);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+ MARS_TEST_ASSERT_ERROR(exit_code, MARS_SUCCESS);
+
+ ret = mars_task_destroy(&task_id[count]);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+ }
+
+ ret = mars_task_destroy(&task2_id);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+
+ ret = mars_task_event_flag_destroy(mpu_to_mpu[i]);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+ }
+
+ ret = mars_context_destroy(mars_ctx);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+
+ return 0;
+}
+
diff --git a/tests/TFP/TFP_35_018/mpu1.c b/tests/TFP/TFP_35_018/mpu1.c
new file mode 100644
index 0000000..354cf93
--- /dev/null
+++ b/tests/TFP/TFP_35_018/mpu1.c
@@ -0,0 +1,52 @@
+/*
+ * Copyright 2008 Sony Corporation
+ *
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a copy
+ * of this software and associated documentation files (the "Software"), to deal
+ * in the Software without restriction, including without limitation the rights
+ * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+ * copies of the Software, and to permit persons to whom the Software is
+ * furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included in
+ * all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+ * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+ * THE SOFTWARE.
+ */
+
+#include <mars/mars.h>
+#include <mars_task_test.h>
+#include <spu_mfcio.h>
+
+static uint32_t shared_resource __attribute((aligned(16)));
+
+int mars_task_main(const struct mars_task_args *task_args)
+{
+ int ret;
+ uint64_t mpu_to_mpu_ea = task_args->type.u64[0];
+ uint32_t chk_bit = (uint32_t)task_args->type.u64[1];
+ uint64_t shared_resource_ea = task_args->type.u64[2];
+
+ ret = mars_task_event_flag_wait(
+ mpu_to_mpu_ea,
+ chk_bit,
+ MARS_TASK_EVENT_FLAG_MASK_AND, NULL);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+
+ /* if program reaches here, shared_resource'll be updated */
+ shared_resource = 1;
+ mfc_put(&shared_resource, shared_resource_ea,
+ sizeof(uint32_t), 0, 0, 0);
+ mfc_write_tag_mask(1 << 0);
+ mfc_read_tag_status_all();
+
+
+ return 0;
+}
diff --git a/tests/TFP/TFP_35_018/mpu2.c b/tests/TFP/TFP_35_018/mpu2.c
new file mode 100644
index 0000000..65f3252
--- /dev/null
+++ b/tests/TFP/TFP_35_018/mpu2.c
@@ -0,0 +1,37 @@
+/*
+ * Copyright 2008 Sony Corporation
+ *
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a copy
+ * of this software and associated documentation files (the "Software"), to deal
+ * in the Software without restriction, including without limitation the rights
+ * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+ * copies of the Software, and to permit persons to whom the Software is
+ * furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included in
+ * all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+ * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+ * THE SOFTWARE.
+ */
+
+#include <mars/mars.h>
+#include <mars_task_test.h>
+
+int mars_task_main(const struct mars_task_args *task_args)
+{
+ int ret;
+ uint64_t mpu_to_mpu_ea = task_args->type.u64[0];
+ uint32_t chk_bit = (uint32_t)task_args->type.u64[1];
+
+ ret = mars_task_event_flag_set(mpu_to_mpu_ea, chk_bit);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+
+ return 0;
+}
diff --git a/tests/TFP/TFP_36_001/Makefile b/tests/TFP/TFP_36_001/Makefile
new file mode 100644
index 0000000..432135a
--- /dev/null
+++ b/tests/TFP/TFP_36_001/Makefile
@@ -0,0 +1,28 @@
+#
+# Copyright 2008 Sony Corporation
+#
+#
+# Permission is hereby granted, free of charge, to any person obtaining a copy
+# of this software and associated documentation files (the "Software"), to deal
+# in the Software without restriction, including without limitation the rights
+# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+# copies of the Software, and to permit persons to whom the Software is
+# furnished to do so, subject to the following conditions:
+#
+# The above copyright notice and this permission notice shall be included in
+# all copies or substantial portions of the Software.
+#
+# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+# THE SOFTWARE.
+#
+
+top_srcdir = ../..
+test_objs = host.o mpu.task_eo
+
+include $(top_srcdir)/scripts/config.mk
+include $(top_srcdir)/scripts/rules_item.mk
diff --git a/tests/TFP/TFP_36_001/host.c b/tests/TFP/TFP_36_001/host.c
new file mode 100644
index 0000000..7d2dc73
--- /dev/null
+++ b/tests/TFP/TFP_36_001/host.c
@@ -0,0 +1,103 @@
+/*
+ * Copyright 2008 Sony Corporation
+ *
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a copy
+ * of this software and associated documentation files (the "Software"), to deal
+ * in the Software without restriction, including without limitation the rights
+ * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+ * copies of the Software, and to permit persons to whom the Software is
+ * furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included in
+ * all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+ * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+ * THE SOFTWARE.
+ */
+
+#include <unistd.h>
+#include <mars/mars.h>
+#include <libspe2.h>
+#include <mars_test.h>
+
+extern spe_program_handle_t mpu_prog;
+#define NUM_PATTERNS 3
+static uint32_t pattern[NUM_PATTERNS][2] = {
+ { 8, 0x000000FFUL },
+ { 16, 0x0000FFFFUL },
+ { 32, 0xFFFFFFFFUL }
+};
+static struct mars_context *mars_ctx;
+static struct mars_task_id task_id;
+static struct mars_task_args task_args;
+static uint64_t host_to_mpu[NUM_PATTERNS];
+static uint32_t shared_resource __attribute__((aligned(16)));
+
+int main(void)
+{
+ int ret, i, bits;
+ uint32_t chk_bit;
+ int32_t exit_code;
+
+ ret = mars_context_create(&mars_ctx, 0, 0);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+
+ for (i = 0; i < NUM_PATTERNS; i++) {
+ shared_resource = 0;
+ ret = mars_task_event_flag_create(
+ mars_ctx,
+ &host_to_mpu[i],
+ MARS_TASK_EVENT_FLAG_HOST_TO_MPU,
+ MARS_TASK_EVENT_FLAG_CLEAR_AUTO);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+
+ ret = mars_task_create(mars_ctx, &task_id, NULL,
+ mpu_prog.elf_image, MARS_TASK_CONTEXT_SAVE_ALL);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+
+ task_args.type.u64[0] = host_to_mpu[i];
+ task_args.type.u64[1] = (uint64_t)pattern[i][1];
+ task_args.type.u64[2] = mars_ptr_to_ea(&shared_resource);
+ ret = mars_task_schedule(&task_id, &task_args, 0);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+
+ chk_bit = 0x01;
+ for (bits = 0; bits < pattern[i][0] - 1; bits++) {
+ ret = mars_task_event_flag_set(
+ host_to_mpu[i], chk_bit);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+ chk_bit <<= 1;
+ }
+ sleep(1);
+ /* check if mpu task doesn't returen MARS_SUCCESS */
+ MARS_TEST_ASSERT_EQUAL(shared_resource, 0);
+
+ /* set last one bit */
+ ret = mars_task_event_flag_set(
+ host_to_mpu[i], chk_bit);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+
+ ret = mars_task_wait(&task_id, &exit_code);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+ MARS_TEST_ASSERT_ERROR(exit_code, MARS_SUCCESS);
+
+ ret = mars_task_destroy(&task_id);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+
+ ret = mars_task_event_flag_destroy(host_to_mpu[i]);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+ }
+
+
+ ret = mars_context_destroy(mars_ctx);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+
+ return 0;
+}
+
diff --git a/tests/TFP/TFP_36_001/mpu.c b/tests/TFP/TFP_36_001/mpu.c
new file mode 100644
index 0000000..26cb256
--- /dev/null
+++ b/tests/TFP/TFP_36_001/mpu.c
@@ -0,0 +1,58 @@
+/*
+ * Copyright 2008 Sony Corporation
+ *
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a copy
+ * of this software and associated documentation files (the "Software"), to deal
+ * in the Software without restriction, including without limitation the rights
+ * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+ * copies of the Software, and to permit persons to whom the Software is
+ * furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included in
+ * all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+ * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+ * THE SOFTWARE.
+ */
+
+#include <mars/mars.h>
+#include <mars_task_test.h>
+#include <spu_mfcio.h>
+
+static uint32_t shared_resource __attribute((aligned(16)));
+
+int mars_task_main(const struct mars_task_args *task_args)
+{
+ int ret;
+ uint64_t host_to_mpu_ea = task_args->type.u64[0];
+ uint32_t chk_bit = (uint32_t)task_args->type.u64[1];
+ uint64_t shared_resource_ea = task_args->type.u64[2];
+
+ while (1) {
+ ret = mars_task_event_flag_try_wait(
+ host_to_mpu_ea,
+ chk_bit,
+ MARS_TASK_EVENT_FLAG_MASK_AND, NULL);
+ if (ret == MARS_SUCCESS)
+ break;
+ else if (ret == MARS_ERROR_BUSY)
+ continue;
+ else
+ MARS_TEST_ASSERT_ERROR(ret, 0);
+ }
+
+ /* if program reaches here, shared_resource'll be updated */
+ shared_resource = 1;
+ mfc_put(&shared_resource, shared_resource_ea,
+ sizeof(uint32_t), 0, 0, 0);
+ mfc_write_tag_mask(1 << 0);
+ mfc_read_tag_status_all();
+
+ return 0;
+}
diff --git a/tests/TFP/TFP_36_002/Makefile b/tests/TFP/TFP_36_002/Makefile
new file mode 100644
index 0000000..432135a
--- /dev/null
+++ b/tests/TFP/TFP_36_002/Makefile
@@ -0,0 +1,28 @@
+#
+# Copyright 2008 Sony Corporation
+#
+#
+# Permission is hereby granted, free of charge, to any person obtaining a copy
+# of this software and associated documentation files (the "Software"), to deal
+# in the Software without restriction, including without limitation the rights
+# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+# copies of the Software, and to permit persons to whom the Software is
+# furnished to do so, subject to the following conditions:
+#
+# The above copyright notice and this permission notice shall be included in
+# all copies or substantial portions of the Software.
+#
+# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+# THE SOFTWARE.
+#
+
+top_srcdir = ../..
+test_objs = host.o mpu.task_eo
+
+include $(top_srcdir)/scripts/config.mk
+include $(top_srcdir)/scripts/rules_item.mk
diff --git a/tests/TFP/TFP_36_002/host.c b/tests/TFP/TFP_36_002/host.c
new file mode 100644
index 0000000..635836e
--- /dev/null
+++ b/tests/TFP/TFP_36_002/host.c
@@ -0,0 +1,132 @@
+/*
+ * Copyright 2008 Sony Corporation
+ *
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a copy
+ * of this software and associated documentation files (the "Software"), to deal
+ * in the Software without restriction, including without limitation the rights
+ * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+ * copies of the Software, and to permit persons to whom the Software is
+ * furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included in
+ * all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+ * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+ * THE SOFTWARE.
+ */
+
+#include <pthread.h>
+#include <mars/mars.h>
+#include <libspe2.h>
+#include <mars_test.h>
+
+#define EVENT_FLAG_SIZE 32
+
+extern spe_program_handle_t mpu_prog;
+#define NUM_PATTERNS 3
+static uint32_t pattern[NUM_PATTERNS][2] = {
+ { 8, 0x000000FFUL },
+ { 16, 0x0000FFFFUL },
+ { 32, 0xFFFFFFFFUL }
+};
+static struct mars_context *mars_ctx;
+static struct mars_task_id task_id[EVENT_FLAG_SIZE];
+static struct mars_task_args task_args, thread_args[NUM_PATTERNS];
+static uint64_t mpu_to_host[NUM_PATTERNS];
+static pthread_t thread[NUM_PATTERNS];
+static uint32_t shared_resource __attribute((aligned(16)));
+
+static void *thread_proc(void *ptr)
+{
+ int ret;
+ struct mars_task_args *task_args = (struct mars_task_args *)ptr;
+ uint32_t i = (uint32_t)task_args->type.u32[0];
+ uint32_t chk_bit = task_args->type.u32[1];
+
+ while (1) {
+ ret = mars_task_event_flag_try_wait(
+ mpu_to_host[i],
+ chk_bit,
+ MARS_TASK_EVENT_FLAG_MASK_AND, NULL);
+ if (ret == MARS_SUCCESS)
+ break;
+ else if (ret == MARS_ERROR_BUSY)
+ continue;
+ else
+ MARS_TEST_ASSERT_ERROR(ret, 0);
+ }
+
+ /* if program reaches here, shared_resource'll be updated */
+ shared_resource = 1;
+
+ return NULL;
+}
+
+int main(void)
+{
+ int ret, i, bits;
+ uint32_t chk_bit;
+ int32_t exit_code;
+
+ ret = mars_context_create(&mars_ctx, 0, 0);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+
+ for (i = 0; i < NUM_PATTERNS; i++) {
+ shared_resource = 0;
+ ret = mars_task_event_flag_create(
+ mars_ctx,
+ &mpu_to_host[i],
+ MARS_TASK_EVENT_FLAG_MPU_TO_HOST,
+ MARS_TASK_EVENT_FLAG_CLEAR_AUTO);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+
+ thread_args[i].type.u32[0] = (uint32_t)i;
+ thread_args[i].type.u32[1] = pattern[i][1];
+ pthread_create(&thread[i], NULL,
+ thread_proc, &thread_args[i]);
+
+ chk_bit = 0x01;
+ for (bits = 0; bits < pattern[i][0]; bits++) {
+ ret = mars_task_create(mars_ctx, &task_id[bits], NULL,
+ mpu_prog.elf_image,
+ MARS_TASK_CONTEXT_SAVE_ALL);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+
+ /* mpu tasks will set event_flags */
+ task_args.type.u64[0] = mpu_to_host[i];
+ task_args.type.u64[1] = (uint64_t)chk_bit;
+ ret = mars_task_schedule(&task_id[bits], &task_args, 0);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+
+ ret = mars_task_wait(&task_id[bits], &exit_code);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+ MARS_TEST_ASSERT_ERROR(exit_code, MARS_SUCCESS);
+
+ ret = mars_task_destroy(&task_id[bits]);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+
+ /* check if mpu task doesn't returen MARS_SUCCESS */
+ if (bits != (pattern[i][0] - 1))
+ MARS_TEST_ASSERT_EQUAL(shared_resource, 0);
+
+ chk_bit <<= 1;
+ }
+
+ pthread_join(thread[i], NULL);
+
+ ret = mars_task_event_flag_destroy(mpu_to_host[i]);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+ }
+
+ ret = mars_context_destroy(mars_ctx);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+
+ return 0;
+}
+
diff --git a/tests/TFP/TFP_36_002/mpu.c b/tests/TFP/TFP_36_002/mpu.c
new file mode 100644
index 0000000..4fdbceb
--- /dev/null
+++ b/tests/TFP/TFP_36_002/mpu.c
@@ -0,0 +1,37 @@
+/*
+ * Copyright 2008 Sony Corporation
+ *
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a copy
+ * of this software and associated documentation files (the "Software"), to deal
+ * in the Software without restriction, including without limitation the rights
+ * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+ * copies of the Software, and to permit persons to whom the Software is
+ * furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included in
+ * all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+ * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+ * THE SOFTWARE.
+ */
+
+#include <mars/mars.h>
+#include <mars_task_test.h>
+
+int mars_task_main(const struct mars_task_args *task_args)
+{
+ int ret;
+ uint64_t mpu_to_host_ea = task_args->type.u64[0];
+ uint32_t chk_bit = (uint32_t)task_args->type.u64[1];
+
+ ret = mars_task_event_flag_set(mpu_to_host_ea, chk_bit);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+
+ return 0;
+}
diff --git a/tests/TFP/TFP_36_003/Makefile b/tests/TFP/TFP_36_003/Makefile
new file mode 100644
index 0000000..ecbce33
--- /dev/null
+++ b/tests/TFP/TFP_36_003/Makefile
@@ -0,0 +1,28 @@
+#
+# Copyright 2008 Sony Corporation
+#
+#
+# Permission is hereby granted, free of charge, to any person obtaining a copy
+# of this software and associated documentation files (the "Software"), to deal
+# in the Software without restriction, including without limitation the rights
+# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+# copies of the Software, and to permit persons to whom the Software is
+# furnished to do so, subject to the following conditions:
+#
+# The above copyright notice and this permission notice shall be included in
+# all copies or substantial portions of the Software.
+#
+# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+# THE SOFTWARE.
+#
+
+top_srcdir = ../..
+test_objs = host.o mpu1.task_eo mpu2.task_eo
+
+include $(top_srcdir)/scripts/config.mk
+include $(top_srcdir)/scripts/rules_item.mk
diff --git a/tests/TFP/TFP_36_003/host.c b/tests/TFP/TFP_36_003/host.c
new file mode 100644
index 0000000..4eb8999
--- /dev/null
+++ b/tests/TFP/TFP_36_003/host.c
@@ -0,0 +1,116 @@
+/*
+ * Copyright 2008 Sony Corporation
+ *
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a copy
+ * of this software and associated documentation files (the "Software"), to deal
+ * in the Software without restriction, including without limitation the rights
+ * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+ * copies of the Software, and to permit persons to whom the Software is
+ * furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included in
+ * all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+ * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+ * THE SOFTWARE.
+ */
+
+#include <unistd.h>
+#include <mars/mars.h>
+#include <libspe2.h>
+#include <mars_test.h>
+
+extern spe_program_handle_t mpu1_prog;
+extern spe_program_handle_t mpu2_prog;
+#define NUM_PATTERNS 3
+static uint32_t pattern[NUM_PATTERNS][2] = {
+ { 8, 0x000000FFUL },
+ { 16, 0x0000FFFFUL },
+ { 32, 0xFFFFFFFFUL }
+};
+static struct mars_context *mars_ctx;
+static struct mars_task_id task1_id, task2_id;
+static struct mars_task_args task1_args, task2_args;
+static uint64_t mpu_to_mpu[NUM_PATTERNS];
+static uint32_t shared_resource __attribute__((aligned(16)));
+
+int main(void)
+{
+ int ret, i, bits;
+ uint32_t chk_bit;
+ int32_t exit_code;
+
+ ret = mars_context_create(&mars_ctx, 0, 0);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+
+ for (i = 0; i < NUM_PATTERNS; i++) {
+ shared_resource = 0;
+ ret = mars_task_event_flag_create(
+ mars_ctx,
+ &mpu_to_mpu[i],
+ MARS_TASK_EVENT_FLAG_MPU_TO_MPU,
+ MARS_TASK_EVENT_FLAG_CLEAR_AUTO);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+
+ ret = mars_task_create(mars_ctx, &task1_id, NULL,
+ mpu1_prog.elf_image, MARS_TASK_CONTEXT_SAVE_ALL);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+
+ task1_args.type.u64[0] = mpu_to_mpu[i];
+ task1_args.type.u64[1] = (uint64_t)pattern[i][1];
+ task1_args.type.u64[2] = mars_ptr_to_ea(&shared_resource);
+ ret = mars_task_schedule(&task1_id, &task1_args, 0);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+
+ chk_bit = 0x01;
+ for (bits = 0; bits < pattern[i][0]; bits++) {
+ /* create flag_set task */
+ ret = mars_task_create(mars_ctx, &task2_id, NULL,
+ mpu2_prog.elf_image,
+ MARS_TASK_CONTEXT_SAVE_ALL);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+
+ /* mpu tasks will set event_flags */
+ task2_args.type.u64[0] = mpu_to_mpu[i];
+ task2_args.type.u64[1] = (uint64_t)chk_bit;
+ ret = mars_task_schedule(&task2_id, &task2_args, 0);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+
+ ret = mars_task_wait(&task2_id, &exit_code);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+ MARS_TEST_ASSERT_ERROR(exit_code, MARS_SUCCESS);
+
+ ret = mars_task_destroy(&task2_id);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+
+ /* check if wait task doesn't returen MARS_SUCCESS */
+ if (bits != (pattern[i][0] - 1))
+ MARS_TEST_ASSERT_EQUAL(shared_resource, 0);
+
+ chk_bit <<= 1;
+ }
+
+ /* wait task return MARS_SUCCESS and finished */
+ ret = mars_task_wait(&task1_id, &exit_code);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+ MARS_TEST_ASSERT_ERROR(exit_code, MARS_SUCCESS);
+
+ ret = mars_task_destroy(&task1_id);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+
+ ret = mars_task_event_flag_destroy(mpu_to_mpu[i]);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+ }
+
+ ret = mars_context_destroy(mars_ctx);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+
+ return 0;
+}
+
diff --git a/tests/TFP/TFP_36_003/mpu1.c b/tests/TFP/TFP_36_003/mpu1.c
new file mode 100644
index 0000000..a59c7f6
--- /dev/null
+++ b/tests/TFP/TFP_36_003/mpu1.c
@@ -0,0 +1,58 @@
+/*
+ * Copyright 2008 Sony Corporation
+ *
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a copy
+ * of this software and associated documentation files (the "Software"), to deal
+ * in the Software without restriction, including without limitation the rights
+ * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+ * copies of the Software, and to permit persons to whom the Software is
+ * furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included in
+ * all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+ * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+ * THE SOFTWARE.
+ */
+
+#include <mars/mars.h>
+#include <mars_task_test.h>
+#include <spu_mfcio.h>
+
+static uint32_t shared_resource __attribute((aligned(16)));
+
+int mars_task_main(const struct mars_task_args *task_args)
+{
+ int ret;
+ uint64_t mpu_to_mpu_ea = task_args->type.u64[0];
+ uint32_t chk_bit = (uint32_t)task_args->type.u64[1];
+ uint64_t shared_resource_ea = task_args->type.u64[2];
+
+ while (1) {
+ ret = mars_task_event_flag_try_wait(
+ mpu_to_mpu_ea,
+ chk_bit,
+ MARS_TASK_EVENT_FLAG_MASK_AND, NULL);
+ if (ret == MARS_SUCCESS)
+ break;
+ else if (ret == MARS_ERROR_BUSY)
+ continue;
+ else
+ MARS_TEST_ASSERT_ERROR(ret, 0);
+ }
+
+ /* if program reaches here, shared_resource'll be updated */
+ shared_resource = 1;
+ mfc_put(&shared_resource, shared_resource_ea,
+ sizeof(uint32_t), 0, 0, 0);
+ mfc_write_tag_mask(1 << 0);
+ mfc_read_tag_status_all();
+
+ return 0;
+}
diff --git a/tests/TFP/TFP_36_003/mpu2.c b/tests/TFP/TFP_36_003/mpu2.c
new file mode 100644
index 0000000..65f3252
--- /dev/null
+++ b/tests/TFP/TFP_36_003/mpu2.c
@@ -0,0 +1,37 @@
+/*
+ * Copyright 2008 Sony Corporation
+ *
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a copy
+ * of this software and associated documentation files (the "Software"), to deal
+ * in the Software without restriction, including without limitation the rights
+ * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+ * copies of the Software, and to permit persons to whom the Software is
+ * furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included in
+ * all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+ * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+ * THE SOFTWARE.
+ */
+
+#include <mars/mars.h>
+#include <mars_task_test.h>
+
+int mars_task_main(const struct mars_task_args *task_args)
+{
+ int ret;
+ uint64_t mpu_to_mpu_ea = task_args->type.u64[0];
+ uint32_t chk_bit = (uint32_t)task_args->type.u64[1];
+
+ ret = mars_task_event_flag_set(mpu_to_mpu_ea, chk_bit);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+
+ return 0;
+}
diff --git a/tests/TFP/TFP_36_004/Makefile b/tests/TFP/TFP_36_004/Makefile
new file mode 100644
index 0000000..432135a
--- /dev/null
+++ b/tests/TFP/TFP_36_004/Makefile
@@ -0,0 +1,28 @@
+#
+# Copyright 2008 Sony Corporation
+#
+#
+# Permission is hereby granted, free of charge, to any person obtaining a copy
+# of this software and associated documentation files (the "Software"), to deal
+# in the Software without restriction, including without limitation the rights
+# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+# copies of the Software, and to permit persons to whom the Software is
+# furnished to do so, subject to the following conditions:
+#
+# The above copyright notice and this permission notice shall be included in
+# all copies or substantial portions of the Software.
+#
+# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+# THE SOFTWARE.
+#
+
+top_srcdir = ../..
+test_objs = host.o mpu.task_eo
+
+include $(top_srcdir)/scripts/config.mk
+include $(top_srcdir)/scripts/rules_item.mk
diff --git a/tests/TFP/TFP_36_004/host.c b/tests/TFP/TFP_36_004/host.c
new file mode 100644
index 0000000..e2cd109
--- /dev/null
+++ b/tests/TFP/TFP_36_004/host.c
@@ -0,0 +1,105 @@
+/*
+ * Copyright 2008 Sony Corporation
+ *
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a copy
+ * of this software and associated documentation files (the "Software"), to deal
+ * in the Software without restriction, including without limitation the rights
+ * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+ * copies of the Software, and to permit persons to whom the Software is
+ * furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included in
+ * all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+ * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+ * THE SOFTWARE.
+ */
+
+#include <unistd.h>
+#include <mars/mars.h>
+#include <libspe2.h>
+#include <mars_test.h>
+
+extern spe_program_handle_t mpu_prog;
+#define NUM_PATTERNS 3
+static uint32_t pattern[NUM_PATTERNS][2] = {
+ { 0, 0xFFFFFFFFUL },
+ { 16, 0xFFFF0000UL },
+ { 24, 0xFF000000UL }
+};
+static struct mars_context *mars_ctx;
+static struct mars_task_id task_id;
+static struct mars_task_args task_args;
+static uint64_t host_to_mpu[NUM_PATTERNS];
+static uint32_t shared_resource __attribute__((aligned(16)));
+
+int main(void)
+{
+ int ret, i, bits;
+ uint32_t chk_bit;
+ int32_t exit_code;
+
+ ret = mars_context_create(&mars_ctx, 0, 0);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+
+ for (i = 0; i < NUM_PATTERNS; i++) {
+ ret = mars_task_event_flag_create(
+ mars_ctx,
+ &host_to_mpu[i],
+ MARS_TASK_EVENT_FLAG_HOST_TO_MPU,
+ MARS_TASK_EVENT_FLAG_CLEAR_AUTO);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+
+ shared_resource = 0;
+ ret = mars_task_create(mars_ctx, &task_id, NULL,
+ mpu_prog.elf_image,
+ MARS_TASK_CONTEXT_SAVE_ALL);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+
+ task_args.type.u64[0] = host_to_mpu[i];
+ task_args.type.u64[1] = (uint64_t)pattern[i][1];
+ task_args.type.u64[2] = mars_ptr_to_ea(&shared_resource);
+
+ ret = mars_task_schedule(&task_id, &task_args, 0);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+
+ chk_bit = 0x01;
+ for (bits = 0; bits < pattern[i][0] ; bits++) {
+ ret = mars_task_event_flag_set(
+ host_to_mpu[i], chk_bit);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+ chk_bit <<= 1;
+ }
+
+ sleep(1);
+ /* check if mpu task doesn't returen MARS_SUCCESS */
+ MARS_TEST_ASSERT_EQUAL(shared_resource, 0);
+
+ /* set another one bit */
+ ret = mars_task_event_flag_set(
+ host_to_mpu[i], chk_bit);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+
+ ret = mars_task_wait(&task_id, &exit_code);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+ MARS_TEST_ASSERT_ERROR(exit_code, MARS_SUCCESS);
+
+ ret = mars_task_destroy(&task_id);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+
+ ret = mars_task_event_flag_destroy(host_to_mpu[i]);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+ }
+
+ ret = mars_context_destroy(mars_ctx);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+
+ return 0;
+}
+
diff --git a/tests/TFP/TFP_36_004/mpu.c b/tests/TFP/TFP_36_004/mpu.c
new file mode 100644
index 0000000..312f743
--- /dev/null
+++ b/tests/TFP/TFP_36_004/mpu.c
@@ -0,0 +1,58 @@
+/*
+ * Copyright 2008 Sony Corporation
+ *
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a copy
+ * of this software and associated documentation files (the "Software"), to deal
+ * in the Software without restriction, including without limitation the rights
+ * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+ * copies of the Software, and to permit persons to whom the Software is
+ * furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included in
+ * all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+ * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+ * THE SOFTWARE.
+ */
+
+#include <mars/mars.h>
+#include <mars_task_test.h>
+#include <spu_mfcio.h>
+
+static uint32_t shared_resource __attribute((aligned(16)));
+
+int mars_task_main(const struct mars_task_args *task_args)
+{
+ int ret;
+ uint64_t host_to_mpu_ea = task_args->type.u64[0];
+ uint32_t chk_bit = (uint32_t)task_args->type.u64[1];
+ uint64_t shared_resource_ea = task_args->type.u64[2];
+
+ while (1) {
+ ret = mars_task_event_flag_try_wait(
+ host_to_mpu_ea,
+ chk_bit,
+ MARS_TASK_EVENT_FLAG_MASK_OR, NULL);
+ if (ret == MARS_SUCCESS)
+ break;
+ else if (ret == MARS_ERROR_BUSY)
+ continue;
+ else
+ MARS_TEST_ASSERT_ERROR(ret, 0);
+ }
+
+ /* if program reaches here, shared_resource'll be updated */
+ shared_resource = 1;
+ mfc_put(&shared_resource, shared_resource_ea,
+ sizeof(uint32_t), 0, 0, 0);
+ mfc_write_tag_mask(1 << 0);
+ mfc_read_tag_status_all();
+
+ return 0;
+}
diff --git a/tests/TFP/TFP_36_005/Makefile b/tests/TFP/TFP_36_005/Makefile
new file mode 100644
index 0000000..432135a
--- /dev/null
+++ b/tests/TFP/TFP_36_005/Makefile
@@ -0,0 +1,28 @@
+#
+# Copyright 2008 Sony Corporation
+#
+#
+# Permission is hereby granted, free of charge, to any person obtaining a copy
+# of this software and associated documentation files (the "Software"), to deal
+# in the Software without restriction, including without limitation the rights
+# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+# copies of the Software, and to permit persons to whom the Software is
+# furnished to do so, subject to the following conditions:
+#
+# The above copyright notice and this permission notice shall be included in
+# all copies or substantial portions of the Software.
+#
+# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+# THE SOFTWARE.
+#
+
+top_srcdir = ../..
+test_objs = host.o mpu.task_eo
+
+include $(top_srcdir)/scripts/config.mk
+include $(top_srcdir)/scripts/rules_item.mk
diff --git a/tests/TFP/TFP_36_005/host.c b/tests/TFP/TFP_36_005/host.c
new file mode 100644
index 0000000..3679e5b
--- /dev/null
+++ b/tests/TFP/TFP_36_005/host.c
@@ -0,0 +1,149 @@
+/*
+ * Copyright 2008 Sony Corporation
+ *
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a copy
+ * of this software and associated documentation files (the "Software"), to deal
+ * in the Software without restriction, including without limitation the rights
+ * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+ * copies of the Software, and to permit persons to whom the Software is
+ * furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included in
+ * all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+ * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+ * THE SOFTWARE.
+ */
+
+#include <pthread.h>
+#include <mars/mars.h>
+#include <libspe2.h>
+#include <mars_test.h>
+
+#define EVENT_FLAG_SIZE 32
+
+extern spe_program_handle_t mpu_prog;
+#define NUM_PATTERNS 3
+static uint32_t pattern[NUM_PATTERNS][2] = {
+ { 0, 0xFFFFFFFFUL },
+ { 16, 0xFFFF0000UL },
+ { 24, 0xFF000000UL }
+};
+static struct mars_context *mars_ctx;
+static struct mars_task_id task_id[EVENT_FLAG_SIZE];
+static struct mars_task_args task_args, thread_args[NUM_PATTERNS];
+static uint64_t mpu_to_host[NUM_PATTERNS];
+static pthread_t thread[NUM_PATTERNS];
+static uint32_t shared_resource __attribute((aligned(16)));
+
+
+static void *thread_proc(void *ptr)
+{
+ int ret;
+ struct mars_task_args *task_args = (struct mars_task_args *)ptr;
+ uint32_t i = (uint32_t)task_args->type.u32[0];
+ uint32_t chk_bit = task_args->type.u32[1];
+
+ while (1) {
+ ret = mars_task_event_flag_try_wait(
+ mpu_to_host[i],
+ chk_bit,
+ MARS_TASK_EVENT_FLAG_MASK_OR, NULL);
+ if (ret == MARS_SUCCESS)
+ break;
+ else if (ret == MARS_ERROR_BUSY)
+ continue;
+ else
+ MARS_TEST_ASSERT_ERROR(ret, 0);
+ }
+
+ /* if program reaches here, shared_resource'll be updated */
+ shared_resource = 1;
+
+ return NULL;
+}
+
+int main(void)
+{
+ int ret, i, bits;
+ uint32_t chk_bit;
+ int32_t exit_code;
+
+ ret = mars_context_create(&mars_ctx, 0, 0);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+
+ for (i = 0; i < NUM_PATTERNS; i++) {
+ shared_resource = 0;
+ ret = mars_task_event_flag_create(
+ mars_ctx,
+ &mpu_to_host[i],
+ MARS_TASK_EVENT_FLAG_MPU_TO_HOST,
+ MARS_TASK_EVENT_FLAG_CLEAR_AUTO);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+
+ thread_args[i].type.u32[0] = (uint32_t)i;
+ thread_args[i].type.u32[1] = pattern[i][1];
+ pthread_create(&thread[i], NULL,
+ thread_proc, &thread_args[i]);
+
+ chk_bit = 0x01;
+ for (bits = 0; bits < pattern[i][0]; bits++) {
+ ret = mars_task_create(mars_ctx, &task_id[bits], NULL,
+ mpu_prog.elf_image,
+ MARS_TASK_CONTEXT_SAVE_ALL);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+
+ /* mpu tasks will set event_flags */
+ task_args.type.u64[0] = mpu_to_host[i];
+ task_args.type.u64[1] = (uint64_t)chk_bit;
+ ret = mars_task_schedule(&task_id[bits], &task_args, 0);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+
+ ret = mars_task_wait(&task_id[bits], &exit_code);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+ MARS_TEST_ASSERT_ERROR(exit_code, MARS_SUCCESS);
+
+ /* check if try_wait doesn't return MARS_SUCCESS */
+ MARS_TEST_ASSERT_EQUAL(shared_resource, 0);
+
+ ret = mars_task_destroy(&task_id[bits]);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+
+ chk_bit <<= 1;
+ }
+ /* set another one bit */
+ ret = mars_task_create(mars_ctx, &task_id[bits], NULL,
+ mpu_prog.elf_image,
+ MARS_TASK_CONTEXT_SAVE_ALL);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+
+ task_args.type.u64[0] = mpu_to_host[i];
+ task_args.type.u64[1] = (uint64_t)chk_bit;
+ ret = mars_task_schedule(&task_id[bits], &task_args, 0);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+
+ ret = mars_task_wait(&task_id[bits], &exit_code);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+ MARS_TEST_ASSERT_ERROR(exit_code, MARS_SUCCESS);
+
+ ret = mars_task_destroy(&task_id[bits]);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+
+ pthread_join(thread[i], NULL);
+
+ ret = mars_task_event_flag_destroy(mpu_to_host[i]);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+ }
+
+ ret = mars_context_destroy(mars_ctx);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+
+ return 0;
+}
+
diff --git a/tests/TFP/TFP_36_005/mpu.c b/tests/TFP/TFP_36_005/mpu.c
new file mode 100644
index 0000000..4fdbceb
--- /dev/null
+++ b/tests/TFP/TFP_36_005/mpu.c
@@ -0,0 +1,37 @@
+/*
+ * Copyright 2008 Sony Corporation
+ *
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a copy
+ * of this software and associated documentation files (the "Software"), to deal
+ * in the Software without restriction, including without limitation the rights
+ * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+ * copies of the Software, and to permit persons to whom the Software is
+ * furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included in
+ * all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+ * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+ * THE SOFTWARE.
+ */
+
+#include <mars/mars.h>
+#include <mars_task_test.h>
+
+int mars_task_main(const struct mars_task_args *task_args)
+{
+ int ret;
+ uint64_t mpu_to_host_ea = task_args->type.u64[0];
+ uint32_t chk_bit = (uint32_t)task_args->type.u64[1];
+
+ ret = mars_task_event_flag_set(mpu_to_host_ea, chk_bit);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+
+ return 0;
+}
diff --git a/tests/TFP/TFP_36_006/Makefile b/tests/TFP/TFP_36_006/Makefile
new file mode 100644
index 0000000..ecbce33
--- /dev/null
+++ b/tests/TFP/TFP_36_006/Makefile
@@ -0,0 +1,28 @@
+#
+# Copyright 2008 Sony Corporation
+#
+#
+# Permission is hereby granted, free of charge, to any person obtaining a copy
+# of this software and associated documentation files (the "Software"), to deal
+# in the Software without restriction, including without limitation the rights
+# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+# copies of the Software, and to permit persons to whom the Software is
+# furnished to do so, subject to the following conditions:
+#
+# The above copyright notice and this permission notice shall be included in
+# all copies or substantial portions of the Software.
+#
+# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+# THE SOFTWARE.
+#
+
+top_srcdir = ../..
+test_objs = host.o mpu1.task_eo mpu2.task_eo
+
+include $(top_srcdir)/scripts/config.mk
+include $(top_srcdir)/scripts/rules_item.mk
diff --git a/tests/TFP/TFP_36_006/host.c b/tests/TFP/TFP_36_006/host.c
new file mode 100644
index 0000000..7fca71a
--- /dev/null
+++ b/tests/TFP/TFP_36_006/host.c
@@ -0,0 +1,133 @@
+/*
+ * Copyright 2008 Sony Corporation
+ *
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a copy
+ * of this software and associated documentation files (the "Software"), to deal
+ * in the Software without restriction, including without limitation the rights
+ * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+ * copies of the Software, and to permit persons to whom the Software is
+ * furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included in
+ * all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+ * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+ * THE SOFTWARE.
+ */
+
+#include <unistd.h>
+#include <mars/mars.h>
+#include <libspe2.h>
+#include <mars_test.h>
+
+extern spe_program_handle_t mpu1_prog;
+extern spe_program_handle_t mpu2_prog;
+#define NUM_PATTERNS 3
+static uint32_t pattern[NUM_PATTERNS][2] = {
+ { 0, 0xFFFFFFFFUL },
+ { 16, 0xFFFF0000UL },
+ { 24, 0xFF000000UL }
+};
+static struct mars_context *mars_ctx;
+static struct mars_task_id task1_id, task2_id;
+static struct mars_task_args task1_args, task2_args;
+static uint64_t mpu_to_mpu[NUM_PATTERNS];
+static uint32_t shared_resource __attribute__((aligned(16)));
+
+int main(void)
+{
+ int ret, i, bits;
+ uint32_t chk_bit;
+ int32_t exit_code;
+
+ ret = mars_context_create(&mars_ctx, 0, 0);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+
+ for (i = 0; i < NUM_PATTERNS; i++) {
+ ret = mars_task_event_flag_create(
+ mars_ctx,
+ &mpu_to_mpu[i],
+ MARS_TASK_EVENT_FLAG_MPU_TO_MPU,
+ MARS_TASK_EVENT_FLAG_CLEAR_AUTO);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+
+ shared_resource = 0;
+ ret = mars_task_create(mars_ctx, &task1_id, NULL,
+ mpu1_prog.elf_image,
+ MARS_TASK_CONTEXT_SAVE_ALL);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+
+ task1_args.type.u64[0] = mpu_to_mpu[i];
+ task1_args.type.u64[1] = (uint64_t)pattern[i][1];
+ task1_args.type.u64[2] = mars_ptr_to_ea(&shared_resource);
+
+ ret = mars_task_schedule(&task1_id, &task1_args, 0);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+
+ chk_bit = 0x01;
+ for (bits = 0; bits < pattern[i][0] ; bits++) {
+ ret = mars_task_create(mars_ctx, &task2_id, NULL,
+ mpu2_prog.elf_image,
+ MARS_TASK_CONTEXT_SAVE_ALL);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+
+ /* mpu tasks will set event_flags */
+ task2_args.type.u64[0] = mpu_to_mpu[i];
+ task2_args.type.u64[1] = (uint64_t)chk_bit;
+ ret = mars_task_schedule(&task2_id, &task2_args, 0);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+
+ ret = mars_task_wait(&task2_id, &exit_code);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+ MARS_TEST_ASSERT_ERROR(exit_code, MARS_SUCCESS);
+
+ /* check if try_wait doesn't return MARS_SUCCESS */
+ MARS_TEST_ASSERT_EQUAL(shared_resource, 0);
+
+ ret = mars_task_destroy(&task2_id);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+
+ chk_bit <<= 1;
+ }
+ /* set another one bit */
+ ret = mars_task_create(mars_ctx, &task2_id, NULL,
+ mpu2_prog.elf_image,
+ MARS_TASK_CONTEXT_SAVE_ALL);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+
+ task2_args.type.u64[0] = mpu_to_mpu[i];
+ task2_args.type.u64[1] = (uint64_t)chk_bit;
+ ret = mars_task_schedule(&task2_id, &task2_args, 0);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+
+ ret = mars_task_wait(&task2_id, &exit_code);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+ MARS_TEST_ASSERT_ERROR(exit_code, MARS_SUCCESS);
+
+ ret = mars_task_destroy(&task2_id);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+
+ /* check if wait task return sucessfuly */
+ ret = mars_task_wait(&task1_id, &exit_code);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+ MARS_TEST_ASSERT_ERROR(exit_code, MARS_SUCCESS);
+
+ ret = mars_task_destroy(&task1_id);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+
+ ret = mars_task_event_flag_destroy(mpu_to_mpu[i]);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+ }
+
+ ret = mars_context_destroy(mars_ctx);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+
+ return 0;
+}
+
diff --git a/tests/TFP/TFP_36_006/mpu1.c b/tests/TFP/TFP_36_006/mpu1.c
new file mode 100644
index 0000000..500dcec
--- /dev/null
+++ b/tests/TFP/TFP_36_006/mpu1.c
@@ -0,0 +1,58 @@
+/*
+ * Copyright 2008 Sony Corporation
+ *
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a copy
+ * of this software and associated documentation files (the "Software"), to deal
+ * in the Software without restriction, including without limitation the rights
+ * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+ * copies of the Software, and to permit persons to whom the Software is
+ * furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included in
+ * all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+ * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+ * THE SOFTWARE.
+ */
+
+#include <mars/mars.h>
+#include <mars_task_test.h>
+#include <spu_mfcio.h>
+
+static uint32_t shared_resource __attribute((aligned(16)));
+
+int mars_task_main(const struct mars_task_args *task_args)
+{
+ int ret;
+ uint64_t mpu_to_mpu_ea = task_args->type.u64[0];
+ uint32_t chk_bit = (uint32_t)task_args->type.u64[1];
+ uint64_t shared_resource_ea = task_args->type.u64[2];
+
+ while (1) {
+ ret = mars_task_event_flag_try_wait(
+ mpu_to_mpu_ea,
+ chk_bit,
+ MARS_TASK_EVENT_FLAG_MASK_OR, NULL);
+ if (ret == MARS_SUCCESS)
+ break;
+ else if (ret == MARS_ERROR_BUSY)
+ continue;
+ else
+ MARS_TEST_ASSERT_ERROR(ret, 0);
+ }
+
+ /* if program reaches here, shared_resource'll be updated */
+ shared_resource = 1;
+ mfc_put(&shared_resource, shared_resource_ea,
+ sizeof(uint32_t), 0, 0, 0);
+ mfc_write_tag_mask(1 << 0);
+ mfc_read_tag_status_all();
+
+ return 0;
+}
diff --git a/tests/TFP/TFP_36_006/mpu2.c b/tests/TFP/TFP_36_006/mpu2.c
new file mode 100644
index 0000000..65f3252
--- /dev/null
+++ b/tests/TFP/TFP_36_006/mpu2.c
@@ -0,0 +1,37 @@
+/*
+ * Copyright 2008 Sony Corporation
+ *
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a copy
+ * of this software and associated documentation files (the "Software"), to deal
+ * in the Software without restriction, including without limitation the rights
+ * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+ * copies of the Software, and to permit persons to whom the Software is
+ * furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included in
+ * all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+ * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+ * THE SOFTWARE.
+ */
+
+#include <mars/mars.h>
+#include <mars_task_test.h>
+
+int mars_task_main(const struct mars_task_args *task_args)
+{
+ int ret;
+ uint64_t mpu_to_mpu_ea = task_args->type.u64[0];
+ uint32_t chk_bit = (uint32_t)task_args->type.u64[1];
+
+ ret = mars_task_event_flag_set(mpu_to_mpu_ea, chk_bit);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+
+ return 0;
+}
diff --git a/tests/TFP/TFP_36_007/Makefile b/tests/TFP/TFP_36_007/Makefile
new file mode 100644
index 0000000..ecbce33
--- /dev/null
+++ b/tests/TFP/TFP_36_007/Makefile
@@ -0,0 +1,28 @@
+#
+# Copyright 2008 Sony Corporation
+#
+#
+# Permission is hereby granted, free of charge, to any person obtaining a copy
+# of this software and associated documentation files (the "Software"), to deal
+# in the Software without restriction, including without limitation the rights
+# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+# copies of the Software, and to permit persons to whom the Software is
+# furnished to do so, subject to the following conditions:
+#
+# The above copyright notice and this permission notice shall be included in
+# all copies or substantial portions of the Software.
+#
+# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+# THE SOFTWARE.
+#
+
+top_srcdir = ../..
+test_objs = host.o mpu1.task_eo mpu2.task_eo
+
+include $(top_srcdir)/scripts/config.mk
+include $(top_srcdir)/scripts/rules_item.mk
diff --git a/tests/TFP/TFP_36_007/host.c b/tests/TFP/TFP_36_007/host.c
new file mode 100644
index 0000000..9a1a2dc
--- /dev/null
+++ b/tests/TFP/TFP_36_007/host.c
@@ -0,0 +1,122 @@
+/*
+ * Copyright 2008 Sony Corporation
+ *
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a copy
+ * of this software and associated documentation files (the "Software"), to deal
+ * in the Software without restriction, including without limitation the rights
+ * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+ * copies of the Software, and to permit persons to whom the Software is
+ * furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included in
+ * all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+ * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+ * THE SOFTWARE.
+ */
+
+#include <unistd.h>
+#include <mars/mars.h>
+#include <libspe2.h>
+#include <mars_test.h>
+
+extern spe_program_handle_t mpu1_prog;
+extern spe_program_handle_t mpu2_prog;
+#define NUM_PATTERNS 3
+static uint32_t pattern[NUM_PATTERNS][2] = {
+/* pattern or chk_bit */
+ { 0x00000001UL, 0x01UL },
+ { 0x0000CAFEUL, 0x00008000UL },
+ { 0x10203040UL, 0x10000000UL }
+};
+static struct mars_context *mars_ctx;
+static struct mars_task_id task1_id, task2_id;
+static struct mars_task_args task1_args, task2_args;
+static uint64_t host_to_mpu_and[NUM_PATTERNS];
+static uint64_t host_to_mpu_or[NUM_PATTERNS];
+
+int main(void)
+{
+ int ret, i;
+ int32_t exit_code;
+
+ ret = mars_context_create(&mars_ctx, 0, 0);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+
+ for (i = 0; i < NUM_PATTERNS; i++) {
+ ret = mars_task_event_flag_create(
+ mars_ctx,
+ &host_to_mpu_and[i],
+ MARS_TASK_EVENT_FLAG_HOST_TO_MPU,
+ MARS_TASK_EVENT_FLAG_CLEAR_AUTO);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+
+ ret = mars_task_event_flag_create(
+ mars_ctx,
+ &host_to_mpu_or[i],
+ MARS_TASK_EVENT_FLAG_HOST_TO_MPU,
+ MARS_TASK_EVENT_FLAG_CLEAR_AUTO);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+
+ ret = mars_task_create(mars_ctx, &task1_id, NULL,
+ mpu1_prog.elf_image, MARS_TASK_CONTEXT_SAVE_ALL);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+
+ ret = mars_task_create(mars_ctx, &task2_id, NULL,
+ mpu2_prog.elf_image, MARS_TASK_CONTEXT_SAVE_ALL);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+
+ task1_args.type.u64[0] = host_to_mpu_and[i];
+ task1_args.type.u64[1] = (uint64_t)pattern[i][0];
+ ret = mars_task_schedule(&task1_id, &task1_args, 0);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+
+ task2_args.type.u64[0] = host_to_mpu_or[i];
+ task2_args.type.u64[1] = (uint64_t)pattern[i][0];
+ ret = mars_task_schedule(&task2_id, &task2_args, 0);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+
+ sleep(1);
+
+ /* set bits for AND wait condition */
+ ret = mars_task_event_flag_set(host_to_mpu_and[i],
+ pattern[i][0]);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+ /* set bit for OR wait condition */
+ ret = mars_task_event_flag_set(host_to_mpu_or[i],
+ pattern[i][1]);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+
+ ret = mars_task_wait(&task1_id, &exit_code);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+ MARS_TEST_ASSERT_ERROR(exit_code, MARS_SUCCESS);
+
+ ret = mars_task_wait(&task2_id, &exit_code);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+ MARS_TEST_ASSERT_ERROR(exit_code, MARS_SUCCESS);
+
+ ret = mars_task_destroy(&task1_id);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+
+ ret = mars_task_destroy(&task2_id);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+
+ ret = mars_task_event_flag_destroy(host_to_mpu_and[i]);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+
+ ret = mars_task_event_flag_destroy(host_to_mpu_or[i]);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+ }
+
+ ret = mars_context_destroy(mars_ctx);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+
+ return 0;
+}
+
diff --git a/tests/TFP/TFP_36_007/mpu1.c b/tests/TFP/TFP_36_007/mpu1.c
new file mode 100644
index 0000000..a18474e
--- /dev/null
+++ b/tests/TFP/TFP_36_007/mpu1.c
@@ -0,0 +1,63 @@
+/*
+ * Copyright 2008 Sony Corporation
+ *
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a copy
+ * of this software and associated documentation files (the "Software"), to deal
+ * in the Software without restriction, including without limitation the rights
+ * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+ * copies of the Software, and to permit persons to whom the Software is
+ * furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included in
+ * all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+ * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+ * THE SOFTWARE.
+ */
+
+#include <mars/mars.h>
+#include <mars_task_test.h>
+
+int mars_task_main(const struct mars_task_args *task_args)
+{
+ int ret;
+ uint64_t host_to_mpu_ea = task_args->type.u64[0];
+ uint32_t flags = (uint32_t)task_args->type.u64[1];
+ uint32_t chk_bit;
+
+ /* wait condition AND */
+ while (1) {
+ ret = mars_task_event_flag_try_wait(
+ host_to_mpu_ea,
+ flags,
+ MARS_TASK_EVENT_FLAG_MASK_AND, NULL);
+ if (ret == MARS_SUCCESS)
+ break;
+ else if (ret == MARS_ERROR_BUSY)
+ continue;
+ else
+ MARS_TEST_ASSERT_ERROR(ret, 0);
+ }
+
+ /* check if all bits are cleard */
+ chk_bit = 0x01;
+ while (flags) {
+ if (flags & 0x01) {
+ ret = mars_task_event_flag_try_wait(
+ host_to_mpu_ea,
+ chk_bit,
+ MARS_TASK_EVENT_FLAG_MASK_OR, NULL);
+ /* if bit == 0, try_wait returns BUSY */
+ MARS_TEST_ASSERT_ERROR(ret, MARS_ERROR_BUSY);
+ }
+ flags >>= 1;
+ chk_bit <<= 1;
+ }
+ return 0;
+}
diff --git a/tests/TFP/TFP_36_007/mpu2.c b/tests/TFP/TFP_36_007/mpu2.c
new file mode 100644
index 0000000..915784b
--- /dev/null
+++ b/tests/TFP/TFP_36_007/mpu2.c
@@ -0,0 +1,63 @@
+/*
+ * Copyright 2008 Sony Corporation
+ *
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a copy
+ * of this software and associated documentation files (the "Software"), to deal
+ * in the Software without restriction, including without limitation the rights
+ * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+ * copies of the Software, and to permit persons to whom the Software is
+ * furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included in
+ * all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+ * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+ * THE SOFTWARE.
+ */
+
+#include <mars/mars.h>
+#include <mars_task_test.h>
+
+int mars_task_main(const struct mars_task_args *task_args)
+{
+ int ret;
+ uint64_t host_to_mpu_ea = task_args->type.u64[0];
+ uint32_t flags = (uint32_t)task_args->type.u64[1];
+ uint32_t chk_bit;
+
+ /* wait condition OR */
+ while (1) {
+ ret = mars_task_event_flag_try_wait(
+ host_to_mpu_ea,
+ flags,
+ MARS_TASK_EVENT_FLAG_MASK_OR, NULL);
+ if (ret == MARS_SUCCESS)
+ break;
+ else if (ret == MARS_ERROR_BUSY)
+ continue;
+ else
+ MARS_TEST_ASSERT_ERROR(ret, 0);
+ }
+
+ /* check if all bits are cleard */
+ chk_bit = 0x01;
+ while (flags) {
+ if (flags & 0x01) {
+ ret = mars_task_event_flag_try_wait(
+ host_to_mpu_ea,
+ chk_bit,
+ MARS_TASK_EVENT_FLAG_MASK_OR, NULL);
+ /* if bit == 0, try_wait returns BUSY */
+ MARS_TEST_ASSERT_ERROR(ret, MARS_ERROR_BUSY);
+ }
+ flags >>= 1;
+ chk_bit <<= 1;
+ }
+ return 0;
+}
diff --git a/tests/TFP/TFP_36_008/Makefile b/tests/TFP/TFP_36_008/Makefile
new file mode 100644
index 0000000..432135a
--- /dev/null
+++ b/tests/TFP/TFP_36_008/Makefile
@@ -0,0 +1,28 @@
+#
+# Copyright 2008 Sony Corporation
+#
+#
+# Permission is hereby granted, free of charge, to any person obtaining a copy
+# of this software and associated documentation files (the "Software"), to deal
+# in the Software without restriction, including without limitation the rights
+# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+# copies of the Software, and to permit persons to whom the Software is
+# furnished to do so, subject to the following conditions:
+#
+# The above copyright notice and this permission notice shall be included in
+# all copies or substantial portions of the Software.
+#
+# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+# THE SOFTWARE.
+#
+
+top_srcdir = ../..
+test_objs = host.o mpu.task_eo
+
+include $(top_srcdir)/scripts/config.mk
+include $(top_srcdir)/scripts/rules_item.mk
diff --git a/tests/TFP/TFP_36_008/host.c b/tests/TFP/TFP_36_008/host.c
new file mode 100644
index 0000000..0d92238
--- /dev/null
+++ b/tests/TFP/TFP_36_008/host.c
@@ -0,0 +1,211 @@
+/*
+ * Copyright 2008 Sony Corporation
+ *
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a copy
+ * of this software and associated documentation files (the "Software"), to deal
+ * in the Software without restriction, including without limitation the rights
+ * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+ * copies of the Software, and to permit persons to whom the Software is
+ * furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included in
+ * all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+ * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+ * THE SOFTWARE.
+ */
+
+#include <pthread.h>
+#include <mars/mars.h>
+#include <libspe2.h>
+#include <mars_test.h>
+
+#define EVENT_FLAG_SIZE 32
+
+extern spe_program_handle_t mpu_prog;
+#define NUM_PATTERNS 3
+static uint32_t pattern[NUM_PATTERNS][2] = {
+/* pattern or chk_bit */
+ { 0x00000001UL, 0x01UL },
+ { 0x0000CAFEUL, 0x00008000UL },
+ { 0x10203040UL, 0x10000000UL }
+};
+static struct mars_context *mars_ctx;
+static struct mars_task_id task1_id, task2_id;
+static struct mars_task_args task1_args, task2_args;
+static struct mars_task_args thread1_args, thread2_args;
+static uint64_t mpu_to_host_and[NUM_PATTERNS];
+static uint64_t mpu_to_host_or[NUM_PATTERNS];
+static pthread_t thread1, thread2;
+
+static void *thread1_proc(void *ptr)
+{
+ int ret;
+ struct mars_task_args *task_args = (struct mars_task_args *)ptr;
+ uint32_t id = (uint32_t)task_args->type.u32[0];
+ uint32_t flags = task_args->type.u32[1];
+ uint32_t chk_bit;
+
+ /* wait condition AND */
+ while (1) {
+ ret = mars_task_event_flag_try_wait(
+ mpu_to_host_and[id],
+ flags,
+ MARS_TASK_EVENT_FLAG_MASK_AND, NULL);
+ if (ret == MARS_SUCCESS)
+ break;
+ else if (ret == MARS_ERROR_BUSY)
+ continue;
+ else
+ MARS_TEST_ASSERT_ERROR(ret, 0);
+ }
+
+ /* check if all bits are cleard */
+ chk_bit = 0x01;
+ while (flags) {
+ if (flags & 0x01) {
+ ret = mars_task_event_flag_try_wait(
+ mpu_to_host_and[id],
+ chk_bit,
+ MARS_TASK_EVENT_FLAG_MASK_OR, NULL);
+ /* if bit == 0, try_wait returns BUSY */
+ MARS_TEST_ASSERT_ERROR(ret, MARS_ERROR_BUSY);
+ }
+ flags >>= 1;
+ chk_bit <<= 1;
+ }
+
+ return NULL;
+}
+
+static void *thread2_proc(void *ptr)
+{
+ int ret;
+ struct mars_task_args *task_args = (struct mars_task_args *)ptr;
+ uint32_t id = (uint32_t)task_args->type.u32[0];
+ uint32_t flags = task_args->type.u32[1];
+ uint32_t chk_bit;
+
+ /* wait condition OR */
+ while (1) {
+ ret = mars_task_event_flag_try_wait(
+ mpu_to_host_or[id],
+ flags,
+ MARS_TASK_EVENT_FLAG_MASK_OR, NULL);
+ if (ret == MARS_SUCCESS)
+ break;
+ else if (ret == MARS_ERROR_BUSY)
+ continue;
+ else
+ MARS_TEST_ASSERT_ERROR(ret, 0);
+ }
+
+ /* check if all bits are cleard */
+ chk_bit = 0x01;
+ while (flags) {
+ if (flags & 0x01) {
+ ret = mars_task_event_flag_try_wait(
+ mpu_to_host_or[id],
+ chk_bit,
+ MARS_TASK_EVENT_FLAG_MASK_OR, NULL);
+ /* if bit == 0, try_wait returns BUSY */
+ MARS_TEST_ASSERT_ERROR(ret, MARS_ERROR_BUSY);
+ }
+ flags >>= 1;
+ chk_bit <<= 1;
+ }
+
+ return NULL;
+}
+
+int main(void)
+{
+ int ret, i;
+ int32_t exit_code;
+
+ ret = mars_context_create(&mars_ctx, 0, 0);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+
+ for (i = 0; i < NUM_PATTERNS; i++) {
+ ret = mars_task_event_flag_create(
+ mars_ctx,
+ &mpu_to_host_and[i],
+ MARS_TASK_EVENT_FLAG_MPU_TO_HOST,
+ MARS_TASK_EVENT_FLAG_CLEAR_AUTO);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+
+ ret = mars_task_event_flag_create(
+ mars_ctx,
+ &mpu_to_host_or[i],
+ MARS_TASK_EVENT_FLAG_MPU_TO_HOST,
+ MARS_TASK_EVENT_FLAG_CLEAR_AUTO);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+
+ ret = mars_task_create(mars_ctx, &task1_id, NULL,
+ mpu_prog.elf_image,
+ MARS_TASK_CONTEXT_SAVE_ALL);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+
+ ret = mars_task_create(mars_ctx, &task2_id, NULL,
+ mpu_prog.elf_image,
+ MARS_TASK_CONTEXT_SAVE_ALL);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+
+ thread1_args.type.u32[0] = (uint32_t)i;
+ thread1_args.type.u32[1] = pattern[i][0];
+ pthread_create(&thread1, NULL,
+ thread1_proc, &thread1_args);
+
+ thread2_args.type.u32[0] = (uint32_t)i;
+ thread2_args.type.u32[1] = pattern[i][0];
+ pthread_create(&thread2, NULL,
+ thread2_proc, &thread2_args);
+
+ /* set flags AND condition */
+ task1_args.type.u64[0] = mpu_to_host_and[i];
+ task1_args.type.u64[1] = (uint64_t)pattern[i][0];
+ ret = mars_task_schedule(&task1_id, &task1_args, 0);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+
+ /* set flags OR conditon */
+ task2_args.type.u64[0] = mpu_to_host_or[i];
+ task2_args.type.u64[1] = (uint64_t)pattern[i][1];
+ ret = mars_task_schedule(&task2_id, &task2_args, 0);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+
+ pthread_join(thread1, NULL);
+ pthread_join(thread2, NULL);
+
+ ret = mars_task_wait(&task1_id, &exit_code);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+ MARS_TEST_ASSERT_ERROR(exit_code, MARS_SUCCESS);
+
+ ret = mars_task_wait(&task2_id, &exit_code);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+ MARS_TEST_ASSERT_ERROR(exit_code, MARS_SUCCESS);
+
+ ret = mars_task_destroy(&task1_id);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+
+ ret = mars_task_destroy(&task2_id);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+
+ ret = mars_task_event_flag_destroy(mpu_to_host_and[i]);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+
+ ret = mars_task_event_flag_destroy(mpu_to_host_or[i]);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+ }
+
+ ret = mars_context_destroy(mars_ctx);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+
+ return 0;
+}
+
diff --git a/tests/TFP/TFP_36_008/mpu.c b/tests/TFP/TFP_36_008/mpu.c
new file mode 100644
index 0000000..4fdbceb
--- /dev/null
+++ b/tests/TFP/TFP_36_008/mpu.c
@@ -0,0 +1,37 @@
+/*
+ * Copyright 2008 Sony Corporation
+ *
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a copy
+ * of this software and associated documentation files (the "Software"), to deal
+ * in the Software without restriction, including without limitation the rights
+ * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+ * copies of the Software, and to permit persons to whom the Software is
+ * furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included in
+ * all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+ * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+ * THE SOFTWARE.
+ */
+
+#include <mars/mars.h>
+#include <mars_task_test.h>
+
+int mars_task_main(const struct mars_task_args *task_args)
+{
+ int ret;
+ uint64_t mpu_to_host_ea = task_args->type.u64[0];
+ uint32_t chk_bit = (uint32_t)task_args->type.u64[1];
+
+ ret = mars_task_event_flag_set(mpu_to_host_ea, chk_bit);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+
+ return 0;
+}
diff --git a/tests/TFP/TFP_36_009/Makefile b/tests/TFP/TFP_36_009/Makefile
new file mode 100644
index 0000000..72cf999
--- /dev/null
+++ b/tests/TFP/TFP_36_009/Makefile
@@ -0,0 +1,28 @@
+#
+# Copyright 2008 Sony Corporation
+#
+#
+# Permission is hereby granted, free of charge, to any person obtaining a copy
+# of this software and associated documentation files (the "Software"), to deal
+# in the Software without restriction, including without limitation the rights
+# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+# copies of the Software, and to permit persons to whom the Software is
+# furnished to do so, subject to the following conditions:
+#
+# The above copyright notice and this permission notice shall be included in
+# all copies or substantial portions of the Software.
+#
+# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+# THE SOFTWARE.
+#
+
+top_srcdir = ../..
+test_objs = host.o mpu1.task_eo mpu2.task_eo mpu3.task_eo
+
+include $(top_srcdir)/scripts/config.mk
+include $(top_srcdir)/scripts/rules_item.mk
diff --git a/tests/TFP/TFP_36_009/host.c b/tests/TFP/TFP_36_009/host.c
new file mode 100644
index 0000000..5743798
--- /dev/null
+++ b/tests/TFP/TFP_36_009/host.c
@@ -0,0 +1,151 @@
+/*
+ * Copyright 2008 Sony Corporation
+ *
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a copy
+ * of this software and associated documentation files (the "Software"), to deal
+ * in the Software without restriction, including without limitation the rights
+ * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+ * copies of the Software, and to permit persons to whom the Software is
+ * furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included in
+ * all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+ * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+ * THE SOFTWARE.
+ */
+
+#include <unistd.h>
+#include <mars/mars.h>
+#include <libspe2.h>
+#include <mars_test.h>
+
+extern spe_program_handle_t mpu1_prog;
+extern spe_program_handle_t mpu2_prog;
+extern spe_program_handle_t mpu3_prog;
+#define NUM_PATTERNS 3
+static uint32_t pattern[NUM_PATTERNS][2] = {
+/* pattern or chk_bit */
+ { 0x00000001UL, 0x01UL },
+ { 0x0000CAFEUL, 0x00008000UL },
+ { 0x10203040UL, 0x10000000UL }
+};
+static struct mars_context *mars_ctx;
+static struct mars_task_id task1_id, task2_id, task3_id;
+static struct mars_task_args task1_args, task2_args, task3_args;
+static uint64_t mpu_to_mpu_and[NUM_PATTERNS];
+static uint64_t mpu_to_mpu_or[NUM_PATTERNS];
+
+int main(void)
+{
+ int ret, i;
+ int32_t exit_code;
+
+ ret = mars_context_create(&mars_ctx, 0, 0);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+
+ for (i = 0; i < NUM_PATTERNS; i++) {
+ ret = mars_task_event_flag_create(
+ mars_ctx,
+ &mpu_to_mpu_and[i],
+ MARS_TASK_EVENT_FLAG_MPU_TO_MPU,
+ MARS_TASK_EVENT_FLAG_CLEAR_AUTO);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+
+ ret = mars_task_event_flag_create(
+ mars_ctx,
+ &mpu_to_mpu_or[i],
+ MARS_TASK_EVENT_FLAG_MPU_TO_MPU,
+ MARS_TASK_EVENT_FLAG_CLEAR_AUTO);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+
+ ret = mars_task_create(mars_ctx, &task1_id, NULL,
+ mpu1_prog.elf_image, MARS_TASK_CONTEXT_SAVE_ALL);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+
+ ret = mars_task_create(mars_ctx, &task2_id, NULL,
+ mpu2_prog.elf_image, MARS_TASK_CONTEXT_SAVE_ALL);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+
+ /* run try_wait task */
+ task1_args.type.u64[0] = mpu_to_mpu_and[i];
+ task1_args.type.u64[1] = (uint64_t)pattern[i][0];
+ ret = mars_task_schedule(&task1_id, &task1_args, 0);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+
+ task2_args.type.u64[0] = mpu_to_mpu_or[i];
+ task2_args.type.u64[1] = (uint64_t)pattern[i][0];
+ ret = mars_task_schedule(&task2_id, &task2_args, 0);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+
+ sleep(1);
+
+ /* set bits for AND wait condition */
+ ret = mars_task_create(mars_ctx, &task3_id, NULL,
+ mpu3_prog.elf_image, MARS_TASK_CONTEXT_SAVE_ALL);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+
+ task3_args.type.u64[0] = mpu_to_mpu_and[i];
+ task3_args.type.u64[1] = (uint64_t)pattern[i][0]; /* AND */
+ ret = mars_task_schedule(&task3_id, &task3_args, 0);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+
+ ret = mars_task_wait(&task3_id, &exit_code);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+ MARS_TEST_ASSERT_ERROR(exit_code, MARS_SUCCESS);
+
+ ret = mars_task_destroy(&task3_id);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+
+
+ /* set bit for OR wait condition */
+ ret = mars_task_create(mars_ctx, &task3_id, NULL,
+ mpu3_prog.elf_image, MARS_TASK_CONTEXT_SAVE_ALL);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+
+ task3_args.type.u64[0] = mpu_to_mpu_or[i];
+ task3_args.type.u64[1] = (uint64_t)pattern[i][1]; /* OR */
+ ret = mars_task_schedule(&task3_id, &task3_args, 0);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+
+ ret = mars_task_wait(&task3_id, &exit_code);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+ MARS_TEST_ASSERT_ERROR(exit_code, MARS_SUCCESS);
+
+ ret = mars_task_destroy(&task3_id);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+
+ /* wait try_wait task */
+ ret = mars_task_wait(&task1_id, &exit_code);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+ MARS_TEST_ASSERT_ERROR(exit_code, MARS_SUCCESS);
+
+ ret = mars_task_wait(&task2_id, &exit_code);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+ MARS_TEST_ASSERT_ERROR(exit_code, MARS_SUCCESS);
+
+ ret = mars_task_destroy(&task1_id);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+
+ ret = mars_task_destroy(&task2_id);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+
+ ret = mars_task_event_flag_destroy(mpu_to_mpu_and[i]);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+
+ ret = mars_task_event_flag_destroy(mpu_to_mpu_or[i]);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+ }
+
+ ret = mars_context_destroy(mars_ctx);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+
+ return 0;
+}
+
diff --git a/tests/TFP/TFP_36_009/mpu1.c b/tests/TFP/TFP_36_009/mpu1.c
new file mode 100644
index 0000000..6e41f78
--- /dev/null
+++ b/tests/TFP/TFP_36_009/mpu1.c
@@ -0,0 +1,63 @@
+/*
+ * Copyright 2008 Sony Corporation
+ *
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a copy
+ * of this software and associated documentation files (the "Software"), to deal
+ * in the Software without restriction, including without limitation the rights
+ * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+ * copies of the Software, and to permit persons to whom the Software is
+ * furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included in
+ * all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+ * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+ * THE SOFTWARE.
+ */
+
+#include <mars/mars.h>
+#include <mars_task_test.h>
+
+int mars_task_main(const struct mars_task_args *task_args)
+{
+ int ret;
+ uint64_t mpu_to_mpu_ea = task_args->type.u64[0];
+ uint32_t flags = (uint32_t)task_args->type.u64[1];
+ uint32_t chk_bit;
+
+ /* wait condition AND */
+ while (1) {
+ ret = mars_task_event_flag_try_wait(
+ mpu_to_mpu_ea,
+ flags,
+ MARS_TASK_EVENT_FLAG_MASK_AND, NULL);
+ if (ret == MARS_SUCCESS)
+ break;
+ else if (ret == MARS_ERROR_BUSY)
+ continue;
+ else
+ MARS_TEST_ASSERT_ERROR(ret, 0);
+ }
+
+ /* check if all bits are cleard */
+ chk_bit = 0x01;
+ while (flags) {
+ if (flags & 0x01) {
+ ret = mars_task_event_flag_try_wait(
+ mpu_to_mpu_ea,
+ chk_bit,
+ MARS_TASK_EVENT_FLAG_MASK_OR, NULL);
+ /* if bit == 0, try_wait returns BUSY */
+ MARS_TEST_ASSERT_ERROR(ret, MARS_ERROR_BUSY);
+ }
+ flags >>= 1;
+ chk_bit <<= 1;
+ }
+ return 0;
+}
diff --git a/tests/TFP/TFP_36_009/mpu2.c b/tests/TFP/TFP_36_009/mpu2.c
new file mode 100644
index 0000000..3bc7344
--- /dev/null
+++ b/tests/TFP/TFP_36_009/mpu2.c
@@ -0,0 +1,63 @@
+/*
+ * Copyright 2008 Sony Corporation
+ *
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a copy
+ * of this software and associated documentation files (the "Software"), to deal
+ * in the Software without restriction, including without limitation the rights
+ * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+ * copies of the Software, and to permit persons to whom the Software is
+ * furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included in
+ * all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+ * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+ * THE SOFTWARE.
+ */
+
+#include <mars/mars.h>
+#include <mars_task_test.h>
+
+int mars_task_main(const struct mars_task_args *task_args)
+{
+ int ret;
+ uint64_t mpu_to_mpu_ea = task_args->type.u64[0];
+ uint32_t flags = (uint32_t)task_args->type.u64[1];
+ uint32_t chk_bit;
+
+ /* wait condition OR */
+ while (1) {
+ ret = mars_task_event_flag_try_wait(
+ mpu_to_mpu_ea,
+ flags,
+ MARS_TASK_EVENT_FLAG_MASK_OR, NULL);
+ if (ret == MARS_SUCCESS)
+ break;
+ else if (ret == MARS_ERROR_BUSY)
+ continue;
+ else
+ MARS_TEST_ASSERT_ERROR(ret, 0);
+ }
+
+ /* check if all bits are cleard */
+ chk_bit = 0x01;
+ while (flags) {
+ if (flags & 0x01) {
+ ret = mars_task_event_flag_try_wait(
+ mpu_to_mpu_ea,
+ chk_bit,
+ MARS_TASK_EVENT_FLAG_MASK_OR, NULL);
+ /* if bit == 0, try_wait returns BUSY */
+ MARS_TEST_ASSERT_ERROR(ret, MARS_ERROR_BUSY);
+ }
+ flags >>= 1;
+ chk_bit <<= 1;
+ }
+ return 0;
+}
diff --git a/tests/TFP/TFP_36_009/mpu3.c b/tests/TFP/TFP_36_009/mpu3.c
new file mode 100644
index 0000000..65f3252
--- /dev/null
+++ b/tests/TFP/TFP_36_009/mpu3.c
@@ -0,0 +1,37 @@
+/*
+ * Copyright 2008 Sony Corporation
+ *
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a copy
+ * of this software and associated documentation files (the "Software"), to deal
+ * in the Software without restriction, including without limitation the rights
+ * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+ * copies of the Software, and to permit persons to whom the Software is
+ * furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included in
+ * all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+ * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+ * THE SOFTWARE.
+ */
+
+#include <mars/mars.h>
+#include <mars_task_test.h>
+
+int mars_task_main(const struct mars_task_args *task_args)
+{
+ int ret;
+ uint64_t mpu_to_mpu_ea = task_args->type.u64[0];
+ uint32_t chk_bit = (uint32_t)task_args->type.u64[1];
+
+ ret = mars_task_event_flag_set(mpu_to_mpu_ea, chk_bit);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+
+ return 0;
+}
diff --git a/tests/TFP/TFP_36_010/Makefile b/tests/TFP/TFP_36_010/Makefile
new file mode 100644
index 0000000..ecbce33
--- /dev/null
+++ b/tests/TFP/TFP_36_010/Makefile
@@ -0,0 +1,28 @@
+#
+# Copyright 2008 Sony Corporation
+#
+#
+# Permission is hereby granted, free of charge, to any person obtaining a copy
+# of this software and associated documentation files (the "Software"), to deal
+# in the Software without restriction, including without limitation the rights
+# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+# copies of the Software, and to permit persons to whom the Software is
+# furnished to do so, subject to the following conditions:
+#
+# The above copyright notice and this permission notice shall be included in
+# all copies or substantial portions of the Software.
+#
+# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+# THE SOFTWARE.
+#
+
+top_srcdir = ../..
+test_objs = host.o mpu1.task_eo mpu2.task_eo
+
+include $(top_srcdir)/scripts/config.mk
+include $(top_srcdir)/scripts/rules_item.mk
diff --git a/tests/TFP/TFP_36_010/host.c b/tests/TFP/TFP_36_010/host.c
new file mode 100644
index 0000000..5f5fb1f
--- /dev/null
+++ b/tests/TFP/TFP_36_010/host.c
@@ -0,0 +1,123 @@
+/*
+ * Copyright 2008 Sony Corporation
+ *
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a copy
+ * of this software and associated documentation files (the "Software"), to deal
+ * in the Software without restriction, including without limitation the rights
+ * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+ * copies of the Software, and to permit persons to whom the Software is
+ * furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included in
+ * all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+ * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+ * THE SOFTWARE.
+ */
+
+#include <unistd.h>
+#include <mars/mars.h>
+#include <libspe2.h>
+#include <mars_test.h>
+
+extern spe_program_handle_t mpu1_prog;
+extern spe_program_handle_t mpu2_prog;
+#define NUM_PATTERNS 3
+static uint32_t pattern[NUM_PATTERNS][2] = {
+/* pattern or chk_bit */
+ { 0x00000001UL, 0x01UL },
+ { 0x0000CAFEUL, 0x00008000UL },
+ { 0x10203040UL, 0x10000000UL }
+};
+static struct mars_context *mars_ctx;
+static struct mars_task_id task1_id, task2_id;
+static struct mars_task_args task1_args, task2_args;
+static uint64_t host_to_mpu_and[NUM_PATTERNS];
+static uint64_t host_to_mpu_or[NUM_PATTERNS];
+
+int main(void)
+{
+ int ret, i;
+ int32_t exit_code;
+
+ ret = mars_context_create(&mars_ctx, 0, 0);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+
+ for (i = 0; i < NUM_PATTERNS; i++) {
+ ret = mars_task_event_flag_create(
+ mars_ctx,
+ &host_to_mpu_and[i],
+ MARS_TASK_EVENT_FLAG_HOST_TO_MPU,
+ MARS_TASK_EVENT_FLAG_CLEAR_MANUAL);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+
+ ret = mars_task_event_flag_create(
+ mars_ctx,
+ &host_to_mpu_or[i],
+ MARS_TASK_EVENT_FLAG_HOST_TO_MPU,
+ MARS_TASK_EVENT_FLAG_CLEAR_MANUAL);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+
+ ret = mars_task_create(mars_ctx, &task1_id, NULL,
+ mpu1_prog.elf_image, MARS_TASK_CONTEXT_SAVE_ALL);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+
+ ret = mars_task_create(mars_ctx, &task2_id, NULL,
+ mpu2_prog.elf_image, MARS_TASK_CONTEXT_SAVE_ALL);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+
+ task1_args.type.u64[0] = host_to_mpu_and[i];
+ task1_args.type.u64[1] = (uint64_t)pattern[i][0];
+ ret = mars_task_schedule(&task1_id, &task1_args, 0);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+
+ task2_args.type.u64[0] = host_to_mpu_or[i];
+ task2_args.type.u64[1] = (uint64_t)pattern[i][0];
+ task2_args.type.u64[2] = (uint64_t)pattern[i][1];
+ ret = mars_task_schedule(&task2_id, &task2_args, 0);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+
+ sleep(1);
+
+ /* set bits for AND wait condition */
+ ret = mars_task_event_flag_set(host_to_mpu_and[i],
+ pattern[i][0]);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+ /* set bit for OR wait condition */
+ ret = mars_task_event_flag_set(host_to_mpu_or[i],
+ pattern[i][1]);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+
+ ret = mars_task_wait(&task1_id, &exit_code);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+ MARS_TEST_ASSERT_ERROR(exit_code, MARS_SUCCESS);
+
+ ret = mars_task_wait(&task2_id, &exit_code);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+ MARS_TEST_ASSERT_ERROR(exit_code, MARS_SUCCESS);
+
+ ret = mars_task_destroy(&task1_id);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+
+ ret = mars_task_destroy(&task2_id);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+
+ ret = mars_task_event_flag_destroy(host_to_mpu_and[i]);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+
+ ret = mars_task_event_flag_destroy(host_to_mpu_or[i]);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+ }
+
+ ret = mars_context_destroy(mars_ctx);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+
+ return 0;
+}
+
diff --git a/tests/TFP/TFP_36_010/mpu1.c b/tests/TFP/TFP_36_010/mpu1.c
new file mode 100644
index 0000000..5379ace
--- /dev/null
+++ b/tests/TFP/TFP_36_010/mpu1.c
@@ -0,0 +1,63 @@
+/*
+ * Copyright 2008 Sony Corporation
+ *
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a copy
+ * of this software and associated documentation files (the "Software"), to deal
+ * in the Software without restriction, including without limitation the rights
+ * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+ * copies of the Software, and to permit persons to whom the Software is
+ * furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included in
+ * all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+ * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+ * THE SOFTWARE.
+ */
+
+#include <mars/mars.h>
+#include <mars_task_test.h>
+
+int mars_task_main(const struct mars_task_args *task_args)
+{
+ int ret;
+ uint64_t host_to_mpu_ea = task_args->type.u64[0];
+ uint32_t flags = (uint32_t)task_args->type.u64[1];
+ uint32_t chk_bit;
+
+ /* wait condition AND */
+ while (1) {
+ ret = mars_task_event_flag_try_wait(
+ host_to_mpu_ea,
+ flags,
+ MARS_TASK_EVENT_FLAG_MASK_AND, NULL);
+ if (ret == MARS_SUCCESS)
+ break;
+ else if (ret == MARS_ERROR_BUSY)
+ continue;
+ else
+ MARS_TEST_ASSERT_ERROR(ret, 0);
+ }
+
+ /* check if all bits are cleard */
+ chk_bit = 0x01;
+ while (flags) {
+ if (flags & 0x01) {
+ ret = mars_task_event_flag_try_wait(
+ host_to_mpu_ea,
+ chk_bit,
+ MARS_TASK_EVENT_FLAG_MASK_AND, NULL);
+ /* if bit == 1, try_wait returns SUCCESS */
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+ }
+ flags >>= 1;
+ chk_bit <<= 1;
+ }
+ return 0;
+}
diff --git a/tests/TFP/TFP_36_010/mpu2.c b/tests/TFP/TFP_36_010/mpu2.c
new file mode 100644
index 0000000..314514c
--- /dev/null
+++ b/tests/TFP/TFP_36_010/mpu2.c
@@ -0,0 +1,64 @@
+/*
+ * Copyright 2008 Sony Corporation
+ *
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a copy
+ * of this software and associated documentation files (the "Software"), to deal
+ * in the Software without restriction, including without limitation the rights
+ * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+ * copies of the Software, and to permit persons to whom the Software is
+ * furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included in
+ * all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+ * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+ * THE SOFTWARE.
+ */
+
+#include <mars/mars.h>
+#include <mars_task_test.h>
+
+int mars_task_main(const struct mars_task_args *task_args)
+{
+ int ret;
+ uint64_t host_to_mpu_ea = task_args->type.u64[0];
+ uint32_t flags = (uint32_t)task_args->type.u64[1];
+ uint32_t set_flags = (uint32_t)task_args->type.u64[2];
+ uint32_t chk_bit;
+
+ /* wait condition OR */
+ while (1) {
+ ret = mars_task_event_flag_try_wait(
+ host_to_mpu_ea,
+ flags,
+ MARS_TASK_EVENT_FLAG_MASK_OR, NULL);
+ if (ret == MARS_SUCCESS)
+ break;
+ else if (ret == MARS_ERROR_BUSY)
+ continue;
+ else
+ MARS_TEST_ASSERT_ERROR(ret, 0);
+ }
+
+ /* check if all bits are cleard */
+ chk_bit = 0x01;
+ while (set_flags) {
+ if (set_flags & 0x01) {
+ ret = mars_task_event_flag_try_wait(
+ host_to_mpu_ea,
+ chk_bit,
+ MARS_TASK_EVENT_FLAG_MASK_AND, NULL);
+ /* if bit == 1, try_wait returns SUCCESS */
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+ }
+ set_flags >>= 1;
+ chk_bit <<= 1;
+ }
+ return 0;
+}
diff --git a/tests/TFP/TFP_36_011/Makefile b/tests/TFP/TFP_36_011/Makefile
new file mode 100644
index 0000000..432135a
--- /dev/null
+++ b/tests/TFP/TFP_36_011/Makefile
@@ -0,0 +1,28 @@
+#
+# Copyright 2008 Sony Corporation
+#
+#
+# Permission is hereby granted, free of charge, to any person obtaining a copy
+# of this software and associated documentation files (the "Software"), to deal
+# in the Software without restriction, including without limitation the rights
+# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+# copies of the Software, and to permit persons to whom the Software is
+# furnished to do so, subject to the following conditions:
+#
+# The above copyright notice and this permission notice shall be included in
+# all copies or substantial portions of the Software.
+#
+# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+# THE SOFTWARE.
+#
+
+top_srcdir = ../..
+test_objs = host.o mpu.task_eo
+
+include $(top_srcdir)/scripts/config.mk
+include $(top_srcdir)/scripts/rules_item.mk
diff --git a/tests/TFP/TFP_36_011/host.c b/tests/TFP/TFP_36_011/host.c
new file mode 100644
index 0000000..1e6d8d2
--- /dev/null
+++ b/tests/TFP/TFP_36_011/host.c
@@ -0,0 +1,213 @@
+/*
+ * Copyright 2008 Sony Corporation
+ *
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a copy
+ * of this software and associated documentation files (the "Software"), to deal
+ * in the Software without restriction, including without limitation the rights
+ * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+ * copies of the Software, and to permit persons to whom the Software is
+ * furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included in
+ * all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+ * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+ * THE SOFTWARE.
+ */
+
+#include <pthread.h>
+#include <mars/mars.h>
+#include <libspe2.h>
+#include <mars_test.h>
+
+#define EVENT_FLAG_SIZE 32
+
+extern spe_program_handle_t mpu_prog;
+#define NUM_PATTERNS 3
+static uint32_t pattern[NUM_PATTERNS][2] = {
+/* pattern or chk_bit */
+ { 0x00000001UL, 0x01UL },
+ { 0x0000CAFEUL, 0x00008000UL },
+ { 0x10203040UL, 0x10000000UL }
+};
+static struct mars_context *mars_ctx;
+static struct mars_task_id task1_id, task2_id;
+static struct mars_task_args task1_args, task2_args;
+static struct mars_task_args thread1_args, thread2_args;
+static uint64_t mpu_to_host_and[NUM_PATTERNS];
+static uint64_t mpu_to_host_or[NUM_PATTERNS];
+static pthread_t thread1, thread2;
+
+static void *thread1_proc(void *ptr)
+{
+ int ret;
+ struct mars_task_args *task_args = (struct mars_task_args *)ptr;
+ uint32_t id = (uint32_t)task_args->type.u32[0];
+ uint32_t flags = task_args->type.u32[1];
+ uint32_t chk_bit;
+
+ /* wait condition AND */
+ while (1) {
+ ret = mars_task_event_flag_try_wait(
+ mpu_to_host_and[id],
+ flags,
+ MARS_TASK_EVENT_FLAG_MASK_AND, NULL);
+ if (ret == MARS_SUCCESS)
+ break;
+ else if (ret == MARS_ERROR_BUSY)
+ continue;
+ else
+ MARS_TEST_ASSERT_ERROR(ret, 0);
+ }
+
+ /* check if all bits are cleard */
+ chk_bit = 0x01;
+ while (flags) {
+ if (flags & 0x01) {
+ ret = mars_task_event_flag_try_wait(
+ mpu_to_host_and[id],
+ chk_bit,
+ MARS_TASK_EVENT_FLAG_MASK_AND, NULL);
+ /* if bit == 1, try_wait returns SUCCESS */
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+ }
+ flags >>= 1;
+ chk_bit <<= 1;
+ }
+
+ return NULL;
+}
+
+static void *thread2_proc(void *ptr)
+{
+ int ret;
+ struct mars_task_args *task_args = (struct mars_task_args *)ptr;
+ uint32_t id = (uint32_t)task_args->type.u32[0];
+ uint32_t flags = task_args->type.u32[1];
+ uint32_t set_flags = task_args->type.u32[2];
+ uint32_t chk_bit;
+
+ /* wait condition OR */
+ while (1) {
+ ret = mars_task_event_flag_try_wait(
+ mpu_to_host_or[id],
+ flags,
+ MARS_TASK_EVENT_FLAG_MASK_OR, NULL);
+ if (ret == MARS_SUCCESS)
+ break;
+ else if (ret == MARS_ERROR_BUSY)
+ continue;
+ else
+ MARS_TEST_ASSERT_ERROR(ret, 0);
+ }
+
+ /* check if all bits are cleard */
+ chk_bit = 0x01;
+ while (set_flags) {
+ if (set_flags & 0x01) {
+ ret = mars_task_event_flag_try_wait(
+ mpu_to_host_or[id],
+ chk_bit,
+ MARS_TASK_EVENT_FLAG_MASK_AND, NULL);
+ /* if bit == 1, try_wait returns SUCCESS */
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+ }
+ set_flags >>= 1;
+ chk_bit <<= 1;
+ }
+
+ return NULL;
+}
+
+int main(void)
+{
+ int ret, i;
+ int32_t exit_code;
+
+ ret = mars_context_create(&mars_ctx, 0, 0);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+
+ for (i = 0; i < NUM_PATTERNS; i++) {
+ ret = mars_task_event_flag_create(
+ mars_ctx,
+ &mpu_to_host_and[i],
+ MARS_TASK_EVENT_FLAG_MPU_TO_HOST,
+ MARS_TASK_EVENT_FLAG_CLEAR_MANUAL);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+
+ ret = mars_task_event_flag_create(
+ mars_ctx,
+ &mpu_to_host_or[i],
+ MARS_TASK_EVENT_FLAG_MPU_TO_HOST,
+ MARS_TASK_EVENT_FLAG_CLEAR_MANUAL);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+
+ ret = mars_task_create(mars_ctx, &task1_id, NULL,
+ mpu_prog.elf_image,
+ MARS_TASK_CONTEXT_SAVE_ALL);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+
+ ret = mars_task_create(mars_ctx, &task2_id, NULL,
+ mpu_prog.elf_image,
+ MARS_TASK_CONTEXT_SAVE_ALL);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+
+ thread1_args.type.u32[0] = (uint32_t)i;
+ thread1_args.type.u32[1] = pattern[i][0];
+ pthread_create(&thread1, NULL,
+ thread1_proc, &thread1_args);
+
+ thread2_args.type.u32[0] = (uint32_t)i;
+ thread2_args.type.u32[1] = pattern[i][0]; /* wait */
+ thread2_args.type.u32[2] = pattern[i][1]; /* set */
+ pthread_create(&thread2, NULL,
+ thread2_proc, &thread2_args);
+
+ /* set flags AND condition */
+ task1_args.type.u64[0] = mpu_to_host_and[i];
+ task1_args.type.u64[1] = (uint64_t)pattern[i][0];
+ ret = mars_task_schedule(&task1_id, &task1_args, 0);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+
+ /* set flags OR conditon */
+ task2_args.type.u64[0] = mpu_to_host_or[i];
+ task2_args.type.u64[1] = (uint64_t)pattern[i][1];
+ ret = mars_task_schedule(&task2_id, &task2_args, 0);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+
+ pthread_join(thread1, NULL);
+ pthread_join(thread2, NULL);
+
+ ret = mars_task_wait(&task1_id, &exit_code);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+ MARS_TEST_ASSERT_ERROR(exit_code, MARS_SUCCESS);
+
+ ret = mars_task_wait(&task2_id, &exit_code);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+ MARS_TEST_ASSERT_ERROR(exit_code, MARS_SUCCESS);
+
+ ret = mars_task_destroy(&task1_id);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+
+ ret = mars_task_destroy(&task2_id);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+
+ ret = mars_task_event_flag_destroy(mpu_to_host_and[i]);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+
+ ret = mars_task_event_flag_destroy(mpu_to_host_or[i]);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+ }
+
+ ret = mars_context_destroy(mars_ctx);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+
+ return 0;
+}
+
diff --git a/tests/TFP/TFP_36_011/mpu.c b/tests/TFP/TFP_36_011/mpu.c
new file mode 100644
index 0000000..4fdbceb
--- /dev/null
+++ b/tests/TFP/TFP_36_011/mpu.c
@@ -0,0 +1,37 @@
+/*
+ * Copyright 2008 Sony Corporation
+ *
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a copy
+ * of this software and associated documentation files (the "Software"), to deal
+ * in the Software without restriction, including without limitation the rights
+ * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+ * copies of the Software, and to permit persons to whom the Software is
+ * furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included in
+ * all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+ * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+ * THE SOFTWARE.
+ */
+
+#include <mars/mars.h>
+#include <mars_task_test.h>
+
+int mars_task_main(const struct mars_task_args *task_args)
+{
+ int ret;
+ uint64_t mpu_to_host_ea = task_args->type.u64[0];
+ uint32_t chk_bit = (uint32_t)task_args->type.u64[1];
+
+ ret = mars_task_event_flag_set(mpu_to_host_ea, chk_bit);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+
+ return 0;
+}
diff --git a/tests/TFP/TFP_36_012/Makefile b/tests/TFP/TFP_36_012/Makefile
new file mode 100644
index 0000000..72cf999
--- /dev/null
+++ b/tests/TFP/TFP_36_012/Makefile
@@ -0,0 +1,28 @@
+#
+# Copyright 2008 Sony Corporation
+#
+#
+# Permission is hereby granted, free of charge, to any person obtaining a copy
+# of this software and associated documentation files (the "Software"), to deal
+# in the Software without restriction, including without limitation the rights
+# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+# copies of the Software, and to permit persons to whom the Software is
+# furnished to do so, subject to the following conditions:
+#
+# The above copyright notice and this permission notice shall be included in
+# all copies or substantial portions of the Software.
+#
+# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+# THE SOFTWARE.
+#
+
+top_srcdir = ../..
+test_objs = host.o mpu1.task_eo mpu2.task_eo mpu3.task_eo
+
+include $(top_srcdir)/scripts/config.mk
+include $(top_srcdir)/scripts/rules_item.mk
diff --git a/tests/TFP/TFP_36_012/host.c b/tests/TFP/TFP_36_012/host.c
new file mode 100644
index 0000000..a7d15aa
--- /dev/null
+++ b/tests/TFP/TFP_36_012/host.c
@@ -0,0 +1,150 @@
+/*
+ * Copyright 2008 Sony Corporation
+ *
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a copy
+ * of this software and associated documentation files (the "Software"), to deal
+ * in the Software without restriction, including without limitation the rights
+ * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+ * copies of the Software, and to permit persons to whom the Software is
+ * furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included in
+ * all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+ * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+ * THE SOFTWARE.
+ */
+
+#include <unistd.h>
+#include <mars/mars.h>
+#include <libspe2.h>
+#include <mars_test.h>
+
+extern spe_program_handle_t mpu1_prog;
+extern spe_program_handle_t mpu2_prog;
+extern spe_program_handle_t mpu3_prog;
+#define NUM_PATTERNS 3
+static uint32_t pattern[NUM_PATTERNS][2] = {
+/* pattern or chk_bit */
+ { 0x00000001UL, 0x01UL },
+ { 0x0000CAFEUL, 0x00008000UL },
+ { 0x10203040UL, 0x10000000UL }
+};
+static struct mars_context *mars_ctx;
+static struct mars_task_id task1_id, task2_id, task3_id;
+static struct mars_task_args task1_args, task2_args, task3_args;
+static uint64_t mpu_to_mpu_and[NUM_PATTERNS];
+static uint64_t mpu_to_mpu_or[NUM_PATTERNS];
+
+int main(void)
+{
+ int ret, i;
+ int32_t exit_code;
+
+ ret = mars_context_create(&mars_ctx, 0, 0);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+
+ for (i = 0; i < NUM_PATTERNS; i++) {
+ ret = mars_task_event_flag_create(
+ mars_ctx,
+ &mpu_to_mpu_and[i],
+ MARS_TASK_EVENT_FLAG_MPU_TO_MPU,
+ MARS_TASK_EVENT_FLAG_CLEAR_MANUAL);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+
+ ret = mars_task_event_flag_create(
+ mars_ctx,
+ &mpu_to_mpu_or[i],
+ MARS_TASK_EVENT_FLAG_MPU_TO_MPU,
+ MARS_TASK_EVENT_FLAG_CLEAR_MANUAL);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+
+ ret = mars_task_create(mars_ctx, &task1_id, NULL,
+ mpu1_prog.elf_image, MARS_TASK_CONTEXT_SAVE_ALL);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+
+ ret = mars_task_create(mars_ctx, &task2_id, NULL,
+ mpu2_prog.elf_image, MARS_TASK_CONTEXT_SAVE_ALL);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+
+ task1_args.type.u64[0] = mpu_to_mpu_and[i];
+ task1_args.type.u64[1] = (uint64_t)pattern[i][0];
+ ret = mars_task_schedule(&task1_id, &task1_args, 0);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+
+ task2_args.type.u64[0] = mpu_to_mpu_or[i];
+ task2_args.type.u64[1] = (uint64_t)pattern[i][0];
+ task2_args.type.u64[2] = (uint64_t)pattern[i][1];
+ ret = mars_task_schedule(&task2_id, &task2_args, 0);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+
+ sleep(1);
+
+ /* set bits for AND wait condition */
+ ret = mars_task_create(mars_ctx, &task3_id, NULL,
+ mpu3_prog.elf_image, MARS_TASK_CONTEXT_SAVE_ALL);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+
+ task3_args.type.u64[0] = mpu_to_mpu_and[i];
+ task3_args.type.u64[1] = (uint64_t)pattern[i][0]; /* AND */
+ ret = mars_task_schedule(&task3_id, &task3_args, 0);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+
+ ret = mars_task_wait(&task3_id, &exit_code);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+ MARS_TEST_ASSERT_ERROR(exit_code, MARS_SUCCESS);
+
+ ret = mars_task_destroy(&task3_id);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+
+ /* set bit for OR wait condition */
+ ret = mars_task_create(mars_ctx, &task3_id, NULL,
+ mpu3_prog.elf_image, MARS_TASK_CONTEXT_SAVE_ALL);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+
+ task3_args.type.u64[0] = mpu_to_mpu_or[i];
+ task3_args.type.u64[1] = (uint64_t)pattern[i][1]; /* OR */
+ ret = mars_task_schedule(&task3_id, &task3_args, 0);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+
+ ret = mars_task_wait(&task3_id, &exit_code);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+ MARS_TEST_ASSERT_ERROR(exit_code, MARS_SUCCESS);
+
+ ret = mars_task_destroy(&task3_id);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+
+ /* wait for try_wait task */
+ ret = mars_task_wait(&task1_id, &exit_code);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+ MARS_TEST_ASSERT_ERROR(exit_code, MARS_SUCCESS);
+
+ ret = mars_task_wait(&task2_id, &exit_code);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+ MARS_TEST_ASSERT_ERROR(exit_code, MARS_SUCCESS);
+
+ ret = mars_task_destroy(&task1_id);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+
+ ret = mars_task_destroy(&task2_id);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+
+ ret = mars_task_event_flag_destroy(mpu_to_mpu_and[i]);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+
+ ret = mars_task_event_flag_destroy(mpu_to_mpu_or[i]);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+ }
+
+ ret = mars_context_destroy(mars_ctx);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+
+ return 0;
+}
+
diff --git a/tests/TFP/TFP_36_012/mpu1.c b/tests/TFP/TFP_36_012/mpu1.c
new file mode 100644
index 0000000..3693939
--- /dev/null
+++ b/tests/TFP/TFP_36_012/mpu1.c
@@ -0,0 +1,63 @@
+/*
+ * Copyright 2008 Sony Corporation
+ *
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a copy
+ * of this software and associated documentation files (the "Software"), to deal
+ * in the Software without restriction, including without limitation the rights
+ * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+ * copies of the Software, and to permit persons to whom the Software is
+ * furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included in
+ * all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+ * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+ * THE SOFTWARE.
+ */
+
+#include <mars/mars.h>
+#include <mars_task_test.h>
+
+int mars_task_main(const struct mars_task_args *task_args)
+{
+ int ret;
+ uint64_t mpu_to_mpu_ea = task_args->type.u64[0];
+ uint32_t flags = (uint32_t)task_args->type.u64[1];
+ uint32_t chk_bit;
+
+ /* wait condition AND */
+ while (1) {
+ ret = mars_task_event_flag_try_wait(
+ mpu_to_mpu_ea,
+ flags,
+ MARS_TASK_EVENT_FLAG_MASK_AND, NULL);
+ if (ret == MARS_SUCCESS)
+ break;
+ else if (ret == MARS_ERROR_BUSY)
+ continue;
+ else
+ MARS_TEST_ASSERT_ERROR(ret, 0);
+ }
+
+ /* check if all bits are cleard */
+ chk_bit = 0x01;
+ while (flags) {
+ if (flags & 0x01) {
+ ret = mars_task_event_flag_try_wait(
+ mpu_to_mpu_ea,
+ chk_bit,
+ MARS_TASK_EVENT_FLAG_MASK_AND, NULL);
+ /* if bit == 1, try_wait returns SUCCESS */
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+ }
+ flags >>= 1;
+ chk_bit <<= 1;
+ }
+ return 0;
+}
diff --git a/tests/TFP/TFP_36_012/mpu2.c b/tests/TFP/TFP_36_012/mpu2.c
new file mode 100644
index 0000000..3185051
--- /dev/null
+++ b/tests/TFP/TFP_36_012/mpu2.c
@@ -0,0 +1,64 @@
+/*
+ * Copyright 2008 Sony Corporation
+ *
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a copy
+ * of this software and associated documentation files (the "Software"), to deal
+ * in the Software without restriction, including without limitation the rights
+ * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+ * copies of the Software, and to permit persons to whom the Software is
+ * furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included in
+ * all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+ * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+ * THE SOFTWARE.
+ */
+
+#include <mars/mars.h>
+#include <mars_task_test.h>
+
+int mars_task_main(const struct mars_task_args *task_args)
+{
+ int ret;
+ uint64_t mpu_to_mpu_ea = task_args->type.u64[0];
+ uint32_t flags = (uint32_t)task_args->type.u64[1];
+ uint32_t set_flags = (uint32_t)task_args->type.u64[2];
+ uint32_t chk_bit;
+
+ /* wait condition OR */
+ while (1) {
+ ret = mars_task_event_flag_try_wait(
+ mpu_to_mpu_ea,
+ flags,
+ MARS_TASK_EVENT_FLAG_MASK_OR, NULL);
+ if (ret == MARS_SUCCESS)
+ break;
+ else if (ret == MARS_ERROR_BUSY)
+ continue;
+ else
+ MARS_TEST_ASSERT_ERROR(ret, 0);
+ }
+
+ /* check if all bits are cleard */
+ chk_bit = 0x01;
+ while (set_flags) {
+ if (set_flags & 0x01) {
+ ret = mars_task_event_flag_try_wait(
+ mpu_to_mpu_ea,
+ chk_bit,
+ MARS_TASK_EVENT_FLAG_MASK_AND, NULL);
+ /* if bit == 1, try_wait returns SUCCESS */
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+ }
+ set_flags >>= 1;
+ chk_bit <<= 1;
+ }
+ return 0;
+}
diff --git a/tests/TFP/TFP_36_012/mpu3.c b/tests/TFP/TFP_36_012/mpu3.c
new file mode 100644
index 0000000..65f3252
--- /dev/null
+++ b/tests/TFP/TFP_36_012/mpu3.c
@@ -0,0 +1,37 @@
+/*
+ * Copyright 2008 Sony Corporation
+ *
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a copy
+ * of this software and associated documentation files (the "Software"), to deal
+ * in the Software without restriction, including without limitation the rights
+ * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+ * copies of the Software, and to permit persons to whom the Software is
+ * furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included in
+ * all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+ * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+ * THE SOFTWARE.
+ */
+
+#include <mars/mars.h>
+#include <mars_task_test.h>
+
+int mars_task_main(const struct mars_task_args *task_args)
+{
+ int ret;
+ uint64_t mpu_to_mpu_ea = task_args->type.u64[0];
+ uint32_t chk_bit = (uint32_t)task_args->type.u64[1];
+
+ ret = mars_task_event_flag_set(mpu_to_mpu_ea, chk_bit);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+
+ return 0;
+}
diff --git a/tests/TFP/TFP_41_001/Makefile b/tests/TFP/TFP_41_001/Makefile
new file mode 100644
index 0000000..43ba573
--- /dev/null
+++ b/tests/TFP/TFP_41_001/Makefile
@@ -0,0 +1,28 @@
+#
+# Copyright 2008 Sony Corporation
+#
+#
+# Permission is hereby granted, free of charge, to any person obtaining a copy
+# of this software and associated documentation files (the "Software"), to deal
+# in the Software without restriction, including without limitation the rights
+# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+# copies of the Software, and to permit persons to whom the Software is
+# furnished to do so, subject to the following conditions:
+#
+# The above copyright notice and this permission notice shall be included in
+# all copies or substantial portions of the Software.
+#
+# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+# THE SOFTWARE.
+#
+
+top_srcdir = ../..
+test_objs = host.o
+
+include $(top_srcdir)/scripts/config.mk
+include $(top_srcdir)/scripts/rules_item.mk
diff --git a/tests/TFP/TFP_41_001/host.c b/tests/TFP/TFP_41_001/host.c
new file mode 100644
index 0000000..c27218a
--- /dev/null
+++ b/tests/TFP/TFP_41_001/host.c
@@ -0,0 +1,116 @@
+/*
+ * Copyright 2008 Sony Corporation
+ *
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a copy
+ * of this software and associated documentation files (the "Software"), to deal
+ * in the Software without restriction, including without limitation the rights
+ * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+ * copies of the Software, and to permit persons to whom the Software is
+ * furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included in
+ * all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+ * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+ * THE SOFTWARE.
+ */
+
+#include <mars/mars.h>
+#include <libspe2.h>
+#include <mars_test.h>
+
+
+#define Q_SIZE_MIN 16
+#define Q_SIZE_MAX MARS_TASK_QUEUE_ENTRY_SIZE_MAX
+#define Q_DEPTH_MIN 1
+#define Q_DEPTH_MAX (16 * 1024) /* XXX */
+
+static struct mars_context *mars_ctx;
+
+#define NUM_TYPE 3
+static uint32_t type[NUM_TYPE] = {
+ MARS_TASK_QUEUE_HOST_TO_MPU,
+ MARS_TASK_QUEUE_MPU_TO_HOST,
+ MARS_TASK_QUEUE_MPU_TO_MPU
+};
+static uint64_t q[NUM_TYPE][4];
+
+int main(void)
+{
+ int ret, i, j;
+ uint32_t count;
+
+ ret = mars_context_create(&mars_ctx, 0, 0);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+
+ for (i = 0; i < NUM_TYPE; i++) {
+ /* DEPTH_MIN, SIZE_MIN */
+ ret = mars_task_queue_create(
+ mars_ctx,
+ &q[i][0],
+ sizeof(char) * Q_SIZE_MIN,
+ Q_DEPTH_MIN,
+ type[i]);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+
+ ret = mars_task_queue_count(q[i][0], &count);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+ MARS_TEST_ASSERT_EQUAL(count, 0);
+
+ /* DEPTH_MAX, SIZE_MIN */
+ ret = mars_task_queue_create(
+ mars_ctx,
+ &q[i][1],
+ sizeof(char) * Q_SIZE_MIN,
+ Q_DEPTH_MAX,
+ type[i]);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+
+ ret = mars_task_queue_count(q[i][1], &count);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+ MARS_TEST_ASSERT_EQUAL(count, 0);
+
+ /* DEPTH_MIN, SIZE_MAX */
+ ret = mars_task_queue_create(
+ mars_ctx,
+ &q[i][2],
+ sizeof(char) * Q_SIZE_MAX,
+ Q_DEPTH_MIN,
+ type[i]);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+
+ ret = mars_task_queue_count(q[i][2], &count);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+ MARS_TEST_ASSERT_EQUAL(count, 0);
+
+ /* DEPTH_MAX, SIZE_MAX */
+ ret = mars_task_queue_create(
+ mars_ctx,
+ &q[i][3],
+ sizeof(char) * Q_SIZE_MAX,
+ Q_DEPTH_MAX,
+ type[i]);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+
+ ret = mars_task_queue_count(q[i][3], &count);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+ MARS_TEST_ASSERT_EQUAL(count, 0);
+
+ for (j = 0; j < 4; j++) {
+ ret = mars_task_queue_destroy(q[i][j]);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+ }
+ }
+
+ ret = mars_context_destroy(mars_ctx);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+
+ return 0;
+}
+
diff --git a/tests/TFP/TFP_41_003/Makefile b/tests/TFP/TFP_41_003/Makefile
new file mode 100644
index 0000000..43ba573
--- /dev/null
+++ b/tests/TFP/TFP_41_003/Makefile
@@ -0,0 +1,28 @@
+#
+# Copyright 2008 Sony Corporation
+#
+#
+# Permission is hereby granted, free of charge, to any person obtaining a copy
+# of this software and associated documentation files (the "Software"), to deal
+# in the Software without restriction, including without limitation the rights
+# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+# copies of the Software, and to permit persons to whom the Software is
+# furnished to do so, subject to the following conditions:
+#
+# The above copyright notice and this permission notice shall be included in
+# all copies or substantial portions of the Software.
+#
+# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+# THE SOFTWARE.
+#
+
+top_srcdir = ../..
+test_objs = host.o
+
+include $(top_srcdir)/scripts/config.mk
+include $(top_srcdir)/scripts/rules_item.mk
diff --git a/tests/TFP/TFP_41_003/host.c b/tests/TFP/TFP_41_003/host.c
new file mode 100644
index 0000000..06b9d16
--- /dev/null
+++ b/tests/TFP/TFP_41_003/host.c
@@ -0,0 +1,75 @@
+/*
+ * Copyright 2008 Sony Corporation
+ *
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a copy
+ * of this software and associated documentation files (the "Software"), to deal
+ * in the Software without restriction, including without limitation the rights
+ * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+ * copies of the Software, and to permit persons to whom the Software is
+ * furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included in
+ * all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+ * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+ * THE SOFTWARE.
+ */
+
+#include <pthread.h>
+#include <libspe2.h>
+#include <mars/mars.h>
+#include <mars_test.h>
+
+#define THREAD_COUNT 16
+#define QUEUE_DEPTH 16
+
+static struct mars_context *mars;
+static pthread_t threads[THREAD_COUNT];
+static uint64_t queues[THREAD_COUNT];
+
+void *thread_proc(void *arg)
+{
+ int ret;
+
+ ret = mars_task_queue_create(
+ mars,
+ &queues[mars_ptr_to_ea(arg)],
+ 16,
+ QUEUE_DEPTH,
+ MARS_TASK_QUEUE_HOST_TO_MPU);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+
+ ret = mars_task_queue_destroy(queues[mars_ptr_to_ea(arg)]);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+
+ return NULL;
+}
+
+int main(void)
+{
+ int i, ret;
+
+ ret = mars_context_create(&mars, 0, 0);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+
+ for (i = 0; i < THREAD_COUNT; i++)
+ pthread_create(
+ &threads[i],
+ NULL,
+ thread_proc,
+ (void *)(intptr_t)i);
+
+ for (i = 0; i < THREAD_COUNT; i++)
+ pthread_join(threads[i], NULL);
+
+ ret = mars_context_destroy(mars);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+
+ return 0;
+}
diff --git a/tests/TFP/TFP_43_001/Makefile b/tests/TFP/TFP_43_001/Makefile
new file mode 100644
index 0000000..432135a
--- /dev/null
+++ b/tests/TFP/TFP_43_001/Makefile
@@ -0,0 +1,28 @@
+#
+# Copyright 2008 Sony Corporation
+#
+#
+# Permission is hereby granted, free of charge, to any person obtaining a copy
+# of this software and associated documentation files (the "Software"), to deal
+# in the Software without restriction, including without limitation the rights
+# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+# copies of the Software, and to permit persons to whom the Software is
+# furnished to do so, subject to the following conditions:
+#
+# The above copyright notice and this permission notice shall be included in
+# all copies or substantial portions of the Software.
+#
+# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+# THE SOFTWARE.
+#
+
+top_srcdir = ../..
+test_objs = host.o mpu.task_eo
+
+include $(top_srcdir)/scripts/config.mk
+include $(top_srcdir)/scripts/rules_item.mk
diff --git a/tests/TFP/TFP_43_001/host.c b/tests/TFP/TFP_43_001/host.c
new file mode 100644
index 0000000..d9f0a2d
--- /dev/null
+++ b/tests/TFP/TFP_43_001/host.c
@@ -0,0 +1,102 @@
+/*
+ * Copyright 2008 Sony Corporation
+ *
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a copy
+ * of this software and associated documentation files (the "Software"), to deal
+ * in the Software without restriction, including without limitation the rights
+ * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+ * copies of the Software, and to permit persons to whom the Software is
+ * furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included in
+ * all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+ * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+ * THE SOFTWARE.
+ */
+
+#include <mars/mars.h>
+#include <libspe2.h>
+#include <mars_test.h>
+
+
+#define Q_SIZE 128
+struct queue_entry {
+ char text[Q_SIZE];
+};
+#define Q_DEPTH 1024
+
+#define NUM_LOOP 3
+static uint32_t depth_size[] =
+{
+ 1,
+ Q_DEPTH / 2,
+ Q_DEPTH
+};
+extern spe_program_handle_t mpu_prog;
+
+static struct mars_context *mars_ctx;
+static struct mars_task_args task_args;
+static struct mars_task_id task_id;
+
+static uint64_t mpu_to_host[NUM_LOOP];
+
+int main(void)
+{
+ int ret, i;
+ int32_t exit_code;
+ uint32_t count;
+
+ ret = mars_context_create(&mars_ctx, 0, 0);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+
+ for (i = 0; i < NUM_LOOP; i++) {
+ ret = mars_task_queue_create(
+ mars_ctx,
+ &mpu_to_host[i],
+ sizeof(struct queue_entry),
+ depth_size[i],
+ MARS_TASK_QUEUE_MPU_TO_HOST);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+
+ ret = mars_task_queue_count(mpu_to_host[i], &count);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+ MARS_TEST_ASSERT_EQUAL(count, 0);
+
+ ret = mars_task_create(mars_ctx, &task_id, NULL,
+ mpu_prog.elf_image, MARS_TASK_CONTEXT_SAVE_ALL);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+
+ task_args.type.u64[0] = mpu_to_host[i];
+ task_args.type.u64[1] = (uint64_t)depth_size[i];
+ ret = mars_task_schedule(&task_id, &task_args, 0);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+
+ ret = mars_task_wait(&task_id, &exit_code);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+ MARS_TEST_ASSERT_ERROR(exit_code, MARS_SUCCESS);
+
+ ret = mars_task_destroy(&task_id);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+
+ /* check queue count */
+ ret = mars_task_queue_count(mpu_to_host[i], &count);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+ MARS_TEST_ASSERT_EQUAL(count, depth_size[i]);
+
+ ret = mars_task_queue_destroy(mpu_to_host[i]);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+ }
+
+ ret = mars_context_destroy(mars_ctx);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+
+ return 0;
+}
+
diff --git a/tests/TFP/TFP_43_001/mpu.c b/tests/TFP/TFP_43_001/mpu.c
new file mode 100644
index 0000000..e9a3ef9
--- /dev/null
+++ b/tests/TFP/TFP_43_001/mpu.c
@@ -0,0 +1,50 @@
+/*
+ * Copyright 2008 Sony Corporation
+ *
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a copy
+ * of this software and associated documentation files (the "Software"), to deal
+ * in the Software without restriction, including without limitation the rights
+ * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+ * copies of the Software, and to permit persons to whom the Software is
+ * furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included in
+ * all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+ * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+ * THE SOFTWARE.
+ */
+
+#include <mars/mars.h>
+#include <mars_task_test.h>
+
+#define Q_SIZE 128
+struct queue_entry {
+ char text[Q_SIZE];
+};
+static struct queue_entry data;
+
+int mars_task_main(const struct mars_task_args *task_args)
+{
+ int ret, i;
+ uint64_t mpu_to_host_ea = task_args->type.u64[0];
+ uint32_t num_push = (uint32_t)task_args->type.u64[1];
+ uint32_t count;
+
+ for (i = 0; i < num_push; i++) {
+ ret = mars_task_queue_push(mpu_to_host_ea, &data);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+ }
+
+ ret = mars_task_queue_count(mpu_to_host_ea, &count);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+ MARS_TEST_ASSERT_EQUAL(count, num_push);
+
+ return 0;
+}
diff --git a/tests/TFP/TFP_43_002/Makefile b/tests/TFP/TFP_43_002/Makefile
new file mode 100644
index 0000000..432135a
--- /dev/null
+++ b/tests/TFP/TFP_43_002/Makefile
@@ -0,0 +1,28 @@
+#
+# Copyright 2008 Sony Corporation
+#
+#
+# Permission is hereby granted, free of charge, to any person obtaining a copy
+# of this software and associated documentation files (the "Software"), to deal
+# in the Software without restriction, including without limitation the rights
+# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+# copies of the Software, and to permit persons to whom the Software is
+# furnished to do so, subject to the following conditions:
+#
+# The above copyright notice and this permission notice shall be included in
+# all copies or substantial portions of the Software.
+#
+# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+# THE SOFTWARE.
+#
+
+top_srcdir = ../..
+test_objs = host.o mpu.task_eo
+
+include $(top_srcdir)/scripts/config.mk
+include $(top_srcdir)/scripts/rules_item.mk
diff --git a/tests/TFP/TFP_43_002/host.c b/tests/TFP/TFP_43_002/host.c
new file mode 100644
index 0000000..53c93b3
--- /dev/null
+++ b/tests/TFP/TFP_43_002/host.c
@@ -0,0 +1,107 @@
+/*
+ * Copyright 2008 Sony Corporation
+ *
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a copy
+ * of this software and associated documentation files (the "Software"), to deal
+ * in the Software without restriction, including without limitation the rights
+ * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+ * copies of the Software, and to permit persons to whom the Software is
+ * furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included in
+ * all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+ * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+ * THE SOFTWARE.
+ */
+
+#include <mars/mars.h>
+#include <libspe2.h>
+#include <mars_test.h>
+
+#define Q_SIZE 128
+struct queue_entry {
+ char text[Q_SIZE];
+};
+#define Q_DEPTH 1024
+
+#define NUM_LOOP 3
+static uint32_t depth_size[] =
+{
+ 1,
+ Q_DEPTH / 2,
+ Q_DEPTH
+};
+extern spe_program_handle_t mpu_prog;
+
+static struct mars_context *mars_ctx;
+static struct mars_task_args task_args;
+static struct mars_task_id task_id;
+
+static uint64_t host_to_mpu[NUM_LOOP];
+static struct queue_entry data;
+
+int main(void)
+{
+ int ret, i;
+ int32_t exit_code;
+ uint32_t num, count;
+
+ ret = mars_context_create(&mars_ctx, 0, 0);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+
+ for (i = 0; i < NUM_LOOP; i++) {
+ ret = mars_task_queue_create(
+ mars_ctx,
+ &host_to_mpu[i],
+ sizeof(struct queue_entry),
+ depth_size[i],
+ MARS_TASK_QUEUE_HOST_TO_MPU);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+
+ ret = mars_task_queue_count(host_to_mpu[i], &count);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+ MARS_TEST_ASSERT_EQUAL(count, 0);
+
+ ret = mars_task_create(mars_ctx, &task_id, NULL,
+ mpu_prog.elf_image, MARS_TASK_CONTEXT_SAVE_ALL);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+
+ for (num = 0; num < depth_size[i]; num++) {
+ ret = mars_task_queue_push(host_to_mpu[i], &data);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+ }
+
+ /* check queue count */
+ ret = mars_task_queue_count(host_to_mpu[i], &count);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+ MARS_TEST_ASSERT_EQUAL(count, depth_size[i]);
+
+ task_args.type.u64[0] = host_to_mpu[i];
+ task_args.type.u64[1] = (uint64_t)depth_size[i];
+ ret = mars_task_schedule(&task_id, &task_args, 0);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+
+ ret = mars_task_wait(&task_id, &exit_code);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+ MARS_TEST_ASSERT_ERROR(exit_code, MARS_SUCCESS);
+
+ ret = mars_task_destroy(&task_id);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+
+ ret = mars_task_queue_destroy(host_to_mpu[i]);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+ }
+
+ ret = mars_context_destroy(mars_ctx);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+
+ return 0;
+}
+
diff --git a/tests/TFP/TFP_43_002/mpu.c b/tests/TFP/TFP_43_002/mpu.c
new file mode 100644
index 0000000..1af2425
--- /dev/null
+++ b/tests/TFP/TFP_43_002/mpu.c
@@ -0,0 +1,44 @@
+/*
+ * Copyright 2008 Sony Corporation
+ *
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a copy
+ * of this software and associated documentation files (the "Software"), to deal
+ * in the Software without restriction, including without limitation the rights
+ * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+ * copies of the Software, and to permit persons to whom the Software is
+ * furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included in
+ * all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+ * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+ * THE SOFTWARE.
+ */
+
+#include <mars/mars.h>
+#include <mars_task_test.h>
+
+#define Q_SIZE 128
+struct queue_entry {
+ char text[Q_SIZE];
+};
+
+int mars_task_main(const struct mars_task_args *task_args)
+{
+ int ret;
+ uint64_t host_to_mpu_ea = task_args->type.u64[0];
+ uint32_t num_push = (uint32_t)task_args->type.u64[1];
+ uint32_t count;
+
+ ret = mars_task_queue_count(host_to_mpu_ea, &count);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+ MARS_TEST_ASSERT_EQUAL(count, num_push);
+
+ return 0;
+}
diff --git a/tests/TFP/TFP_43_003/Makefile b/tests/TFP/TFP_43_003/Makefile
new file mode 100644
index 0000000..ecbce33
--- /dev/null
+++ b/tests/TFP/TFP_43_003/Makefile
@@ -0,0 +1,28 @@
+#
+# Copyright 2008 Sony Corporation
+#
+#
+# Permission is hereby granted, free of charge, to any person obtaining a copy
+# of this software and associated documentation files (the "Software"), to deal
+# in the Software without restriction, including without limitation the rights
+# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+# copies of the Software, and to permit persons to whom the Software is
+# furnished to do so, subject to the following conditions:
+#
+# The above copyright notice and this permission notice shall be included in
+# all copies or substantial portions of the Software.
+#
+# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+# THE SOFTWARE.
+#
+
+top_srcdir = ../..
+test_objs = host.o mpu1.task_eo mpu2.task_eo
+
+include $(top_srcdir)/scripts/config.mk
+include $(top_srcdir)/scripts/rules_item.mk
diff --git a/tests/TFP/TFP_43_003/host.c b/tests/TFP/TFP_43_003/host.c
new file mode 100644
index 0000000..2e4c1ed
--- /dev/null
+++ b/tests/TFP/TFP_43_003/host.c
@@ -0,0 +1,97 @@
+/*
+ * Copyright 2008 Sony Corporation
+ *
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a copy
+ * of this software and associated documentation files (the "Software"), to deal
+ * in the Software without restriction, including without limitation the rights
+ * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+ * copies of the Software, and to permit persons to whom the Software is
+ * furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included in
+ * all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+ * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+ * THE SOFTWARE.
+ */
+
+#include <libspe2.h>
+#include <mars/mars.h>
+#include <mars_test.h>
+
+#define QUEUE_DEPTH 16
+
+extern spe_program_handle_t mpu1_prog, mpu2_prog;
+
+static struct mars_context *mars;
+static struct mars_task_id pusher_task_id, counter_task_id;
+static struct mars_task_args task_args;
+static uint64_t queue;
+static uint32_t notify[32] __attribute__((aligned(128)));
+
+int main(void)
+{
+ int exit_code, ret;
+
+ ret = mars_context_create(&mars, 0, 0);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+
+ ret = mars_task_create(
+ mars,
+ &pusher_task_id,
+ "43003 pusher",
+ mpu1_prog.elf_image,
+ MARS_TASK_CONTEXT_SAVE_ALL);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+
+ ret = mars_task_create(
+ mars,
+ &counter_task_id,
+ "43003 counter",
+ mpu2_prog.elf_image,
+ MARS_TASK_CONTEXT_SAVE_ALL);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+
+ ret = mars_task_queue_create(
+ mars,
+ &queue,
+ 16,
+ QUEUE_DEPTH,
+ MARS_TASK_QUEUE_MPU_TO_MPU);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+
+ task_args.type.u64[0] = queue;
+ task_args.type.u64[1] = mars_ptr_to_ea(notify);
+ ret = mars_task_schedule(&pusher_task_id, &task_args, 0);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+
+ ret = mars_task_schedule(&counter_task_id, &task_args, 0);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+
+ ret = mars_task_wait(&pusher_task_id, &exit_code);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+ MARS_TEST_ASSERT_EQUAL(exit_code, 0);
+
+ ret = mars_task_wait(&counter_task_id, &exit_code);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+ MARS_TEST_ASSERT_EQUAL(exit_code, 0);
+
+ ret = mars_task_queue_destroy(queue);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+
+ ret = mars_task_destroy(&pusher_task_id);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+ ret = mars_task_destroy(&counter_task_id);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+
+ ret = mars_context_destroy(mars);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+
+ return 0;
+}
diff --git a/tests/TFP/TFP_43_003/mpu1.c b/tests/TFP/TFP_43_003/mpu1.c
new file mode 100644
index 0000000..666bc44
--- /dev/null
+++ b/tests/TFP/TFP_43_003/mpu1.c
@@ -0,0 +1,46 @@
+/*
+ * Copyright 2008 Sony Corporation
+ *
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a copy
+ * of this software and associated documentation files (the "Software"), to deal
+ * in the Software without restriction, including without limitation the rights
+ * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+ * copies of the Software, and to permit persons to whom the Software is
+ * furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included in
+ * all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+ * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+ * THE SOFTWARE.
+ */
+
+#include <string.h>
+#include <mars/mars.h>
+#include "mars_task_test.h"
+
+static uint64_t queue_item[2] __attribute__((aligned(16)));
+
+int mars_task_main(const struct mars_task_args *task_args)
+{
+ uint64_t queue_ea = task_args->type.u64[0];
+ uint64_t notify_ea = task_args->type.u64[1];
+ int ret;
+
+ mars_test_counter_wait(notify_ea, 1);
+
+ ret = mars_task_queue_push(queue_ea, queue_item);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+
+ mars_test_counter_set(notify_ea, 2);
+
+ mars_task_exit(0);
+
+ return 0;
+}
diff --git a/tests/TFP/TFP_43_003/mpu2.c b/tests/TFP/TFP_43_003/mpu2.c
new file mode 100644
index 0000000..8f1b434
--- /dev/null
+++ b/tests/TFP/TFP_43_003/mpu2.c
@@ -0,0 +1,50 @@
+/*
+ * Copyright 2008 Sony Corporation
+ *
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a copy
+ * of this software and associated documentation files (the "Software"), to deal
+ * in the Software without restriction, including without limitation the rights
+ * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+ * copies of the Software, and to permit persons to whom the Software is
+ * furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included in
+ * all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+ * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+ * THE SOFTWARE.
+ */
+
+#include <string.h>
+#include <mars/mars.h>
+#include "mars_task_test.h"
+
+int mars_task_main(const struct mars_task_args *task_args)
+{
+ uint64_t queue_ea = task_args->type.u64[0];
+ uint64_t notify_ea = task_args->type.u64[1];
+ uint32_t count;
+ int ret;
+
+ ret = mars_task_queue_count(queue_ea, &count);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+ MARS_TEST_ASSERT(count == 0);
+
+ mars_test_counter_set(notify_ea, 1);
+
+ mars_test_counter_wait(notify_ea, 2);
+
+ ret = mars_task_queue_count(queue_ea, &count);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+ MARS_TEST_ASSERT(count == 1);
+
+ mars_task_exit(0);
+
+ return 0;
+}
diff --git a/tests/TFP/TFP_43_004/Makefile b/tests/TFP/TFP_43_004/Makefile
new file mode 100644
index 0000000..432135a
--- /dev/null
+++ b/tests/TFP/TFP_43_004/Makefile
@@ -0,0 +1,28 @@
+#
+# Copyright 2008 Sony Corporation
+#
+#
+# Permission is hereby granted, free of charge, to any person obtaining a copy
+# of this software and associated documentation files (the "Software"), to deal
+# in the Software without restriction, including without limitation the rights
+# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+# copies of the Software, and to permit persons to whom the Software is
+# furnished to do so, subject to the following conditions:
+#
+# The above copyright notice and this permission notice shall be included in
+# all copies or substantial portions of the Software.
+#
+# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+# THE SOFTWARE.
+#
+
+top_srcdir = ../..
+test_objs = host.o mpu.task_eo
+
+include $(top_srcdir)/scripts/config.mk
+include $(top_srcdir)/scripts/rules_item.mk
diff --git a/tests/TFP/TFP_43_004/host.c b/tests/TFP/TFP_43_004/host.c
new file mode 100644
index 0000000..7aa031c
--- /dev/null
+++ b/tests/TFP/TFP_43_004/host.c
@@ -0,0 +1,92 @@
+/*
+ * Copyright 2008 Sony Corporation
+ *
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a copy
+ * of this software and associated documentation files (the "Software"), to deal
+ * in the Software without restriction, including without limitation the rights
+ * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+ * copies of the Software, and to permit persons to whom the Software is
+ * furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included in
+ * all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+ * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+ * THE SOFTWARE.
+ */
+
+#include <unistd.h>
+#include <libspe2.h>
+#include <mars/mars.h>
+#include <mars_test.h>
+
+#define QUEUE_DEPTH 16
+
+extern spe_program_handle_t mpu_prog;
+
+static struct mars_context *mars;
+static struct mars_task_id task_id;
+static struct mars_task_args task_args;
+static uint64_t queue;
+
+int main(void)
+{
+ int exit_code, ret;
+ uint32_t count;
+
+ ret = mars_context_create(&mars, 0, 0);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+
+ ret = mars_task_create(
+ mars,
+ &task_id,
+ "43004",
+ mpu_prog.elf_image,
+ MARS_TASK_CONTEXT_SAVE_ALL);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+
+ ret = mars_task_queue_create(
+ mars,
+ &queue,
+ 16,
+ QUEUE_DEPTH,
+ MARS_TASK_QUEUE_MPU_TO_HOST);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+
+ ret = mars_task_queue_count(queue, &count);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+
+ MARS_TEST_ASSERT(count == 0);
+
+ task_args.type.u64[0] = queue;
+ ret = mars_task_schedule(&task_id, &task_args, 0);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+
+ usleep(100000);
+
+ mars_task_queue_count(queue, &count);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+
+ MARS_TEST_ASSERT(count == 1);
+
+ ret = mars_task_wait(&task_id, &exit_code);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+ MARS_TEST_ASSERT_EQUAL(exit_code, 0);
+
+ ret = mars_task_queue_destroy(queue);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+
+ ret = mars_task_destroy(&task_id);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+
+ ret = mars_context_destroy(mars);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+
+ return 0;
+}
diff --git a/tests/TFP/TFP_43_004/mpu.c b/tests/TFP/TFP_43_004/mpu.c
new file mode 100644
index 0000000..424edea
--- /dev/null
+++ b/tests/TFP/TFP_43_004/mpu.c
@@ -0,0 +1,41 @@
+/*
+ * Copyright 2008 Sony Corporation
+ *
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a copy
+ * of this software and associated documentation files (the "Software"), to deal
+ * in the Software without restriction, including without limitation the rights
+ * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+ * copies of the Software, and to permit persons to whom the Software is
+ * furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included in
+ * all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+ * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+ * THE SOFTWARE.
+ */
+
+#include <string.h>
+#include <mars/mars.h>
+#include "mars_task_test.h"
+
+static uint64_t queue_item[2] __attribute__((aligned(16)));
+
+int mars_task_main(const struct mars_task_args *task_args)
+{
+ int ret;
+ uint64_t queue_ea = task_args->type.u64[0];
+
+ ret = mars_task_queue_try_push(queue_ea, queue_item);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+
+ mars_task_exit(0);
+
+ return 0;
+}
diff --git a/tests/TFP/TFP_43_005/Makefile b/tests/TFP/TFP_43_005/Makefile
new file mode 100644
index 0000000..432135a
--- /dev/null
+++ b/tests/TFP/TFP_43_005/Makefile
@@ -0,0 +1,28 @@
+#
+# Copyright 2008 Sony Corporation
+#
+#
+# Permission is hereby granted, free of charge, to any person obtaining a copy
+# of this software and associated documentation files (the "Software"), to deal
+# in the Software without restriction, including without limitation the rights
+# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+# copies of the Software, and to permit persons to whom the Software is
+# furnished to do so, subject to the following conditions:
+#
+# The above copyright notice and this permission notice shall be included in
+# all copies or substantial portions of the Software.
+#
+# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+# THE SOFTWARE.
+#
+
+top_srcdir = ../..
+test_objs = host.o mpu.task_eo
+
+include $(top_srcdir)/scripts/config.mk
+include $(top_srcdir)/scripts/rules_item.mk
diff --git a/tests/TFP/TFP_43_005/host.c b/tests/TFP/TFP_43_005/host.c
new file mode 100644
index 0000000..88711ff
--- /dev/null
+++ b/tests/TFP/TFP_43_005/host.c
@@ -0,0 +1,89 @@
+/*
+ * Copyright 2008 Sony Corporation
+ *
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a copy
+ * of this software and associated documentation files (the "Software"), to deal
+ * in the Software without restriction, including without limitation the rights
+ * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+ * copies of the Software, and to permit persons to whom the Software is
+ * furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included in
+ * all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+ * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+ * THE SOFTWARE.
+ */
+
+#include <unistd.h>
+#include <libspe2.h>
+#include <mars/mars.h>
+#include <mars_test.h>
+
+#define QUEUE_DEPTH 16
+
+extern spe_program_handle_t mpu_prog;
+
+static struct mars_context *mars;
+static struct mars_task_id task_id;
+static struct mars_task_args task_args;
+static uint64_t queue;
+static uint64_t queue_item[2];
+static uint32_t notify[32] __attribute__((aligned(128)));
+
+int main(void)
+{
+ int exit_code, ret;
+
+ ret = mars_context_create(&mars, 0, 0);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+
+ ret = mars_task_create(
+ mars,
+ &task_id,
+ "43005",
+ mpu_prog.elf_image,
+ MARS_TASK_CONTEXT_SAVE_ALL);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+
+ ret = mars_task_queue_create(
+ mars,
+ &queue,
+ 16,
+ QUEUE_DEPTH,
+ MARS_TASK_QUEUE_HOST_TO_MPU);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+
+ task_args.type.u64[0] = queue;
+ task_args.type.u64[1] = mars_ptr_to_ea(notify);
+ ret = mars_task_schedule(&task_id, &task_args, 0);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+
+ mars_test_counter_wait(notify, 1);
+
+ ret = mars_task_queue_try_push(queue, queue_item);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+
+ mars_test_counter_set(notify, 2);
+
+ ret = mars_task_wait(&task_id, &exit_code);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+ MARS_TEST_ASSERT_EQUAL(exit_code, 0);
+
+ ret = mars_task_queue_destroy(queue);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+
+ ret = mars_task_destroy(&task_id);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+
+ ret = mars_context_destroy(mars);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+
+ return 0;
+}
diff --git a/tests/TFP/TFP_43_005/mpu.c b/tests/TFP/TFP_43_005/mpu.c
new file mode 100644
index 0000000..8f1b434
--- /dev/null
+++ b/tests/TFP/TFP_43_005/mpu.c
@@ -0,0 +1,50 @@
+/*
+ * Copyright 2008 Sony Corporation
+ *
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a copy
+ * of this software and associated documentation files (the "Software"), to deal
+ * in the Software without restriction, including without limitation the rights
+ * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+ * copies of the Software, and to permit persons to whom the Software is
+ * furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included in
+ * all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+ * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+ * THE SOFTWARE.
+ */
+
+#include <string.h>
+#include <mars/mars.h>
+#include "mars_task_test.h"
+
+int mars_task_main(const struct mars_task_args *task_args)
+{
+ uint64_t queue_ea = task_args->type.u64[0];
+ uint64_t notify_ea = task_args->type.u64[1];
+ uint32_t count;
+ int ret;
+
+ ret = mars_task_queue_count(queue_ea, &count);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+ MARS_TEST_ASSERT(count == 0);
+
+ mars_test_counter_set(notify_ea, 1);
+
+ mars_test_counter_wait(notify_ea, 2);
+
+ ret = mars_task_queue_count(queue_ea, &count);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+ MARS_TEST_ASSERT(count == 1);
+
+ mars_task_exit(0);
+
+ return 0;
+}
diff --git a/tests/TFP/TFP_43_006/Makefile b/tests/TFP/TFP_43_006/Makefile
new file mode 100644
index 0000000..ecbce33
--- /dev/null
+++ b/tests/TFP/TFP_43_006/Makefile
@@ -0,0 +1,28 @@
+#
+# Copyright 2008 Sony Corporation
+#
+#
+# Permission is hereby granted, free of charge, to any person obtaining a copy
+# of this software and associated documentation files (the "Software"), to deal
+# in the Software without restriction, including without limitation the rights
+# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+# copies of the Software, and to permit persons to whom the Software is
+# furnished to do so, subject to the following conditions:
+#
+# The above copyright notice and this permission notice shall be included in
+# all copies or substantial portions of the Software.
+#
+# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+# THE SOFTWARE.
+#
+
+top_srcdir = ../..
+test_objs = host.o mpu1.task_eo mpu2.task_eo
+
+include $(top_srcdir)/scripts/config.mk
+include $(top_srcdir)/scripts/rules_item.mk
diff --git a/tests/TFP/TFP_43_006/host.c b/tests/TFP/TFP_43_006/host.c
new file mode 100644
index 0000000..b9e6672
--- /dev/null
+++ b/tests/TFP/TFP_43_006/host.c
@@ -0,0 +1,98 @@
+/*
+ * Copyright 2008 Sony Corporation
+ *
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a copy
+ * of this software and associated documentation files (the "Software"), to deal
+ * in the Software without restriction, including without limitation the rights
+ * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+ * copies of the Software, and to permit persons to whom the Software is
+ * furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included in
+ * all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+ * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+ * THE SOFTWARE.
+ */
+
+#include <libspe2.h>
+#include <mars/mars.h>
+#include <mars_test.h>
+
+#define QUEUE_DEPTH 16
+
+extern spe_program_handle_t mpu1_prog, mpu2_prog;
+
+static struct mars_context *mars;
+static struct mars_task_id pusher_task_id, counter_task_id;
+static struct mars_task_args task_args;
+static uint64_t queue;
+static uint32_t notify[32] __attribute__((aligned(128)));
+
+int main(void)
+{
+ int exit_code, ret;
+
+ ret = mars_context_create(&mars, 0, 0);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+
+ ret = mars_task_create(
+ mars,
+ &pusher_task_id,
+ "43006 pusher",
+ mpu1_prog.elf_image,
+ MARS_TASK_CONTEXT_SAVE_ALL);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+
+ ret = mars_task_create(
+ mars,
+ &counter_task_id,
+ "43006 counter",
+ mpu2_prog.elf_image,
+ MARS_TASK_CONTEXT_SAVE_ALL);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+
+ ret = mars_task_queue_create(
+ mars,
+ &queue,
+ 16,
+ QUEUE_DEPTH,
+ MARS_TASK_QUEUE_MPU_TO_MPU);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+
+ task_args.type.u64[0] = queue;
+ task_args.type.u64[1] = mars_ptr_to_ea(notify);
+ ret = mars_task_schedule(&pusher_task_id, &task_args, 0);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+
+ ret = mars_task_schedule(&counter_task_id, &task_args, 0);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+
+ ret = mars_task_wait(&pusher_task_id, &exit_code);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+ MARS_TEST_ASSERT_EQUAL(exit_code, 0);
+
+ ret = mars_task_wait(&counter_task_id, &exit_code);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+ MARS_TEST_ASSERT_EQUAL(exit_code, 0);
+
+ ret = mars_task_queue_destroy(queue);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+
+ ret = mars_task_destroy(&pusher_task_id);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+
+ ret = mars_task_destroy(&counter_task_id);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+
+ ret = mars_context_destroy(mars);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+
+ return 0;
+}
diff --git a/tests/TFP/TFP_43_006/mpu1.c b/tests/TFP/TFP_43_006/mpu1.c
new file mode 100644
index 0000000..159e5c2
--- /dev/null
+++ b/tests/TFP/TFP_43_006/mpu1.c
@@ -0,0 +1,46 @@
+/*
+ * Copyright 2008 Sony Corporation
+ *
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a copy
+ * of this software and associated documentation files (the "Software"), to deal
+ * in the Software without restriction, including without limitation the rights
+ * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+ * copies of the Software, and to permit persons to whom the Software is
+ * furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included in
+ * all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+ * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+ * THE SOFTWARE.
+ */
+
+#include <string.h>
+#include <mars/mars.h>
+#include "mars_task_test.h"
+
+static uint64_t queue_item[2] __attribute__((aligned(16)));
+
+int mars_task_main(const struct mars_task_args *task_args)
+{
+ uint64_t queue_ea = task_args->type.u64[0];
+ uint64_t notify_ea = task_args->type.u64[1];
+ int ret;
+
+ mars_test_counter_wait(notify_ea, 1);
+
+ ret = mars_task_queue_try_push(queue_ea, queue_item);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+
+ mars_test_counter_set(notify_ea, 2);
+
+ mars_task_exit(0);
+
+ return 0;
+}
diff --git a/tests/TFP/TFP_43_006/mpu2.c b/tests/TFP/TFP_43_006/mpu2.c
new file mode 100644
index 0000000..8f1b434
--- /dev/null
+++ b/tests/TFP/TFP_43_006/mpu2.c
@@ -0,0 +1,50 @@
+/*
+ * Copyright 2008 Sony Corporation
+ *
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a copy
+ * of this software and associated documentation files (the "Software"), to deal
+ * in the Software without restriction, including without limitation the rights
+ * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+ * copies of the Software, and to permit persons to whom the Software is
+ * furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included in
+ * all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+ * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+ * THE SOFTWARE.
+ */
+
+#include <string.h>
+#include <mars/mars.h>
+#include "mars_task_test.h"
+
+int mars_task_main(const struct mars_task_args *task_args)
+{
+ uint64_t queue_ea = task_args->type.u64[0];
+ uint64_t notify_ea = task_args->type.u64[1];
+ uint32_t count;
+ int ret;
+
+ ret = mars_task_queue_count(queue_ea, &count);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+ MARS_TEST_ASSERT(count == 0);
+
+ mars_test_counter_set(notify_ea, 1);
+
+ mars_test_counter_wait(notify_ea, 2);
+
+ ret = mars_task_queue_count(queue_ea, &count);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+ MARS_TEST_ASSERT(count == 1);
+
+ mars_task_exit(0);
+
+ return 0;
+}
diff --git a/tests/TFP/TFP_43_007/Makefile b/tests/TFP/TFP_43_007/Makefile
new file mode 100644
index 0000000..ecbce33
--- /dev/null
+++ b/tests/TFP/TFP_43_007/Makefile
@@ -0,0 +1,28 @@
+#
+# Copyright 2008 Sony Corporation
+#
+#
+# Permission is hereby granted, free of charge, to any person obtaining a copy
+# of this software and associated documentation files (the "Software"), to deal
+# in the Software without restriction, including without limitation the rights
+# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+# copies of the Software, and to permit persons to whom the Software is
+# furnished to do so, subject to the following conditions:
+#
+# The above copyright notice and this permission notice shall be included in
+# all copies or substantial portions of the Software.
+#
+# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+# THE SOFTWARE.
+#
+
+top_srcdir = ../..
+test_objs = host.o mpu1.task_eo mpu2.task_eo
+
+include $(top_srcdir)/scripts/config.mk
+include $(top_srcdir)/scripts/rules_item.mk
diff --git a/tests/TFP/TFP_43_007/host.c b/tests/TFP/TFP_43_007/host.c
new file mode 100644
index 0000000..285ce08
--- /dev/null
+++ b/tests/TFP/TFP_43_007/host.c
@@ -0,0 +1,98 @@
+/*
+ * Copyright 2008 Sony Corporation
+ *
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a copy
+ * of this software and associated documentation files (the "Software"), to deal
+ * in the Software without restriction, including without limitation the rights
+ * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+ * copies of the Software, and to permit persons to whom the Software is
+ * furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included in
+ * all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+ * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+ * THE SOFTWARE.
+ */
+
+#include <libspe2.h>
+#include <mars/mars.h>
+#include <mars_test.h>
+
+#define QUEUE_DEPTH 16
+
+extern spe_program_handle_t mpu1_prog, mpu2_prog;
+
+static struct mars_context *mars;
+static struct mars_task_id pusher_task_id, counter_task_id;
+static struct mars_task_args task_args;
+static uint64_t queue;
+static uint32_t notify[32] __attribute__((aligned(128)));
+
+int main(void)
+{
+ int exit_code, ret;
+
+ ret = mars_context_create(&mars, 0, 0);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+
+ ret = mars_task_create(
+ mars,
+ &pusher_task_id,
+ "43007 pusher",
+ mpu1_prog.elf_image,
+ MARS_TASK_CONTEXT_SAVE_ALL);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+
+ ret = mars_task_create(
+ mars,
+ &counter_task_id,
+ "43007 counter",
+ mpu2_prog.elf_image,
+ MARS_TASK_CONTEXT_SAVE_ALL);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+
+ ret = mars_task_queue_create(
+ mars,
+ &queue,
+ 16,
+ QUEUE_DEPTH,
+ MARS_TASK_QUEUE_MPU_TO_MPU);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+
+ task_args.type.u64[0] = queue;
+ task_args.type.u64[1] = mars_ptr_to_ea(notify);
+ ret = mars_task_schedule(&pusher_task_id, &task_args, 0);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+
+ ret = mars_task_schedule(&counter_task_id, &task_args, 0);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+
+ ret = mars_task_wait(&pusher_task_id, &exit_code);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+ MARS_TEST_ASSERT_EQUAL(exit_code, 0);
+
+ ret = mars_task_wait(&counter_task_id, &exit_code);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+ MARS_TEST_ASSERT_EQUAL(exit_code, 0);
+
+ ret = mars_task_queue_destroy(queue);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+
+ ret = mars_task_destroy(&pusher_task_id);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+
+ ret = mars_task_destroy(&counter_task_id);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+
+ ret = mars_context_destroy(mars);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+
+ return 0;
+}
diff --git a/tests/TFP/TFP_43_007/mpu1.c b/tests/TFP/TFP_43_007/mpu1.c
new file mode 100644
index 0000000..14bdc6c
--- /dev/null
+++ b/tests/TFP/TFP_43_007/mpu1.c
@@ -0,0 +1,49 @@
+/*
+ * Copyright 2008 Sony Corporation
+ *
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a copy
+ * of this software and associated documentation files (the "Software"), to deal
+ * in the Software without restriction, including without limitation the rights
+ * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+ * copies of the Software, and to permit persons to whom the Software is
+ * furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included in
+ * all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+ * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+ * THE SOFTWARE.
+ */
+
+#include <string.h>
+#include <mars/mars.h>
+#include "mars_task_test.h"
+
+static uint64_t queue_item[2] __attribute__((aligned(16)));
+
+int mars_task_main(const struct mars_task_args *task_args)
+{
+ uint64_t queue_ea = task_args->type.u64[0];
+ uint64_t notify_ea = task_args->type.u64[1];
+ int ret;
+
+ mars_test_counter_wait(notify_ea, 1);
+
+ ret = mars_task_queue_push_begin(queue_ea, queue_item, 0);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+
+ ret = mars_task_queue_push_end(queue_ea, 0);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+
+ mars_test_counter_set(notify_ea, 2);
+
+ mars_task_exit(0);
+
+ return 0;
+}
diff --git a/tests/TFP/TFP_43_007/mpu2.c b/tests/TFP/TFP_43_007/mpu2.c
new file mode 100644
index 0000000..8f1b434
--- /dev/null
+++ b/tests/TFP/TFP_43_007/mpu2.c
@@ -0,0 +1,50 @@
+/*
+ * Copyright 2008 Sony Corporation
+ *
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a copy
+ * of this software and associated documentation files (the "Software"), to deal
+ * in the Software without restriction, including without limitation the rights
+ * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+ * copies of the Software, and to permit persons to whom the Software is
+ * furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included in
+ * all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+ * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+ * THE SOFTWARE.
+ */
+
+#include <string.h>
+#include <mars/mars.h>
+#include "mars_task_test.h"
+
+int mars_task_main(const struct mars_task_args *task_args)
+{
+ uint64_t queue_ea = task_args->type.u64[0];
+ uint64_t notify_ea = task_args->type.u64[1];
+ uint32_t count;
+ int ret;
+
+ ret = mars_task_queue_count(queue_ea, &count);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+ MARS_TEST_ASSERT(count == 0);
+
+ mars_test_counter_set(notify_ea, 1);
+
+ mars_test_counter_wait(notify_ea, 2);
+
+ ret = mars_task_queue_count(queue_ea, &count);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+ MARS_TEST_ASSERT(count == 1);
+
+ mars_task_exit(0);
+
+ return 0;
+}
diff --git a/tests/TFP/TFP_43_008/Makefile b/tests/TFP/TFP_43_008/Makefile
new file mode 100644
index 0000000..ecbce33
--- /dev/null
+++ b/tests/TFP/TFP_43_008/Makefile
@@ -0,0 +1,28 @@
+#
+# Copyright 2008 Sony Corporation
+#
+#
+# Permission is hereby granted, free of charge, to any person obtaining a copy
+# of this software and associated documentation files (the "Software"), to deal
+# in the Software without restriction, including without limitation the rights
+# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+# copies of the Software, and to permit persons to whom the Software is
+# furnished to do so, subject to the following conditions:
+#
+# The above copyright notice and this permission notice shall be included in
+# all copies or substantial portions of the Software.
+#
+# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+# THE SOFTWARE.
+#
+
+top_srcdir = ../..
+test_objs = host.o mpu1.task_eo mpu2.task_eo
+
+include $(top_srcdir)/scripts/config.mk
+include $(top_srcdir)/scripts/rules_item.mk
diff --git a/tests/TFP/TFP_43_008/host.c b/tests/TFP/TFP_43_008/host.c
new file mode 100644
index 0000000..d92d02e
--- /dev/null
+++ b/tests/TFP/TFP_43_008/host.c
@@ -0,0 +1,98 @@
+/*
+ * Copyright 2008 Sony Corporation
+ *
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a copy
+ * of this software and associated documentation files (the "Software"), to deal
+ * in the Software without restriction, including without limitation the rights
+ * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+ * copies of the Software, and to permit persons to whom the Software is
+ * furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included in
+ * all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+ * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+ * THE SOFTWARE.
+ */
+
+#include <libspe2.h>
+#include <mars/mars.h>
+#include <mars_test.h>
+
+#define QUEUE_DEPTH 16
+
+extern spe_program_handle_t mpu1_prog, mpu2_prog;
+
+static struct mars_context *mars;
+static struct mars_task_id pusher_task_id, counter_task_id;
+static struct mars_task_args task_args;
+static uint64_t queue;
+static uint32_t notify[32] __attribute__((aligned(128)));
+
+int main(void)
+{
+ int exit_code, ret;
+
+ ret = mars_context_create(&mars, 0, 0);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+
+ ret = mars_task_create(
+ mars,
+ &pusher_task_id,
+ "43008 pusher",
+ mpu1_prog.elf_image,
+ MARS_TASK_CONTEXT_SAVE_ALL);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+
+ ret = mars_task_create(
+ mars,
+ &counter_task_id,
+ "43008 counter",
+ mpu2_prog.elf_image,
+ MARS_TASK_CONTEXT_SAVE_ALL);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+
+ ret = mars_task_queue_create(
+ mars,
+ &queue,
+ 16,
+ QUEUE_DEPTH,
+ MARS_TASK_QUEUE_MPU_TO_MPU);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+
+ task_args.type.u64[0] = queue;
+ task_args.type.u64[1] = mars_ptr_to_ea(notify);
+ ret = mars_task_schedule(&pusher_task_id, &task_args, 0);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+
+ ret = mars_task_schedule(&counter_task_id, &task_args, 0);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+
+ ret = mars_task_wait(&pusher_task_id, &exit_code);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+ MARS_TEST_ASSERT_EQUAL(exit_code, 0);
+
+ ret = mars_task_wait(&counter_task_id, &exit_code);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+ MARS_TEST_ASSERT_EQUAL(exit_code, 0);
+
+ ret = mars_task_queue_destroy(queue);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+
+ ret = mars_task_destroy(&pusher_task_id);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+
+ ret = mars_task_destroy(&counter_task_id);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+
+ ret = mars_context_destroy(mars);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+
+ return 0;
+}
diff --git a/tests/TFP/TFP_43_008/mpu1.c b/tests/TFP/TFP_43_008/mpu1.c
new file mode 100644
index 0000000..71e6072
--- /dev/null
+++ b/tests/TFP/TFP_43_008/mpu1.c
@@ -0,0 +1,49 @@
+/*
+ * Copyright 2008 Sony Corporation
+ *
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a copy
+ * of this software and associated documentation files (the "Software"), to deal
+ * in the Software without restriction, including without limitation the rights
+ * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+ * copies of the Software, and to permit persons to whom the Software is
+ * furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included in
+ * all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+ * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+ * THE SOFTWARE.
+ */
+
+#include <string.h>
+#include <mars/mars.h>
+#include "mars_task_test.h"
+
+static uint64_t queue_item[2] __attribute__((aligned(16)));
+
+int mars_task_main(const struct mars_task_args *task_args)
+{
+ uint64_t queue_ea = task_args->type.u64[0];
+ uint64_t notify_ea = task_args->type.u64[1];
+ int ret;
+
+ mars_test_counter_wait(notify_ea, 1);
+
+ ret = mars_task_queue_try_push_begin(queue_ea, queue_item, 0);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+
+ ret = mars_task_queue_push_end(queue_ea, 0);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+
+ mars_test_counter_set(notify_ea, 2);
+
+ mars_task_exit(0);
+
+ return 0;
+}
diff --git a/tests/TFP/TFP_43_008/mpu2.c b/tests/TFP/TFP_43_008/mpu2.c
new file mode 100644
index 0000000..8f1b434
--- /dev/null
+++ b/tests/TFP/TFP_43_008/mpu2.c
@@ -0,0 +1,50 @@
+/*
+ * Copyright 2008 Sony Corporation
+ *
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a copy
+ * of this software and associated documentation files (the "Software"), to deal
+ * in the Software without restriction, including without limitation the rights
+ * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+ * copies of the Software, and to permit persons to whom the Software is
+ * furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included in
+ * all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+ * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+ * THE SOFTWARE.
+ */
+
+#include <string.h>
+#include <mars/mars.h>
+#include "mars_task_test.h"
+
+int mars_task_main(const struct mars_task_args *task_args)
+{
+ uint64_t queue_ea = task_args->type.u64[0];
+ uint64_t notify_ea = task_args->type.u64[1];
+ uint32_t count;
+ int ret;
+
+ ret = mars_task_queue_count(queue_ea, &count);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+ MARS_TEST_ASSERT(count == 0);
+
+ mars_test_counter_set(notify_ea, 1);
+
+ mars_test_counter_wait(notify_ea, 2);
+
+ ret = mars_task_queue_count(queue_ea, &count);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+ MARS_TEST_ASSERT(count == 1);
+
+ mars_task_exit(0);
+
+ return 0;
+}
diff --git a/tests/TFP/TFP_43_009/Makefile b/tests/TFP/TFP_43_009/Makefile
new file mode 100644
index 0000000..ecbce33
--- /dev/null
+++ b/tests/TFP/TFP_43_009/Makefile
@@ -0,0 +1,28 @@
+#
+# Copyright 2008 Sony Corporation
+#
+#
+# Permission is hereby granted, free of charge, to any person obtaining a copy
+# of this software and associated documentation files (the "Software"), to deal
+# in the Software without restriction, including without limitation the rights
+# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+# copies of the Software, and to permit persons to whom the Software is
+# furnished to do so, subject to the following conditions:
+#
+# The above copyright notice and this permission notice shall be included in
+# all copies or substantial portions of the Software.
+#
+# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+# THE SOFTWARE.
+#
+
+top_srcdir = ../..
+test_objs = host.o mpu1.task_eo mpu2.task_eo
+
+include $(top_srcdir)/scripts/config.mk
+include $(top_srcdir)/scripts/rules_item.mk
diff --git a/tests/TFP/TFP_43_009/host.c b/tests/TFP/TFP_43_009/host.c
new file mode 100644
index 0000000..3055724
--- /dev/null
+++ b/tests/TFP/TFP_43_009/host.c
@@ -0,0 +1,144 @@
+/*
+ * Copyright 2008 Sony Corporation
+ *
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a copy
+ * of this software and associated documentation files (the "Software"), to deal
+ * in the Software without restriction, including without limitation the rights
+ * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+ * copies of the Software, and to permit persons to whom the Software is
+ * furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included in
+ * all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+ * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+ * THE SOFTWARE.
+ */
+
+#include <mars/mars.h>
+#include <libspe2.h>
+#include <mars_test.h>
+
+
+#define Q_SIZE 128
+struct queue_entry {
+ char text[Q_SIZE];
+};
+#define Q_DEPTH 1024
+
+#define NUM_LOOP 3
+static uint32_t depth_size[] =
+{
+ 1,
+ Q_DEPTH / 2,
+ Q_DEPTH
+};
+extern spe_program_handle_t mpu1_prog;
+extern spe_program_handle_t mpu2_prog;
+
+static struct mars_context *mars_ctx;
+static struct mars_task_args task1_args, task2_args;
+static struct mars_task_id task1_id, task2_id;
+
+static uint64_t mpu_to_host[NUM_LOOP];
+
+static struct queue_entry data;
+
+int main(void)
+{
+ int ret, i, num;
+ int32_t exit_code;
+ uint32_t count, pushed_num;
+
+ ret = mars_context_create(&mars_ctx, 0, 0);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+
+ for (i = 0; i < NUM_LOOP; i++) {
+ ret = mars_task_queue_create(
+ mars_ctx,
+ &mpu_to_host[i],
+ sizeof(struct queue_entry),
+ depth_size[i],
+ MARS_TASK_QUEUE_MPU_TO_HOST);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+
+ ret = mars_task_queue_count(mpu_to_host[i], &count);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+ MARS_TEST_ASSERT_EQUAL(count, 0);
+
+ /* push queue full */
+ ret = mars_task_create(mars_ctx, &task1_id, NULL,
+ mpu1_prog.elf_image, MARS_TASK_CONTEXT_SAVE_ALL);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+
+ task1_args.type.u64[0] = mpu_to_host[i];
+ task1_args.type.u64[1] = (uint64_t)depth_size[i];
+ ret = mars_task_schedule(&task1_id, &task1_args, 0);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+
+ ret = mars_task_wait(&task1_id, &exit_code);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+ MARS_TEST_ASSERT_ERROR(exit_code, MARS_SUCCESS);
+
+ /* queue must be full */
+ ret = mars_task_queue_count(mpu_to_host[i], &count);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+ MARS_TEST_ASSERT_EQUAL(count, depth_size[i]);
+
+ pushed_num = depth_size[i];
+ for (num = 0; num < depth_size[i]; num++) {
+ /* pop one queue */
+ ret = mars_task_queue_pop(mpu_to_host[i], &data);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+ pushed_num--;
+
+ /* check 1st and last one */
+ if (num == 0 || num == depth_size[i] - 1) {
+ /* check queue count in host side */
+ ret = mars_task_queue_count(mpu_to_host[i],
+ &count);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+ MARS_TEST_ASSERT_EQUAL(count, pushed_num);
+
+ /* check queue count in mpu side */
+ ret = mars_task_create(mars_ctx, &task2_id,
+ NULL,
+ mpu2_prog.elf_image,
+ MARS_TASK_CONTEXT_SAVE_ALL);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+
+ task2_args.type.u64[0] = mpu_to_host[i];
+ task2_args.type.u64[1] =
+ (uint64_t)(pushed_num);
+ ret = mars_task_schedule(&task2_id,
+ &task2_args, 0);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+
+ ret = mars_task_wait(&task2_id, &exit_code);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+ MARS_TEST_ASSERT_ERROR(exit_code, MARS_SUCCESS);
+
+ ret = mars_task_destroy(&task2_id);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+ }
+ }
+
+ ret = mars_task_destroy(&task1_id);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+
+ ret = mars_task_queue_destroy(mpu_to_host[i]);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+ }
+
+ ret = mars_context_destroy(mars_ctx);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+
+ return 0;
+}
+
diff --git a/tests/TFP/TFP_43_009/mpu1.c b/tests/TFP/TFP_43_009/mpu1.c
new file mode 100644
index 0000000..e9a3ef9
--- /dev/null
+++ b/tests/TFP/TFP_43_009/mpu1.c
@@ -0,0 +1,50 @@
+/*
+ * Copyright 2008 Sony Corporation
+ *
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a copy
+ * of this software and associated documentation files (the "Software"), to deal
+ * in the Software without restriction, including without limitation the rights
+ * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+ * copies of the Software, and to permit persons to whom the Software is
+ * furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included in
+ * all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+ * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+ * THE SOFTWARE.
+ */
+
+#include <mars/mars.h>
+#include <mars_task_test.h>
+
+#define Q_SIZE 128
+struct queue_entry {
+ char text[Q_SIZE];
+};
+static struct queue_entry data;
+
+int mars_task_main(const struct mars_task_args *task_args)
+{
+ int ret, i;
+ uint64_t mpu_to_host_ea = task_args->type.u64[0];
+ uint32_t num_push = (uint32_t)task_args->type.u64[1];
+ uint32_t count;
+
+ for (i = 0; i < num_push; i++) {
+ ret = mars_task_queue_push(mpu_to_host_ea, &data);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+ }
+
+ ret = mars_task_queue_count(mpu_to_host_ea, &count);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+ MARS_TEST_ASSERT_EQUAL(count, num_push);
+
+ return 0;
+}
diff --git a/tests/TFP/TFP_43_009/mpu2.c b/tests/TFP/TFP_43_009/mpu2.c
new file mode 100644
index 0000000..ea98cbf
--- /dev/null
+++ b/tests/TFP/TFP_43_009/mpu2.c
@@ -0,0 +1,44 @@
+/*
+ * Copyright 2008 Sony Corporation
+ *
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a copy
+ * of this software and associated documentation files (the "Software"), to deal
+ * in the Software without restriction, including without limitation the rights
+ * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+ * copies of the Software, and to permit persons to whom the Software is
+ * furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included in
+ * all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+ * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+ * THE SOFTWARE.
+ */
+
+#include <mars/mars.h>
+#include <mars_task_test.h>
+
+#define Q_SIZE 128
+struct queue_entry {
+ char text[Q_SIZE];
+};
+
+int mars_task_main(const struct mars_task_args *task_args)
+{
+ int ret;
+ uint64_t mpu_to_host_ea = task_args->type.u64[0];
+ uint32_t num_push = (uint32_t)task_args->type.u64[1];
+ uint32_t count;
+
+ ret = mars_task_queue_count(mpu_to_host_ea, &count);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+ MARS_TEST_ASSERT_EQUAL(count, num_push);
+
+ return 0;
+}
diff --git a/tests/TFP/TFP_43_010/Makefile b/tests/TFP/TFP_43_010/Makefile
new file mode 100644
index 0000000..ecbce33
--- /dev/null
+++ b/tests/TFP/TFP_43_010/Makefile
@@ -0,0 +1,28 @@
+#
+# Copyright 2008 Sony Corporation
+#
+#
+# Permission is hereby granted, free of charge, to any person obtaining a copy
+# of this software and associated documentation files (the "Software"), to deal
+# in the Software without restriction, including without limitation the rights
+# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+# copies of the Software, and to permit persons to whom the Software is
+# furnished to do so, subject to the following conditions:
+#
+# The above copyright notice and this permission notice shall be included in
+# all copies or substantial portions of the Software.
+#
+# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+# THE SOFTWARE.
+#
+
+top_srcdir = ../..
+test_objs = host.o mpu1.task_eo mpu2.task_eo
+
+include $(top_srcdir)/scripts/config.mk
+include $(top_srcdir)/scripts/rules_item.mk
diff --git a/tests/TFP/TFP_43_010/host.c b/tests/TFP/TFP_43_010/host.c
new file mode 100644
index 0000000..ac5be00
--- /dev/null
+++ b/tests/TFP/TFP_43_010/host.c
@@ -0,0 +1,139 @@
+/*
+ * Copyright 2008 Sony Corporation
+ *
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a copy
+ * of this software and associated documentation files (the "Software"), to deal
+ * in the Software without restriction, including without limitation the rights
+ * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+ * copies of the Software, and to permit persons to whom the Software is
+ * furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included in
+ * all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+ * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+ * THE SOFTWARE.
+ */
+
+#include <mars/mars.h>
+#include <libspe2.h>
+#include <mars_test.h>
+
+
+#define Q_SIZE 128
+struct queue_entry {
+ char text[Q_SIZE];
+};
+#define Q_DEPTH 1024
+
+#define NUM_LOOP 3
+static uint32_t depth_size[] =
+{
+ 1,
+ Q_DEPTH / 2,
+ Q_DEPTH
+};
+extern spe_program_handle_t mpu1_prog;
+extern spe_program_handle_t mpu2_prog;
+
+static struct mars_context *mars_ctx;
+static struct mars_task_args task1_args, task2_args;
+static struct mars_task_id task1_id, task2_id;
+
+static uint64_t host_to_mpu[NUM_LOOP];
+
+static struct queue_entry data;
+
+int main(void)
+{
+ int ret, i, num;
+ int32_t exit_code;
+ uint32_t count;
+
+ ret = mars_context_create(&mars_ctx, 0, 0);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+
+ for (i = 0; i < NUM_LOOP; i++) {
+ ret = mars_task_queue_create(
+ mars_ctx,
+ &host_to_mpu[i],
+ sizeof(struct queue_entry),
+ depth_size[i],
+ MARS_TASK_QUEUE_HOST_TO_MPU);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+
+ ret = mars_task_queue_count(host_to_mpu[i], &count);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+ MARS_TEST_ASSERT_EQUAL(count, 0);
+
+ /* push queue full */
+ for (num = 0; num < depth_size[i]; num++) {
+ ret = mars_task_queue_push(host_to_mpu[i], &data);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+ }
+
+ /* check queue count in host side */
+ ret = mars_task_queue_count(host_to_mpu[i], &count);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+ MARS_TEST_ASSERT_EQUAL(count, depth_size[i]);
+
+ /* create pop task */
+ ret = mars_task_create(mars_ctx, &task1_id, NULL,
+ mpu1_prog.elf_image, MARS_TASK_CONTEXT_SAVE_ALL);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+
+ task1_args.type.u64[0] = host_to_mpu[i];
+ task1_args.type.u64[1] = (uint64_t)depth_size[i];
+ ret = mars_task_schedule(&task1_id, &task1_args, 0);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+
+ ret = mars_task_wait(&task1_id, &exit_code);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+ MARS_TEST_ASSERT_ERROR(exit_code, MARS_SUCCESS);
+
+ /* queue must be decremented */
+ ret = mars_task_queue_count(host_to_mpu[i], &count);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+ MARS_TEST_ASSERT_EQUAL(count, depth_size[i] - 1);
+
+ /* create pop all task */
+ ret = mars_task_create(mars_ctx, &task2_id, NULL,
+ mpu2_prog.elf_image, MARS_TASK_CONTEXT_SAVE_ALL);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+
+ task2_args.type.u64[0] = host_to_mpu[i];
+ task2_args.type.u64[1] = (uint64_t)(depth_size[i] - 1);
+ ret = mars_task_schedule(&task2_id, &task2_args, 0);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+
+ ret = mars_task_wait(&task2_id, &exit_code);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+ MARS_TEST_ASSERT_ERROR(exit_code, MARS_SUCCESS);
+
+ /* queue must be 0 */
+ ret = mars_task_queue_count(host_to_mpu[i], &count);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+ MARS_TEST_ASSERT_EQUAL(count, 0);
+
+ ret = mars_task_destroy(&task1_id);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+
+ ret = mars_task_destroy(&task2_id);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+
+ ret = mars_task_queue_destroy(host_to_mpu[i]);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+ }
+
+ ret = mars_context_destroy(mars_ctx);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+
+ return 0;
+}
+
diff --git a/tests/TFP/TFP_43_010/mpu1.c b/tests/TFP/TFP_43_010/mpu1.c
new file mode 100644
index 0000000..378e790
--- /dev/null
+++ b/tests/TFP/TFP_43_010/mpu1.c
@@ -0,0 +1,49 @@
+/*
+ * Copyright 2008 Sony Corporation
+ *
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a copy
+ * of this software and associated documentation files (the "Software"), to deal
+ * in the Software without restriction, including without limitation the rights
+ * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+ * copies of the Software, and to permit persons to whom the Software is
+ * furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included in
+ * all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+ * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+ * THE SOFTWARE.
+ */
+
+#include <mars/mars.h>
+#include <mars_task_test.h>
+
+#define Q_SIZE 128
+struct queue_entry {
+ char text[Q_SIZE];
+};
+static struct queue_entry data;
+
+int mars_task_main(const struct mars_task_args *task_args)
+{
+ int ret;
+ uint64_t mpu_to_host_ea = task_args->type.u64[0];
+ uint32_t num_push = (uint32_t)task_args->type.u64[1];
+ uint32_t count;
+
+ num_push--;
+ ret = mars_task_queue_pop(mpu_to_host_ea, &data);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+
+ ret = mars_task_queue_count(mpu_to_host_ea, &count);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+ MARS_TEST_ASSERT_EQUAL(count, num_push);
+
+ return 0;
+}
diff --git a/tests/TFP/TFP_43_010/mpu2.c b/tests/TFP/TFP_43_010/mpu2.c
new file mode 100644
index 0000000..1e6118c
--- /dev/null
+++ b/tests/TFP/TFP_43_010/mpu2.c
@@ -0,0 +1,52 @@
+/*
+ * Copyright 2008 Sony Corporation
+ *
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a copy
+ * of this software and associated documentation files (the "Software"), to deal
+ * in the Software without restriction, including without limitation the rights
+ * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+ * copies of the Software, and to permit persons to whom the Software is
+ * furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included in
+ * all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+ * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+ * THE SOFTWARE.
+ */
+
+#include <mars/mars.h>
+#include <mars_task_test.h>
+
+#define Q_SIZE 128
+struct queue_entry {
+ char text[Q_SIZE];
+};
+
+static struct queue_entry data;
+
+int mars_task_main(const struct mars_task_args *task_args)
+{
+ int ret, i;
+ uint64_t mpu_to_host_ea = task_args->type.u64[0];
+ uint32_t num_push = (uint32_t)task_args->type.u64[1];
+ uint32_t count, num = num_push;
+
+ for (i = 0; i < num_push; i++) {
+ num--;
+ ret = mars_task_queue_pop(mpu_to_host_ea, &data);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+
+ ret = mars_task_queue_count(mpu_to_host_ea, &count);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+ MARS_TEST_ASSERT_EQUAL(count, num);
+ }
+
+ return 0;
+}
diff --git a/tests/TFP/TFP_43_011/Makefile b/tests/TFP/TFP_43_011/Makefile
new file mode 100644
index 0000000..ecbce33
--- /dev/null
+++ b/tests/TFP/TFP_43_011/Makefile
@@ -0,0 +1,28 @@
+#
+# Copyright 2008 Sony Corporation
+#
+#
+# Permission is hereby granted, free of charge, to any person obtaining a copy
+# of this software and associated documentation files (the "Software"), to deal
+# in the Software without restriction, including without limitation the rights
+# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+# copies of the Software, and to permit persons to whom the Software is
+# furnished to do so, subject to the following conditions:
+#
+# The above copyright notice and this permission notice shall be included in
+# all copies or substantial portions of the Software.
+#
+# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+# THE SOFTWARE.
+#
+
+top_srcdir = ../..
+test_objs = host.o mpu1.task_eo mpu2.task_eo
+
+include $(top_srcdir)/scripts/config.mk
+include $(top_srcdir)/scripts/rules_item.mk
diff --git a/tests/TFP/TFP_43_011/host.c b/tests/TFP/TFP_43_011/host.c
new file mode 100644
index 0000000..54318b2
--- /dev/null
+++ b/tests/TFP/TFP_43_011/host.c
@@ -0,0 +1,97 @@
+/*
+ * Copyright 2008 Sony Corporation
+ *
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a copy
+ * of this software and associated documentation files (the "Software"), to deal
+ * in the Software without restriction, including without limitation the rights
+ * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+ * copies of the Software, and to permit persons to whom the Software is
+ * furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included in
+ * all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+ * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+ * THE SOFTWARE.
+ */
+
+#include <libspe2.h>
+#include <mars/mars.h>
+#include <mars_test.h>
+#include "host_and_mpu.h"
+
+extern spe_program_handle_t mpu1_prog, mpu2_prog;
+
+static struct mars_context *mars;
+static struct mars_task_id poper_task_id, counter_task_id;
+static struct mars_task_args task_args;
+static uint64_t queue;
+static uint32_t notify[32] __attribute__((aligned(128)));
+
+int main(void)
+{
+ int exit_code, ret;
+
+ ret = mars_context_create(&mars, 0, 0);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+
+ ret = mars_task_create(
+ mars,
+ &poper_task_id,
+ "43011 poper",
+ mpu1_prog.elf_image,
+ MARS_TASK_CONTEXT_SAVE_ALL);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+
+ ret = mars_task_create(
+ mars,
+ &counter_task_id,
+ "43011 counter",
+ mpu2_prog.elf_image,
+ MARS_TASK_CONTEXT_SAVE_ALL);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+
+ ret = mars_task_queue_create(
+ mars,
+ &queue,
+ 16,
+ QUEUE_DEPTH,
+ MARS_TASK_QUEUE_MPU_TO_MPU);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+
+ task_args.type.u64[0] = queue;
+ task_args.type.u64[1] = mars_ptr_to_ea(notify);
+ ret = mars_task_schedule(&poper_task_id, &task_args, 0);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+
+ ret = mars_task_schedule(&counter_task_id, &task_args, 0);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+
+ ret = mars_task_wait(&poper_task_id, &exit_code);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+ MARS_TEST_ASSERT_EQUAL(exit_code, 0);
+
+ ret = mars_task_wait(&counter_task_id, &exit_code);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+ MARS_TEST_ASSERT_EQUAL(exit_code, 0);
+
+ ret = mars_task_queue_destroy(queue);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+
+ ret = mars_task_destroy(&poper_task_id);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+
+ ret = mars_task_destroy(&counter_task_id);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+
+ ret = mars_context_destroy(mars);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+
+ return 0;
+}
diff --git a/tests/TFP/TFP_43_011/host_and_mpu.h b/tests/TFP/TFP_43_011/host_and_mpu.h
new file mode 100644
index 0000000..e565e93
--- /dev/null
+++ b/tests/TFP/TFP_43_011/host_and_mpu.h
@@ -0,0 +1,24 @@
+/*
+ * Copyright 2008 Sony Corporation
+ *
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a copy
+ * of this software and associated documentation files (the "Software"), to deal
+ * in the Software without restriction, including without limitation the rights
+ * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+ * copies of the Software, and to permit persons to whom the Software is
+ * furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included in
+ * all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+ * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+ * THE SOFTWARE.
+ */
+
+#define QUEUE_DEPTH 16
diff --git a/tests/TFP/TFP_43_011/mpu1.c b/tests/TFP/TFP_43_011/mpu1.c
new file mode 100644
index 0000000..b11000a
--- /dev/null
+++ b/tests/TFP/TFP_43_011/mpu1.c
@@ -0,0 +1,54 @@
+/*
+ * Copyright 2008 Sony Corporation
+ *
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a copy
+ * of this software and associated documentation files (the "Software"), to deal
+ * in the Software without restriction, including without limitation the rights
+ * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+ * copies of the Software, and to permit persons to whom the Software is
+ * furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included in
+ * all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+ * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+ * THE SOFTWARE.
+ */
+
+#include <string.h>
+#include <mars/mars.h>
+#include "mars_task_test.h"
+#include "host_and_mpu.h"
+
+static uint64_t queue_item[2] __attribute__((aligned(16)));
+
+int mars_task_main(const struct mars_task_args *task_args)
+{
+ uint64_t queue_ea = task_args->type.u64[0];
+ uint64_t notify_ea = task_args->type.u64[1];
+ uint32_t count;
+ int ret;
+
+ mars_test_counter_wait(notify_ea, 1);
+
+ ret = mars_task_queue_count(queue_ea, &count);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+ MARS_TEST_ASSERT(count == QUEUE_DEPTH);
+
+ ret = mars_task_queue_pop(queue_ea, queue_item);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+
+ ret = mars_task_queue_count(queue_ea, &count);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+ MARS_TEST_ASSERT(count == QUEUE_DEPTH-1);
+
+ mars_task_exit(0);
+
+ return 0;
+}
diff --git a/tests/TFP/TFP_43_011/mpu2.c b/tests/TFP/TFP_43_011/mpu2.c
new file mode 100644
index 0000000..5dc8254
--- /dev/null
+++ b/tests/TFP/TFP_43_011/mpu2.c
@@ -0,0 +1,47 @@
+/*
+ * Copyright 2008 Sony Corporation
+ *
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a copy
+ * of this software and associated documentation files (the "Software"), to deal
+ * in the Software without restriction, including without limitation the rights
+ * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+ * copies of the Software, and to permit persons to whom the Software is
+ * furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included in
+ * all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+ * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+ * THE SOFTWARE.
+ */
+
+#include <string.h>
+#include <mars/mars.h>
+#include "mars_task_test.h"
+#include "host_and_mpu.h"
+
+static uint64_t queue_item[2] __attribute__((aligned(16)));
+
+int mars_task_main(const struct mars_task_args *task_args)
+{
+ uint64_t queue_ea = task_args->type.u64[0];
+ uint64_t notify_ea = task_args->type.u64[1];
+ int i, ret;
+
+ for (i = 0; i < QUEUE_DEPTH; i++) {
+ ret = mars_task_queue_push(queue_ea, queue_item);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+ }
+
+ mars_test_counter_set(notify_ea, 1);
+
+ mars_task_exit(0);
+
+ return 0;
+}
diff --git a/tests/TFP/TFP_43_012/Makefile b/tests/TFP/TFP_43_012/Makefile
new file mode 100644
index 0000000..432135a
--- /dev/null
+++ b/tests/TFP/TFP_43_012/Makefile
@@ -0,0 +1,28 @@
+#
+# Copyright 2008 Sony Corporation
+#
+#
+# Permission is hereby granted, free of charge, to any person obtaining a copy
+# of this software and associated documentation files (the "Software"), to deal
+# in the Software without restriction, including without limitation the rights
+# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+# copies of the Software, and to permit persons to whom the Software is
+# furnished to do so, subject to the following conditions:
+#
+# The above copyright notice and this permission notice shall be included in
+# all copies or substantial portions of the Software.
+#
+# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+# THE SOFTWARE.
+#
+
+top_srcdir = ../..
+test_objs = host.o mpu.task_eo
+
+include $(top_srcdir)/scripts/config.mk
+include $(top_srcdir)/scripts/rules_item.mk
diff --git a/tests/TFP/TFP_43_012/host.c b/tests/TFP/TFP_43_012/host.c
new file mode 100644
index 0000000..fc7a3d8
--- /dev/null
+++ b/tests/TFP/TFP_43_012/host.c
@@ -0,0 +1,95 @@
+/*
+ * Copyright 2008 Sony Corporation
+ *
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a copy
+ * of this software and associated documentation files (the "Software"), to deal
+ * in the Software without restriction, including without limitation the rights
+ * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+ * copies of the Software, and to permit persons to whom the Software is
+ * furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included in
+ * all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+ * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+ * THE SOFTWARE.
+ */
+
+#include <unistd.h>
+#include <libspe2.h>
+#include <mars/mars.h>
+#include <mars_test.h>
+#include "host_and_mpu.h"
+
+extern spe_program_handle_t mpu_prog;
+
+static struct mars_context *mars;
+static struct mars_task_id task_id;
+static struct mars_task_args task_args;
+static uint64_t queue;
+static uint64_t queue_item[2];
+
+int main(void)
+{
+ int exit_code, ret;
+ uint32_t count;
+
+ ret = mars_context_create(&mars, 0, 0);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+
+ ret = mars_task_create(
+ mars,
+ &task_id,
+ "43012",
+ mpu_prog.elf_image,
+ MARS_TASK_CONTEXT_SAVE_ALL);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+
+ ret = mars_task_queue_create(
+ mars,
+ &queue,
+ 16,
+ QUEUE_DEPTH,
+ MARS_TASK_QUEUE_MPU_TO_HOST);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+
+ task_args.type.u64[0] = queue;
+ ret = mars_task_schedule(&task_id, &task_args, 0);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+
+ usleep(100000);
+
+ ret = mars_task_queue_count(queue, &count);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+
+ MARS_TEST_ASSERT(count == QUEUE_DEPTH);
+
+ ret = mars_task_queue_pop(queue, queue_item);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+
+ ret = mars_task_queue_count(queue, &count);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+
+ MARS_TEST_ASSERT(count == QUEUE_DEPTH-1);
+
+ ret = mars_task_wait(&task_id, &exit_code);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+ MARS_TEST_ASSERT_EQUAL(exit_code, 0);
+
+ ret = mars_task_queue_destroy(queue);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+
+ ret = mars_task_destroy(&task_id);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+
+ ret = mars_context_destroy(mars);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+
+ return 0;
+}
diff --git a/tests/TFP/TFP_43_012/host_and_mpu.h b/tests/TFP/TFP_43_012/host_and_mpu.h
new file mode 100644
index 0000000..e565e93
--- /dev/null
+++ b/tests/TFP/TFP_43_012/host_and_mpu.h
@@ -0,0 +1,24 @@
+/*
+ * Copyright 2008 Sony Corporation
+ *
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a copy
+ * of this software and associated documentation files (the "Software"), to deal
+ * in the Software without restriction, including without limitation the rights
+ * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+ * copies of the Software, and to permit persons to whom the Software is
+ * furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included in
+ * all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+ * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+ * THE SOFTWARE.
+ */
+
+#define QUEUE_DEPTH 16
diff --git a/tests/TFP/TFP_43_012/mpu.c b/tests/TFP/TFP_43_012/mpu.c
new file mode 100644
index 0000000..aa4dd5a
--- /dev/null
+++ b/tests/TFP/TFP_43_012/mpu.c
@@ -0,0 +1,44 @@
+/*
+ * Copyright 2008 Sony Corporation
+ *
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a copy
+ * of this software and associated documentation files (the "Software"), to deal
+ * in the Software without restriction, including without limitation the rights
+ * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+ * copies of the Software, and to permit persons to whom the Software is
+ * furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included in
+ * all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+ * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+ * THE SOFTWARE.
+ */
+
+#include <string.h>
+#include <mars/mars.h>
+#include "mars_task_test.h"
+#include "host_and_mpu.h"
+
+static uint64_t queue_item[2] __attribute__((aligned(16)));
+
+int mars_task_main(const struct mars_task_args *task_args)
+{
+ uint64_t queue_ea = task_args->type.u64[0];
+ int i, ret;
+
+ for (i = 0; i < QUEUE_DEPTH; i++) {
+ ret = mars_task_queue_push(queue_ea, queue_item);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+ }
+
+ mars_task_exit(0);
+
+ return 0;
+}
diff --git a/tests/TFP/TFP_43_013/Makefile b/tests/TFP/TFP_43_013/Makefile
new file mode 100644
index 0000000..432135a
--- /dev/null
+++ b/tests/TFP/TFP_43_013/Makefile
@@ -0,0 +1,28 @@
+#
+# Copyright 2008 Sony Corporation
+#
+#
+# Permission is hereby granted, free of charge, to any person obtaining a copy
+# of this software and associated documentation files (the "Software"), to deal
+# in the Software without restriction, including without limitation the rights
+# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+# copies of the Software, and to permit persons to whom the Software is
+# furnished to do so, subject to the following conditions:
+#
+# The above copyright notice and this permission notice shall be included in
+# all copies or substantial portions of the Software.
+#
+# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+# THE SOFTWARE.
+#
+
+top_srcdir = ../..
+test_objs = host.o mpu.task_eo
+
+include $(top_srcdir)/scripts/config.mk
+include $(top_srcdir)/scripts/rules_item.mk
diff --git a/tests/TFP/TFP_43_013/host.c b/tests/TFP/TFP_43_013/host.c
new file mode 100644
index 0000000..892b0d2
--- /dev/null
+++ b/tests/TFP/TFP_43_013/host.c
@@ -0,0 +1,83 @@
+/*
+ * Copyright 2008 Sony Corporation
+ *
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a copy
+ * of this software and associated documentation files (the "Software"), to deal
+ * in the Software without restriction, including without limitation the rights
+ * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+ * copies of the Software, and to permit persons to whom the Software is
+ * furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included in
+ * all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+ * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+ * THE SOFTWARE.
+ */
+
+#include <libspe2.h>
+#include <mars/mars.h>
+#include <mars_test.h>
+#include "host_and_mpu.h"
+
+extern spe_program_handle_t mpu_prog;
+
+static struct mars_context *mars;
+static struct mars_task_id task_id;
+static struct mars_task_args task_args;
+static uint64_t queue;
+static uint64_t queue_item[2];
+
+int main(void)
+{
+ int i, exit_code, ret;
+
+ ret = mars_context_create(&mars, 0, 0);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+
+ ret = mars_task_create(
+ mars,
+ &task_id,
+ "43013",
+ mpu_prog.elf_image,
+ MARS_TASK_CONTEXT_SAVE_ALL);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+
+ ret = mars_task_queue_create(
+ mars,
+ &queue,
+ 16,
+ QUEUE_DEPTH,
+ MARS_TASK_QUEUE_HOST_TO_MPU);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+
+ for (i = 0; i < QUEUE_DEPTH; i++) {
+ ret = mars_task_queue_push(queue, queue_item);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+ }
+
+ task_args.type.u64[0] = queue;
+ ret = mars_task_schedule(&task_id, &task_args, 0);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+
+ ret = mars_task_wait(&task_id, &exit_code);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+ MARS_TEST_ASSERT_EQUAL(exit_code, 0);
+
+ ret = mars_task_queue_destroy(queue);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+
+ ret = mars_task_destroy(&task_id);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+
+ ret = mars_context_destroy(mars);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+
+ return 0;
+}
diff --git a/tests/TFP/TFP_43_013/host_and_mpu.h b/tests/TFP/TFP_43_013/host_and_mpu.h
new file mode 100644
index 0000000..e565e93
--- /dev/null
+++ b/tests/TFP/TFP_43_013/host_and_mpu.h
@@ -0,0 +1,24 @@
+/*
+ * Copyright 2008 Sony Corporation
+ *
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a copy
+ * of this software and associated documentation files (the "Software"), to deal
+ * in the Software without restriction, including without limitation the rights
+ * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+ * copies of the Software, and to permit persons to whom the Software is
+ * furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included in
+ * all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+ * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+ * THE SOFTWARE.
+ */
+
+#define QUEUE_DEPTH 16
diff --git a/tests/TFP/TFP_43_013/mpu.c b/tests/TFP/TFP_43_013/mpu.c
new file mode 100644
index 0000000..acc4f64
--- /dev/null
+++ b/tests/TFP/TFP_43_013/mpu.c
@@ -0,0 +1,53 @@
+/*
+ * Copyright 2008 Sony Corporation
+ *
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a copy
+ * of this software and associated documentation files (the "Software"), to deal
+ * in the Software without restriction, including without limitation the rights
+ * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+ * copies of the Software, and to permit persons to whom the Software is
+ * furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included in
+ * all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+ * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+ * THE SOFTWARE.
+ */
+
+#include <string.h>
+#include <mars/mars.h>
+#include "mars_task_test.h"
+#include "host_and_mpu.h"
+
+static uint64_t queue_item[2] __attribute__((aligned(16)));
+
+int mars_task_main(const struct mars_task_args *task_args)
+{
+ uint64_t queue_ea = task_args->type.u64[0];
+ uint32_t count;
+ int ret;
+
+ ret = mars_task_queue_count(queue_ea, &count);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+
+ MARS_TEST_ASSERT(count == QUEUE_DEPTH);
+
+ ret = mars_task_queue_pop(queue_ea, queue_item);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+
+ ret = mars_task_queue_count(queue_ea, &count);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+
+ MARS_TEST_ASSERT(count == QUEUE_DEPTH-1);
+
+ mars_task_exit(0);
+
+ return 0;
+}
diff --git a/tests/TFP/TFP_43_014/Makefile b/tests/TFP/TFP_43_014/Makefile
new file mode 100644
index 0000000..ecbce33
--- /dev/null
+++ b/tests/TFP/TFP_43_014/Makefile
@@ -0,0 +1,28 @@
+#
+# Copyright 2008 Sony Corporation
+#
+#
+# Permission is hereby granted, free of charge, to any person obtaining a copy
+# of this software and associated documentation files (the "Software"), to deal
+# in the Software without restriction, including without limitation the rights
+# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+# copies of the Software, and to permit persons to whom the Software is
+# furnished to do so, subject to the following conditions:
+#
+# The above copyright notice and this permission notice shall be included in
+# all copies or substantial portions of the Software.
+#
+# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+# THE SOFTWARE.
+#
+
+top_srcdir = ../..
+test_objs = host.o mpu1.task_eo mpu2.task_eo
+
+include $(top_srcdir)/scripts/config.mk
+include $(top_srcdir)/scripts/rules_item.mk
diff --git a/tests/TFP/TFP_43_014/host.c b/tests/TFP/TFP_43_014/host.c
new file mode 100644
index 0000000..9c6e2a8
--- /dev/null
+++ b/tests/TFP/TFP_43_014/host.c
@@ -0,0 +1,97 @@
+/*
+ * Copyright 2008 Sony Corporation
+ *
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a copy
+ * of this software and associated documentation files (the "Software"), to deal
+ * in the Software without restriction, including without limitation the rights
+ * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+ * copies of the Software, and to permit persons to whom the Software is
+ * furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included in
+ * all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+ * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+ * THE SOFTWARE.
+ */
+
+#include <libspe2.h>
+#include <mars/mars.h>
+#include <mars_test.h>
+#include "host_and_mpu.h"
+
+extern spe_program_handle_t mpu1_prog, mpu2_prog;
+
+static struct mars_context *mars;
+static struct mars_task_id poper_task_id, counter_task_id;
+static struct mars_task_args task_args;
+static uint64_t queue;
+static uint32_t notify[32] __attribute__((aligned(16)));
+
+int main(void)
+{
+ int exit_code, ret;
+
+ ret = mars_context_create(&mars, 0, 0);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+
+ ret = mars_task_create(
+ mars,
+ &poper_task_id,
+ "43014 poper",
+ mpu1_prog.elf_image,
+ MARS_TASK_CONTEXT_SAVE_ALL);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+
+ ret = mars_task_create(
+ mars,
+ &counter_task_id,
+ "43014 counter",
+ mpu2_prog.elf_image,
+ MARS_TASK_CONTEXT_SAVE_ALL);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+
+ ret = mars_task_queue_create(
+ mars,
+ &queue,
+ 16,
+ QUEUE_DEPTH,
+ MARS_TASK_QUEUE_MPU_TO_MPU);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+
+ task_args.type.u64[0] = queue;
+ task_args.type.u64[1] = mars_ptr_to_ea(notify);
+ ret = mars_task_schedule(&poper_task_id, &task_args, 0);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+
+ ret = mars_task_schedule(&counter_task_id, &task_args, 0);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+
+ ret = mars_task_wait(&poper_task_id, &exit_code);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+ MARS_TEST_ASSERT_EQUAL(exit_code, 0);
+
+ ret = mars_task_wait(&counter_task_id, &exit_code);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+ MARS_TEST_ASSERT_EQUAL(exit_code, 0);
+
+ ret = mars_task_queue_destroy(queue);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+
+ ret = mars_task_destroy(&poper_task_id);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+
+ ret = mars_task_destroy(&counter_task_id);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+
+ ret = mars_context_destroy(mars);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+
+ return 0;
+}
diff --git a/tests/TFP/TFP_43_014/host_and_mpu.h b/tests/TFP/TFP_43_014/host_and_mpu.h
new file mode 100644
index 0000000..e565e93
--- /dev/null
+++ b/tests/TFP/TFP_43_014/host_and_mpu.h
@@ -0,0 +1,24 @@
+/*
+ * Copyright 2008 Sony Corporation
+ *
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a copy
+ * of this software and associated documentation files (the "Software"), to deal
+ * in the Software without restriction, including without limitation the rights
+ * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+ * copies of the Software, and to permit persons to whom the Software is
+ * furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included in
+ * all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+ * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+ * THE SOFTWARE.
+ */
+
+#define QUEUE_DEPTH 16
diff --git a/tests/TFP/TFP_43_014/mpu1.c b/tests/TFP/TFP_43_014/mpu1.c
new file mode 100644
index 0000000..7ac8e8d
--- /dev/null
+++ b/tests/TFP/TFP_43_014/mpu1.c
@@ -0,0 +1,54 @@
+/*
+ * Copyright 2008 Sony Corporation
+ *
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a copy
+ * of this software and associated documentation files (the "Software"), to deal
+ * in the Software without restriction, including without limitation the rights
+ * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+ * copies of the Software, and to permit persons to whom the Software is
+ * furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included in
+ * all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+ * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+ * THE SOFTWARE.
+ */
+
+#include <string.h>
+#include <mars/mars.h>
+#include "mars_task_test.h"
+#include "host_and_mpu.h"
+
+static uint64_t queue_item[2] __attribute__((aligned(16)));
+
+int mars_task_main(const struct mars_task_args *task_args)
+{
+ uint64_t queue_ea = task_args->type.u64[0];
+ uint64_t notify_ea = task_args->type.u64[1];
+ uint32_t count;
+ int ret;
+
+ mars_test_counter_wait(notify_ea, 1);
+
+ ret = mars_task_queue_count(queue_ea, &count);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+ MARS_TEST_ASSERT(count == QUEUE_DEPTH);
+
+ ret = mars_task_queue_try_pop(queue_ea, queue_item);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+
+ ret = mars_task_queue_count(queue_ea, &count);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+ MARS_TEST_ASSERT(count == QUEUE_DEPTH-1);
+
+ mars_task_exit(0);
+
+ return 0;
+}
diff --git a/tests/TFP/TFP_43_014/mpu2.c b/tests/TFP/TFP_43_014/mpu2.c
new file mode 100644
index 0000000..5dc8254
--- /dev/null
+++ b/tests/TFP/TFP_43_014/mpu2.c
@@ -0,0 +1,47 @@
+/*
+ * Copyright 2008 Sony Corporation
+ *
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a copy
+ * of this software and associated documentation files (the "Software"), to deal
+ * in the Software without restriction, including without limitation the rights
+ * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+ * copies of the Software, and to permit persons to whom the Software is
+ * furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included in
+ * all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+ * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+ * THE SOFTWARE.
+ */
+
+#include <string.h>
+#include <mars/mars.h>
+#include "mars_task_test.h"
+#include "host_and_mpu.h"
+
+static uint64_t queue_item[2] __attribute__((aligned(16)));
+
+int mars_task_main(const struct mars_task_args *task_args)
+{
+ uint64_t queue_ea = task_args->type.u64[0];
+ uint64_t notify_ea = task_args->type.u64[1];
+ int i, ret;
+
+ for (i = 0; i < QUEUE_DEPTH; i++) {
+ ret = mars_task_queue_push(queue_ea, queue_item);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+ }
+
+ mars_test_counter_set(notify_ea, 1);
+
+ mars_task_exit(0);
+
+ return 0;
+}
diff --git a/tests/TFP/TFP_43_015/Makefile b/tests/TFP/TFP_43_015/Makefile
new file mode 100644
index 0000000..432135a
--- /dev/null
+++ b/tests/TFP/TFP_43_015/Makefile
@@ -0,0 +1,28 @@
+#
+# Copyright 2008 Sony Corporation
+#
+#
+# Permission is hereby granted, free of charge, to any person obtaining a copy
+# of this software and associated documentation files (the "Software"), to deal
+# in the Software without restriction, including without limitation the rights
+# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+# copies of the Software, and to permit persons to whom the Software is
+# furnished to do so, subject to the following conditions:
+#
+# The above copyright notice and this permission notice shall be included in
+# all copies or substantial portions of the Software.
+#
+# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+# THE SOFTWARE.
+#
+
+top_srcdir = ../..
+test_objs = host.o mpu.task_eo
+
+include $(top_srcdir)/scripts/config.mk
+include $(top_srcdir)/scripts/rules_item.mk
diff --git a/tests/TFP/TFP_43_015/host.c b/tests/TFP/TFP_43_015/host.c
new file mode 100644
index 0000000..1be78c5
--- /dev/null
+++ b/tests/TFP/TFP_43_015/host.c
@@ -0,0 +1,83 @@
+/*
+ * Copyright 2008 Sony Corporation
+ *
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a copy
+ * of this software and associated documentation files (the "Software"), to deal
+ * in the Software without restriction, including without limitation the rights
+ * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+ * copies of the Software, and to permit persons to whom the Software is
+ * furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included in
+ * all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+ * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+ * THE SOFTWARE.
+ */
+
+#include <libspe2.h>
+#include <mars/mars.h>
+#include <mars_test.h>
+#include "host_and_mpu.h"
+
+extern spe_program_handle_t mpu_prog;
+
+static struct mars_context *mars;
+static struct mars_task_id task_id;
+static struct mars_task_args task_args;
+static uint64_t queue;
+static uint64_t queue_item[2];
+
+int main(void)
+{
+ int i, exit_code, ret;
+
+ ret = mars_context_create(&mars, 0, 0);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+
+ ret = mars_task_create(
+ mars,
+ &task_id,
+ "43015",
+ mpu_prog.elf_image,
+ MARS_TASK_CONTEXT_SAVE_ALL);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+
+ ret = mars_task_queue_create(
+ mars,
+ &queue,
+ 16,
+ QUEUE_DEPTH,
+ MARS_TASK_QUEUE_HOST_TO_MPU);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+
+ for (i = 0; i < QUEUE_DEPTH; i++) {
+ ret = mars_task_queue_push(queue, queue_item);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+ }
+
+ task_args.type.u64[0] = queue;
+ ret = mars_task_schedule(&task_id, &task_args, 0);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+
+ ret = mars_task_wait(&task_id, &exit_code);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+ MARS_TEST_ASSERT_EQUAL(exit_code, 0);
+
+ ret = mars_task_queue_destroy(queue);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+
+ ret = mars_task_destroy(&task_id);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+
+ ret = mars_context_destroy(mars);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+
+ return 0;
+}
diff --git a/tests/TFP/TFP_43_015/host_and_mpu.h b/tests/TFP/TFP_43_015/host_and_mpu.h
new file mode 100644
index 0000000..e565e93
--- /dev/null
+++ b/tests/TFP/TFP_43_015/host_and_mpu.h
@@ -0,0 +1,24 @@
+/*
+ * Copyright 2008 Sony Corporation
+ *
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a copy
+ * of this software and associated documentation files (the "Software"), to deal
+ * in the Software without restriction, including without limitation the rights
+ * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+ * copies of the Software, and to permit persons to whom the Software is
+ * furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included in
+ * all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+ * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+ * THE SOFTWARE.
+ */
+
+#define QUEUE_DEPTH 16
diff --git a/tests/TFP/TFP_43_015/mpu.c b/tests/TFP/TFP_43_015/mpu.c
new file mode 100644
index 0000000..0e994e1
--- /dev/null
+++ b/tests/TFP/TFP_43_015/mpu.c
@@ -0,0 +1,56 @@
+/*
+ * Copyright 2008 Sony Corporation
+ *
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a copy
+ * of this software and associated documentation files (the "Software"), to deal
+ * in the Software without restriction, including without limitation the rights
+ * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+ * copies of the Software, and to permit persons to whom the Software is
+ * furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included in
+ * all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+ * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+ * THE SOFTWARE.
+ */
+
+#include <string.h>
+#include <mars/mars.h>
+#include "mars_task_test.h"
+#include "host_and_mpu.h"
+
+static uint64_t queue_item[2] __attribute__((aligned(16)));
+
+int mars_task_main(const struct mars_task_args *task_args)
+{
+ uint64_t queue_ea = task_args->type.u64[0];
+ uint32_t count;
+ int ret;
+
+ ret = mars_task_queue_count(queue_ea, &count);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+
+ MARS_TEST_ASSERT(count == QUEUE_DEPTH);
+
+ ret = mars_task_queue_pop_begin(queue_ea, queue_item, 0);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+
+ ret = mars_task_queue_pop_end(queue_ea, 0);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+
+ ret = mars_task_queue_count(queue_ea, &count);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+
+ MARS_TEST_ASSERT(count == QUEUE_DEPTH-1);
+
+ mars_task_exit(0);
+
+ return 0;
+}
diff --git a/tests/TFP/TFP_43_016/Makefile b/tests/TFP/TFP_43_016/Makefile
new file mode 100644
index 0000000..ecbce33
--- /dev/null
+++ b/tests/TFP/TFP_43_016/Makefile
@@ -0,0 +1,28 @@
+#
+# Copyright 2008 Sony Corporation
+#
+#
+# Permission is hereby granted, free of charge, to any person obtaining a copy
+# of this software and associated documentation files (the "Software"), to deal
+# in the Software without restriction, including without limitation the rights
+# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+# copies of the Software, and to permit persons to whom the Software is
+# furnished to do so, subject to the following conditions:
+#
+# The above copyright notice and this permission notice shall be included in
+# all copies or substantial portions of the Software.
+#
+# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+# THE SOFTWARE.
+#
+
+top_srcdir = ../..
+test_objs = host.o mpu1.task_eo mpu2.task_eo
+
+include $(top_srcdir)/scripts/config.mk
+include $(top_srcdir)/scripts/rules_item.mk
diff --git a/tests/TFP/TFP_43_016/host.c b/tests/TFP/TFP_43_016/host.c
new file mode 100644
index 0000000..66d53bd
--- /dev/null
+++ b/tests/TFP/TFP_43_016/host.c
@@ -0,0 +1,97 @@
+/*
+ * Copyright 2008 Sony Corporation
+ *
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a copy
+ * of this software and associated documentation files (the "Software"), to deal
+ * in the Software without restriction, including without limitation the rights
+ * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+ * copies of the Software, and to permit persons to whom the Software is
+ * furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included in
+ * all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+ * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+ * THE SOFTWARE.
+ */
+
+#include <libspe2.h>
+#include <mars/mars.h>
+#include <mars_test.h>
+#include "host_and_mpu.h"
+
+extern spe_program_handle_t mpu1_prog, mpu2_prog;
+
+static struct mars_context *mars;
+static struct mars_task_id poper_task_id, counter_task_id;
+static struct mars_task_args task_args;
+static uint64_t queue;
+static uint32_t notify[32] __attribute__((aligned(16)));
+
+int main(void)
+{
+ int exit_code, ret;
+
+ ret = mars_context_create(&mars, 0, 0);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+
+ ret = mars_task_create(
+ mars,
+ &poper_task_id,
+ "43016 poper",
+ mpu1_prog.elf_image,
+ MARS_TASK_CONTEXT_SAVE_ALL);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+
+ ret = mars_task_create(
+ mars,
+ &counter_task_id,
+ "43016 counter",
+ mpu2_prog.elf_image,
+ MARS_TASK_CONTEXT_SAVE_ALL);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+
+ ret = mars_task_queue_create(
+ mars,
+ &queue,
+ 16,
+ QUEUE_DEPTH,
+ MARS_TASK_QUEUE_MPU_TO_MPU);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+
+ task_args.type.u64[0] = queue;
+ task_args.type.u64[1] = mars_ptr_to_ea(notify);
+ ret = mars_task_schedule(&poper_task_id, &task_args, 0);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+
+ ret = mars_task_schedule(&counter_task_id, &task_args, 0);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+
+ ret = mars_task_wait(&poper_task_id, &exit_code);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+ MARS_TEST_ASSERT_EQUAL(exit_code, 0);
+
+ ret = mars_task_wait(&counter_task_id, &exit_code);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+ MARS_TEST_ASSERT_EQUAL(exit_code, 0);
+
+ ret = mars_task_queue_destroy(queue);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+
+ ret = mars_task_destroy(&poper_task_id);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+
+ ret = mars_task_destroy(&counter_task_id);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+
+ ret = mars_context_destroy(mars);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+
+ return 0;
+}
diff --git a/tests/TFP/TFP_43_016/host_and_mpu.h b/tests/TFP/TFP_43_016/host_and_mpu.h
new file mode 100644
index 0000000..e565e93
--- /dev/null
+++ b/tests/TFP/TFP_43_016/host_and_mpu.h
@@ -0,0 +1,24 @@
+/*
+ * Copyright 2008 Sony Corporation
+ *
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a copy
+ * of this software and associated documentation files (the "Software"), to deal
+ * in the Software without restriction, including without limitation the rights
+ * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+ * copies of the Software, and to permit persons to whom the Software is
+ * furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included in
+ * all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+ * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+ * THE SOFTWARE.
+ */
+
+#define QUEUE_DEPTH 16
diff --git a/tests/TFP/TFP_43_016/mpu1.c b/tests/TFP/TFP_43_016/mpu1.c
new file mode 100644
index 0000000..63fe4a0
--- /dev/null
+++ b/tests/TFP/TFP_43_016/mpu1.c
@@ -0,0 +1,57 @@
+/*
+ * Copyright 2008 Sony Corporation
+ *
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a copy
+ * of this software and associated documentation files (the "Software"), to deal
+ * in the Software without restriction, including without limitation the rights
+ * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+ * copies of the Software, and to permit persons to whom the Software is
+ * furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included in
+ * all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+ * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+ * THE SOFTWARE.
+ */
+
+#include <string.h>
+#include <mars/mars.h>
+#include "mars_task_test.h"
+#include "host_and_mpu.h"
+
+static uint64_t queue_item[2] __attribute__((aligned(16)));
+
+int mars_task_main(const struct mars_task_args *task_args)
+{
+ uint64_t queue_ea = task_args->type.u64[0];
+ uint64_t notify_ea = task_args->type.u64[1];
+ uint32_t count;
+ int ret;
+
+ mars_test_counter_wait(notify_ea, 1);
+
+ ret = mars_task_queue_count(queue_ea, &count);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+ MARS_TEST_ASSERT(count == QUEUE_DEPTH);
+
+ ret = mars_task_queue_pop_begin(queue_ea, queue_item, 0);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+
+ ret = mars_task_queue_pop_end(queue_ea, 0);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+
+ ret = mars_task_queue_count(queue_ea, &count);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+ MARS_TEST_ASSERT(count == QUEUE_DEPTH-1);
+
+ mars_task_exit(0);
+
+ return 0;
+}
diff --git a/tests/TFP/TFP_43_016/mpu2.c b/tests/TFP/TFP_43_016/mpu2.c
new file mode 100644
index 0000000..5dc8254
--- /dev/null
+++ b/tests/TFP/TFP_43_016/mpu2.c
@@ -0,0 +1,47 @@
+/*
+ * Copyright 2008 Sony Corporation
+ *
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a copy
+ * of this software and associated documentation files (the "Software"), to deal
+ * in the Software without restriction, including without limitation the rights
+ * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+ * copies of the Software, and to permit persons to whom the Software is
+ * furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included in
+ * all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+ * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+ * THE SOFTWARE.
+ */
+
+#include <string.h>
+#include <mars/mars.h>
+#include "mars_task_test.h"
+#include "host_and_mpu.h"
+
+static uint64_t queue_item[2] __attribute__((aligned(16)));
+
+int mars_task_main(const struct mars_task_args *task_args)
+{
+ uint64_t queue_ea = task_args->type.u64[0];
+ uint64_t notify_ea = task_args->type.u64[1];
+ int i, ret;
+
+ for (i = 0; i < QUEUE_DEPTH; i++) {
+ ret = mars_task_queue_push(queue_ea, queue_item);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+ }
+
+ mars_test_counter_set(notify_ea, 1);
+
+ mars_task_exit(0);
+
+ return 0;
+}
diff --git a/tests/TFP/TFP_43_017/Makefile b/tests/TFP/TFP_43_017/Makefile
new file mode 100644
index 0000000..432135a
--- /dev/null
+++ b/tests/TFP/TFP_43_017/Makefile
@@ -0,0 +1,28 @@
+#
+# Copyright 2008 Sony Corporation
+#
+#
+# Permission is hereby granted, free of charge, to any person obtaining a copy
+# of this software and associated documentation files (the "Software"), to deal
+# in the Software without restriction, including without limitation the rights
+# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+# copies of the Software, and to permit persons to whom the Software is
+# furnished to do so, subject to the following conditions:
+#
+# The above copyright notice and this permission notice shall be included in
+# all copies or substantial portions of the Software.
+#
+# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+# THE SOFTWARE.
+#
+
+top_srcdir = ../..
+test_objs = host.o mpu.task_eo
+
+include $(top_srcdir)/scripts/config.mk
+include $(top_srcdir)/scripts/rules_item.mk
diff --git a/tests/TFP/TFP_43_017/host.c b/tests/TFP/TFP_43_017/host.c
new file mode 100644
index 0000000..9218e32
--- /dev/null
+++ b/tests/TFP/TFP_43_017/host.c
@@ -0,0 +1,83 @@
+/*
+ * Copyright 2008 Sony Corporation
+ *
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a copy
+ * of this software and associated documentation files (the "Software"), to deal
+ * in the Software without restriction, including without limitation the rights
+ * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+ * copies of the Software, and to permit persons to whom the Software is
+ * furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included in
+ * all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+ * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+ * THE SOFTWARE.
+ */
+
+#include <libspe2.h>
+#include <mars/mars.h>
+#include <mars_test.h>
+#include "host_and_mpu.h"
+
+extern spe_program_handle_t mpu_prog;
+
+static struct mars_context *mars;
+static struct mars_task_id task_id;
+static struct mars_task_args task_args;
+static uint64_t queue;
+static uint64_t queue_item[2];
+
+int main(void)
+{
+ int i, exit_code, ret;
+
+ ret = mars_context_create(&mars, 0, 0);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+
+ ret = mars_task_create(
+ mars,
+ &task_id,
+ "43017",
+ mpu_prog.elf_image,
+ MARS_TASK_CONTEXT_SAVE_ALL);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+
+ ret = mars_task_queue_create(
+ mars,
+ &queue,
+ 16,
+ QUEUE_DEPTH,
+ MARS_TASK_QUEUE_HOST_TO_MPU);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+
+ for (i = 0; i < QUEUE_DEPTH; i++) {
+ ret = mars_task_queue_push(queue, queue_item);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+ }
+
+ task_args.type.u64[0] = queue;
+ ret = mars_task_schedule(&task_id, &task_args, 0);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+
+ ret = mars_task_wait(&task_id, &exit_code);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+ MARS_TEST_ASSERT_EQUAL(exit_code, 0);
+
+ ret = mars_task_queue_destroy(queue);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+
+ ret = mars_task_destroy(&task_id);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+
+ ret = mars_context_destroy(mars);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+
+ return 0;
+}
diff --git a/tests/TFP/TFP_43_017/host_and_mpu.h b/tests/TFP/TFP_43_017/host_and_mpu.h
new file mode 100644
index 0000000..e565e93
--- /dev/null
+++ b/tests/TFP/TFP_43_017/host_and_mpu.h
@@ -0,0 +1,24 @@
+/*
+ * Copyright 2008 Sony Corporation
+ *
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a copy
+ * of this software and associated documentation files (the "Software"), to deal
+ * in the Software without restriction, including without limitation the rights
+ * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+ * copies of the Software, and to permit persons to whom the Software is
+ * furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included in
+ * all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+ * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+ * THE SOFTWARE.
+ */
+
+#define QUEUE_DEPTH 16
diff --git a/tests/TFP/TFP_43_017/mpu.c b/tests/TFP/TFP_43_017/mpu.c
new file mode 100644
index 0000000..4a3225f
--- /dev/null
+++ b/tests/TFP/TFP_43_017/mpu.c
@@ -0,0 +1,56 @@
+/*
+ * Copyright 2008 Sony Corporation
+ *
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a copy
+ * of this software and associated documentation files (the "Software"), to deal
+ * in the Software without restriction, including without limitation the rights
+ * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+ * copies of the Software, and to permit persons to whom the Software is
+ * furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included in
+ * all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+ * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+ * THE SOFTWARE.
+ */
+
+#include <string.h>
+#include <mars/mars.h>
+#include "mars_task_test.h"
+#include "host_and_mpu.h"
+
+static uint64_t queue_item[2] __attribute__((aligned(16)));
+
+int mars_task_main(const struct mars_task_args *task_args)
+{
+ uint64_t queue_ea = task_args->type.u64[0];
+ uint32_t count;
+ int ret;
+
+ ret = mars_task_queue_count(queue_ea, &count);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+
+ MARS_TEST_ASSERT(count == QUEUE_DEPTH);
+
+ ret = mars_task_queue_try_pop_begin(queue_ea, queue_item, 0);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+
+ ret = mars_task_queue_pop_end(queue_ea, 0);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+
+ ret = mars_task_queue_count(queue_ea, &count);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+
+ MARS_TEST_ASSERT(count == QUEUE_DEPTH-1);
+
+ mars_task_exit(0);
+
+ return 0;
+}
diff --git a/tests/TFP/TFP_43_018/Makefile b/tests/TFP/TFP_43_018/Makefile
new file mode 100644
index 0000000..ecbce33
--- /dev/null
+++ b/tests/TFP/TFP_43_018/Makefile
@@ -0,0 +1,28 @@
+#
+# Copyright 2008 Sony Corporation
+#
+#
+# Permission is hereby granted, free of charge, to any person obtaining a copy
+# of this software and associated documentation files (the "Software"), to deal
+# in the Software without restriction, including without limitation the rights
+# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+# copies of the Software, and to permit persons to whom the Software is
+# furnished to do so, subject to the following conditions:
+#
+# The above copyright notice and this permission notice shall be included in
+# all copies or substantial portions of the Software.
+#
+# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+# THE SOFTWARE.
+#
+
+top_srcdir = ../..
+test_objs = host.o mpu1.task_eo mpu2.task_eo
+
+include $(top_srcdir)/scripts/config.mk
+include $(top_srcdir)/scripts/rules_item.mk
diff --git a/tests/TFP/TFP_43_018/host.c b/tests/TFP/TFP_43_018/host.c
new file mode 100644
index 0000000..2c3476f
--- /dev/null
+++ b/tests/TFP/TFP_43_018/host.c
@@ -0,0 +1,97 @@
+/*
+ * Copyright 2008 Sony Corporation
+ *
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a copy
+ * of this software and associated documentation files (the "Software"), to deal
+ * in the Software without restriction, including without limitation the rights
+ * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+ * copies of the Software, and to permit persons to whom the Software is
+ * furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included in
+ * all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+ * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+ * THE SOFTWARE.
+ */
+
+#include <libspe2.h>
+#include <mars/mars.h>
+#include <mars_test.h>
+#include "host_and_mpu.h"
+
+extern spe_program_handle_t mpu1_prog, mpu2_prog;
+
+static struct mars_context *mars;
+static struct mars_task_id poper_task_id, counter_task_id;
+static struct mars_task_args task_args;
+static uint64_t queue;
+static uint32_t notify[32] __attribute__((aligned(16)));
+
+int main(void)
+{
+ int exit_code, ret;
+
+ ret = mars_context_create(&mars, 0, 0);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+
+ ret = mars_task_create(
+ mars,
+ &poper_task_id,
+ "43018 poper",
+ mpu1_prog.elf_image,
+ MARS_TASK_CONTEXT_SAVE_ALL);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+
+ ret = mars_task_create(
+ mars,
+ &counter_task_id,
+ "43018 counter",
+ mpu2_prog.elf_image,
+ MARS_TASK_CONTEXT_SAVE_ALL);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+
+ ret = mars_task_queue_create(
+ mars,
+ &queue,
+ 16,
+ QUEUE_DEPTH,
+ MARS_TASK_QUEUE_MPU_TO_MPU);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+
+ task_args.type.u64[0] = queue;
+ task_args.type.u64[1] = mars_ptr_to_ea(notify);
+ ret = mars_task_schedule(&poper_task_id, &task_args, 0);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+
+ ret = mars_task_schedule(&counter_task_id, &task_args, 0);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+
+ ret = mars_task_wait(&poper_task_id, &exit_code);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+ MARS_TEST_ASSERT_EQUAL(exit_code, 0);
+
+ ret = mars_task_wait(&counter_task_id, &exit_code);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+ MARS_TEST_ASSERT_EQUAL(exit_code, 0);
+
+ ret = mars_task_queue_destroy(queue);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+
+ ret = mars_task_destroy(&poper_task_id);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+
+ ret = mars_task_destroy(&counter_task_id);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+
+ ret = mars_context_destroy(mars);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+
+ return 0;
+}
diff --git a/tests/TFP/TFP_43_018/host_and_mpu.h b/tests/TFP/TFP_43_018/host_and_mpu.h
new file mode 100644
index 0000000..e565e93
--- /dev/null
+++ b/tests/TFP/TFP_43_018/host_and_mpu.h
@@ -0,0 +1,24 @@
+/*
+ * Copyright 2008 Sony Corporation
+ *
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a copy
+ * of this software and associated documentation files (the "Software"), to deal
+ * in the Software without restriction, including without limitation the rights
+ * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+ * copies of the Software, and to permit persons to whom the Software is
+ * furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included in
+ * all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+ * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+ * THE SOFTWARE.
+ */
+
+#define QUEUE_DEPTH 16
diff --git a/tests/TFP/TFP_43_018/mpu1.c b/tests/TFP/TFP_43_018/mpu1.c
new file mode 100644
index 0000000..361bdd5
--- /dev/null
+++ b/tests/TFP/TFP_43_018/mpu1.c
@@ -0,0 +1,57 @@
+/*
+ * Copyright 2008 Sony Corporation
+ *
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a copy
+ * of this software and associated documentation files (the "Software"), to deal
+ * in the Software without restriction, including without limitation the rights
+ * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+ * copies of the Software, and to permit persons to whom the Software is
+ * furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included in
+ * all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+ * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+ * THE SOFTWARE.
+ */
+
+#include <string.h>
+#include <mars/mars.h>
+#include "mars_task_test.h"
+#include "host_and_mpu.h"
+
+static uint64_t queue_item[2] __attribute__((aligned(16)));
+
+int mars_task_main(const struct mars_task_args *task_args)
+{
+ uint64_t queue_ea = task_args->type.u64[0];
+ uint64_t notify_ea = task_args->type.u64[1];
+ uint32_t count;
+ int ret;
+
+ mars_test_counter_wait(notify_ea, 1);
+
+ ret = mars_task_queue_count(queue_ea, &count);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+ MARS_TEST_ASSERT(count == QUEUE_DEPTH);
+
+ ret = mars_task_queue_try_pop_begin(queue_ea, queue_item, 0);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+
+ ret = mars_task_queue_pop_end(queue_ea, 0);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+
+ ret = mars_task_queue_count(queue_ea, &count);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+ MARS_TEST_ASSERT(count == QUEUE_DEPTH-1);
+
+ mars_task_exit(0);
+
+ return 0;
+}
diff --git a/tests/TFP/TFP_43_018/mpu2.c b/tests/TFP/TFP_43_018/mpu2.c
new file mode 100644
index 0000000..5dc8254
--- /dev/null
+++ b/tests/TFP/TFP_43_018/mpu2.c
@@ -0,0 +1,47 @@
+/*
+ * Copyright 2008 Sony Corporation
+ *
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a copy
+ * of this software and associated documentation files (the "Software"), to deal
+ * in the Software without restriction, including without limitation the rights
+ * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+ * copies of the Software, and to permit persons to whom the Software is
+ * furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included in
+ * all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+ * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+ * THE SOFTWARE.
+ */
+
+#include <string.h>
+#include <mars/mars.h>
+#include "mars_task_test.h"
+#include "host_and_mpu.h"
+
+static uint64_t queue_item[2] __attribute__((aligned(16)));
+
+int mars_task_main(const struct mars_task_args *task_args)
+{
+ uint64_t queue_ea = task_args->type.u64[0];
+ uint64_t notify_ea = task_args->type.u64[1];
+ int i, ret;
+
+ for (i = 0; i < QUEUE_DEPTH; i++) {
+ ret = mars_task_queue_push(queue_ea, queue_item);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+ }
+
+ mars_test_counter_set(notify_ea, 1);
+
+ mars_task_exit(0);
+
+ return 0;
+}
diff --git a/tests/TFP/TFP_45_001/Makefile b/tests/TFP/TFP_45_001/Makefile
new file mode 100644
index 0000000..432135a
--- /dev/null
+++ b/tests/TFP/TFP_45_001/Makefile
@@ -0,0 +1,28 @@
+#
+# Copyright 2008 Sony Corporation
+#
+#
+# Permission is hereby granted, free of charge, to any person obtaining a copy
+# of this software and associated documentation files (the "Software"), to deal
+# in the Software without restriction, including without limitation the rights
+# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+# copies of the Software, and to permit persons to whom the Software is
+# furnished to do so, subject to the following conditions:
+#
+# The above copyright notice and this permission notice shall be included in
+# all copies or substantial portions of the Software.
+#
+# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+# THE SOFTWARE.
+#
+
+top_srcdir = ../..
+test_objs = host.o mpu.task_eo
+
+include $(top_srcdir)/scripts/config.mk
+include $(top_srcdir)/scripts/rules_item.mk
diff --git a/tests/TFP/TFP_45_001/host.c b/tests/TFP/TFP_45_001/host.c
new file mode 100644
index 0000000..9f51f2d
--- /dev/null
+++ b/tests/TFP/TFP_45_001/host.c
@@ -0,0 +1,95 @@
+/*
+ * Copyright 2008 Sony Corporation
+ *
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a copy
+ * of this software and associated documentation files (the "Software"), to deal
+ * in the Software without restriction, including without limitation the rights
+ * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+ * copies of the Software, and to permit persons to whom the Software is
+ * furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included in
+ * all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+ * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+ * THE SOFTWARE.
+ */
+
+#include <libspe2.h>
+#include <mars/mars.h>
+#include <mars_test.h>
+#include "host_and_mpu.h"
+
+extern spe_program_handle_t mpu_prog;
+
+static struct mars_context *mars;
+static struct mars_task_id task_id;
+static struct mars_task_args task_args;
+static uint64_t queue;
+static uint64_t queue_item[2], mpu_answer __attribute__((aligned(16)));
+
+int main(void)
+{
+ int i, exit_code, ret;
+ uint32_t tb_freq;
+
+ ret = mars_test_get_timebase_freq(&tb_freq);
+ MARS_TEST_ASSERT_EQUAL(ret, 0);
+
+ ret = mars_context_create(&mars, 0, 0);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+
+ ret = mars_task_create(
+ mars,
+ &task_id,
+ "45001",
+ mpu_prog.elf_image,
+ MARS_TASK_CONTEXT_SAVE_ALL);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+
+ ret = mars_task_queue_create(
+ mars,
+ &queue,
+ 16,
+ QUEUE_DEPTH,
+ MARS_TASK_QUEUE_HOST_TO_MPU);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+
+ mpu_answer = 0;
+
+ task_args.type.u64[0] = queue;
+ task_args.type.u64[1] = mars_ptr_to_ea(&mpu_answer);
+ task_args.type.u64[2] = tb_freq;
+ ret = mars_task_schedule(&task_id, &task_args, 0);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+
+ for (i = 0; i < QUEUE_DEPTH+1; i++) {
+ queue_item[0] = queue_item[1] = i;
+
+ ret = mars_task_queue_push(queue, queue_item);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+ }
+
+ MARS_TEST_ASSERT(mpu_answer);
+
+ ret = mars_task_wait(&task_id, &exit_code);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+ MARS_TEST_ASSERT_EQUAL(exit_code, 0);
+
+ ret = mars_task_queue_destroy(queue);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+
+ ret = mars_task_destroy(&task_id);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+
+ ret = mars_context_destroy(mars);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+
+ return 0;
+}
diff --git a/tests/TFP/TFP_45_001/host_and_mpu.h b/tests/TFP/TFP_45_001/host_and_mpu.h
new file mode 100644
index 0000000..e565e93
--- /dev/null
+++ b/tests/TFP/TFP_45_001/host_and_mpu.h
@@ -0,0 +1,24 @@
+/*
+ * Copyright 2008 Sony Corporation
+ *
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a copy
+ * of this software and associated documentation files (the "Software"), to deal
+ * in the Software without restriction, including without limitation the rights
+ * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+ * copies of the Software, and to permit persons to whom the Software is
+ * furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included in
+ * all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+ * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+ * THE SOFTWARE.
+ */
+
+#define QUEUE_DEPTH 16
diff --git a/tests/TFP/TFP_45_001/mpu.c b/tests/TFP/TFP_45_001/mpu.c
new file mode 100644
index 0000000..5b7366c
--- /dev/null
+++ b/tests/TFP/TFP_45_001/mpu.c
@@ -0,0 +1,53 @@
+/*
+ * Copyright 2008 Sony Corporation
+ *
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a copy
+ * of this software and associated documentation files (the "Software"), to deal
+ * in the Software without restriction, including without limitation the rights
+ * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+ * copies of the Software, and to permit persons to whom the Software is
+ * furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included in
+ * all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+ * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+ * THE SOFTWARE.
+ */
+
+#include <string.h>
+#include <spu_mfcio.h>
+#include <mars/mars.h>
+#include "mars_task_test.h"
+#include "host_and_mpu.h"
+
+static uint64_t queue_item[2] __attribute__((aligned(16)));
+
+int mars_task_main(const struct mars_task_args *task_args)
+{
+ uint64_t queue_ea = task_args->type.u64[0];
+ uint64_t mpu_answer_ea = task_args->type.u64[1];
+ uint32_t tb_freq = task_args->type.u64[2];
+ int i, ret;
+
+ mars_test_usleep(tb_freq, 100000);
+
+ mars_test_int64_put(mpu_answer_ea, 1);
+
+ for (i = 0; i < QUEUE_DEPTH+1; i++) {
+ ret = mars_task_queue_pop(queue_ea, queue_item);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+
+ MARS_TEST_ASSERT(queue_item[0] == i && queue_item[1] == i);
+ }
+
+ mars_task_exit(0);
+
+ return 0;
+}
diff --git a/tests/TFP/TFP_45_002/Makefile b/tests/TFP/TFP_45_002/Makefile
new file mode 100644
index 0000000..432135a
--- /dev/null
+++ b/tests/TFP/TFP_45_002/Makefile
@@ -0,0 +1,28 @@
+#
+# Copyright 2008 Sony Corporation
+#
+#
+# Permission is hereby granted, free of charge, to any person obtaining a copy
+# of this software and associated documentation files (the "Software"), to deal
+# in the Software without restriction, including without limitation the rights
+# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+# copies of the Software, and to permit persons to whom the Software is
+# furnished to do so, subject to the following conditions:
+#
+# The above copyright notice and this permission notice shall be included in
+# all copies or substantial portions of the Software.
+#
+# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+# THE SOFTWARE.
+#
+
+top_srcdir = ../..
+test_objs = host.o mpu.task_eo
+
+include $(top_srcdir)/scripts/config.mk
+include $(top_srcdir)/scripts/rules_item.mk
diff --git a/tests/TFP/TFP_45_002/host.c b/tests/TFP/TFP_45_002/host.c
new file mode 100644
index 0000000..14344c5
--- /dev/null
+++ b/tests/TFP/TFP_45_002/host.c
@@ -0,0 +1,93 @@
+/*
+ * Copyright 2008 Sony Corporation
+ *
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a copy
+ * of this software and associated documentation files (the "Software"), to deal
+ * in the Software without restriction, including without limitation the rights
+ * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+ * copies of the Software, and to permit persons to whom the Software is
+ * furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included in
+ * all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+ * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+ * THE SOFTWARE.
+ */
+
+#include <unistd.h>
+#include <libspe2.h>
+#include <mars/mars.h>
+#include <mars_test.h>
+#include "host_and_mpu.h"
+
+extern spe_program_handle_t mpu_prog;
+
+static struct mars_context *mars;
+static struct mars_task_id task_id;
+static struct mars_task_args task_args;
+static uint64_t queue;
+static uint64_t queue_item[2], mpu_answer __attribute__((aligned(16)));
+
+int main(void)
+{
+ int i, exit_code, ret;
+
+ ret = mars_context_create(&mars, 0, 0);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+
+ ret = mars_task_create(
+ mars,
+ &task_id,
+ "45002",
+ mpu_prog.elf_image,
+ MARS_TASK_CONTEXT_SAVE_ALL);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+
+ ret = mars_task_queue_create(
+ mars,
+ &queue,
+ 16,
+ QUEUE_DEPTH,
+ MARS_TASK_QUEUE_MPU_TO_HOST);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+
+ mpu_answer = 0;
+
+ task_args.type.u64[0] = queue;
+ task_args.type.u64[1] = mars_ptr_to_ea(&mpu_answer);
+ ret = mars_task_schedule(&task_id, &task_args, 0);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+
+ usleep(100000);
+
+ mpu_answer = 1;
+
+ for (i = 0; i < QUEUE_DEPTH+1; i++) {
+ ret = mars_task_queue_pop(queue, queue_item);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+
+ MARS_TEST_ASSERT(queue_item[0] == i && queue_item[1] == i);
+ }
+
+ ret = mars_task_wait(&task_id, &exit_code);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+ MARS_TEST_ASSERT_EQUAL(exit_code, 0);
+
+ ret = mars_task_queue_destroy(queue);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+
+ ret = mars_task_destroy(&task_id);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+
+ ret = mars_context_destroy(mars);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+
+ return 0;
+}
diff --git a/tests/TFP/TFP_45_002/host_and_mpu.h b/tests/TFP/TFP_45_002/host_and_mpu.h
new file mode 100644
index 0000000..e565e93
--- /dev/null
+++ b/tests/TFP/TFP_45_002/host_and_mpu.h
@@ -0,0 +1,24 @@
+/*
+ * Copyright 2008 Sony Corporation
+ *
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a copy
+ * of this software and associated documentation files (the "Software"), to deal
+ * in the Software without restriction, including without limitation the rights
+ * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+ * copies of the Software, and to permit persons to whom the Software is
+ * furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included in
+ * all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+ * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+ * THE SOFTWARE.
+ */
+
+#define QUEUE_DEPTH 16
diff --git a/tests/TFP/TFP_45_002/mpu.c b/tests/TFP/TFP_45_002/mpu.c
new file mode 100644
index 0000000..9b7c07b
--- /dev/null
+++ b/tests/TFP/TFP_45_002/mpu.c
@@ -0,0 +1,52 @@
+/*
+ * Copyright 2008 Sony Corporation
+ *
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a copy
+ * of this software and associated documentation files (the "Software"), to deal
+ * in the Software without restriction, including without limitation the rights
+ * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+ * copies of the Software, and to permit persons to whom the Software is
+ * furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included in
+ * all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+ * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+ * THE SOFTWARE.
+ */
+
+#include <string.h>
+#include <spu_mfcio.h>
+#include <mars/mars.h>
+#include "mars_task_test.h"
+#include "host_and_mpu.h"
+
+static uint64_t queue_item[2] __attribute__((aligned(16)));
+
+int mars_task_main(const struct mars_task_args *task_args)
+{
+ uint64_t queue_ea = task_args->type.u64[0];
+ uint64_t mpu_answer_ea = task_args->type.u64[1];
+ uint64_t mpu_answer;
+ int i, ret;
+
+ for (i = 0; i < QUEUE_DEPTH+1; i++) {
+ queue_item[0] = queue_item[1] = i;
+
+ ret = mars_task_queue_push(queue_ea, queue_item);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+ }
+
+ mpu_answer = mars_test_int64_get(mpu_answer_ea);
+ MARS_TEST_ASSERT(mpu_answer);
+
+ mars_task_exit(0);
+
+ return 0;
+}
diff --git a/tests/TFP/TFP_45_003/Makefile b/tests/TFP/TFP_45_003/Makefile
new file mode 100644
index 0000000..ecbce33
--- /dev/null
+++ b/tests/TFP/TFP_45_003/Makefile
@@ -0,0 +1,28 @@
+#
+# Copyright 2008 Sony Corporation
+#
+#
+# Permission is hereby granted, free of charge, to any person obtaining a copy
+# of this software and associated documentation files (the "Software"), to deal
+# in the Software without restriction, including without limitation the rights
+# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+# copies of the Software, and to permit persons to whom the Software is
+# furnished to do so, subject to the following conditions:
+#
+# The above copyright notice and this permission notice shall be included in
+# all copies or substantial portions of the Software.
+#
+# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+# THE SOFTWARE.
+#
+
+top_srcdir = ../..
+test_objs = host.o mpu1.task_eo mpu2.task_eo
+
+include $(top_srcdir)/scripts/config.mk
+include $(top_srcdir)/scripts/rules_item.mk
diff --git a/tests/TFP/TFP_45_003/host.c b/tests/TFP/TFP_45_003/host.c
new file mode 100644
index 0000000..404a455
--- /dev/null
+++ b/tests/TFP/TFP_45_003/host.c
@@ -0,0 +1,104 @@
+/*
+ * Copyright 2008 Sony Corporation
+ *
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a copy
+ * of this software and associated documentation files (the "Software"), to deal
+ * in the Software without restriction, including without limitation the rights
+ * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+ * copies of the Software, and to permit persons to whom the Software is
+ * furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included in
+ * all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+ * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+ * THE SOFTWARE.
+ */
+
+#include <libspe2.h>
+#include <mars/mars.h>
+#include <mars_test.h>
+#include "host_and_mpu.h"
+
+extern spe_program_handle_t mpu1_prog, mpu2_prog;
+
+static struct mars_context *mars;
+static struct mars_task_id pusher_task_id, poper_task_id;
+static struct mars_task_args task_args;
+static uint64_t queue;
+static uint64_t mpu_answer __attribute__((aligned(16)));
+
+int main(void)
+{
+ int exit_code, ret;
+ uint32_t tb_freq;
+
+ ret = mars_test_get_timebase_freq(&tb_freq);
+ MARS_TEST_ASSERT_EQUAL(ret, 0);
+
+ ret = mars_context_create(&mars, 0, 0);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+
+ ret = mars_task_create(
+ mars,
+ &pusher_task_id,
+ "45003",
+ mpu1_prog.elf_image,
+ MARS_TASK_CONTEXT_SAVE_ALL);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+
+ ret = mars_task_create(
+ mars,
+ &poper_task_id,
+ "45003",
+ mpu2_prog.elf_image,
+ MARS_TASK_CONTEXT_SAVE_ALL);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+
+ ret = mars_task_queue_create(
+ mars,
+ &queue,
+ 16,
+ QUEUE_DEPTH,
+ MARS_TASK_QUEUE_MPU_TO_MPU);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+
+ mpu_answer = 0;
+
+ task_args.type.u64[0] = queue;
+ task_args.type.u64[1] = mars_ptr_to_ea(&mpu_answer);
+ task_args.type.u64[2] = tb_freq;
+ ret = mars_task_schedule(&pusher_task_id, &task_args, 0);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+
+ ret = mars_task_schedule(&poper_task_id, &task_args, 0);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+
+ ret = mars_task_wait(&pusher_task_id, &exit_code);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+ MARS_TEST_ASSERT_EQUAL(exit_code, 0);
+
+ ret = mars_task_wait(&poper_task_id, &exit_code);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+ MARS_TEST_ASSERT_EQUAL(exit_code, 0);
+
+ ret = mars_task_queue_destroy(queue);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+
+ ret = mars_task_destroy(&pusher_task_id);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+
+ ret = mars_task_destroy(&poper_task_id);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+
+ ret = mars_context_destroy(mars);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+
+ return 0;
+}
diff --git a/tests/TFP/TFP_45_003/host_and_mpu.h b/tests/TFP/TFP_45_003/host_and_mpu.h
new file mode 100644
index 0000000..e565e93
--- /dev/null
+++ b/tests/TFP/TFP_45_003/host_and_mpu.h
@@ -0,0 +1,24 @@
+/*
+ * Copyright 2008 Sony Corporation
+ *
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a copy
+ * of this software and associated documentation files (the "Software"), to deal
+ * in the Software without restriction, including without limitation the rights
+ * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+ * copies of the Software, and to permit persons to whom the Software is
+ * furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included in
+ * all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+ * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+ * THE SOFTWARE.
+ */
+
+#define QUEUE_DEPTH 16
diff --git a/tests/TFP/TFP_45_003/mpu1.c b/tests/TFP/TFP_45_003/mpu1.c
new file mode 100644
index 0000000..46bbaae
--- /dev/null
+++ b/tests/TFP/TFP_45_003/mpu1.c
@@ -0,0 +1,53 @@
+/*
+ * Copyright 2008 Sony Corporation
+ *
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a copy
+ * of this software and associated documentation files (the "Software"), to deal
+ * in the Software without restriction, including without limitation the rights
+ * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+ * copies of the Software, and to permit persons to whom the Software is
+ * furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included in
+ * all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+ * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+ * THE SOFTWARE.
+ */
+
+#include <string.h>
+#include <spu_mfcio.h>
+#include <mars/mars.h>
+#include "mars_task_test.h"
+#include "host_and_mpu.h"
+
+static uint64_t queue_item[2] __attribute__((aligned(16)));
+
+int mars_task_main(const struct mars_task_args *task_args)
+{
+ uint64_t queue_ea = task_args->type.u64[0];
+ uint64_t mpu_answer_ea = task_args->type.u64[1];
+ int i, ret;
+
+ uint64_t mpu_answer;
+
+ for (i = 0; i < QUEUE_DEPTH+1; i++) {
+ queue_item[0] = queue_item[1] = i;
+
+ ret = mars_task_queue_push(queue_ea, queue_item);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+ }
+
+ mpu_answer = mars_test_int64_get(mpu_answer_ea);
+ MARS_TEST_ASSERT(mpu_answer);
+
+ mars_task_exit(0);
+
+ return 0;
+}
diff --git a/tests/TFP/TFP_45_003/mpu2.c b/tests/TFP/TFP_45_003/mpu2.c
new file mode 100644
index 0000000..5b7366c
--- /dev/null
+++ b/tests/TFP/TFP_45_003/mpu2.c
@@ -0,0 +1,53 @@
+/*
+ * Copyright 2008 Sony Corporation
+ *
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a copy
+ * of this software and associated documentation files (the "Software"), to deal
+ * in the Software without restriction, including without limitation the rights
+ * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+ * copies of the Software, and to permit persons to whom the Software is
+ * furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included in
+ * all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+ * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+ * THE SOFTWARE.
+ */
+
+#include <string.h>
+#include <spu_mfcio.h>
+#include <mars/mars.h>
+#include "mars_task_test.h"
+#include "host_and_mpu.h"
+
+static uint64_t queue_item[2] __attribute__((aligned(16)));
+
+int mars_task_main(const struct mars_task_args *task_args)
+{
+ uint64_t queue_ea = task_args->type.u64[0];
+ uint64_t mpu_answer_ea = task_args->type.u64[1];
+ uint32_t tb_freq = task_args->type.u64[2];
+ int i, ret;
+
+ mars_test_usleep(tb_freq, 100000);
+
+ mars_test_int64_put(mpu_answer_ea, 1);
+
+ for (i = 0; i < QUEUE_DEPTH+1; i++) {
+ ret = mars_task_queue_pop(queue_ea, queue_item);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+
+ MARS_TEST_ASSERT(queue_item[0] == i && queue_item[1] == i);
+ }
+
+ mars_task_exit(0);
+
+ return 0;
+}
diff --git a/tests/TFP/TFP_45_004/Makefile b/tests/TFP/TFP_45_004/Makefile
new file mode 100644
index 0000000..432135a
--- /dev/null
+++ b/tests/TFP/TFP_45_004/Makefile
@@ -0,0 +1,28 @@
+#
+# Copyright 2008 Sony Corporation
+#
+#
+# Permission is hereby granted, free of charge, to any person obtaining a copy
+# of this software and associated documentation files (the "Software"), to deal
+# in the Software without restriction, including without limitation the rights
+# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+# copies of the Software, and to permit persons to whom the Software is
+# furnished to do so, subject to the following conditions:
+#
+# The above copyright notice and this permission notice shall be included in
+# all copies or substantial portions of the Software.
+#
+# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+# THE SOFTWARE.
+#
+
+top_srcdir = ../..
+test_objs = host.o mpu.task_eo
+
+include $(top_srcdir)/scripts/config.mk
+include $(top_srcdir)/scripts/rules_item.mk
diff --git a/tests/TFP/TFP_45_004/host.c b/tests/TFP/TFP_45_004/host.c
new file mode 100644
index 0000000..81293d1
--- /dev/null
+++ b/tests/TFP/TFP_45_004/host.c
@@ -0,0 +1,139 @@
+/*
+ * Copyright 2008 Sony Corporation
+ *
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a copy
+ * of this software and associated documentation files (the "Software"), to deal
+ * in the Software without restriction, including without limitation the rights
+ * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+ * copies of the Software, and to permit persons to whom the Software is
+ * furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included in
+ * all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+ * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+ * THE SOFTWARE.
+ */
+
+#include <pthread.h>
+#include <unistd.h>
+#include <mars/mars.h>
+#include <libspe2.h>
+#include <mars_test.h>
+
+struct queue_entry {
+ uint64_t val1;
+ uint64_t val2;
+};
+#define Q_DEPTH (16)
+
+#define NUM_LOOP 5
+static uint32_t depth_size[] =
+{
+ 1,
+ Q_DEPTH / 2,
+ Q_DEPTH,
+ Q_DEPTH,
+ Q_DEPTH
+};
+extern spe_program_handle_t mpu_prog;
+
+static struct mars_context *mars_ctx;
+static struct mars_task_args task_args;
+static struct mars_task_id task_id;
+
+static uint64_t host_to_mpu[NUM_LOOP];
+static uint32_t shared_resource __attribute((aligned(16)));
+
+static struct queue_entry data[Q_DEPTH];
+static struct mars_task_args thread_args[Q_DEPTH];
+static pthread_t thread[Q_DEPTH];
+static void *thread_proc(void *ptr)
+{
+ int ret;
+ struct mars_task_args *task_args = (struct mars_task_args *)ptr;
+ uint32_t id = (uint32_t)task_args->type.u32[0];
+ uint32_t count = (uint32_t)task_args->type.u32[1];
+
+ /* wait for start */
+ while (!shared_resource)
+ usleep(100);
+
+ data[count].val1 = (uint64_t)id;
+ data[count].val2 = (uint64_t)count;
+ ret = mars_task_queue_push(host_to_mpu[id], &data[count]);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+
+ return NULL;
+}
+
+int main(void)
+{
+ int ret, i;
+ int32_t exit_code;
+ uint32_t num;
+
+ ret = mars_context_create(&mars_ctx, 0, 0);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+
+ for (i = 0; i < NUM_LOOP; i++) {
+ shared_resource = 0;
+
+ ret = mars_task_queue_create(
+ mars_ctx,
+ &host_to_mpu[i],
+ sizeof(struct queue_entry),
+ depth_size[i],
+ MARS_TASK_QUEUE_HOST_TO_MPU);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+
+ /* create push thread */
+ for (num = 0; num < depth_size[i]; num++) {
+ thread_args[num].type.u32[0] = (uint32_t)i;
+ thread_args[num].type.u32[1] = (uint32_t)num;
+ pthread_create(&thread[num], NULL,
+ thread_proc, &thread_args[num]);
+ }
+
+ /* create pop task */
+ ret = mars_task_create(mars_ctx, &task_id, NULL,
+ mpu_prog.elf_image, MARS_TASK_CONTEXT_SAVE_ALL);
+
+ /* start ppe threads at the same time */
+ sleep(1);
+ shared_resource = 1;
+
+ /* check if all threads finished without fail */
+ for (num = 0; num < depth_size[i]; num++)
+ pthread_join(thread[num], NULL);
+
+ /* run pop task */
+ task_args.type.u64[0] = host_to_mpu[i];
+ task_args.type.u64[1] = (uint64_t)i;
+ task_args.type.u64[2] = (uint64_t)depth_size[i];
+ ret = mars_task_schedule(&task_id, &task_args, 0);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+
+ ret = mars_task_wait(&task_id, &exit_code);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+ MARS_TEST_ASSERT_ERROR(exit_code, MARS_SUCCESS);
+
+ ret = mars_task_destroy(&task_id);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+
+ ret = mars_task_queue_destroy(host_to_mpu[i]);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+ }
+
+ ret = mars_context_destroy(mars_ctx);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+
+ return 0;
+}
+
diff --git a/tests/TFP/TFP_45_004/mpu.c b/tests/TFP/TFP_45_004/mpu.c
new file mode 100644
index 0000000..050d450
--- /dev/null
+++ b/tests/TFP/TFP_45_004/mpu.c
@@ -0,0 +1,61 @@
+/*
+ * Copyright 2008 Sony Corporation
+ *
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a copy
+ * of this software and associated documentation files (the "Software"), to deal
+ * in the Software without restriction, including without limitation the rights
+ * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+ * copies of the Software, and to permit persons to whom the Software is
+ * furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included in
+ * all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+ * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+ * THE SOFTWARE.
+ */
+
+#include <mars/mars.h>
+#include <mars_task_test.h>
+
+struct queue_entry {
+ uint64_t val1;
+ uint64_t val2;
+};
+static struct queue_entry data;
+
+int mars_task_main(const struct mars_task_args *task_args)
+{
+ int ret, i;
+ uint64_t host_to_mpu_ea = task_args->type.u64[0];
+ uint64_t id = task_args->type.u64[1];
+ uint64_t num = task_args->type.u64[2];
+ uint64_t sum, sum_q;
+ uint32_t count;
+
+ sum = sum_q = 0;
+ for (i = 0; i < num; i++) {
+ ret = mars_task_queue_pop(host_to_mpu_ea, &data);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+
+ MARS_TEST_ASSERT_EQUAL(data.val1, id);
+ sum += i;
+ sum_q += data.val2;
+ }
+
+ /* check queue data */
+ MARS_TEST_ASSERT_EQUAL(sum, sum_q);
+
+ /* queue should be empty */
+ ret = mars_task_queue_count(host_to_mpu_ea, &count);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+ MARS_TEST_ASSERT_EQUAL(count, 0);
+
+ return 0;
+}
diff --git a/tests/TFP/TFP_45_005/Makefile b/tests/TFP/TFP_45_005/Makefile
new file mode 100644
index 0000000..432135a
--- /dev/null
+++ b/tests/TFP/TFP_45_005/Makefile
@@ -0,0 +1,28 @@
+#
+# Copyright 2008 Sony Corporation
+#
+#
+# Permission is hereby granted, free of charge, to any person obtaining a copy
+# of this software and associated documentation files (the "Software"), to deal
+# in the Software without restriction, including without limitation the rights
+# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+# copies of the Software, and to permit persons to whom the Software is
+# furnished to do so, subject to the following conditions:
+#
+# The above copyright notice and this permission notice shall be included in
+# all copies or substantial portions of the Software.
+#
+# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+# THE SOFTWARE.
+#
+
+top_srcdir = ../..
+test_objs = host.o mpu.task_eo
+
+include $(top_srcdir)/scripts/config.mk
+include $(top_srcdir)/scripts/rules_item.mk
diff --git a/tests/TFP/TFP_45_005/host.c b/tests/TFP/TFP_45_005/host.c
new file mode 100644
index 0000000..f1b1a29
--- /dev/null
+++ b/tests/TFP/TFP_45_005/host.c
@@ -0,0 +1,140 @@
+/*
+ * Copyright 2008 Sony Corporation
+ *
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a copy
+ * of this software and associated documentation files (the "Software"), to deal
+ * in the Software without restriction, including without limitation the rights
+ * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+ * copies of the Software, and to permit persons to whom the Software is
+ * furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included in
+ * all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+ * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+ * THE SOFTWARE.
+ */
+
+#include <unistd.h>
+#include <mars/mars.h>
+#include <libspe2.h>
+#include <mars_test.h>
+
+struct queue_entry {
+ uint64_t val1;
+ uint64_t val2;
+};
+#define Q_DEPTH (256)
+
+#define NUM_LOOP 5
+static uint32_t depth_size[] =
+{
+ 1,
+ Q_DEPTH / 2,
+ Q_DEPTH,
+ Q_DEPTH,
+ Q_DEPTH
+};
+extern spe_program_handle_t mpu_prog;
+
+static struct mars_context *mars_ctx;
+static struct mars_task_args task_args;
+static struct mars_task_id task_id[Q_DEPTH];
+
+static uint64_t mpu_to_host[NUM_LOOP];
+static uint32_t notify[32] __attribute((aligned(128)));
+static struct queue_entry data;
+
+static void check_queue(uint64_t id, uint64_t num)
+{
+ int ret, i;
+ uint64_t sum, sum_q;
+ uint32_t count;
+
+ sum = sum_q = 0;
+ for (i = 0; i < num; i++) {
+ ret = mars_task_queue_pop(mpu_to_host[id], &data);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+
+ MARS_TEST_ASSERT_EQUAL(data.val1, id);
+ sum += i;
+ sum_q += data.val2;
+ }
+ /* check queue data */
+ MARS_TEST_ASSERT_EQUAL(sum, sum_q);
+
+ /* queue should be empty */
+ ret = mars_task_queue_count(mpu_to_host[id], &count);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+ MARS_TEST_ASSERT_EQUAL(count, 0);
+}
+
+int main(void)
+{
+ int ret, i;
+ int32_t exit_code;
+ uint32_t num;
+
+ ret = mars_context_create(&mars_ctx, 0, 0);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+
+ for (i = 0; i < NUM_LOOP; i++) {
+ notify[0] = 0;
+
+ ret = mars_task_queue_create(
+ mars_ctx,
+ &mpu_to_host[i],
+ sizeof(struct queue_entry),
+ depth_size[i],
+ MARS_TASK_QUEUE_MPU_TO_HOST);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+
+ /* create push task */
+ for (num = 0; num < depth_size[i]; num++) {
+ ret = mars_task_create(mars_ctx, &task_id[num], NULL,
+ mpu_prog.elf_image,
+ MARS_TASK_CONTEXT_SAVE_ALL);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+
+ task_args.type.u64[0] = mpu_to_host[i];
+ task_args.type.u64[1] = (uint64_t)i;
+ task_args.type.u64[2] = (uint64_t)num;
+ task_args.type.u64[3] = mars_ptr_to_ea(&notify);
+ ret = mars_task_schedule(&task_id[num], &task_args, 0);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+ }
+
+ /* start mpu task at the same time */
+ sleep(1);
+ mars_test_counter_set(&notify[0], 1);
+
+ for (num = 0; num < depth_size[i]; num++) {
+ ret = mars_task_wait(&task_id[num], &exit_code);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+ MARS_TEST_ASSERT_ERROR(exit_code, MARS_SUCCESS);
+ }
+
+ /* check queue data */
+ check_queue(i, depth_size[i]);
+
+ for (num = 0; num < depth_size[i]; num++) {
+ ret = mars_task_destroy(&task_id[num]);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+ }
+
+ ret = mars_task_queue_destroy(mpu_to_host[i]);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+ }
+
+ ret = mars_context_destroy(mars_ctx);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+
+ return 0;
+}
+
diff --git a/tests/TFP/TFP_45_005/mpu.c b/tests/TFP/TFP_45_005/mpu.c
new file mode 100644
index 0000000..733c723
--- /dev/null
+++ b/tests/TFP/TFP_45_005/mpu.c
@@ -0,0 +1,51 @@
+/*
+ * Copyright 2008 Sony Corporation
+ *
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a copy
+ * of this software and associated documentation files (the "Software"), to deal
+ * in the Software without restriction, including without limitation the rights
+ * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+ * copies of the Software, and to permit persons to whom the Software is
+ * furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included in
+ * all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+ * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+ * THE SOFTWARE.
+ */
+
+#include <mars/mars.h>
+#include <mars_task_test.h>
+#include <spu_mfcio.h>
+
+struct queue_entry {
+ uint64_t val1;
+ uint64_t val2;
+};
+static struct queue_entry data;
+
+int mars_task_main(const struct mars_task_args *task_args)
+{
+ int ret;
+ uint64_t mpu_to_host_ea = task_args->type.u64[0];
+ uint64_t id = task_args->type.u64[1];
+ uint64_t num = task_args->type.u64[2];
+ uint64_t notify_ea = task_args->type.u64[3];
+
+ data.val1 = id;
+ data.val2 = num;
+
+ mars_test_counter_wait(notify_ea, 1);
+
+ ret = mars_task_queue_push(mpu_to_host_ea, &data);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+
+ return 0;
+}
diff --git a/tests/TFP/TFP_45_006/Makefile b/tests/TFP/TFP_45_006/Makefile
new file mode 100644
index 0000000..ecbce33
--- /dev/null
+++ b/tests/TFP/TFP_45_006/Makefile
@@ -0,0 +1,28 @@
+#
+# Copyright 2008 Sony Corporation
+#
+#
+# Permission is hereby granted, free of charge, to any person obtaining a copy
+# of this software and associated documentation files (the "Software"), to deal
+# in the Software without restriction, including without limitation the rights
+# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+# copies of the Software, and to permit persons to whom the Software is
+# furnished to do so, subject to the following conditions:
+#
+# The above copyright notice and this permission notice shall be included in
+# all copies or substantial portions of the Software.
+#
+# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+# THE SOFTWARE.
+#
+
+top_srcdir = ../..
+test_objs = host.o mpu1.task_eo mpu2.task_eo
+
+include $(top_srcdir)/scripts/config.mk
+include $(top_srcdir)/scripts/rules_item.mk
diff --git a/tests/TFP/TFP_45_006/host.c b/tests/TFP/TFP_45_006/host.c
new file mode 100644
index 0000000..a56138f
--- /dev/null
+++ b/tests/TFP/TFP_45_006/host.c
@@ -0,0 +1,132 @@
+/*
+ * Copyright 2008 Sony Corporation
+ *
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a copy
+ * of this software and associated documentation files (the "Software"), to deal
+ * in the Software without restriction, including without limitation the rights
+ * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+ * copies of the Software, and to permit persons to whom the Software is
+ * furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included in
+ * all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+ * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+ * THE SOFTWARE.
+ */
+
+#include <unistd.h>
+#include <mars/mars.h>
+#include <libspe2.h>
+#include <mars_test.h>
+
+struct queue_entry {
+ uint64_t val1;
+ uint64_t val2;
+};
+#define Q_DEPTH (256)
+
+#define NUM_LOOP 5
+static uint32_t depth_size[] =
+{
+ 1,
+ Q_DEPTH / 2,
+ Q_DEPTH,
+ Q_DEPTH,
+ Q_DEPTH
+};
+extern spe_program_handle_t mpu1_prog;
+extern spe_program_handle_t mpu2_prog;
+
+static struct mars_context *mars_ctx;
+static struct mars_task_args task1_args, task2_args;
+static struct mars_task_id task1_id[Q_DEPTH], task2_id;
+
+static uint64_t mpu_to_mpu[NUM_LOOP];
+static uint32_t notify[32] __attribute((aligned(128)));
+
+int main(void)
+{
+ int ret, i;
+ int32_t exit_code;
+ uint32_t num;
+
+ ret = mars_context_create(&mars_ctx, 0, 0);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+
+ for (i = 0; i < NUM_LOOP; i++) {
+ notify[0] = 0;
+
+ ret = mars_task_queue_create(
+ mars_ctx,
+ &mpu_to_mpu[i],
+ sizeof(struct queue_entry),
+ depth_size[i],
+ MARS_TASK_QUEUE_MPU_TO_MPU);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+
+ /* create push task */
+ for (num = 0; num < depth_size[i]; num++) {
+ ret = mars_task_create(mars_ctx, &task1_id[num], NULL,
+ mpu1_prog.elf_image,
+ MARS_TASK_CONTEXT_SAVE_ALL);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+
+ task1_args.type.u64[0] = mpu_to_mpu[i];
+ task1_args.type.u64[1] = (uint64_t)i;
+ task1_args.type.u64[2] = (uint64_t)num;
+ task1_args.type.u64[3] = mars_ptr_to_ea(&notify);
+ ret = mars_task_schedule(&task1_id[num],
+ &task1_args, 0);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+ }
+
+ /* create pop task */
+ ret = mars_task_create(mars_ctx, &task2_id, NULL,
+ mpu2_prog.elf_image, MARS_TASK_CONTEXT_SAVE_ALL);
+
+ /* start push task at the same time */
+ sleep(1);
+ mars_test_counter_set(&notify[0], 1);
+
+ for (num = 0; num < depth_size[i]; num++) {
+ ret = mars_task_wait(&task1_id[num], &exit_code);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+ MARS_TEST_ASSERT_ERROR(exit_code, MARS_SUCCESS);
+ }
+
+ /* run pop task */
+ task2_args.type.u64[0] = mpu_to_mpu[i];
+ task2_args.type.u64[1] = (uint64_t)i;
+ task2_args.type.u64[2] = (uint64_t)depth_size[i];
+ ret = mars_task_schedule(&task2_id, &task2_args, 0);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+
+ ret = mars_task_wait(&task2_id, &exit_code);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+ MARS_TEST_ASSERT_ERROR(exit_code, MARS_SUCCESS);
+
+ ret = mars_task_destroy(&task2_id);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+
+ for (num = 0; num < depth_size[i]; num++) {
+ ret = mars_task_destroy(&task1_id[num]);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+ }
+
+ ret = mars_task_queue_destroy(mpu_to_mpu[i]);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+ }
+
+ ret = mars_context_destroy(mars_ctx);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+
+ return 0;
+}
+
diff --git a/tests/TFP/TFP_45_006/mpu1.c b/tests/TFP/TFP_45_006/mpu1.c
new file mode 100644
index 0000000..570e80b
--- /dev/null
+++ b/tests/TFP/TFP_45_006/mpu1.c
@@ -0,0 +1,51 @@
+/*
+ * Copyright 2008 Sony Corporation
+ *
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a copy
+ * of this software and associated documentation files (the "Software"), to deal
+ * in the Software without restriction, including without limitation the rights
+ * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+ * copies of the Software, and to permit persons to whom the Software is
+ * furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included in
+ * all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+ * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+ * THE SOFTWARE.
+ */
+
+#include <mars/mars.h>
+#include <mars_task_test.h>
+#include <spu_mfcio.h>
+
+struct queue_entry {
+ uint64_t val1;
+ uint64_t val2;
+};
+static struct queue_entry data;
+
+int mars_task_main(const struct mars_task_args *task_args)
+{
+ int ret;
+ uint64_t mpu_to_mpu_ea = task_args->type.u64[0];
+ uint64_t id = task_args->type.u64[1];
+ uint64_t num = task_args->type.u64[2];
+ uint64_t notify_ea = task_args->type.u64[3];
+
+ data.val1 = id;
+ data.val2 = num;
+
+ mars_test_counter_wait(notify_ea, 1);
+
+ ret = mars_task_queue_push(mpu_to_mpu_ea, &data);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+
+ return 0;
+}
diff --git a/tests/TFP/TFP_45_006/mpu2.c b/tests/TFP/TFP_45_006/mpu2.c
new file mode 100644
index 0000000..c43688b
--- /dev/null
+++ b/tests/TFP/TFP_45_006/mpu2.c
@@ -0,0 +1,61 @@
+/*
+ * Copyright 2008 Sony Corporation
+ *
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a copy
+ * of this software and associated documentation files (the "Software"), to deal
+ * in the Software without restriction, including without limitation the rights
+ * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+ * copies of the Software, and to permit persons to whom the Software is
+ * furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included in
+ * all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+ * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+ * THE SOFTWARE.
+ */
+
+#include <mars/mars.h>
+#include <mars_task_test.h>
+
+struct queue_entry {
+ uint64_t val1;
+ uint64_t val2;
+};
+static struct queue_entry data;
+
+int mars_task_main(const struct mars_task_args *task_args)
+{
+ int ret, i;
+ uint64_t mpu_to_mpu_ea = task_args->type.u64[0];
+ uint64_t id = task_args->type.u64[1];
+ uint64_t num = task_args->type.u64[2];
+ uint64_t sum, sum_q;
+ uint32_t count;
+
+ sum = sum_q = 0;
+ for (i = 0; i < num; i++) {
+ ret = mars_task_queue_pop(mpu_to_mpu_ea, &data);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+
+ MARS_TEST_ASSERT_EQUAL(data.val1, id);
+ sum += i;
+ sum_q += data.val2;
+ }
+
+ /* check queue data */
+ MARS_TEST_ASSERT_EQUAL(sum, sum_q);
+
+ /* queue should be empty */
+ ret = mars_task_queue_count(mpu_to_mpu_ea, &count);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+ MARS_TEST_ASSERT_EQUAL(count, 0);
+
+ return 0;
+}
diff --git a/tests/TFP/TFP_45_007/Makefile b/tests/TFP/TFP_45_007/Makefile
new file mode 100644
index 0000000..432135a
--- /dev/null
+++ b/tests/TFP/TFP_45_007/Makefile
@@ -0,0 +1,28 @@
+#
+# Copyright 2008 Sony Corporation
+#
+#
+# Permission is hereby granted, free of charge, to any person obtaining a copy
+# of this software and associated documentation files (the "Software"), to deal
+# in the Software without restriction, including without limitation the rights
+# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+# copies of the Software, and to permit persons to whom the Software is
+# furnished to do so, subject to the following conditions:
+#
+# The above copyright notice and this permission notice shall be included in
+# all copies or substantial portions of the Software.
+#
+# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+# THE SOFTWARE.
+#
+
+top_srcdir = ../..
+test_objs = host.o mpu.task_eo
+
+include $(top_srcdir)/scripts/config.mk
+include $(top_srcdir)/scripts/rules_item.mk
diff --git a/tests/TFP/TFP_45_007/host.c b/tests/TFP/TFP_45_007/host.c
new file mode 100644
index 0000000..0c2990c
--- /dev/null
+++ b/tests/TFP/TFP_45_007/host.c
@@ -0,0 +1,141 @@
+/*
+ * Copyright 2008 Sony Corporation
+ *
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a copy
+ * of this software and associated documentation files (the "Software"), to deal
+ * in the Software without restriction, including without limitation the rights
+ * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+ * copies of the Software, and to permit persons to whom the Software is
+ * furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included in
+ * all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+ * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+ * THE SOFTWARE.
+ */
+
+#include <pthread.h>
+#include <unistd.h>
+#include <mars/mars.h>
+#include <libspe2.h>
+#include <mars_test.h>
+
+struct queue_entry {
+ uint64_t val1;
+ uint64_t val2;
+};
+#define Q_DEPTH (MARS_TASK_QUEUE_WAIT_MAX)
+
+#define NUM_LOOP 5
+static uint32_t depth_size[] =
+{
+ 1,
+ Q_DEPTH / 2,
+ Q_DEPTH,
+ Q_DEPTH,
+ Q_DEPTH
+};
+extern spe_program_handle_t mpu_prog;
+
+static struct mars_context *mars_ctx;
+static struct mars_task_args task_args[Q_DEPTH], thread_args[Q_DEPTH];
+static struct mars_task_id task_id[Q_DEPTH];
+
+static uint64_t host_to_mpu[NUM_LOOP];
+static uint32_t shared_resource __attribute((aligned(16)));
+static struct queue_entry data[Q_DEPTH];
+
+static pthread_t thread[Q_DEPTH];
+static void *thread_proc(void *ptr)
+{
+ int ret;
+ struct mars_task_args *task_args = (struct mars_task_args *)ptr;
+ uint32_t id = (uint32_t)task_args->type.u32[0];
+ uint32_t count = (uint32_t)task_args->type.u32[1];
+
+ /* wait for start */
+ while (!shared_resource)
+ usleep(100);
+
+ data[count].val1 = id;
+ ret = mars_task_queue_push(host_to_mpu[id], &data[count]);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+
+ return NULL;
+}
+
+int main(void)
+{
+ int ret, i;
+ int32_t exit_code;
+ uint32_t num, count;
+
+ ret = mars_context_create(&mars_ctx, 0, 0);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+
+ for (i = 0; i < NUM_LOOP; i++) {
+ shared_resource = 0;
+
+ ret = mars_task_queue_create(
+ mars_ctx,
+ &host_to_mpu[i],
+ sizeof(struct queue_entry),
+ depth_size[i],
+ MARS_TASK_QUEUE_HOST_TO_MPU);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+
+ for (num = 0; num < depth_size[i]; num++) {
+ /* create push thread */
+ thread_args[num].type.u32[0] = (uint32_t)i;
+ thread_args[num].type.u32[1] = (uint32_t)num;
+ pthread_create(&thread[num], NULL,
+ thread_proc, &thread_args[num]);
+
+ /* create peek tasks */
+ /* all tasks will peek the same data */
+ ret = mars_task_create(mars_ctx, &task_id[num], NULL,
+ mpu_prog.elf_image, MARS_TASK_CONTEXT_SAVE_ALL);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+
+ task_args[num].type.u64[0] = host_to_mpu[i];
+ task_args[num].type.u64[1] = (uint64_t)i;
+ ret = mars_task_schedule(&task_id[num],
+ &task_args[num], 0);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+ }
+
+ /* start ppe threads the same time */
+ sleep(1);
+ shared_resource = 1;
+
+ for (num = 0; num < depth_size[i]; num++) {
+ ret = mars_task_wait(&task_id[num], &exit_code);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+ MARS_TEST_ASSERT_ERROR(exit_code, MARS_SUCCESS);
+
+ ret = mars_task_destroy(&task_id[num]);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+
+ pthread_join(thread[num], NULL);
+ }
+ ret = mars_task_queue_count(host_to_mpu[i], &count);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+ MARS_TEST_ASSERT_EQUAL(count, depth_size[i]);
+
+ ret = mars_task_queue_destroy(host_to_mpu[i]);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+ }
+
+ ret = mars_context_destroy(mars_ctx);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+
+ return 0;
+}
+
diff --git a/tests/TFP/TFP_45_007/mpu.c b/tests/TFP/TFP_45_007/mpu.c
new file mode 100644
index 0000000..88b8d1f
--- /dev/null
+++ b/tests/TFP/TFP_45_007/mpu.c
@@ -0,0 +1,47 @@
+/*
+ * Copyright 2008 Sony Corporation
+ *
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a copy
+ * of this software and associated documentation files (the "Software"), to deal
+ * in the Software without restriction, including without limitation the rights
+ * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+ * copies of the Software, and to permit persons to whom the Software is
+ * furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included in
+ * all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+ * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+ * THE SOFTWARE.
+ */
+
+#include <mars/mars.h>
+#include <mars_task_test.h>
+#include <spu_mfcio.h>
+
+struct queue_entry {
+ uint64_t val1;
+ uint64_t val2;
+};
+static struct queue_entry data;
+
+int mars_task_main(const struct mars_task_args *task_args)
+{
+ int ret;
+ uint64_t host_to_mpu_ea = task_args->type.u64[0];
+ uint32_t id = (uint32_t)task_args->type.u64[1];
+
+ ret = mars_task_queue_peek(host_to_mpu_ea, &data);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+
+ /* check the peeked data */
+ MARS_TEST_ASSERT_EQUAL(data.val1, id);
+
+ return 0;
+}
diff --git a/tests/TFP/TFP_45_008/Makefile b/tests/TFP/TFP_45_008/Makefile
new file mode 100644
index 0000000..432135a
--- /dev/null
+++ b/tests/TFP/TFP_45_008/Makefile
@@ -0,0 +1,28 @@
+#
+# Copyright 2008 Sony Corporation
+#
+#
+# Permission is hereby granted, free of charge, to any person obtaining a copy
+# of this software and associated documentation files (the "Software"), to deal
+# in the Software without restriction, including without limitation the rights
+# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+# copies of the Software, and to permit persons to whom the Software is
+# furnished to do so, subject to the following conditions:
+#
+# The above copyright notice and this permission notice shall be included in
+# all copies or substantial portions of the Software.
+#
+# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+# THE SOFTWARE.
+#
+
+top_srcdir = ../..
+test_objs = host.o mpu.task_eo
+
+include $(top_srcdir)/scripts/config.mk
+include $(top_srcdir)/scripts/rules_item.mk
diff --git a/tests/TFP/TFP_45_008/host.c b/tests/TFP/TFP_45_008/host.c
new file mode 100644
index 0000000..4e9a1c0
--- /dev/null
+++ b/tests/TFP/TFP_45_008/host.c
@@ -0,0 +1,140 @@
+/*
+ * Copyright 2008 Sony Corporation
+ *
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a copy
+ * of this software and associated documentation files (the "Software"), to deal
+ * in the Software without restriction, including without limitation the rights
+ * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+ * copies of the Software, and to permit persons to whom the Software is
+ * furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included in
+ * all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+ * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+ * THE SOFTWARE.
+ */
+
+#include <pthread.h>
+#include <unistd.h>
+#include <mars/mars.h>
+#include <libspe2.h>
+#include <mars_test.h>
+
+struct queue_entry {
+ uint64_t val1;
+ uint64_t val2;
+};
+#define Q_DEPTH (MARS_TASK_QUEUE_WAIT_MAX)
+
+#define NUM_LOOP 5
+static uint32_t depth_size[] =
+{
+ 1,
+ Q_DEPTH / 2,
+ Q_DEPTH,
+ Q_DEPTH,
+ Q_DEPTH
+};
+extern spe_program_handle_t mpu_prog;
+
+static struct mars_context *mars_ctx;
+static struct mars_task_args task_args, thread_args[Q_DEPTH];
+static struct mars_task_id task_id[Q_DEPTH];
+
+static uint64_t mpu_to_host[NUM_LOOP];
+static uint32_t notify[32] __attribute((aligned(128)));
+static struct queue_entry data[Q_DEPTH];
+
+static pthread_t thread[Q_DEPTH];
+static void *thread_proc(void *ptr)
+{
+ int ret;
+ struct mars_task_args *task_args = (struct mars_task_args *)ptr;
+ uint32_t id = (uint32_t)task_args->type.u32[0];
+ uint32_t num = (uint32_t)task_args->type.u32[1];
+
+ ret = mars_task_queue_peek(mpu_to_host[id], &data[num]);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+
+ /* check the peeked data */
+ MARS_TEST_ASSERT_EQUAL(data[num].val1, id);
+
+ return NULL;
+}
+
+int main(void)
+{
+ int ret, i;
+ int32_t exit_code;
+ uint32_t num, count;
+
+ ret = mars_context_create(&mars_ctx, 0, 0);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+
+ for (i = 0; i < NUM_LOOP; i++) {
+ notify[0] = 0;
+
+ ret = mars_task_queue_create(
+ mars_ctx,
+ &mpu_to_host[i],
+ sizeof(struct queue_entry),
+ depth_size[i],
+ MARS_TASK_QUEUE_MPU_TO_HOST);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+
+
+ for (num = 0; num < depth_size[i]; num++) {
+ /* create push task */
+ ret = mars_task_create(mars_ctx, &task_id[num], NULL,
+ mpu_prog.elf_image,
+ MARS_TASK_CONTEXT_SAVE_ALL);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+
+ task_args.type.u64[0] = mpu_to_host[i];
+ task_args.type.u64[1] = mars_ptr_to_ea(&notify);
+ task_args.type.u64[2] = (uint64_t)i;
+ ret = mars_task_schedule(&task_id[num], &task_args, 0);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+
+ /* create peek thread */
+ /* all threads will peek the same queue */
+ thread_args[num].type.u32[0] = (uint32_t)i;
+ pthread_create(&thread[num], NULL,
+ thread_proc, &thread_args[num]);
+ }
+
+ /* start tasks at the same time */
+ sleep(1);
+ mars_test_counter_set(&notify[0], 1);
+
+ for (num = 0; num < depth_size[i]; num++) {
+ ret = mars_task_wait(&task_id[num], &exit_code);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+ MARS_TEST_ASSERT_ERROR(exit_code, MARS_SUCCESS);
+
+ ret = mars_task_destroy(&task_id[num]);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+
+ pthread_join(thread[num], NULL);
+ }
+ ret = mars_task_queue_count(mpu_to_host[i], &count);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+ MARS_TEST_ASSERT_EQUAL(count, depth_size[i]);
+
+ ret = mars_task_queue_destroy(mpu_to_host[i]);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+ }
+
+ ret = mars_context_destroy(mars_ctx);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+
+ return 0;
+}
+
diff --git a/tests/TFP/TFP_45_008/mpu.c b/tests/TFP/TFP_45_008/mpu.c
new file mode 100644
index 0000000..b98d7ac
--- /dev/null
+++ b/tests/TFP/TFP_45_008/mpu.c
@@ -0,0 +1,48 @@
+/*
+ * Copyright 2008 Sony Corporation
+ *
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a copy
+ * of this software and associated documentation files (the "Software"), to deal
+ * in the Software without restriction, including without limitation the rights
+ * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+ * copies of the Software, and to permit persons to whom the Software is
+ * furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included in
+ * all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+ * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+ * THE SOFTWARE.
+ */
+
+#include <mars/mars.h>
+#include <mars_task_test.h>
+#include <spu_mfcio.h>
+
+struct queue_entry {
+ uint64_t val1;
+ uint64_t val2;
+};
+static struct queue_entry data;
+
+int mars_task_main(const struct mars_task_args *task_args)
+{
+ int ret;
+ uint64_t mpu_to_host_ea = task_args->type.u64[0];
+ uint64_t notify_ea = task_args->type.u64[1];
+ uint32_t id = (uint32_t)task_args->type.u64[2];
+
+ mars_test_counter_wait(notify_ea, 1);
+
+ data.val1 = id;
+ ret = mars_task_queue_push(mpu_to_host_ea, &data);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+
+ return 0;
+}
diff --git a/tests/TFP/TFP_45_009/Makefile b/tests/TFP/TFP_45_009/Makefile
new file mode 100644
index 0000000..432135a
--- /dev/null
+++ b/tests/TFP/TFP_45_009/Makefile
@@ -0,0 +1,28 @@
+#
+# Copyright 2008 Sony Corporation
+#
+#
+# Permission is hereby granted, free of charge, to any person obtaining a copy
+# of this software and associated documentation files (the "Software"), to deal
+# in the Software without restriction, including without limitation the rights
+# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+# copies of the Software, and to permit persons to whom the Software is
+# furnished to do so, subject to the following conditions:
+#
+# The above copyright notice and this permission notice shall be included in
+# all copies or substantial portions of the Software.
+#
+# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+# THE SOFTWARE.
+#
+
+top_srcdir = ../..
+test_objs = host.o mpu.task_eo
+
+include $(top_srcdir)/scripts/config.mk
+include $(top_srcdir)/scripts/rules_item.mk
diff --git a/tests/TFP/TFP_45_009/host.c b/tests/TFP/TFP_45_009/host.c
new file mode 100644
index 0000000..0d5cdbb
--- /dev/null
+++ b/tests/TFP/TFP_45_009/host.c
@@ -0,0 +1,86 @@
+/*
+ * Copyright 2008 Sony Corporation
+ *
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a copy
+ * of this software and associated documentation files (the "Software"), to deal
+ * in the Software without restriction, including without limitation the rights
+ * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+ * copies of the Software, and to permit persons to whom the Software is
+ * furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included in
+ * all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+ * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+ * THE SOFTWARE.
+ */
+
+#include <libspe2.h>
+#include <mars/mars.h>
+#include <mars_test.h>
+#include "host_and_mpu.h"
+
+extern spe_program_handle_t mpu_prog;
+
+static struct mars_context *mars;
+static struct mars_task_id task_ids[TASK_COUNT];
+static struct mars_task_args task_args;
+static uint64_t queue;
+
+int main(void)
+{
+ int i, exit_code, ret;
+
+ ret = mars_context_create(&mars, 0, 0);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+
+ for (i = 0; i < TASK_COUNT; i++) {
+ ret = mars_task_create(
+ mars,
+ &task_ids[i],
+ "45009",
+ mpu_prog.elf_image,
+ MARS_TASK_CONTEXT_SAVE_ALL);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+ }
+
+ ret = mars_task_queue_create(
+ mars,
+ &queue,
+ 16,
+ QUEUE_DEPTH,
+ MARS_TASK_QUEUE_MPU_TO_MPU);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+
+ task_args.type.u64[0] = queue;
+
+ for (i = 0; i < TASK_COUNT; i++) {
+ ret = mars_task_schedule(&task_ids[i], &task_args, 0);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+ }
+
+ for (i = 0; i < TASK_COUNT; i++) {
+ ret = mars_task_wait(&task_ids[i], &exit_code);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+ MARS_TEST_ASSERT_EQUAL(exit_code, 0);
+ }
+
+ ret = mars_task_queue_destroy(queue);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+
+ for (i = 0; i < TASK_COUNT; i++) {
+ ret = mars_task_destroy(&task_ids[i]);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+ }
+
+ ret = mars_context_destroy(mars);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+
+ return 0;
+}
diff --git a/tests/TFP/TFP_45_009/host_and_mpu.h b/tests/TFP/TFP_45_009/host_and_mpu.h
new file mode 100644
index 0000000..7cb3f27
--- /dev/null
+++ b/tests/TFP/TFP_45_009/host_and_mpu.h
@@ -0,0 +1,25 @@
+/*
+ * Copyright 2008 Sony Corporation
+ *
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a copy
+ * of this software and associated documentation files (the "Software"), to deal
+ * in the Software without restriction, including without limitation the rights
+ * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+ * copies of the Software, and to permit persons to whom the Software is
+ * furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included in
+ * all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+ * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+ * THE SOFTWARE.
+ */
+
+#define QUEUE_DEPTH 65536
+#define TASK_COUNT 16
diff --git a/tests/TFP/TFP_45_009/mpu.c b/tests/TFP/TFP_45_009/mpu.c
new file mode 100644
index 0000000..16444f7
--- /dev/null
+++ b/tests/TFP/TFP_45_009/mpu.c
@@ -0,0 +1,49 @@
+/*
+ * Copyright 2008 Sony Corporation
+ *
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a copy
+ * of this software and associated documentation files (the "Software"), to deal
+ * in the Software without restriction, including without limitation the rights
+ * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+ * copies of the Software, and to permit persons to whom the Software is
+ * furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included in
+ * all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+ * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+ * THE SOFTWARE.
+ */
+
+#include <string.h>
+#include <mars/mars.h>
+#include "mars_task_test.h"
+#include "host_and_mpu.h"
+
+#define LOOP_COUNT (QUEUE_DEPTH)/(TASK_COUNT)
+
+static uint64_t queue_item[2] __attribute__((aligned(16)));
+
+int mars_task_main(const struct mars_task_args *task_args)
+{
+ uint64_t queue_ea = task_args->type.u64[0];
+ int i, ret;
+
+ for (i = 0; i < LOOP_COUNT; i++) {
+ ret = mars_task_queue_push(queue_ea, queue_item);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+
+ ret = mars_task_queue_peek(queue_ea, queue_item);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+ }
+
+ mars_task_exit(0);
+
+ return 0;
+}
diff --git a/tests/TFP/TFP_45_010/Makefile b/tests/TFP/TFP_45_010/Makefile
new file mode 100644
index 0000000..432135a
--- /dev/null
+++ b/tests/TFP/TFP_45_010/Makefile
@@ -0,0 +1,28 @@
+#
+# Copyright 2008 Sony Corporation
+#
+#
+# Permission is hereby granted, free of charge, to any person obtaining a copy
+# of this software and associated documentation files (the "Software"), to deal
+# in the Software without restriction, including without limitation the rights
+# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+# copies of the Software, and to permit persons to whom the Software is
+# furnished to do so, subject to the following conditions:
+#
+# The above copyright notice and this permission notice shall be included in
+# all copies or substantial portions of the Software.
+#
+# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+# THE SOFTWARE.
+#
+
+top_srcdir = ../..
+test_objs = host.o mpu.task_eo
+
+include $(top_srcdir)/scripts/config.mk
+include $(top_srcdir)/scripts/rules_item.mk
diff --git a/tests/TFP/TFP_45_010/host.c b/tests/TFP/TFP_45_010/host.c
new file mode 100644
index 0000000..67337c1
--- /dev/null
+++ b/tests/TFP/TFP_45_010/host.c
@@ -0,0 +1,127 @@
+/*
+ * Copyright 2008 Sony Corporation
+ *
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a copy
+ * of this software and associated documentation files (the "Software"), to deal
+ * in the Software without restriction, including without limitation the rights
+ * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+ * copies of the Software, and to permit persons to whom the Software is
+ * furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included in
+ * all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+ * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+ * THE SOFTWARE.
+ */
+
+#include <pthread.h>
+#include <unistd.h>
+#include <mars/mars.h>
+#include <libspe2.h>
+#include <mars_test.h>
+
+struct queue_entry {
+ uint64_t val;
+ uint64_t pad;
+};
+#define Q_DEPTH (256 * 1024)
+
+#define NUM_LOOP 2
+static uint32_t depth_size[] =
+{
+ 1,
+ Q_DEPTH
+};
+extern spe_program_handle_t mpu_prog;
+
+static struct mars_context *mars_ctx;
+static struct mars_task_args task_args, thread_args;
+static struct mars_task_id task_id;
+
+static uint64_t host_to_mpu[NUM_LOOP];
+static struct queue_entry data;
+static uint32_t shared_resource __attribute((aligned(16)));
+
+static pthread_t thread;
+static void *thread_proc(void *ptr)
+{
+ int ret, i;
+ struct mars_task_args *task_args = (struct mars_task_args *)ptr;
+ uint32_t id = task_args->type.u32[0];
+ uint32_t num = task_args->type.u32[1];
+
+ /* the last one push should be blocked */
+ for (i = 0; i < num + 1; i++) {
+ ret = mars_task_queue_push(host_to_mpu[id], &data);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+ }
+
+ shared_resource = 1;
+ return NULL;
+}
+
+int main(void)
+{
+ int ret, i;
+ int32_t exit_code;
+
+ ret = mars_context_create(&mars_ctx, 0, 0);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+
+ for (i = 0; i < NUM_LOOP; i++) {
+ shared_resource = 0;
+
+ ret = mars_task_queue_create(
+ mars_ctx,
+ &host_to_mpu[i],
+ sizeof(struct queue_entry),
+ depth_size[i],
+ MARS_TASK_QUEUE_HOST_TO_MPU);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+
+ /* create push thread */
+ thread_args.type.u32[0] = (uint32_t)i;
+ thread_args.type.u32[1] = (uint32_t)depth_size[i];
+ pthread_create(&thread, NULL,
+ thread_proc, &thread_args);
+
+ /* check if queue_push is blocked */
+ sleep(1);
+ MARS_TEST_ASSERT_EQUAL(shared_resource, 0);
+
+ /* create pop task */
+ ret = mars_task_create(mars_ctx, &task_id, NULL,
+ mpu_prog.elf_image, MARS_TASK_CONTEXT_SAVE_ALL);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+
+ task_args.type.u64[0] = host_to_mpu[i];
+ ret = mars_task_schedule(&task_id, &task_args, 0);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+
+ ret = mars_task_wait(&task_id, &exit_code);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+ MARS_TEST_ASSERT_ERROR(exit_code, MARS_SUCCESS);
+
+ /* check if thread is finished for queue_push */
+ pthread_join(thread, NULL);
+
+ ret = mars_task_destroy(&task_id);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+
+ ret = mars_task_queue_destroy(host_to_mpu[i]);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+ }
+
+ ret = mars_context_destroy(mars_ctx);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+
+ return 0;
+}
+
diff --git a/tests/TFP/TFP_45_010/mpu.c b/tests/TFP/TFP_45_010/mpu.c
new file mode 100644
index 0000000..d9a7248
--- /dev/null
+++ b/tests/TFP/TFP_45_010/mpu.c
@@ -0,0 +1,42 @@
+/*
+ * Copyright 2008 Sony Corporation
+ *
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a copy
+ * of this software and associated documentation files (the "Software"), to deal
+ * in the Software without restriction, including without limitation the rights
+ * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+ * copies of the Software, and to permit persons to whom the Software is
+ * furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included in
+ * all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+ * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+ * THE SOFTWARE.
+ */
+
+#include <mars/mars.h>
+#include <mars_task_test.h>
+
+struct queue_entry {
+ uint64_t val;
+ uint64_t pad;
+};
+static struct queue_entry data;
+
+int mars_task_main(const struct mars_task_args *task_args)
+{
+ int ret;
+ uint64_t host_to_mpu_ea = task_args->type.u64[0];
+
+ ret = mars_task_queue_pop(host_to_mpu_ea, &data);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+
+ return 0;
+}
diff --git a/tests/TFP/TFP_45_011/Makefile b/tests/TFP/TFP_45_011/Makefile
new file mode 100644
index 0000000..432135a
--- /dev/null
+++ b/tests/TFP/TFP_45_011/Makefile
@@ -0,0 +1,28 @@
+#
+# Copyright 2008 Sony Corporation
+#
+#
+# Permission is hereby granted, free of charge, to any person obtaining a copy
+# of this software and associated documentation files (the "Software"), to deal
+# in the Software without restriction, including without limitation the rights
+# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+# copies of the Software, and to permit persons to whom the Software is
+# furnished to do so, subject to the following conditions:
+#
+# The above copyright notice and this permission notice shall be included in
+# all copies or substantial portions of the Software.
+#
+# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+# THE SOFTWARE.
+#
+
+top_srcdir = ../..
+test_objs = host.o mpu.task_eo
+
+include $(top_srcdir)/scripts/config.mk
+include $(top_srcdir)/scripts/rules_item.mk
diff --git a/tests/TFP/TFP_45_011/host.c b/tests/TFP/TFP_45_011/host.c
new file mode 100644
index 0000000..402e401
--- /dev/null
+++ b/tests/TFP/TFP_45_011/host.c
@@ -0,0 +1,107 @@
+/*
+ * Copyright 2008 Sony Corporation
+ *
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a copy
+ * of this software and associated documentation files (the "Software"), to deal
+ * in the Software without restriction, including without limitation the rights
+ * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+ * copies of the Software, and to permit persons to whom the Software is
+ * furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included in
+ * all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+ * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+ * THE SOFTWARE.
+ */
+
+#include <unistd.h>
+#include <mars/mars.h>
+#include <libspe2.h>
+#include <mars_test.h>
+
+struct queue_entry {
+ uint64_t val;
+ uint64_t pad;
+};
+#define Q_DEPTH (256 * 1024)
+
+#define NUM_LOOP 2
+static uint32_t depth_size[] =
+{
+ 1,
+ Q_DEPTH
+};
+extern spe_program_handle_t mpu_prog;
+
+static struct mars_context *mars_ctx;
+static struct mars_task_args task_args;
+static struct mars_task_id task_id;
+
+static uint64_t mpu_to_host[NUM_LOOP];
+static struct queue_entry data;
+
+static uint32_t shared_resource __attribute((aligned(16)));
+
+int main(void)
+{
+ int ret, i;
+ int32_t exit_code;
+
+ ret = mars_context_create(&mars_ctx, 0, 0);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+
+ for (i = 0; i < NUM_LOOP; i++) {
+ shared_resource = 0;
+
+ ret = mars_task_queue_create(
+ mars_ctx,
+ &mpu_to_host[i],
+ sizeof(struct queue_entry),
+ depth_size[i],
+ MARS_TASK_QUEUE_MPU_TO_HOST);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+
+ /* create push task */
+ ret = mars_task_create(mars_ctx, &task_id, NULL,
+ mpu_prog.elf_image, MARS_TASK_CONTEXT_SAVE_ALL);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+
+ task_args.type.u64[0] = mpu_to_host[i];
+ task_args.type.u64[1] = (uint64_t)depth_size[i];
+ task_args.type.u64[2] = mars_ptr_to_ea(&shared_resource);
+ ret = mars_task_schedule(&task_id, &task_args, 0);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+
+ /* check if queue push is blocked in mpu task */
+ sleep(1);
+ MARS_TEST_ASSERT_EQUAL(shared_resource, 0);
+
+ /* pop one */
+ ret = mars_task_queue_pop(mpu_to_host[i], &data);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+
+ /* check if mpu task is successfly finished */
+ ret = mars_task_wait(&task_id, &exit_code);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+ MARS_TEST_ASSERT_ERROR(exit_code, MARS_SUCCESS);
+
+ ret = mars_task_destroy(&task_id);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+
+ ret = mars_task_queue_destroy(mpu_to_host[i]);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+ }
+
+ ret = mars_context_destroy(mars_ctx);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+
+ return 0;
+}
+
diff --git a/tests/TFP/TFP_45_011/mpu.c b/tests/TFP/TFP_45_011/mpu.c
new file mode 100644
index 0000000..3b55c63
--- /dev/null
+++ b/tests/TFP/TFP_45_011/mpu.c
@@ -0,0 +1,56 @@
+/*
+ * Copyright 2008 Sony Corporation
+ *
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a copy
+ * of this software and associated documentation files (the "Software"), to deal
+ * in the Software without restriction, including without limitation the rights
+ * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+ * copies of the Software, and to permit persons to whom the Software is
+ * furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included in
+ * all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+ * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+ * THE SOFTWARE.
+ */
+
+#include <mars/mars.h>
+#include <mars_task_test.h>
+#include <spu_mfcio.h>
+
+struct queue_entry {
+ uint64_t val;
+ uint64_t pad;
+};
+static struct queue_entry data;
+static uint32_t shared_resource __attribute((aligned(16)));
+
+int mars_task_main(const struct mars_task_args *task_args)
+{
+ int ret, i;
+ uint64_t mpu_to_host_ea = task_args->type.u64[0];
+ uint32_t num_push = (uint32_t)task_args->type.u64[1];
+ uint64_t shared_resource_ea = task_args->type.u64[2];
+
+ /* last one push should be blocked */
+ for (i = 0; i < num_push + 1; i++) {
+ ret = mars_task_queue_push(mpu_to_host_ea, &data);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+ }
+
+ /* if the program reaches here, shared_resource'll be updated */
+ shared_resource = 1;
+ mfc_put(&shared_resource, shared_resource_ea,
+ sizeof(uint32_t), 0, 0, 0);
+ mfc_write_tag_mask(1 << 0);
+ mfc_read_tag_status_all();
+
+ return 0;
+}
diff --git a/tests/TFP/TFP_45_012/Makefile b/tests/TFP/TFP_45_012/Makefile
new file mode 100644
index 0000000..ecbce33
--- /dev/null
+++ b/tests/TFP/TFP_45_012/Makefile
@@ -0,0 +1,28 @@
+#
+# Copyright 2008 Sony Corporation
+#
+#
+# Permission is hereby granted, free of charge, to any person obtaining a copy
+# of this software and associated documentation files (the "Software"), to deal
+# in the Software without restriction, including without limitation the rights
+# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+# copies of the Software, and to permit persons to whom the Software is
+# furnished to do so, subject to the following conditions:
+#
+# The above copyright notice and this permission notice shall be included in
+# all copies or substantial portions of the Software.
+#
+# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+# THE SOFTWARE.
+#
+
+top_srcdir = ../..
+test_objs = host.o mpu1.task_eo mpu2.task_eo
+
+include $(top_srcdir)/scripts/config.mk
+include $(top_srcdir)/scripts/rules_item.mk
diff --git a/tests/TFP/TFP_45_012/host.c b/tests/TFP/TFP_45_012/host.c
new file mode 100644
index 0000000..4a350ec
--- /dev/null
+++ b/tests/TFP/TFP_45_012/host.c
@@ -0,0 +1,118 @@
+/*
+ * Copyright 2008 Sony Corporation
+ *
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a copy
+ * of this software and associated documentation files (the "Software"), to deal
+ * in the Software without restriction, including without limitation the rights
+ * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+ * copies of the Software, and to permit persons to whom the Software is
+ * furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included in
+ * all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+ * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+ * THE SOFTWARE.
+ */
+
+#include <unistd.h>
+#include <mars/mars.h>
+#include <libspe2.h>
+#include <mars_test.h>
+
+struct queue_entry {
+ uint64_t val;
+ uint64_t pad;
+};
+#define Q_DEPTH (256 * 1024)
+
+#define NUM_LOOP 2
+static uint32_t depth_size[] =
+{
+ 1,
+ Q_DEPTH
+};
+extern spe_program_handle_t mpu1_prog;
+extern spe_program_handle_t mpu2_prog;
+
+static struct mars_context *mars_ctx;
+static struct mars_task_args task1_args, task2_args;
+static struct mars_task_id task1_id, task2_id;
+
+static uint64_t mpu_to_mpu[NUM_LOOP];
+static uint32_t shared_resource __attribute((aligned(16)));
+
+int main(void)
+{
+ int ret, i;
+ int32_t exit_code;
+
+ ret = mars_context_create(&mars_ctx, 0, 0);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+
+ for (i = 0; i < NUM_LOOP; i++) {
+ shared_resource = 0;
+
+ ret = mars_task_queue_create(
+ mars_ctx,
+ &mpu_to_mpu[i],
+ sizeof(struct queue_entry),
+ depth_size[i],
+ MARS_TASK_QUEUE_MPU_TO_MPU);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+
+ /* create push task */
+ ret = mars_task_create(mars_ctx, &task1_id, NULL,
+ mpu1_prog.elf_image, MARS_TASK_CONTEXT_SAVE_ALL);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+
+ task1_args.type.u64[0] = mpu_to_mpu[i];
+ task1_args.type.u64[1] = (uint64_t)depth_size[i];
+ task1_args.type.u64[2] = mars_ptr_to_ea(&shared_resource);
+ ret = mars_task_schedule(&task1_id, &task1_args, 0);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+
+ /* check if queue_push is blocked */
+ sleep(1);
+ MARS_TEST_ASSERT_EQUAL(shared_resource, 0);
+
+ /* create and run pop task */
+ ret = mars_task_create(mars_ctx, &task2_id, NULL,
+ mpu2_prog.elf_image, MARS_TASK_CONTEXT_SAVE_ALL);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+
+ task2_args.type.u64[0] = mpu_to_mpu[i];
+ ret = mars_task_schedule(&task2_id, &task2_args, 0);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+
+ ret = mars_task_wait(&task2_id, &exit_code);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+ MARS_TEST_ASSERT_ERROR(exit_code, MARS_SUCCESS);
+
+ /* check if push task is successfly finished */
+ ret = mars_task_wait(&task1_id, &exit_code);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+ MARS_TEST_ASSERT_ERROR(exit_code, MARS_SUCCESS);
+
+ ret = mars_task_destroy(&task1_id);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+
+ ret = mars_task_destroy(&task2_id);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+
+ ret = mars_task_queue_destroy(mpu_to_mpu[i]);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+ }
+
+ ret = mars_context_destroy(mars_ctx);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+
+ return 0;
+}
+
diff --git a/tests/TFP/TFP_45_012/mpu1.c b/tests/TFP/TFP_45_012/mpu1.c
new file mode 100644
index 0000000..9f2dd0e
--- /dev/null
+++ b/tests/TFP/TFP_45_012/mpu1.c
@@ -0,0 +1,56 @@
+/*
+ * Copyright 2008 Sony Corporation
+ *
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a copy
+ * of this software and associated documentation files (the "Software"), to deal
+ * in the Software without restriction, including without limitation the rights
+ * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+ * copies of the Software, and to permit persons to whom the Software is
+ * furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included in
+ * all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+ * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+ * THE SOFTWARE.
+ */
+
+#include <mars/mars.h>
+#include <mars_task_test.h>
+#include <spu_mfcio.h>
+
+struct queue_entry {
+ uint64_t val;
+ uint64_t pad;
+};
+static struct queue_entry data;
+static uint32_t shared_resource __attribute((aligned(16)));
+
+int mars_task_main(const struct mars_task_args *task_args)
+{
+ int ret, i;
+ uint64_t mpu_to_mpu_ea = task_args->type.u64[0];
+ uint32_t num_push = (uint32_t)task_args->type.u64[1];
+ uint64_t shared_resource_ea = task_args->type.u64[2];
+
+ /* last one push should be blocked */
+ for (i = 0; i < num_push + 1; i++) {
+ ret = mars_task_queue_push(mpu_to_mpu_ea, &data);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+ }
+
+ /* if the program reaches here, shared_resource'll be updated */
+ shared_resource = 1;
+ mfc_put(&shared_resource, shared_resource_ea,
+ sizeof(uint32_t), 0, 0, 0);
+ mfc_write_tag_mask(1 << 0);
+ mfc_read_tag_status_all();
+
+ return 0;
+}
diff --git a/tests/TFP/TFP_45_012/mpu2.c b/tests/TFP/TFP_45_012/mpu2.c
new file mode 100644
index 0000000..fe8da44
--- /dev/null
+++ b/tests/TFP/TFP_45_012/mpu2.c
@@ -0,0 +1,42 @@
+/*
+ * Copyright 2008 Sony Corporation
+ *
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a copy
+ * of this software and associated documentation files (the "Software"), to deal
+ * in the Software without restriction, including without limitation the rights
+ * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+ * copies of the Software, and to permit persons to whom the Software is
+ * furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included in
+ * all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+ * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+ * THE SOFTWARE.
+ */
+
+#include <mars/mars.h>
+#include <mars_task_test.h>
+
+struct queue_entry {
+ uint64_t val;
+ uint64_t pad;
+};
+static struct queue_entry data;
+
+int mars_task_main(const struct mars_task_args *task_args)
+{
+ int ret;
+ uint64_t mpu_to_mpu_ea = task_args->type.u64[0];
+
+ ret = mars_task_queue_pop(mpu_to_mpu_ea, &data);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+
+ return 0;
+}
diff --git a/tests/TFP/TFP_45_013/Makefile b/tests/TFP/TFP_45_013/Makefile
new file mode 100644
index 0000000..432135a
--- /dev/null
+++ b/tests/TFP/TFP_45_013/Makefile
@@ -0,0 +1,28 @@
+#
+# Copyright 2008 Sony Corporation
+#
+#
+# Permission is hereby granted, free of charge, to any person obtaining a copy
+# of this software and associated documentation files (the "Software"), to deal
+# in the Software without restriction, including without limitation the rights
+# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+# copies of the Software, and to permit persons to whom the Software is
+# furnished to do so, subject to the following conditions:
+#
+# The above copyright notice and this permission notice shall be included in
+# all copies or substantial portions of the Software.
+#
+# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+# THE SOFTWARE.
+#
+
+top_srcdir = ../..
+test_objs = host.o mpu.task_eo
+
+include $(top_srcdir)/scripts/config.mk
+include $(top_srcdir)/scripts/rules_item.mk
diff --git a/tests/TFP/TFP_45_013/host.c b/tests/TFP/TFP_45_013/host.c
new file mode 100644
index 0000000..2f6cd73
--- /dev/null
+++ b/tests/TFP/TFP_45_013/host.c
@@ -0,0 +1,147 @@
+/*
+ * Copyright 2008 Sony Corporation
+ *
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a copy
+ * of this software and associated documentation files (the "Software"), to deal
+ * in the Software without restriction, including without limitation the rights
+ * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+ * copies of the Software, and to permit persons to whom the Software is
+ * furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included in
+ * all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+ * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+ * THE SOFTWARE.
+ */
+
+#include <pthread.h>
+#include <unistd.h>
+#include <mars/mars.h>
+#include <libspe2.h>
+#include <mars_test.h>
+
+struct queue_entry {
+ uint64_t val1;
+ uint64_t val2;
+};
+#define Q_DEPTH (MARS_TASK_QUEUE_WAIT_MAX)
+
+#define TEST_DIFF 1
+
+#define NUM_LOOP 5
+static uint32_t depth_size[] =
+{
+ 1,
+ Q_DEPTH / 2,
+ Q_DEPTH,
+ Q_DEPTH,
+ Q_DEPTH
+};
+extern spe_program_handle_t mpu_prog;
+
+static struct mars_context *mars_ctx;
+static struct mars_task_args task_args[Q_DEPTH], thread_args[Q_DEPTH];
+static struct mars_task_id task_id[Q_DEPTH];
+
+static uint64_t host_to_mpu[NUM_LOOP];
+static uint32_t notify[32] __attribute((aligned(128)));
+static struct queue_entry data[Q_DEPTH];
+
+static pthread_t thread[Q_DEPTH];
+static void *thread_proc(void *ptr)
+{
+ int ret;
+ struct mars_task_args *task_args = (struct mars_task_args *)ptr;
+ uint32_t id = (uint32_t)task_args->type.u32[0];
+ uint32_t count = (uint32_t)task_args->type.u32[1];
+
+ /* wait for start */
+ while (!notify[0])
+ usleep(100);
+
+ data[count].val1 = count;
+ data[count].val2 = count + TEST_DIFF;
+ ret = mars_task_queue_push(host_to_mpu[id], &data[count]);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+
+ return NULL;
+}
+
+int main(void)
+{
+ int ret, i;
+ int32_t exit_code, chk_exit;
+ uint32_t num;
+ uint32_t chk_bit;
+
+ ret = mars_context_create(&mars_ctx, 0, 0);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+
+ for (i = 0; i < NUM_LOOP; i++) {
+ notify[0] = 0;
+ chk_bit = 0;
+
+ ret = mars_task_queue_create(
+ mars_ctx,
+ &host_to_mpu[i],
+ sizeof(struct queue_entry),
+ depth_size[i],
+ MARS_TASK_QUEUE_HOST_TO_MPU);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+
+ for (num = 0; num < depth_size[i]; num++) {
+ chk_bit += (1 << num);
+
+ /* create push thread */
+ thread_args[num].type.u32[0] = (uint32_t)i;
+ thread_args[num].type.u32[1] = (uint32_t)num;
+ pthread_create(&thread[num], NULL,
+ thread_proc, &thread_args[num]);
+
+ /* create pop task */
+ ret = mars_task_create(mars_ctx, &task_id[num], NULL,
+ mpu_prog.elf_image, MARS_TASK_CONTEXT_SAVE_ALL);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+
+ task_args[num].type.u64[0] = host_to_mpu[i];
+ task_args[num].type.u64[1] =
+ mars_ptr_to_ea(&notify);
+ ret = mars_task_schedule(&task_id[num],
+ &task_args[num], 0);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+ }
+
+ /* start ppe threads and mpu tasks at the same time */
+ sleep(1);
+ mars_test_counter_set(&notify[0], 1);
+
+ chk_exit = 0;
+ for (num = 0; num < depth_size[i]; num++) {
+ ret = mars_task_wait(&task_id[num], &exit_code);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+ chk_exit |= exit_code;
+
+ ret = mars_task_destroy(&task_id[num]);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+
+ pthread_join(thread[num], NULL);
+ }
+ MARS_TEST_ASSERT_EQUAL((uint32_t)chk_exit, chk_bit);
+
+ ret = mars_task_queue_destroy(host_to_mpu[i]);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+ }
+
+ ret = mars_context_destroy(mars_ctx);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+
+ return 0;
+}
+
diff --git a/tests/TFP/TFP_45_013/mpu.c b/tests/TFP/TFP_45_013/mpu.c
new file mode 100644
index 0000000..9aaaad8
--- /dev/null
+++ b/tests/TFP/TFP_45_013/mpu.c
@@ -0,0 +1,54 @@
+/*
+ * Copyright 2008 Sony Corporation
+ *
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a copy
+ * of this software and associated documentation files (the "Software"), to deal
+ * in the Software without restriction, including without limitation the rights
+ * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+ * copies of the Software, and to permit persons to whom the Software is
+ * furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included in
+ * all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+ * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+ * THE SOFTWARE.
+ */
+
+#include <mars/mars.h>
+#include <mars_task_test.h>
+#include <spu_mfcio.h>
+
+#define TEST_DIFF 1
+struct queue_entry {
+ uint64_t val1;
+ uint64_t val2;
+};
+static struct queue_entry data;
+
+int mars_task_main(const struct mars_task_args *task_args)
+{
+ int ret;
+ uint64_t host_to_mpu_ea = task_args->type.u64[0];
+ uint64_t notify_ea = task_args->type.u64[1];
+ uint64_t val;
+
+ mars_test_counter_wait(notify_ea, 1);
+
+ ret = mars_task_queue_pop(host_to_mpu_ea, &data);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+
+ /* check queue data */
+ val = data.val2 - data.val1;
+ MARS_TEST_ASSERT_EQUAL(val, TEST_DIFF);
+
+ mars_task_exit(1 << data.val1);
+
+ return 0;
+}
diff --git a/tests/TFP/TFP_45_014/Makefile b/tests/TFP/TFP_45_014/Makefile
new file mode 100644
index 0000000..432135a
--- /dev/null
+++ b/tests/TFP/TFP_45_014/Makefile
@@ -0,0 +1,28 @@
+#
+# Copyright 2008 Sony Corporation
+#
+#
+# Permission is hereby granted, free of charge, to any person obtaining a copy
+# of this software and associated documentation files (the "Software"), to deal
+# in the Software without restriction, including without limitation the rights
+# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+# copies of the Software, and to permit persons to whom the Software is
+# furnished to do so, subject to the following conditions:
+#
+# The above copyright notice and this permission notice shall be included in
+# all copies or substantial portions of the Software.
+#
+# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+# THE SOFTWARE.
+#
+
+top_srcdir = ../..
+test_objs = host.o mpu.task_eo
+
+include $(top_srcdir)/scripts/config.mk
+include $(top_srcdir)/scripts/rules_item.mk
diff --git a/tests/TFP/TFP_45_014/host.c b/tests/TFP/TFP_45_014/host.c
new file mode 100644
index 0000000..d853a83
--- /dev/null
+++ b/tests/TFP/TFP_45_014/host.c
@@ -0,0 +1,155 @@
+/*
+ * Copyright 2008 Sony Corporation
+ *
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a copy
+ * of this software and associated documentation files (the "Software"), to deal
+ * in the Software without restriction, including without limitation the rights
+ * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+ * copies of the Software, and to permit persons to whom the Software is
+ * furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included in
+ * all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+ * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+ * THE SOFTWARE.
+ */
+
+#include <pthread.h>
+#include <unistd.h>
+#include <mars/mars.h>
+#include <libspe2.h>
+#include <mars_test.h>
+
+struct queue_entry {
+ uint64_t val1;
+ uint64_t val2;
+};
+#define Q_DEPTH (MARS_TASK_QUEUE_WAIT_MAX)
+
+#define TEST_DIFF 1
+
+#define NUM_LOOP 5
+static uint32_t depth_size[] =
+{
+ 1,
+ Q_DEPTH / 2,
+ Q_DEPTH,
+ Q_DEPTH,
+ Q_DEPTH
+};
+extern spe_program_handle_t mpu_prog;
+
+static struct mars_context *mars_ctx;
+static struct mars_task_args task_args[Q_DEPTH];
+static struct mars_task_args thread_args[Q_DEPTH];
+static struct mars_task_id task_id[Q_DEPTH];
+
+static uint64_t mpu_to_host[NUM_LOOP];
+static uint32_t notify[32] __attribute((aligned(128)));
+static struct queue_entry data[Q_DEPTH];
+
+static pthread_t thread[Q_DEPTH];
+static void *thread_proc(void *ptr)
+{
+ int ret;
+ struct mars_task_args *task_args = (struct mars_task_args *)ptr;
+ uint32_t id = (uint32_t)task_args->type.u32[0];
+ uint32_t num = (uint32_t)task_args->type.u32[1];
+ uint64_t val;
+
+ /* wait for start */
+ while (!notify[0])
+ usleep(100);
+
+ ret = mars_task_queue_pop(mpu_to_host[id], &data[num]);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+
+ /* check queue data */
+ val = data[num].val2 - data[num].val1;
+ MARS_TEST_ASSERT_EQUAL(val, TEST_DIFF);
+
+ return (void *)(1 << data[num].val1);
+}
+
+int main(void)
+{
+ int ret, i;
+ int32_t exit_code;
+ uint32_t num;
+ uint32_t chk_bit, chk_exit;
+ void *p_ret;
+
+ ret = mars_context_create(&mars_ctx, 0, 0);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+
+ for (i = 0; i < NUM_LOOP; i++) {
+ notify[0] = 0;
+ chk_bit = 0;
+
+ ret = mars_task_queue_create(
+ mars_ctx,
+ &mpu_to_host[i],
+ sizeof(struct queue_entry),
+ depth_size[i],
+ MARS_TASK_QUEUE_MPU_TO_HOST);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+
+ for (num = 0; num < depth_size[i]; num++) {
+ chk_bit += (1 << num);
+
+ /* create pop thread */
+ thread_args[num].type.u32[0] = (uint32_t)i;
+ thread_args[num].type.u32[1] = (uint32_t)num;
+ pthread_create(&thread[num], NULL,
+ thread_proc, &thread_args[num]);
+
+ /* create push task */
+ ret = mars_task_create(mars_ctx, &task_id[num], NULL,
+ mpu_prog.elf_image,
+ MARS_TASK_CONTEXT_SAVE_ALL);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+
+ task_args[num].type.u64[0] = mpu_to_host[i];
+ task_args[num].type.u64[1] =
+ mars_ptr_to_ea(&notify);
+ task_args[num].type.u64[2] = (uint64_t) num;
+ ret = mars_task_schedule(&task_id[num],
+ &task_args[num], 0);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+ }
+
+ /* start ppe threads and mpu tasks at the same time */
+ sleep(1);
+ mars_test_counter_set(&notify[0], 1);
+
+ chk_exit = 0;
+ for (num = 0; num < depth_size[i]; num++) {
+ ret = mars_task_wait(&task_id[num], &exit_code);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+ MARS_TEST_ASSERT_ERROR(exit_code, MARS_SUCCESS);
+
+ ret = mars_task_destroy(&task_id[num]);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+
+ pthread_join(thread[num], &p_ret);
+ chk_exit |= (uint32_t)p_ret;
+ }
+ MARS_TEST_ASSERT_EQUAL(chk_exit, chk_bit);
+
+ ret = mars_task_queue_destroy(mpu_to_host[i]);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+ }
+
+ ret = mars_context_destroy(mars_ctx);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+
+ return 0;
+}
+
diff --git a/tests/TFP/TFP_45_014/mpu.c b/tests/TFP/TFP_45_014/mpu.c
new file mode 100644
index 0000000..59ec445
--- /dev/null
+++ b/tests/TFP/TFP_45_014/mpu.c
@@ -0,0 +1,51 @@
+/*
+ * Copyright 2008 Sony Corporation
+ *
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a copy
+ * of this software and associated documentation files (the "Software"), to deal
+ * in the Software without restriction, including without limitation the rights
+ * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+ * copies of the Software, and to permit persons to whom the Software is
+ * furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included in
+ * all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+ * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+ * THE SOFTWARE.
+ */
+
+#include <mars/mars.h>
+#include <mars_task_test.h>
+#include <spu_mfcio.h>
+
+#define TEST_DIFF 1
+struct queue_entry {
+ uint64_t val1;
+ uint64_t val2;
+};
+static struct queue_entry data;
+
+int mars_task_main(const struct mars_task_args *task_args)
+{
+ int ret;
+ uint64_t mpu_to_host_ea = task_args->type.u64[0];
+ uint64_t notify_ea = task_args->type.u64[1];
+ uint32_t val = task_args->type.u64[2];
+
+ data.val1 = val;
+ data.val2 = val + TEST_DIFF;
+
+ mars_test_counter_wait(notify_ea, 1);
+
+ ret = mars_task_queue_push(mpu_to_host_ea, &data);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+
+ return 0;
+}
diff --git a/tests/TFP/TFP_45_015/Makefile b/tests/TFP/TFP_45_015/Makefile
new file mode 100644
index 0000000..ecbce33
--- /dev/null
+++ b/tests/TFP/TFP_45_015/Makefile
@@ -0,0 +1,28 @@
+#
+# Copyright 2008 Sony Corporation
+#
+#
+# Permission is hereby granted, free of charge, to any person obtaining a copy
+# of this software and associated documentation files (the "Software"), to deal
+# in the Software without restriction, including without limitation the rights
+# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+# copies of the Software, and to permit persons to whom the Software is
+# furnished to do so, subject to the following conditions:
+#
+# The above copyright notice and this permission notice shall be included in
+# all copies or substantial portions of the Software.
+#
+# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+# THE SOFTWARE.
+#
+
+top_srcdir = ../..
+test_objs = host.o mpu1.task_eo mpu2.task_eo
+
+include $(top_srcdir)/scripts/config.mk
+include $(top_srcdir)/scripts/rules_item.mk
diff --git a/tests/TFP/TFP_45_015/host.c b/tests/TFP/TFP_45_015/host.c
new file mode 100644
index 0000000..11d5a1a
--- /dev/null
+++ b/tests/TFP/TFP_45_015/host.c
@@ -0,0 +1,86 @@
+/*
+ * Copyright 2008 Sony Corporation
+ *
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a copy
+ * of this software and associated documentation files (the "Software"), to deal
+ * in the Software without restriction, including without limitation the rights
+ * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+ * copies of the Software, and to permit persons to whom the Software is
+ * furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included in
+ * all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+ * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+ * THE SOFTWARE.
+ */
+
+#include <libspe2.h>
+#include <mars/mars.h>
+#include <mars_test.h>
+#include "host_and_mpu.h"
+
+extern spe_program_handle_t mpu1_prog, mpu2_prog;
+
+static struct mars_context *mars;
+static struct mars_task_id task_ids[TASK_COUNT];
+static struct mars_task_args task_args;
+static uint64_t queue;
+
+int main(void)
+{
+ int i, exit_code, ret;
+
+ ret = mars_context_create(&mars, 0, 0);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+
+ for (i = 0; i < TASK_COUNT; i++) {
+ ret = mars_task_create(
+ mars,
+ &task_ids[i],
+ "45015",
+ (i % 2) ? mpu1_prog.elf_image : mpu2_prog.elf_image,
+ MARS_TASK_CONTEXT_SAVE_ALL);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+ }
+
+ ret = mars_task_queue_create(
+ mars,
+ &queue,
+ 16,
+ QUEUE_DEPTH,
+ MARS_TASK_QUEUE_MPU_TO_MPU);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+
+ task_args.type.u64[0] = queue;
+
+ for (i = 0; i < TASK_COUNT; i++) {
+ ret = mars_task_schedule(&task_ids[i], &task_args, 0);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+ }
+
+ for (i = 0; i < TASK_COUNT; i++) {
+ ret = mars_task_wait(&task_ids[i], &exit_code);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+ MARS_TEST_ASSERT_EQUAL(exit_code, 0);
+ }
+
+ ret = mars_task_queue_destroy(queue);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+
+ for (i = 0; i < TASK_COUNT; i++) {
+ ret = mars_task_destroy(&task_ids[i]);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+ }
+
+ ret = mars_context_destroy(mars);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+
+ return 0;
+}
diff --git a/tests/TFP/TFP_45_015/host_and_mpu.h b/tests/TFP/TFP_45_015/host_and_mpu.h
new file mode 100644
index 0000000..4a39ef5
--- /dev/null
+++ b/tests/TFP/TFP_45_015/host_and_mpu.h
@@ -0,0 +1,25 @@
+/*
+ * Copyright 2008 Sony Corporation
+ *
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a copy
+ * of this software and associated documentation files (the "Software"), to deal
+ * in the Software without restriction, including without limitation the rights
+ * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+ * copies of the Software, and to permit persons to whom the Software is
+ * furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included in
+ * all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+ * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+ * THE SOFTWARE.
+ */
+
+#define QUEUE_DEPTH 1048576
+#define TASK_COUNT 16
diff --git a/tests/TFP/TFP_45_015/mpu1.c b/tests/TFP/TFP_45_015/mpu1.c
new file mode 100644
index 0000000..2c0b447
--- /dev/null
+++ b/tests/TFP/TFP_45_015/mpu1.c
@@ -0,0 +1,46 @@
+/*
+ * Copyright 2008 Sony Corporation
+ *
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a copy
+ * of this software and associated documentation files (the "Software"), to deal
+ * in the Software without restriction, including without limitation the rights
+ * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+ * copies of the Software, and to permit persons to whom the Software is
+ * furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included in
+ * all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+ * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+ * THE SOFTWARE.
+ */
+
+#include <string.h>
+#include <mars/mars.h>
+#include "mars_task_test.h"
+#include "host_and_mpu.h"
+
+#define LOOP_COUNT ((QUEUE_DEPTH)/((TASK_COUNT)/2))
+
+static uint64_t queue_item[2] __attribute__((aligned(16)));
+
+int mars_task_main(const struct mars_task_args *task_args)
+{
+ uint64_t queue_ea = task_args->type.u64[0];
+ int i, ret;
+
+ for (i = 0; i < LOOP_COUNT; i++) {
+ ret = mars_task_queue_push(queue_ea, queue_item);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+ }
+
+ mars_task_exit(0);
+
+ return 0;
+}
diff --git a/tests/TFP/TFP_45_015/mpu2.c b/tests/TFP/TFP_45_015/mpu2.c
new file mode 100644
index 0000000..95cdd3d
--- /dev/null
+++ b/tests/TFP/TFP_45_015/mpu2.c
@@ -0,0 +1,46 @@
+/*
+ * Copyright 2008 Sony Corporation
+ *
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a copy
+ * of this software and associated documentation files (the "Software"), to deal
+ * in the Software without restriction, including without limitation the rights
+ * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+ * copies of the Software, and to permit persons to whom the Software is
+ * furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included in
+ * all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+ * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+ * THE SOFTWARE.
+ */
+
+#include <string.h>
+#include <mars/mars.h>
+#include "mars_task_test.h"
+#include "host_and_mpu.h"
+
+#define LOOP_COUNT ((QUEUE_DEPTH)/((TASK_COUNT)/2))
+
+static uint64_t queue_item[2] __attribute__((aligned(16)));
+
+int mars_task_main(const struct mars_task_args *task_args)
+{
+ uint64_t queue_ea = task_args->type.u64[0];
+ int i, ret;
+
+ for (i = 0; i < LOOP_COUNT; i++) {
+ ret = mars_task_queue_pop(queue_ea, queue_item);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+ }
+
+ mars_task_exit(0);
+
+ return 0;
+}
diff --git a/tests/TFP/TFP_45_016/Makefile b/tests/TFP/TFP_45_016/Makefile
new file mode 100644
index 0000000..432135a
--- /dev/null
+++ b/tests/TFP/TFP_45_016/Makefile
@@ -0,0 +1,28 @@
+#
+# Copyright 2008 Sony Corporation
+#
+#
+# Permission is hereby granted, free of charge, to any person obtaining a copy
+# of this software and associated documentation files (the "Software"), to deal
+# in the Software without restriction, including without limitation the rights
+# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+# copies of the Software, and to permit persons to whom the Software is
+# furnished to do so, subject to the following conditions:
+#
+# The above copyright notice and this permission notice shall be included in
+# all copies or substantial portions of the Software.
+#
+# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+# THE SOFTWARE.
+#
+
+top_srcdir = ../..
+test_objs = host.o mpu.task_eo
+
+include $(top_srcdir)/scripts/config.mk
+include $(top_srcdir)/scripts/rules_item.mk
diff --git a/tests/TFP/TFP_45_016/host.c b/tests/TFP/TFP_45_016/host.c
new file mode 100644
index 0000000..67337c1
--- /dev/null
+++ b/tests/TFP/TFP_45_016/host.c
@@ -0,0 +1,127 @@
+/*
+ * Copyright 2008 Sony Corporation
+ *
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a copy
+ * of this software and associated documentation files (the "Software"), to deal
+ * in the Software without restriction, including without limitation the rights
+ * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+ * copies of the Software, and to permit persons to whom the Software is
+ * furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included in
+ * all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+ * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+ * THE SOFTWARE.
+ */
+
+#include <pthread.h>
+#include <unistd.h>
+#include <mars/mars.h>
+#include <libspe2.h>
+#include <mars_test.h>
+
+struct queue_entry {
+ uint64_t val;
+ uint64_t pad;
+};
+#define Q_DEPTH (256 * 1024)
+
+#define NUM_LOOP 2
+static uint32_t depth_size[] =
+{
+ 1,
+ Q_DEPTH
+};
+extern spe_program_handle_t mpu_prog;
+
+static struct mars_context *mars_ctx;
+static struct mars_task_args task_args, thread_args;
+static struct mars_task_id task_id;
+
+static uint64_t host_to_mpu[NUM_LOOP];
+static struct queue_entry data;
+static uint32_t shared_resource __attribute((aligned(16)));
+
+static pthread_t thread;
+static void *thread_proc(void *ptr)
+{
+ int ret, i;
+ struct mars_task_args *task_args = (struct mars_task_args *)ptr;
+ uint32_t id = task_args->type.u32[0];
+ uint32_t num = task_args->type.u32[1];
+
+ /* the last one push should be blocked */
+ for (i = 0; i < num + 1; i++) {
+ ret = mars_task_queue_push(host_to_mpu[id], &data);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+ }
+
+ shared_resource = 1;
+ return NULL;
+}
+
+int main(void)
+{
+ int ret, i;
+ int32_t exit_code;
+
+ ret = mars_context_create(&mars_ctx, 0, 0);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+
+ for (i = 0; i < NUM_LOOP; i++) {
+ shared_resource = 0;
+
+ ret = mars_task_queue_create(
+ mars_ctx,
+ &host_to_mpu[i],
+ sizeof(struct queue_entry),
+ depth_size[i],
+ MARS_TASK_QUEUE_HOST_TO_MPU);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+
+ /* create push thread */
+ thread_args.type.u32[0] = (uint32_t)i;
+ thread_args.type.u32[1] = (uint32_t)depth_size[i];
+ pthread_create(&thread, NULL,
+ thread_proc, &thread_args);
+
+ /* check if queue_push is blocked */
+ sleep(1);
+ MARS_TEST_ASSERT_EQUAL(shared_resource, 0);
+
+ /* create pop task */
+ ret = mars_task_create(mars_ctx, &task_id, NULL,
+ mpu_prog.elf_image, MARS_TASK_CONTEXT_SAVE_ALL);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+
+ task_args.type.u64[0] = host_to_mpu[i];
+ ret = mars_task_schedule(&task_id, &task_args, 0);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+
+ ret = mars_task_wait(&task_id, &exit_code);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+ MARS_TEST_ASSERT_ERROR(exit_code, MARS_SUCCESS);
+
+ /* check if thread is finished for queue_push */
+ pthread_join(thread, NULL);
+
+ ret = mars_task_destroy(&task_id);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+
+ ret = mars_task_queue_destroy(host_to_mpu[i]);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+ }
+
+ ret = mars_context_destroy(mars_ctx);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+
+ return 0;
+}
+
diff --git a/tests/TFP/TFP_45_016/mpu.c b/tests/TFP/TFP_45_016/mpu.c
new file mode 100644
index 0000000..faf0f34
--- /dev/null
+++ b/tests/TFP/TFP_45_016/mpu.c
@@ -0,0 +1,45 @@
+/*
+ * Copyright 2008 Sony Corporation
+ *
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a copy
+ * of this software and associated documentation files (the "Software"), to deal
+ * in the Software without restriction, including without limitation the rights
+ * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+ * copies of the Software, and to permit persons to whom the Software is
+ * furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included in
+ * all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+ * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+ * THE SOFTWARE.
+ */
+
+#include <mars/mars.h>
+#include <mars_task_test.h>
+
+struct queue_entry {
+ uint64_t val;
+ uint64_t pad;
+};
+static struct queue_entry data;
+
+int mars_task_main(const struct mars_task_args *task_args)
+{
+ int ret;
+ uint64_t host_to_mpu_ea = task_args->type.u64[0];
+
+ ret = mars_task_queue_pop_begin(host_to_mpu_ea, &data, 1);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+
+ ret = mars_task_queue_pop_end(host_to_mpu_ea, 1);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+
+ return 0;
+}
diff --git a/tests/TFP/TFP_45_017/Makefile b/tests/TFP/TFP_45_017/Makefile
new file mode 100644
index 0000000..ecbce33
--- /dev/null
+++ b/tests/TFP/TFP_45_017/Makefile
@@ -0,0 +1,28 @@
+#
+# Copyright 2008 Sony Corporation
+#
+#
+# Permission is hereby granted, free of charge, to any person obtaining a copy
+# of this software and associated documentation files (the "Software"), to deal
+# in the Software without restriction, including without limitation the rights
+# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+# copies of the Software, and to permit persons to whom the Software is
+# furnished to do so, subject to the following conditions:
+#
+# The above copyright notice and this permission notice shall be included in
+# all copies or substantial portions of the Software.
+#
+# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+# THE SOFTWARE.
+#
+
+top_srcdir = ../..
+test_objs = host.o mpu1.task_eo mpu2.task_eo
+
+include $(top_srcdir)/scripts/config.mk
+include $(top_srcdir)/scripts/rules_item.mk
diff --git a/tests/TFP/TFP_45_017/host.c b/tests/TFP/TFP_45_017/host.c
new file mode 100644
index 0000000..8e34181
--- /dev/null
+++ b/tests/TFP/TFP_45_017/host.c
@@ -0,0 +1,119 @@
+/*
+ * Copyright 2008 Sony Corporation
+ *
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a copy
+ * of this software and associated documentation files (the "Software"), to deal
+ * in the Software without restriction, including without limitation the rights
+ * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+ * copies of the Software, and to permit persons to whom the Software is
+ * furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included in
+ * all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+ * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+ * THE SOFTWARE.
+ */
+
+#include <pthread.h>
+#include <unistd.h>
+#include <mars/mars.h>
+#include <libspe2.h>
+#include <mars_test.h>
+
+struct queue_entry {
+ uint64_t val;
+ uint64_t pad;
+};
+#define Q_DEPTH (256 * 1024)
+
+#define NUM_LOOP 2
+static uint32_t depth_size[] =
+{
+ 1,
+ Q_DEPTH
+};
+extern spe_program_handle_t mpu1_prog;
+extern spe_program_handle_t mpu2_prog;
+
+static struct mars_context *mars_ctx;
+static struct mars_task_args task1_args, task2_args;
+static struct mars_task_id task1_id, task2_id;
+
+static uint64_t mpu_to_mpu[NUM_LOOP];
+static uint32_t shared_resource __attribute((aligned(16)));
+
+int main(void)
+{
+ int ret, i;
+ int32_t exit_code;
+
+ ret = mars_context_create(&mars_ctx, 0, 0);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+
+ for (i = 0; i < NUM_LOOP; i++) {
+ shared_resource = 0;
+
+ ret = mars_task_queue_create(
+ mars_ctx,
+ &mpu_to_mpu[i],
+ sizeof(struct queue_entry),
+ depth_size[i],
+ MARS_TASK_QUEUE_MPU_TO_MPU);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+
+ /* create push task */
+ ret = mars_task_create(mars_ctx, &task1_id, NULL,
+ mpu1_prog.elf_image, MARS_TASK_CONTEXT_SAVE_ALL);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+
+ task1_args.type.u64[0] = mpu_to_mpu[i];
+ task1_args.type.u64[1] = (uint64_t)depth_size[i];
+ task1_args.type.u64[2] = mars_ptr_to_ea(&shared_resource);
+ ret = mars_task_schedule(&task1_id, &task1_args, 0);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+
+ /* check if queue_push is blocked */
+ sleep(1);
+ MARS_TEST_ASSERT_EQUAL(shared_resource, 0);
+
+ /* create and run pop task */
+ ret = mars_task_create(mars_ctx, &task2_id, NULL,
+ mpu2_prog.elf_image, MARS_TASK_CONTEXT_SAVE_ALL);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+
+ task2_args.type.u64[0] = mpu_to_mpu[i];
+ ret = mars_task_schedule(&task2_id, &task2_args, 0);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+
+ ret = mars_task_wait(&task2_id, &exit_code);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+ MARS_TEST_ASSERT_ERROR(exit_code, MARS_SUCCESS);
+
+ /* check if push task is successfly finished */
+ ret = mars_task_wait(&task1_id, &exit_code);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+ MARS_TEST_ASSERT_ERROR(exit_code, MARS_SUCCESS);
+
+ ret = mars_task_destroy(&task1_id);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+
+ ret = mars_task_destroy(&task2_id);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+
+ ret = mars_task_queue_destroy(mpu_to_mpu[i]);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+ }
+
+ ret = mars_context_destroy(mars_ctx);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+
+ return 0;
+}
+
diff --git a/tests/TFP/TFP_45_017/mpu1.c b/tests/TFP/TFP_45_017/mpu1.c
new file mode 100644
index 0000000..9f2dd0e
--- /dev/null
+++ b/tests/TFP/TFP_45_017/mpu1.c
@@ -0,0 +1,56 @@
+/*
+ * Copyright 2008 Sony Corporation
+ *
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a copy
+ * of this software and associated documentation files (the "Software"), to deal
+ * in the Software without restriction, including without limitation the rights
+ * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+ * copies of the Software, and to permit persons to whom the Software is
+ * furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included in
+ * all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+ * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+ * THE SOFTWARE.
+ */
+
+#include <mars/mars.h>
+#include <mars_task_test.h>
+#include <spu_mfcio.h>
+
+struct queue_entry {
+ uint64_t val;
+ uint64_t pad;
+};
+static struct queue_entry data;
+static uint32_t shared_resource __attribute((aligned(16)));
+
+int mars_task_main(const struct mars_task_args *task_args)
+{
+ int ret, i;
+ uint64_t mpu_to_mpu_ea = task_args->type.u64[0];
+ uint32_t num_push = (uint32_t)task_args->type.u64[1];
+ uint64_t shared_resource_ea = task_args->type.u64[2];
+
+ /* last one push should be blocked */
+ for (i = 0; i < num_push + 1; i++) {
+ ret = mars_task_queue_push(mpu_to_mpu_ea, &data);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+ }
+
+ /* if the program reaches here, shared_resource'll be updated */
+ shared_resource = 1;
+ mfc_put(&shared_resource, shared_resource_ea,
+ sizeof(uint32_t), 0, 0, 0);
+ mfc_write_tag_mask(1 << 0);
+ mfc_read_tag_status_all();
+
+ return 0;
+}
diff --git a/tests/TFP/TFP_45_017/mpu2.c b/tests/TFP/TFP_45_017/mpu2.c
new file mode 100644
index 0000000..2770f9d
--- /dev/null
+++ b/tests/TFP/TFP_45_017/mpu2.c
@@ -0,0 +1,45 @@
+/*
+ * Copyright 2008 Sony Corporation
+ *
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a copy
+ * of this software and associated documentation files (the "Software"), to deal
+ * in the Software without restriction, including without limitation the rights
+ * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+ * copies of the Software, and to permit persons to whom the Software is
+ * furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included in
+ * all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+ * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+ * THE SOFTWARE.
+ */
+
+#include <mars/mars.h>
+#include <mars_task_test.h>
+
+struct queue_entry {
+ uint64_t val;
+ uint64_t pad;
+};
+static struct queue_entry data;
+
+int mars_task_main(const struct mars_task_args *task_args)
+{
+ int ret;
+ uint64_t mpu_to_mpu_ea = task_args->type.u64[0];
+
+ ret = mars_task_queue_pop_begin(mpu_to_mpu_ea, &data, 1);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+
+ ret = mars_task_queue_pop_end(mpu_to_mpu_ea, 1);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+
+ return 0;
+}
diff --git a/tests/TFP/TFP_45_018/Makefile b/tests/TFP/TFP_45_018/Makefile
new file mode 100644
index 0000000..432135a
--- /dev/null
+++ b/tests/TFP/TFP_45_018/Makefile
@@ -0,0 +1,28 @@
+#
+# Copyright 2008 Sony Corporation
+#
+#
+# Permission is hereby granted, free of charge, to any person obtaining a copy
+# of this software and associated documentation files (the "Software"), to deal
+# in the Software without restriction, including without limitation the rights
+# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+# copies of the Software, and to permit persons to whom the Software is
+# furnished to do so, subject to the following conditions:
+#
+# The above copyright notice and this permission notice shall be included in
+# all copies or substantial portions of the Software.
+#
+# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+# THE SOFTWARE.
+#
+
+top_srcdir = ../..
+test_objs = host.o mpu.task_eo
+
+include $(top_srcdir)/scripts/config.mk
+include $(top_srcdir)/scripts/rules_item.mk
diff --git a/tests/TFP/TFP_45_018/host.c b/tests/TFP/TFP_45_018/host.c
new file mode 100644
index 0000000..67337c1
--- /dev/null
+++ b/tests/TFP/TFP_45_018/host.c
@@ -0,0 +1,127 @@
+/*
+ * Copyright 2008 Sony Corporation
+ *
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a copy
+ * of this software and associated documentation files (the "Software"), to deal
+ * in the Software without restriction, including without limitation the rights
+ * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+ * copies of the Software, and to permit persons to whom the Software is
+ * furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included in
+ * all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+ * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+ * THE SOFTWARE.
+ */
+
+#include <pthread.h>
+#include <unistd.h>
+#include <mars/mars.h>
+#include <libspe2.h>
+#include <mars_test.h>
+
+struct queue_entry {
+ uint64_t val;
+ uint64_t pad;
+};
+#define Q_DEPTH (256 * 1024)
+
+#define NUM_LOOP 2
+static uint32_t depth_size[] =
+{
+ 1,
+ Q_DEPTH
+};
+extern spe_program_handle_t mpu_prog;
+
+static struct mars_context *mars_ctx;
+static struct mars_task_args task_args, thread_args;
+static struct mars_task_id task_id;
+
+static uint64_t host_to_mpu[NUM_LOOP];
+static struct queue_entry data;
+static uint32_t shared_resource __attribute((aligned(16)));
+
+static pthread_t thread;
+static void *thread_proc(void *ptr)
+{
+ int ret, i;
+ struct mars_task_args *task_args = (struct mars_task_args *)ptr;
+ uint32_t id = task_args->type.u32[0];
+ uint32_t num = task_args->type.u32[1];
+
+ /* the last one push should be blocked */
+ for (i = 0; i < num + 1; i++) {
+ ret = mars_task_queue_push(host_to_mpu[id], &data);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+ }
+
+ shared_resource = 1;
+ return NULL;
+}
+
+int main(void)
+{
+ int ret, i;
+ int32_t exit_code;
+
+ ret = mars_context_create(&mars_ctx, 0, 0);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+
+ for (i = 0; i < NUM_LOOP; i++) {
+ shared_resource = 0;
+
+ ret = mars_task_queue_create(
+ mars_ctx,
+ &host_to_mpu[i],
+ sizeof(struct queue_entry),
+ depth_size[i],
+ MARS_TASK_QUEUE_HOST_TO_MPU);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+
+ /* create push thread */
+ thread_args.type.u32[0] = (uint32_t)i;
+ thread_args.type.u32[1] = (uint32_t)depth_size[i];
+ pthread_create(&thread, NULL,
+ thread_proc, &thread_args);
+
+ /* check if queue_push is blocked */
+ sleep(1);
+ MARS_TEST_ASSERT_EQUAL(shared_resource, 0);
+
+ /* create pop task */
+ ret = mars_task_create(mars_ctx, &task_id, NULL,
+ mpu_prog.elf_image, MARS_TASK_CONTEXT_SAVE_ALL);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+
+ task_args.type.u64[0] = host_to_mpu[i];
+ ret = mars_task_schedule(&task_id, &task_args, 0);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+
+ ret = mars_task_wait(&task_id, &exit_code);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+ MARS_TEST_ASSERT_ERROR(exit_code, MARS_SUCCESS);
+
+ /* check if thread is finished for queue_push */
+ pthread_join(thread, NULL);
+
+ ret = mars_task_destroy(&task_id);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+
+ ret = mars_task_queue_destroy(host_to_mpu[i]);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+ }
+
+ ret = mars_context_destroy(mars_ctx);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+
+ return 0;
+}
+
diff --git a/tests/TFP/TFP_45_018/mpu.c b/tests/TFP/TFP_45_018/mpu.c
new file mode 100644
index 0000000..9e9e9d8
--- /dev/null
+++ b/tests/TFP/TFP_45_018/mpu.c
@@ -0,0 +1,42 @@
+/*
+ * Copyright 2008 Sony Corporation
+ *
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a copy
+ * of this software and associated documentation files (the "Software"), to deal
+ * in the Software without restriction, including without limitation the rights
+ * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+ * copies of the Software, and to permit persons to whom the Software is
+ * furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included in
+ * all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+ * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+ * THE SOFTWARE.
+ */
+
+#include <mars/mars.h>
+#include <mars_task_test.h>
+
+struct queue_entry {
+ uint64_t val;
+ uint64_t pad;
+};
+static struct queue_entry data;
+
+int mars_task_main(const struct mars_task_args *task_args)
+{
+ int ret;
+ uint64_t host_to_mpu_ea = task_args->type.u64[0];
+
+ ret = mars_task_queue_try_pop(host_to_mpu_ea, &data);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+
+ return 0;
+}
diff --git a/tests/TFP/TFP_45_019/Makefile b/tests/TFP/TFP_45_019/Makefile
new file mode 100644
index 0000000..432135a
--- /dev/null
+++ b/tests/TFP/TFP_45_019/Makefile
@@ -0,0 +1,28 @@
+#
+# Copyright 2008 Sony Corporation
+#
+#
+# Permission is hereby granted, free of charge, to any person obtaining a copy
+# of this software and associated documentation files (the "Software"), to deal
+# in the Software without restriction, including without limitation the rights
+# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+# copies of the Software, and to permit persons to whom the Software is
+# furnished to do so, subject to the following conditions:
+#
+# The above copyright notice and this permission notice shall be included in
+# all copies or substantial portions of the Software.
+#
+# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+# THE SOFTWARE.
+#
+
+top_srcdir = ../..
+test_objs = host.o mpu.task_eo
+
+include $(top_srcdir)/scripts/config.mk
+include $(top_srcdir)/scripts/rules_item.mk
diff --git a/tests/TFP/TFP_45_019/host.c b/tests/TFP/TFP_45_019/host.c
new file mode 100644
index 0000000..22618f9
--- /dev/null
+++ b/tests/TFP/TFP_45_019/host.c
@@ -0,0 +1,107 @@
+/*
+ * Copyright 2008 Sony Corporation
+ *
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a copy
+ * of this software and associated documentation files (the "Software"), to deal
+ * in the Software without restriction, including without limitation the rights
+ * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+ * copies of the Software, and to permit persons to whom the Software is
+ * furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included in
+ * all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+ * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+ * THE SOFTWARE.
+ */
+
+#include <unistd.h>
+#include <mars/mars.h>
+#include <libspe2.h>
+#include <mars_test.h>
+
+struct queue_entry {
+ uint64_t val;
+ uint64_t pad;
+};
+#define Q_DEPTH (256 * 1024)
+
+#define NUM_LOOP 2
+static uint32_t depth_size[] =
+{
+ 1,
+ Q_DEPTH
+};
+extern spe_program_handle_t mpu_prog;
+
+static struct mars_context *mars_ctx;
+static struct mars_task_args task_args;
+static struct mars_task_id task_id;
+
+static uint64_t mpu_to_host[NUM_LOOP];
+static struct queue_entry data;
+
+static uint32_t shared_resource __attribute((aligned(16)));
+
+int main(void)
+{
+ int ret, i;
+ int32_t exit_code;
+
+ ret = mars_context_create(&mars_ctx, 0, 0);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+
+ for (i = 0; i < NUM_LOOP; i++) {
+ shared_resource = 0;
+
+ ret = mars_task_queue_create(
+ mars_ctx,
+ &mpu_to_host[i],
+ sizeof(struct queue_entry),
+ depth_size[i],
+ MARS_TASK_QUEUE_MPU_TO_HOST);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+
+ /* create push task */
+ ret = mars_task_create(mars_ctx, &task_id, NULL,
+ mpu_prog.elf_image, MARS_TASK_CONTEXT_SAVE_ALL);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+
+ task_args.type.u64[0] = mpu_to_host[i];
+ task_args.type.u64[1] = (uint64_t)depth_size[i];
+ task_args.type.u64[2] = mars_ptr_to_ea(&shared_resource);
+ ret = mars_task_schedule(&task_id, &task_args, 0);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+
+ /* check if queue push is blocked in mpu task */
+ sleep(1);
+ MARS_TEST_ASSERT_EQUAL(shared_resource, 0);
+
+ /* try_pop one */
+ ret = mars_task_queue_try_pop(mpu_to_host[i], &data);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+
+ /* check if mpu task is successfly finished */
+ ret = mars_task_wait(&task_id, &exit_code);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+ MARS_TEST_ASSERT_ERROR(exit_code, MARS_SUCCESS);
+
+ ret = mars_task_destroy(&task_id);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+
+ ret = mars_task_queue_destroy(mpu_to_host[i]);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+ }
+
+ ret = mars_context_destroy(mars_ctx);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+
+ return 0;
+}
+
diff --git a/tests/TFP/TFP_45_019/mpu.c b/tests/TFP/TFP_45_019/mpu.c
new file mode 100644
index 0000000..3b55c63
--- /dev/null
+++ b/tests/TFP/TFP_45_019/mpu.c
@@ -0,0 +1,56 @@
+/*
+ * Copyright 2008 Sony Corporation
+ *
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a copy
+ * of this software and associated documentation files (the "Software"), to deal
+ * in the Software without restriction, including without limitation the rights
+ * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+ * copies of the Software, and to permit persons to whom the Software is
+ * furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included in
+ * all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+ * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+ * THE SOFTWARE.
+ */
+
+#include <mars/mars.h>
+#include <mars_task_test.h>
+#include <spu_mfcio.h>
+
+struct queue_entry {
+ uint64_t val;
+ uint64_t pad;
+};
+static struct queue_entry data;
+static uint32_t shared_resource __attribute((aligned(16)));
+
+int mars_task_main(const struct mars_task_args *task_args)
+{
+ int ret, i;
+ uint64_t mpu_to_host_ea = task_args->type.u64[0];
+ uint32_t num_push = (uint32_t)task_args->type.u64[1];
+ uint64_t shared_resource_ea = task_args->type.u64[2];
+
+ /* last one push should be blocked */
+ for (i = 0; i < num_push + 1; i++) {
+ ret = mars_task_queue_push(mpu_to_host_ea, &data);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+ }
+
+ /* if the program reaches here, shared_resource'll be updated */
+ shared_resource = 1;
+ mfc_put(&shared_resource, shared_resource_ea,
+ sizeof(uint32_t), 0, 0, 0);
+ mfc_write_tag_mask(1 << 0);
+ mfc_read_tag_status_all();
+
+ return 0;
+}
diff --git a/tests/TFP/TFP_45_020/Makefile b/tests/TFP/TFP_45_020/Makefile
new file mode 100644
index 0000000..ecbce33
--- /dev/null
+++ b/tests/TFP/TFP_45_020/Makefile
@@ -0,0 +1,28 @@
+#
+# Copyright 2008 Sony Corporation
+#
+#
+# Permission is hereby granted, free of charge, to any person obtaining a copy
+# of this software and associated documentation files (the "Software"), to deal
+# in the Software without restriction, including without limitation the rights
+# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+# copies of the Software, and to permit persons to whom the Software is
+# furnished to do so, subject to the following conditions:
+#
+# The above copyright notice and this permission notice shall be included in
+# all copies or substantial portions of the Software.
+#
+# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+# THE SOFTWARE.
+#
+
+top_srcdir = ../..
+test_objs = host.o mpu1.task_eo mpu2.task_eo
+
+include $(top_srcdir)/scripts/config.mk
+include $(top_srcdir)/scripts/rules_item.mk
diff --git a/tests/TFP/TFP_45_020/host.c b/tests/TFP/TFP_45_020/host.c
new file mode 100644
index 0000000..4a350ec
--- /dev/null
+++ b/tests/TFP/TFP_45_020/host.c
@@ -0,0 +1,118 @@
+/*
+ * Copyright 2008 Sony Corporation
+ *
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a copy
+ * of this software and associated documentation files (the "Software"), to deal
+ * in the Software without restriction, including without limitation the rights
+ * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+ * copies of the Software, and to permit persons to whom the Software is
+ * furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included in
+ * all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+ * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+ * THE SOFTWARE.
+ */
+
+#include <unistd.h>
+#include <mars/mars.h>
+#include <libspe2.h>
+#include <mars_test.h>
+
+struct queue_entry {
+ uint64_t val;
+ uint64_t pad;
+};
+#define Q_DEPTH (256 * 1024)
+
+#define NUM_LOOP 2
+static uint32_t depth_size[] =
+{
+ 1,
+ Q_DEPTH
+};
+extern spe_program_handle_t mpu1_prog;
+extern spe_program_handle_t mpu2_prog;
+
+static struct mars_context *mars_ctx;
+static struct mars_task_args task1_args, task2_args;
+static struct mars_task_id task1_id, task2_id;
+
+static uint64_t mpu_to_mpu[NUM_LOOP];
+static uint32_t shared_resource __attribute((aligned(16)));
+
+int main(void)
+{
+ int ret, i;
+ int32_t exit_code;
+
+ ret = mars_context_create(&mars_ctx, 0, 0);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+
+ for (i = 0; i < NUM_LOOP; i++) {
+ shared_resource = 0;
+
+ ret = mars_task_queue_create(
+ mars_ctx,
+ &mpu_to_mpu[i],
+ sizeof(struct queue_entry),
+ depth_size[i],
+ MARS_TASK_QUEUE_MPU_TO_MPU);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+
+ /* create push task */
+ ret = mars_task_create(mars_ctx, &task1_id, NULL,
+ mpu1_prog.elf_image, MARS_TASK_CONTEXT_SAVE_ALL);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+
+ task1_args.type.u64[0] = mpu_to_mpu[i];
+ task1_args.type.u64[1] = (uint64_t)depth_size[i];
+ task1_args.type.u64[2] = mars_ptr_to_ea(&shared_resource);
+ ret = mars_task_schedule(&task1_id, &task1_args, 0);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+
+ /* check if queue_push is blocked */
+ sleep(1);
+ MARS_TEST_ASSERT_EQUAL(shared_resource, 0);
+
+ /* create and run pop task */
+ ret = mars_task_create(mars_ctx, &task2_id, NULL,
+ mpu2_prog.elf_image, MARS_TASK_CONTEXT_SAVE_ALL);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+
+ task2_args.type.u64[0] = mpu_to_mpu[i];
+ ret = mars_task_schedule(&task2_id, &task2_args, 0);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+
+ ret = mars_task_wait(&task2_id, &exit_code);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+ MARS_TEST_ASSERT_ERROR(exit_code, MARS_SUCCESS);
+
+ /* check if push task is successfly finished */
+ ret = mars_task_wait(&task1_id, &exit_code);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+ MARS_TEST_ASSERT_ERROR(exit_code, MARS_SUCCESS);
+
+ ret = mars_task_destroy(&task1_id);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+
+ ret = mars_task_destroy(&task2_id);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+
+ ret = mars_task_queue_destroy(mpu_to_mpu[i]);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+ }
+
+ ret = mars_context_destroy(mars_ctx);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+
+ return 0;
+}
+
diff --git a/tests/TFP/TFP_45_020/mpu1.c b/tests/TFP/TFP_45_020/mpu1.c
new file mode 100644
index 0000000..9f2dd0e
--- /dev/null
+++ b/tests/TFP/TFP_45_020/mpu1.c
@@ -0,0 +1,56 @@
+/*
+ * Copyright 2008 Sony Corporation
+ *
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a copy
+ * of this software and associated documentation files (the "Software"), to deal
+ * in the Software without restriction, including without limitation the rights
+ * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+ * copies of the Software, and to permit persons to whom the Software is
+ * furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included in
+ * all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+ * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+ * THE SOFTWARE.
+ */
+
+#include <mars/mars.h>
+#include <mars_task_test.h>
+#include <spu_mfcio.h>
+
+struct queue_entry {
+ uint64_t val;
+ uint64_t pad;
+};
+static struct queue_entry data;
+static uint32_t shared_resource __attribute((aligned(16)));
+
+int mars_task_main(const struct mars_task_args *task_args)
+{
+ int ret, i;
+ uint64_t mpu_to_mpu_ea = task_args->type.u64[0];
+ uint32_t num_push = (uint32_t)task_args->type.u64[1];
+ uint64_t shared_resource_ea = task_args->type.u64[2];
+
+ /* last one push should be blocked */
+ for (i = 0; i < num_push + 1; i++) {
+ ret = mars_task_queue_push(mpu_to_mpu_ea, &data);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+ }
+
+ /* if the program reaches here, shared_resource'll be updated */
+ shared_resource = 1;
+ mfc_put(&shared_resource, shared_resource_ea,
+ sizeof(uint32_t), 0, 0, 0);
+ mfc_write_tag_mask(1 << 0);
+ mfc_read_tag_status_all();
+
+ return 0;
+}
diff --git a/tests/TFP/TFP_45_020/mpu2.c b/tests/TFP/TFP_45_020/mpu2.c
new file mode 100644
index 0000000..89852d8
--- /dev/null
+++ b/tests/TFP/TFP_45_020/mpu2.c
@@ -0,0 +1,42 @@
+/*
+ * Copyright 2008 Sony Corporation
+ *
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a copy
+ * of this software and associated documentation files (the "Software"), to deal
+ * in the Software without restriction, including without limitation the rights
+ * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+ * copies of the Software, and to permit persons to whom the Software is
+ * furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included in
+ * all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+ * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+ * THE SOFTWARE.
+ */
+
+#include <mars/mars.h>
+#include <mars_task_test.h>
+
+struct queue_entry {
+ uint64_t val;
+ uint64_t pad;
+};
+static struct queue_entry data;
+
+int mars_task_main(const struct mars_task_args *task_args)
+{
+ int ret;
+ uint64_t mpu_to_mpu_ea = task_args->type.u64[0];
+
+ ret = mars_task_queue_try_pop(mpu_to_mpu_ea, &data);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+
+ return 0;
+}
diff --git a/tests/TFP/TFP_45_021/Makefile b/tests/TFP/TFP_45_021/Makefile
new file mode 100644
index 0000000..432135a
--- /dev/null
+++ b/tests/TFP/TFP_45_021/Makefile
@@ -0,0 +1,28 @@
+#
+# Copyright 2008 Sony Corporation
+#
+#
+# Permission is hereby granted, free of charge, to any person obtaining a copy
+# of this software and associated documentation files (the "Software"), to deal
+# in the Software without restriction, including without limitation the rights
+# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+# copies of the Software, and to permit persons to whom the Software is
+# furnished to do so, subject to the following conditions:
+#
+# The above copyright notice and this permission notice shall be included in
+# all copies or substantial portions of the Software.
+#
+# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+# THE SOFTWARE.
+#
+
+top_srcdir = ../..
+test_objs = host.o mpu.task_eo
+
+include $(top_srcdir)/scripts/config.mk
+include $(top_srcdir)/scripts/rules_item.mk
diff --git a/tests/TFP/TFP_45_021/host.c b/tests/TFP/TFP_45_021/host.c
new file mode 100644
index 0000000..67337c1
--- /dev/null
+++ b/tests/TFP/TFP_45_021/host.c
@@ -0,0 +1,127 @@
+/*
+ * Copyright 2008 Sony Corporation
+ *
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a copy
+ * of this software and associated documentation files (the "Software"), to deal
+ * in the Software without restriction, including without limitation the rights
+ * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+ * copies of the Software, and to permit persons to whom the Software is
+ * furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included in
+ * all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+ * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+ * THE SOFTWARE.
+ */
+
+#include <pthread.h>
+#include <unistd.h>
+#include <mars/mars.h>
+#include <libspe2.h>
+#include <mars_test.h>
+
+struct queue_entry {
+ uint64_t val;
+ uint64_t pad;
+};
+#define Q_DEPTH (256 * 1024)
+
+#define NUM_LOOP 2
+static uint32_t depth_size[] =
+{
+ 1,
+ Q_DEPTH
+};
+extern spe_program_handle_t mpu_prog;
+
+static struct mars_context *mars_ctx;
+static struct mars_task_args task_args, thread_args;
+static struct mars_task_id task_id;
+
+static uint64_t host_to_mpu[NUM_LOOP];
+static struct queue_entry data;
+static uint32_t shared_resource __attribute((aligned(16)));
+
+static pthread_t thread;
+static void *thread_proc(void *ptr)
+{
+ int ret, i;
+ struct mars_task_args *task_args = (struct mars_task_args *)ptr;
+ uint32_t id = task_args->type.u32[0];
+ uint32_t num = task_args->type.u32[1];
+
+ /* the last one push should be blocked */
+ for (i = 0; i < num + 1; i++) {
+ ret = mars_task_queue_push(host_to_mpu[id], &data);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+ }
+
+ shared_resource = 1;
+ return NULL;
+}
+
+int main(void)
+{
+ int ret, i;
+ int32_t exit_code;
+
+ ret = mars_context_create(&mars_ctx, 0, 0);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+
+ for (i = 0; i < NUM_LOOP; i++) {
+ shared_resource = 0;
+
+ ret = mars_task_queue_create(
+ mars_ctx,
+ &host_to_mpu[i],
+ sizeof(struct queue_entry),
+ depth_size[i],
+ MARS_TASK_QUEUE_HOST_TO_MPU);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+
+ /* create push thread */
+ thread_args.type.u32[0] = (uint32_t)i;
+ thread_args.type.u32[1] = (uint32_t)depth_size[i];
+ pthread_create(&thread, NULL,
+ thread_proc, &thread_args);
+
+ /* check if queue_push is blocked */
+ sleep(1);
+ MARS_TEST_ASSERT_EQUAL(shared_resource, 0);
+
+ /* create pop task */
+ ret = mars_task_create(mars_ctx, &task_id, NULL,
+ mpu_prog.elf_image, MARS_TASK_CONTEXT_SAVE_ALL);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+
+ task_args.type.u64[0] = host_to_mpu[i];
+ ret = mars_task_schedule(&task_id, &task_args, 0);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+
+ ret = mars_task_wait(&task_id, &exit_code);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+ MARS_TEST_ASSERT_ERROR(exit_code, MARS_SUCCESS);
+
+ /* check if thread is finished for queue_push */
+ pthread_join(thread, NULL);
+
+ ret = mars_task_destroy(&task_id);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+
+ ret = mars_task_queue_destroy(host_to_mpu[i]);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+ }
+
+ ret = mars_context_destroy(mars_ctx);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+
+ return 0;
+}
+
diff --git a/tests/TFP/TFP_45_021/mpu.c b/tests/TFP/TFP_45_021/mpu.c
new file mode 100644
index 0000000..95927cc
--- /dev/null
+++ b/tests/TFP/TFP_45_021/mpu.c
@@ -0,0 +1,45 @@
+/*
+ * Copyright 2008 Sony Corporation
+ *
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a copy
+ * of this software and associated documentation files (the "Software"), to deal
+ * in the Software without restriction, including without limitation the rights
+ * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+ * copies of the Software, and to permit persons to whom the Software is
+ * furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included in
+ * all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+ * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+ * THE SOFTWARE.
+ */
+
+#include <mars/mars.h>
+#include <mars_task_test.h>
+
+struct queue_entry {
+ uint64_t val;
+ uint64_t pad;
+};
+static struct queue_entry data;
+
+int mars_task_main(const struct mars_task_args *task_args)
+{
+ int ret;
+ uint64_t host_to_mpu_ea = task_args->type.u64[0];
+
+ ret = mars_task_queue_try_pop_begin(host_to_mpu_ea, &data, 1);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+
+ ret = mars_task_queue_pop_end(host_to_mpu_ea, 1);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+
+ return 0;
+}
diff --git a/tests/TFP/TFP_45_022/Makefile b/tests/TFP/TFP_45_022/Makefile
new file mode 100644
index 0000000..ecbce33
--- /dev/null
+++ b/tests/TFP/TFP_45_022/Makefile
@@ -0,0 +1,28 @@
+#
+# Copyright 2008 Sony Corporation
+#
+#
+# Permission is hereby granted, free of charge, to any person obtaining a copy
+# of this software and associated documentation files (the "Software"), to deal
+# in the Software without restriction, including without limitation the rights
+# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+# copies of the Software, and to permit persons to whom the Software is
+# furnished to do so, subject to the following conditions:
+#
+# The above copyright notice and this permission notice shall be included in
+# all copies or substantial portions of the Software.
+#
+# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+# THE SOFTWARE.
+#
+
+top_srcdir = ../..
+test_objs = host.o mpu1.task_eo mpu2.task_eo
+
+include $(top_srcdir)/scripts/config.mk
+include $(top_srcdir)/scripts/rules_item.mk
diff --git a/tests/TFP/TFP_45_022/host.c b/tests/TFP/TFP_45_022/host.c
new file mode 100644
index 0000000..4a350ec
--- /dev/null
+++ b/tests/TFP/TFP_45_022/host.c
@@ -0,0 +1,118 @@
+/*
+ * Copyright 2008 Sony Corporation
+ *
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a copy
+ * of this software and associated documentation files (the "Software"), to deal
+ * in the Software without restriction, including without limitation the rights
+ * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+ * copies of the Software, and to permit persons to whom the Software is
+ * furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included in
+ * all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+ * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+ * THE SOFTWARE.
+ */
+
+#include <unistd.h>
+#include <mars/mars.h>
+#include <libspe2.h>
+#include <mars_test.h>
+
+struct queue_entry {
+ uint64_t val;
+ uint64_t pad;
+};
+#define Q_DEPTH (256 * 1024)
+
+#define NUM_LOOP 2
+static uint32_t depth_size[] =
+{
+ 1,
+ Q_DEPTH
+};
+extern spe_program_handle_t mpu1_prog;
+extern spe_program_handle_t mpu2_prog;
+
+static struct mars_context *mars_ctx;
+static struct mars_task_args task1_args, task2_args;
+static struct mars_task_id task1_id, task2_id;
+
+static uint64_t mpu_to_mpu[NUM_LOOP];
+static uint32_t shared_resource __attribute((aligned(16)));
+
+int main(void)
+{
+ int ret, i;
+ int32_t exit_code;
+
+ ret = mars_context_create(&mars_ctx, 0, 0);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+
+ for (i = 0; i < NUM_LOOP; i++) {
+ shared_resource = 0;
+
+ ret = mars_task_queue_create(
+ mars_ctx,
+ &mpu_to_mpu[i],
+ sizeof(struct queue_entry),
+ depth_size[i],
+ MARS_TASK_QUEUE_MPU_TO_MPU);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+
+ /* create push task */
+ ret = mars_task_create(mars_ctx, &task1_id, NULL,
+ mpu1_prog.elf_image, MARS_TASK_CONTEXT_SAVE_ALL);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+
+ task1_args.type.u64[0] = mpu_to_mpu[i];
+ task1_args.type.u64[1] = (uint64_t)depth_size[i];
+ task1_args.type.u64[2] = mars_ptr_to_ea(&shared_resource);
+ ret = mars_task_schedule(&task1_id, &task1_args, 0);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+
+ /* check if queue_push is blocked */
+ sleep(1);
+ MARS_TEST_ASSERT_EQUAL(shared_resource, 0);
+
+ /* create and run pop task */
+ ret = mars_task_create(mars_ctx, &task2_id, NULL,
+ mpu2_prog.elf_image, MARS_TASK_CONTEXT_SAVE_ALL);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+
+ task2_args.type.u64[0] = mpu_to_mpu[i];
+ ret = mars_task_schedule(&task2_id, &task2_args, 0);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+
+ ret = mars_task_wait(&task2_id, &exit_code);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+ MARS_TEST_ASSERT_ERROR(exit_code, MARS_SUCCESS);
+
+ /* check if push task is successfly finished */
+ ret = mars_task_wait(&task1_id, &exit_code);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+ MARS_TEST_ASSERT_ERROR(exit_code, MARS_SUCCESS);
+
+ ret = mars_task_destroy(&task1_id);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+
+ ret = mars_task_destroy(&task2_id);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+
+ ret = mars_task_queue_destroy(mpu_to_mpu[i]);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+ }
+
+ ret = mars_context_destroy(mars_ctx);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+
+ return 0;
+}
+
diff --git a/tests/TFP/TFP_45_022/mpu1.c b/tests/TFP/TFP_45_022/mpu1.c
new file mode 100644
index 0000000..9f2dd0e
--- /dev/null
+++ b/tests/TFP/TFP_45_022/mpu1.c
@@ -0,0 +1,56 @@
+/*
+ * Copyright 2008 Sony Corporation
+ *
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a copy
+ * of this software and associated documentation files (the "Software"), to deal
+ * in the Software without restriction, including without limitation the rights
+ * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+ * copies of the Software, and to permit persons to whom the Software is
+ * furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included in
+ * all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+ * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+ * THE SOFTWARE.
+ */
+
+#include <mars/mars.h>
+#include <mars_task_test.h>
+#include <spu_mfcio.h>
+
+struct queue_entry {
+ uint64_t val;
+ uint64_t pad;
+};
+static struct queue_entry data;
+static uint32_t shared_resource __attribute((aligned(16)));
+
+int mars_task_main(const struct mars_task_args *task_args)
+{
+ int ret, i;
+ uint64_t mpu_to_mpu_ea = task_args->type.u64[0];
+ uint32_t num_push = (uint32_t)task_args->type.u64[1];
+ uint64_t shared_resource_ea = task_args->type.u64[2];
+
+ /* last one push should be blocked */
+ for (i = 0; i < num_push + 1; i++) {
+ ret = mars_task_queue_push(mpu_to_mpu_ea, &data);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+ }
+
+ /* if the program reaches here, shared_resource'll be updated */
+ shared_resource = 1;
+ mfc_put(&shared_resource, shared_resource_ea,
+ sizeof(uint32_t), 0, 0, 0);
+ mfc_write_tag_mask(1 << 0);
+ mfc_read_tag_status_all();
+
+ return 0;
+}
diff --git a/tests/TFP/TFP_45_022/mpu2.c b/tests/TFP/TFP_45_022/mpu2.c
new file mode 100644
index 0000000..5865ea4
--- /dev/null
+++ b/tests/TFP/TFP_45_022/mpu2.c
@@ -0,0 +1,45 @@
+/*
+ * Copyright 2008 Sony Corporation
+ *
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a copy
+ * of this software and associated documentation files (the "Software"), to deal
+ * in the Software without restriction, including without limitation the rights
+ * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+ * copies of the Software, and to permit persons to whom the Software is
+ * furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included in
+ * all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+ * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+ * THE SOFTWARE.
+ */
+
+#include <mars/mars.h>
+#include <mars_task_test.h>
+
+struct queue_entry {
+ uint64_t val;
+ uint64_t pad;
+};
+static struct queue_entry data;
+
+int mars_task_main(const struct mars_task_args *task_args)
+{
+ int ret;
+ uint64_t mpu_to_mpu_ea = task_args->type.u64[0];
+
+ ret = mars_task_queue_try_pop_begin(mpu_to_mpu_ea, &data, 1);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+
+ ret = mars_task_queue_pop_end(mpu_to_mpu_ea, 1);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+
+ return 0;
+}
diff --git a/tests/TFP/TFP_46_001/Makefile b/tests/TFP/TFP_46_001/Makefile
new file mode 100644
index 0000000..432135a
--- /dev/null
+++ b/tests/TFP/TFP_46_001/Makefile
@@ -0,0 +1,28 @@
+#
+# Copyright 2008 Sony Corporation
+#
+#
+# Permission is hereby granted, free of charge, to any person obtaining a copy
+# of this software and associated documentation files (the "Software"), to deal
+# in the Software without restriction, including without limitation the rights
+# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+# copies of the Software, and to permit persons to whom the Software is
+# furnished to do so, subject to the following conditions:
+#
+# The above copyright notice and this permission notice shall be included in
+# all copies or substantial portions of the Software.
+#
+# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+# THE SOFTWARE.
+#
+
+top_srcdir = ../..
+test_objs = host.o mpu.task_eo
+
+include $(top_srcdir)/scripts/config.mk
+include $(top_srcdir)/scripts/rules_item.mk
diff --git a/tests/TFP/TFP_46_001/host.c b/tests/TFP/TFP_46_001/host.c
new file mode 100644
index 0000000..968c6c1
--- /dev/null
+++ b/tests/TFP/TFP_46_001/host.c
@@ -0,0 +1,95 @@
+/*
+ * Copyright 2008 Sony Corporation
+ *
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a copy
+ * of this software and associated documentation files (the "Software"), to deal
+ * in the Software without restriction, including without limitation the rights
+ * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+ * copies of the Software, and to permit persons to whom the Software is
+ * furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included in
+ * all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+ * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+ * THE SOFTWARE.
+ */
+
+#include <unistd.h>
+#include <libspe2.h>
+#include <mars/mars.h>
+#include <mars_test.h>
+#include "host_and_mpu.h"
+
+extern spe_program_handle_t mpu_prog;
+
+static struct mars_context *mars;
+static struct mars_task_id task_id;
+static struct mars_task_args task_args;
+static uint64_t queue;
+static uint64_t queue_item[2], mpu_answer __attribute__((aligned(16)));
+
+int main(void)
+{
+ int i, exit_code, ret;
+
+ ret = mars_context_create(&mars, 0, 0);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+
+ ret = mars_task_create(
+ mars,
+ &task_id,
+ "46001",
+ mpu_prog.elf_image,
+ MARS_TASK_CONTEXT_SAVE_ALL);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+
+ ret = mars_task_queue_create(
+ mars,
+ &queue,
+ 16,
+ QUEUE_DEPTH,
+ MARS_TASK_QUEUE_MPU_TO_HOST);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+
+ mpu_answer = 0;
+
+ task_args.type.u64[0] = queue;
+ task_args.type.u64[1] = mars_ptr_to_ea(&mpu_answer);
+ ret = mars_task_schedule(&task_id, &task_args, 0);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+
+ usleep(100000);
+
+ MARS_TEST_ASSERT(mpu_answer == 0);
+
+ for (i = 0; i < QUEUE_DEPTH+1; i++) {
+ ret = mars_task_queue_pop(queue, queue_item);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+
+ MARS_TEST_ASSERT(queue_item[0] == i && queue_item[1] == i);
+ }
+
+ MARS_TEST_ASSERT(mpu_answer);
+
+ ret = mars_task_wait(&task_id, &exit_code);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+ MARS_TEST_ASSERT_EQUAL(exit_code, 0);
+
+ ret = mars_task_queue_destroy(queue);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+
+ ret = mars_task_destroy(&task_id);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+
+ ret = mars_context_destroy(mars);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+
+ return 0;
+}
diff --git a/tests/TFP/TFP_46_001/host_and_mpu.h b/tests/TFP/TFP_46_001/host_and_mpu.h
new file mode 100644
index 0000000..e565e93
--- /dev/null
+++ b/tests/TFP/TFP_46_001/host_and_mpu.h
@@ -0,0 +1,24 @@
+/*
+ * Copyright 2008 Sony Corporation
+ *
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a copy
+ * of this software and associated documentation files (the "Software"), to deal
+ * in the Software without restriction, including without limitation the rights
+ * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+ * copies of the Software, and to permit persons to whom the Software is
+ * furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included in
+ * all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+ * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+ * THE SOFTWARE.
+ */
+
+#define QUEUE_DEPTH 16
diff --git a/tests/TFP/TFP_46_001/mpu.c b/tests/TFP/TFP_46_001/mpu.c
new file mode 100644
index 0000000..c8d3a99
--- /dev/null
+++ b/tests/TFP/TFP_46_001/mpu.c
@@ -0,0 +1,53 @@
+/*
+ * Copyright 2008 Sony Corporation
+ *
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a copy
+ * of this software and associated documentation files (the "Software"), to deal
+ * in the Software without restriction, including without limitation the rights
+ * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+ * copies of the Software, and to permit persons to whom the Software is
+ * furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included in
+ * all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+ * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+ * THE SOFTWARE.
+ */
+
+#include <string.h>
+#include <spu_mfcio.h>
+#include <mars/mars.h>
+#include "mars_task_test.h"
+#include "host_and_mpu.h"
+
+static uint64_t queue_item[2] __attribute__((aligned(16)));
+
+int mars_task_main(const struct mars_task_args *task_args)
+{
+ uint64_t queue_ea = task_args->type.u64[0];
+ uint64_t mpu_answer_ea = task_args->type.u64[1];
+ int i, ret;
+
+ for (i = 0; i < QUEUE_DEPTH+1; i++) {
+ queue_item[0] = queue_item[1] = i;
+
+ ret = mars_task_queue_push_begin(queue_ea, queue_item, 0);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+
+ ret = mars_task_queue_push_end(queue_ea, 0);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+ }
+
+ mars_test_int64_put(mpu_answer_ea, 1);
+
+ mars_task_exit(0);
+
+ return 0;
+}
diff --git a/tests/TFP/TFP_46_002/Makefile b/tests/TFP/TFP_46_002/Makefile
new file mode 100644
index 0000000..ecbce33
--- /dev/null
+++ b/tests/TFP/TFP_46_002/Makefile
@@ -0,0 +1,28 @@
+#
+# Copyright 2008 Sony Corporation
+#
+#
+# Permission is hereby granted, free of charge, to any person obtaining a copy
+# of this software and associated documentation files (the "Software"), to deal
+# in the Software without restriction, including without limitation the rights
+# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+# copies of the Software, and to permit persons to whom the Software is
+# furnished to do so, subject to the following conditions:
+#
+# The above copyright notice and this permission notice shall be included in
+# all copies or substantial portions of the Software.
+#
+# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+# THE SOFTWARE.
+#
+
+top_srcdir = ../..
+test_objs = host.o mpu1.task_eo mpu2.task_eo
+
+include $(top_srcdir)/scripts/config.mk
+include $(top_srcdir)/scripts/rules_item.mk
diff --git a/tests/TFP/TFP_46_002/host.c b/tests/TFP/TFP_46_002/host.c
new file mode 100644
index 0000000..3547b0c
--- /dev/null
+++ b/tests/TFP/TFP_46_002/host.c
@@ -0,0 +1,102 @@
+/*
+ * Copyright 2008 Sony Corporation
+ *
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a copy
+ * of this software and associated documentation files (the "Software"), to deal
+ * in the Software without restriction, including without limitation the rights
+ * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+ * copies of the Software, and to permit persons to whom the Software is
+ * furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included in
+ * all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+ * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+ * THE SOFTWARE.
+ */
+
+#include <libspe2.h>
+#include <mars/mars.h>
+#include <mars_test.h>
+#include "host_and_mpu.h"
+
+extern spe_program_handle_t mpu1_prog, mpu2_prog;
+
+static struct mars_context *mars;
+static struct mars_task_id pusher_task_id, poper_task_id;
+static struct mars_task_args task_args;
+static uint64_t queue;
+static uint64_t mpu_answer __attribute__((aligned(16)));
+
+int main(void)
+{
+ int exit_code, ret;
+ uint32_t tb_freq;
+
+ ret = mars_test_get_timebase_freq(&tb_freq);
+ MARS_TEST_ASSERT_EQUAL(ret, 0);
+
+ ret = mars_context_create(&mars, 0, 0);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+
+ ret = mars_task_create(
+ mars,
+ &pusher_task_id,
+ "46002",
+ mpu1_prog.elf_image,
+ MARS_TASK_CONTEXT_SAVE_ALL);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+
+ ret = mars_task_create(
+ mars,
+ &poper_task_id,
+ "46002",
+ mpu2_prog.elf_image,
+ MARS_TASK_CONTEXT_SAVE_ALL);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+
+ ret = mars_task_queue_create(
+ mars,
+ &queue,
+ 16,
+ QUEUE_DEPTH,
+ MARS_TASK_QUEUE_MPU_TO_MPU);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+
+ mpu_answer = 0;
+
+ task_args.type.u64[0] = queue;
+ task_args.type.u64[1] = mars_ptr_to_ea(&mpu_answer);
+ task_args.type.u64[2] = tb_freq;
+ ret = mars_task_schedule(&pusher_task_id, &task_args, 0);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+
+ ret = mars_task_schedule(&poper_task_id, &task_args, 0);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+
+ ret = mars_task_wait(&pusher_task_id, &exit_code);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+ MARS_TEST_ASSERT_EQUAL(exit_code, 0);
+
+ ret = mars_task_wait(&poper_task_id, &exit_code);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+ MARS_TEST_ASSERT_EQUAL(exit_code, 0);
+
+ ret = mars_task_queue_destroy(queue);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+
+ ret = mars_task_destroy(&pusher_task_id);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+ mars_task_destroy(&poper_task_id);
+
+ ret = mars_context_destroy(mars);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+
+ return 0;
+}
diff --git a/tests/TFP/TFP_46_002/host_and_mpu.h b/tests/TFP/TFP_46_002/host_and_mpu.h
new file mode 100644
index 0000000..e565e93
--- /dev/null
+++ b/tests/TFP/TFP_46_002/host_and_mpu.h
@@ -0,0 +1,24 @@
+/*
+ * Copyright 2008 Sony Corporation
+ *
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a copy
+ * of this software and associated documentation files (the "Software"), to deal
+ * in the Software without restriction, including without limitation the rights
+ * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+ * copies of the Software, and to permit persons to whom the Software is
+ * furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included in
+ * all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+ * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+ * THE SOFTWARE.
+ */
+
+#define QUEUE_DEPTH 16
diff --git a/tests/TFP/TFP_46_002/mpu1.c b/tests/TFP/TFP_46_002/mpu1.c
new file mode 100644
index 0000000..3a4cd20
--- /dev/null
+++ b/tests/TFP/TFP_46_002/mpu1.c
@@ -0,0 +1,56 @@
+/*
+ * Copyright 2008 Sony Corporation
+ *
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a copy
+ * of this software and associated documentation files (the "Software"), to deal
+ * in the Software without restriction, including without limitation the rights
+ * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+ * copies of the Software, and to permit persons to whom the Software is
+ * furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included in
+ * all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+ * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+ * THE SOFTWARE.
+ */
+
+#include <string.h>
+#include <spu_mfcio.h>
+#include <mars/mars.h>
+#include "mars_task_test.h"
+#include "host_and_mpu.h"
+
+static uint64_t queue_item[2] __attribute__((aligned(16)));
+
+int mars_task_main(const struct mars_task_args *task_args)
+{
+ uint64_t queue_ea = task_args->type.u64[0];
+ uint64_t mpu_answer_ea = task_args->type.u64[1];
+ int i, ret;
+
+ for (i = 0; i < QUEUE_DEPTH+1; i++) {
+ queue_item[0] = queue_item[1] = i;
+
+ ret = mars_task_queue_push_begin(
+ queue_ea,
+ queue_item,
+ 0);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+
+ ret = mars_task_queue_push_end(queue_ea, 0);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+ }
+
+ mars_test_int64_put(mpu_answer_ea, 1);
+
+ mars_task_exit(0);
+
+ return 0;
+}
diff --git a/tests/TFP/TFP_46_002/mpu2.c b/tests/TFP/TFP_46_002/mpu2.c
new file mode 100644
index 0000000..278e416
--- /dev/null
+++ b/tests/TFP/TFP_46_002/mpu2.c
@@ -0,0 +1,58 @@
+/*
+ * Copyright 2008 Sony Corporation
+ *
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a copy
+ * of this software and associated documentation files (the "Software"), to deal
+ * in the Software without restriction, including without limitation the rights
+ * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+ * copies of the Software, and to permit persons to whom the Software is
+ * furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included in
+ * all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+ * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+ * THE SOFTWARE.
+ */
+
+#include <string.h>
+#include <spu_mfcio.h>
+#include <mars/mars.h>
+#include "mars_task_test.h"
+#include "host_and_mpu.h"
+
+static uint64_t queue_item[2] __attribute__((aligned(16)));
+
+int mars_task_main(const struct mars_task_args *task_args)
+{
+ uint64_t queue_ea = task_args->type.u64[0];
+ uint64_t mpu_answer_ea = task_args->type.u64[1];
+ uint32_t tb_freq = task_args->type.u64[2];
+ int i, ret;
+
+ uint64_t mpu_answer;
+
+ mars_test_usleep(tb_freq, 100000);
+
+ mpu_answer = mars_test_int64_get(mpu_answer_ea);
+ MARS_TEST_ASSERT_EQUAL(mpu_answer, 0);
+
+ for (i = 0; i < QUEUE_DEPTH+1; i++) {
+ ret = mars_task_queue_pop(queue_ea, queue_item);
+
+ MARS_TEST_ASSERT(queue_item[0] == i && queue_item[1] == i);
+ }
+
+ mpu_answer = mars_test_int64_get(mpu_answer_ea);
+ MARS_TEST_ASSERT(mpu_answer);
+
+ mars_task_exit(0);
+
+ return 0;
+}
diff --git a/tests/TFP/TFP_46_003/Makefile b/tests/TFP/TFP_46_003/Makefile
new file mode 100644
index 0000000..432135a
--- /dev/null
+++ b/tests/TFP/TFP_46_003/Makefile
@@ -0,0 +1,28 @@
+#
+# Copyright 2008 Sony Corporation
+#
+#
+# Permission is hereby granted, free of charge, to any person obtaining a copy
+# of this software and associated documentation files (the "Software"), to deal
+# in the Software without restriction, including without limitation the rights
+# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+# copies of the Software, and to permit persons to whom the Software is
+# furnished to do so, subject to the following conditions:
+#
+# The above copyright notice and this permission notice shall be included in
+# all copies or substantial portions of the Software.
+#
+# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+# THE SOFTWARE.
+#
+
+top_srcdir = ../..
+test_objs = host.o mpu.task_eo
+
+include $(top_srcdir)/scripts/config.mk
+include $(top_srcdir)/scripts/rules_item.mk
diff --git a/tests/TFP/TFP_46_003/host.c b/tests/TFP/TFP_46_003/host.c
new file mode 100644
index 0000000..bc011fe
--- /dev/null
+++ b/tests/TFP/TFP_46_003/host.c
@@ -0,0 +1,108 @@
+/*
+ * Copyright 2008 Sony Corporation
+ *
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a copy
+ * of this software and associated documentation files (the "Software"), to deal
+ * in the Software without restriction, including without limitation the rights
+ * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+ * copies of the Software, and to permit persons to whom the Software is
+ * furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included in
+ * all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+ * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+ * THE SOFTWARE.
+ */
+
+#include <unistd.h>
+#include <mars/mars.h>
+#include <libspe2.h>
+#include <mars_test.h>
+
+struct queue_entry {
+ uint64_t val;
+ uint64_t pad;
+};
+#define Q_DEPTH (256 * 1024)
+
+#define NUM_LOOP 3
+static uint32_t depth_size[] =
+{
+ 1,
+ Q_DEPTH / 2,
+ Q_DEPTH
+};
+extern spe_program_handle_t mpu_prog;
+
+static struct mars_context *mars_ctx;
+static struct mars_task_args task_args;
+static struct mars_task_id task_id;
+
+static uint64_t mpu_to_host[NUM_LOOP];
+static struct queue_entry data;
+
+static uint32_t shared_resource __attribute((aligned(16)));
+
+int main(void)
+{
+ int ret, i;
+ int32_t exit_code;
+
+ ret = mars_context_create(&mars_ctx, 0, 0);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+
+ for (i = 0; i < NUM_LOOP; i++) {
+ shared_resource = 0;
+
+ ret = mars_task_queue_create(
+ mars_ctx,
+ &mpu_to_host[i],
+ sizeof(struct queue_entry),
+ depth_size[i],
+ MARS_TASK_QUEUE_MPU_TO_HOST);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+
+ /* create push task */
+ ret = mars_task_create(mars_ctx, &task_id, NULL,
+ mpu_prog.elf_image, MARS_TASK_CONTEXT_SAVE_ALL);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+
+ task_args.type.u64[0] = mpu_to_host[i];
+ task_args.type.u64[1] = (uint64_t)depth_size[i];
+ task_args.type.u64[2] = mars_ptr_to_ea(&shared_resource);
+ ret = mars_task_schedule(&task_id, &task_args, 0);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+
+ /* check if queue push is blocked in mpu task */
+ sleep(1);
+ MARS_TEST_ASSERT_EQUAL(shared_resource, 0);
+
+ /* pop one */
+ ret = mars_task_queue_pop(mpu_to_host[i], &data);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+
+ /* check if mpu task is successfly finished */
+ ret = mars_task_wait(&task_id, &exit_code);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+ MARS_TEST_ASSERT_ERROR(exit_code, MARS_SUCCESS);
+
+ ret = mars_task_destroy(&task_id);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+
+ ret = mars_task_queue_destroy(mpu_to_host[i]);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+ }
+
+ ret = mars_context_destroy(mars_ctx);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+
+ return 0;
+}
+
diff --git a/tests/TFP/TFP_46_003/mpu.c b/tests/TFP/TFP_46_003/mpu.c
new file mode 100644
index 0000000..04f7059
--- /dev/null
+++ b/tests/TFP/TFP_46_003/mpu.c
@@ -0,0 +1,59 @@
+/*
+ * Copyright 2008 Sony Corporation
+ *
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a copy
+ * of this software and associated documentation files (the "Software"), to deal
+ * in the Software without restriction, including without limitation the rights
+ * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+ * copies of the Software, and to permit persons to whom the Software is
+ * furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included in
+ * all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+ * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+ * THE SOFTWARE.
+ */
+
+#include <mars/mars.h>
+#include <mars_task_test.h>
+#include <spu_mfcio.h>
+
+struct queue_entry {
+ uint64_t val;
+ uint64_t pad;
+};
+static struct queue_entry data;
+static uint32_t shared_resource __attribute((aligned(16)));
+
+int mars_task_main(const struct mars_task_args *task_args)
+{
+ int ret, i;
+ uint64_t mpu_to_host_ea = task_args->type.u64[0];
+ uint32_t num_push = (uint32_t)task_args->type.u64[1];
+ uint64_t shared_resource_ea = task_args->type.u64[2];
+
+ /* last one push should be blocked */
+ for (i = 0; i < num_push + 1; i++) {
+ ret = mars_task_queue_push_begin(mpu_to_host_ea, &data, 1);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+
+ ret = mars_task_queue_push_end(mpu_to_host_ea, 1);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+ }
+
+ /* if the program reaches here, shared_resource'll be updated */
+ shared_resource = 1;
+ mfc_put(&shared_resource, shared_resource_ea,
+ sizeof(uint32_t), 0, 0, 0);
+ mfc_write_tag_mask(1 << 0);
+ mfc_read_tag_status_all();
+
+ return 0;
+}
diff --git a/tests/TFP/TFP_46_004/Makefile b/tests/TFP/TFP_46_004/Makefile
new file mode 100644
index 0000000..ecbce33
--- /dev/null
+++ b/tests/TFP/TFP_46_004/Makefile
@@ -0,0 +1,28 @@
+#
+# Copyright 2008 Sony Corporation
+#
+#
+# Permission is hereby granted, free of charge, to any person obtaining a copy
+# of this software and associated documentation files (the "Software"), to deal
+# in the Software without restriction, including without limitation the rights
+# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+# copies of the Software, and to permit persons to whom the Software is
+# furnished to do so, subject to the following conditions:
+#
+# The above copyright notice and this permission notice shall be included in
+# all copies or substantial portions of the Software.
+#
+# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+# THE SOFTWARE.
+#
+
+top_srcdir = ../..
+test_objs = host.o mpu1.task_eo mpu2.task_eo
+
+include $(top_srcdir)/scripts/config.mk
+include $(top_srcdir)/scripts/rules_item.mk
diff --git a/tests/TFP/TFP_46_004/host.c b/tests/TFP/TFP_46_004/host.c
new file mode 100644
index 0000000..4a350ec
--- /dev/null
+++ b/tests/TFP/TFP_46_004/host.c
@@ -0,0 +1,118 @@
+/*
+ * Copyright 2008 Sony Corporation
+ *
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a copy
+ * of this software and associated documentation files (the "Software"), to deal
+ * in the Software without restriction, including without limitation the rights
+ * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+ * copies of the Software, and to permit persons to whom the Software is
+ * furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included in
+ * all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+ * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+ * THE SOFTWARE.
+ */
+
+#include <unistd.h>
+#include <mars/mars.h>
+#include <libspe2.h>
+#include <mars_test.h>
+
+struct queue_entry {
+ uint64_t val;
+ uint64_t pad;
+};
+#define Q_DEPTH (256 * 1024)
+
+#define NUM_LOOP 2
+static uint32_t depth_size[] =
+{
+ 1,
+ Q_DEPTH
+};
+extern spe_program_handle_t mpu1_prog;
+extern spe_program_handle_t mpu2_prog;
+
+static struct mars_context *mars_ctx;
+static struct mars_task_args task1_args, task2_args;
+static struct mars_task_id task1_id, task2_id;
+
+static uint64_t mpu_to_mpu[NUM_LOOP];
+static uint32_t shared_resource __attribute((aligned(16)));
+
+int main(void)
+{
+ int ret, i;
+ int32_t exit_code;
+
+ ret = mars_context_create(&mars_ctx, 0, 0);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+
+ for (i = 0; i < NUM_LOOP; i++) {
+ shared_resource = 0;
+
+ ret = mars_task_queue_create(
+ mars_ctx,
+ &mpu_to_mpu[i],
+ sizeof(struct queue_entry),
+ depth_size[i],
+ MARS_TASK_QUEUE_MPU_TO_MPU);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+
+ /* create push task */
+ ret = mars_task_create(mars_ctx, &task1_id, NULL,
+ mpu1_prog.elf_image, MARS_TASK_CONTEXT_SAVE_ALL);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+
+ task1_args.type.u64[0] = mpu_to_mpu[i];
+ task1_args.type.u64[1] = (uint64_t)depth_size[i];
+ task1_args.type.u64[2] = mars_ptr_to_ea(&shared_resource);
+ ret = mars_task_schedule(&task1_id, &task1_args, 0);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+
+ /* check if queue_push is blocked */
+ sleep(1);
+ MARS_TEST_ASSERT_EQUAL(shared_resource, 0);
+
+ /* create and run pop task */
+ ret = mars_task_create(mars_ctx, &task2_id, NULL,
+ mpu2_prog.elf_image, MARS_TASK_CONTEXT_SAVE_ALL);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+
+ task2_args.type.u64[0] = mpu_to_mpu[i];
+ ret = mars_task_schedule(&task2_id, &task2_args, 0);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+
+ ret = mars_task_wait(&task2_id, &exit_code);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+ MARS_TEST_ASSERT_ERROR(exit_code, MARS_SUCCESS);
+
+ /* check if push task is successfly finished */
+ ret = mars_task_wait(&task1_id, &exit_code);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+ MARS_TEST_ASSERT_ERROR(exit_code, MARS_SUCCESS);
+
+ ret = mars_task_destroy(&task1_id);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+
+ ret = mars_task_destroy(&task2_id);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+
+ ret = mars_task_queue_destroy(mpu_to_mpu[i]);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+ }
+
+ ret = mars_context_destroy(mars_ctx);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+
+ return 0;
+}
+
diff --git a/tests/TFP/TFP_46_004/mpu1.c b/tests/TFP/TFP_46_004/mpu1.c
new file mode 100644
index 0000000..b94867e
--- /dev/null
+++ b/tests/TFP/TFP_46_004/mpu1.c
@@ -0,0 +1,59 @@
+/*
+ * Copyright 2008 Sony Corporation
+ *
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a copy
+ * of this software and associated documentation files (the "Software"), to deal
+ * in the Software without restriction, including without limitation the rights
+ * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+ * copies of the Software, and to permit persons to whom the Software is
+ * furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included in
+ * all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+ * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+ * THE SOFTWARE.
+ */
+
+#include <mars/mars.h>
+#include <mars_task_test.h>
+#include <spu_mfcio.h>
+
+struct queue_entry {
+ uint64_t val;
+ uint64_t pad;
+};
+static struct queue_entry data;
+static uint32_t shared_resource __attribute((aligned(16)));
+
+int mars_task_main(const struct mars_task_args *task_args)
+{
+ int ret, i;
+ uint64_t mpu_to_mpu_ea = task_args->type.u64[0];
+ uint32_t num_push = (uint32_t)task_args->type.u64[1];
+ uint64_t shared_resource_ea = task_args->type.u64[2];
+
+ /* last one push should be blocked */
+ for (i = 0; i < num_push + 1; i++) {
+ ret = mars_task_queue_push_begin(mpu_to_mpu_ea, &data, 1);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+
+ ret = mars_task_queue_push_end(mpu_to_mpu_ea, 1);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+ }
+
+ /* if the program reaches here, shared_resource'll be updated */
+ shared_resource = 1;
+ mfc_put(&shared_resource, shared_resource_ea,
+ sizeof(uint32_t), 0, 0, 0);
+ mfc_write_tag_mask(1 << 0);
+ mfc_read_tag_status_all();
+
+ return 0;
+}
diff --git a/tests/TFP/TFP_46_004/mpu2.c b/tests/TFP/TFP_46_004/mpu2.c
new file mode 100644
index 0000000..fe8da44
--- /dev/null
+++ b/tests/TFP/TFP_46_004/mpu2.c
@@ -0,0 +1,42 @@
+/*
+ * Copyright 2008 Sony Corporation
+ *
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a copy
+ * of this software and associated documentation files (the "Software"), to deal
+ * in the Software without restriction, including without limitation the rights
+ * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+ * copies of the Software, and to permit persons to whom the Software is
+ * furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included in
+ * all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+ * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+ * THE SOFTWARE.
+ */
+
+#include <mars/mars.h>
+#include <mars_task_test.h>
+
+struct queue_entry {
+ uint64_t val;
+ uint64_t pad;
+};
+static struct queue_entry data;
+
+int mars_task_main(const struct mars_task_args *task_args)
+{
+ int ret;
+ uint64_t mpu_to_mpu_ea = task_args->type.u64[0];
+
+ ret = mars_task_queue_pop(mpu_to_mpu_ea, &data);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+
+ return 0;
+}
diff --git a/tests/TFP/TFP_46_005/Makefile b/tests/TFP/TFP_46_005/Makefile
new file mode 100644
index 0000000..ecbce33
--- /dev/null
+++ b/tests/TFP/TFP_46_005/Makefile
@@ -0,0 +1,28 @@
+#
+# Copyright 2008 Sony Corporation
+#
+#
+# Permission is hereby granted, free of charge, to any person obtaining a copy
+# of this software and associated documentation files (the "Software"), to deal
+# in the Software without restriction, including without limitation the rights
+# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+# copies of the Software, and to permit persons to whom the Software is
+# furnished to do so, subject to the following conditions:
+#
+# The above copyright notice and this permission notice shall be included in
+# all copies or substantial portions of the Software.
+#
+# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+# THE SOFTWARE.
+#
+
+top_srcdir = ../..
+test_objs = host.o mpu1.task_eo mpu2.task_eo
+
+include $(top_srcdir)/scripts/config.mk
+include $(top_srcdir)/scripts/rules_item.mk
diff --git a/tests/TFP/TFP_46_005/host.c b/tests/TFP/TFP_46_005/host.c
new file mode 100644
index 0000000..4a350ec
--- /dev/null
+++ b/tests/TFP/TFP_46_005/host.c
@@ -0,0 +1,118 @@
+/*
+ * Copyright 2008 Sony Corporation
+ *
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a copy
+ * of this software and associated documentation files (the "Software"), to deal
+ * in the Software without restriction, including without limitation the rights
+ * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+ * copies of the Software, and to permit persons to whom the Software is
+ * furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included in
+ * all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+ * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+ * THE SOFTWARE.
+ */
+
+#include <unistd.h>
+#include <mars/mars.h>
+#include <libspe2.h>
+#include <mars_test.h>
+
+struct queue_entry {
+ uint64_t val;
+ uint64_t pad;
+};
+#define Q_DEPTH (256 * 1024)
+
+#define NUM_LOOP 2
+static uint32_t depth_size[] =
+{
+ 1,
+ Q_DEPTH
+};
+extern spe_program_handle_t mpu1_prog;
+extern spe_program_handle_t mpu2_prog;
+
+static struct mars_context *mars_ctx;
+static struct mars_task_args task1_args, task2_args;
+static struct mars_task_id task1_id, task2_id;
+
+static uint64_t mpu_to_mpu[NUM_LOOP];
+static uint32_t shared_resource __attribute((aligned(16)));
+
+int main(void)
+{
+ int ret, i;
+ int32_t exit_code;
+
+ ret = mars_context_create(&mars_ctx, 0, 0);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+
+ for (i = 0; i < NUM_LOOP; i++) {
+ shared_resource = 0;
+
+ ret = mars_task_queue_create(
+ mars_ctx,
+ &mpu_to_mpu[i],
+ sizeof(struct queue_entry),
+ depth_size[i],
+ MARS_TASK_QUEUE_MPU_TO_MPU);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+
+ /* create push task */
+ ret = mars_task_create(mars_ctx, &task1_id, NULL,
+ mpu1_prog.elf_image, MARS_TASK_CONTEXT_SAVE_ALL);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+
+ task1_args.type.u64[0] = mpu_to_mpu[i];
+ task1_args.type.u64[1] = (uint64_t)depth_size[i];
+ task1_args.type.u64[2] = mars_ptr_to_ea(&shared_resource);
+ ret = mars_task_schedule(&task1_id, &task1_args, 0);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+
+ /* check if queue_push is blocked */
+ sleep(1);
+ MARS_TEST_ASSERT_EQUAL(shared_resource, 0);
+
+ /* create and run pop task */
+ ret = mars_task_create(mars_ctx, &task2_id, NULL,
+ mpu2_prog.elf_image, MARS_TASK_CONTEXT_SAVE_ALL);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+
+ task2_args.type.u64[0] = mpu_to_mpu[i];
+ ret = mars_task_schedule(&task2_id, &task2_args, 0);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+
+ ret = mars_task_wait(&task2_id, &exit_code);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+ MARS_TEST_ASSERT_ERROR(exit_code, MARS_SUCCESS);
+
+ /* check if push task is successfly finished */
+ ret = mars_task_wait(&task1_id, &exit_code);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+ MARS_TEST_ASSERT_ERROR(exit_code, MARS_SUCCESS);
+
+ ret = mars_task_destroy(&task1_id);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+
+ ret = mars_task_destroy(&task2_id);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+
+ ret = mars_task_queue_destroy(mpu_to_mpu[i]);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+ }
+
+ ret = mars_context_destroy(mars_ctx);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+
+ return 0;
+}
+
diff --git a/tests/TFP/TFP_46_005/mpu1.c b/tests/TFP/TFP_46_005/mpu1.c
new file mode 100644
index 0000000..b94867e
--- /dev/null
+++ b/tests/TFP/TFP_46_005/mpu1.c
@@ -0,0 +1,59 @@
+/*
+ * Copyright 2008 Sony Corporation
+ *
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a copy
+ * of this software and associated documentation files (the "Software"), to deal
+ * in the Software without restriction, including without limitation the rights
+ * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+ * copies of the Software, and to permit persons to whom the Software is
+ * furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included in
+ * all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+ * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+ * THE SOFTWARE.
+ */
+
+#include <mars/mars.h>
+#include <mars_task_test.h>
+#include <spu_mfcio.h>
+
+struct queue_entry {
+ uint64_t val;
+ uint64_t pad;
+};
+static struct queue_entry data;
+static uint32_t shared_resource __attribute((aligned(16)));
+
+int mars_task_main(const struct mars_task_args *task_args)
+{
+ int ret, i;
+ uint64_t mpu_to_mpu_ea = task_args->type.u64[0];
+ uint32_t num_push = (uint32_t)task_args->type.u64[1];
+ uint64_t shared_resource_ea = task_args->type.u64[2];
+
+ /* last one push should be blocked */
+ for (i = 0; i < num_push + 1; i++) {
+ ret = mars_task_queue_push_begin(mpu_to_mpu_ea, &data, 1);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+
+ ret = mars_task_queue_push_end(mpu_to_mpu_ea, 1);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+ }
+
+ /* if the program reaches here, shared_resource'll be updated */
+ shared_resource = 1;
+ mfc_put(&shared_resource, shared_resource_ea,
+ sizeof(uint32_t), 0, 0, 0);
+ mfc_write_tag_mask(1 << 0);
+ mfc_read_tag_status_all();
+
+ return 0;
+}
diff --git a/tests/TFP/TFP_46_005/mpu2.c b/tests/TFP/TFP_46_005/mpu2.c
new file mode 100644
index 0000000..2770f9d
--- /dev/null
+++ b/tests/TFP/TFP_46_005/mpu2.c
@@ -0,0 +1,45 @@
+/*
+ * Copyright 2008 Sony Corporation
+ *
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a copy
+ * of this software and associated documentation files (the "Software"), to deal
+ * in the Software without restriction, including without limitation the rights
+ * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+ * copies of the Software, and to permit persons to whom the Software is
+ * furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included in
+ * all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+ * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+ * THE SOFTWARE.
+ */
+
+#include <mars/mars.h>
+#include <mars_task_test.h>
+
+struct queue_entry {
+ uint64_t val;
+ uint64_t pad;
+};
+static struct queue_entry data;
+
+int mars_task_main(const struct mars_task_args *task_args)
+{
+ int ret;
+ uint64_t mpu_to_mpu_ea = task_args->type.u64[0];
+
+ ret = mars_task_queue_pop_begin(mpu_to_mpu_ea, &data, 1);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+
+ ret = mars_task_queue_pop_end(mpu_to_mpu_ea, 1);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+
+ return 0;
+}
diff --git a/tests/TFP/TFP_46_007/Makefile b/tests/TFP/TFP_46_007/Makefile
new file mode 100644
index 0000000..432135a
--- /dev/null
+++ b/tests/TFP/TFP_46_007/Makefile
@@ -0,0 +1,28 @@
+#
+# Copyright 2008 Sony Corporation
+#
+#
+# Permission is hereby granted, free of charge, to any person obtaining a copy
+# of this software and associated documentation files (the "Software"), to deal
+# in the Software without restriction, including without limitation the rights
+# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+# copies of the Software, and to permit persons to whom the Software is
+# furnished to do so, subject to the following conditions:
+#
+# The above copyright notice and this permission notice shall be included in
+# all copies or substantial portions of the Software.
+#
+# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+# THE SOFTWARE.
+#
+
+top_srcdir = ../..
+test_objs = host.o mpu.task_eo
+
+include $(top_srcdir)/scripts/config.mk
+include $(top_srcdir)/scripts/rules_item.mk
diff --git a/tests/TFP/TFP_46_007/host.c b/tests/TFP/TFP_46_007/host.c
new file mode 100644
index 0000000..163db06
--- /dev/null
+++ b/tests/TFP/TFP_46_007/host.c
@@ -0,0 +1,140 @@
+/*
+ * Copyright 2008 Sony Corporation
+ *
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a copy
+ * of this software and associated documentation files (the "Software"), to deal
+ * in the Software without restriction, including without limitation the rights
+ * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+ * copies of the Software, and to permit persons to whom the Software is
+ * furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included in
+ * all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+ * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+ * THE SOFTWARE.
+ */
+
+#include <unistd.h>
+#include <mars/mars.h>
+#include <libspe2.h>
+#include <mars_test.h>
+
+struct queue_entry {
+ uint64_t val1;
+ uint64_t val2;
+};
+#define Q_DEPTH (512)
+
+#define NUM_LOOP 5
+static uint32_t depth_size[] =
+{
+ 1,
+ Q_DEPTH / 2,
+ Q_DEPTH,
+ Q_DEPTH,
+ Q_DEPTH
+};
+extern spe_program_handle_t mpu_prog;
+
+static struct mars_context *mars_ctx;
+static struct mars_task_args task_args;
+static struct mars_task_id task_id[Q_DEPTH];
+
+static uint64_t mpu_to_host[NUM_LOOP];
+static uint32_t notify[32] __attribute((aligned(128)));
+static struct queue_entry data;
+
+static void check_queue(uint64_t id, uint64_t num)
+{
+ int ret, i;
+ uint64_t sum, sum_q;
+ uint32_t count;
+
+ sum = sum_q = 0;
+ for (i = 0; i < num; i++) {
+ ret = mars_task_queue_pop(mpu_to_host[id], &data);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+
+ MARS_TEST_ASSERT_EQUAL(data.val1, id);
+ sum += i;
+ sum_q += data.val2;
+ }
+ /* check queue data */
+ MARS_TEST_ASSERT_EQUAL(sum, sum_q);
+
+ /* queue should be empty */
+ ret = mars_task_queue_count(mpu_to_host[id], &count);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+ MARS_TEST_ASSERT_EQUAL(count, 0);
+}
+
+int main(void)
+{
+ int ret, i;
+ int32_t exit_code;
+ uint32_t num;
+
+ ret = mars_context_create(&mars_ctx, 0, 0);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+
+ for (i = 0; i < NUM_LOOP; i++) {
+ notify[0] = 0;
+
+ ret = mars_task_queue_create(
+ mars_ctx,
+ &mpu_to_host[i],
+ sizeof(struct queue_entry),
+ depth_size[i],
+ MARS_TASK_QUEUE_MPU_TO_HOST);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+
+ /* create push task */
+ for (num = 0; num < depth_size[i]; num++) {
+ ret = mars_task_create(mars_ctx, &task_id[num], NULL,
+ mpu_prog.elf_image,
+ MARS_TASK_CONTEXT_SAVE_ALL);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+
+ task_args.type.u64[0] = mpu_to_host[i];
+ task_args.type.u64[1] = (uint64_t)i;
+ task_args.type.u64[2] = (uint64_t)num;
+ task_args.type.u64[3] = mars_ptr_to_ea(&notify);
+ ret = mars_task_schedule(&task_id[num], &task_args, 0);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+ }
+
+ /* start mpu task at the same time */
+ sleep(1);
+ mars_test_counter_set(&notify[0], 1);
+
+ for (num = 0; num < depth_size[i]; num++) {
+ ret = mars_task_wait(&task_id[num], &exit_code);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+ MARS_TEST_ASSERT_ERROR(exit_code, MARS_SUCCESS);
+ }
+
+ /* check queue data */
+ check_queue(i, depth_size[i]);
+
+ for (num = 0; num < depth_size[i]; num++) {
+ ret = mars_task_destroy(&task_id[num]);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+ }
+
+ ret = mars_task_queue_destroy(mpu_to_host[i]);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+ }
+
+ ret = mars_context_destroy(mars_ctx);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+
+ return 0;
+}
+
diff --git a/tests/TFP/TFP_46_007/mpu.c b/tests/TFP/TFP_46_007/mpu.c
new file mode 100644
index 0000000..febd58c
--- /dev/null
+++ b/tests/TFP/TFP_46_007/mpu.c
@@ -0,0 +1,54 @@
+/*
+ * Copyright 2008 Sony Corporation
+ *
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a copy
+ * of this software and associated documentation files (the "Software"), to deal
+ * in the Software without restriction, including without limitation the rights
+ * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+ * copies of the Software, and to permit persons to whom the Software is
+ * furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included in
+ * all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+ * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+ * THE SOFTWARE.
+ */
+
+#include <mars/mars.h>
+#include <mars_task_test.h>
+#include <spu_mfcio.h>
+
+struct queue_entry {
+ uint64_t val1;
+ uint64_t val2;
+};
+static struct queue_entry data;
+
+int mars_task_main(const struct mars_task_args *task_args)
+{
+ int ret;
+ uint64_t mpu_to_host_ea = task_args->type.u64[0];
+ uint64_t id = task_args->type.u64[1];
+ uint64_t num = task_args->type.u64[2];
+ uint64_t notify_ea = task_args->type.u64[3];
+
+ data.val1 = id;
+ data.val2 = num;
+
+ mars_test_counter_wait(notify_ea, 1);
+
+ ret = mars_task_queue_push_begin(mpu_to_host_ea, &data, 1);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+
+ ret = mars_task_queue_push_end(mpu_to_host_ea, 1);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+
+ return 0;
+}
diff --git a/tests/TFP/TFP_46_008/Makefile b/tests/TFP/TFP_46_008/Makefile
new file mode 100644
index 0000000..432135a
--- /dev/null
+++ b/tests/TFP/TFP_46_008/Makefile
@@ -0,0 +1,28 @@
+#
+# Copyright 2008 Sony Corporation
+#
+#
+# Permission is hereby granted, free of charge, to any person obtaining a copy
+# of this software and associated documentation files (the "Software"), to deal
+# in the Software without restriction, including without limitation the rights
+# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+# copies of the Software, and to permit persons to whom the Software is
+# furnished to do so, subject to the following conditions:
+#
+# The above copyright notice and this permission notice shall be included in
+# all copies or substantial portions of the Software.
+#
+# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+# THE SOFTWARE.
+#
+
+top_srcdir = ../..
+test_objs = host.o mpu.task_eo
+
+include $(top_srcdir)/scripts/config.mk
+include $(top_srcdir)/scripts/rules_item.mk
diff --git a/tests/TFP/TFP_46_008/host.c b/tests/TFP/TFP_46_008/host.c
new file mode 100644
index 0000000..51d4744
--- /dev/null
+++ b/tests/TFP/TFP_46_008/host.c
@@ -0,0 +1,108 @@
+/*
+ * Copyright 2008 Sony Corporation
+ *
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a copy
+ * of this software and associated documentation files (the "Software"), to deal
+ * in the Software without restriction, including without limitation the rights
+ * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+ * copies of the Software, and to permit persons to whom the Software is
+ * furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included in
+ * all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+ * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+ * THE SOFTWARE.
+ */
+
+#include <unistd.h>
+#include <mars/mars.h>
+#include <libspe2.h>
+#include <mars_test.h>
+
+struct queue_entry {
+ uint64_t val;
+ uint64_t pad;
+};
+#define Q_DEPTH (256 * 1024)
+
+#define NUM_LOOP 3
+static uint32_t depth_size[] =
+{
+ 1,
+ Q_DEPTH / 2,
+ Q_DEPTH
+};
+extern spe_program_handle_t mpu_prog;
+
+static struct mars_context *mars_ctx;
+static struct mars_task_args task_args;
+static struct mars_task_id task_id;
+
+static uint64_t mpu_to_host[NUM_LOOP];
+static struct queue_entry data;
+
+static uint32_t shared_resource __attribute((aligned(16)));
+
+int main(void)
+{
+ int ret, i;
+ int32_t exit_code;
+
+ ret = mars_context_create(&mars_ctx, 0, 0);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+
+ for (i = 0; i < NUM_LOOP; i++) {
+ shared_resource = 0;
+
+ ret = mars_task_queue_create(
+ mars_ctx,
+ &mpu_to_host[i],
+ sizeof(struct queue_entry),
+ depth_size[i],
+ MARS_TASK_QUEUE_MPU_TO_HOST);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+
+ /* create push task */
+ ret = mars_task_create(mars_ctx, &task_id, NULL,
+ mpu_prog.elf_image, MARS_TASK_CONTEXT_SAVE_ALL);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+
+ task_args.type.u64[0] = mpu_to_host[i];
+ task_args.type.u64[1] = (uint64_t)depth_size[i];
+ task_args.type.u64[2] = mars_ptr_to_ea(&shared_resource);
+ ret = mars_task_schedule(&task_id, &task_args, 0);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+
+ /* check if queue push is blocked in mpu task */
+ sleep(1);
+ MARS_TEST_ASSERT_EQUAL(shared_resource, 0);
+
+ /* try pop one */
+ ret = mars_task_queue_try_pop(mpu_to_host[i], &data);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+
+ /* check if mpu task is successfly finished */
+ ret = mars_task_wait(&task_id, &exit_code);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+ MARS_TEST_ASSERT_ERROR(exit_code, MARS_SUCCESS);
+
+ ret = mars_task_destroy(&task_id);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+
+ ret = mars_task_queue_destroy(mpu_to_host[i]);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+ }
+
+ ret = mars_context_destroy(mars_ctx);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+
+ return 0;
+}
+
diff --git a/tests/TFP/TFP_46_008/mpu.c b/tests/TFP/TFP_46_008/mpu.c
new file mode 100644
index 0000000..04f7059
--- /dev/null
+++ b/tests/TFP/TFP_46_008/mpu.c
@@ -0,0 +1,59 @@
+/*
+ * Copyright 2008 Sony Corporation
+ *
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a copy
+ * of this software and associated documentation files (the "Software"), to deal
+ * in the Software without restriction, including without limitation the rights
+ * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+ * copies of the Software, and to permit persons to whom the Software is
+ * furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included in
+ * all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+ * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+ * THE SOFTWARE.
+ */
+
+#include <mars/mars.h>
+#include <mars_task_test.h>
+#include <spu_mfcio.h>
+
+struct queue_entry {
+ uint64_t val;
+ uint64_t pad;
+};
+static struct queue_entry data;
+static uint32_t shared_resource __attribute((aligned(16)));
+
+int mars_task_main(const struct mars_task_args *task_args)
+{
+ int ret, i;
+ uint64_t mpu_to_host_ea = task_args->type.u64[0];
+ uint32_t num_push = (uint32_t)task_args->type.u64[1];
+ uint64_t shared_resource_ea = task_args->type.u64[2];
+
+ /* last one push should be blocked */
+ for (i = 0; i < num_push + 1; i++) {
+ ret = mars_task_queue_push_begin(mpu_to_host_ea, &data, 1);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+
+ ret = mars_task_queue_push_end(mpu_to_host_ea, 1);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+ }
+
+ /* if the program reaches here, shared_resource'll be updated */
+ shared_resource = 1;
+ mfc_put(&shared_resource, shared_resource_ea,
+ sizeof(uint32_t), 0, 0, 0);
+ mfc_write_tag_mask(1 << 0);
+ mfc_read_tag_status_all();
+
+ return 0;
+}
diff --git a/tests/TFP/TFP_46_009/Makefile b/tests/TFP/TFP_46_009/Makefile
new file mode 100644
index 0000000..ecbce33
--- /dev/null
+++ b/tests/TFP/TFP_46_009/Makefile
@@ -0,0 +1,28 @@
+#
+# Copyright 2008 Sony Corporation
+#
+#
+# Permission is hereby granted, free of charge, to any person obtaining a copy
+# of this software and associated documentation files (the "Software"), to deal
+# in the Software without restriction, including without limitation the rights
+# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+# copies of the Software, and to permit persons to whom the Software is
+# furnished to do so, subject to the following conditions:
+#
+# The above copyright notice and this permission notice shall be included in
+# all copies or substantial portions of the Software.
+#
+# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+# THE SOFTWARE.
+#
+
+top_srcdir = ../..
+test_objs = host.o mpu1.task_eo mpu2.task_eo
+
+include $(top_srcdir)/scripts/config.mk
+include $(top_srcdir)/scripts/rules_item.mk
diff --git a/tests/TFP/TFP_46_009/host.c b/tests/TFP/TFP_46_009/host.c
new file mode 100644
index 0000000..4a350ec
--- /dev/null
+++ b/tests/TFP/TFP_46_009/host.c
@@ -0,0 +1,118 @@
+/*
+ * Copyright 2008 Sony Corporation
+ *
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a copy
+ * of this software and associated documentation files (the "Software"), to deal
+ * in the Software without restriction, including without limitation the rights
+ * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+ * copies of the Software, and to permit persons to whom the Software is
+ * furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included in
+ * all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+ * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+ * THE SOFTWARE.
+ */
+
+#include <unistd.h>
+#include <mars/mars.h>
+#include <libspe2.h>
+#include <mars_test.h>
+
+struct queue_entry {
+ uint64_t val;
+ uint64_t pad;
+};
+#define Q_DEPTH (256 * 1024)
+
+#define NUM_LOOP 2
+static uint32_t depth_size[] =
+{
+ 1,
+ Q_DEPTH
+};
+extern spe_program_handle_t mpu1_prog;
+extern spe_program_handle_t mpu2_prog;
+
+static struct mars_context *mars_ctx;
+static struct mars_task_args task1_args, task2_args;
+static struct mars_task_id task1_id, task2_id;
+
+static uint64_t mpu_to_mpu[NUM_LOOP];
+static uint32_t shared_resource __attribute((aligned(16)));
+
+int main(void)
+{
+ int ret, i;
+ int32_t exit_code;
+
+ ret = mars_context_create(&mars_ctx, 0, 0);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+
+ for (i = 0; i < NUM_LOOP; i++) {
+ shared_resource = 0;
+
+ ret = mars_task_queue_create(
+ mars_ctx,
+ &mpu_to_mpu[i],
+ sizeof(struct queue_entry),
+ depth_size[i],
+ MARS_TASK_QUEUE_MPU_TO_MPU);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+
+ /* create push task */
+ ret = mars_task_create(mars_ctx, &task1_id, NULL,
+ mpu1_prog.elf_image, MARS_TASK_CONTEXT_SAVE_ALL);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+
+ task1_args.type.u64[0] = mpu_to_mpu[i];
+ task1_args.type.u64[1] = (uint64_t)depth_size[i];
+ task1_args.type.u64[2] = mars_ptr_to_ea(&shared_resource);
+ ret = mars_task_schedule(&task1_id, &task1_args, 0);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+
+ /* check if queue_push is blocked */
+ sleep(1);
+ MARS_TEST_ASSERT_EQUAL(shared_resource, 0);
+
+ /* create and run pop task */
+ ret = mars_task_create(mars_ctx, &task2_id, NULL,
+ mpu2_prog.elf_image, MARS_TASK_CONTEXT_SAVE_ALL);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+
+ task2_args.type.u64[0] = mpu_to_mpu[i];
+ ret = mars_task_schedule(&task2_id, &task2_args, 0);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+
+ ret = mars_task_wait(&task2_id, &exit_code);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+ MARS_TEST_ASSERT_ERROR(exit_code, MARS_SUCCESS);
+
+ /* check if push task is successfly finished */
+ ret = mars_task_wait(&task1_id, &exit_code);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+ MARS_TEST_ASSERT_ERROR(exit_code, MARS_SUCCESS);
+
+ ret = mars_task_destroy(&task1_id);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+
+ ret = mars_task_destroy(&task2_id);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+
+ ret = mars_task_queue_destroy(mpu_to_mpu[i]);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+ }
+
+ ret = mars_context_destroy(mars_ctx);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+
+ return 0;
+}
+
diff --git a/tests/TFP/TFP_46_009/mpu1.c b/tests/TFP/TFP_46_009/mpu1.c
new file mode 100644
index 0000000..b94867e
--- /dev/null
+++ b/tests/TFP/TFP_46_009/mpu1.c
@@ -0,0 +1,59 @@
+/*
+ * Copyright 2008 Sony Corporation
+ *
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a copy
+ * of this software and associated documentation files (the "Software"), to deal
+ * in the Software without restriction, including without limitation the rights
+ * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+ * copies of the Software, and to permit persons to whom the Software is
+ * furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included in
+ * all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+ * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+ * THE SOFTWARE.
+ */
+
+#include <mars/mars.h>
+#include <mars_task_test.h>
+#include <spu_mfcio.h>
+
+struct queue_entry {
+ uint64_t val;
+ uint64_t pad;
+};
+static struct queue_entry data;
+static uint32_t shared_resource __attribute((aligned(16)));
+
+int mars_task_main(const struct mars_task_args *task_args)
+{
+ int ret, i;
+ uint64_t mpu_to_mpu_ea = task_args->type.u64[0];
+ uint32_t num_push = (uint32_t)task_args->type.u64[1];
+ uint64_t shared_resource_ea = task_args->type.u64[2];
+
+ /* last one push should be blocked */
+ for (i = 0; i < num_push + 1; i++) {
+ ret = mars_task_queue_push_begin(mpu_to_mpu_ea, &data, 1);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+
+ ret = mars_task_queue_push_end(mpu_to_mpu_ea, 1);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+ }
+
+ /* if the program reaches here, shared_resource'll be updated */
+ shared_resource = 1;
+ mfc_put(&shared_resource, shared_resource_ea,
+ sizeof(uint32_t), 0, 0, 0);
+ mfc_write_tag_mask(1 << 0);
+ mfc_read_tag_status_all();
+
+ return 0;
+}
diff --git a/tests/TFP/TFP_46_009/mpu2.c b/tests/TFP/TFP_46_009/mpu2.c
new file mode 100644
index 0000000..89852d8
--- /dev/null
+++ b/tests/TFP/TFP_46_009/mpu2.c
@@ -0,0 +1,42 @@
+/*
+ * Copyright 2008 Sony Corporation
+ *
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a copy
+ * of this software and associated documentation files (the "Software"), to deal
+ * in the Software without restriction, including without limitation the rights
+ * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+ * copies of the Software, and to permit persons to whom the Software is
+ * furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included in
+ * all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+ * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+ * THE SOFTWARE.
+ */
+
+#include <mars/mars.h>
+#include <mars_task_test.h>
+
+struct queue_entry {
+ uint64_t val;
+ uint64_t pad;
+};
+static struct queue_entry data;
+
+int mars_task_main(const struct mars_task_args *task_args)
+{
+ int ret;
+ uint64_t mpu_to_mpu_ea = task_args->type.u64[0];
+
+ ret = mars_task_queue_try_pop(mpu_to_mpu_ea, &data);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+
+ return 0;
+}
diff --git a/tests/TFP/TFP_46_010/Makefile b/tests/TFP/TFP_46_010/Makefile
new file mode 100644
index 0000000..ecbce33
--- /dev/null
+++ b/tests/TFP/TFP_46_010/Makefile
@@ -0,0 +1,28 @@
+#
+# Copyright 2008 Sony Corporation
+#
+#
+# Permission is hereby granted, free of charge, to any person obtaining a copy
+# of this software and associated documentation files (the "Software"), to deal
+# in the Software without restriction, including without limitation the rights
+# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+# copies of the Software, and to permit persons to whom the Software is
+# furnished to do so, subject to the following conditions:
+#
+# The above copyright notice and this permission notice shall be included in
+# all copies or substantial portions of the Software.
+#
+# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+# THE SOFTWARE.
+#
+
+top_srcdir = ../..
+test_objs = host.o mpu1.task_eo mpu2.task_eo
+
+include $(top_srcdir)/scripts/config.mk
+include $(top_srcdir)/scripts/rules_item.mk
diff --git a/tests/TFP/TFP_46_010/host.c b/tests/TFP/TFP_46_010/host.c
new file mode 100644
index 0000000..4a350ec
--- /dev/null
+++ b/tests/TFP/TFP_46_010/host.c
@@ -0,0 +1,118 @@
+/*
+ * Copyright 2008 Sony Corporation
+ *
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a copy
+ * of this software and associated documentation files (the "Software"), to deal
+ * in the Software without restriction, including without limitation the rights
+ * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+ * copies of the Software, and to permit persons to whom the Software is
+ * furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included in
+ * all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+ * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+ * THE SOFTWARE.
+ */
+
+#include <unistd.h>
+#include <mars/mars.h>
+#include <libspe2.h>
+#include <mars_test.h>
+
+struct queue_entry {
+ uint64_t val;
+ uint64_t pad;
+};
+#define Q_DEPTH (256 * 1024)
+
+#define NUM_LOOP 2
+static uint32_t depth_size[] =
+{
+ 1,
+ Q_DEPTH
+};
+extern spe_program_handle_t mpu1_prog;
+extern spe_program_handle_t mpu2_prog;
+
+static struct mars_context *mars_ctx;
+static struct mars_task_args task1_args, task2_args;
+static struct mars_task_id task1_id, task2_id;
+
+static uint64_t mpu_to_mpu[NUM_LOOP];
+static uint32_t shared_resource __attribute((aligned(16)));
+
+int main(void)
+{
+ int ret, i;
+ int32_t exit_code;
+
+ ret = mars_context_create(&mars_ctx, 0, 0);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+
+ for (i = 0; i < NUM_LOOP; i++) {
+ shared_resource = 0;
+
+ ret = mars_task_queue_create(
+ mars_ctx,
+ &mpu_to_mpu[i],
+ sizeof(struct queue_entry),
+ depth_size[i],
+ MARS_TASK_QUEUE_MPU_TO_MPU);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+
+ /* create push task */
+ ret = mars_task_create(mars_ctx, &task1_id, NULL,
+ mpu1_prog.elf_image, MARS_TASK_CONTEXT_SAVE_ALL);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+
+ task1_args.type.u64[0] = mpu_to_mpu[i];
+ task1_args.type.u64[1] = (uint64_t)depth_size[i];
+ task1_args.type.u64[2] = mars_ptr_to_ea(&shared_resource);
+ ret = mars_task_schedule(&task1_id, &task1_args, 0);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+
+ /* check if queue_push is blocked */
+ sleep(1);
+ MARS_TEST_ASSERT_EQUAL(shared_resource, 0);
+
+ /* create and run pop task */
+ ret = mars_task_create(mars_ctx, &task2_id, NULL,
+ mpu2_prog.elf_image, MARS_TASK_CONTEXT_SAVE_ALL);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+
+ task2_args.type.u64[0] = mpu_to_mpu[i];
+ ret = mars_task_schedule(&task2_id, &task2_args, 0);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+
+ ret = mars_task_wait(&task2_id, &exit_code);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+ MARS_TEST_ASSERT_ERROR(exit_code, MARS_SUCCESS);
+
+ /* check if push task is successfly finished */
+ ret = mars_task_wait(&task1_id, &exit_code);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+ MARS_TEST_ASSERT_ERROR(exit_code, MARS_SUCCESS);
+
+ ret = mars_task_destroy(&task1_id);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+
+ ret = mars_task_destroy(&task2_id);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+
+ ret = mars_task_queue_destroy(mpu_to_mpu[i]);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+ }
+
+ ret = mars_context_destroy(mars_ctx);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+
+ return 0;
+}
+
diff --git a/tests/TFP/TFP_46_010/mpu1.c b/tests/TFP/TFP_46_010/mpu1.c
new file mode 100644
index 0000000..b94867e
--- /dev/null
+++ b/tests/TFP/TFP_46_010/mpu1.c
@@ -0,0 +1,59 @@
+/*
+ * Copyright 2008 Sony Corporation
+ *
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a copy
+ * of this software and associated documentation files (the "Software"), to deal
+ * in the Software without restriction, including without limitation the rights
+ * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+ * copies of the Software, and to permit persons to whom the Software is
+ * furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included in
+ * all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+ * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+ * THE SOFTWARE.
+ */
+
+#include <mars/mars.h>
+#include <mars_task_test.h>
+#include <spu_mfcio.h>
+
+struct queue_entry {
+ uint64_t val;
+ uint64_t pad;
+};
+static struct queue_entry data;
+static uint32_t shared_resource __attribute((aligned(16)));
+
+int mars_task_main(const struct mars_task_args *task_args)
+{
+ int ret, i;
+ uint64_t mpu_to_mpu_ea = task_args->type.u64[0];
+ uint32_t num_push = (uint32_t)task_args->type.u64[1];
+ uint64_t shared_resource_ea = task_args->type.u64[2];
+
+ /* last one push should be blocked */
+ for (i = 0; i < num_push + 1; i++) {
+ ret = mars_task_queue_push_begin(mpu_to_mpu_ea, &data, 1);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+
+ ret = mars_task_queue_push_end(mpu_to_mpu_ea, 1);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+ }
+
+ /* if the program reaches here, shared_resource'll be updated */
+ shared_resource = 1;
+ mfc_put(&shared_resource, shared_resource_ea,
+ sizeof(uint32_t), 0, 0, 0);
+ mfc_write_tag_mask(1 << 0);
+ mfc_read_tag_status_all();
+
+ return 0;
+}
diff --git a/tests/TFP/TFP_46_010/mpu2.c b/tests/TFP/TFP_46_010/mpu2.c
new file mode 100644
index 0000000..5865ea4
--- /dev/null
+++ b/tests/TFP/TFP_46_010/mpu2.c
@@ -0,0 +1,45 @@
+/*
+ * Copyright 2008 Sony Corporation
+ *
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a copy
+ * of this software and associated documentation files (the "Software"), to deal
+ * in the Software without restriction, including without limitation the rights
+ * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+ * copies of the Software, and to permit persons to whom the Software is
+ * furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included in
+ * all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+ * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+ * THE SOFTWARE.
+ */
+
+#include <mars/mars.h>
+#include <mars_task_test.h>
+
+struct queue_entry {
+ uint64_t val;
+ uint64_t pad;
+};
+static struct queue_entry data;
+
+int mars_task_main(const struct mars_task_args *task_args)
+{
+ int ret;
+ uint64_t mpu_to_mpu_ea = task_args->type.u64[0];
+
+ ret = mars_task_queue_try_pop_begin(mpu_to_mpu_ea, &data, 1);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+
+ ret = mars_task_queue_pop_end(mpu_to_mpu_ea, 1);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+
+ return 0;
+}
diff --git a/tests/TFP/TFP_47_001/Makefile b/tests/TFP/TFP_47_001/Makefile
new file mode 100644
index 0000000..ecbce33
--- /dev/null
+++ b/tests/TFP/TFP_47_001/Makefile
@@ -0,0 +1,28 @@
+#
+# Copyright 2008 Sony Corporation
+#
+#
+# Permission is hereby granted, free of charge, to any person obtaining a copy
+# of this software and associated documentation files (the "Software"), to deal
+# in the Software without restriction, including without limitation the rights
+# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+# copies of the Software, and to permit persons to whom the Software is
+# furnished to do so, subject to the following conditions:
+#
+# The above copyright notice and this permission notice shall be included in
+# all copies or substantial portions of the Software.
+#
+# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+# THE SOFTWARE.
+#
+
+top_srcdir = ../..
+test_objs = host.o mpu1.task_eo mpu2.task_eo
+
+include $(top_srcdir)/scripts/config.mk
+include $(top_srcdir)/scripts/rules_item.mk
diff --git a/tests/TFP/TFP_47_001/host.c b/tests/TFP/TFP_47_001/host.c
new file mode 100644
index 0000000..9dbfc88
--- /dev/null
+++ b/tests/TFP/TFP_47_001/host.c
@@ -0,0 +1,131 @@
+/*
+ * Copyright 2008 Sony Corporation
+ *
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a copy
+ * of this software and associated documentation files (the "Software"), to deal
+ * in the Software without restriction, including without limitation the rights
+ * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+ * copies of the Software, and to permit persons to whom the Software is
+ * furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included in
+ * all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+ * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+ * THE SOFTWARE.
+ */
+
+#include <unistd.h>
+#include <mars/mars.h>
+#include <libspe2.h>
+#include <mars_test.h>
+
+struct queue_entry {
+ uint64_t val1;
+ uint64_t val2;
+};
+#define Q_DEPTH (256)
+
+#define NUM_LOOP 5
+static uint32_t depth_size[] =
+{
+ 1,
+ Q_DEPTH / 2,
+ Q_DEPTH,
+ Q_DEPTH,
+ Q_DEPTH
+};
+extern spe_program_handle_t mpu1_prog;
+extern spe_program_handle_t mpu2_prog;
+
+static struct mars_context *mars_ctx;
+static struct mars_task_args task1_args, task2_args;
+static struct mars_task_id task1_id[Q_DEPTH], task2_id;
+
+static uint64_t mpu_to_mpu[NUM_LOOP];
+static uint32_t notify[32] __attribute((aligned(128)));
+
+int main(void)
+{
+ int ret, i;
+ int32_t exit_code;
+ uint32_t num;
+
+ ret = mars_context_create(&mars_ctx, 0, 0);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+
+ for (i = 0; i < NUM_LOOP; i++) {
+ notify[0] = 0;
+
+ ret = mars_task_queue_create(
+ mars_ctx,
+ &mpu_to_mpu[i],
+ sizeof(struct queue_entry),
+ depth_size[i],
+ MARS_TASK_QUEUE_MPU_TO_MPU);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+
+ /* create push task */
+ for (num = 0; num < depth_size[i]; num++) {
+ ret = mars_task_create(mars_ctx, &task1_id[num], NULL,
+ mpu1_prog.elf_image,
+ MARS_TASK_CONTEXT_SAVE_ALL);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+
+ task1_args.type.u64[0] = mpu_to_mpu[i];
+ task1_args.type.u64[1] = (uint64_t)i;
+ task1_args.type.u64[2] = (uint64_t)num;
+ task1_args.type.u64[3] = mars_ptr_to_ea(&notify);
+ ret = mars_task_schedule(&task1_id[num],
+ &task1_args, 0);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+ }
+
+ /* create pop task */
+ ret = mars_task_create(mars_ctx, &task2_id, NULL,
+ mpu2_prog.elf_image, MARS_TASK_CONTEXT_SAVE_ALL);
+
+ /* start push task at the same time */
+ sleep(1);
+ mars_test_counter_set(&notify[0], 1);
+
+ for (num = 0; num < depth_size[i]; num++) {
+ ret = mars_task_wait(&task1_id[num], &exit_code);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+ MARS_TEST_ASSERT_ERROR(exit_code, MARS_SUCCESS);
+ }
+
+ /* run pop task */
+ task2_args.type.u64[0] = mpu_to_mpu[i];
+ task2_args.type.u64[1] = (uint64_t)i;
+ task2_args.type.u64[2] = (uint64_t)depth_size[i];
+ ret = mars_task_schedule(&task2_id, &task2_args, 0);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+
+ ret = mars_task_wait(&task2_id, &exit_code);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+ MARS_TEST_ASSERT_ERROR(exit_code, MARS_SUCCESS);
+
+ ret = mars_task_destroy(&task2_id);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+
+ for (num = 0; num < depth_size[i]; num++) {
+ ret = mars_task_destroy(&task1_id[num]);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+ }
+ ret = mars_task_queue_destroy(mpu_to_mpu[i]);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+ }
+
+ ret = mars_context_destroy(mars_ctx);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+
+ return 0;
+}
+
diff --git a/tests/TFP/TFP_47_001/mpu1.c b/tests/TFP/TFP_47_001/mpu1.c
new file mode 100644
index 0000000..549a6bf
--- /dev/null
+++ b/tests/TFP/TFP_47_001/mpu1.c
@@ -0,0 +1,54 @@
+/*
+ * Copyright 2008 Sony Corporation
+ *
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a copy
+ * of this software and associated documentation files (the "Software"), to deal
+ * in the Software without restriction, including without limitation the rights
+ * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+ * copies of the Software, and to permit persons to whom the Software is
+ * furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included in
+ * all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+ * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+ * THE SOFTWARE.
+ */
+
+#include <mars/mars.h>
+#include <mars_task_test.h>
+#include <spu_mfcio.h>
+
+struct queue_entry {
+ uint64_t val1;
+ uint64_t val2;
+};
+static struct queue_entry data;
+
+int mars_task_main(const struct mars_task_args *task_args)
+{
+ int ret;
+ uint64_t mpu_to_mpu_ea = task_args->type.u64[0];
+ uint64_t id = task_args->type.u64[1];
+ uint64_t num = task_args->type.u64[2];
+ uint64_t notify_ea = task_args->type.u64[3];
+
+ data.val1 = id;
+ data.val2 = num;
+
+ mars_test_counter_wait(notify_ea, 1);
+
+ ret = mars_task_queue_push_begin(mpu_to_mpu_ea, &data, 1);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+
+ ret = mars_task_queue_push_end(mpu_to_mpu_ea, 1);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+
+ return 0;
+}
diff --git a/tests/TFP/TFP_47_001/mpu2.c b/tests/TFP/TFP_47_001/mpu2.c
new file mode 100644
index 0000000..c43688b
--- /dev/null
+++ b/tests/TFP/TFP_47_001/mpu2.c
@@ -0,0 +1,61 @@
+/*
+ * Copyright 2008 Sony Corporation
+ *
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a copy
+ * of this software and associated documentation files (the "Software"), to deal
+ * in the Software without restriction, including without limitation the rights
+ * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+ * copies of the Software, and to permit persons to whom the Software is
+ * furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included in
+ * all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+ * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+ * THE SOFTWARE.
+ */
+
+#include <mars/mars.h>
+#include <mars_task_test.h>
+
+struct queue_entry {
+ uint64_t val1;
+ uint64_t val2;
+};
+static struct queue_entry data;
+
+int mars_task_main(const struct mars_task_args *task_args)
+{
+ int ret, i;
+ uint64_t mpu_to_mpu_ea = task_args->type.u64[0];
+ uint64_t id = task_args->type.u64[1];
+ uint64_t num = task_args->type.u64[2];
+ uint64_t sum, sum_q;
+ uint32_t count;
+
+ sum = sum_q = 0;
+ for (i = 0; i < num; i++) {
+ ret = mars_task_queue_pop(mpu_to_mpu_ea, &data);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+
+ MARS_TEST_ASSERT_EQUAL(data.val1, id);
+ sum += i;
+ sum_q += data.val2;
+ }
+
+ /* check queue data */
+ MARS_TEST_ASSERT_EQUAL(sum, sum_q);
+
+ /* queue should be empty */
+ ret = mars_task_queue_count(mpu_to_mpu_ea, &count);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+ MARS_TEST_ASSERT_EQUAL(count, 0);
+
+ return 0;
+}
diff --git a/tests/TFP/TFP_48_001/Makefile b/tests/TFP/TFP_48_001/Makefile
new file mode 100644
index 0000000..432135a
--- /dev/null
+++ b/tests/TFP/TFP_48_001/Makefile
@@ -0,0 +1,28 @@
+#
+# Copyright 2008 Sony Corporation
+#
+#
+# Permission is hereby granted, free of charge, to any person obtaining a copy
+# of this software and associated documentation files (the "Software"), to deal
+# in the Software without restriction, including without limitation the rights
+# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+# copies of the Software, and to permit persons to whom the Software is
+# furnished to do so, subject to the following conditions:
+#
+# The above copyright notice and this permission notice shall be included in
+# all copies or substantial portions of the Software.
+#
+# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+# THE SOFTWARE.
+#
+
+top_srcdir = ../..
+test_objs = host.o mpu.task_eo
+
+include $(top_srcdir)/scripts/config.mk
+include $(top_srcdir)/scripts/rules_item.mk
diff --git a/tests/TFP/TFP_48_001/host.c b/tests/TFP/TFP_48_001/host.c
new file mode 100644
index 0000000..5182f65
--- /dev/null
+++ b/tests/TFP/TFP_48_001/host.c
@@ -0,0 +1,104 @@
+/*
+ * Copyright 2008 Sony Corporation
+ *
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a copy
+ * of this software and associated documentation files (the "Software"), to deal
+ * in the Software without restriction, including without limitation the rights
+ * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+ * copies of the Software, and to permit persons to whom the Software is
+ * furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included in
+ * all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+ * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+ * THE SOFTWARE.
+ */
+
+#include <mars/mars.h>
+#include <libspe2.h>
+#include <mars_test.h>
+
+struct queue_entry {
+ uint64_t val;
+ uint64_t pad;
+};
+#define Q_DEPTH (256 * 1024)
+
+#define NUM_LOOP 3
+static uint32_t depth_size[] =
+{
+ 1,
+ Q_DEPTH / 2,
+ Q_DEPTH
+};
+extern spe_program_handle_t mpu_prog;
+
+static struct mars_context *mars_ctx;
+static struct mars_task_args task_args;
+static struct mars_task_id task_id;
+
+static uint64_t host_to_mpu[NUM_LOOP];
+static struct queue_entry data;
+
+int main(void)
+{
+ int ret, i;
+ int32_t exit_code;
+ uint64_t num;
+
+ ret = mars_context_create(&mars_ctx, 0, 0);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+
+ for (i = 0; i < NUM_LOOP; i++) {
+ ret = mars_task_queue_create(
+ mars_ctx,
+ &host_to_mpu[i],
+ sizeof(struct queue_entry),
+ depth_size[i],
+ MARS_TASK_QUEUE_HOST_TO_MPU);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+
+ data.val = 0;
+ for (num = 0; num < depth_size[i]; num++) {
+ data.val += num;
+ ret = mars_task_queue_push(host_to_mpu[i], &data);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+ }
+
+ /* try_push depth + 1 should be BUSY */
+ ret = mars_task_queue_try_push(host_to_mpu[i], &data);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_ERROR_BUSY);
+
+ ret = mars_task_create(mars_ctx, &task_id, NULL,
+ mpu_prog.elf_image, MARS_TASK_CONTEXT_SAVE_ALL);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+
+ task_args.type.u64[0] = host_to_mpu[i];
+ task_args.type.u64[1] = (uint64_t)depth_size[i];
+ ret = mars_task_schedule(&task_id, &task_args, 0);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+
+ ret = mars_task_wait(&task_id, &exit_code);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+ MARS_TEST_ASSERT_ERROR(exit_code, MARS_SUCCESS);
+
+ ret = mars_task_destroy(&task_id);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+
+ ret = mars_task_queue_destroy(host_to_mpu[i]);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+ }
+
+ ret = mars_context_destroy(mars_ctx);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+
+ return 0;
+}
+
diff --git a/tests/TFP/TFP_48_001/mpu.c b/tests/TFP/TFP_48_001/mpu.c
new file mode 100644
index 0000000..a8473a0
--- /dev/null
+++ b/tests/TFP/TFP_48_001/mpu.c
@@ -0,0 +1,54 @@
+/*
+ * Copyright 2008 Sony Corporation
+ *
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a copy
+ * of this software and associated documentation files (the "Software"), to deal
+ * in the Software without restriction, including without limitation the rights
+ * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+ * copies of the Software, and to permit persons to whom the Software is
+ * furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included in
+ * all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+ * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+ * THE SOFTWARE.
+ */
+
+#include <mars/mars.h>
+#include <mars_task_test.h>
+
+struct queue_entry {
+ uint64_t val;
+ uint64_t pad;
+};
+static struct queue_entry data;
+
+int mars_task_main(const struct mars_task_args *task_args)
+{
+ int ret;
+ uint64_t host_to_mpu_ea = task_args->type.u64[0];
+ uint32_t num_push = (uint32_t)task_args->type.u64[1];
+ uint32_t i, count;
+ uint64_t sum;
+
+ sum = 0;
+ for (i = 0; i < num_push; i++) {
+ ret = mars_task_queue_pop(host_to_mpu_ea, &data);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+ sum += i;
+ MARS_TEST_ASSERT_EQUAL(data.val, sum);
+ }
+ /* no items in the queue */
+ ret = mars_task_queue_count(host_to_mpu_ea, &count);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+ MARS_TEST_ASSERT_EQUAL(count, 0);
+
+ return 0;
+}
diff --git a/tests/TFP/TFP_48_002/Makefile b/tests/TFP/TFP_48_002/Makefile
new file mode 100644
index 0000000..432135a
--- /dev/null
+++ b/tests/TFP/TFP_48_002/Makefile
@@ -0,0 +1,28 @@
+#
+# Copyright 2008 Sony Corporation
+#
+#
+# Permission is hereby granted, free of charge, to any person obtaining a copy
+# of this software and associated documentation files (the "Software"), to deal
+# in the Software without restriction, including without limitation the rights
+# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+# copies of the Software, and to permit persons to whom the Software is
+# furnished to do so, subject to the following conditions:
+#
+# The above copyright notice and this permission notice shall be included in
+# all copies or substantial portions of the Software.
+#
+# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+# THE SOFTWARE.
+#
+
+top_srcdir = ../..
+test_objs = host.o mpu.task_eo
+
+include $(top_srcdir)/scripts/config.mk
+include $(top_srcdir)/scripts/rules_item.mk
diff --git a/tests/TFP/TFP_48_002/host.c b/tests/TFP/TFP_48_002/host.c
new file mode 100644
index 0000000..e96cfa2
--- /dev/null
+++ b/tests/TFP/TFP_48_002/host.c
@@ -0,0 +1,106 @@
+/*
+ * Copyright 2008 Sony Corporation
+ *
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a copy
+ * of this software and associated documentation files (the "Software"), to deal
+ * in the Software without restriction, including without limitation the rights
+ * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+ * copies of the Software, and to permit persons to whom the Software is
+ * furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included in
+ * all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+ * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+ * THE SOFTWARE.
+ */
+
+#include <mars/mars.h>
+#include <libspe2.h>
+#include <mars_test.h>
+
+struct queue_entry {
+ uint64_t val;
+ uint64_t pad;
+};
+#define Q_DEPTH (256 * 1024)
+
+#define NUM_LOOP 3
+static uint32_t depth_size[] =
+{
+ 1,
+ Q_DEPTH / 2,
+ Q_DEPTH
+};
+extern spe_program_handle_t mpu_prog;
+
+static struct mars_context *mars_ctx;
+static struct mars_task_args task_args;
+static struct mars_task_id task_id;
+
+static uint64_t mpu_to_host[NUM_LOOP];
+static struct queue_entry data;
+
+int main(void)
+{
+ int ret, i;
+ int32_t exit_code;
+ uint32_t count;
+ uint64_t num, sum;
+
+ ret = mars_context_create(&mars_ctx, 0, 0);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+
+ for (i = 0; i < NUM_LOOP; i++) {
+ ret = mars_task_queue_create(
+ mars_ctx,
+ &mpu_to_host[i],
+ sizeof(struct queue_entry),
+ depth_size[i],
+ MARS_TASK_QUEUE_MPU_TO_HOST);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+
+ ret = mars_task_create(mars_ctx, &task_id, NULL,
+ mpu_prog.elf_image, MARS_TASK_CONTEXT_SAVE_ALL);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+
+ task_args.type.u64[0] = mpu_to_host[i];
+ task_args.type.u64[1] = (uint64_t)depth_size[i];
+ ret = mars_task_schedule(&task_id, &task_args, 0);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+
+ ret = mars_task_wait(&task_id, &exit_code);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+ MARS_TEST_ASSERT_ERROR(exit_code, MARS_SUCCESS);
+
+ sum = 0;
+ for (num = 0; num < depth_size[i]; num++) {
+ ret = mars_task_queue_pop(mpu_to_host[i], &data);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+ sum += num;
+ MARS_TEST_ASSERT_EQUAL(data.val, sum);
+ }
+ /* no items in the queue */
+ ret = mars_task_queue_count(mpu_to_host[i], &count);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+ MARS_TEST_ASSERT_EQUAL(count, 0);
+
+ ret = mars_task_destroy(&task_id);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+
+ ret = mars_task_queue_destroy(mpu_to_host[i]);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+ }
+
+ ret = mars_context_destroy(mars_ctx);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+
+ return 0;
+}
+
diff --git a/tests/TFP/TFP_48_002/mpu.c b/tests/TFP/TFP_48_002/mpu.c
new file mode 100644
index 0000000..7be4d3d
--- /dev/null
+++ b/tests/TFP/TFP_48_002/mpu.c
@@ -0,0 +1,51 @@
+/*
+ * Copyright 2008 Sony Corporation
+ *
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a copy
+ * of this software and associated documentation files (the "Software"), to deal
+ * in the Software without restriction, including without limitation the rights
+ * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+ * copies of the Software, and to permit persons to whom the Software is
+ * furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included in
+ * all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+ * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+ * THE SOFTWARE.
+ */
+
+#include <mars/mars.h>
+#include <mars_task_test.h>
+
+struct queue_entry {
+ uint64_t val;
+ uint64_t pad;
+};
+static struct queue_entry data;
+
+int mars_task_main(const struct mars_task_args *task_args)
+{
+ int ret;
+ uint64_t mpu_to_host_ea = task_args->type.u64[0];
+ uint32_t num_push = (uint32_t)task_args->type.u64[1];
+ uint32_t i;
+
+ for (i = 0; i < num_push; i++) {
+ data.val += i;
+ ret = mars_task_queue_push(mpu_to_host_ea, &data);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+ }
+
+ /* try_push depth + 1 should be BUSY */
+ ret = mars_task_queue_try_push(mpu_to_host_ea, &data);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_ERROR_BUSY);
+
+ return 0;
+}
diff --git a/tests/TFP/TFP_48_003/Makefile b/tests/TFP/TFP_48_003/Makefile
new file mode 100644
index 0000000..ecbce33
--- /dev/null
+++ b/tests/TFP/TFP_48_003/Makefile
@@ -0,0 +1,28 @@
+#
+# Copyright 2008 Sony Corporation
+#
+#
+# Permission is hereby granted, free of charge, to any person obtaining a copy
+# of this software and associated documentation files (the "Software"), to deal
+# in the Software without restriction, including without limitation the rights
+# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+# copies of the Software, and to permit persons to whom the Software is
+# furnished to do so, subject to the following conditions:
+#
+# The above copyright notice and this permission notice shall be included in
+# all copies or substantial portions of the Software.
+#
+# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+# THE SOFTWARE.
+#
+
+top_srcdir = ../..
+test_objs = host.o mpu1.task_eo mpu2.task_eo
+
+include $(top_srcdir)/scripts/config.mk
+include $(top_srcdir)/scripts/rules_item.mk
diff --git a/tests/TFP/TFP_48_003/host.c b/tests/TFP/TFP_48_003/host.c
new file mode 100644
index 0000000..20d4e6d
--- /dev/null
+++ b/tests/TFP/TFP_48_003/host.c
@@ -0,0 +1,109 @@
+/*
+ * Copyright 2008 Sony Corporation
+ *
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a copy
+ * of this software and associated documentation files (the "Software"), to deal
+ * in the Software without restriction, including without limitation the rights
+ * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+ * copies of the Software, and to permit persons to whom the Software is
+ * furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included in
+ * all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+ * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+ * THE SOFTWARE.
+ */
+
+#include <mars/mars.h>
+#include <libspe2.h>
+#include <mars_test.h>
+
+struct queue_entry {
+ uint64_t val;
+ uint64_t pad;
+};
+#define Q_DEPTH (256 * 1024)
+
+#define NUM_LOOP 2
+static uint32_t depth_size[] =
+{
+ 1,
+ Q_DEPTH
+};
+extern spe_program_handle_t mpu1_prog;
+extern spe_program_handle_t mpu2_prog;
+
+static struct mars_context *mars_ctx;
+static struct mars_task_args task1_args, task2_args;
+static struct mars_task_id task1_id, task2_id;
+
+static uint64_t mpu_to_mpu[NUM_LOOP];
+
+int main(void)
+{
+ int ret, i;
+ int32_t exit_code;
+
+ ret = mars_context_create(&mars_ctx, 0, 0);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+
+ for (i = 0; i < NUM_LOOP; i++) {
+ ret = mars_task_queue_create(
+ mars_ctx,
+ &mpu_to_mpu[i],
+ sizeof(struct queue_entry),
+ depth_size[i],
+ MARS_TASK_QUEUE_MPU_TO_MPU);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+
+ /* create and run push task */
+ ret = mars_task_create(mars_ctx, &task1_id, NULL,
+ mpu1_prog.elf_image, MARS_TASK_CONTEXT_SAVE_ALL);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+
+ task1_args.type.u64[0] = mpu_to_mpu[i];
+ task1_args.type.u64[1] = (uint64_t)depth_size[i];
+ ret = mars_task_schedule(&task1_id, &task1_args, 0);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+
+ ret = mars_task_wait(&task1_id, &exit_code);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+ MARS_TEST_ASSERT_ERROR(exit_code, MARS_SUCCESS);
+
+ /* create and run pop task */
+ ret = mars_task_create(mars_ctx, &task2_id, NULL,
+ mpu2_prog.elf_image, MARS_TASK_CONTEXT_SAVE_ALL);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+
+ task2_args.type.u64[0] = mpu_to_mpu[i];
+ task2_args.type.u64[1] = (uint64_t)depth_size[i];
+ ret = mars_task_schedule(&task2_id, &task2_args, 0);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+
+ ret = mars_task_wait(&task2_id, &exit_code);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+ MARS_TEST_ASSERT_ERROR(exit_code, MARS_SUCCESS);
+
+ ret = mars_task_destroy(&task2_id);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+
+ ret = mars_task_destroy(&task1_id);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+
+ ret = mars_task_queue_destroy(mpu_to_mpu[i]);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+ }
+
+ ret = mars_context_destroy(mars_ctx);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+
+ return 0;
+}
+
diff --git a/tests/TFP/TFP_48_003/mpu1.c b/tests/TFP/TFP_48_003/mpu1.c
new file mode 100644
index 0000000..ce63d9b
--- /dev/null
+++ b/tests/TFP/TFP_48_003/mpu1.c
@@ -0,0 +1,51 @@
+/*
+ * Copyright 2008 Sony Corporation
+ *
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a copy
+ * of this software and associated documentation files (the "Software"), to deal
+ * in the Software without restriction, including without limitation the rights
+ * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+ * copies of the Software, and to permit persons to whom the Software is
+ * furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included in
+ * all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+ * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+ * THE SOFTWARE.
+ */
+
+#include <mars/mars.h>
+#include <mars_task_test.h>
+
+struct queue_entry {
+ uint64_t val;
+ uint64_t pad;
+};
+static struct queue_entry data;
+
+int mars_task_main(const struct mars_task_args *task_args)
+{
+ int ret;
+ uint64_t mpu_to_mpu_ea = task_args->type.u64[0];
+ uint32_t num_push = (uint32_t)task_args->type.u64[1];
+ uint32_t i;
+
+ for (i = 0; i < num_push; i++) {
+ data.val += i;
+ ret = mars_task_queue_push(mpu_to_mpu_ea, &data);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+ }
+
+ /* try_push depth + 1 should be BUSY */
+ ret = mars_task_queue_try_push(mpu_to_mpu_ea, &data);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_ERROR_BUSY);
+
+ return 0;
+}
diff --git a/tests/TFP/TFP_48_003/mpu2.c b/tests/TFP/TFP_48_003/mpu2.c
new file mode 100644
index 0000000..b34789f
--- /dev/null
+++ b/tests/TFP/TFP_48_003/mpu2.c
@@ -0,0 +1,54 @@
+/*
+ * Copyright 2008 Sony Corporation
+ *
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a copy
+ * of this software and associated documentation files (the "Software"), to deal
+ * in the Software without restriction, including without limitation the rights
+ * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+ * copies of the Software, and to permit persons to whom the Software is
+ * furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included in
+ * all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+ * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+ * THE SOFTWARE.
+ */
+
+#include <mars/mars.h>
+#include <mars_task_test.h>
+
+struct queue_entry {
+ uint64_t val;
+ uint64_t pad;
+};
+static struct queue_entry data;
+
+int mars_task_main(const struct mars_task_args *task_args)
+{
+ int ret;
+ uint64_t mpu_to_mpu_ea = task_args->type.u64[0];
+ uint32_t num_push = (uint32_t)task_args->type.u64[1];
+ uint32_t i, count;
+ uint64_t sum;
+
+ sum = 0;
+ for (i = 0; i < num_push; i++) {
+ ret = mars_task_queue_pop(mpu_to_mpu_ea, &data);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+ sum += i;
+ MARS_TEST_ASSERT_EQUAL(data.val, sum);
+ }
+ /* no items in the queue */
+ ret = mars_task_queue_count(mpu_to_mpu_ea, &count);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+ MARS_TEST_ASSERT_EQUAL(count, 0);
+
+ return 0;
+}
diff --git a/tests/TFP/TFP_48_004/Makefile b/tests/TFP/TFP_48_004/Makefile
new file mode 100644
index 0000000..432135a
--- /dev/null
+++ b/tests/TFP/TFP_48_004/Makefile
@@ -0,0 +1,28 @@
+#
+# Copyright 2008 Sony Corporation
+#
+#
+# Permission is hereby granted, free of charge, to any person obtaining a copy
+# of this software and associated documentation files (the "Software"), to deal
+# in the Software without restriction, including without limitation the rights
+# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+# copies of the Software, and to permit persons to whom the Software is
+# furnished to do so, subject to the following conditions:
+#
+# The above copyright notice and this permission notice shall be included in
+# all copies or substantial portions of the Software.
+#
+# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+# THE SOFTWARE.
+#
+
+top_srcdir = ../..
+test_objs = host.o mpu.task_eo
+
+include $(top_srcdir)/scripts/config.mk
+include $(top_srcdir)/scripts/rules_item.mk
diff --git a/tests/TFP/TFP_48_004/host.c b/tests/TFP/TFP_48_004/host.c
new file mode 100644
index 0000000..c31ac50
--- /dev/null
+++ b/tests/TFP/TFP_48_004/host.c
@@ -0,0 +1,139 @@
+/*
+ * Copyright 2008 Sony Corporation
+ *
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a copy
+ * of this software and associated documentation files (the "Software"), to deal
+ * in the Software without restriction, including without limitation the rights
+ * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+ * copies of the Software, and to permit persons to whom the Software is
+ * furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included in
+ * all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+ * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+ * THE SOFTWARE.
+ */
+
+#include <pthread.h>
+#include <unistd.h>
+#include <mars/mars.h>
+#include <libspe2.h>
+#include <mars_test.h>
+
+struct queue_entry {
+ uint64_t val1;
+ uint64_t val2;
+};
+#define Q_DEPTH (16)
+
+#define NUM_LOOP 5
+static uint32_t depth_size[] =
+{
+ 1,
+ Q_DEPTH / 2,
+ Q_DEPTH,
+ Q_DEPTH,
+ Q_DEPTH
+};
+extern spe_program_handle_t mpu_prog;
+
+static struct mars_context *mars_ctx;
+static struct mars_task_args task_args;
+static struct mars_task_id task_id;
+
+static uint64_t host_to_mpu[NUM_LOOP];
+static uint32_t shared_resource __attribute((aligned(16)));
+static struct queue_entry data[Q_DEPTH];
+
+static struct mars_task_args thread_args[Q_DEPTH];
+static pthread_t thread[Q_DEPTH];
+static void *thread_proc(void *ptr)
+{
+ int ret;
+ struct mars_task_args *task_args = (struct mars_task_args *)ptr;
+ uint32_t id = (uint32_t)task_args->type.u32[0];
+ uint32_t count = (uint32_t)task_args->type.u32[1];
+
+ /* wait for start */
+ while (!shared_resource)
+ usleep(100);
+
+ data[count].val1 = (uint64_t)id;
+ data[count].val2 = (uint64_t)count;
+ ret = mars_task_queue_try_push(host_to_mpu[id], &data[count]);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+
+ return NULL;
+}
+
+int main(void)
+{
+ int ret, i;
+ int32_t exit_code;
+ uint32_t num;
+
+ ret = mars_context_create(&mars_ctx, 0, 0);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+
+ for (i = 0; i < NUM_LOOP; i++) {
+ shared_resource = 0;
+
+ ret = mars_task_queue_create(
+ mars_ctx,
+ &host_to_mpu[i],
+ sizeof(struct queue_entry),
+ depth_size[i],
+ MARS_TASK_QUEUE_HOST_TO_MPU);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+
+ /* create push thread */
+ for (num = 0; num < depth_size[i]; num++) {
+ thread_args[num].type.u32[0] = (uint32_t)i;
+ thread_args[num].type.u32[1] = (uint32_t)num;
+ pthread_create(&thread[num], NULL,
+ thread_proc, &thread_args[num]);
+ }
+
+ /* create pop task */
+ ret = mars_task_create(mars_ctx, &task_id, NULL,
+ mpu_prog.elf_image, MARS_TASK_CONTEXT_SAVE_ALL);
+
+ /* start ppe threads at the same time */
+ sleep(1);
+ shared_resource = 1;
+
+ /* check if all threads finished without fail */
+ for (num = 0; num < depth_size[i]; num++)
+ pthread_join(thread[num], NULL);
+
+ /* run pop task */
+ task_args.type.u64[0] = host_to_mpu[i];
+ task_args.type.u64[1] = (uint64_t)i;
+ task_args.type.u64[2] = (uint64_t)depth_size[i];
+ ret = mars_task_schedule(&task_id, &task_args, 0);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+
+ ret = mars_task_wait(&task_id, &exit_code);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+ MARS_TEST_ASSERT_ERROR(exit_code, MARS_SUCCESS);
+
+ ret = mars_task_destroy(&task_id);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+
+ ret = mars_task_queue_destroy(host_to_mpu[i]);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+ }
+
+ ret = mars_context_destroy(mars_ctx);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+
+ return 0;
+}
+
diff --git a/tests/TFP/TFP_48_004/mpu.c b/tests/TFP/TFP_48_004/mpu.c
new file mode 100644
index 0000000..050d450
--- /dev/null
+++ b/tests/TFP/TFP_48_004/mpu.c
@@ -0,0 +1,61 @@
+/*
+ * Copyright 2008 Sony Corporation
+ *
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a copy
+ * of this software and associated documentation files (the "Software"), to deal
+ * in the Software without restriction, including without limitation the rights
+ * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+ * copies of the Software, and to permit persons to whom the Software is
+ * furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included in
+ * all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+ * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+ * THE SOFTWARE.
+ */
+
+#include <mars/mars.h>
+#include <mars_task_test.h>
+
+struct queue_entry {
+ uint64_t val1;
+ uint64_t val2;
+};
+static struct queue_entry data;
+
+int mars_task_main(const struct mars_task_args *task_args)
+{
+ int ret, i;
+ uint64_t host_to_mpu_ea = task_args->type.u64[0];
+ uint64_t id = task_args->type.u64[1];
+ uint64_t num = task_args->type.u64[2];
+ uint64_t sum, sum_q;
+ uint32_t count;
+
+ sum = sum_q = 0;
+ for (i = 0; i < num; i++) {
+ ret = mars_task_queue_pop(host_to_mpu_ea, &data);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+
+ MARS_TEST_ASSERT_EQUAL(data.val1, id);
+ sum += i;
+ sum_q += data.val2;
+ }
+
+ /* check queue data */
+ MARS_TEST_ASSERT_EQUAL(sum, sum_q);
+
+ /* queue should be empty */
+ ret = mars_task_queue_count(host_to_mpu_ea, &count);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+ MARS_TEST_ASSERT_EQUAL(count, 0);
+
+ return 0;
+}
diff --git a/tests/TFP/TFP_48_005/Makefile b/tests/TFP/TFP_48_005/Makefile
new file mode 100644
index 0000000..432135a
--- /dev/null
+++ b/tests/TFP/TFP_48_005/Makefile
@@ -0,0 +1,28 @@
+#
+# Copyright 2008 Sony Corporation
+#
+#
+# Permission is hereby granted, free of charge, to any person obtaining a copy
+# of this software and associated documentation files (the "Software"), to deal
+# in the Software without restriction, including without limitation the rights
+# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+# copies of the Software, and to permit persons to whom the Software is
+# furnished to do so, subject to the following conditions:
+#
+# The above copyright notice and this permission notice shall be included in
+# all copies or substantial portions of the Software.
+#
+# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+# THE SOFTWARE.
+#
+
+top_srcdir = ../..
+test_objs = host.o mpu.task_eo
+
+include $(top_srcdir)/scripts/config.mk
+include $(top_srcdir)/scripts/rules_item.mk
diff --git a/tests/TFP/TFP_48_005/host.c b/tests/TFP/TFP_48_005/host.c
new file mode 100644
index 0000000..f1b1a29
--- /dev/null
+++ b/tests/TFP/TFP_48_005/host.c
@@ -0,0 +1,140 @@
+/*
+ * Copyright 2008 Sony Corporation
+ *
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a copy
+ * of this software and associated documentation files (the "Software"), to deal
+ * in the Software without restriction, including without limitation the rights
+ * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+ * copies of the Software, and to permit persons to whom the Software is
+ * furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included in
+ * all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+ * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+ * THE SOFTWARE.
+ */
+
+#include <unistd.h>
+#include <mars/mars.h>
+#include <libspe2.h>
+#include <mars_test.h>
+
+struct queue_entry {
+ uint64_t val1;
+ uint64_t val2;
+};
+#define Q_DEPTH (256)
+
+#define NUM_LOOP 5
+static uint32_t depth_size[] =
+{
+ 1,
+ Q_DEPTH / 2,
+ Q_DEPTH,
+ Q_DEPTH,
+ Q_DEPTH
+};
+extern spe_program_handle_t mpu_prog;
+
+static struct mars_context *mars_ctx;
+static struct mars_task_args task_args;
+static struct mars_task_id task_id[Q_DEPTH];
+
+static uint64_t mpu_to_host[NUM_LOOP];
+static uint32_t notify[32] __attribute((aligned(128)));
+static struct queue_entry data;
+
+static void check_queue(uint64_t id, uint64_t num)
+{
+ int ret, i;
+ uint64_t sum, sum_q;
+ uint32_t count;
+
+ sum = sum_q = 0;
+ for (i = 0; i < num; i++) {
+ ret = mars_task_queue_pop(mpu_to_host[id], &data);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+
+ MARS_TEST_ASSERT_EQUAL(data.val1, id);
+ sum += i;
+ sum_q += data.val2;
+ }
+ /* check queue data */
+ MARS_TEST_ASSERT_EQUAL(sum, sum_q);
+
+ /* queue should be empty */
+ ret = mars_task_queue_count(mpu_to_host[id], &count);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+ MARS_TEST_ASSERT_EQUAL(count, 0);
+}
+
+int main(void)
+{
+ int ret, i;
+ int32_t exit_code;
+ uint32_t num;
+
+ ret = mars_context_create(&mars_ctx, 0, 0);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+
+ for (i = 0; i < NUM_LOOP; i++) {
+ notify[0] = 0;
+
+ ret = mars_task_queue_create(
+ mars_ctx,
+ &mpu_to_host[i],
+ sizeof(struct queue_entry),
+ depth_size[i],
+ MARS_TASK_QUEUE_MPU_TO_HOST);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+
+ /* create push task */
+ for (num = 0; num < depth_size[i]; num++) {
+ ret = mars_task_create(mars_ctx, &task_id[num], NULL,
+ mpu_prog.elf_image,
+ MARS_TASK_CONTEXT_SAVE_ALL);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+
+ task_args.type.u64[0] = mpu_to_host[i];
+ task_args.type.u64[1] = (uint64_t)i;
+ task_args.type.u64[2] = (uint64_t)num;
+ task_args.type.u64[3] = mars_ptr_to_ea(&notify);
+ ret = mars_task_schedule(&task_id[num], &task_args, 0);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+ }
+
+ /* start mpu task at the same time */
+ sleep(1);
+ mars_test_counter_set(&notify[0], 1);
+
+ for (num = 0; num < depth_size[i]; num++) {
+ ret = mars_task_wait(&task_id[num], &exit_code);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+ MARS_TEST_ASSERT_ERROR(exit_code, MARS_SUCCESS);
+ }
+
+ /* check queue data */
+ check_queue(i, depth_size[i]);
+
+ for (num = 0; num < depth_size[i]; num++) {
+ ret = mars_task_destroy(&task_id[num]);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+ }
+
+ ret = mars_task_queue_destroy(mpu_to_host[i]);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+ }
+
+ ret = mars_context_destroy(mars_ctx);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+
+ return 0;
+}
+
diff --git a/tests/TFP/TFP_48_005/mpu.c b/tests/TFP/TFP_48_005/mpu.c
new file mode 100644
index 0000000..a8156c4
--- /dev/null
+++ b/tests/TFP/TFP_48_005/mpu.c
@@ -0,0 +1,51 @@
+/*
+ * Copyright 2008 Sony Corporation
+ *
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a copy
+ * of this software and associated documentation files (the "Software"), to deal
+ * in the Software without restriction, including without limitation the rights
+ * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+ * copies of the Software, and to permit persons to whom the Software is
+ * furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included in
+ * all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+ * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+ * THE SOFTWARE.
+ */
+
+#include <mars/mars.h>
+#include <mars_task_test.h>
+#include <spu_mfcio.h>
+
+struct queue_entry {
+ uint64_t val1;
+ uint64_t val2;
+};
+static struct queue_entry data;
+
+int mars_task_main(const struct mars_task_args *task_args)
+{
+ int ret;
+ uint64_t mpu_to_host_ea = task_args->type.u64[0];
+ uint64_t id = task_args->type.u64[1];
+ uint64_t num = task_args->type.u64[2];
+ uint64_t notify_ea = task_args->type.u64[3];
+
+ data.val1 = id;
+ data.val2 = num;
+
+ mars_test_counter_wait(notify_ea, 1);
+
+ ret = mars_task_queue_try_push(mpu_to_host_ea, &data);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+
+ return 0;
+}
diff --git a/tests/TFP/TFP_48_006/Makefile b/tests/TFP/TFP_48_006/Makefile
new file mode 100644
index 0000000..ecbce33
--- /dev/null
+++ b/tests/TFP/TFP_48_006/Makefile
@@ -0,0 +1,28 @@
+#
+# Copyright 2008 Sony Corporation
+#
+#
+# Permission is hereby granted, free of charge, to any person obtaining a copy
+# of this software and associated documentation files (the "Software"), to deal
+# in the Software without restriction, including without limitation the rights
+# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+# copies of the Software, and to permit persons to whom the Software is
+# furnished to do so, subject to the following conditions:
+#
+# The above copyright notice and this permission notice shall be included in
+# all copies or substantial portions of the Software.
+#
+# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+# THE SOFTWARE.
+#
+
+top_srcdir = ../..
+test_objs = host.o mpu1.task_eo mpu2.task_eo
+
+include $(top_srcdir)/scripts/config.mk
+include $(top_srcdir)/scripts/rules_item.mk
diff --git a/tests/TFP/TFP_48_006/host.c b/tests/TFP/TFP_48_006/host.c
new file mode 100644
index 0000000..9dbfc88
--- /dev/null
+++ b/tests/TFP/TFP_48_006/host.c
@@ -0,0 +1,131 @@
+/*
+ * Copyright 2008 Sony Corporation
+ *
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a copy
+ * of this software and associated documentation files (the "Software"), to deal
+ * in the Software without restriction, including without limitation the rights
+ * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+ * copies of the Software, and to permit persons to whom the Software is
+ * furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included in
+ * all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+ * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+ * THE SOFTWARE.
+ */
+
+#include <unistd.h>
+#include <mars/mars.h>
+#include <libspe2.h>
+#include <mars_test.h>
+
+struct queue_entry {
+ uint64_t val1;
+ uint64_t val2;
+};
+#define Q_DEPTH (256)
+
+#define NUM_LOOP 5
+static uint32_t depth_size[] =
+{
+ 1,
+ Q_DEPTH / 2,
+ Q_DEPTH,
+ Q_DEPTH,
+ Q_DEPTH
+};
+extern spe_program_handle_t mpu1_prog;
+extern spe_program_handle_t mpu2_prog;
+
+static struct mars_context *mars_ctx;
+static struct mars_task_args task1_args, task2_args;
+static struct mars_task_id task1_id[Q_DEPTH], task2_id;
+
+static uint64_t mpu_to_mpu[NUM_LOOP];
+static uint32_t notify[32] __attribute((aligned(128)));
+
+int main(void)
+{
+ int ret, i;
+ int32_t exit_code;
+ uint32_t num;
+
+ ret = mars_context_create(&mars_ctx, 0, 0);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+
+ for (i = 0; i < NUM_LOOP; i++) {
+ notify[0] = 0;
+
+ ret = mars_task_queue_create(
+ mars_ctx,
+ &mpu_to_mpu[i],
+ sizeof(struct queue_entry),
+ depth_size[i],
+ MARS_TASK_QUEUE_MPU_TO_MPU);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+
+ /* create push task */
+ for (num = 0; num < depth_size[i]; num++) {
+ ret = mars_task_create(mars_ctx, &task1_id[num], NULL,
+ mpu1_prog.elf_image,
+ MARS_TASK_CONTEXT_SAVE_ALL);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+
+ task1_args.type.u64[0] = mpu_to_mpu[i];
+ task1_args.type.u64[1] = (uint64_t)i;
+ task1_args.type.u64[2] = (uint64_t)num;
+ task1_args.type.u64[3] = mars_ptr_to_ea(&notify);
+ ret = mars_task_schedule(&task1_id[num],
+ &task1_args, 0);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+ }
+
+ /* create pop task */
+ ret = mars_task_create(mars_ctx, &task2_id, NULL,
+ mpu2_prog.elf_image, MARS_TASK_CONTEXT_SAVE_ALL);
+
+ /* start push task at the same time */
+ sleep(1);
+ mars_test_counter_set(&notify[0], 1);
+
+ for (num = 0; num < depth_size[i]; num++) {
+ ret = mars_task_wait(&task1_id[num], &exit_code);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+ MARS_TEST_ASSERT_ERROR(exit_code, MARS_SUCCESS);
+ }
+
+ /* run pop task */
+ task2_args.type.u64[0] = mpu_to_mpu[i];
+ task2_args.type.u64[1] = (uint64_t)i;
+ task2_args.type.u64[2] = (uint64_t)depth_size[i];
+ ret = mars_task_schedule(&task2_id, &task2_args, 0);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+
+ ret = mars_task_wait(&task2_id, &exit_code);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+ MARS_TEST_ASSERT_ERROR(exit_code, MARS_SUCCESS);
+
+ ret = mars_task_destroy(&task2_id);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+
+ for (num = 0; num < depth_size[i]; num++) {
+ ret = mars_task_destroy(&task1_id[num]);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+ }
+ ret = mars_task_queue_destroy(mpu_to_mpu[i]);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+ }
+
+ ret = mars_context_destroy(mars_ctx);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+
+ return 0;
+}
+
diff --git a/tests/TFP/TFP_48_006/mpu1.c b/tests/TFP/TFP_48_006/mpu1.c
new file mode 100644
index 0000000..b412318
--- /dev/null
+++ b/tests/TFP/TFP_48_006/mpu1.c
@@ -0,0 +1,51 @@
+/*
+ * Copyright 2008 Sony Corporation
+ *
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a copy
+ * of this software and associated documentation files (the "Software"), to deal
+ * in the Software without restriction, including without limitation the rights
+ * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+ * copies of the Software, and to permit persons to whom the Software is
+ * furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included in
+ * all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+ * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+ * THE SOFTWARE.
+ */
+
+#include <mars/mars.h>
+#include <mars_task_test.h>
+#include <spu_mfcio.h>
+
+struct queue_entry {
+ uint64_t val1;
+ uint64_t val2;
+};
+static struct queue_entry data;
+
+int mars_task_main(const struct mars_task_args *task_args)
+{
+ int ret;
+ uint64_t mpu_to_mpu_ea = task_args->type.u64[0];
+ uint64_t id = task_args->type.u64[1];
+ uint64_t num = task_args->type.u64[2];
+ uint64_t notify_ea = task_args->type.u64[3];
+
+ data.val1 = id;
+ data.val2 = num;
+
+ mars_test_counter_wait(notify_ea, 1);
+
+ ret = mars_task_queue_try_push(mpu_to_mpu_ea, &data);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+
+ return 0;
+}
diff --git a/tests/TFP/TFP_48_006/mpu2.c b/tests/TFP/TFP_48_006/mpu2.c
new file mode 100644
index 0000000..c43688b
--- /dev/null
+++ b/tests/TFP/TFP_48_006/mpu2.c
@@ -0,0 +1,61 @@
+/*
+ * Copyright 2008 Sony Corporation
+ *
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a copy
+ * of this software and associated documentation files (the "Software"), to deal
+ * in the Software without restriction, including without limitation the rights
+ * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+ * copies of the Software, and to permit persons to whom the Software is
+ * furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included in
+ * all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+ * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+ * THE SOFTWARE.
+ */
+
+#include <mars/mars.h>
+#include <mars_task_test.h>
+
+struct queue_entry {
+ uint64_t val1;
+ uint64_t val2;
+};
+static struct queue_entry data;
+
+int mars_task_main(const struct mars_task_args *task_args)
+{
+ int ret, i;
+ uint64_t mpu_to_mpu_ea = task_args->type.u64[0];
+ uint64_t id = task_args->type.u64[1];
+ uint64_t num = task_args->type.u64[2];
+ uint64_t sum, sum_q;
+ uint32_t count;
+
+ sum = sum_q = 0;
+ for (i = 0; i < num; i++) {
+ ret = mars_task_queue_pop(mpu_to_mpu_ea, &data);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+
+ MARS_TEST_ASSERT_EQUAL(data.val1, id);
+ sum += i;
+ sum_q += data.val2;
+ }
+
+ /* check queue data */
+ MARS_TEST_ASSERT_EQUAL(sum, sum_q);
+
+ /* queue should be empty */
+ ret = mars_task_queue_count(mpu_to_mpu_ea, &count);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+ MARS_TEST_ASSERT_EQUAL(count, 0);
+
+ return 0;
+}
diff --git a/tests/TFP/TFP_49_001/Makefile b/tests/TFP/TFP_49_001/Makefile
new file mode 100644
index 0000000..432135a
--- /dev/null
+++ b/tests/TFP/TFP_49_001/Makefile
@@ -0,0 +1,28 @@
+#
+# Copyright 2008 Sony Corporation
+#
+#
+# Permission is hereby granted, free of charge, to any person obtaining a copy
+# of this software and associated documentation files (the "Software"), to deal
+# in the Software without restriction, including without limitation the rights
+# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+# copies of the Software, and to permit persons to whom the Software is
+# furnished to do so, subject to the following conditions:
+#
+# The above copyright notice and this permission notice shall be included in
+# all copies or substantial portions of the Software.
+#
+# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+# THE SOFTWARE.
+#
+
+top_srcdir = ../..
+test_objs = host.o mpu.task_eo
+
+include $(top_srcdir)/scripts/config.mk
+include $(top_srcdir)/scripts/rules_item.mk
diff --git a/tests/TFP/TFP_49_001/host.c b/tests/TFP/TFP_49_001/host.c
new file mode 100644
index 0000000..e6dff36
--- /dev/null
+++ b/tests/TFP/TFP_49_001/host.c
@@ -0,0 +1,88 @@
+/*
+ * Copyright 2008 Sony Corporation
+ *
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a copy
+ * of this software and associated documentation files (the "Software"), to deal
+ * in the Software without restriction, including without limitation the rights
+ * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+ * copies of the Software, and to permit persons to whom the Software is
+ * furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included in
+ * all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+ * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+ * THE SOFTWARE.
+ */
+
+#include <unistd.h>
+#include <libspe2.h>
+#include <mars/mars.h>
+#include <mars_test.h>
+#include "host_and_mpu.h"
+
+extern spe_program_handle_t mpu_prog;
+
+static struct mars_context *mars;
+static struct mars_task_id task_id;
+static struct mars_task_args task_args;
+static uint64_t queue;
+static uint64_t queue_item[2];
+
+int main(void)
+{
+ int i, exit_code, ret;
+
+ ret = mars_context_create(&mars, 0, 0);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+
+ ret = mars_task_create(
+ mars,
+ &task_id,
+ "49001",
+ mpu_prog.elf_image,
+ MARS_TASK_CONTEXT_SAVE_ALL);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+
+ ret = mars_task_queue_create(
+ mars,
+ &queue,
+ 16,
+ QUEUE_DEPTH,
+ MARS_TASK_QUEUE_MPU_TO_HOST);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+
+ task_args.type.u64[0] = queue;
+ ret = mars_task_schedule(&task_id, &task_args, 0);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+
+ usleep(100000);
+
+ for (i = 0; i < QUEUE_DEPTH; i++) {
+ ret = mars_task_queue_pop(queue, queue_item);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+
+ MARS_TEST_ASSERT(queue_item[0] == i && queue_item[1] == i);
+ }
+
+ ret = mars_task_wait(&task_id, &exit_code);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+ MARS_TEST_ASSERT_EQUAL(exit_code, 0);
+
+ ret = mars_task_queue_destroy(queue);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+
+ ret = mars_task_destroy(&task_id);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+
+ ret = mars_context_destroy(mars);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+
+ return 0;
+}
diff --git a/tests/TFP/TFP_49_001/host_and_mpu.h b/tests/TFP/TFP_49_001/host_and_mpu.h
new file mode 100644
index 0000000..e565e93
--- /dev/null
+++ b/tests/TFP/TFP_49_001/host_and_mpu.h
@@ -0,0 +1,24 @@
+/*
+ * Copyright 2008 Sony Corporation
+ *
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a copy
+ * of this software and associated documentation files (the "Software"), to deal
+ * in the Software without restriction, including without limitation the rights
+ * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+ * copies of the Software, and to permit persons to whom the Software is
+ * furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included in
+ * all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+ * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+ * THE SOFTWARE.
+ */
+
+#define QUEUE_DEPTH 16
diff --git a/tests/TFP/TFP_49_001/mpu.c b/tests/TFP/TFP_49_001/mpu.c
new file mode 100644
index 0000000..cb239df
--- /dev/null
+++ b/tests/TFP/TFP_49_001/mpu.c
@@ -0,0 +1,60 @@
+/*
+ * Copyright 2008 Sony Corporation
+ *
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a copy
+ * of this software and associated documentation files (the "Software"), to deal
+ * in the Software without restriction, including without limitation the rights
+ * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+ * copies of the Software, and to permit persons to whom the Software is
+ * furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included in
+ * all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+ * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+ * THE SOFTWARE.
+ */
+
+#include <string.h>
+#include <mars/mars.h>
+#include "mars_task_test.h"
+#include "host_and_mpu.h"
+
+static uint64_t queue_item[2] __attribute__((aligned(16)));
+
+int mars_task_main(const struct mars_task_args *task_args)
+{
+ uint64_t queue_ea = task_args->type.u64[0];
+ int i, ret;
+
+ for (i = 0; i < QUEUE_DEPTH+1; i++) {
+ queue_item[0] = queue_item[1] = i;
+
+ if (i < QUEUE_DEPTH) {
+ ret = mars_task_queue_try_push_begin(
+ queue_ea,
+ queue_item,
+ 0);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+ } else {
+ ret = mars_task_queue_try_push_begin(
+ queue_ea,
+ queue_item,
+ 0);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_ERROR_BUSY);
+ }
+
+ ret = mars_task_queue_push_end(queue_ea, 0);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+ }
+
+ mars_task_exit(0);
+
+ return 0;
+}
diff --git a/tests/TFP/TFP_49_002/Makefile b/tests/TFP/TFP_49_002/Makefile
new file mode 100644
index 0000000..ecbce33
--- /dev/null
+++ b/tests/TFP/TFP_49_002/Makefile
@@ -0,0 +1,28 @@
+#
+# Copyright 2008 Sony Corporation
+#
+#
+# Permission is hereby granted, free of charge, to any person obtaining a copy
+# of this software and associated documentation files (the "Software"), to deal
+# in the Software without restriction, including without limitation the rights
+# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+# copies of the Software, and to permit persons to whom the Software is
+# furnished to do so, subject to the following conditions:
+#
+# The above copyright notice and this permission notice shall be included in
+# all copies or substantial portions of the Software.
+#
+# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+# THE SOFTWARE.
+#
+
+top_srcdir = ../..
+test_objs = host.o mpu1.task_eo mpu2.task_eo
+
+include $(top_srcdir)/scripts/config.mk
+include $(top_srcdir)/scripts/rules_item.mk
diff --git a/tests/TFP/TFP_49_002/host.c b/tests/TFP/TFP_49_002/host.c
new file mode 100644
index 0000000..9cab8d6
--- /dev/null
+++ b/tests/TFP/TFP_49_002/host.c
@@ -0,0 +1,97 @@
+/*
+ * Copyright 2008 Sony Corporation
+ *
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a copy
+ * of this software and associated documentation files (the "Software"), to deal
+ * in the Software without restriction, including without limitation the rights
+ * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+ * copies of the Software, and to permit persons to whom the Software is
+ * furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included in
+ * all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+ * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+ * THE SOFTWARE.
+ */
+
+#include <libspe2.h>
+#include <mars/mars.h>
+#include <mars_test.h>
+#include "host_and_mpu.h"
+
+extern spe_program_handle_t mpu1_prog, mpu2_prog;
+
+static struct mars_context *mars;
+static struct mars_task_id pusher_task_id, poper_task_id;
+static struct mars_task_args task_args;
+static uint64_t queue;
+static uint32_t notify[32] __attribute__((aligned(16)));
+
+int main(void)
+{
+ int exit_code, ret;
+
+ ret = mars_context_create(&mars, 0, 0);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+
+ ret = mars_task_create(
+ mars,
+ &pusher_task_id,
+ "49002",
+ mpu1_prog.elf_image,
+ MARS_TASK_CONTEXT_SAVE_ALL);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+
+ ret = mars_task_create(
+ mars,
+ &poper_task_id,
+ "49002",
+ mpu2_prog.elf_image,
+ MARS_TASK_CONTEXT_SAVE_ALL);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+
+ ret = mars_task_queue_create(
+ mars,
+ &queue,
+ 16,
+ QUEUE_DEPTH,
+ MARS_TASK_QUEUE_MPU_TO_MPU);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+
+ task_args.type.u64[0] = queue;
+ task_args.type.u64[1] = mars_ptr_to_ea(notify);
+ ret = mars_task_schedule(&pusher_task_id, &task_args, 0);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+
+ ret = mars_task_schedule(&poper_task_id, &task_args, 0);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+
+ ret = mars_task_wait(&pusher_task_id, &exit_code);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+ MARS_TEST_ASSERT_EQUAL(exit_code, 0);
+
+ ret = mars_task_wait(&poper_task_id, &exit_code);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+ MARS_TEST_ASSERT_EQUAL(exit_code, 0);
+
+ ret = mars_task_queue_destroy(queue);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+
+ ret = mars_task_destroy(&pusher_task_id);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+
+ ret = mars_task_destroy(&poper_task_id);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+
+ ret = mars_context_destroy(mars);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+
+ return 0;
+}
diff --git a/tests/TFP/TFP_49_002/host_and_mpu.h b/tests/TFP/TFP_49_002/host_and_mpu.h
new file mode 100644
index 0000000..e565e93
--- /dev/null
+++ b/tests/TFP/TFP_49_002/host_and_mpu.h
@@ -0,0 +1,24 @@
+/*
+ * Copyright 2008 Sony Corporation
+ *
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a copy
+ * of this software and associated documentation files (the "Software"), to deal
+ * in the Software without restriction, including without limitation the rights
+ * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+ * copies of the Software, and to permit persons to whom the Software is
+ * furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included in
+ * all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+ * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+ * THE SOFTWARE.
+ */
+
+#define QUEUE_DEPTH 16
diff --git a/tests/TFP/TFP_49_002/mpu1.c b/tests/TFP/TFP_49_002/mpu1.c
new file mode 100644
index 0000000..85045ba
--- /dev/null
+++ b/tests/TFP/TFP_49_002/mpu1.c
@@ -0,0 +1,63 @@
+/*
+ * Copyright 2008 Sony Corporation
+ *
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a copy
+ * of this software and associated documentation files (the "Software"), to deal
+ * in the Software without restriction, including without limitation the rights
+ * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+ * copies of the Software, and to permit persons to whom the Software is
+ * furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included in
+ * all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+ * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+ * THE SOFTWARE.
+ */
+
+#include <string.h>
+#include <mars/mars.h>
+#include "mars_task_test.h"
+#include "host_and_mpu.h"
+
+static uint64_t queue_item[2] __attribute__((aligned(16)));
+
+int mars_task_main(const struct mars_task_args *task_args)
+{
+ uint64_t queue_ea = task_args->type.u64[0];
+ uint64_t notify_ea = task_args->type.u64[1];
+ int i, ret;
+
+ for (i = 0; i < QUEUE_DEPTH+1; i++) {
+ queue_item[0] = queue_item[1] = i;
+
+ if (i < QUEUE_DEPTH) {
+ ret = mars_task_queue_try_push_begin(
+ queue_ea,
+ queue_item,
+ 0);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+ } else {
+ ret = mars_task_queue_try_push_begin(
+ queue_ea,
+ queue_item,
+ 0);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_ERROR_BUSY);
+ }
+
+ ret = mars_task_queue_push_end(queue_ea, 0);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+ }
+
+ mars_test_counter_set(notify_ea, 1);
+
+ mars_task_exit(0);
+
+ return 0;
+}
diff --git a/tests/TFP/TFP_49_002/mpu2.c b/tests/TFP/TFP_49_002/mpu2.c
new file mode 100644
index 0000000..2f660ef
--- /dev/null
+++ b/tests/TFP/TFP_49_002/mpu2.c
@@ -0,0 +1,49 @@
+/*
+ * Copyright 2008 Sony Corporation
+ *
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a copy
+ * of this software and associated documentation files (the "Software"), to deal
+ * in the Software without restriction, including without limitation the rights
+ * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+ * copies of the Software, and to permit persons to whom the Software is
+ * furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included in
+ * all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+ * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+ * THE SOFTWARE.
+ */
+
+#include <string.h>
+#include <mars/mars.h>
+#include "mars_task_test.h"
+#include "host_and_mpu.h"
+
+static uint64_t queue_item[2] __attribute__((aligned(16)));
+
+int mars_task_main(const struct mars_task_args *task_args)
+{
+ uint64_t queue_ea = task_args->type.u64[0];
+ uint64_t notify_ea = task_args->type.u64[1];
+ int i, ret;
+
+ mars_test_counter_wait(notify_ea, 1);
+
+ for (i = 0; i < QUEUE_DEPTH; i++) {
+ ret = mars_task_queue_pop(queue_ea, queue_item);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+
+ MARS_TEST_ASSERT(queue_item[0] == i && queue_item[1] == i);
+ }
+
+ mars_task_exit(0);
+
+ return 0;
+}
diff --git a/tests/TFP/TFP_49_003/Makefile b/tests/TFP/TFP_49_003/Makefile
new file mode 100644
index 0000000..432135a
--- /dev/null
+++ b/tests/TFP/TFP_49_003/Makefile
@@ -0,0 +1,28 @@
+#
+# Copyright 2008 Sony Corporation
+#
+#
+# Permission is hereby granted, free of charge, to any person obtaining a copy
+# of this software and associated documentation files (the "Software"), to deal
+# in the Software without restriction, including without limitation the rights
+# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+# copies of the Software, and to permit persons to whom the Software is
+# furnished to do so, subject to the following conditions:
+#
+# The above copyright notice and this permission notice shall be included in
+# all copies or substantial portions of the Software.
+#
+# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+# THE SOFTWARE.
+#
+
+top_srcdir = ../..
+test_objs = host.o mpu.task_eo
+
+include $(top_srcdir)/scripts/config.mk
+include $(top_srcdir)/scripts/rules_item.mk
diff --git a/tests/TFP/TFP_49_003/host.c b/tests/TFP/TFP_49_003/host.c
new file mode 100644
index 0000000..0609f37
--- /dev/null
+++ b/tests/TFP/TFP_49_003/host.c
@@ -0,0 +1,139 @@
+/*
+ * Copyright 2008 Sony Corporation
+ *
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a copy
+ * of this software and associated documentation files (the "Software"), to deal
+ * in the Software without restriction, including without limitation the rights
+ * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+ * copies of the Software, and to permit persons to whom the Software is
+ * furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included in
+ * all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+ * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+ * THE SOFTWARE.
+ */
+
+#include <unistd.h>
+#include <mars/mars.h>
+#include <libspe2.h>
+#include <mars_test.h>
+
+struct queue_entry {
+ uint64_t val1;
+ uint64_t val2;
+};
+#define Q_DEPTH (512)
+
+#define NUM_LOOP 5
+static uint32_t depth_size[] =
+{
+ 1,
+ Q_DEPTH / 2,
+ Q_DEPTH,
+ Q_DEPTH,
+ Q_DEPTH
+};
+extern spe_program_handle_t mpu_prog;
+
+static struct mars_context *mars_ctx;
+static struct mars_task_args task_args;
+static struct mars_task_id task_id[Q_DEPTH];
+
+static uint64_t mpu_to_host[NUM_LOOP];
+static uint32_t notify[32] __attribute((aligned(128)));
+static struct queue_entry data;
+
+static void check_queue(uint64_t id, uint64_t num)
+{
+ int ret, i;
+ uint64_t sum, sum_q;
+ uint32_t count;
+
+ sum = sum_q = 0;
+ for (i = 0; i < num; i++) {
+ ret = mars_task_queue_pop(mpu_to_host[id], &data);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+
+ MARS_TEST_ASSERT_EQUAL(data.val1, id);
+ sum += i;
+ sum_q += data.val2;
+ }
+ /* check queue data */
+ MARS_TEST_ASSERT_EQUAL(sum, sum_q);
+
+ /* queue should be empty */
+ ret = mars_task_queue_count(mpu_to_host[id], &count);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+ MARS_TEST_ASSERT_EQUAL(count, 0);
+}
+
+int main(void)
+{
+ int ret, i;
+ int32_t exit_code;
+ uint32_t num;
+
+ ret = mars_context_create(&mars_ctx, 0, 0);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+
+ for (i = 0; i < NUM_LOOP; i++) {
+ notify[0] = 0;
+
+ ret = mars_task_queue_create(
+ mars_ctx,
+ &mpu_to_host[i],
+ sizeof(struct queue_entry),
+ depth_size[i],
+ MARS_TASK_QUEUE_MPU_TO_HOST);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+
+ /* create push task */
+ for (num = 0; num < depth_size[i]; num++) {
+ ret = mars_task_create(mars_ctx, &task_id[num], NULL,
+ mpu_prog.elf_image,
+ MARS_TASK_CONTEXT_SAVE_ALL);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+
+ task_args.type.u64[0] = mpu_to_host[i];
+ task_args.type.u64[1] = (uint64_t)i;
+ task_args.type.u64[2] = (uint64_t)num;
+ task_args.type.u64[3] = mars_ptr_to_ea(&notify);
+ ret = mars_task_schedule(&task_id[num], &task_args, 0);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+ }
+
+ /* start mpu task at the same time */
+ sleep(1);
+ mars_test_counter_set(&notify[0], 1);
+
+ for (num = 0; num < depth_size[i]; num++) {
+ ret = mars_task_wait(&task_id[num], &exit_code);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+ MARS_TEST_ASSERT_ERROR(exit_code, MARS_SUCCESS);
+ }
+
+ /* check queue data */
+ check_queue(i, depth_size[i]);
+
+ for (num = 0; num < depth_size[i]; num++) {
+ ret = mars_task_destroy(&task_id[num]);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+ }
+ ret = mars_task_queue_destroy(mpu_to_host[i]);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+ }
+
+ ret = mars_context_destroy(mars_ctx);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+
+ return 0;
+}
+
diff --git a/tests/TFP/TFP_49_003/mpu.c b/tests/TFP/TFP_49_003/mpu.c
new file mode 100644
index 0000000..86fe027
--- /dev/null
+++ b/tests/TFP/TFP_49_003/mpu.c
@@ -0,0 +1,54 @@
+/*
+ * Copyright 2008 Sony Corporation
+ *
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a copy
+ * of this software and associated documentation files (the "Software"), to deal
+ * in the Software without restriction, including without limitation the rights
+ * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+ * copies of the Software, and to permit persons to whom the Software is
+ * furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included in
+ * all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+ * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+ * THE SOFTWARE.
+ */
+
+#include <mars/mars.h>
+#include <mars_task_test.h>
+#include <spu_mfcio.h>
+
+struct queue_entry {
+ uint64_t val1;
+ uint64_t val2;
+};
+static struct queue_entry data;
+
+int mars_task_main(const struct mars_task_args *task_args)
+{
+ int ret;
+ uint64_t mpu_to_host_ea = task_args->type.u64[0];
+ uint64_t id = task_args->type.u64[1];
+ uint64_t num = task_args->type.u64[2];
+ uint64_t notify_ea = task_args->type.u64[3];
+
+ data.val1 = id;
+ data.val2 = num;
+
+ mars_test_counter_wait(notify_ea, 1);
+
+ ret = mars_task_queue_try_push_begin(mpu_to_host_ea, &data, 1);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+
+ ret = mars_task_queue_push_end(mpu_to_host_ea, 1);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+
+ return 0;
+}
diff --git a/tests/TFP/TFP_49_004/Makefile b/tests/TFP/TFP_49_004/Makefile
new file mode 100644
index 0000000..ecbce33
--- /dev/null
+++ b/tests/TFP/TFP_49_004/Makefile
@@ -0,0 +1,28 @@
+#
+# Copyright 2008 Sony Corporation
+#
+#
+# Permission is hereby granted, free of charge, to any person obtaining a copy
+# of this software and associated documentation files (the "Software"), to deal
+# in the Software without restriction, including without limitation the rights
+# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+# copies of the Software, and to permit persons to whom the Software is
+# furnished to do so, subject to the following conditions:
+#
+# The above copyright notice and this permission notice shall be included in
+# all copies or substantial portions of the Software.
+#
+# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+# THE SOFTWARE.
+#
+
+top_srcdir = ../..
+test_objs = host.o mpu1.task_eo mpu2.task_eo
+
+include $(top_srcdir)/scripts/config.mk
+include $(top_srcdir)/scripts/rules_item.mk
diff --git a/tests/TFP/TFP_49_004/host.c b/tests/TFP/TFP_49_004/host.c
new file mode 100644
index 0000000..9dbfc88
--- /dev/null
+++ b/tests/TFP/TFP_49_004/host.c
@@ -0,0 +1,131 @@
+/*
+ * Copyright 2008 Sony Corporation
+ *
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a copy
+ * of this software and associated documentation files (the "Software"), to deal
+ * in the Software without restriction, including without limitation the rights
+ * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+ * copies of the Software, and to permit persons to whom the Software is
+ * furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included in
+ * all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+ * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+ * THE SOFTWARE.
+ */
+
+#include <unistd.h>
+#include <mars/mars.h>
+#include <libspe2.h>
+#include <mars_test.h>
+
+struct queue_entry {
+ uint64_t val1;
+ uint64_t val2;
+};
+#define Q_DEPTH (256)
+
+#define NUM_LOOP 5
+static uint32_t depth_size[] =
+{
+ 1,
+ Q_DEPTH / 2,
+ Q_DEPTH,
+ Q_DEPTH,
+ Q_DEPTH
+};
+extern spe_program_handle_t mpu1_prog;
+extern spe_program_handle_t mpu2_prog;
+
+static struct mars_context *mars_ctx;
+static struct mars_task_args task1_args, task2_args;
+static struct mars_task_id task1_id[Q_DEPTH], task2_id;
+
+static uint64_t mpu_to_mpu[NUM_LOOP];
+static uint32_t notify[32] __attribute((aligned(128)));
+
+int main(void)
+{
+ int ret, i;
+ int32_t exit_code;
+ uint32_t num;
+
+ ret = mars_context_create(&mars_ctx, 0, 0);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+
+ for (i = 0; i < NUM_LOOP; i++) {
+ notify[0] = 0;
+
+ ret = mars_task_queue_create(
+ mars_ctx,
+ &mpu_to_mpu[i],
+ sizeof(struct queue_entry),
+ depth_size[i],
+ MARS_TASK_QUEUE_MPU_TO_MPU);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+
+ /* create push task */
+ for (num = 0; num < depth_size[i]; num++) {
+ ret = mars_task_create(mars_ctx, &task1_id[num], NULL,
+ mpu1_prog.elf_image,
+ MARS_TASK_CONTEXT_SAVE_ALL);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+
+ task1_args.type.u64[0] = mpu_to_mpu[i];
+ task1_args.type.u64[1] = (uint64_t)i;
+ task1_args.type.u64[2] = (uint64_t)num;
+ task1_args.type.u64[3] = mars_ptr_to_ea(&notify);
+ ret = mars_task_schedule(&task1_id[num],
+ &task1_args, 0);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+ }
+
+ /* create pop task */
+ ret = mars_task_create(mars_ctx, &task2_id, NULL,
+ mpu2_prog.elf_image, MARS_TASK_CONTEXT_SAVE_ALL);
+
+ /* start push task at the same time */
+ sleep(1);
+ mars_test_counter_set(&notify[0], 1);
+
+ for (num = 0; num < depth_size[i]; num++) {
+ ret = mars_task_wait(&task1_id[num], &exit_code);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+ MARS_TEST_ASSERT_ERROR(exit_code, MARS_SUCCESS);
+ }
+
+ /* run pop task */
+ task2_args.type.u64[0] = mpu_to_mpu[i];
+ task2_args.type.u64[1] = (uint64_t)i;
+ task2_args.type.u64[2] = (uint64_t)depth_size[i];
+ ret = mars_task_schedule(&task2_id, &task2_args, 0);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+
+ ret = mars_task_wait(&task2_id, &exit_code);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+ MARS_TEST_ASSERT_ERROR(exit_code, MARS_SUCCESS);
+
+ ret = mars_task_destroy(&task2_id);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+
+ for (num = 0; num < depth_size[i]; num++) {
+ ret = mars_task_destroy(&task1_id[num]);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+ }
+ ret = mars_task_queue_destroy(mpu_to_mpu[i]);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+ }
+
+ ret = mars_context_destroy(mars_ctx);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+
+ return 0;
+}
+
diff --git a/tests/TFP/TFP_49_004/mpu1.c b/tests/TFP/TFP_49_004/mpu1.c
new file mode 100644
index 0000000..1d5ba4f
--- /dev/null
+++ b/tests/TFP/TFP_49_004/mpu1.c
@@ -0,0 +1,54 @@
+/*
+ * Copyright 2008 Sony Corporation
+ *
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a copy
+ * of this software and associated documentation files (the "Software"), to deal
+ * in the Software without restriction, including without limitation the rights
+ * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+ * copies of the Software, and to permit persons to whom the Software is
+ * furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included in
+ * all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+ * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+ * THE SOFTWARE.
+ */
+
+#include <mars/mars.h>
+#include <mars_task_test.h>
+#include <spu_mfcio.h>
+
+struct queue_entry {
+ uint64_t val1;
+ uint64_t val2;
+};
+static struct queue_entry data;
+
+int mars_task_main(const struct mars_task_args *task_args)
+{
+ int ret;
+ uint64_t mpu_to_mpu_ea = task_args->type.u64[0];
+ uint64_t id = task_args->type.u64[1];
+ uint64_t num = task_args->type.u64[2];
+ uint64_t notify_ea = task_args->type.u64[3];
+
+ data.val1 = id;
+ data.val2 = num;
+
+ mars_test_counter_wait(notify_ea, 1);
+
+ ret = mars_task_queue_try_push_begin(mpu_to_mpu_ea, &data, 1);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+
+ ret = mars_task_queue_push_end(mpu_to_mpu_ea, 1);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+
+ return 0;
+}
diff --git a/tests/TFP/TFP_49_004/mpu2.c b/tests/TFP/TFP_49_004/mpu2.c
new file mode 100644
index 0000000..c43688b
--- /dev/null
+++ b/tests/TFP/TFP_49_004/mpu2.c
@@ -0,0 +1,61 @@
+/*
+ * Copyright 2008 Sony Corporation
+ *
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a copy
+ * of this software and associated documentation files (the "Software"), to deal
+ * in the Software without restriction, including without limitation the rights
+ * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+ * copies of the Software, and to permit persons to whom the Software is
+ * furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included in
+ * all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+ * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+ * THE SOFTWARE.
+ */
+
+#include <mars/mars.h>
+#include <mars_task_test.h>
+
+struct queue_entry {
+ uint64_t val1;
+ uint64_t val2;
+};
+static struct queue_entry data;
+
+int mars_task_main(const struct mars_task_args *task_args)
+{
+ int ret, i;
+ uint64_t mpu_to_mpu_ea = task_args->type.u64[0];
+ uint64_t id = task_args->type.u64[1];
+ uint64_t num = task_args->type.u64[2];
+ uint64_t sum, sum_q;
+ uint32_t count;
+
+ sum = sum_q = 0;
+ for (i = 0; i < num; i++) {
+ ret = mars_task_queue_pop(mpu_to_mpu_ea, &data);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+
+ MARS_TEST_ASSERT_EQUAL(data.val1, id);
+ sum += i;
+ sum_q += data.val2;
+ }
+
+ /* check queue data */
+ MARS_TEST_ASSERT_EQUAL(sum, sum_q);
+
+ /* queue should be empty */
+ ret = mars_task_queue_count(mpu_to_mpu_ea, &count);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+ MARS_TEST_ASSERT_EQUAL(count, 0);
+
+ return 0;
+}
diff --git a/tests/TFP/TFP_4A_001/Makefile b/tests/TFP/TFP_4A_001/Makefile
new file mode 100644
index 0000000..432135a
--- /dev/null
+++ b/tests/TFP/TFP_4A_001/Makefile
@@ -0,0 +1,28 @@
+#
+# Copyright 2008 Sony Corporation
+#
+#
+# Permission is hereby granted, free of charge, to any person obtaining a copy
+# of this software and associated documentation files (the "Software"), to deal
+# in the Software without restriction, including without limitation the rights
+# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+# copies of the Software, and to permit persons to whom the Software is
+# furnished to do so, subject to the following conditions:
+#
+# The above copyright notice and this permission notice shall be included in
+# all copies or substantial portions of the Software.
+#
+# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+# THE SOFTWARE.
+#
+
+top_srcdir = ../..
+test_objs = host.o mpu.task_eo
+
+include $(top_srcdir)/scripts/config.mk
+include $(top_srcdir)/scripts/rules_item.mk
diff --git a/tests/TFP/TFP_4A_001/host.c b/tests/TFP/TFP_4A_001/host.c
new file mode 100644
index 0000000..1c07f12
--- /dev/null
+++ b/tests/TFP/TFP_4A_001/host.c
@@ -0,0 +1,90 @@
+/*
+ * Copyright 2008 Sony Corporation
+ *
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a copy
+ * of this software and associated documentation files (the "Software"), to deal
+ * in the Software without restriction, including without limitation the rights
+ * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+ * copies of the Software, and to permit persons to whom the Software is
+ * furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included in
+ * all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+ * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+ * THE SOFTWARE.
+ */
+
+#include <unistd.h>
+#include <libspe2.h>
+#include <mars/mars.h>
+#include <mars_test.h>
+
+#define QUEUE_DEPTH 16
+
+extern spe_program_handle_t mpu_prog;
+
+static struct mars_context *mars;
+static struct mars_task_id task_id;
+static struct mars_task_args task_args;
+static uint64_t queue;
+static uint64_t queue_item[2], mpu_answer __attribute__((aligned(16)));
+
+int main(void)
+{
+ int exit_code, ret;
+
+ ret = mars_context_create(&mars, 0, 0);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+
+ ret = mars_task_create(
+ mars,
+ &task_id,
+ "4A001",
+ mpu_prog.elf_image,
+ MARS_TASK_CONTEXT_SAVE_ALL);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+
+ ret = mars_task_queue_create(
+ mars,
+ &queue,
+ 16,
+ QUEUE_DEPTH,
+ MARS_TASK_QUEUE_HOST_TO_MPU);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+
+ mpu_answer = 0;
+
+ task_args.type.u64[0] = queue;
+ task_args.type.u64[1] = mars_ptr_to_ea(&mpu_answer);
+ ret = mars_task_schedule(&task_id, &task_args, 0);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+
+ usleep(200000);
+
+ mpu_answer = 1;
+
+ ret = mars_task_queue_push(queue, queue_item);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+
+ ret = mars_task_wait(&task_id, &exit_code);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+ MARS_TEST_ASSERT_EQUAL(exit_code, 0);
+
+ ret = mars_task_queue_destroy(queue);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+
+ ret = mars_task_destroy(&task_id);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+
+ ret = mars_context_destroy(mars);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+
+ return 0;
+}
diff --git a/tests/TFP/TFP_4A_001/mpu.c b/tests/TFP/TFP_4A_001/mpu.c
new file mode 100644
index 0000000..0813eac
--- /dev/null
+++ b/tests/TFP/TFP_4A_001/mpu.c
@@ -0,0 +1,47 @@
+/*
+ * Copyright 2008 Sony Corporation
+ *
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a copy
+ * of this software and associated documentation files (the "Software"), to deal
+ * in the Software without restriction, including without limitation the rights
+ * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+ * copies of the Software, and to permit persons to whom the Software is
+ * furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included in
+ * all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+ * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+ * THE SOFTWARE.
+ */
+
+#include <string.h>
+#include <spu_mfcio.h>
+#include <mars/mars.h>
+#include "mars_task_test.h"
+
+static uint64_t queue_item[2] __attribute__((aligned(16)));
+
+int mars_task_main(const struct mars_task_args *task_args)
+{
+ uint64_t queue_ea = task_args->type.u64[0];
+ uint64_t mpu_answer_ea = task_args->type.u64[1];
+ uint64_t mpu_answer;
+ int ret;
+
+ ret = mars_task_queue_pop(queue_ea, queue_item);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+
+ mpu_answer = mars_test_int64_get(mpu_answer_ea);
+ MARS_TEST_ASSERT(mpu_answer);
+
+ mars_task_exit(0);
+
+ return 0;
+}
diff --git a/tests/TFP/TFP_4A_002/Makefile b/tests/TFP/TFP_4A_002/Makefile
new file mode 100644
index 0000000..432135a
--- /dev/null
+++ b/tests/TFP/TFP_4A_002/Makefile
@@ -0,0 +1,28 @@
+#
+# Copyright 2008 Sony Corporation
+#
+#
+# Permission is hereby granted, free of charge, to any person obtaining a copy
+# of this software and associated documentation files (the "Software"), to deal
+# in the Software without restriction, including without limitation the rights
+# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+# copies of the Software, and to permit persons to whom the Software is
+# furnished to do so, subject to the following conditions:
+#
+# The above copyright notice and this permission notice shall be included in
+# all copies or substantial portions of the Software.
+#
+# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+# THE SOFTWARE.
+#
+
+top_srcdir = ../..
+test_objs = host.o mpu.task_eo
+
+include $(top_srcdir)/scripts/config.mk
+include $(top_srcdir)/scripts/rules_item.mk
diff --git a/tests/TFP/TFP_4A_002/host.c b/tests/TFP/TFP_4A_002/host.c
new file mode 100644
index 0000000..870ff74
--- /dev/null
+++ b/tests/TFP/TFP_4A_002/host.c
@@ -0,0 +1,92 @@
+/*
+ * Copyright 2008 Sony Corporation
+ *
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a copy
+ * of this software and associated documentation files (the "Software"), to deal
+ * in the Software without restriction, including without limitation the rights
+ * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+ * copies of the Software, and to permit persons to whom the Software is
+ * furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included in
+ * all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+ * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+ * THE SOFTWARE.
+ */
+
+#include <libspe2.h>
+#include <mars/mars.h>
+#include <mars_test.h>
+
+#define QUEUE_DEPTH 16
+
+extern spe_program_handle_t mpu_prog;
+
+static struct mars_context *mars;
+static struct mars_task_id task_id;
+static struct mars_task_args task_args;
+static uint64_t queue;
+static uint64_t queue_item[2], mpu_answer __attribute__((aligned(16)));
+
+int main(void)
+{
+ int exit_code, ret;
+ uint32_t tb_freq;
+
+ ret = mars_test_get_timebase_freq(&tb_freq);
+ MARS_TEST_ASSERT_EQUAL(ret, 0);
+
+ ret = mars_context_create(&mars, 0, 0);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+
+ ret = mars_task_create(
+ mars,
+ &task_id,
+ "4A002",
+ mpu_prog.elf_image,
+ MARS_TASK_CONTEXT_SAVE_ALL);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+
+ ret = mars_task_queue_create(
+ mars,
+ &queue,
+ 16,
+ QUEUE_DEPTH,
+ MARS_TASK_QUEUE_MPU_TO_HOST);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+
+ mpu_answer = 0;
+
+ task_args.type.u64[0] = queue;
+ task_args.type.u64[1] = mars_ptr_to_ea(&mpu_answer);
+ task_args.type.u64[2] = tb_freq;
+ ret = mars_task_schedule(&task_id, &task_args, 0);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+
+ ret = mars_task_queue_pop(queue, queue_item);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+
+ MARS_TEST_ASSERT(mpu_answer);
+
+ ret = mars_task_wait(&task_id, &exit_code);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+ MARS_TEST_ASSERT_EQUAL(exit_code, 0);
+
+ ret = mars_task_queue_destroy(queue);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+
+ ret = mars_task_destroy(&task_id);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+
+ ret = mars_context_destroy(mars);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+
+ return 0;
+}
diff --git a/tests/TFP/TFP_4A_002/mpu.c b/tests/TFP/TFP_4A_002/mpu.c
new file mode 100644
index 0000000..62015b8
--- /dev/null
+++ b/tests/TFP/TFP_4A_002/mpu.c
@@ -0,0 +1,48 @@
+/*
+ * Copyright 2008 Sony Corporation
+ *
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a copy
+ * of this software and associated documentation files (the "Software"), to deal
+ * in the Software without restriction, including without limitation the rights
+ * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+ * copies of the Software, and to permit persons to whom the Software is
+ * furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included in
+ * all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+ * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+ * THE SOFTWARE.
+ */
+
+#include <string.h>
+#include <spu_mfcio.h>
+#include <mars/mars.h>
+#include "mars_task_test.h"
+
+static uint64_t queue_item[2] __attribute__((aligned(16)));
+
+int mars_task_main(const struct mars_task_args *task_args)
+{
+ uint64_t queue_ea = task_args->type.u64[0];
+ uint64_t mpu_answer_ea = task_args->type.u64[1];
+ uint32_t tb_freq = task_args->type.u64[2];
+ int ret;
+
+ mars_test_usleep(tb_freq, 200000);
+
+ mars_test_int64_put(mpu_answer_ea, 1);
+
+ ret = mars_task_queue_push(queue_ea, queue_item);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+
+ mars_task_exit(0);
+
+ return 0;
+}
diff --git a/tests/TFP/TFP_4A_003/Makefile b/tests/TFP/TFP_4A_003/Makefile
new file mode 100644
index 0000000..ecbce33
--- /dev/null
+++ b/tests/TFP/TFP_4A_003/Makefile
@@ -0,0 +1,28 @@
+#
+# Copyright 2008 Sony Corporation
+#
+#
+# Permission is hereby granted, free of charge, to any person obtaining a copy
+# of this software and associated documentation files (the "Software"), to deal
+# in the Software without restriction, including without limitation the rights
+# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+# copies of the Software, and to permit persons to whom the Software is
+# furnished to do so, subject to the following conditions:
+#
+# The above copyright notice and this permission notice shall be included in
+# all copies or substantial portions of the Software.
+#
+# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+# THE SOFTWARE.
+#
+
+top_srcdir = ../..
+test_objs = host.o mpu1.task_eo mpu2.task_eo
+
+include $(top_srcdir)/scripts/config.mk
+include $(top_srcdir)/scripts/rules_item.mk
diff --git a/tests/TFP/TFP_4A_003/host.c b/tests/TFP/TFP_4A_003/host.c
new file mode 100644
index 0000000..989de00
--- /dev/null
+++ b/tests/TFP/TFP_4A_003/host.c
@@ -0,0 +1,105 @@
+/*
+ * Copyright 2008 Sony Corporation
+ *
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a copy
+ * of this software and associated documentation files (the "Software"), to deal
+ * in the Software without restriction, including without limitation the rights
+ * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+ * copies of the Software, and to permit persons to whom the Software is
+ * furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included in
+ * all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+ * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+ * THE SOFTWARE.
+ */
+
+#include <libspe2.h>
+#include <mars/mars.h>
+#include <mars_test.h>
+
+#define QUEUE_DEPTH 16
+
+extern spe_program_handle_t mpu1_prog, mpu2_prog;
+
+static struct mars_context *mars;
+static struct mars_task_id pusher_task_id, poper_task_id;
+static struct mars_task_args task_args;
+static uint64_t queue;
+static uint64_t mpu_answer __attribute__((aligned(16)));
+
+int main(void)
+{
+ int exit_code, ret;
+ uint32_t tb_freq;
+
+ ret = mars_test_get_timebase_freq(&tb_freq);
+ MARS_TEST_ASSERT_EQUAL(ret, 0);
+
+ ret = mars_context_create(&mars, 0, 0);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+
+ ret = mars_task_create(
+ mars,
+ &pusher_task_id,
+ "4A003",
+ mpu1_prog.elf_image,
+ MARS_TASK_CONTEXT_SAVE_ALL);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+
+ ret = mars_task_create(
+ mars,
+ &poper_task_id,
+ "4A003",
+ mpu2_prog.elf_image,
+ MARS_TASK_CONTEXT_SAVE_ALL);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+
+ ret = mars_task_queue_create(
+ mars,
+ &queue,
+ 16,
+ QUEUE_DEPTH,
+ MARS_TASK_QUEUE_MPU_TO_MPU);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+
+ mpu_answer = 0;
+
+ task_args.type.u64[0] = queue;
+ task_args.type.u64[1] = mars_ptr_to_ea(&mpu_answer);
+ task_args.type.u64[2] = tb_freq;
+ ret = mars_task_schedule(&pusher_task_id, &task_args, 0);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+
+ ret = mars_task_schedule(&poper_task_id, &task_args, 0);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+
+ ret = mars_task_wait(&pusher_task_id, &exit_code);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+ MARS_TEST_ASSERT_EQUAL(exit_code, 0);
+
+ ret = mars_task_wait(&poper_task_id, &exit_code);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+ MARS_TEST_ASSERT_EQUAL(exit_code, 0);
+
+ ret = mars_task_queue_destroy(queue);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+
+ ret = mars_task_destroy(&pusher_task_id);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+
+ ret = mars_task_destroy(&poper_task_id);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+
+ ret = mars_context_destroy(mars);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+
+ return 0;
+}
diff --git a/tests/TFP/TFP_4A_003/mpu1.c b/tests/TFP/TFP_4A_003/mpu1.c
new file mode 100644
index 0000000..59cd979
--- /dev/null
+++ b/tests/TFP/TFP_4A_003/mpu1.c
@@ -0,0 +1,48 @@
+/*
+ * Copyright 2008 Sony Corporation
+ *
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a copy
+ * of this software and associated documentation files (the "Software"), to deal
+ * in the Software without restriction, including without limitation the rights
+ * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+ * copies of the Software, and to permit persons to whom the Software is
+ * furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included in
+ * all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+ * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+ * THE SOFTWARE.
+ */
+
+#include <string.h>
+#include <spu_mfcio.h>
+#include <mars/mars.h>
+#include "mars_task_test.h"
+
+static uint64_t queue_item[2] __attribute__((aligned(16)));
+
+int mars_task_main(const struct mars_task_args *task_args)
+{
+ uint64_t queue_ea = task_args->type.u64[0];
+ uint64_t mpu_answer_ea = task_args->type.u64[1];
+ uint64_t tb_freq = task_args->type.u64[2];
+ int ret;
+
+ mars_test_usleep(tb_freq, 200000);
+
+ mars_test_int64_put(mpu_answer_ea, 1);
+
+ ret = mars_task_queue_push(queue_ea, queue_item);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+
+ mars_task_exit(0);
+
+ return 0;
+}
diff --git a/tests/TFP/TFP_4A_003/mpu2.c b/tests/TFP/TFP_4A_003/mpu2.c
new file mode 100644
index 0000000..1e66283
--- /dev/null
+++ b/tests/TFP/TFP_4A_003/mpu2.c
@@ -0,0 +1,47 @@
+/*
+ * Copyright 2008 Sony Corporation
+ *
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a copy
+ * of this software and associated documentation files (the "Software"), to deal
+ * in the Software without restriction, including without limitation the rights
+ * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+ * copies of the Software, and to permit persons to whom the Software is
+ * furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included in
+ * all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+ * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+ * THE SOFTWARE.
+ */
+
+#include <string.h>
+#include <spu_mfcio.h>
+#include <mars/mars.h>
+#include "mars_task_test.h"
+
+static uint64_t queue_item[2] __attribute__((aligned(16)));
+
+int mars_task_main(const struct mars_task_args *task_args)
+{
+ uint64_t queue_ea = task_args->type.u64[0];
+ uint64_t mpu_answer_ea = task_args->type.u64[1];
+ int ret;
+
+ uint64_t mpu_answer;
+ ret = mars_task_queue_pop(queue_ea, queue_item);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+
+ mpu_answer = mars_test_int64_get(mpu_answer_ea);
+ MARS_TEST_ASSERT(mpu_answer);
+
+ mars_task_exit(0);
+
+ return 0;
+}
diff --git a/tests/TFP/TFP_4A_004/Makefile b/tests/TFP/TFP_4A_004/Makefile
new file mode 100644
index 0000000..432135a
--- /dev/null
+++ b/tests/TFP/TFP_4A_004/Makefile
@@ -0,0 +1,28 @@
+#
+# Copyright 2008 Sony Corporation
+#
+#
+# Permission is hereby granted, free of charge, to any person obtaining a copy
+# of this software and associated documentation files (the "Software"), to deal
+# in the Software without restriction, including without limitation the rights
+# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+# copies of the Software, and to permit persons to whom the Software is
+# furnished to do so, subject to the following conditions:
+#
+# The above copyright notice and this permission notice shall be included in
+# all copies or substantial portions of the Software.
+#
+# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+# THE SOFTWARE.
+#
+
+top_srcdir = ../..
+test_objs = host.o mpu.task_eo
+
+include $(top_srcdir)/scripts/config.mk
+include $(top_srcdir)/scripts/rules_item.mk
diff --git a/tests/TFP/TFP_4A_004/host.c b/tests/TFP/TFP_4A_004/host.c
new file mode 100644
index 0000000..fdf3de4
--- /dev/null
+++ b/tests/TFP/TFP_4A_004/host.c
@@ -0,0 +1,138 @@
+/*
+ * Copyright 2008 Sony Corporation
+ *
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a copy
+ * of this software and associated documentation files (the "Software"), to deal
+ * in the Software without restriction, including without limitation the rights
+ * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+ * copies of the Software, and to permit persons to whom the Software is
+ * furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included in
+ * all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+ * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+ * THE SOFTWARE.
+ */
+
+#include <unistd.h>
+#include <mars/mars.h>
+#include <libspe2.h>
+#include <mars_test.h>
+
+struct queue_entry {
+ uint64_t val1;
+ uint64_t val2;
+};
+#define Q_DEPTH (MARS_TASK_QUEUE_WAIT_MAX)
+
+#define TEST_DIFF 1
+
+#define NUM_LOOP 5
+static uint32_t depth_size[] =
+{
+ 1,
+ Q_DEPTH / 2,
+ Q_DEPTH,
+ Q_DEPTH,
+ Q_DEPTH
+};
+extern spe_program_handle_t mpu_prog;
+
+static struct mars_context *mars_ctx;
+static struct mars_task_args task_args;
+static struct mars_task_id task_id[Q_DEPTH];
+
+static uint64_t host_to_mpu[NUM_LOOP];
+static uint32_t notify[32] __attribute((aligned(128)));
+static struct queue_entry data;
+
+static void queue_push(uint64_t id, uint64_t count)
+{
+ int ret, i;
+
+ for (i = 0; i < count; i++) {
+ data.val1 = i;
+ data.val2 = i + TEST_DIFF;
+ ret = mars_task_queue_push(host_to_mpu[id], &data);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+ }
+}
+
+int main(void)
+{
+ int ret, i;
+ int32_t exit_code, chk_exit;
+ uint32_t num;
+ uint32_t chk_bit, count;
+
+ ret = mars_context_create(&mars_ctx, 0, 0);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+
+ for (i = 0; i < NUM_LOOP; i++) {
+ notify[0] = 0;
+ chk_bit = 0;
+
+ ret = mars_task_queue_create(
+ mars_ctx,
+ &host_to_mpu[i],
+ sizeof(struct queue_entry),
+ depth_size[i],
+ MARS_TASK_QUEUE_HOST_TO_MPU);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+
+ queue_push(i, depth_size[i]);
+
+ /* create pop task */
+ for (num = 0; num < depth_size[i]; num++) {
+ chk_bit += (1 << num);
+
+ /* create pop task */
+ ret = mars_task_create(mars_ctx, &task_id[num], NULL,
+ mpu_prog.elf_image, MARS_TASK_CONTEXT_SAVE_ALL);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+
+ task_args.type.u64[0] = host_to_mpu[i];
+ task_args.type.u64[1] =
+ mars_ptr_to_ea(&notify);
+ ret = mars_task_schedule(&task_id[num],
+ &task_args, 0);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+ }
+
+ /* start mpu tasks at the same time */
+ sleep(1);
+ mars_test_counter_set(&notify[0], 1);
+
+ chk_exit = 0;
+ for (num = 0; num < depth_size[i]; num++) {
+ ret = mars_task_wait(&task_id[num], &exit_code);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+ chk_exit |= exit_code;
+
+ ret = mars_task_destroy(&task_id[num]);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+ }
+ MARS_TEST_ASSERT_EQUAL((uint32_t)chk_exit, chk_bit);
+
+ /* check queue count */
+ ret = mars_task_queue_count(host_to_mpu[i], &count);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+ MARS_TEST_ASSERT_EQUAL(count, 0);
+
+ ret = mars_task_queue_destroy(host_to_mpu[i]);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+ }
+
+ ret = mars_context_destroy(mars_ctx);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+
+ return 0;
+}
+
diff --git a/tests/TFP/TFP_4A_004/mpu.c b/tests/TFP/TFP_4A_004/mpu.c
new file mode 100644
index 0000000..889db8c
--- /dev/null
+++ b/tests/TFP/TFP_4A_004/mpu.c
@@ -0,0 +1,54 @@
+/*
+ * Copyright 2008 Sony Corporation
+ *
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a copy
+ * of this software and associated documentation files (the "Software"), to deal
+ * in the Software without restriction, including without limitation the rights
+ * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+ * copies of the Software, and to permit persons to whom the Software is
+ * furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included in
+ * all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+ * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+ * THE SOFTWARE.
+ */
+
+#include <mars/mars.h>
+#include <mars_task_test.h>
+#include <spu_mfcio.h>
+
+#define TEST_DIFF 1
+struct queue_entry {
+ uint64_t val1;
+ uint64_t val2;
+};
+static struct queue_entry data;
+
+int mars_task_main(const struct mars_task_args *task_args)
+{
+ int ret;
+ uint64_t host_to_mpu_ea = task_args->type.u64[0];
+ uint64_t notify_ea = task_args->type.u64[1];
+ uint64_t val;
+
+ mars_test_counter_set(notify_ea, 1);
+
+ ret = mars_task_queue_pop(host_to_mpu_ea, &data);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+
+ /* check queue data */
+ val = data.val2 - data.val1;
+ MARS_TEST_ASSERT_EQUAL(val, TEST_DIFF);
+
+ mars_task_exit(1 << data.val1);
+
+ return 0;
+}
diff --git a/tests/TFP/TFP_4A_005/Makefile b/tests/TFP/TFP_4A_005/Makefile
new file mode 100644
index 0000000..432135a
--- /dev/null
+++ b/tests/TFP/TFP_4A_005/Makefile
@@ -0,0 +1,28 @@
+#
+# Copyright 2008 Sony Corporation
+#
+#
+# Permission is hereby granted, free of charge, to any person obtaining a copy
+# of this software and associated documentation files (the "Software"), to deal
+# in the Software without restriction, including without limitation the rights
+# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+# copies of the Software, and to permit persons to whom the Software is
+# furnished to do so, subject to the following conditions:
+#
+# The above copyright notice and this permission notice shall be included in
+# all copies or substantial portions of the Software.
+#
+# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+# THE SOFTWARE.
+#
+
+top_srcdir = ../..
+test_objs = host.o mpu.task_eo
+
+include $(top_srcdir)/scripts/config.mk
+include $(top_srcdir)/scripts/rules_item.mk
diff --git a/tests/TFP/TFP_4A_005/host.c b/tests/TFP/TFP_4A_005/host.c
new file mode 100644
index 0000000..0a3eb7b
--- /dev/null
+++ b/tests/TFP/TFP_4A_005/host.c
@@ -0,0 +1,155 @@
+/*
+ * Copyright 2008 Sony Corporation
+ *
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a copy
+ * of this software and associated documentation files (the "Software"), to deal
+ * in the Software without restriction, including without limitation the rights
+ * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+ * copies of the Software, and to permit persons to whom the Software is
+ * furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included in
+ * all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+ * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+ * THE SOFTWARE.
+ */
+
+#include <pthread.h>
+#include <unistd.h>
+#include <mars/mars.h>
+#include <libspe2.h>
+#include <mars_test.h>
+
+struct queue_entry {
+ uint64_t val1;
+ uint64_t val2;
+};
+#define Q_DEPTH (MARS_TASK_QUEUE_WAIT_MAX)
+
+#define TEST_DIFF 1
+
+#define NUM_LOOP 5
+static uint32_t depth_size[] =
+{
+ 1,
+ Q_DEPTH / 2,
+ Q_DEPTH,
+ Q_DEPTH,
+ Q_DEPTH
+};
+extern spe_program_handle_t mpu_prog;
+
+static struct mars_context *mars_ctx;
+static struct mars_task_args task1_args;
+static struct mars_task_args thread_args[Q_DEPTH];
+static struct mars_task_id task1_id;
+
+static uint64_t mpu_to_host[NUM_LOOP];
+static uint32_t shared_resource __attribute((aligned(16)));
+static struct queue_entry data[Q_DEPTH];
+
+static pthread_t thread[Q_DEPTH];
+static void *thread_proc(void *ptr)
+{
+ int ret;
+ struct mars_task_args *task_args = (struct mars_task_args *)ptr;
+ uint32_t id = (uint32_t)task_args->type.u32[0];
+ uint32_t num = (uint32_t)task_args->type.u32[1];
+ uint64_t val;
+
+ /* wait for start */
+ while (!shared_resource)
+ usleep(100);
+
+ ret = mars_task_queue_pop(mpu_to_host[id], &data[num]);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+
+ /* check queue data */
+ val = data[num].val2 - data[num].val1;
+ MARS_TEST_ASSERT_EQUAL(val, TEST_DIFF);
+
+ return (void *)(1 << data[num].val1);
+}
+
+int main(void)
+{
+ int ret, i;
+ int32_t exit_code;
+ uint32_t num;
+ uint32_t chk_bit, chk_exit, count;
+ void *p_ret;
+
+ ret = mars_context_create(&mars_ctx, 0, 0);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+
+ for (i = 0; i < NUM_LOOP; i++) {
+ shared_resource = 0;
+ chk_bit = 0;
+
+ ret = mars_task_queue_create(
+ mars_ctx,
+ &mpu_to_host[i],
+ sizeof(struct queue_entry),
+ depth_size[i],
+ MARS_TASK_QUEUE_MPU_TO_HOST);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+
+ /* create push task */
+ ret = mars_task_create(mars_ctx, &task1_id, NULL,
+ mpu_prog.elf_image,
+ MARS_TASK_CONTEXT_SAVE_ALL);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+
+ task1_args.type.u64[0] = mpu_to_host[i];
+ task1_args.type.u64[1] = (uint64_t) depth_size[i];
+ ret = mars_task_schedule(&task1_id, &task1_args, 0);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+
+ ret = mars_task_wait(&task1_id, &exit_code);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+ MARS_TEST_ASSERT_ERROR(exit_code, MARS_SUCCESS);
+
+ ret = mars_task_destroy(&task1_id);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+
+ for (num = 0; num < depth_size[i]; num++) {
+ chk_bit += (1 << num);
+
+ /* create pop thread */
+ thread_args[num].type.u32[0] = (uint32_t)i;
+ pthread_create(&thread[num], NULL,
+ thread_proc, &thread_args[num]);
+ }
+
+ /* start ppe threads and mpu tasks at the same time */
+ sleep(1);
+ shared_resource = 1;
+
+ chk_exit = 0;
+ for (num = 0; num < depth_size[i]; num++) {
+ pthread_join(thread[num], &p_ret);
+ chk_exit |= (uint32_t)p_ret;
+ }
+ MARS_TEST_ASSERT_EQUAL(chk_exit, chk_bit);
+
+ ret = mars_task_queue_count(mpu_to_host[i], &count);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+ MARS_TEST_ASSERT_EQUAL(count, 0);
+
+ ret = mars_task_queue_destroy(mpu_to_host[i]);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+ }
+
+ ret = mars_context_destroy(mars_ctx);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+
+ return 0;
+}
+
diff --git a/tests/TFP/TFP_4A_005/mpu.c b/tests/TFP/TFP_4A_005/mpu.c
new file mode 100644
index 0000000..c7d8751
--- /dev/null
+++ b/tests/TFP/TFP_4A_005/mpu.c
@@ -0,0 +1,49 @@
+/*
+ * Copyright 2008 Sony Corporation
+ *
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a copy
+ * of this software and associated documentation files (the "Software"), to deal
+ * in the Software without restriction, including without limitation the rights
+ * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+ * copies of the Software, and to permit persons to whom the Software is
+ * furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included in
+ * all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+ * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+ * THE SOFTWARE.
+ */
+
+#include <mars/mars.h>
+#include <mars_task_test.h>
+
+#define TEST_DIFF 1
+struct queue_entry {
+ uint64_t val1;
+ uint64_t val2;
+};
+static struct queue_entry data;
+
+int mars_task_main(const struct mars_task_args *task_args)
+{
+ int ret, i;
+ uint64_t mpu_to_host_ea = task_args->type.u64[0];
+ uint32_t num = task_args->type.u64[1];
+
+ for (i = 0; i < num; i++) {
+ data.val1 = i;
+ data.val2 = i + TEST_DIFF;
+
+ ret = mars_task_queue_push(mpu_to_host_ea, &data);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+ }
+
+ return 0;
+}
diff --git a/tests/TFP/TFP_4A_006/Makefile b/tests/TFP/TFP_4A_006/Makefile
new file mode 100644
index 0000000..ecbce33
--- /dev/null
+++ b/tests/TFP/TFP_4A_006/Makefile
@@ -0,0 +1,28 @@
+#
+# Copyright 2008 Sony Corporation
+#
+#
+# Permission is hereby granted, free of charge, to any person obtaining a copy
+# of this software and associated documentation files (the "Software"), to deal
+# in the Software without restriction, including without limitation the rights
+# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+# copies of the Software, and to permit persons to whom the Software is
+# furnished to do so, subject to the following conditions:
+#
+# The above copyright notice and this permission notice shall be included in
+# all copies or substantial portions of the Software.
+#
+# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+# THE SOFTWARE.
+#
+
+top_srcdir = ../..
+test_objs = host.o mpu1.task_eo mpu2.task_eo
+
+include $(top_srcdir)/scripts/config.mk
+include $(top_srcdir)/scripts/rules_item.mk
diff --git a/tests/TFP/TFP_4A_006/host.c b/tests/TFP/TFP_4A_006/host.c
new file mode 100644
index 0000000..e66bb36
--- /dev/null
+++ b/tests/TFP/TFP_4A_006/host.c
@@ -0,0 +1,150 @@
+/*
+ * Copyright 2008 Sony Corporation
+ *
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a copy
+ * of this software and associated documentation files (the "Software"), to deal
+ * in the Software without restriction, including without limitation the rights
+ * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+ * copies of the Software, and to permit persons to whom the Software is
+ * furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included in
+ * all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+ * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+ * THE SOFTWARE.
+ */
+
+#include <unistd.h>
+#include <mars/mars.h>
+#include <libspe2.h>
+#include <mars_test.h>
+
+struct queue_entry {
+ uint64_t val1;
+ uint64_t val2;
+};
+#define Q_DEPTH (MARS_TASK_QUEUE_WAIT_MAX)
+
+#define TEST_DIFF 1
+
+#define NUM_LOOP 5
+static uint32_t depth_size[] =
+{
+ 1,
+ Q_DEPTH / 2,
+ Q_DEPTH,
+ Q_DEPTH,
+ Q_DEPTH
+};
+extern spe_program_handle_t mpu1_prog;
+extern spe_program_handle_t mpu2_prog;
+
+static struct mars_context *mars_ctx;
+static struct mars_task_args task1_args, task2_args;
+static struct mars_task_id task1_id[Q_DEPTH], task2_id;
+
+static uint64_t mpu_to_mpu[NUM_LOOP];
+static uint32_t notify[32] __attribute((aligned(128)));
+
+static void queue_push(uint64_t id)
+{
+ int ret;
+ int32_t exit_code;
+
+ /* create push task */
+ ret = mars_task_create(mars_ctx, &task2_id, NULL,
+ mpu2_prog.elf_image,
+ MARS_TASK_CONTEXT_SAVE_ALL);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+
+ task2_args.type.u64[0] = mpu_to_mpu[id];
+ task2_args.type.u64[1] = (uint64_t) depth_size[id];
+ ret = mars_task_schedule(&task2_id, &task2_args, 0);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+
+ ret = mars_task_wait(&task2_id, &exit_code);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+ MARS_TEST_ASSERT_ERROR(exit_code, MARS_SUCCESS);
+
+ ret = mars_task_destroy(&task2_id);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+}
+
+int main(void)
+{
+ int ret, i;
+ int32_t exit_code, chk_exit;
+ uint32_t num;
+ uint32_t chk_bit, count;
+
+ ret = mars_context_create(&mars_ctx, 0, 0);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+
+ for (i = 0; i < NUM_LOOP; i++) {
+ notify[0] = 0;
+ chk_bit = 0;
+
+ ret = mars_task_queue_create(
+ mars_ctx,
+ &mpu_to_mpu[i],
+ sizeof(struct queue_entry),
+ depth_size[i],
+ MARS_TASK_QUEUE_MPU_TO_MPU);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+
+ queue_push(i);
+
+ /* create pop task */
+ for (num = 0; num < depth_size[i]; num++) {
+ chk_bit += (1 << num);
+
+ /* create pop task */
+ ret = mars_task_create(mars_ctx, &task1_id[num], NULL,
+ mpu1_prog.elf_image, MARS_TASK_CONTEXT_SAVE_ALL);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+
+ task1_args.type.u64[0] = mpu_to_mpu[i];
+ task1_args.type.u64[1] =
+ mars_ptr_to_ea(&notify);
+ ret = mars_task_schedule(&task1_id[num],
+ &task1_args, 0);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+ }
+
+ /* start pop tasks at the same time */
+ sleep(1);
+ mars_test_counter_set(&notify[0], 1);
+
+ chk_exit = 0;
+ for (num = 0; num < depth_size[i]; num++) {
+ ret = mars_task_wait(&task1_id[num], &exit_code);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+ chk_exit |= exit_code;
+
+ ret = mars_task_destroy(&task1_id[num]);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+ }
+ MARS_TEST_ASSERT_EQUAL((uint32_t)chk_exit, chk_bit);
+
+ /* check queue count */
+ ret = mars_task_queue_count(mpu_to_mpu[i], &count);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+ MARS_TEST_ASSERT_EQUAL(count, 0);
+
+ ret = mars_task_queue_destroy(mpu_to_mpu[i]);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+ }
+
+ ret = mars_context_destroy(mars_ctx);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+
+ return 0;
+}
+
diff --git a/tests/TFP/TFP_4A_006/mpu1.c b/tests/TFP/TFP_4A_006/mpu1.c
new file mode 100644
index 0000000..7c8a1d8
--- /dev/null
+++ b/tests/TFP/TFP_4A_006/mpu1.c
@@ -0,0 +1,54 @@
+/*
+ * Copyright 2008 Sony Corporation
+ *
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a copy
+ * of this software and associated documentation files (the "Software"), to deal
+ * in the Software without restriction, including without limitation the rights
+ * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+ * copies of the Software, and to permit persons to whom the Software is
+ * furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included in
+ * all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+ * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+ * THE SOFTWARE.
+ */
+
+#include <mars/mars.h>
+#include <mars_task_test.h>
+#include <spu_mfcio.h>
+
+#define TEST_DIFF 1
+struct queue_entry {
+ uint64_t val1;
+ uint64_t val2;
+};
+static struct queue_entry data;
+
+int mars_task_main(const struct mars_task_args *task_args)
+{
+ int ret;
+ uint64_t mpu_to_mpu_ea = task_args->type.u64[0];
+ uint64_t notify_ea = task_args->type.u64[1];
+ uint64_t val;
+
+ mars_test_counter_wait(notify_ea, 1);
+
+ ret = mars_task_queue_pop(mpu_to_mpu_ea, &data);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+
+ /* check queue data */
+ val = data.val2 - data.val1;
+ MARS_TEST_ASSERT_EQUAL(val, TEST_DIFF);
+
+ mars_task_exit(1 << data.val1);
+
+ return 0;
+}
diff --git a/tests/TFP/TFP_4A_006/mpu2.c b/tests/TFP/TFP_4A_006/mpu2.c
new file mode 100644
index 0000000..c7d8751
--- /dev/null
+++ b/tests/TFP/TFP_4A_006/mpu2.c
@@ -0,0 +1,49 @@
+/*
+ * Copyright 2008 Sony Corporation
+ *
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a copy
+ * of this software and associated documentation files (the "Software"), to deal
+ * in the Software without restriction, including without limitation the rights
+ * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+ * copies of the Software, and to permit persons to whom the Software is
+ * furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included in
+ * all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+ * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+ * THE SOFTWARE.
+ */
+
+#include <mars/mars.h>
+#include <mars_task_test.h>
+
+#define TEST_DIFF 1
+struct queue_entry {
+ uint64_t val1;
+ uint64_t val2;
+};
+static struct queue_entry data;
+
+int mars_task_main(const struct mars_task_args *task_args)
+{
+ int ret, i;
+ uint64_t mpu_to_host_ea = task_args->type.u64[0];
+ uint32_t num = task_args->type.u64[1];
+
+ for (i = 0; i < num; i++) {
+ data.val1 = i;
+ data.val2 = i + TEST_DIFF;
+
+ ret = mars_task_queue_push(mpu_to_host_ea, &data);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+ }
+
+ return 0;
+}
diff --git a/tests/TFP/TFP_4A_007/Makefile b/tests/TFP/TFP_4A_007/Makefile
new file mode 100644
index 0000000..432135a
--- /dev/null
+++ b/tests/TFP/TFP_4A_007/Makefile
@@ -0,0 +1,28 @@
+#
+# Copyright 2008 Sony Corporation
+#
+#
+# Permission is hereby granted, free of charge, to any person obtaining a copy
+# of this software and associated documentation files (the "Software"), to deal
+# in the Software without restriction, including without limitation the rights
+# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+# copies of the Software, and to permit persons to whom the Software is
+# furnished to do so, subject to the following conditions:
+#
+# The above copyright notice and this permission notice shall be included in
+# all copies or substantial portions of the Software.
+#
+# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+# THE SOFTWARE.
+#
+
+top_srcdir = ../..
+test_objs = host.o mpu.task_eo
+
+include $(top_srcdir)/scripts/config.mk
+include $(top_srcdir)/scripts/rules_item.mk
diff --git a/tests/TFP/TFP_4A_007/host.c b/tests/TFP/TFP_4A_007/host.c
new file mode 100644
index 0000000..a4417b5
--- /dev/null
+++ b/tests/TFP/TFP_4A_007/host.c
@@ -0,0 +1,90 @@
+/*
+ * Copyright 2008 Sony Corporation
+ *
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a copy
+ * of this software and associated documentation files (the "Software"), to deal
+ * in the Software without restriction, including without limitation the rights
+ * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+ * copies of the Software, and to permit persons to whom the Software is
+ * furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included in
+ * all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+ * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+ * THE SOFTWARE.
+ */
+
+#include <libspe2.h>
+#include <mars/mars.h>
+#include <mars_test.h>
+#include "host_and_mpu.h"
+
+extern spe_program_handle_t mpu_prog;
+
+static struct mars_context *mars;
+static struct mars_task_id task_ids[TASK_COUNT];
+static struct mars_task_args task_args;
+static uint64_t queue;
+static uint64_t queue_item[2];
+
+int main(void)
+{
+ int i, exit_code, ret;
+
+ ret = mars_context_create(&mars, 0, 0);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+
+ ret = mars_task_queue_create(
+ mars,
+ &queue,
+ 16,
+ QUEUE_DEPTH,
+ MARS_TASK_QUEUE_HOST_TO_MPU);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+
+ for (i = 0; i < QUEUE_DEPTH; i++) {
+ ret = mars_task_queue_push(queue, queue_item);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+ }
+
+ for (i = 0; i < TASK_COUNT; i++) {
+ ret = mars_task_create(
+ mars,
+ &task_ids[i],
+ "4A007",
+ mpu_prog.elf_image,
+ MARS_TASK_CONTEXT_SAVE_ALL);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+ }
+
+ task_args.type.u64[0] = queue;
+
+ for (i = 0; i < TASK_COUNT; i++) {
+ ret = mars_task_schedule(&task_ids[i], &task_args, 0);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+ }
+
+ for (i = 0; i < TASK_COUNT; i++) {
+ ret = mars_task_wait(&task_ids[i], &exit_code);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+ MARS_TEST_ASSERT_EQUAL(exit_code, 0);
+
+ ret = mars_task_destroy(&task_ids[i]);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+ }
+
+ ret = mars_task_queue_destroy(queue);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+
+ ret = mars_context_destroy(mars);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+
+ return 0;
+}
diff --git a/tests/TFP/TFP_4A_007/host_and_mpu.h b/tests/TFP/TFP_4A_007/host_and_mpu.h
new file mode 100644
index 0000000..7cb3f27
--- /dev/null
+++ b/tests/TFP/TFP_4A_007/host_and_mpu.h
@@ -0,0 +1,25 @@
+/*
+ * Copyright 2008 Sony Corporation
+ *
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a copy
+ * of this software and associated documentation files (the "Software"), to deal
+ * in the Software without restriction, including without limitation the rights
+ * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+ * copies of the Software, and to permit persons to whom the Software is
+ * furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included in
+ * all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+ * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+ * THE SOFTWARE.
+ */
+
+#define QUEUE_DEPTH 65536
+#define TASK_COUNT 16
diff --git a/tests/TFP/TFP_4A_007/mpu.c b/tests/TFP/TFP_4A_007/mpu.c
new file mode 100644
index 0000000..c2eee42
--- /dev/null
+++ b/tests/TFP/TFP_4A_007/mpu.c
@@ -0,0 +1,49 @@
+/*
+ * Copyright 2008 Sony Corporation
+ *
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a copy
+ * of this software and associated documentation files (the "Software"), to deal
+ * in the Software without restriction, including without limitation the rights
+ * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+ * copies of the Software, and to permit persons to whom the Software is
+ * furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included in
+ * all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+ * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+ * THE SOFTWARE.
+ */
+
+#include <string.h>
+#include <mars/mars.h>
+#include "mars_task_test.h"
+#include "host_and_mpu.h"
+
+#define LOOP_COUNT (QUEUE_DEPTH/(TASK_COUNT*2))
+
+static uint64_t queue_item[2] __attribute__((aligned(16)));
+
+int mars_task_main(const struct mars_task_args *task_args)
+{
+ uint64_t queue_ea = task_args->type.u64[0];
+ int i, ret;
+
+ for (i = 0; i < LOOP_COUNT; i++) {
+ ret = mars_task_queue_pop(queue_ea, queue_item);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+
+ ret = mars_task_queue_peek(queue_ea, queue_item);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+ }
+
+ mars_task_exit(0);
+
+ return 0;
+}
diff --git a/tests/TFP/TFP_4A_008/Makefile b/tests/TFP/TFP_4A_008/Makefile
new file mode 100644
index 0000000..432135a
--- /dev/null
+++ b/tests/TFP/TFP_4A_008/Makefile
@@ -0,0 +1,28 @@
+#
+# Copyright 2008 Sony Corporation
+#
+#
+# Permission is hereby granted, free of charge, to any person obtaining a copy
+# of this software and associated documentation files (the "Software"), to deal
+# in the Software without restriction, including without limitation the rights
+# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+# copies of the Software, and to permit persons to whom the Software is
+# furnished to do so, subject to the following conditions:
+#
+# The above copyright notice and this permission notice shall be included in
+# all copies or substantial portions of the Software.
+#
+# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+# THE SOFTWARE.
+#
+
+top_srcdir = ../..
+test_objs = host.o mpu.task_eo
+
+include $(top_srcdir)/scripts/config.mk
+include $(top_srcdir)/scripts/rules_item.mk
diff --git a/tests/TFP/TFP_4A_008/host.c b/tests/TFP/TFP_4A_008/host.c
new file mode 100644
index 0000000..10cb19c
--- /dev/null
+++ b/tests/TFP/TFP_4A_008/host.c
@@ -0,0 +1,104 @@
+/*
+ * Copyright 2008 Sony Corporation
+ *
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a copy
+ * of this software and associated documentation files (the "Software"), to deal
+ * in the Software without restriction, including without limitation the rights
+ * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+ * copies of the Software, and to permit persons to whom the Software is
+ * furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included in
+ * all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+ * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+ * THE SOFTWARE.
+ */
+
+#include <libspe2.h>
+#include <pthread.h>
+#include <mars/mars.h>
+#include <mars_test.h>
+#include "host_and_mpu.h"
+
+#define THREAD_COUNT 16
+#define LOOP_COUNT (QUEUE_DEPTH/(THREAD_COUNT*2))
+
+extern spe_program_handle_t mpu_prog;
+
+static pthread_t threads[THREAD_COUNT];
+static struct mars_context *mars;
+static struct mars_task_id task_id;
+static struct mars_task_args task_args;
+static uint64_t queue;
+static uint64_t queue_item[2];
+
+void *thread_proc(void *arg)
+{
+ int i, ret;
+
+ for (i = 0; i < LOOP_COUNT; i++) {
+ ret = mars_task_queue_pop(queue, queue_item);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+
+ ret = mars_task_queue_peek(queue, queue_item);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+ }
+
+ return NULL;
+}
+
+int main(void)
+{
+ int i, exit_code, ret;
+
+ ret = mars_context_create(&mars, 0, 0);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+
+ ret = mars_task_create(
+ mars,
+ &task_id,
+ "4A008",
+ mpu_prog.elf_image,
+ MARS_TASK_CONTEXT_SAVE_ALL);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+
+ ret = mars_task_queue_create(
+ mars,
+ &queue,
+ 16,
+ QUEUE_DEPTH,
+ MARS_TASK_QUEUE_MPU_TO_HOST);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+
+ task_args.type.u64[0] = queue;
+ ret = mars_task_schedule(&task_id, &task_args, 0);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+
+ ret = mars_task_wait(&task_id, &exit_code);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+ MARS_TEST_ASSERT_EQUAL(exit_code, 0);
+
+ for (i = 0; i < THREAD_COUNT; i++)
+ pthread_create(&threads[i], NULL, thread_proc, NULL);
+
+ for (i = 0; i < THREAD_COUNT; i++)
+ pthread_join(threads[i], NULL);
+
+ ret = mars_task_queue_destroy(queue);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+
+ ret = mars_task_destroy(&task_id);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+
+ ret = mars_context_destroy(mars);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+
+ return 0;
+}
diff --git a/tests/TFP/TFP_4A_008/host_and_mpu.h b/tests/TFP/TFP_4A_008/host_and_mpu.h
new file mode 100644
index 0000000..3d9a0e3
--- /dev/null
+++ b/tests/TFP/TFP_4A_008/host_and_mpu.h
@@ -0,0 +1,24 @@
+/*
+ * Copyright 2008 Sony Corporation
+ *
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a copy
+ * of this software and associated documentation files (the "Software"), to deal
+ * in the Software without restriction, including without limitation the rights
+ * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+ * copies of the Software, and to permit persons to whom the Software is
+ * furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included in
+ * all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+ * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+ * THE SOFTWARE.
+ */
+
+#define QUEUE_DEPTH 65536
diff --git a/tests/TFP/TFP_4A_008/mpu.c b/tests/TFP/TFP_4A_008/mpu.c
new file mode 100644
index 0000000..aa4dd5a
--- /dev/null
+++ b/tests/TFP/TFP_4A_008/mpu.c
@@ -0,0 +1,44 @@
+/*
+ * Copyright 2008 Sony Corporation
+ *
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a copy
+ * of this software and associated documentation files (the "Software"), to deal
+ * in the Software without restriction, including without limitation the rights
+ * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+ * copies of the Software, and to permit persons to whom the Software is
+ * furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included in
+ * all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+ * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+ * THE SOFTWARE.
+ */
+
+#include <string.h>
+#include <mars/mars.h>
+#include "mars_task_test.h"
+#include "host_and_mpu.h"
+
+static uint64_t queue_item[2] __attribute__((aligned(16)));
+
+int mars_task_main(const struct mars_task_args *task_args)
+{
+ uint64_t queue_ea = task_args->type.u64[0];
+ int i, ret;
+
+ for (i = 0; i < QUEUE_DEPTH; i++) {
+ ret = mars_task_queue_push(queue_ea, queue_item);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+ }
+
+ mars_task_exit(0);
+
+ return 0;
+}
diff --git a/tests/TFP/TFP_4A_009/Makefile b/tests/TFP/TFP_4A_009/Makefile
new file mode 100644
index 0000000..ecbce33
--- /dev/null
+++ b/tests/TFP/TFP_4A_009/Makefile
@@ -0,0 +1,28 @@
+#
+# Copyright 2008 Sony Corporation
+#
+#
+# Permission is hereby granted, free of charge, to any person obtaining a copy
+# of this software and associated documentation files (the "Software"), to deal
+# in the Software without restriction, including without limitation the rights
+# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+# copies of the Software, and to permit persons to whom the Software is
+# furnished to do so, subject to the following conditions:
+#
+# The above copyright notice and this permission notice shall be included in
+# all copies or substantial portions of the Software.
+#
+# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+# THE SOFTWARE.
+#
+
+top_srcdir = ../..
+test_objs = host.o mpu1.task_eo mpu2.task_eo
+
+include $(top_srcdir)/scripts/config.mk
+include $(top_srcdir)/scripts/rules_item.mk
diff --git a/tests/TFP/TFP_4A_009/host.c b/tests/TFP/TFP_4A_009/host.c
new file mode 100644
index 0000000..dac628d
--- /dev/null
+++ b/tests/TFP/TFP_4A_009/host.c
@@ -0,0 +1,108 @@
+/*
+ * Copyright 2008 Sony Corporation
+ *
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a copy
+ * of this software and associated documentation files (the "Software"), to deal
+ * in the Software without restriction, including without limitation the rights
+ * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+ * copies of the Software, and to permit persons to whom the Software is
+ * furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included in
+ * all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+ * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+ * THE SOFTWARE.
+ */
+
+#include <libspe2.h>
+#include <mars/mars.h>
+#include <mars_test.h>
+#include "host_and_mpu.h"
+
+extern spe_program_handle_t mpu1_prog, mpu2_prog;
+
+static struct mars_context *mars;
+static struct mars_task_id pusher_task_id, popers_task_ids[TASK_COUNT];
+static struct mars_task_args task_args;
+static uint64_t queue;
+
+int main(void)
+{
+ int i, exit_code, ret;
+ uint32_t count;
+
+ ret = mars_context_create(&mars, 0, 0);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+
+ ret = mars_task_create(
+ mars,
+ &pusher_task_id,
+ "4A009",
+ mpu1_prog.elf_image,
+ MARS_TASK_CONTEXT_SAVE_ALL);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+
+ for (i = 0; i < TASK_COUNT; i++) {
+ ret = mars_task_create(
+ mars,
+ &popers_task_ids[i],
+ "4A009",
+ mpu2_prog.elf_image,
+ MARS_TASK_CONTEXT_SAVE_ALL);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+ }
+
+ ret = mars_task_queue_create(
+ mars,
+ &queue,
+ 16,
+ QUEUE_DEPTH,
+ MARS_TASK_QUEUE_MPU_TO_MPU);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+
+ task_args.type.u64[0] = queue;
+ ret = mars_task_schedule(&pusher_task_id, &task_args, 0);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+
+ ret = mars_task_wait(&pusher_task_id, &exit_code);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+ MARS_TEST_ASSERT_EQUAL(exit_code, 0);
+
+ ret = mars_task_queue_count(queue, &count);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+ MARS_TEST_ASSERT(count == QUEUE_DEPTH);
+
+ for (i = 0; i < TASK_COUNT; i++) {
+ ret = mars_task_schedule(&popers_task_ids[i], &task_args, 0);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+ }
+
+ for (i = 0; i < TASK_COUNT; i++) {
+ ret = mars_task_wait(&popers_task_ids[i], &exit_code);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+ MARS_TEST_ASSERT_EQUAL(exit_code, 0);
+ }
+
+ ret = mars_task_queue_destroy(queue);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+
+ ret = mars_task_destroy(&pusher_task_id);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+
+ for (i = 0; i < TASK_COUNT; i++) {
+ ret = mars_task_destroy(&popers_task_ids[i]);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+ }
+
+ ret = mars_context_destroy(mars);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+
+ return 0;
+}
diff --git a/tests/TFP/TFP_4A_009/host_and_mpu.h b/tests/TFP/TFP_4A_009/host_and_mpu.h
new file mode 100644
index 0000000..7cb3f27
--- /dev/null
+++ b/tests/TFP/TFP_4A_009/host_and_mpu.h
@@ -0,0 +1,25 @@
+/*
+ * Copyright 2008 Sony Corporation
+ *
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a copy
+ * of this software and associated documentation files (the "Software"), to deal
+ * in the Software without restriction, including without limitation the rights
+ * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+ * copies of the Software, and to permit persons to whom the Software is
+ * furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included in
+ * all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+ * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+ * THE SOFTWARE.
+ */
+
+#define QUEUE_DEPTH 65536
+#define TASK_COUNT 16
diff --git a/tests/TFP/TFP_4A_009/mpu1.c b/tests/TFP/TFP_4A_009/mpu1.c
new file mode 100644
index 0000000..74b17b2
--- /dev/null
+++ b/tests/TFP/TFP_4A_009/mpu1.c
@@ -0,0 +1,46 @@
+/*
+ * Copyright 2008 Sony Corporation
+ *
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a copy
+ * of this software and associated documentation files (the "Software"), to deal
+ * in the Software without restriction, including without limitation the rights
+ * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+ * copies of the Software, and to permit persons to whom the Software is
+ * furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included in
+ * all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+ * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+ * THE SOFTWARE.
+ */
+
+#include <string.h>
+#include <mars/mars.h>
+#include "mars_task_test.h"
+#include "host_and_mpu.h"
+
+#define LOOP_COUNT ((QUEUE_DEPTH)/(TASK_COUNT))
+
+static uint64_t queue_item[2] __attribute__((aligned(16)));
+
+int mars_task_main(const struct mars_task_args *task_args)
+{
+ uint64_t queue_ea = task_args->type.u64[0];
+ int i, ret;
+
+ for (i = 0; i < QUEUE_DEPTH; i++) {
+ ret = mars_task_queue_push(queue_ea, queue_item);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+ }
+
+ mars_task_exit(0);
+
+ return 0;
+}
diff --git a/tests/TFP/TFP_4A_009/mpu2.c b/tests/TFP/TFP_4A_009/mpu2.c
new file mode 100644
index 0000000..745eeaa
--- /dev/null
+++ b/tests/TFP/TFP_4A_009/mpu2.c
@@ -0,0 +1,49 @@
+/*
+ * Copyright 2008 Sony Corporation
+ *
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a copy
+ * of this software and associated documentation files (the "Software"), to deal
+ * in the Software without restriction, including without limitation the rights
+ * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+ * copies of the Software, and to permit persons to whom the Software is
+ * furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included in
+ * all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+ * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+ * THE SOFTWARE.
+ */
+
+#include <string.h>
+#include <mars/mars.h>
+#include "mars_task_test.h"
+#include "host_and_mpu.h"
+
+#define LOOP_COUNT ((QUEUE_DEPTH)/(TASK_COUNT))
+
+static uint64_t queue_item[2] __attribute__((aligned(16)));
+
+int mars_task_main(const struct mars_task_args *task_args)
+{
+ uint64_t queue_ea = task_args->type.u64[0];
+ int i, ret;
+
+ for (i = 0; i < LOOP_COUNT; i++) {
+ ret = mars_task_queue_peek(queue_ea, queue_item);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+
+ ret = mars_task_queue_pop(queue_ea, queue_item);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+ }
+
+ mars_task_exit(0);
+
+ return 0;
+}
diff --git a/tests/TFP/TFP_4A_010/Makefile b/tests/TFP/TFP_4A_010/Makefile
new file mode 100644
index 0000000..432135a
--- /dev/null
+++ b/tests/TFP/TFP_4A_010/Makefile
@@ -0,0 +1,28 @@
+#
+# Copyright 2008 Sony Corporation
+#
+#
+# Permission is hereby granted, free of charge, to any person obtaining a copy
+# of this software and associated documentation files (the "Software"), to deal
+# in the Software without restriction, including without limitation the rights
+# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+# copies of the Software, and to permit persons to whom the Software is
+# furnished to do so, subject to the following conditions:
+#
+# The above copyright notice and this permission notice shall be included in
+# all copies or substantial portions of the Software.
+#
+# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+# THE SOFTWARE.
+#
+
+top_srcdir = ../..
+test_objs = host.o mpu.task_eo
+
+include $(top_srcdir)/scripts/config.mk
+include $(top_srcdir)/scripts/rules_item.mk
diff --git a/tests/TFP/TFP_4A_010/host.c b/tests/TFP/TFP_4A_010/host.c
new file mode 100644
index 0000000..364763f
--- /dev/null
+++ b/tests/TFP/TFP_4A_010/host.c
@@ -0,0 +1,108 @@
+/*
+ * Copyright 2008 Sony Corporation
+ *
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a copy
+ * of this software and associated documentation files (the "Software"), to deal
+ * in the Software without restriction, including without limitation the rights
+ * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+ * copies of the Software, and to permit persons to whom the Software is
+ * furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included in
+ * all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+ * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+ * THE SOFTWARE.
+ */
+
+#include <unistd.h>
+#include <mars/mars.h>
+#include <libspe2.h>
+#include <mars_test.h>
+
+struct queue_entry {
+ uint64_t val;
+ uint64_t pad;
+};
+#define Q_DEPTH (256 * 1024)
+
+#define NUM_LOOP 2
+static uint32_t depth_size[] =
+{
+ 1,
+ Q_DEPTH
+};
+extern spe_program_handle_t mpu_prog;
+
+static struct mars_context *mars_ctx;
+static struct mars_task_args task_args;
+static struct mars_task_id task_id;
+
+static uint64_t host_to_mpu[NUM_LOOP];
+static struct queue_entry data;
+
+static uint32_t shared_resource __attribute((aligned(16)));
+
+int main(void)
+{
+ int ret, i;
+ int32_t exit_code;
+
+ ret = mars_context_create(&mars_ctx, 0, 0);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+
+ for (i = 0; i < NUM_LOOP; i++) {
+ shared_resource = 0;
+
+ ret = mars_task_queue_create(
+ mars_ctx,
+ &host_to_mpu[i],
+ sizeof(struct queue_entry),
+ depth_size[i],
+ MARS_TASK_QUEUE_HOST_TO_MPU);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+
+ /* create pop task */
+ ret = mars_task_create(mars_ctx, &task_id, NULL,
+ mpu_prog.elf_image, MARS_TASK_CONTEXT_SAVE_ALL);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+
+ task_args.type.u64[0] = host_to_mpu[i];
+ task_args.type.u64[1] = mars_ptr_to_ea(&shared_resource);
+ task_args.type.u64[2] = (uint64_t)i;
+ ret = mars_task_schedule(&task_id, &task_args, 0);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+
+ /* check if queue pop is blocked in mpu task */
+ sleep(1);
+ MARS_TEST_ASSERT_EQUAL(shared_resource, 0);
+
+ /* push one */
+ data.val = i;
+ ret = mars_task_queue_push(host_to_mpu[i], &data);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+
+ /* check if mpu task is successfly finished */
+ ret = mars_task_wait(&task_id, &exit_code);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+ MARS_TEST_ASSERT_ERROR(exit_code, MARS_SUCCESS);
+
+ ret = mars_task_destroy(&task_id);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+
+ ret = mars_task_queue_destroy(host_to_mpu[i]);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+ }
+
+ ret = mars_context_destroy(mars_ctx);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+
+ return 0;
+}
+
diff --git a/tests/TFP/TFP_4A_010/mpu.c b/tests/TFP/TFP_4A_010/mpu.c
new file mode 100644
index 0000000..2d05c63
--- /dev/null
+++ b/tests/TFP/TFP_4A_010/mpu.c
@@ -0,0 +1,54 @@
+/*
+ * Copyright 2008 Sony Corporation
+ *
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a copy
+ * of this software and associated documentation files (the "Software"), to deal
+ * in the Software without restriction, including without limitation the rights
+ * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+ * copies of the Software, and to permit persons to whom the Software is
+ * furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included in
+ * all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+ * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+ * THE SOFTWARE.
+ */
+
+#include <mars/mars.h>
+#include <mars_task_test.h>
+#include <spu_mfcio.h>
+
+struct queue_entry {
+ uint64_t val;
+ uint64_t pad;
+};
+static struct queue_entry data;
+static uint32_t shared_resource __attribute((aligned(16)));
+
+int mars_task_main(const struct mars_task_args *task_args)
+{
+ int ret;
+ uint64_t host_to_mpu_ea = task_args->type.u64[0];
+ uint64_t shared_resource_ea = task_args->type.u64[1];
+ uint64_t val = task_args->type.u64[2];
+
+ ret = mars_task_queue_pop(host_to_mpu_ea, &data);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+ MARS_TEST_ASSERT_EQUAL(data.val, val);
+
+ /* if the program reaches here, shared_resource'll be updated */
+ shared_resource = 1;
+ mfc_put(&shared_resource, shared_resource_ea,
+ sizeof(uint32_t), 0, 0, 0);
+ mfc_write_tag_mask(1 << 0);
+ mfc_read_tag_status_all();
+
+ return 0;
+}
diff --git a/tests/TFP/TFP_4A_011/Makefile b/tests/TFP/TFP_4A_011/Makefile
new file mode 100644
index 0000000..432135a
--- /dev/null
+++ b/tests/TFP/TFP_4A_011/Makefile
@@ -0,0 +1,28 @@
+#
+# Copyright 2008 Sony Corporation
+#
+#
+# Permission is hereby granted, free of charge, to any person obtaining a copy
+# of this software and associated documentation files (the "Software"), to deal
+# in the Software without restriction, including without limitation the rights
+# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+# copies of the Software, and to permit persons to whom the Software is
+# furnished to do so, subject to the following conditions:
+#
+# The above copyright notice and this permission notice shall be included in
+# all copies or substantial portions of the Software.
+#
+# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+# THE SOFTWARE.
+#
+
+top_srcdir = ../..
+test_objs = host.o mpu.task_eo
+
+include $(top_srcdir)/scripts/config.mk
+include $(top_srcdir)/scripts/rules_item.mk
diff --git a/tests/TFP/TFP_4A_011/host.c b/tests/TFP/TFP_4A_011/host.c
new file mode 100644
index 0000000..f8301c0
--- /dev/null
+++ b/tests/TFP/TFP_4A_011/host.c
@@ -0,0 +1,128 @@
+/*
+ * Copyright 2008 Sony Corporation
+ *
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a copy
+ * of this software and associated documentation files (the "Software"), to deal
+ * in the Software without restriction, including without limitation the rights
+ * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+ * copies of the Software, and to permit persons to whom the Software is
+ * furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included in
+ * all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+ * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+ * THE SOFTWARE.
+ */
+
+#include <pthread.h>
+#include <unistd.h>
+#include <mars/mars.h>
+#include <libspe2.h>
+#include <mars_test.h>
+
+struct queue_entry {
+ uint64_t val1;
+ uint64_t val2;
+};
+#define Q_DEPTH (256 * 1024)
+
+#define NUM_LOOP 2
+static uint32_t depth_size[] =
+{
+ 1,
+ Q_DEPTH
+};
+extern spe_program_handle_t mpu_prog;
+
+static struct mars_context *mars_ctx;
+static struct mars_task_args task_args, thread_args;
+static struct mars_task_id task_id;
+
+static uint64_t mpu_to_host[NUM_LOOP];
+
+static uint32_t shared_resource __attribute((aligned(16)));
+static struct queue_entry data;
+
+static pthread_t thread;
+static void *thread_proc(void *ptr)
+{
+ int ret;
+ struct mars_task_args *task_args = (struct mars_task_args *)ptr;
+ uint32_t id = (uint32_t)task_args->type.u32[0];
+
+ ret = mars_task_queue_pop(mpu_to_host[id], &data);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+
+ MARS_TEST_ASSERT_EQUAL(data.val1, id);
+
+ /* if the program reaches here, shared_resource'll be updated */
+ shared_resource = 1;
+
+ return NULL;
+}
+
+int main(void)
+{
+ int ret, i;
+ int32_t exit_code;
+
+ ret = mars_context_create(&mars_ctx, 0, 0);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+
+ for (i = 0; i < NUM_LOOP; i++) {
+ shared_resource = 0;
+
+ ret = mars_task_queue_create(
+ mars_ctx,
+ &mpu_to_host[i],
+ sizeof(struct queue_entry),
+ depth_size[i],
+ MARS_TASK_QUEUE_MPU_TO_HOST);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+
+ /* create pop thread */
+ thread_args.type.u32[0] = (uint32_t)i;
+ pthread_create(&thread, NULL, thread_proc, &thread_args);
+
+ /* create push task */
+ ret = mars_task_create(mars_ctx, &task_id, NULL,
+ mpu_prog.elf_image, MARS_TASK_CONTEXT_SAVE_ALL);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+
+ /* check if queue pop is blocked in ppe thread */
+ sleep(1);
+ MARS_TEST_ASSERT_EQUAL(shared_resource, 0);
+
+ /* push one by mpu */
+ task_args.type.u64[0] = mpu_to_host[i];
+ task_args.type.u64[1] = (uint64_t)i;
+ ret = mars_task_schedule(&task_id, &task_args, 0);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+
+ ret = mars_task_wait(&task_id, &exit_code);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+ MARS_TEST_ASSERT_ERROR(exit_code, MARS_SUCCESS);
+
+ /* check if the thread wakes up and finished */
+ pthread_join(thread, NULL);
+
+ ret = mars_task_destroy(&task_id);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+
+ ret = mars_task_queue_destroy(mpu_to_host[i]);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+ }
+
+ ret = mars_context_destroy(mars_ctx);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+
+ return 0;
+}
+
diff --git a/tests/TFP/TFP_4A_011/mpu.c b/tests/TFP/TFP_4A_011/mpu.c
new file mode 100644
index 0000000..4ea6b99
--- /dev/null
+++ b/tests/TFP/TFP_4A_011/mpu.c
@@ -0,0 +1,45 @@
+/*
+ * Copyright 2008 Sony Corporation
+ *
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a copy
+ * of this software and associated documentation files (the "Software"), to deal
+ * in the Software without restriction, including without limitation the rights
+ * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+ * copies of the Software, and to permit persons to whom the Software is
+ * furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included in
+ * all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+ * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+ * THE SOFTWARE.
+ */
+
+#include <mars/mars.h>
+#include <mars_task_test.h>
+#include <spu_mfcio.h>
+
+struct queue_entry {
+ uint64_t val1;
+ uint64_t val2;
+};
+static struct queue_entry data;
+
+int mars_task_main(const struct mars_task_args *task_args)
+{
+ int ret;
+ uint64_t mpu_to_host_ea = task_args->type.u64[0];
+ uint64_t val = task_args->type.u64[1];
+
+ data.val1 = val;
+ ret = mars_task_queue_push(mpu_to_host_ea, &data);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+
+ return 0;
+}
diff --git a/tests/TFP/TFP_4A_012/Makefile b/tests/TFP/TFP_4A_012/Makefile
new file mode 100644
index 0000000..ecbce33
--- /dev/null
+++ b/tests/TFP/TFP_4A_012/Makefile
@@ -0,0 +1,28 @@
+#
+# Copyright 2008 Sony Corporation
+#
+#
+# Permission is hereby granted, free of charge, to any person obtaining a copy
+# of this software and associated documentation files (the "Software"), to deal
+# in the Software without restriction, including without limitation the rights
+# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+# copies of the Software, and to permit persons to whom the Software is
+# furnished to do so, subject to the following conditions:
+#
+# The above copyright notice and this permission notice shall be included in
+# all copies or substantial portions of the Software.
+#
+# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+# THE SOFTWARE.
+#
+
+top_srcdir = ../..
+test_objs = host.o mpu1.task_eo mpu2.task_eo
+
+include $(top_srcdir)/scripts/config.mk
+include $(top_srcdir)/scripts/rules_item.mk
diff --git a/tests/TFP/TFP_4A_012/host.c b/tests/TFP/TFP_4A_012/host.c
new file mode 100644
index 0000000..0de04c9
--- /dev/null
+++ b/tests/TFP/TFP_4A_012/host.c
@@ -0,0 +1,121 @@
+/*
+ * Copyright 2008 Sony Corporation
+ *
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a copy
+ * of this software and associated documentation files (the "Software"), to deal
+ * in the Software without restriction, including without limitation the rights
+ * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+ * copies of the Software, and to permit persons to whom the Software is
+ * furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included in
+ * all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+ * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+ * THE SOFTWARE.
+ */
+
+#include <unistd.h>
+#include <mars/mars.h>
+#include <libspe2.h>
+#include <mars_test.h>
+
+struct queue_entry {
+ uint64_t val1;
+ uint64_t val2;
+};
+#define Q_DEPTH (256 * 1024)
+
+#define NUM_LOOP 2
+static uint32_t depth_size[] =
+{
+ 1,
+ Q_DEPTH
+};
+extern spe_program_handle_t mpu1_prog;
+extern spe_program_handle_t mpu2_prog;
+
+static struct mars_context *mars_ctx;
+static struct mars_task_args task1_args, task2_args;
+static struct mars_task_id task1_id, task2_id;
+
+static uint64_t mpu_to_mpu[NUM_LOOP];
+
+static uint32_t shared_resource __attribute((aligned(16)));
+
+int main(void)
+{
+ int ret, i;
+ int32_t exit_code;
+
+ ret = mars_context_create(&mars_ctx, 0, 0);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+
+ for (i = 0; i < NUM_LOOP; i++) {
+ shared_resource = 0;
+
+ ret = mars_task_queue_create(
+ mars_ctx,
+ &mpu_to_mpu[i],
+ sizeof(struct queue_entry),
+ depth_size[i],
+ MARS_TASK_QUEUE_MPU_TO_MPU);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+
+ /* create pop task */
+ ret = mars_task_create(mars_ctx, &task1_id, NULL,
+ mpu1_prog.elf_image, MARS_TASK_CONTEXT_SAVE_ALL);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+
+ task1_args.type.u64[0] = mpu_to_mpu[i];
+ task1_args.type.u64[1] = mars_ptr_to_ea(&shared_resource);
+ task1_args.type.u64[2] = (uint64_t)i;
+ ret = mars_task_schedule(&task1_id, &task1_args, 0);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+
+ /* create push task */
+ ret = mars_task_create(mars_ctx, &task2_id, NULL,
+ mpu2_prog.elf_image, MARS_TASK_CONTEXT_SAVE_ALL);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+
+ /* check if queue pop is blocked in mpu task */
+ sleep(1);
+ MARS_TEST_ASSERT_EQUAL(shared_resource, 0);
+
+ /* push one by mpu */
+ task2_args.type.u64[0] = mpu_to_mpu[i];
+ task2_args.type.u64[1] = (uint64_t)i;
+ ret = mars_task_schedule(&task2_id, &task2_args, 0);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+
+ ret = mars_task_wait(&task2_id, &exit_code);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+ MARS_TEST_ASSERT_ERROR(exit_code, MARS_SUCCESS);
+
+ /* check if pop task is successfly finished */
+ ret = mars_task_wait(&task1_id, &exit_code);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+ MARS_TEST_ASSERT_ERROR(exit_code, MARS_SUCCESS);
+
+ ret = mars_task_destroy(&task1_id);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+
+ ret = mars_task_destroy(&task2_id);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+
+ ret = mars_task_queue_destroy(mpu_to_mpu[i]);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+ }
+
+ ret = mars_context_destroy(mars_ctx);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+
+ return 0;
+}
+
diff --git a/tests/TFP/TFP_4A_012/mpu1.c b/tests/TFP/TFP_4A_012/mpu1.c
new file mode 100644
index 0000000..0f9dd5e
--- /dev/null
+++ b/tests/TFP/TFP_4A_012/mpu1.c
@@ -0,0 +1,54 @@
+/*
+ * Copyright 2008 Sony Corporation
+ *
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a copy
+ * of this software and associated documentation files (the "Software"), to deal
+ * in the Software without restriction, including without limitation the rights
+ * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+ * copies of the Software, and to permit persons to whom the Software is
+ * furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included in
+ * all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+ * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+ * THE SOFTWARE.
+ */
+
+#include <mars/mars.h>
+#include <mars_task_test.h>
+#include <spu_mfcio.h>
+
+struct queue_entry {
+ uint64_t val;
+ uint64_t pad;
+};
+static struct queue_entry data;
+static uint32_t shared_resource __attribute((aligned(16)));
+
+int mars_task_main(const struct mars_task_args *task_args)
+{
+ int ret;
+ uint64_t mpu_to_mpu_ea = task_args->type.u64[0];
+ uint64_t shared_resource_ea = task_args->type.u64[1];
+ uint64_t val = task_args->type.u64[2];
+
+ ret = mars_task_queue_pop(mpu_to_mpu_ea, &data);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+ MARS_TEST_ASSERT_EQUAL(data.val, val);
+
+ /* if the program reaches here, shared_resource'll be updated */
+ shared_resource = 1;
+ mfc_put(&shared_resource, shared_resource_ea,
+ sizeof(uint32_t), 0, 0, 0);
+ mfc_write_tag_mask(1 << 0);
+ mfc_read_tag_status_all();
+
+ return 0;
+}
diff --git a/tests/TFP/TFP_4A_012/mpu2.c b/tests/TFP/TFP_4A_012/mpu2.c
new file mode 100644
index 0000000..fb4a992
--- /dev/null
+++ b/tests/TFP/TFP_4A_012/mpu2.c
@@ -0,0 +1,45 @@
+/*
+ * Copyright 2008 Sony Corporation
+ *
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a copy
+ * of this software and associated documentation files (the "Software"), to deal
+ * in the Software without restriction, including without limitation the rights
+ * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+ * copies of the Software, and to permit persons to whom the Software is
+ * furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included in
+ * all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+ * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+ * THE SOFTWARE.
+ */
+
+#include <mars/mars.h>
+#include <mars_task_test.h>
+#include <spu_mfcio.h>
+
+struct queue_entry {
+ uint64_t val1;
+ uint64_t val2;
+};
+static struct queue_entry data;
+
+int mars_task_main(const struct mars_task_args *task_args)
+{
+ int ret;
+ uint64_t mpu_to_mpu_ea = task_args->type.u64[0];
+ uint64_t val = task_args->type.u64[1];
+
+ data.val1 = val;
+ ret = mars_task_queue_push(mpu_to_mpu_ea, &data);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+
+ return 0;
+}
diff --git a/tests/TFP/TFP_4A_013/Makefile b/tests/TFP/TFP_4A_013/Makefile
new file mode 100644
index 0000000..432135a
--- /dev/null
+++ b/tests/TFP/TFP_4A_013/Makefile
@@ -0,0 +1,28 @@
+#
+# Copyright 2008 Sony Corporation
+#
+#
+# Permission is hereby granted, free of charge, to any person obtaining a copy
+# of this software and associated documentation files (the "Software"), to deal
+# in the Software without restriction, including without limitation the rights
+# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+# copies of the Software, and to permit persons to whom the Software is
+# furnished to do so, subject to the following conditions:
+#
+# The above copyright notice and this permission notice shall be included in
+# all copies or substantial portions of the Software.
+#
+# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+# THE SOFTWARE.
+#
+
+top_srcdir = ../..
+test_objs = host.o mpu.task_eo
+
+include $(top_srcdir)/scripts/config.mk
+include $(top_srcdir)/scripts/rules_item.mk
diff --git a/tests/TFP/TFP_4A_013/host.c b/tests/TFP/TFP_4A_013/host.c
new file mode 100644
index 0000000..bb501af
--- /dev/null
+++ b/tests/TFP/TFP_4A_013/host.c
@@ -0,0 +1,128 @@
+/*
+ * Copyright 2008 Sony Corporation
+ *
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a copy
+ * of this software and associated documentation files (the "Software"), to deal
+ * in the Software without restriction, including without limitation the rights
+ * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+ * copies of the Software, and to permit persons to whom the Software is
+ * furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included in
+ * all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+ * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+ * THE SOFTWARE.
+ */
+
+#include <pthread.h>
+#include <unistd.h>
+#include <mars/mars.h>
+#include <libspe2.h>
+#include <mars_test.h>
+
+struct queue_entry {
+ uint64_t val1;
+ uint64_t val2;
+};
+#define Q_DEPTH (256 * 1024)
+
+#define NUM_LOOP 2
+static uint32_t depth_size[] =
+{
+ 1,
+ Q_DEPTH
+};
+extern spe_program_handle_t mpu_prog;
+
+static struct mars_context *mars_ctx;
+static struct mars_task_args task_args, thread_args;
+static struct mars_task_id task_id;
+
+static uint64_t mpu_to_host[NUM_LOOP];
+
+static uint32_t shared_resource __attribute((aligned(16)));
+static struct queue_entry data;
+
+static pthread_t thread;
+static void *thread_proc(void *ptr)
+{
+ int ret;
+ struct mars_task_args *task_args = (struct mars_task_args *)ptr;
+ uint32_t id = (uint32_t)task_args->type.u32[0];
+
+ ret = mars_task_queue_pop(mpu_to_host[id], &data);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+
+ MARS_TEST_ASSERT_EQUAL(data.val1, id);
+
+ /* if the program reaches here, shared_resource'll be updated */
+ shared_resource = 1;
+
+ return NULL;
+}
+
+int main(void)
+{
+ int ret, i;
+ int32_t exit_code;
+
+ ret = mars_context_create(&mars_ctx, 0, 0);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+
+ for (i = 0; i < NUM_LOOP; i++) {
+ shared_resource = 0;
+
+ ret = mars_task_queue_create(
+ mars_ctx,
+ &mpu_to_host[i],
+ sizeof(struct queue_entry),
+ depth_size[i],
+ MARS_TASK_QUEUE_MPU_TO_HOST);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+
+ /* create pop thread */
+ thread_args.type.u32[0] = (uint32_t)i;
+ pthread_create(&thread, NULL, thread_proc, &thread_args);
+
+ /* create push task */
+ ret = mars_task_create(mars_ctx, &task_id, NULL,
+ mpu_prog.elf_image, MARS_TASK_CONTEXT_SAVE_ALL);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+
+ /* check if queue pop is blocked in ppe thread */
+ sleep(1);
+ MARS_TEST_ASSERT_EQUAL(shared_resource, 0);
+
+ /* push_begin one by mpu */
+ task_args.type.u64[0] = mpu_to_host[i];
+ task_args.type.u64[1] = (uint64_t)i;
+ ret = mars_task_schedule(&task_id, &task_args, 0);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+
+ ret = mars_task_wait(&task_id, &exit_code);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+ MARS_TEST_ASSERT_ERROR(exit_code, MARS_SUCCESS);
+
+ /* check if the thread wakes up and finished */
+ pthread_join(thread, NULL);
+
+ ret = mars_task_destroy(&task_id);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+
+ ret = mars_task_queue_destroy(mpu_to_host[i]);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+ }
+
+ ret = mars_context_destroy(mars_ctx);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+
+ return 0;
+}
+
diff --git a/tests/TFP/TFP_4A_013/mpu.c b/tests/TFP/TFP_4A_013/mpu.c
new file mode 100644
index 0000000..9bab286
--- /dev/null
+++ b/tests/TFP/TFP_4A_013/mpu.c
@@ -0,0 +1,48 @@
+/*
+ * Copyright 2008 Sony Corporation
+ *
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a copy
+ * of this software and associated documentation files (the "Software"), to deal
+ * in the Software without restriction, including without limitation the rights
+ * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+ * copies of the Software, and to permit persons to whom the Software is
+ * furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included in
+ * all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+ * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+ * THE SOFTWARE.
+ */
+
+#include <mars/mars.h>
+#include <mars_task_test.h>
+#include <spu_mfcio.h>
+
+struct queue_entry {
+ uint64_t val1;
+ uint64_t val2;
+};
+static struct queue_entry data;
+
+int mars_task_main(const struct mars_task_args *task_args)
+{
+ int ret;
+ uint64_t mpu_to_host_ea = task_args->type.u64[0];
+ uint64_t val = task_args->type.u64[1];
+
+ data.val1 = val;
+ ret = mars_task_queue_push_begin(mpu_to_host_ea, &data, 1);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+
+ ret = mars_task_queue_push_end(mpu_to_host_ea, 1);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+
+ return 0;
+}
diff --git a/tests/TFP/TFP_4A_014/Makefile b/tests/TFP/TFP_4A_014/Makefile
new file mode 100644
index 0000000..ecbce33
--- /dev/null
+++ b/tests/TFP/TFP_4A_014/Makefile
@@ -0,0 +1,28 @@
+#
+# Copyright 2008 Sony Corporation
+#
+#
+# Permission is hereby granted, free of charge, to any person obtaining a copy
+# of this software and associated documentation files (the "Software"), to deal
+# in the Software without restriction, including without limitation the rights
+# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+# copies of the Software, and to permit persons to whom the Software is
+# furnished to do so, subject to the following conditions:
+#
+# The above copyright notice and this permission notice shall be included in
+# all copies or substantial portions of the Software.
+#
+# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+# THE SOFTWARE.
+#
+
+top_srcdir = ../..
+test_objs = host.o mpu1.task_eo mpu2.task_eo
+
+include $(top_srcdir)/scripts/config.mk
+include $(top_srcdir)/scripts/rules_item.mk
diff --git a/tests/TFP/TFP_4A_014/host.c b/tests/TFP/TFP_4A_014/host.c
new file mode 100644
index 0000000..0de04c9
--- /dev/null
+++ b/tests/TFP/TFP_4A_014/host.c
@@ -0,0 +1,121 @@
+/*
+ * Copyright 2008 Sony Corporation
+ *
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a copy
+ * of this software and associated documentation files (the "Software"), to deal
+ * in the Software without restriction, including without limitation the rights
+ * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+ * copies of the Software, and to permit persons to whom the Software is
+ * furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included in
+ * all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+ * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+ * THE SOFTWARE.
+ */
+
+#include <unistd.h>
+#include <mars/mars.h>
+#include <libspe2.h>
+#include <mars_test.h>
+
+struct queue_entry {
+ uint64_t val1;
+ uint64_t val2;
+};
+#define Q_DEPTH (256 * 1024)
+
+#define NUM_LOOP 2
+static uint32_t depth_size[] =
+{
+ 1,
+ Q_DEPTH
+};
+extern spe_program_handle_t mpu1_prog;
+extern spe_program_handle_t mpu2_prog;
+
+static struct mars_context *mars_ctx;
+static struct mars_task_args task1_args, task2_args;
+static struct mars_task_id task1_id, task2_id;
+
+static uint64_t mpu_to_mpu[NUM_LOOP];
+
+static uint32_t shared_resource __attribute((aligned(16)));
+
+int main(void)
+{
+ int ret, i;
+ int32_t exit_code;
+
+ ret = mars_context_create(&mars_ctx, 0, 0);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+
+ for (i = 0; i < NUM_LOOP; i++) {
+ shared_resource = 0;
+
+ ret = mars_task_queue_create(
+ mars_ctx,
+ &mpu_to_mpu[i],
+ sizeof(struct queue_entry),
+ depth_size[i],
+ MARS_TASK_QUEUE_MPU_TO_MPU);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+
+ /* create pop task */
+ ret = mars_task_create(mars_ctx, &task1_id, NULL,
+ mpu1_prog.elf_image, MARS_TASK_CONTEXT_SAVE_ALL);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+
+ task1_args.type.u64[0] = mpu_to_mpu[i];
+ task1_args.type.u64[1] = mars_ptr_to_ea(&shared_resource);
+ task1_args.type.u64[2] = (uint64_t)i;
+ ret = mars_task_schedule(&task1_id, &task1_args, 0);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+
+ /* create push task */
+ ret = mars_task_create(mars_ctx, &task2_id, NULL,
+ mpu2_prog.elf_image, MARS_TASK_CONTEXT_SAVE_ALL);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+
+ /* check if queue pop is blocked in mpu task */
+ sleep(1);
+ MARS_TEST_ASSERT_EQUAL(shared_resource, 0);
+
+ /* push one by mpu */
+ task2_args.type.u64[0] = mpu_to_mpu[i];
+ task2_args.type.u64[1] = (uint64_t)i;
+ ret = mars_task_schedule(&task2_id, &task2_args, 0);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+
+ ret = mars_task_wait(&task2_id, &exit_code);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+ MARS_TEST_ASSERT_ERROR(exit_code, MARS_SUCCESS);
+
+ /* check if pop task is successfly finished */
+ ret = mars_task_wait(&task1_id, &exit_code);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+ MARS_TEST_ASSERT_ERROR(exit_code, MARS_SUCCESS);
+
+ ret = mars_task_destroy(&task1_id);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+
+ ret = mars_task_destroy(&task2_id);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+
+ ret = mars_task_queue_destroy(mpu_to_mpu[i]);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+ }
+
+ ret = mars_context_destroy(mars_ctx);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+
+ return 0;
+}
+
diff --git a/tests/TFP/TFP_4A_014/mpu1.c b/tests/TFP/TFP_4A_014/mpu1.c
new file mode 100644
index 0000000..0f9dd5e
--- /dev/null
+++ b/tests/TFP/TFP_4A_014/mpu1.c
@@ -0,0 +1,54 @@
+/*
+ * Copyright 2008 Sony Corporation
+ *
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a copy
+ * of this software and associated documentation files (the "Software"), to deal
+ * in the Software without restriction, including without limitation the rights
+ * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+ * copies of the Software, and to permit persons to whom the Software is
+ * furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included in
+ * all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+ * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+ * THE SOFTWARE.
+ */
+
+#include <mars/mars.h>
+#include <mars_task_test.h>
+#include <spu_mfcio.h>
+
+struct queue_entry {
+ uint64_t val;
+ uint64_t pad;
+};
+static struct queue_entry data;
+static uint32_t shared_resource __attribute((aligned(16)));
+
+int mars_task_main(const struct mars_task_args *task_args)
+{
+ int ret;
+ uint64_t mpu_to_mpu_ea = task_args->type.u64[0];
+ uint64_t shared_resource_ea = task_args->type.u64[1];
+ uint64_t val = task_args->type.u64[2];
+
+ ret = mars_task_queue_pop(mpu_to_mpu_ea, &data);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+ MARS_TEST_ASSERT_EQUAL(data.val, val);
+
+ /* if the program reaches here, shared_resource'll be updated */
+ shared_resource = 1;
+ mfc_put(&shared_resource, shared_resource_ea,
+ sizeof(uint32_t), 0, 0, 0);
+ mfc_write_tag_mask(1 << 0);
+ mfc_read_tag_status_all();
+
+ return 0;
+}
diff --git a/tests/TFP/TFP_4A_014/mpu2.c b/tests/TFP/TFP_4A_014/mpu2.c
new file mode 100644
index 0000000..d8e04bc
--- /dev/null
+++ b/tests/TFP/TFP_4A_014/mpu2.c
@@ -0,0 +1,48 @@
+/*
+ * Copyright 2008 Sony Corporation
+ *
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a copy
+ * of this software and associated documentation files (the "Software"), to deal
+ * in the Software without restriction, including without limitation the rights
+ * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+ * copies of the Software, and to permit persons to whom the Software is
+ * furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included in
+ * all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+ * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+ * THE SOFTWARE.
+ */
+
+#include <mars/mars.h>
+#include <mars_task_test.h>
+#include <spu_mfcio.h>
+
+struct queue_entry {
+ uint64_t val1;
+ uint64_t val2;
+};
+static struct queue_entry data;
+
+int mars_task_main(const struct mars_task_args *task_args)
+{
+ int ret;
+ uint64_t mpu_to_mpu_ea = task_args->type.u64[0];
+ uint64_t val = task_args->type.u64[1];
+
+ data.val1 = val;
+ ret = mars_task_queue_push_begin(mpu_to_mpu_ea, &data, 1);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+
+ ret = mars_task_queue_push_end(mpu_to_mpu_ea, 1);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+
+ return 0;
+}
diff --git a/tests/TFP/TFP_4A_015/Makefile b/tests/TFP/TFP_4A_015/Makefile
new file mode 100644
index 0000000..432135a
--- /dev/null
+++ b/tests/TFP/TFP_4A_015/Makefile
@@ -0,0 +1,28 @@
+#
+# Copyright 2008 Sony Corporation
+#
+#
+# Permission is hereby granted, free of charge, to any person obtaining a copy
+# of this software and associated documentation files (the "Software"), to deal
+# in the Software without restriction, including without limitation the rights
+# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+# copies of the Software, and to permit persons to whom the Software is
+# furnished to do so, subject to the following conditions:
+#
+# The above copyright notice and this permission notice shall be included in
+# all copies or substantial portions of the Software.
+#
+# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+# THE SOFTWARE.
+#
+
+top_srcdir = ../..
+test_objs = host.o mpu.task_eo
+
+include $(top_srcdir)/scripts/config.mk
+include $(top_srcdir)/scripts/rules_item.mk
diff --git a/tests/TFP/TFP_4A_015/host.c b/tests/TFP/TFP_4A_015/host.c
new file mode 100644
index 0000000..4e04577
--- /dev/null
+++ b/tests/TFP/TFP_4A_015/host.c
@@ -0,0 +1,108 @@
+/*
+ * Copyright 2008 Sony Corporation
+ *
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a copy
+ * of this software and associated documentation files (the "Software"), to deal
+ * in the Software without restriction, including without limitation the rights
+ * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+ * copies of the Software, and to permit persons to whom the Software is
+ * furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included in
+ * all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+ * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+ * THE SOFTWARE.
+ */
+
+#include <unistd.h>
+#include <mars/mars.h>
+#include <libspe2.h>
+#include <mars_test.h>
+
+struct queue_entry {
+ uint64_t val;
+ uint64_t pad;
+};
+#define Q_DEPTH (256 * 1024)
+
+#define NUM_LOOP 2
+static uint32_t depth_size[] =
+{
+ 1,
+ Q_DEPTH
+};
+extern spe_program_handle_t mpu_prog;
+
+static struct mars_context *mars_ctx;
+static struct mars_task_args task_args;
+static struct mars_task_id task_id;
+
+static uint64_t host_to_mpu[NUM_LOOP];
+static struct queue_entry data;
+
+static uint32_t shared_resource __attribute((aligned(16)));
+
+int main(void)
+{
+ int ret, i;
+ int32_t exit_code;
+
+ ret = mars_context_create(&mars_ctx, 0, 0);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+
+ for (i = 0; i < NUM_LOOP; i++) {
+ shared_resource = 0;
+
+ ret = mars_task_queue_create(
+ mars_ctx,
+ &host_to_mpu[i],
+ sizeof(struct queue_entry),
+ depth_size[i],
+ MARS_TASK_QUEUE_HOST_TO_MPU);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+
+ /* create pop task */
+ ret = mars_task_create(mars_ctx, &task_id, NULL,
+ mpu_prog.elf_image, MARS_TASK_CONTEXT_SAVE_ALL);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+
+ task_args.type.u64[0] = host_to_mpu[i];
+ task_args.type.u64[1] = mars_ptr_to_ea(&shared_resource);
+ task_args.type.u64[2] = (uint64_t)i;
+ ret = mars_task_schedule(&task_id, &task_args, 0);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+
+ /* check if queue pop is blocked in mpu task */
+ sleep(1);
+ MARS_TEST_ASSERT_EQUAL(shared_resource, 0);
+
+ /* try push one */
+ data.val = i;
+ ret = mars_task_queue_try_push(host_to_mpu[i], &data);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+
+ /* check if mpu task is successfly finished */
+ ret = mars_task_wait(&task_id, &exit_code);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+ MARS_TEST_ASSERT_ERROR(exit_code, MARS_SUCCESS);
+
+ ret = mars_task_destroy(&task_id);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+
+ ret = mars_task_queue_destroy(host_to_mpu[i]);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+ }
+
+ ret = mars_context_destroy(mars_ctx);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+
+ return 0;
+}
+
diff --git a/tests/TFP/TFP_4A_015/mpu.c b/tests/TFP/TFP_4A_015/mpu.c
new file mode 100644
index 0000000..2d05c63
--- /dev/null
+++ b/tests/TFP/TFP_4A_015/mpu.c
@@ -0,0 +1,54 @@
+/*
+ * Copyright 2008 Sony Corporation
+ *
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a copy
+ * of this software and associated documentation files (the "Software"), to deal
+ * in the Software without restriction, including without limitation the rights
+ * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+ * copies of the Software, and to permit persons to whom the Software is
+ * furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included in
+ * all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+ * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+ * THE SOFTWARE.
+ */
+
+#include <mars/mars.h>
+#include <mars_task_test.h>
+#include <spu_mfcio.h>
+
+struct queue_entry {
+ uint64_t val;
+ uint64_t pad;
+};
+static struct queue_entry data;
+static uint32_t shared_resource __attribute((aligned(16)));
+
+int mars_task_main(const struct mars_task_args *task_args)
+{
+ int ret;
+ uint64_t host_to_mpu_ea = task_args->type.u64[0];
+ uint64_t shared_resource_ea = task_args->type.u64[1];
+ uint64_t val = task_args->type.u64[2];
+
+ ret = mars_task_queue_pop(host_to_mpu_ea, &data);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+ MARS_TEST_ASSERT_EQUAL(data.val, val);
+
+ /* if the program reaches here, shared_resource'll be updated */
+ shared_resource = 1;
+ mfc_put(&shared_resource, shared_resource_ea,
+ sizeof(uint32_t), 0, 0, 0);
+ mfc_write_tag_mask(1 << 0);
+ mfc_read_tag_status_all();
+
+ return 0;
+}
diff --git a/tests/TFP/TFP_4A_016/Makefile b/tests/TFP/TFP_4A_016/Makefile
new file mode 100644
index 0000000..432135a
--- /dev/null
+++ b/tests/TFP/TFP_4A_016/Makefile
@@ -0,0 +1,28 @@
+#
+# Copyright 2008 Sony Corporation
+#
+#
+# Permission is hereby granted, free of charge, to any person obtaining a copy
+# of this software and associated documentation files (the "Software"), to deal
+# in the Software without restriction, including without limitation the rights
+# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+# copies of the Software, and to permit persons to whom the Software is
+# furnished to do so, subject to the following conditions:
+#
+# The above copyright notice and this permission notice shall be included in
+# all copies or substantial portions of the Software.
+#
+# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+# THE SOFTWARE.
+#
+
+top_srcdir = ../..
+test_objs = host.o mpu.task_eo
+
+include $(top_srcdir)/scripts/config.mk
+include $(top_srcdir)/scripts/rules_item.mk
diff --git a/tests/TFP/TFP_4A_016/host.c b/tests/TFP/TFP_4A_016/host.c
new file mode 100644
index 0000000..6e589d5
--- /dev/null
+++ b/tests/TFP/TFP_4A_016/host.c
@@ -0,0 +1,128 @@
+/*
+ * Copyright 2008 Sony Corporation
+ *
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a copy
+ * of this software and associated documentation files (the "Software"), to deal
+ * in the Software without restriction, including without limitation the rights
+ * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+ * copies of the Software, and to permit persons to whom the Software is
+ * furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included in
+ * all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+ * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+ * THE SOFTWARE.
+ */
+
+#include <pthread.h>
+#include <unistd.h>
+#include <mars/mars.h>
+#include <libspe2.h>
+#include <mars_test.h>
+
+struct queue_entry {
+ uint64_t val1;
+ uint64_t val2;
+};
+#define Q_DEPTH (256 * 1024)
+
+#define NUM_LOOP 2
+static uint32_t depth_size[] =
+{
+ 1,
+ Q_DEPTH
+};
+extern spe_program_handle_t mpu_prog;
+
+static struct mars_context *mars_ctx;
+static struct mars_task_args task_args, thread_args;
+static struct mars_task_id task_id;
+
+static uint64_t mpu_to_host[NUM_LOOP];
+
+static uint32_t shared_resource __attribute((aligned(16)));
+static struct queue_entry data;
+
+static pthread_t thread;
+static void *thread_proc(void *ptr)
+{
+ int ret;
+ struct mars_task_args *task_args = (struct mars_task_args *)ptr;
+ uint32_t id = (uint32_t)task_args->type.u32[0];
+
+ ret = mars_task_queue_pop(mpu_to_host[id], &data);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+
+ MARS_TEST_ASSERT_EQUAL(data.val1, id);
+
+ /* if the program reaches here, shared_resource'll be updated */
+ shared_resource = 1;
+
+ return NULL;
+}
+
+int main(void)
+{
+ int ret, i;
+ int32_t exit_code;
+
+ ret = mars_context_create(&mars_ctx, 0, 0);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+
+ for (i = 0; i < NUM_LOOP; i++) {
+ shared_resource = 0;
+
+ ret = mars_task_queue_create(
+ mars_ctx,
+ &mpu_to_host[i],
+ sizeof(struct queue_entry),
+ depth_size[i],
+ MARS_TASK_QUEUE_MPU_TO_HOST);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+
+ /* create pop thread */
+ thread_args.type.u32[0] = (uint32_t)i;
+ pthread_create(&thread, NULL, thread_proc, &thread_args);
+
+ /* create try_push task */
+ ret = mars_task_create(mars_ctx, &task_id, NULL,
+ mpu_prog.elf_image, MARS_TASK_CONTEXT_SAVE_ALL);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+
+ /* check if queue pop is blocked in ppe thread */
+ sleep(1);
+ MARS_TEST_ASSERT_EQUAL(shared_resource, 0);
+
+ /* try_push one by mpu */
+ task_args.type.u64[0] = mpu_to_host[i];
+ task_args.type.u64[1] = (uint64_t)i;
+ ret = mars_task_schedule(&task_id, &task_args, 0);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+
+ ret = mars_task_wait(&task_id, &exit_code);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+ MARS_TEST_ASSERT_ERROR(exit_code, MARS_SUCCESS);
+
+ /* check if the thread wakes up and finished */
+ pthread_join(thread, NULL);
+
+ ret = mars_task_destroy(&task_id);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+
+ ret = mars_task_queue_destroy(mpu_to_host[i]);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+ }
+
+ ret = mars_context_destroy(mars_ctx);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+
+ return 0;
+}
+
diff --git a/tests/TFP/TFP_4A_016/mpu.c b/tests/TFP/TFP_4A_016/mpu.c
new file mode 100644
index 0000000..9f5f393
--- /dev/null
+++ b/tests/TFP/TFP_4A_016/mpu.c
@@ -0,0 +1,45 @@
+/*
+ * Copyright 2008 Sony Corporation
+ *
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a copy
+ * of this software and associated documentation files (the "Software"), to deal
+ * in the Software without restriction, including without limitation the rights
+ * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+ * copies of the Software, and to permit persons to whom the Software is
+ * furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included in
+ * all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+ * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+ * THE SOFTWARE.
+ */
+
+#include <mars/mars.h>
+#include <mars_task_test.h>
+#include <spu_mfcio.h>
+
+struct queue_entry {
+ uint64_t val1;
+ uint64_t val2;
+};
+static struct queue_entry data;
+
+int mars_task_main(const struct mars_task_args *task_args)
+{
+ int ret;
+ uint64_t mpu_to_host_ea = task_args->type.u64[0];
+ uint64_t val = task_args->type.u64[1];
+
+ data.val1 = val;
+ ret = mars_task_queue_try_push(mpu_to_host_ea, &data);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+
+ return 0;
+}
diff --git a/tests/TFP/TFP_4A_017/Makefile b/tests/TFP/TFP_4A_017/Makefile
new file mode 100644
index 0000000..ecbce33
--- /dev/null
+++ b/tests/TFP/TFP_4A_017/Makefile
@@ -0,0 +1,28 @@
+#
+# Copyright 2008 Sony Corporation
+#
+#
+# Permission is hereby granted, free of charge, to any person obtaining a copy
+# of this software and associated documentation files (the "Software"), to deal
+# in the Software without restriction, including without limitation the rights
+# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+# copies of the Software, and to permit persons to whom the Software is
+# furnished to do so, subject to the following conditions:
+#
+# The above copyright notice and this permission notice shall be included in
+# all copies or substantial portions of the Software.
+#
+# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+# THE SOFTWARE.
+#
+
+top_srcdir = ../..
+test_objs = host.o mpu1.task_eo mpu2.task_eo
+
+include $(top_srcdir)/scripts/config.mk
+include $(top_srcdir)/scripts/rules_item.mk
diff --git a/tests/TFP/TFP_4A_017/host.c b/tests/TFP/TFP_4A_017/host.c
new file mode 100644
index 0000000..0de04c9
--- /dev/null
+++ b/tests/TFP/TFP_4A_017/host.c
@@ -0,0 +1,121 @@
+/*
+ * Copyright 2008 Sony Corporation
+ *
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a copy
+ * of this software and associated documentation files (the "Software"), to deal
+ * in the Software without restriction, including without limitation the rights
+ * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+ * copies of the Software, and to permit persons to whom the Software is
+ * furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included in
+ * all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+ * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+ * THE SOFTWARE.
+ */
+
+#include <unistd.h>
+#include <mars/mars.h>
+#include <libspe2.h>
+#include <mars_test.h>
+
+struct queue_entry {
+ uint64_t val1;
+ uint64_t val2;
+};
+#define Q_DEPTH (256 * 1024)
+
+#define NUM_LOOP 2
+static uint32_t depth_size[] =
+{
+ 1,
+ Q_DEPTH
+};
+extern spe_program_handle_t mpu1_prog;
+extern spe_program_handle_t mpu2_prog;
+
+static struct mars_context *mars_ctx;
+static struct mars_task_args task1_args, task2_args;
+static struct mars_task_id task1_id, task2_id;
+
+static uint64_t mpu_to_mpu[NUM_LOOP];
+
+static uint32_t shared_resource __attribute((aligned(16)));
+
+int main(void)
+{
+ int ret, i;
+ int32_t exit_code;
+
+ ret = mars_context_create(&mars_ctx, 0, 0);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+
+ for (i = 0; i < NUM_LOOP; i++) {
+ shared_resource = 0;
+
+ ret = mars_task_queue_create(
+ mars_ctx,
+ &mpu_to_mpu[i],
+ sizeof(struct queue_entry),
+ depth_size[i],
+ MARS_TASK_QUEUE_MPU_TO_MPU);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+
+ /* create pop task */
+ ret = mars_task_create(mars_ctx, &task1_id, NULL,
+ mpu1_prog.elf_image, MARS_TASK_CONTEXT_SAVE_ALL);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+
+ task1_args.type.u64[0] = mpu_to_mpu[i];
+ task1_args.type.u64[1] = mars_ptr_to_ea(&shared_resource);
+ task1_args.type.u64[2] = (uint64_t)i;
+ ret = mars_task_schedule(&task1_id, &task1_args, 0);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+
+ /* create push task */
+ ret = mars_task_create(mars_ctx, &task2_id, NULL,
+ mpu2_prog.elf_image, MARS_TASK_CONTEXT_SAVE_ALL);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+
+ /* check if queue pop is blocked in mpu task */
+ sleep(1);
+ MARS_TEST_ASSERT_EQUAL(shared_resource, 0);
+
+ /* push one by mpu */
+ task2_args.type.u64[0] = mpu_to_mpu[i];
+ task2_args.type.u64[1] = (uint64_t)i;
+ ret = mars_task_schedule(&task2_id, &task2_args, 0);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+
+ ret = mars_task_wait(&task2_id, &exit_code);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+ MARS_TEST_ASSERT_ERROR(exit_code, MARS_SUCCESS);
+
+ /* check if pop task is successfly finished */
+ ret = mars_task_wait(&task1_id, &exit_code);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+ MARS_TEST_ASSERT_ERROR(exit_code, MARS_SUCCESS);
+
+ ret = mars_task_destroy(&task1_id);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+
+ ret = mars_task_destroy(&task2_id);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+
+ ret = mars_task_queue_destroy(mpu_to_mpu[i]);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+ }
+
+ ret = mars_context_destroy(mars_ctx);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+
+ return 0;
+}
+
diff --git a/tests/TFP/TFP_4A_017/mpu1.c b/tests/TFP/TFP_4A_017/mpu1.c
new file mode 100644
index 0000000..0f9dd5e
--- /dev/null
+++ b/tests/TFP/TFP_4A_017/mpu1.c
@@ -0,0 +1,54 @@
+/*
+ * Copyright 2008 Sony Corporation
+ *
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a copy
+ * of this software and associated documentation files (the "Software"), to deal
+ * in the Software without restriction, including without limitation the rights
+ * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+ * copies of the Software, and to permit persons to whom the Software is
+ * furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included in
+ * all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+ * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+ * THE SOFTWARE.
+ */
+
+#include <mars/mars.h>
+#include <mars_task_test.h>
+#include <spu_mfcio.h>
+
+struct queue_entry {
+ uint64_t val;
+ uint64_t pad;
+};
+static struct queue_entry data;
+static uint32_t shared_resource __attribute((aligned(16)));
+
+int mars_task_main(const struct mars_task_args *task_args)
+{
+ int ret;
+ uint64_t mpu_to_mpu_ea = task_args->type.u64[0];
+ uint64_t shared_resource_ea = task_args->type.u64[1];
+ uint64_t val = task_args->type.u64[2];
+
+ ret = mars_task_queue_pop(mpu_to_mpu_ea, &data);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+ MARS_TEST_ASSERT_EQUAL(data.val, val);
+
+ /* if the program reaches here, shared_resource'll be updated */
+ shared_resource = 1;
+ mfc_put(&shared_resource, shared_resource_ea,
+ sizeof(uint32_t), 0, 0, 0);
+ mfc_write_tag_mask(1 << 0);
+ mfc_read_tag_status_all();
+
+ return 0;
+}
diff --git a/tests/TFP/TFP_4A_017/mpu2.c b/tests/TFP/TFP_4A_017/mpu2.c
new file mode 100644
index 0000000..2e84740
--- /dev/null
+++ b/tests/TFP/TFP_4A_017/mpu2.c
@@ -0,0 +1,45 @@
+/*
+ * Copyright 2008 Sony Corporation
+ *
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a copy
+ * of this software and associated documentation files (the "Software"), to deal
+ * in the Software without restriction, including without limitation the rights
+ * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+ * copies of the Software, and to permit persons to whom the Software is
+ * furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included in
+ * all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+ * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+ * THE SOFTWARE.
+ */
+
+#include <mars/mars.h>
+#include <mars_task_test.h>
+#include <spu_mfcio.h>
+
+struct queue_entry {
+ uint64_t val1;
+ uint64_t val2;
+};
+static struct queue_entry data;
+
+int mars_task_main(const struct mars_task_args *task_args)
+{
+ int ret;
+ uint64_t mpu_to_mpu_ea = task_args->type.u64[0];
+ uint64_t val = task_args->type.u64[1];
+
+ data.val1 = val;
+ ret = mars_task_queue_try_push(mpu_to_mpu_ea, &data);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+
+ return 0;
+}
diff --git a/tests/TFP/TFP_4A_018/Makefile b/tests/TFP/TFP_4A_018/Makefile
new file mode 100644
index 0000000..432135a
--- /dev/null
+++ b/tests/TFP/TFP_4A_018/Makefile
@@ -0,0 +1,28 @@
+#
+# Copyright 2008 Sony Corporation
+#
+#
+# Permission is hereby granted, free of charge, to any person obtaining a copy
+# of this software and associated documentation files (the "Software"), to deal
+# in the Software without restriction, including without limitation the rights
+# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+# copies of the Software, and to permit persons to whom the Software is
+# furnished to do so, subject to the following conditions:
+#
+# The above copyright notice and this permission notice shall be included in
+# all copies or substantial portions of the Software.
+#
+# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+# THE SOFTWARE.
+#
+
+top_srcdir = ../..
+test_objs = host.o mpu.task_eo
+
+include $(top_srcdir)/scripts/config.mk
+include $(top_srcdir)/scripts/rules_item.mk
diff --git a/tests/TFP/TFP_4A_018/host.c b/tests/TFP/TFP_4A_018/host.c
new file mode 100644
index 0000000..cfd7348
--- /dev/null
+++ b/tests/TFP/TFP_4A_018/host.c
@@ -0,0 +1,91 @@
+/*
+ * Copyright 2008 Sony Corporation
+ *
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a copy
+ * of this software and associated documentation files (the "Software"), to deal
+ * in the Software without restriction, including without limitation the rights
+ * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+ * copies of the Software, and to permit persons to whom the Software is
+ * furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included in
+ * all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+ * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+ * THE SOFTWARE.
+ */
+
+#include <pthread.h>
+#include <unistd.h>
+#include <libspe2.h>
+#include <mars/mars.h>
+#include <mars_test.h>
+
+#define QUEUE_DEPTH 16
+
+extern spe_program_handle_t mpu_prog;
+
+static struct mars_context *mars;
+static struct mars_task_id task_id;
+static struct mars_task_args task_args;
+static uint64_t queue;
+
+static uint64_t queue_item[2];
+
+int main(void)
+{
+ int exit_code, ret;
+ uint32_t tb_freq;
+
+ ret = mars_test_get_timebase_freq(&tb_freq);
+ MARS_TEST_ASSERT_EQUAL(ret, 0);
+
+ ret = mars_context_create(&mars, 0, 0);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+
+ ret = mars_task_create(
+ mars,
+ &task_id,
+ NULL,
+ mpu_prog.elf_image,
+ 0);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+
+ ret = mars_task_queue_create(
+ mars,
+ &queue,
+ 16,
+ QUEUE_DEPTH,
+ MARS_TASK_QUEUE_MPU_TO_HOST);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+
+ task_args.type.u64[0] = queue;
+ task_args.type.u64[1] = tb_freq;
+
+ ret = mars_task_schedule(&task_id, &task_args, 0);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+
+ ret = mars_task_queue_pop(queue, queue_item);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+
+ ret = mars_task_wait(&task_id, &exit_code);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+ MARS_TEST_ASSERT_EQUAL(exit_code, 0);
+
+ ret = mars_task_queue_destroy(queue);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+
+ ret = mars_task_destroy(&task_id);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+
+ ret = mars_context_destroy(mars);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+
+ return 0;
+}
diff --git a/tests/TFP/TFP_4A_018/mpu.c b/tests/TFP/TFP_4A_018/mpu.c
new file mode 100644
index 0000000..820e3fa
--- /dev/null
+++ b/tests/TFP/TFP_4A_018/mpu.c
@@ -0,0 +1,46 @@
+/*
+ * Copyright 2008 Sony Corporation
+ *
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a copy
+ * of this software and associated documentation files (the "Software"), to deal
+ * in the Software without restriction, including without limitation the rights
+ * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+ * copies of the Software, and to permit persons to whom the Software is
+ * furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included in
+ * all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+ * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+ * THE SOFTWARE.
+ */
+
+#include <mars/mars.h>
+#include <mars_task_test.h>
+
+static uint64_t queue_item[2] __attribute__((aligned(16)));
+
+int mars_task_main(const struct mars_task_args *task_args)
+{
+ int ret;
+ uint64_t queue_ea = task_args->type.u64[0];
+ uint32_t tb_freq = task_args->type.u64[1];
+
+ mars_test_usleep(tb_freq, 200000);
+
+ ret = mars_task_queue_try_push_begin(queue_ea, queue_item, 0);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+
+ ret = mars_task_queue_push_end(queue_ea, 0);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+
+ mars_task_exit(0);
+
+ return 0;
+}
diff --git a/tests/TFP/TFP_4A_019/Makefile b/tests/TFP/TFP_4A_019/Makefile
new file mode 100644
index 0000000..ecbce33
--- /dev/null
+++ b/tests/TFP/TFP_4A_019/Makefile
@@ -0,0 +1,28 @@
+#
+# Copyright 2008 Sony Corporation
+#
+#
+# Permission is hereby granted, free of charge, to any person obtaining a copy
+# of this software and associated documentation files (the "Software"), to deal
+# in the Software without restriction, including without limitation the rights
+# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+# copies of the Software, and to permit persons to whom the Software is
+# furnished to do so, subject to the following conditions:
+#
+# The above copyright notice and this permission notice shall be included in
+# all copies or substantial portions of the Software.
+#
+# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+# THE SOFTWARE.
+#
+
+top_srcdir = ../..
+test_objs = host.o mpu1.task_eo mpu2.task_eo
+
+include $(top_srcdir)/scripts/config.mk
+include $(top_srcdir)/scripts/rules_item.mk
diff --git a/tests/TFP/TFP_4A_019/host.c b/tests/TFP/TFP_4A_019/host.c
new file mode 100644
index 0000000..0de04c9
--- /dev/null
+++ b/tests/TFP/TFP_4A_019/host.c
@@ -0,0 +1,121 @@
+/*
+ * Copyright 2008 Sony Corporation
+ *
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a copy
+ * of this software and associated documentation files (the "Software"), to deal
+ * in the Software without restriction, including without limitation the rights
+ * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+ * copies of the Software, and to permit persons to whom the Software is
+ * furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included in
+ * all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+ * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+ * THE SOFTWARE.
+ */
+
+#include <unistd.h>
+#include <mars/mars.h>
+#include <libspe2.h>
+#include <mars_test.h>
+
+struct queue_entry {
+ uint64_t val1;
+ uint64_t val2;
+};
+#define Q_DEPTH (256 * 1024)
+
+#define NUM_LOOP 2
+static uint32_t depth_size[] =
+{
+ 1,
+ Q_DEPTH
+};
+extern spe_program_handle_t mpu1_prog;
+extern spe_program_handle_t mpu2_prog;
+
+static struct mars_context *mars_ctx;
+static struct mars_task_args task1_args, task2_args;
+static struct mars_task_id task1_id, task2_id;
+
+static uint64_t mpu_to_mpu[NUM_LOOP];
+
+static uint32_t shared_resource __attribute((aligned(16)));
+
+int main(void)
+{
+ int ret, i;
+ int32_t exit_code;
+
+ ret = mars_context_create(&mars_ctx, 0, 0);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+
+ for (i = 0; i < NUM_LOOP; i++) {
+ shared_resource = 0;
+
+ ret = mars_task_queue_create(
+ mars_ctx,
+ &mpu_to_mpu[i],
+ sizeof(struct queue_entry),
+ depth_size[i],
+ MARS_TASK_QUEUE_MPU_TO_MPU);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+
+ /* create pop task */
+ ret = mars_task_create(mars_ctx, &task1_id, NULL,
+ mpu1_prog.elf_image, MARS_TASK_CONTEXT_SAVE_ALL);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+
+ task1_args.type.u64[0] = mpu_to_mpu[i];
+ task1_args.type.u64[1] = mars_ptr_to_ea(&shared_resource);
+ task1_args.type.u64[2] = (uint64_t)i;
+ ret = mars_task_schedule(&task1_id, &task1_args, 0);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+
+ /* create push task */
+ ret = mars_task_create(mars_ctx, &task2_id, NULL,
+ mpu2_prog.elf_image, MARS_TASK_CONTEXT_SAVE_ALL);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+
+ /* check if queue pop is blocked in mpu task */
+ sleep(1);
+ MARS_TEST_ASSERT_EQUAL(shared_resource, 0);
+
+ /* push one by mpu */
+ task2_args.type.u64[0] = mpu_to_mpu[i];
+ task2_args.type.u64[1] = (uint64_t)i;
+ ret = mars_task_schedule(&task2_id, &task2_args, 0);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+
+ ret = mars_task_wait(&task2_id, &exit_code);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+ MARS_TEST_ASSERT_ERROR(exit_code, MARS_SUCCESS);
+
+ /* check if pop task is successfly finished */
+ ret = mars_task_wait(&task1_id, &exit_code);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+ MARS_TEST_ASSERT_ERROR(exit_code, MARS_SUCCESS);
+
+ ret = mars_task_destroy(&task1_id);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+
+ ret = mars_task_destroy(&task2_id);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+
+ ret = mars_task_queue_destroy(mpu_to_mpu[i]);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+ }
+
+ ret = mars_context_destroy(mars_ctx);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+
+ return 0;
+}
+
diff --git a/tests/TFP/TFP_4A_019/mpu1.c b/tests/TFP/TFP_4A_019/mpu1.c
new file mode 100644
index 0000000..0f9dd5e
--- /dev/null
+++ b/tests/TFP/TFP_4A_019/mpu1.c
@@ -0,0 +1,54 @@
+/*
+ * Copyright 2008 Sony Corporation
+ *
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a copy
+ * of this software and associated documentation files (the "Software"), to deal
+ * in the Software without restriction, including without limitation the rights
+ * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+ * copies of the Software, and to permit persons to whom the Software is
+ * furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included in
+ * all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+ * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+ * THE SOFTWARE.
+ */
+
+#include <mars/mars.h>
+#include <mars_task_test.h>
+#include <spu_mfcio.h>
+
+struct queue_entry {
+ uint64_t val;
+ uint64_t pad;
+};
+static struct queue_entry data;
+static uint32_t shared_resource __attribute((aligned(16)));
+
+int mars_task_main(const struct mars_task_args *task_args)
+{
+ int ret;
+ uint64_t mpu_to_mpu_ea = task_args->type.u64[0];
+ uint64_t shared_resource_ea = task_args->type.u64[1];
+ uint64_t val = task_args->type.u64[2];
+
+ ret = mars_task_queue_pop(mpu_to_mpu_ea, &data);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+ MARS_TEST_ASSERT_EQUAL(data.val, val);
+
+ /* if the program reaches here, shared_resource'll be updated */
+ shared_resource = 1;
+ mfc_put(&shared_resource, shared_resource_ea,
+ sizeof(uint32_t), 0, 0, 0);
+ mfc_write_tag_mask(1 << 0);
+ mfc_read_tag_status_all();
+
+ return 0;
+}
diff --git a/tests/TFP/TFP_4A_019/mpu2.c b/tests/TFP/TFP_4A_019/mpu2.c
new file mode 100644
index 0000000..2e2124b
--- /dev/null
+++ b/tests/TFP/TFP_4A_019/mpu2.c
@@ -0,0 +1,48 @@
+/*
+ * Copyright 2008 Sony Corporation
+ *
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a copy
+ * of this software and associated documentation files (the "Software"), to deal
+ * in the Software without restriction, including without limitation the rights
+ * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+ * copies of the Software, and to permit persons to whom the Software is
+ * furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included in
+ * all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+ * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+ * THE SOFTWARE.
+ */
+
+#include <mars/mars.h>
+#include <mars_task_test.h>
+#include <spu_mfcio.h>
+
+struct queue_entry {
+ uint64_t val1;
+ uint64_t val2;
+};
+static struct queue_entry data;
+
+int mars_task_main(const struct mars_task_args *task_args)
+{
+ int ret;
+ uint64_t mpu_to_mpu_ea = task_args->type.u64[0];
+ uint64_t val = task_args->type.u64[1];
+
+ data.val1 = val;
+ ret = mars_task_queue_try_push_begin(mpu_to_mpu_ea, &data, 1);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+
+ ret = mars_task_queue_push_end(mpu_to_mpu_ea, 1);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+
+ return 0;
+}
diff --git a/tests/TFP/TFP_4B_001/Makefile b/tests/TFP/TFP_4B_001/Makefile
new file mode 100644
index 0000000..432135a
--- /dev/null
+++ b/tests/TFP/TFP_4B_001/Makefile
@@ -0,0 +1,28 @@
+#
+# Copyright 2008 Sony Corporation
+#
+#
+# Permission is hereby granted, free of charge, to any person obtaining a copy
+# of this software and associated documentation files (the "Software"), to deal
+# in the Software without restriction, including without limitation the rights
+# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+# copies of the Software, and to permit persons to whom the Software is
+# furnished to do so, subject to the following conditions:
+#
+# The above copyright notice and this permission notice shall be included in
+# all copies or substantial portions of the Software.
+#
+# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+# THE SOFTWARE.
+#
+
+top_srcdir = ../..
+test_objs = host.o mpu.task_eo
+
+include $(top_srcdir)/scripts/config.mk
+include $(top_srcdir)/scripts/rules_item.mk
diff --git a/tests/TFP/TFP_4B_001/host.c b/tests/TFP/TFP_4B_001/host.c
new file mode 100644
index 0000000..b0b0a81
--- /dev/null
+++ b/tests/TFP/TFP_4B_001/host.c
@@ -0,0 +1,90 @@
+/*
+ * Copyright 2008 Sony Corporation
+ *
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a copy
+ * of this software and associated documentation files (the "Software"), to deal
+ * in the Software without restriction, including without limitation the rights
+ * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+ * copies of the Software, and to permit persons to whom the Software is
+ * furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included in
+ * all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+ * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+ * THE SOFTWARE.
+ */
+
+#include <unistd.h>
+#include <libspe2.h>
+#include <mars/mars.h>
+#include <mars_test.h>
+
+#define QUEUE_DEPTH 16
+
+extern spe_program_handle_t mpu_prog;
+
+static struct mars_context *mars;
+static struct mars_task_id task_id;
+static struct mars_task_args task_args;
+static uint64_t queue;
+static uint64_t queue_item[2], mpu_answer __attribute__((aligned(16)));
+
+int main(void)
+{
+ int exit_code, ret;
+
+ ret = mars_context_create(&mars, 0, 0);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+
+ ret = mars_task_create(
+ mars,
+ &task_id,
+ "4B001",
+ mpu_prog.elf_image,
+ MARS_TASK_CONTEXT_SAVE_ALL);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+
+ ret = mars_task_queue_create(
+ mars,
+ &queue,
+ 16,
+ QUEUE_DEPTH,
+ MARS_TASK_QUEUE_HOST_TO_MPU);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+
+ mpu_answer = 0;
+
+ task_args.type.u64[0] = queue;
+ task_args.type.u64[1] = mars_ptr_to_ea(&mpu_answer);
+ ret = mars_task_schedule(&task_id, &task_args, 0);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+
+ usleep(200000);
+
+ mpu_answer = 1;
+
+ ret = mars_task_queue_push(queue, queue_item);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+
+ ret = mars_task_wait(&task_id, &exit_code);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+ MARS_TEST_ASSERT_EQUAL(exit_code, 0);
+
+ ret = mars_task_queue_destroy(queue);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+
+ ret = mars_task_destroy(&task_id);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+
+ ret = mars_context_destroy(mars);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+
+ return 0;
+}
diff --git a/tests/TFP/TFP_4B_001/mpu.c b/tests/TFP/TFP_4B_001/mpu.c
new file mode 100644
index 0000000..8bb69b0
--- /dev/null
+++ b/tests/TFP/TFP_4B_001/mpu.c
@@ -0,0 +1,50 @@
+/*
+ * Copyright 2008 Sony Corporation
+ *
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a copy
+ * of this software and associated documentation files (the "Software"), to deal
+ * in the Software without restriction, including without limitation the rights
+ * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+ * copies of the Software, and to permit persons to whom the Software is
+ * furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included in
+ * all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+ * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+ * THE SOFTWARE.
+ */
+
+#include <string.h>
+#include <spu_mfcio.h>
+#include <mars/mars.h>
+#include "mars_task_test.h"
+
+static uint64_t queue_item[2] __attribute__((aligned(16)));
+
+int mars_task_main(const struct mars_task_args *task_args)
+{
+ uint64_t queue_ea = task_args->type.u64[0];
+ uint64_t mpu_answer_ea = task_args->type.u64[1];
+ uint64_t mpu_answer;
+ int ret;
+
+ ret = mars_task_queue_pop_begin(queue_ea, queue_item, 0);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+
+ ret = mars_task_queue_pop_end(queue_ea, 0);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+
+ mpu_answer = mars_test_int64_get(mpu_answer_ea);
+ MARS_TEST_ASSERT(mpu_answer);
+
+ mars_task_exit(0);
+
+ return 0;
+}
diff --git a/tests/TFP/TFP_4B_002/Makefile b/tests/TFP/TFP_4B_002/Makefile
new file mode 100644
index 0000000..ecbce33
--- /dev/null
+++ b/tests/TFP/TFP_4B_002/Makefile
@@ -0,0 +1,28 @@
+#
+# Copyright 2008 Sony Corporation
+#
+#
+# Permission is hereby granted, free of charge, to any person obtaining a copy
+# of this software and associated documentation files (the "Software"), to deal
+# in the Software without restriction, including without limitation the rights
+# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+# copies of the Software, and to permit persons to whom the Software is
+# furnished to do so, subject to the following conditions:
+#
+# The above copyright notice and this permission notice shall be included in
+# all copies or substantial portions of the Software.
+#
+# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+# THE SOFTWARE.
+#
+
+top_srcdir = ../..
+test_objs = host.o mpu1.task_eo mpu2.task_eo
+
+include $(top_srcdir)/scripts/config.mk
+include $(top_srcdir)/scripts/rules_item.mk
diff --git a/tests/TFP/TFP_4B_002/host.c b/tests/TFP/TFP_4B_002/host.c
new file mode 100644
index 0000000..2ce51a5
--- /dev/null
+++ b/tests/TFP/TFP_4B_002/host.c
@@ -0,0 +1,105 @@
+/*
+ * Copyright 2008 Sony Corporation
+ *
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a copy
+ * of this software and associated documentation files (the "Software"), to deal
+ * in the Software without restriction, including without limitation the rights
+ * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+ * copies of the Software, and to permit persons to whom the Software is
+ * furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included in
+ * all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+ * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+ * THE SOFTWARE.
+ */
+
+#include <libspe2.h>
+#include <mars/mars.h>
+#include <mars_test.h>
+
+#define QUEUE_DEPTH 16
+
+extern spe_program_handle_t mpu1_prog, mpu2_prog;
+
+static struct mars_context *mars;
+static struct mars_task_id pusher_task_id, poper_task_id;
+static struct mars_task_args task_args;
+static uint64_t queue;
+static uint64_t mpu_answer __attribute__((aligned(16)));
+
+int main(void)
+{
+ int exit_code, ret;
+ uint32_t tb_freq;
+
+ ret = mars_test_get_timebase_freq(&tb_freq);
+ MARS_TEST_ASSERT_EQUAL(ret, 0);
+
+ ret = mars_context_create(&mars, 0, 0);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+
+ ret = mars_task_create(
+ mars,
+ &pusher_task_id,
+ "4B002",
+ mpu1_prog.elf_image,
+ MARS_TASK_CONTEXT_SAVE_ALL);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+
+ ret = mars_task_create(
+ mars,
+ &poper_task_id,
+ "4B002",
+ mpu2_prog.elf_image,
+ MARS_TASK_CONTEXT_SAVE_ALL);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+
+ ret = mars_task_queue_create(
+ mars,
+ &queue,
+ 16,
+ QUEUE_DEPTH,
+ MARS_TASK_QUEUE_MPU_TO_MPU);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+
+ mpu_answer = 0;
+
+ task_args.type.u64[0] = queue;
+ task_args.type.u64[1] = mars_ptr_to_ea(&mpu_answer);
+ task_args.type.u64[2] = tb_freq;
+ ret = mars_task_schedule(&pusher_task_id, &task_args, 0);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+
+ ret = mars_task_schedule(&poper_task_id, &task_args, 0);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+
+ ret = mars_task_wait(&pusher_task_id, &exit_code);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+ MARS_TEST_ASSERT_EQUAL(exit_code, 0);
+
+ ret = mars_task_wait(&poper_task_id, &exit_code);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+ MARS_TEST_ASSERT_EQUAL(exit_code, 0);
+
+ ret = mars_task_queue_destroy(queue);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+
+ ret = mars_task_destroy(&pusher_task_id);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+
+ ret = mars_task_destroy(&poper_task_id);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+
+ ret = mars_context_destroy(mars);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+
+ return 0;
+}
diff --git a/tests/TFP/TFP_4B_002/mpu1.c b/tests/TFP/TFP_4B_002/mpu1.c
new file mode 100644
index 0000000..62015b8
--- /dev/null
+++ b/tests/TFP/TFP_4B_002/mpu1.c
@@ -0,0 +1,48 @@
+/*
+ * Copyright 2008 Sony Corporation
+ *
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a copy
+ * of this software and associated documentation files (the "Software"), to deal
+ * in the Software without restriction, including without limitation the rights
+ * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+ * copies of the Software, and to permit persons to whom the Software is
+ * furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included in
+ * all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+ * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+ * THE SOFTWARE.
+ */
+
+#include <string.h>
+#include <spu_mfcio.h>
+#include <mars/mars.h>
+#include "mars_task_test.h"
+
+static uint64_t queue_item[2] __attribute__((aligned(16)));
+
+int mars_task_main(const struct mars_task_args *task_args)
+{
+ uint64_t queue_ea = task_args->type.u64[0];
+ uint64_t mpu_answer_ea = task_args->type.u64[1];
+ uint32_t tb_freq = task_args->type.u64[2];
+ int ret;
+
+ mars_test_usleep(tb_freq, 200000);
+
+ mars_test_int64_put(mpu_answer_ea, 1);
+
+ ret = mars_task_queue_push(queue_ea, queue_item);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+
+ mars_task_exit(0);
+
+ return 0;
+}
diff --git a/tests/TFP/TFP_4B_002/mpu2.c b/tests/TFP/TFP_4B_002/mpu2.c
new file mode 100644
index 0000000..7b6e483
--- /dev/null
+++ b/tests/TFP/TFP_4B_002/mpu2.c
@@ -0,0 +1,51 @@
+/*
+ * Copyright 2008 Sony Corporation
+ *
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a copy
+ * of this software and associated documentation files (the "Software"), to deal
+ * in the Software without restriction, including without limitation the rights
+ * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+ * copies of the Software, and to permit persons to whom the Software is
+ * furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included in
+ * all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+ * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+ * THE SOFTWARE.
+ */
+
+#include <string.h>
+#include <spu_mfcio.h>
+#include <mars/mars.h>
+#include "mars_task_test.h"
+
+static uint64_t queue_item[2] __attribute__((aligned(16)));
+
+int mars_task_main(const struct mars_task_args *task_args)
+{
+ uint64_t queue_ea = task_args->type.u64[0];
+ uint64_t mpu_answer_ea = task_args->type.u64[1];
+ int ret;
+
+ uint64_t mpu_answer;
+
+ ret = mars_task_queue_pop_begin(queue_ea, queue_item, 0);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+
+ ret = mars_task_queue_pop_end(queue_ea, 0);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+
+ mpu_answer = mars_test_int64_get(mpu_answer_ea);
+ MARS_TEST_ASSERT(mpu_answer);
+
+ mars_task_exit(0);
+
+ return 0;
+}
diff --git a/tests/TFP/TFP_4B_003/Makefile b/tests/TFP/TFP_4B_003/Makefile
new file mode 100644
index 0000000..432135a
--- /dev/null
+++ b/tests/TFP/TFP_4B_003/Makefile
@@ -0,0 +1,28 @@
+#
+# Copyright 2008 Sony Corporation
+#
+#
+# Permission is hereby granted, free of charge, to any person obtaining a copy
+# of this software and associated documentation files (the "Software"), to deal
+# in the Software without restriction, including without limitation the rights
+# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+# copies of the Software, and to permit persons to whom the Software is
+# furnished to do so, subject to the following conditions:
+#
+# The above copyright notice and this permission notice shall be included in
+# all copies or substantial portions of the Software.
+#
+# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+# THE SOFTWARE.
+#
+
+top_srcdir = ../..
+test_objs = host.o mpu.task_eo
+
+include $(top_srcdir)/scripts/config.mk
+include $(top_srcdir)/scripts/rules_item.mk
diff --git a/tests/TFP/TFP_4B_003/host.c b/tests/TFP/TFP_4B_003/host.c
new file mode 100644
index 0000000..fdf3de4
--- /dev/null
+++ b/tests/TFP/TFP_4B_003/host.c
@@ -0,0 +1,138 @@
+/*
+ * Copyright 2008 Sony Corporation
+ *
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a copy
+ * of this software and associated documentation files (the "Software"), to deal
+ * in the Software without restriction, including without limitation the rights
+ * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+ * copies of the Software, and to permit persons to whom the Software is
+ * furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included in
+ * all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+ * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+ * THE SOFTWARE.
+ */
+
+#include <unistd.h>
+#include <mars/mars.h>
+#include <libspe2.h>
+#include <mars_test.h>
+
+struct queue_entry {
+ uint64_t val1;
+ uint64_t val2;
+};
+#define Q_DEPTH (MARS_TASK_QUEUE_WAIT_MAX)
+
+#define TEST_DIFF 1
+
+#define NUM_LOOP 5
+static uint32_t depth_size[] =
+{
+ 1,
+ Q_DEPTH / 2,
+ Q_DEPTH,
+ Q_DEPTH,
+ Q_DEPTH
+};
+extern spe_program_handle_t mpu_prog;
+
+static struct mars_context *mars_ctx;
+static struct mars_task_args task_args;
+static struct mars_task_id task_id[Q_DEPTH];
+
+static uint64_t host_to_mpu[NUM_LOOP];
+static uint32_t notify[32] __attribute((aligned(128)));
+static struct queue_entry data;
+
+static void queue_push(uint64_t id, uint64_t count)
+{
+ int ret, i;
+
+ for (i = 0; i < count; i++) {
+ data.val1 = i;
+ data.val2 = i + TEST_DIFF;
+ ret = mars_task_queue_push(host_to_mpu[id], &data);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+ }
+}
+
+int main(void)
+{
+ int ret, i;
+ int32_t exit_code, chk_exit;
+ uint32_t num;
+ uint32_t chk_bit, count;
+
+ ret = mars_context_create(&mars_ctx, 0, 0);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+
+ for (i = 0; i < NUM_LOOP; i++) {
+ notify[0] = 0;
+ chk_bit = 0;
+
+ ret = mars_task_queue_create(
+ mars_ctx,
+ &host_to_mpu[i],
+ sizeof(struct queue_entry),
+ depth_size[i],
+ MARS_TASK_QUEUE_HOST_TO_MPU);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+
+ queue_push(i, depth_size[i]);
+
+ /* create pop task */
+ for (num = 0; num < depth_size[i]; num++) {
+ chk_bit += (1 << num);
+
+ /* create pop task */
+ ret = mars_task_create(mars_ctx, &task_id[num], NULL,
+ mpu_prog.elf_image, MARS_TASK_CONTEXT_SAVE_ALL);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+
+ task_args.type.u64[0] = host_to_mpu[i];
+ task_args.type.u64[1] =
+ mars_ptr_to_ea(&notify);
+ ret = mars_task_schedule(&task_id[num],
+ &task_args, 0);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+ }
+
+ /* start mpu tasks at the same time */
+ sleep(1);
+ mars_test_counter_set(&notify[0], 1);
+
+ chk_exit = 0;
+ for (num = 0; num < depth_size[i]; num++) {
+ ret = mars_task_wait(&task_id[num], &exit_code);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+ chk_exit |= exit_code;
+
+ ret = mars_task_destroy(&task_id[num]);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+ }
+ MARS_TEST_ASSERT_EQUAL((uint32_t)chk_exit, chk_bit);
+
+ /* check queue count */
+ ret = mars_task_queue_count(host_to_mpu[i], &count);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+ MARS_TEST_ASSERT_EQUAL(count, 0);
+
+ ret = mars_task_queue_destroy(host_to_mpu[i]);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+ }
+
+ ret = mars_context_destroy(mars_ctx);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+
+ return 0;
+}
+
diff --git a/tests/TFP/TFP_4B_003/mpu.c b/tests/TFP/TFP_4B_003/mpu.c
new file mode 100644
index 0000000..4f9d662
--- /dev/null
+++ b/tests/TFP/TFP_4B_003/mpu.c
@@ -0,0 +1,57 @@
+/*
+ * Copyright 2008 Sony Corporation
+ *
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a copy
+ * of this software and associated documentation files (the "Software"), to deal
+ * in the Software without restriction, including without limitation the rights
+ * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+ * copies of the Software, and to permit persons to whom the Software is
+ * furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included in
+ * all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+ * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+ * THE SOFTWARE.
+ */
+
+#include <mars/mars.h>
+#include <mars_task_test.h>
+#include <spu_mfcio.h>
+
+#define TEST_DIFF 1
+struct queue_entry {
+ uint64_t val1;
+ uint64_t val2;
+};
+static struct queue_entry data;
+
+int mars_task_main(const struct mars_task_args *task_args)
+{
+ int ret;
+ uint64_t host_to_mpu_ea = task_args->type.u64[0];
+ uint64_t notify_ea = task_args->type.u64[1];
+ uint64_t val;
+
+ mars_test_counter_wait(notify_ea, 1);
+
+ ret = mars_task_queue_pop_begin(host_to_mpu_ea, &data, 1);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+
+ ret = mars_task_queue_pop_end(host_to_mpu_ea, 1);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+
+ /* check queue data */
+ val = data.val2 - data.val1;
+ MARS_TEST_ASSERT_EQUAL(val, TEST_DIFF);
+
+ mars_task_exit(1 << data.val1);
+
+ return 0;
+}
diff --git a/tests/TFP/TFP_4B_004/Makefile b/tests/TFP/TFP_4B_004/Makefile
new file mode 100644
index 0000000..432135a
--- /dev/null
+++ b/tests/TFP/TFP_4B_004/Makefile
@@ -0,0 +1,28 @@
+#
+# Copyright 2008 Sony Corporation
+#
+#
+# Permission is hereby granted, free of charge, to any person obtaining a copy
+# of this software and associated documentation files (the "Software"), to deal
+# in the Software without restriction, including without limitation the rights
+# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+# copies of the Software, and to permit persons to whom the Software is
+# furnished to do so, subject to the following conditions:
+#
+# The above copyright notice and this permission notice shall be included in
+# all copies or substantial portions of the Software.
+#
+# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+# THE SOFTWARE.
+#
+
+top_srcdir = ../..
+test_objs = host.o mpu.task_eo
+
+include $(top_srcdir)/scripts/config.mk
+include $(top_srcdir)/scripts/rules_item.mk
diff --git a/tests/TFP/TFP_4B_004/host.c b/tests/TFP/TFP_4B_004/host.c
new file mode 100644
index 0000000..b9cf126
--- /dev/null
+++ b/tests/TFP/TFP_4B_004/host.c
@@ -0,0 +1,88 @@
+/*
+ * Copyright 2008 Sony Corporation
+ *
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a copy
+ * of this software and associated documentation files (the "Software"), to deal
+ * in the Software without restriction, including without limitation the rights
+ * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+ * copies of the Software, and to permit persons to whom the Software is
+ * furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included in
+ * all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+ * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+ * THE SOFTWARE.
+ */
+
+#include <pthread.h>
+#include <unistd.h>
+#include <libspe2.h>
+#include <mars/mars.h>
+#include <mars_test.h>
+
+#define QUEUE_DEPTH 16
+
+extern spe_program_handle_t mpu_prog;
+
+static struct mars_context *mars;
+static struct mars_task_id task_id;
+static struct mars_task_args task_args;
+static uint64_t queue;
+
+static uint64_t queue_item[2];
+
+int main(void)
+{
+ int exit_code, ret;
+
+ ret = mars_context_create(&mars, 0, 0);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+
+ ret = mars_task_create(
+ mars,
+ &task_id,
+ NULL,
+ mpu_prog.elf_image,
+ MARS_TASK_CONTEXT_SAVE_ALL);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+
+ ret = mars_task_queue_create(
+ mars,
+ &queue,
+ 16,
+ QUEUE_DEPTH,
+ MARS_TASK_QUEUE_HOST_TO_MPU);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+
+ task_args.type.u64[0] = queue;
+
+ ret = mars_task_schedule(&task_id, &task_args, 0);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+
+ usleep(200000);
+
+ ret = mars_task_queue_push(queue, queue_item);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+
+ ret = mars_task_wait(&task_id, &exit_code);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+ MARS_TEST_ASSERT_EQUAL(exit_code, 0);
+
+ ret = mars_task_queue_destroy(queue);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+
+ ret = mars_task_destroy(&task_id);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+
+ ret = mars_context_destroy(mars);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+
+ return 0;
+}
diff --git a/tests/TFP/TFP_4B_004/mpu.c b/tests/TFP/TFP_4B_004/mpu.c
new file mode 100644
index 0000000..832e4ce
--- /dev/null
+++ b/tests/TFP/TFP_4B_004/mpu.c
@@ -0,0 +1,43 @@
+/*
+ * Copyright 2008 Sony Corporation
+ *
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a copy
+ * of this software and associated documentation files (the "Software"), to deal
+ * in the Software without restriction, including without limitation the rights
+ * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+ * copies of the Software, and to permit persons to whom the Software is
+ * furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included in
+ * all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+ * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+ * THE SOFTWARE.
+ */
+
+#include <mars/mars.h>
+#include <mars_task_test.h>
+
+static uint64_t queue_item[2] __attribute__((aligned(16)));
+
+int mars_task_main(const struct mars_task_args *task_args)
+{
+ int ret;
+ uint64_t queue_ea = task_args->type.u64[0];
+
+ ret = mars_task_queue_pop_begin(queue_ea, queue_item, 0);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+
+ ret = mars_task_queue_pop_end(queue_ea, 0);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+
+ mars_task_exit(0);
+
+ return 0;
+}
diff --git a/tests/TFP/TFP_4B_005/Makefile b/tests/TFP/TFP_4B_005/Makefile
new file mode 100644
index 0000000..ecbce33
--- /dev/null
+++ b/tests/TFP/TFP_4B_005/Makefile
@@ -0,0 +1,28 @@
+#
+# Copyright 2008 Sony Corporation
+#
+#
+# Permission is hereby granted, free of charge, to any person obtaining a copy
+# of this software and associated documentation files (the "Software"), to deal
+# in the Software without restriction, including without limitation the rights
+# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+# copies of the Software, and to permit persons to whom the Software is
+# furnished to do so, subject to the following conditions:
+#
+# The above copyright notice and this permission notice shall be included in
+# all copies or substantial portions of the Software.
+#
+# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+# THE SOFTWARE.
+#
+
+top_srcdir = ../..
+test_objs = host.o mpu1.task_eo mpu2.task_eo
+
+include $(top_srcdir)/scripts/config.mk
+include $(top_srcdir)/scripts/rules_item.mk
diff --git a/tests/TFP/TFP_4B_005/host.c b/tests/TFP/TFP_4B_005/host.c
new file mode 100644
index 0000000..0de04c9
--- /dev/null
+++ b/tests/TFP/TFP_4B_005/host.c
@@ -0,0 +1,121 @@
+/*
+ * Copyright 2008 Sony Corporation
+ *
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a copy
+ * of this software and associated documentation files (the "Software"), to deal
+ * in the Software without restriction, including without limitation the rights
+ * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+ * copies of the Software, and to permit persons to whom the Software is
+ * furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included in
+ * all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+ * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+ * THE SOFTWARE.
+ */
+
+#include <unistd.h>
+#include <mars/mars.h>
+#include <libspe2.h>
+#include <mars_test.h>
+
+struct queue_entry {
+ uint64_t val1;
+ uint64_t val2;
+};
+#define Q_DEPTH (256 * 1024)
+
+#define NUM_LOOP 2
+static uint32_t depth_size[] =
+{
+ 1,
+ Q_DEPTH
+};
+extern spe_program_handle_t mpu1_prog;
+extern spe_program_handle_t mpu2_prog;
+
+static struct mars_context *mars_ctx;
+static struct mars_task_args task1_args, task2_args;
+static struct mars_task_id task1_id, task2_id;
+
+static uint64_t mpu_to_mpu[NUM_LOOP];
+
+static uint32_t shared_resource __attribute((aligned(16)));
+
+int main(void)
+{
+ int ret, i;
+ int32_t exit_code;
+
+ ret = mars_context_create(&mars_ctx, 0, 0);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+
+ for (i = 0; i < NUM_LOOP; i++) {
+ shared_resource = 0;
+
+ ret = mars_task_queue_create(
+ mars_ctx,
+ &mpu_to_mpu[i],
+ sizeof(struct queue_entry),
+ depth_size[i],
+ MARS_TASK_QUEUE_MPU_TO_MPU);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+
+ /* create pop task */
+ ret = mars_task_create(mars_ctx, &task1_id, NULL,
+ mpu1_prog.elf_image, MARS_TASK_CONTEXT_SAVE_ALL);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+
+ task1_args.type.u64[0] = mpu_to_mpu[i];
+ task1_args.type.u64[1] = mars_ptr_to_ea(&shared_resource);
+ task1_args.type.u64[2] = (uint64_t)i;
+ ret = mars_task_schedule(&task1_id, &task1_args, 0);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+
+ /* create push task */
+ ret = mars_task_create(mars_ctx, &task2_id, NULL,
+ mpu2_prog.elf_image, MARS_TASK_CONTEXT_SAVE_ALL);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+
+ /* check if queue pop is blocked in mpu task */
+ sleep(1);
+ MARS_TEST_ASSERT_EQUAL(shared_resource, 0);
+
+ /* push one by mpu */
+ task2_args.type.u64[0] = mpu_to_mpu[i];
+ task2_args.type.u64[1] = (uint64_t)i;
+ ret = mars_task_schedule(&task2_id, &task2_args, 0);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+
+ ret = mars_task_wait(&task2_id, &exit_code);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+ MARS_TEST_ASSERT_ERROR(exit_code, MARS_SUCCESS);
+
+ /* check if pop task is successfly finished */
+ ret = mars_task_wait(&task1_id, &exit_code);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+ MARS_TEST_ASSERT_ERROR(exit_code, MARS_SUCCESS);
+
+ ret = mars_task_destroy(&task1_id);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+
+ ret = mars_task_destroy(&task2_id);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+
+ ret = mars_task_queue_destroy(mpu_to_mpu[i]);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+ }
+
+ ret = mars_context_destroy(mars_ctx);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+
+ return 0;
+}
+
diff --git a/tests/TFP/TFP_4B_005/mpu1.c b/tests/TFP/TFP_4B_005/mpu1.c
new file mode 100644
index 0000000..bcec72b
--- /dev/null
+++ b/tests/TFP/TFP_4B_005/mpu1.c
@@ -0,0 +1,58 @@
+/*
+ * Copyright 2008 Sony Corporation
+ *
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a copy
+ * of this software and associated documentation files (the "Software"), to deal
+ * in the Software without restriction, including without limitation the rights
+ * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+ * copies of the Software, and to permit persons to whom the Software is
+ * furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included in
+ * all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+ * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+ * THE SOFTWARE.
+ */
+
+#include <mars/mars.h>
+#include <mars_task_test.h>
+#include <spu_mfcio.h>
+
+struct queue_entry {
+ uint64_t val;
+ uint64_t pad;
+};
+static struct queue_entry data;
+static uint32_t shared_resource __attribute((aligned(16)));
+
+int mars_task_main(const struct mars_task_args *task_args)
+{
+ int ret;
+ uint64_t mpu_to_mpu_ea = task_args->type.u64[0];
+ uint64_t shared_resource_ea = task_args->type.u64[1];
+ uint64_t val = task_args->type.u64[2];
+
+ ret = mars_task_queue_pop_begin(mpu_to_mpu_ea, &data, 1);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+
+ ret = mars_task_queue_pop_end(mpu_to_mpu_ea, 1);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+
+ MARS_TEST_ASSERT_EQUAL(data.val, val);
+
+ /* if the program reaches here, shared_resource'll be updated */
+ shared_resource = 1;
+ mfc_put(&shared_resource, shared_resource_ea,
+ sizeof(uint32_t), 0, 0, 0);
+ mfc_write_tag_mask(1 << 0);
+ mfc_read_tag_status_all();
+
+ return 0;
+}
diff --git a/tests/TFP/TFP_4B_005/mpu2.c b/tests/TFP/TFP_4B_005/mpu2.c
new file mode 100644
index 0000000..fb4a992
--- /dev/null
+++ b/tests/TFP/TFP_4B_005/mpu2.c
@@ -0,0 +1,45 @@
+/*
+ * Copyright 2008 Sony Corporation
+ *
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a copy
+ * of this software and associated documentation files (the "Software"), to deal
+ * in the Software without restriction, including without limitation the rights
+ * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+ * copies of the Software, and to permit persons to whom the Software is
+ * furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included in
+ * all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+ * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+ * THE SOFTWARE.
+ */
+
+#include <mars/mars.h>
+#include <mars_task_test.h>
+#include <spu_mfcio.h>
+
+struct queue_entry {
+ uint64_t val1;
+ uint64_t val2;
+};
+static struct queue_entry data;
+
+int mars_task_main(const struct mars_task_args *task_args)
+{
+ int ret;
+ uint64_t mpu_to_mpu_ea = task_args->type.u64[0];
+ uint64_t val = task_args->type.u64[1];
+
+ data.val1 = val;
+ ret = mars_task_queue_push(mpu_to_mpu_ea, &data);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+
+ return 0;
+}
diff --git a/tests/TFP/TFP_4B_006/Makefile b/tests/TFP/TFP_4B_006/Makefile
new file mode 100644
index 0000000..ecbce33
--- /dev/null
+++ b/tests/TFP/TFP_4B_006/Makefile
@@ -0,0 +1,28 @@
+#
+# Copyright 2008 Sony Corporation
+#
+#
+# Permission is hereby granted, free of charge, to any person obtaining a copy
+# of this software and associated documentation files (the "Software"), to deal
+# in the Software without restriction, including without limitation the rights
+# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+# copies of the Software, and to permit persons to whom the Software is
+# furnished to do so, subject to the following conditions:
+#
+# The above copyright notice and this permission notice shall be included in
+# all copies or substantial portions of the Software.
+#
+# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+# THE SOFTWARE.
+#
+
+top_srcdir = ../..
+test_objs = host.o mpu1.task_eo mpu2.task_eo
+
+include $(top_srcdir)/scripts/config.mk
+include $(top_srcdir)/scripts/rules_item.mk
diff --git a/tests/TFP/TFP_4B_006/host.c b/tests/TFP/TFP_4B_006/host.c
new file mode 100644
index 0000000..0de04c9
--- /dev/null
+++ b/tests/TFP/TFP_4B_006/host.c
@@ -0,0 +1,121 @@
+/*
+ * Copyright 2008 Sony Corporation
+ *
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a copy
+ * of this software and associated documentation files (the "Software"), to deal
+ * in the Software without restriction, including without limitation the rights
+ * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+ * copies of the Software, and to permit persons to whom the Software is
+ * furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included in
+ * all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+ * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+ * THE SOFTWARE.
+ */
+
+#include <unistd.h>
+#include <mars/mars.h>
+#include <libspe2.h>
+#include <mars_test.h>
+
+struct queue_entry {
+ uint64_t val1;
+ uint64_t val2;
+};
+#define Q_DEPTH (256 * 1024)
+
+#define NUM_LOOP 2
+static uint32_t depth_size[] =
+{
+ 1,
+ Q_DEPTH
+};
+extern spe_program_handle_t mpu1_prog;
+extern spe_program_handle_t mpu2_prog;
+
+static struct mars_context *mars_ctx;
+static struct mars_task_args task1_args, task2_args;
+static struct mars_task_id task1_id, task2_id;
+
+static uint64_t mpu_to_mpu[NUM_LOOP];
+
+static uint32_t shared_resource __attribute((aligned(16)));
+
+int main(void)
+{
+ int ret, i;
+ int32_t exit_code;
+
+ ret = mars_context_create(&mars_ctx, 0, 0);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+
+ for (i = 0; i < NUM_LOOP; i++) {
+ shared_resource = 0;
+
+ ret = mars_task_queue_create(
+ mars_ctx,
+ &mpu_to_mpu[i],
+ sizeof(struct queue_entry),
+ depth_size[i],
+ MARS_TASK_QUEUE_MPU_TO_MPU);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+
+ /* create pop task */
+ ret = mars_task_create(mars_ctx, &task1_id, NULL,
+ mpu1_prog.elf_image, MARS_TASK_CONTEXT_SAVE_ALL);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+
+ task1_args.type.u64[0] = mpu_to_mpu[i];
+ task1_args.type.u64[1] = mars_ptr_to_ea(&shared_resource);
+ task1_args.type.u64[2] = (uint64_t)i;
+ ret = mars_task_schedule(&task1_id, &task1_args, 0);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+
+ /* create push task */
+ ret = mars_task_create(mars_ctx, &task2_id, NULL,
+ mpu2_prog.elf_image, MARS_TASK_CONTEXT_SAVE_ALL);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+
+ /* check if queue pop is blocked in mpu task */
+ sleep(1);
+ MARS_TEST_ASSERT_EQUAL(shared_resource, 0);
+
+ /* push one by mpu */
+ task2_args.type.u64[0] = mpu_to_mpu[i];
+ task2_args.type.u64[1] = (uint64_t)i;
+ ret = mars_task_schedule(&task2_id, &task2_args, 0);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+
+ ret = mars_task_wait(&task2_id, &exit_code);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+ MARS_TEST_ASSERT_ERROR(exit_code, MARS_SUCCESS);
+
+ /* check if pop task is successfly finished */
+ ret = mars_task_wait(&task1_id, &exit_code);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+ MARS_TEST_ASSERT_ERROR(exit_code, MARS_SUCCESS);
+
+ ret = mars_task_destroy(&task1_id);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+
+ ret = mars_task_destroy(&task2_id);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+
+ ret = mars_task_queue_destroy(mpu_to_mpu[i]);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+ }
+
+ ret = mars_context_destroy(mars_ctx);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+
+ return 0;
+}
+
diff --git a/tests/TFP/TFP_4B_006/mpu1.c b/tests/TFP/TFP_4B_006/mpu1.c
new file mode 100644
index 0000000..bcec72b
--- /dev/null
+++ b/tests/TFP/TFP_4B_006/mpu1.c
@@ -0,0 +1,58 @@
+/*
+ * Copyright 2008 Sony Corporation
+ *
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a copy
+ * of this software and associated documentation files (the "Software"), to deal
+ * in the Software without restriction, including without limitation the rights
+ * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+ * copies of the Software, and to permit persons to whom the Software is
+ * furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included in
+ * all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+ * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+ * THE SOFTWARE.
+ */
+
+#include <mars/mars.h>
+#include <mars_task_test.h>
+#include <spu_mfcio.h>
+
+struct queue_entry {
+ uint64_t val;
+ uint64_t pad;
+};
+static struct queue_entry data;
+static uint32_t shared_resource __attribute((aligned(16)));
+
+int mars_task_main(const struct mars_task_args *task_args)
+{
+ int ret;
+ uint64_t mpu_to_mpu_ea = task_args->type.u64[0];
+ uint64_t shared_resource_ea = task_args->type.u64[1];
+ uint64_t val = task_args->type.u64[2];
+
+ ret = mars_task_queue_pop_begin(mpu_to_mpu_ea, &data, 1);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+
+ ret = mars_task_queue_pop_end(mpu_to_mpu_ea, 1);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+
+ MARS_TEST_ASSERT_EQUAL(data.val, val);
+
+ /* if the program reaches here, shared_resource'll be updated */
+ shared_resource = 1;
+ mfc_put(&shared_resource, shared_resource_ea,
+ sizeof(uint32_t), 0, 0, 0);
+ mfc_write_tag_mask(1 << 0);
+ mfc_read_tag_status_all();
+
+ return 0;
+}
diff --git a/tests/TFP/TFP_4B_006/mpu2.c b/tests/TFP/TFP_4B_006/mpu2.c
new file mode 100644
index 0000000..d8e04bc
--- /dev/null
+++ b/tests/TFP/TFP_4B_006/mpu2.c
@@ -0,0 +1,48 @@
+/*
+ * Copyright 2008 Sony Corporation
+ *
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a copy
+ * of this software and associated documentation files (the "Software"), to deal
+ * in the Software without restriction, including without limitation the rights
+ * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+ * copies of the Software, and to permit persons to whom the Software is
+ * furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included in
+ * all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+ * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+ * THE SOFTWARE.
+ */
+
+#include <mars/mars.h>
+#include <mars_task_test.h>
+#include <spu_mfcio.h>
+
+struct queue_entry {
+ uint64_t val1;
+ uint64_t val2;
+};
+static struct queue_entry data;
+
+int mars_task_main(const struct mars_task_args *task_args)
+{
+ int ret;
+ uint64_t mpu_to_mpu_ea = task_args->type.u64[0];
+ uint64_t val = task_args->type.u64[1];
+
+ data.val1 = val;
+ ret = mars_task_queue_push_begin(mpu_to_mpu_ea, &data, 1);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+
+ ret = mars_task_queue_push_end(mpu_to_mpu_ea, 1);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+
+ return 0;
+}
diff --git a/tests/TFP/TFP_4B_007/Makefile b/tests/TFP/TFP_4B_007/Makefile
new file mode 100644
index 0000000..432135a
--- /dev/null
+++ b/tests/TFP/TFP_4B_007/Makefile
@@ -0,0 +1,28 @@
+#
+# Copyright 2008 Sony Corporation
+#
+#
+# Permission is hereby granted, free of charge, to any person obtaining a copy
+# of this software and associated documentation files (the "Software"), to deal
+# in the Software without restriction, including without limitation the rights
+# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+# copies of the Software, and to permit persons to whom the Software is
+# furnished to do so, subject to the following conditions:
+#
+# The above copyright notice and this permission notice shall be included in
+# all copies or substantial portions of the Software.
+#
+# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+# THE SOFTWARE.
+#
+
+top_srcdir = ../..
+test_objs = host.o mpu.task_eo
+
+include $(top_srcdir)/scripts/config.mk
+include $(top_srcdir)/scripts/rules_item.mk
diff --git a/tests/TFP/TFP_4B_007/host.c b/tests/TFP/TFP_4B_007/host.c
new file mode 100644
index 0000000..4e04577
--- /dev/null
+++ b/tests/TFP/TFP_4B_007/host.c
@@ -0,0 +1,108 @@
+/*
+ * Copyright 2008 Sony Corporation
+ *
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a copy
+ * of this software and associated documentation files (the "Software"), to deal
+ * in the Software without restriction, including without limitation the rights
+ * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+ * copies of the Software, and to permit persons to whom the Software is
+ * furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included in
+ * all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+ * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+ * THE SOFTWARE.
+ */
+
+#include <unistd.h>
+#include <mars/mars.h>
+#include <libspe2.h>
+#include <mars_test.h>
+
+struct queue_entry {
+ uint64_t val;
+ uint64_t pad;
+};
+#define Q_DEPTH (256 * 1024)
+
+#define NUM_LOOP 2
+static uint32_t depth_size[] =
+{
+ 1,
+ Q_DEPTH
+};
+extern spe_program_handle_t mpu_prog;
+
+static struct mars_context *mars_ctx;
+static struct mars_task_args task_args;
+static struct mars_task_id task_id;
+
+static uint64_t host_to_mpu[NUM_LOOP];
+static struct queue_entry data;
+
+static uint32_t shared_resource __attribute((aligned(16)));
+
+int main(void)
+{
+ int ret, i;
+ int32_t exit_code;
+
+ ret = mars_context_create(&mars_ctx, 0, 0);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+
+ for (i = 0; i < NUM_LOOP; i++) {
+ shared_resource = 0;
+
+ ret = mars_task_queue_create(
+ mars_ctx,
+ &host_to_mpu[i],
+ sizeof(struct queue_entry),
+ depth_size[i],
+ MARS_TASK_QUEUE_HOST_TO_MPU);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+
+ /* create pop task */
+ ret = mars_task_create(mars_ctx, &task_id, NULL,
+ mpu_prog.elf_image, MARS_TASK_CONTEXT_SAVE_ALL);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+
+ task_args.type.u64[0] = host_to_mpu[i];
+ task_args.type.u64[1] = mars_ptr_to_ea(&shared_resource);
+ task_args.type.u64[2] = (uint64_t)i;
+ ret = mars_task_schedule(&task_id, &task_args, 0);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+
+ /* check if queue pop is blocked in mpu task */
+ sleep(1);
+ MARS_TEST_ASSERT_EQUAL(shared_resource, 0);
+
+ /* try push one */
+ data.val = i;
+ ret = mars_task_queue_try_push(host_to_mpu[i], &data);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+
+ /* check if mpu task is successfly finished */
+ ret = mars_task_wait(&task_id, &exit_code);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+ MARS_TEST_ASSERT_ERROR(exit_code, MARS_SUCCESS);
+
+ ret = mars_task_destroy(&task_id);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+
+ ret = mars_task_queue_destroy(host_to_mpu[i]);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+ }
+
+ ret = mars_context_destroy(mars_ctx);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+
+ return 0;
+}
+
diff --git a/tests/TFP/TFP_4B_007/mpu.c b/tests/TFP/TFP_4B_007/mpu.c
new file mode 100644
index 0000000..93122b5
--- /dev/null
+++ b/tests/TFP/TFP_4B_007/mpu.c
@@ -0,0 +1,58 @@
+/*
+ * Copyright 2008 Sony Corporation
+ *
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a copy
+ * of this software and associated documentation files (the "Software"), to deal
+ * in the Software without restriction, including without limitation the rights
+ * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+ * copies of the Software, and to permit persons to whom the Software is
+ * furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included in
+ * all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+ * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+ * THE SOFTWARE.
+ */
+
+#include <mars/mars.h>
+#include <mars_task_test.h>
+#include <spu_mfcio.h>
+
+struct queue_entry {
+ uint64_t val;
+ uint64_t pad;
+};
+static struct queue_entry data;
+static uint32_t shared_resource __attribute((aligned(16)));
+
+int mars_task_main(const struct mars_task_args *task_args)
+{
+ int ret;
+ uint64_t host_to_mpu_ea = task_args->type.u64[0];
+ uint64_t shared_resource_ea = task_args->type.u64[1];
+ uint64_t val = task_args->type.u64[2];
+
+ ret = mars_task_queue_pop_begin(host_to_mpu_ea, &data, 1);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+
+ ret = mars_task_queue_pop_end(host_to_mpu_ea, 1);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+
+ MARS_TEST_ASSERT_EQUAL(data.val, val);
+
+ /* if the program reaches here, shared_resource'll be updated */
+ shared_resource = 1;
+ mfc_put(&shared_resource, shared_resource_ea,
+ sizeof(uint32_t), 0, 0, 0);
+ mfc_write_tag_mask(1 << 0);
+ mfc_read_tag_status_all();
+
+ return 0;
+}
diff --git a/tests/TFP/TFP_4B_008/Makefile b/tests/TFP/TFP_4B_008/Makefile
new file mode 100644
index 0000000..ecbce33
--- /dev/null
+++ b/tests/TFP/TFP_4B_008/Makefile
@@ -0,0 +1,28 @@
+#
+# Copyright 2008 Sony Corporation
+#
+#
+# Permission is hereby granted, free of charge, to any person obtaining a copy
+# of this software and associated documentation files (the "Software"), to deal
+# in the Software without restriction, including without limitation the rights
+# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+# copies of the Software, and to permit persons to whom the Software is
+# furnished to do so, subject to the following conditions:
+#
+# The above copyright notice and this permission notice shall be included in
+# all copies or substantial portions of the Software.
+#
+# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+# THE SOFTWARE.
+#
+
+top_srcdir = ../..
+test_objs = host.o mpu1.task_eo mpu2.task_eo
+
+include $(top_srcdir)/scripts/config.mk
+include $(top_srcdir)/scripts/rules_item.mk
diff --git a/tests/TFP/TFP_4B_008/host.c b/tests/TFP/TFP_4B_008/host.c
new file mode 100644
index 0000000..0de04c9
--- /dev/null
+++ b/tests/TFP/TFP_4B_008/host.c
@@ -0,0 +1,121 @@
+/*
+ * Copyright 2008 Sony Corporation
+ *
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a copy
+ * of this software and associated documentation files (the "Software"), to deal
+ * in the Software without restriction, including without limitation the rights
+ * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+ * copies of the Software, and to permit persons to whom the Software is
+ * furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included in
+ * all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+ * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+ * THE SOFTWARE.
+ */
+
+#include <unistd.h>
+#include <mars/mars.h>
+#include <libspe2.h>
+#include <mars_test.h>
+
+struct queue_entry {
+ uint64_t val1;
+ uint64_t val2;
+};
+#define Q_DEPTH (256 * 1024)
+
+#define NUM_LOOP 2
+static uint32_t depth_size[] =
+{
+ 1,
+ Q_DEPTH
+};
+extern spe_program_handle_t mpu1_prog;
+extern spe_program_handle_t mpu2_prog;
+
+static struct mars_context *mars_ctx;
+static struct mars_task_args task1_args, task2_args;
+static struct mars_task_id task1_id, task2_id;
+
+static uint64_t mpu_to_mpu[NUM_LOOP];
+
+static uint32_t shared_resource __attribute((aligned(16)));
+
+int main(void)
+{
+ int ret, i;
+ int32_t exit_code;
+
+ ret = mars_context_create(&mars_ctx, 0, 0);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+
+ for (i = 0; i < NUM_LOOP; i++) {
+ shared_resource = 0;
+
+ ret = mars_task_queue_create(
+ mars_ctx,
+ &mpu_to_mpu[i],
+ sizeof(struct queue_entry),
+ depth_size[i],
+ MARS_TASK_QUEUE_MPU_TO_MPU);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+
+ /* create pop task */
+ ret = mars_task_create(mars_ctx, &task1_id, NULL,
+ mpu1_prog.elf_image, MARS_TASK_CONTEXT_SAVE_ALL);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+
+ task1_args.type.u64[0] = mpu_to_mpu[i];
+ task1_args.type.u64[1] = mars_ptr_to_ea(&shared_resource);
+ task1_args.type.u64[2] = (uint64_t)i;
+ ret = mars_task_schedule(&task1_id, &task1_args, 0);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+
+ /* create push task */
+ ret = mars_task_create(mars_ctx, &task2_id, NULL,
+ mpu2_prog.elf_image, MARS_TASK_CONTEXT_SAVE_ALL);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+
+ /* check if queue pop is blocked in mpu task */
+ sleep(1);
+ MARS_TEST_ASSERT_EQUAL(shared_resource, 0);
+
+ /* push one by mpu */
+ task2_args.type.u64[0] = mpu_to_mpu[i];
+ task2_args.type.u64[1] = (uint64_t)i;
+ ret = mars_task_schedule(&task2_id, &task2_args, 0);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+
+ ret = mars_task_wait(&task2_id, &exit_code);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+ MARS_TEST_ASSERT_ERROR(exit_code, MARS_SUCCESS);
+
+ /* check if pop task is successfly finished */
+ ret = mars_task_wait(&task1_id, &exit_code);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+ MARS_TEST_ASSERT_ERROR(exit_code, MARS_SUCCESS);
+
+ ret = mars_task_destroy(&task1_id);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+
+ ret = mars_task_destroy(&task2_id);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+
+ ret = mars_task_queue_destroy(mpu_to_mpu[i]);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+ }
+
+ ret = mars_context_destroy(mars_ctx);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+
+ return 0;
+}
+
diff --git a/tests/TFP/TFP_4B_008/mpu1.c b/tests/TFP/TFP_4B_008/mpu1.c
new file mode 100644
index 0000000..bcec72b
--- /dev/null
+++ b/tests/TFP/TFP_4B_008/mpu1.c
@@ -0,0 +1,58 @@
+/*
+ * Copyright 2008 Sony Corporation
+ *
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a copy
+ * of this software and associated documentation files (the "Software"), to deal
+ * in the Software without restriction, including without limitation the rights
+ * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+ * copies of the Software, and to permit persons to whom the Software is
+ * furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included in
+ * all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+ * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+ * THE SOFTWARE.
+ */
+
+#include <mars/mars.h>
+#include <mars_task_test.h>
+#include <spu_mfcio.h>
+
+struct queue_entry {
+ uint64_t val;
+ uint64_t pad;
+};
+static struct queue_entry data;
+static uint32_t shared_resource __attribute((aligned(16)));
+
+int mars_task_main(const struct mars_task_args *task_args)
+{
+ int ret;
+ uint64_t mpu_to_mpu_ea = task_args->type.u64[0];
+ uint64_t shared_resource_ea = task_args->type.u64[1];
+ uint64_t val = task_args->type.u64[2];
+
+ ret = mars_task_queue_pop_begin(mpu_to_mpu_ea, &data, 1);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+
+ ret = mars_task_queue_pop_end(mpu_to_mpu_ea, 1);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+
+ MARS_TEST_ASSERT_EQUAL(data.val, val);
+
+ /* if the program reaches here, shared_resource'll be updated */
+ shared_resource = 1;
+ mfc_put(&shared_resource, shared_resource_ea,
+ sizeof(uint32_t), 0, 0, 0);
+ mfc_write_tag_mask(1 << 0);
+ mfc_read_tag_status_all();
+
+ return 0;
+}
diff --git a/tests/TFP/TFP_4B_008/mpu2.c b/tests/TFP/TFP_4B_008/mpu2.c
new file mode 100644
index 0000000..2e84740
--- /dev/null
+++ b/tests/TFP/TFP_4B_008/mpu2.c
@@ -0,0 +1,45 @@
+/*
+ * Copyright 2008 Sony Corporation
+ *
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a copy
+ * of this software and associated documentation files (the "Software"), to deal
+ * in the Software without restriction, including without limitation the rights
+ * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+ * copies of the Software, and to permit persons to whom the Software is
+ * furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included in
+ * all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+ * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+ * THE SOFTWARE.
+ */
+
+#include <mars/mars.h>
+#include <mars_task_test.h>
+#include <spu_mfcio.h>
+
+struct queue_entry {
+ uint64_t val1;
+ uint64_t val2;
+};
+static struct queue_entry data;
+
+int mars_task_main(const struct mars_task_args *task_args)
+{
+ int ret;
+ uint64_t mpu_to_mpu_ea = task_args->type.u64[0];
+ uint64_t val = task_args->type.u64[1];
+
+ data.val1 = val;
+ ret = mars_task_queue_try_push(mpu_to_mpu_ea, &data);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+
+ return 0;
+}
diff --git a/tests/TFP/TFP_4B_009/Makefile b/tests/TFP/TFP_4B_009/Makefile
new file mode 100644
index 0000000..ecbce33
--- /dev/null
+++ b/tests/TFP/TFP_4B_009/Makefile
@@ -0,0 +1,28 @@
+#
+# Copyright 2008 Sony Corporation
+#
+#
+# Permission is hereby granted, free of charge, to any person obtaining a copy
+# of this software and associated documentation files (the "Software"), to deal
+# in the Software without restriction, including without limitation the rights
+# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+# copies of the Software, and to permit persons to whom the Software is
+# furnished to do so, subject to the following conditions:
+#
+# The above copyright notice and this permission notice shall be included in
+# all copies or substantial portions of the Software.
+#
+# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+# THE SOFTWARE.
+#
+
+top_srcdir = ../..
+test_objs = host.o mpu1.task_eo mpu2.task_eo
+
+include $(top_srcdir)/scripts/config.mk
+include $(top_srcdir)/scripts/rules_item.mk
diff --git a/tests/TFP/TFP_4B_009/host.c b/tests/TFP/TFP_4B_009/host.c
new file mode 100644
index 0000000..0de04c9
--- /dev/null
+++ b/tests/TFP/TFP_4B_009/host.c
@@ -0,0 +1,121 @@
+/*
+ * Copyright 2008 Sony Corporation
+ *
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a copy
+ * of this software and associated documentation files (the "Software"), to deal
+ * in the Software without restriction, including without limitation the rights
+ * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+ * copies of the Software, and to permit persons to whom the Software is
+ * furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included in
+ * all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+ * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+ * THE SOFTWARE.
+ */
+
+#include <unistd.h>
+#include <mars/mars.h>
+#include <libspe2.h>
+#include <mars_test.h>
+
+struct queue_entry {
+ uint64_t val1;
+ uint64_t val2;
+};
+#define Q_DEPTH (256 * 1024)
+
+#define NUM_LOOP 2
+static uint32_t depth_size[] =
+{
+ 1,
+ Q_DEPTH
+};
+extern spe_program_handle_t mpu1_prog;
+extern spe_program_handle_t mpu2_prog;
+
+static struct mars_context *mars_ctx;
+static struct mars_task_args task1_args, task2_args;
+static struct mars_task_id task1_id, task2_id;
+
+static uint64_t mpu_to_mpu[NUM_LOOP];
+
+static uint32_t shared_resource __attribute((aligned(16)));
+
+int main(void)
+{
+ int ret, i;
+ int32_t exit_code;
+
+ ret = mars_context_create(&mars_ctx, 0, 0);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+
+ for (i = 0; i < NUM_LOOP; i++) {
+ shared_resource = 0;
+
+ ret = mars_task_queue_create(
+ mars_ctx,
+ &mpu_to_mpu[i],
+ sizeof(struct queue_entry),
+ depth_size[i],
+ MARS_TASK_QUEUE_MPU_TO_MPU);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+
+ /* create pop task */
+ ret = mars_task_create(mars_ctx, &task1_id, NULL,
+ mpu1_prog.elf_image, MARS_TASK_CONTEXT_SAVE_ALL);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+
+ task1_args.type.u64[0] = mpu_to_mpu[i];
+ task1_args.type.u64[1] = mars_ptr_to_ea(&shared_resource);
+ task1_args.type.u64[2] = (uint64_t)i;
+ ret = mars_task_schedule(&task1_id, &task1_args, 0);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+
+ /* create push task */
+ ret = mars_task_create(mars_ctx, &task2_id, NULL,
+ mpu2_prog.elf_image, MARS_TASK_CONTEXT_SAVE_ALL);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+
+ /* check if queue pop is blocked in mpu task */
+ sleep(1);
+ MARS_TEST_ASSERT_EQUAL(shared_resource, 0);
+
+ /* push one by mpu */
+ task2_args.type.u64[0] = mpu_to_mpu[i];
+ task2_args.type.u64[1] = (uint64_t)i;
+ ret = mars_task_schedule(&task2_id, &task2_args, 0);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+
+ ret = mars_task_wait(&task2_id, &exit_code);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+ MARS_TEST_ASSERT_ERROR(exit_code, MARS_SUCCESS);
+
+ /* check if pop task is successfly finished */
+ ret = mars_task_wait(&task1_id, &exit_code);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+ MARS_TEST_ASSERT_ERROR(exit_code, MARS_SUCCESS);
+
+ ret = mars_task_destroy(&task1_id);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+
+ ret = mars_task_destroy(&task2_id);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+
+ ret = mars_task_queue_destroy(mpu_to_mpu[i]);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+ }
+
+ ret = mars_context_destroy(mars_ctx);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+
+ return 0;
+}
+
diff --git a/tests/TFP/TFP_4B_009/mpu1.c b/tests/TFP/TFP_4B_009/mpu1.c
new file mode 100644
index 0000000..bcec72b
--- /dev/null
+++ b/tests/TFP/TFP_4B_009/mpu1.c
@@ -0,0 +1,58 @@
+/*
+ * Copyright 2008 Sony Corporation
+ *
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a copy
+ * of this software and associated documentation files (the "Software"), to deal
+ * in the Software without restriction, including without limitation the rights
+ * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+ * copies of the Software, and to permit persons to whom the Software is
+ * furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included in
+ * all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+ * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+ * THE SOFTWARE.
+ */
+
+#include <mars/mars.h>
+#include <mars_task_test.h>
+#include <spu_mfcio.h>
+
+struct queue_entry {
+ uint64_t val;
+ uint64_t pad;
+};
+static struct queue_entry data;
+static uint32_t shared_resource __attribute((aligned(16)));
+
+int mars_task_main(const struct mars_task_args *task_args)
+{
+ int ret;
+ uint64_t mpu_to_mpu_ea = task_args->type.u64[0];
+ uint64_t shared_resource_ea = task_args->type.u64[1];
+ uint64_t val = task_args->type.u64[2];
+
+ ret = mars_task_queue_pop_begin(mpu_to_mpu_ea, &data, 1);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+
+ ret = mars_task_queue_pop_end(mpu_to_mpu_ea, 1);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+
+ MARS_TEST_ASSERT_EQUAL(data.val, val);
+
+ /* if the program reaches here, shared_resource'll be updated */
+ shared_resource = 1;
+ mfc_put(&shared_resource, shared_resource_ea,
+ sizeof(uint32_t), 0, 0, 0);
+ mfc_write_tag_mask(1 << 0);
+ mfc_read_tag_status_all();
+
+ return 0;
+}
diff --git a/tests/TFP/TFP_4B_009/mpu2.c b/tests/TFP/TFP_4B_009/mpu2.c
new file mode 100644
index 0000000..2e2124b
--- /dev/null
+++ b/tests/TFP/TFP_4B_009/mpu2.c
@@ -0,0 +1,48 @@
+/*
+ * Copyright 2008 Sony Corporation
+ *
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a copy
+ * of this software and associated documentation files (the "Software"), to deal
+ * in the Software without restriction, including without limitation the rights
+ * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+ * copies of the Software, and to permit persons to whom the Software is
+ * furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included in
+ * all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+ * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+ * THE SOFTWARE.
+ */
+
+#include <mars/mars.h>
+#include <mars_task_test.h>
+#include <spu_mfcio.h>
+
+struct queue_entry {
+ uint64_t val1;
+ uint64_t val2;
+};
+static struct queue_entry data;
+
+int mars_task_main(const struct mars_task_args *task_args)
+{
+ int ret;
+ uint64_t mpu_to_mpu_ea = task_args->type.u64[0];
+ uint64_t val = task_args->type.u64[1];
+
+ data.val1 = val;
+ ret = mars_task_queue_try_push_begin(mpu_to_mpu_ea, &data, 1);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+
+ ret = mars_task_queue_push_end(mpu_to_mpu_ea, 1);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+
+ return 0;
+}
diff --git a/tests/TFP/TFP_4C_001/Makefile b/tests/TFP/TFP_4C_001/Makefile
new file mode 100644
index 0000000..ecbce33
--- /dev/null
+++ b/tests/TFP/TFP_4C_001/Makefile
@@ -0,0 +1,28 @@
+#
+# Copyright 2008 Sony Corporation
+#
+#
+# Permission is hereby granted, free of charge, to any person obtaining a copy
+# of this software and associated documentation files (the "Software"), to deal
+# in the Software without restriction, including without limitation the rights
+# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+# copies of the Software, and to permit persons to whom the Software is
+# furnished to do so, subject to the following conditions:
+#
+# The above copyright notice and this permission notice shall be included in
+# all copies or substantial portions of the Software.
+#
+# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+# THE SOFTWARE.
+#
+
+top_srcdir = ../..
+test_objs = host.o mpu1.task_eo mpu2.task_eo
+
+include $(top_srcdir)/scripts/config.mk
+include $(top_srcdir)/scripts/rules_item.mk
diff --git a/tests/TFP/TFP_4C_001/host.c b/tests/TFP/TFP_4C_001/host.c
new file mode 100644
index 0000000..94a67db
--- /dev/null
+++ b/tests/TFP/TFP_4C_001/host.c
@@ -0,0 +1,151 @@
+/*
+ * Copyright 2008 Sony Corporation
+ *
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a copy
+ * of this software and associated documentation files (the "Software"), to deal
+ * in the Software without restriction, including without limitation the rights
+ * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+ * copies of the Software, and to permit persons to whom the Software is
+ * furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included in
+ * all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+ * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+ * THE SOFTWARE.
+ */
+
+#include <unistd.h>
+#include <mars/mars.h>
+#include <libspe2.h>
+#include <mars_test.h>
+
+struct queue_entry {
+ uint64_t val1;
+ uint64_t val2;
+};
+#define Q_DEPTH (MARS_TASK_QUEUE_WAIT_MAX)
+
+#define TEST_DIFF 1
+
+#define NUM_LOOP 5
+static uint32_t depth_size[] =
+{
+ 1,
+ Q_DEPTH / 2,
+ Q_DEPTH,
+ Q_DEPTH,
+ Q_DEPTH
+};
+extern spe_program_handle_t mpu1_prog;
+extern spe_program_handle_t mpu2_prog;
+
+static struct mars_context *mars_ctx;
+static struct mars_task_args task1_args, task2_args;
+static struct mars_task_id task1_id[Q_DEPTH], task2_id;
+
+static uint64_t mpu_to_mpu[NUM_LOOP];
+static uint32_t notify[32] __attribute((aligned(128)));
+
+
+static void queue_push(uint64_t id)
+{
+ int ret;
+ int32_t exit_code;
+
+ /* create push task */
+ ret = mars_task_create(mars_ctx, &task2_id, NULL,
+ mpu2_prog.elf_image,
+ MARS_TASK_CONTEXT_SAVE_ALL);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+
+ task2_args.type.u64[0] = mpu_to_mpu[id];
+ task2_args.type.u64[1] = (uint64_t) depth_size[id];
+ ret = mars_task_schedule(&task2_id, &task2_args, 0);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+
+ ret = mars_task_wait(&task2_id, &exit_code);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+ MARS_TEST_ASSERT_ERROR(exit_code, MARS_SUCCESS);
+
+ ret = mars_task_destroy(&task2_id);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+}
+
+int main(void)
+{
+ int ret, i;
+ int32_t exit_code, chk_exit;
+ uint32_t num;
+ uint32_t chk_bit, count;
+
+ ret = mars_context_create(&mars_ctx, 0, 0);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+
+ for (i = 0; i < NUM_LOOP; i++) {
+ notify[0] = 0;
+ chk_bit = 0;
+
+ ret = mars_task_queue_create(
+ mars_ctx,
+ &mpu_to_mpu[i],
+ sizeof(struct queue_entry),
+ depth_size[i],
+ MARS_TASK_QUEUE_MPU_TO_MPU);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+
+ queue_push(i);
+
+ /* create pop task */
+ for (num = 0; num < depth_size[i]; num++) {
+ chk_bit += (1 << num);
+
+ /* create pop task */
+ ret = mars_task_create(mars_ctx, &task1_id[num], NULL,
+ mpu1_prog.elf_image, MARS_TASK_CONTEXT_SAVE_ALL);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+
+ task1_args.type.u64[0] = mpu_to_mpu[i];
+ task1_args.type.u64[1] =
+ mars_ptr_to_ea(&notify);
+ ret = mars_task_schedule(&task1_id[num],
+ &task1_args, 0);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+ }
+
+ /* start pop tasks at the same time */
+ sleep(1);
+ mars_test_counter_set(&notify[0], 1);
+
+ chk_exit = 0;
+ for (num = 0; num < depth_size[i]; num++) {
+ ret = mars_task_wait(&task1_id[num], &exit_code);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+ chk_exit |= exit_code;
+
+ ret = mars_task_destroy(&task1_id[num]);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+ }
+ MARS_TEST_ASSERT_EQUAL((uint32_t)chk_exit, chk_bit);
+
+ /* check queue count */
+ ret = mars_task_queue_count(mpu_to_mpu[i], &count);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+ MARS_TEST_ASSERT_EQUAL(count, 0);
+
+ ret = mars_task_queue_destroy(mpu_to_mpu[i]);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+ }
+
+ ret = mars_context_destroy(mars_ctx);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+
+ return 0;
+}
+
diff --git a/tests/TFP/TFP_4C_001/mpu1.c b/tests/TFP/TFP_4C_001/mpu1.c
new file mode 100644
index 0000000..4d998ed
--- /dev/null
+++ b/tests/TFP/TFP_4C_001/mpu1.c
@@ -0,0 +1,57 @@
+/*
+ * Copyright 2008 Sony Corporation
+ *
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a copy
+ * of this software and associated documentation files (the "Software"), to deal
+ * in the Software without restriction, including without limitation the rights
+ * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+ * copies of the Software, and to permit persons to whom the Software is
+ * furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included in
+ * all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+ * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+ * THE SOFTWARE.
+ */
+
+#include <mars/mars.h>
+#include <mars_task_test.h>
+#include <spu_mfcio.h>
+
+#define TEST_DIFF 1
+struct queue_entry {
+ uint64_t val1;
+ uint64_t val2;
+};
+static struct queue_entry data;
+
+int mars_task_main(const struct mars_task_args *task_args)
+{
+ int ret;
+ uint64_t mpu_to_mpu_ea = task_args->type.u64[0];
+ uint64_t notify_ea = task_args->type.u64[1];
+ uint64_t val;
+
+ mars_test_counter_wait(notify_ea, 1);
+
+ ret = mars_task_queue_pop_begin(mpu_to_mpu_ea, &data, 1);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+
+ ret = mars_task_queue_pop_end(mpu_to_mpu_ea, 1);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+
+ /* check queue data */
+ val = data.val2 - data.val1;
+ MARS_TEST_ASSERT_EQUAL(val, TEST_DIFF);
+
+ mars_task_exit(1 << data.val1);
+
+ return 0;
+}
diff --git a/tests/TFP/TFP_4C_001/mpu2.c b/tests/TFP/TFP_4C_001/mpu2.c
new file mode 100644
index 0000000..c7d8751
--- /dev/null
+++ b/tests/TFP/TFP_4C_001/mpu2.c
@@ -0,0 +1,49 @@
+/*
+ * Copyright 2008 Sony Corporation
+ *
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a copy
+ * of this software and associated documentation files (the "Software"), to deal
+ * in the Software without restriction, including without limitation the rights
+ * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+ * copies of the Software, and to permit persons to whom the Software is
+ * furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included in
+ * all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+ * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+ * THE SOFTWARE.
+ */
+
+#include <mars/mars.h>
+#include <mars_task_test.h>
+
+#define TEST_DIFF 1
+struct queue_entry {
+ uint64_t val1;
+ uint64_t val2;
+};
+static struct queue_entry data;
+
+int mars_task_main(const struct mars_task_args *task_args)
+{
+ int ret, i;
+ uint64_t mpu_to_host_ea = task_args->type.u64[0];
+ uint32_t num = task_args->type.u64[1];
+
+ for (i = 0; i < num; i++) {
+ data.val1 = i;
+ data.val2 = i + TEST_DIFF;
+
+ ret = mars_task_queue_push(mpu_to_host_ea, &data);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+ }
+
+ return 0;
+}
diff --git a/tests/TFP/TFP_4D_001/Makefile b/tests/TFP/TFP_4D_001/Makefile
new file mode 100644
index 0000000..432135a
--- /dev/null
+++ b/tests/TFP/TFP_4D_001/Makefile
@@ -0,0 +1,28 @@
+#
+# Copyright 2008 Sony Corporation
+#
+#
+# Permission is hereby granted, free of charge, to any person obtaining a copy
+# of this software and associated documentation files (the "Software"), to deal
+# in the Software without restriction, including without limitation the rights
+# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+# copies of the Software, and to permit persons to whom the Software is
+# furnished to do so, subject to the following conditions:
+#
+# The above copyright notice and this permission notice shall be included in
+# all copies or substantial portions of the Software.
+#
+# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+# THE SOFTWARE.
+#
+
+top_srcdir = ../..
+test_objs = host.o mpu.task_eo
+
+include $(top_srcdir)/scripts/config.mk
+include $(top_srcdir)/scripts/rules_item.mk
diff --git a/tests/TFP/TFP_4D_001/host.c b/tests/TFP/TFP_4D_001/host.c
new file mode 100644
index 0000000..f2ce76b
--- /dev/null
+++ b/tests/TFP/TFP_4D_001/host.c
@@ -0,0 +1,90 @@
+/*
+ * Copyright 2008 Sony Corporation
+ *
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a copy
+ * of this software and associated documentation files (the "Software"), to deal
+ * in the Software without restriction, including without limitation the rights
+ * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+ * copies of the Software, and to permit persons to whom the Software is
+ * furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included in
+ * all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+ * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+ * THE SOFTWARE.
+ */
+
+#include <mars/mars.h>
+#include <libspe2.h>
+#include <mars_test.h>
+
+struct queue_entry {
+ uint64_t val;
+ uint64_t pad;
+};
+#define Q_DEPTH (256 * 1024)
+
+#define NUM_LOOP 3
+static uint32_t depth_size[] =
+{
+ 1,
+ Q_DEPTH / 2,
+ Q_DEPTH
+};
+extern spe_program_handle_t mpu_prog;
+
+static struct mars_context *mars_ctx;
+static struct mars_task_args task_args;
+static struct mars_task_id task_id;
+
+static uint64_t host_to_mpu[NUM_LOOP];
+
+int main(void)
+{
+ int ret, i;
+ int32_t exit_code;
+
+ ret = mars_context_create(&mars_ctx, 0, 0);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+
+ for (i = 0; i < NUM_LOOP; i++) {
+ ret = mars_task_queue_create(
+ mars_ctx,
+ &host_to_mpu[i],
+ sizeof(struct queue_entry),
+ depth_size[i],
+ MARS_TASK_QUEUE_HOST_TO_MPU);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+
+ ret = mars_task_create(mars_ctx, &task_id, NULL,
+ mpu_prog.elf_image, MARS_TASK_CONTEXT_SAVE_ALL);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+
+ task_args.type.u64[0] = host_to_mpu[i];
+ ret = mars_task_schedule(&task_id, &task_args, 0);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+
+ ret = mars_task_wait(&task_id, &exit_code);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+ MARS_TEST_ASSERT_ERROR(exit_code, MARS_SUCCESS);
+
+ ret = mars_task_destroy(&task_id);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+
+ ret = mars_task_queue_destroy(host_to_mpu[i]);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+ }
+
+ ret = mars_context_destroy(mars_ctx);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+
+ return 0;
+}
+
diff --git a/tests/TFP/TFP_4D_001/mpu.c b/tests/TFP/TFP_4D_001/mpu.c
new file mode 100644
index 0000000..5c1d7c2
--- /dev/null
+++ b/tests/TFP/TFP_4D_001/mpu.c
@@ -0,0 +1,42 @@
+/*
+ * Copyright 2008 Sony Corporation
+ *
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a copy
+ * of this software and associated documentation files (the "Software"), to deal
+ * in the Software without restriction, including without limitation the rights
+ * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+ * copies of the Software, and to permit persons to whom the Software is
+ * furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included in
+ * all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+ * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+ * THE SOFTWARE.
+ */
+
+#include <mars/mars.h>
+#include <mars_task_test.h>
+
+struct queue_entry {
+ uint64_t val;
+ uint64_t pad;
+};
+static struct queue_entry data;
+
+int mars_task_main(const struct mars_task_args *task_args)
+{
+ int ret;
+ uint64_t host_to_mpu_ea = task_args->type.u64[0];
+
+ ret = mars_task_queue_try_pop(host_to_mpu_ea, &data);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_ERROR_BUSY);
+
+ return 0;
+}
diff --git a/tests/TFP/TFP_4D_002/Makefile b/tests/TFP/TFP_4D_002/Makefile
new file mode 100644
index 0000000..432135a
--- /dev/null
+++ b/tests/TFP/TFP_4D_002/Makefile
@@ -0,0 +1,28 @@
+#
+# Copyright 2008 Sony Corporation
+#
+#
+# Permission is hereby granted, free of charge, to any person obtaining a copy
+# of this software and associated documentation files (the "Software"), to deal
+# in the Software without restriction, including without limitation the rights
+# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+# copies of the Software, and to permit persons to whom the Software is
+# furnished to do so, subject to the following conditions:
+#
+# The above copyright notice and this permission notice shall be included in
+# all copies or substantial portions of the Software.
+#
+# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+# THE SOFTWARE.
+#
+
+top_srcdir = ../..
+test_objs = host.o mpu.task_eo
+
+include $(top_srcdir)/scripts/config.mk
+include $(top_srcdir)/scripts/rules_item.mk
diff --git a/tests/TFP/TFP_4D_002/host.c b/tests/TFP/TFP_4D_002/host.c
new file mode 100644
index 0000000..b071942
--- /dev/null
+++ b/tests/TFP/TFP_4D_002/host.c
@@ -0,0 +1,95 @@
+/*
+ * Copyright 2008 Sony Corporation
+ *
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a copy
+ * of this software and associated documentation files (the "Software"), to deal
+ * in the Software without restriction, including without limitation the rights
+ * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+ * copies of the Software, and to permit persons to whom the Software is
+ * furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included in
+ * all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+ * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+ * THE SOFTWARE.
+ */
+
+#include <mars/mars.h>
+#include <libspe2.h>
+#include <mars_test.h>
+
+struct queue_entry {
+ uint64_t val;
+ uint64_t pad;
+};
+#define Q_DEPTH (256 * 1024)
+
+#define NUM_LOOP 3
+static uint32_t depth_size[] =
+{
+ 1,
+ Q_DEPTH / 2,
+ Q_DEPTH
+};
+extern spe_program_handle_t mpu_prog;
+
+static struct mars_context *mars_ctx;
+static struct mars_task_args task_args;
+static struct mars_task_id task_id;
+
+static uint64_t mpu_to_host[NUM_LOOP];
+static struct queue_entry data;
+
+int main(void)
+{
+ int ret, i;
+ int32_t exit_code;
+
+ ret = mars_context_create(&mars_ctx, 0, 0);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+
+ for (i = 0; i < NUM_LOOP; i++) {
+ ret = mars_task_queue_create(
+ mars_ctx,
+ &mpu_to_host[i],
+ sizeof(struct queue_entry),
+ depth_size[i],
+ MARS_TASK_QUEUE_MPU_TO_HOST);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+
+ ret = mars_task_queue_try_pop(mpu_to_host[i], &data);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_ERROR_BUSY);
+
+ /* dummy task */
+ ret = mars_task_create(mars_ctx, &task_id, NULL,
+ mpu_prog.elf_image, MARS_TASK_CONTEXT_SAVE_ALL);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+
+ task_args.type.u64[0] = mpu_to_host[i];
+ ret = mars_task_schedule(&task_id, &task_args, 0);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+
+ ret = mars_task_wait(&task_id, &exit_code);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+ MARS_TEST_ASSERT_ERROR(exit_code, MARS_SUCCESS);
+
+ ret = mars_task_destroy(&task_id);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+
+ ret = mars_task_queue_destroy(mpu_to_host[i]);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+ }
+
+ ret = mars_context_destroy(mars_ctx);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+
+ return 0;
+}
+
diff --git a/tests/TFP/TFP_4D_002/mpu.c b/tests/TFP/TFP_4D_002/mpu.c
new file mode 100644
index 0000000..0936c46
--- /dev/null
+++ b/tests/TFP/TFP_4D_002/mpu.c
@@ -0,0 +1,35 @@
+/*
+ * Copyright 2008 Sony Corporation
+ *
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a copy
+ * of this software and associated documentation files (the "Software"), to deal
+ * in the Software without restriction, including without limitation the rights
+ * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+ * copies of the Software, and to permit persons to whom the Software is
+ * furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included in
+ * all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+ * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+ * THE SOFTWARE.
+ */
+
+#include <mars/mars.h>
+#include <mars_task_test.h>
+
+struct queue_entry {
+ uint64_t val;
+ uint64_t pad;
+};
+
+int mars_task_main(const struct mars_task_args *task_args)
+{
+ return 0;
+}
diff --git a/tests/TFP/TFP_4D_003/Makefile b/tests/TFP/TFP_4D_003/Makefile
new file mode 100644
index 0000000..432135a
--- /dev/null
+++ b/tests/TFP/TFP_4D_003/Makefile
@@ -0,0 +1,28 @@
+#
+# Copyright 2008 Sony Corporation
+#
+#
+# Permission is hereby granted, free of charge, to any person obtaining a copy
+# of this software and associated documentation files (the "Software"), to deal
+# in the Software without restriction, including without limitation the rights
+# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+# copies of the Software, and to permit persons to whom the Software is
+# furnished to do so, subject to the following conditions:
+#
+# The above copyright notice and this permission notice shall be included in
+# all copies or substantial portions of the Software.
+#
+# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+# THE SOFTWARE.
+#
+
+top_srcdir = ../..
+test_objs = host.o mpu.task_eo
+
+include $(top_srcdir)/scripts/config.mk
+include $(top_srcdir)/scripts/rules_item.mk
diff --git a/tests/TFP/TFP_4D_003/host.c b/tests/TFP/TFP_4D_003/host.c
new file mode 100644
index 0000000..eb31956
--- /dev/null
+++ b/tests/TFP/TFP_4D_003/host.c
@@ -0,0 +1,89 @@
+/*
+ * Copyright 2008 Sony Corporation
+ *
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a copy
+ * of this software and associated documentation files (the "Software"), to deal
+ * in the Software without restriction, including without limitation the rights
+ * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+ * copies of the Software, and to permit persons to whom the Software is
+ * furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included in
+ * all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+ * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+ * THE SOFTWARE.
+ */
+
+#include <mars/mars.h>
+#include <libspe2.h>
+#include <mars_test.h>
+
+struct queue_entry {
+ uint64_t val;
+ uint64_t pad;
+};
+#define Q_DEPTH (256 * 1024)
+
+#define NUM_LOOP 2
+static uint32_t depth_size[] =
+{
+ 1,
+ Q_DEPTH
+};
+extern spe_program_handle_t mpu_prog;
+
+static struct mars_context *mars_ctx;
+static struct mars_task_args task_args;
+static struct mars_task_id task_id;
+
+static uint64_t mpu_to_mpu[NUM_LOOP];
+
+int main(void)
+{
+ int ret, i;
+ int32_t exit_code;
+
+ ret = mars_context_create(&mars_ctx, 0, 0);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+
+ for (i = 0; i < NUM_LOOP; i++) {
+ ret = mars_task_queue_create(
+ mars_ctx,
+ &mpu_to_mpu[i],
+ sizeof(struct queue_entry),
+ depth_size[i],
+ MARS_TASK_QUEUE_MPU_TO_MPU);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+
+ ret = mars_task_create(mars_ctx, &task_id, NULL,
+ mpu_prog.elf_image, MARS_TASK_CONTEXT_SAVE_ALL);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+
+ task_args.type.u64[0] = mpu_to_mpu[i];
+ ret = mars_task_schedule(&task_id, &task_args, 0);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+
+ ret = mars_task_wait(&task_id, &exit_code);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+ MARS_TEST_ASSERT_ERROR(exit_code, MARS_SUCCESS);
+
+ ret = mars_task_destroy(&task_id);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+
+ ret = mars_task_queue_destroy(mpu_to_mpu[i]);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+ }
+
+ ret = mars_context_destroy(mars_ctx);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+
+ return 0;
+}
+
diff --git a/tests/TFP/TFP_4D_003/mpu.c b/tests/TFP/TFP_4D_003/mpu.c
new file mode 100644
index 0000000..6be324a
--- /dev/null
+++ b/tests/TFP/TFP_4D_003/mpu.c
@@ -0,0 +1,42 @@
+/*
+ * Copyright 2008 Sony Corporation
+ *
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a copy
+ * of this software and associated documentation files (the "Software"), to deal
+ * in the Software without restriction, including without limitation the rights
+ * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+ * copies of the Software, and to permit persons to whom the Software is
+ * furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included in
+ * all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+ * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+ * THE SOFTWARE.
+ */
+
+#include <mars/mars.h>
+#include <mars_task_test.h>
+
+struct queue_entry {
+ uint64_t val;
+ uint64_t pad;
+};
+static struct queue_entry data;
+
+int mars_task_main(const struct mars_task_args *task_args)
+{
+ int ret;
+ uint64_t mpu_to_mpu_ea = task_args->type.u64[0];
+
+ ret = mars_task_queue_try_pop(mpu_to_mpu_ea, &data);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_ERROR_BUSY);
+
+ return 0;
+}
diff --git a/tests/TFP/TFP_4D_004/Makefile b/tests/TFP/TFP_4D_004/Makefile
new file mode 100644
index 0000000..432135a
--- /dev/null
+++ b/tests/TFP/TFP_4D_004/Makefile
@@ -0,0 +1,28 @@
+#
+# Copyright 2008 Sony Corporation
+#
+#
+# Permission is hereby granted, free of charge, to any person obtaining a copy
+# of this software and associated documentation files (the "Software"), to deal
+# in the Software without restriction, including without limitation the rights
+# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+# copies of the Software, and to permit persons to whom the Software is
+# furnished to do so, subject to the following conditions:
+#
+# The above copyright notice and this permission notice shall be included in
+# all copies or substantial portions of the Software.
+#
+# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+# THE SOFTWARE.
+#
+
+top_srcdir = ../..
+test_objs = host.o mpu.task_eo
+
+include $(top_srcdir)/scripts/config.mk
+include $(top_srcdir)/scripts/rules_item.mk
diff --git a/tests/TFP/TFP_4D_004/host.c b/tests/TFP/TFP_4D_004/host.c
new file mode 100644
index 0000000..fdf3de4
--- /dev/null
+++ b/tests/TFP/TFP_4D_004/host.c
@@ -0,0 +1,138 @@
+/*
+ * Copyright 2008 Sony Corporation
+ *
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a copy
+ * of this software and associated documentation files (the "Software"), to deal
+ * in the Software without restriction, including without limitation the rights
+ * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+ * copies of the Software, and to permit persons to whom the Software is
+ * furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included in
+ * all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+ * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+ * THE SOFTWARE.
+ */
+
+#include <unistd.h>
+#include <mars/mars.h>
+#include <libspe2.h>
+#include <mars_test.h>
+
+struct queue_entry {
+ uint64_t val1;
+ uint64_t val2;
+};
+#define Q_DEPTH (MARS_TASK_QUEUE_WAIT_MAX)
+
+#define TEST_DIFF 1
+
+#define NUM_LOOP 5
+static uint32_t depth_size[] =
+{
+ 1,
+ Q_DEPTH / 2,
+ Q_DEPTH,
+ Q_DEPTH,
+ Q_DEPTH
+};
+extern spe_program_handle_t mpu_prog;
+
+static struct mars_context *mars_ctx;
+static struct mars_task_args task_args;
+static struct mars_task_id task_id[Q_DEPTH];
+
+static uint64_t host_to_mpu[NUM_LOOP];
+static uint32_t notify[32] __attribute((aligned(128)));
+static struct queue_entry data;
+
+static void queue_push(uint64_t id, uint64_t count)
+{
+ int ret, i;
+
+ for (i = 0; i < count; i++) {
+ data.val1 = i;
+ data.val2 = i + TEST_DIFF;
+ ret = mars_task_queue_push(host_to_mpu[id], &data);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+ }
+}
+
+int main(void)
+{
+ int ret, i;
+ int32_t exit_code, chk_exit;
+ uint32_t num;
+ uint32_t chk_bit, count;
+
+ ret = mars_context_create(&mars_ctx, 0, 0);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+
+ for (i = 0; i < NUM_LOOP; i++) {
+ notify[0] = 0;
+ chk_bit = 0;
+
+ ret = mars_task_queue_create(
+ mars_ctx,
+ &host_to_mpu[i],
+ sizeof(struct queue_entry),
+ depth_size[i],
+ MARS_TASK_QUEUE_HOST_TO_MPU);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+
+ queue_push(i, depth_size[i]);
+
+ /* create pop task */
+ for (num = 0; num < depth_size[i]; num++) {
+ chk_bit += (1 << num);
+
+ /* create pop task */
+ ret = mars_task_create(mars_ctx, &task_id[num], NULL,
+ mpu_prog.elf_image, MARS_TASK_CONTEXT_SAVE_ALL);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+
+ task_args.type.u64[0] = host_to_mpu[i];
+ task_args.type.u64[1] =
+ mars_ptr_to_ea(&notify);
+ ret = mars_task_schedule(&task_id[num],
+ &task_args, 0);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+ }
+
+ /* start mpu tasks at the same time */
+ sleep(1);
+ mars_test_counter_set(&notify[0], 1);
+
+ chk_exit = 0;
+ for (num = 0; num < depth_size[i]; num++) {
+ ret = mars_task_wait(&task_id[num], &exit_code);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+ chk_exit |= exit_code;
+
+ ret = mars_task_destroy(&task_id[num]);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+ }
+ MARS_TEST_ASSERT_EQUAL((uint32_t)chk_exit, chk_bit);
+
+ /* check queue count */
+ ret = mars_task_queue_count(host_to_mpu[i], &count);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+ MARS_TEST_ASSERT_EQUAL(count, 0);
+
+ ret = mars_task_queue_destroy(host_to_mpu[i]);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+ }
+
+ ret = mars_context_destroy(mars_ctx);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+
+ return 0;
+}
+
diff --git a/tests/TFP/TFP_4D_004/mpu.c b/tests/TFP/TFP_4D_004/mpu.c
new file mode 100644
index 0000000..e849248
--- /dev/null
+++ b/tests/TFP/TFP_4D_004/mpu.c
@@ -0,0 +1,54 @@
+/*
+ * Copyright 2008 Sony Corporation
+ *
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a copy
+ * of this software and associated documentation files (the "Software"), to deal
+ * in the Software without restriction, including without limitation the rights
+ * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+ * copies of the Software, and to permit persons to whom the Software is
+ * furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included in
+ * all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+ * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+ * THE SOFTWARE.
+ */
+
+#include <mars/mars.h>
+#include <mars_task_test.h>
+#include <spu_mfcio.h>
+
+#define TEST_DIFF 1
+struct queue_entry {
+ uint64_t val1;
+ uint64_t val2;
+};
+static struct queue_entry data;
+
+int mars_task_main(const struct mars_task_args *task_args)
+{
+ int ret;
+ uint64_t host_to_mpu_ea = task_args->type.u64[0];
+ uint64_t notify_ea = task_args->type.u64[1];
+ uint64_t val;
+
+ mars_test_counter_wait(notify_ea, 1);
+
+ ret = mars_task_queue_try_pop(host_to_mpu_ea, &data);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+
+ /* check queue data */
+ val = data.val2 - data.val1;
+ MARS_TEST_ASSERT_EQUAL(val, TEST_DIFF);
+
+ mars_task_exit(1 << data.val1);
+
+ return 0;
+}
diff --git a/tests/TFP/TFP_4D_005/Makefile b/tests/TFP/TFP_4D_005/Makefile
new file mode 100644
index 0000000..432135a
--- /dev/null
+++ b/tests/TFP/TFP_4D_005/Makefile
@@ -0,0 +1,28 @@
+#
+# Copyright 2008 Sony Corporation
+#
+#
+# Permission is hereby granted, free of charge, to any person obtaining a copy
+# of this software and associated documentation files (the "Software"), to deal
+# in the Software without restriction, including without limitation the rights
+# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+# copies of the Software, and to permit persons to whom the Software is
+# furnished to do so, subject to the following conditions:
+#
+# The above copyright notice and this permission notice shall be included in
+# all copies or substantial portions of the Software.
+#
+# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+# THE SOFTWARE.
+#
+
+top_srcdir = ../..
+test_objs = host.o mpu.task_eo
+
+include $(top_srcdir)/scripts/config.mk
+include $(top_srcdir)/scripts/rules_item.mk
diff --git a/tests/TFP/TFP_4D_005/host.c b/tests/TFP/TFP_4D_005/host.c
new file mode 100644
index 0000000..ff74c2e
--- /dev/null
+++ b/tests/TFP/TFP_4D_005/host.c
@@ -0,0 +1,156 @@
+/*
+ * Copyright 2008 Sony Corporation
+ *
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a copy
+ * of this software and associated documentation files (the "Software"), to deal
+ * in the Software without restriction, including without limitation the rights
+ * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+ * copies of the Software, and to permit persons to whom the Software is
+ * furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included in
+ * all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+ * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+ * THE SOFTWARE.
+ */
+
+#include <pthread.h>
+#include <unistd.h>
+#include <mars/mars.h>
+#include <libspe2.h>
+#include <mars_test.h>
+
+struct queue_entry {
+ uint64_t val1;
+ uint64_t val2;
+};
+#define Q_DEPTH (MARS_TASK_QUEUE_WAIT_MAX)
+
+#define TEST_DIFF 1
+
+#define NUM_LOOP 5
+static uint32_t depth_size[] =
+{
+ 1,
+ Q_DEPTH / 2,
+ Q_DEPTH,
+ Q_DEPTH,
+ Q_DEPTH
+};
+extern spe_program_handle_t mpu_prog;
+
+static struct mars_context *mars_ctx;
+static struct mars_task_args task1_args;
+static struct mars_task_args thread_args[Q_DEPTH];
+static struct mars_task_id task1_id;
+
+static uint64_t mpu_to_host[NUM_LOOP];
+static uint32_t shared_resource __attribute((aligned(16)));
+static struct queue_entry data[Q_DEPTH];
+
+static pthread_t thread[Q_DEPTH];
+static void *thread_proc(void *ptr)
+{
+ int ret;
+ struct mars_task_args *task_args = (struct mars_task_args *)ptr;
+ uint32_t id = (uint32_t)task_args->type.u32[0];
+ uint32_t num = (uint32_t)task_args->type.u32[1];
+ uint64_t val;
+
+ /* wait for start */
+ while (!shared_resource)
+ usleep(100);
+
+ ret = mars_task_queue_try_pop(mpu_to_host[id], &data[num]);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+
+ /* check queue data */
+ val = data[num].val2 - data[num].val1;
+ MARS_TEST_ASSERT_EQUAL(val, TEST_DIFF);
+
+ return (void *)(1 << data[num].val1);
+}
+
+int main(void)
+{
+ int ret, i;
+ int32_t exit_code;
+ uint32_t num;
+ uint32_t chk_bit, chk_exit, count;
+ void *p_ret;
+
+ ret = mars_context_create(&mars_ctx, 0, 0);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+
+ for (i = 0; i < NUM_LOOP; i++) {
+ shared_resource = 0;
+ chk_bit = 0;
+
+ ret = mars_task_queue_create(
+ mars_ctx,
+ &mpu_to_host[i],
+ sizeof(struct queue_entry),
+ depth_size[i],
+ MARS_TASK_QUEUE_MPU_TO_HOST);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+
+ /* create push task */
+ ret = mars_task_create(mars_ctx, &task1_id, NULL,
+ mpu_prog.elf_image,
+ MARS_TASK_CONTEXT_SAVE_ALL);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+
+ task1_args.type.u64[0] = mpu_to_host[i];
+ task1_args.type.u64[1] = (uint64_t) depth_size[i];
+ ret = mars_task_schedule(&task1_id, &task1_args, 0);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+
+ ret = mars_task_wait(&task1_id, &exit_code);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+ MARS_TEST_ASSERT_ERROR(exit_code, MARS_SUCCESS);
+
+ ret = mars_task_destroy(&task1_id);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+
+ for (num = 0; num < depth_size[i]; num++) {
+ chk_bit += (1 << num);
+
+ /* create pop thread */
+ thread_args[num].type.u32[0] = (uint32_t)i;
+ thread_args[num].type.u32[1] = (uint32_t)num;
+ pthread_create(&thread[num], NULL,
+ thread_proc, &thread_args[num]);
+ }
+
+ /* start ppe threads and mpu tasks at the same time */
+ sleep(1);
+ shared_resource = 1;
+
+ chk_exit = 0;
+ for (num = 0; num < depth_size[i]; num++) {
+ pthread_join(thread[num], &p_ret);
+ chk_exit |= (uint32_t)p_ret;
+ }
+ MARS_TEST_ASSERT_EQUAL(chk_exit, chk_bit);
+
+ ret = mars_task_queue_count(mpu_to_host[i], &count);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+ MARS_TEST_ASSERT_EQUAL(count, 0);
+
+ ret = mars_task_queue_destroy(mpu_to_host[i]);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+ }
+
+ ret = mars_context_destroy(mars_ctx);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+
+ return 0;
+}
+
diff --git a/tests/TFP/TFP_4D_005/mpu.c b/tests/TFP/TFP_4D_005/mpu.c
new file mode 100644
index 0000000..c7d8751
--- /dev/null
+++ b/tests/TFP/TFP_4D_005/mpu.c
@@ -0,0 +1,49 @@
+/*
+ * Copyright 2008 Sony Corporation
+ *
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a copy
+ * of this software and associated documentation files (the "Software"), to deal
+ * in the Software without restriction, including without limitation the rights
+ * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+ * copies of the Software, and to permit persons to whom the Software is
+ * furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included in
+ * all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+ * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+ * THE SOFTWARE.
+ */
+
+#include <mars/mars.h>
+#include <mars_task_test.h>
+
+#define TEST_DIFF 1
+struct queue_entry {
+ uint64_t val1;
+ uint64_t val2;
+};
+static struct queue_entry data;
+
+int mars_task_main(const struct mars_task_args *task_args)
+{
+ int ret, i;
+ uint64_t mpu_to_host_ea = task_args->type.u64[0];
+ uint32_t num = task_args->type.u64[1];
+
+ for (i = 0; i < num; i++) {
+ data.val1 = i;
+ data.val2 = i + TEST_DIFF;
+
+ ret = mars_task_queue_push(mpu_to_host_ea, &data);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+ }
+
+ return 0;
+}
diff --git a/tests/TFP/TFP_4D_006/Makefile b/tests/TFP/TFP_4D_006/Makefile
new file mode 100644
index 0000000..ecbce33
--- /dev/null
+++ b/tests/TFP/TFP_4D_006/Makefile
@@ -0,0 +1,28 @@
+#
+# Copyright 2008 Sony Corporation
+#
+#
+# Permission is hereby granted, free of charge, to any person obtaining a copy
+# of this software and associated documentation files (the "Software"), to deal
+# in the Software without restriction, including without limitation the rights
+# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+# copies of the Software, and to permit persons to whom the Software is
+# furnished to do so, subject to the following conditions:
+#
+# The above copyright notice and this permission notice shall be included in
+# all copies or substantial portions of the Software.
+#
+# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+# THE SOFTWARE.
+#
+
+top_srcdir = ../..
+test_objs = host.o mpu1.task_eo mpu2.task_eo
+
+include $(top_srcdir)/scripts/config.mk
+include $(top_srcdir)/scripts/rules_item.mk
diff --git a/tests/TFP/TFP_4D_006/host.c b/tests/TFP/TFP_4D_006/host.c
new file mode 100644
index 0000000..e66bb36
--- /dev/null
+++ b/tests/TFP/TFP_4D_006/host.c
@@ -0,0 +1,150 @@
+/*
+ * Copyright 2008 Sony Corporation
+ *
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a copy
+ * of this software and associated documentation files (the "Software"), to deal
+ * in the Software without restriction, including without limitation the rights
+ * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+ * copies of the Software, and to permit persons to whom the Software is
+ * furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included in
+ * all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+ * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+ * THE SOFTWARE.
+ */
+
+#include <unistd.h>
+#include <mars/mars.h>
+#include <libspe2.h>
+#include <mars_test.h>
+
+struct queue_entry {
+ uint64_t val1;
+ uint64_t val2;
+};
+#define Q_DEPTH (MARS_TASK_QUEUE_WAIT_MAX)
+
+#define TEST_DIFF 1
+
+#define NUM_LOOP 5
+static uint32_t depth_size[] =
+{
+ 1,
+ Q_DEPTH / 2,
+ Q_DEPTH,
+ Q_DEPTH,
+ Q_DEPTH
+};
+extern spe_program_handle_t mpu1_prog;
+extern spe_program_handle_t mpu2_prog;
+
+static struct mars_context *mars_ctx;
+static struct mars_task_args task1_args, task2_args;
+static struct mars_task_id task1_id[Q_DEPTH], task2_id;
+
+static uint64_t mpu_to_mpu[NUM_LOOP];
+static uint32_t notify[32] __attribute((aligned(128)));
+
+static void queue_push(uint64_t id)
+{
+ int ret;
+ int32_t exit_code;
+
+ /* create push task */
+ ret = mars_task_create(mars_ctx, &task2_id, NULL,
+ mpu2_prog.elf_image,
+ MARS_TASK_CONTEXT_SAVE_ALL);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+
+ task2_args.type.u64[0] = mpu_to_mpu[id];
+ task2_args.type.u64[1] = (uint64_t) depth_size[id];
+ ret = mars_task_schedule(&task2_id, &task2_args, 0);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+
+ ret = mars_task_wait(&task2_id, &exit_code);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+ MARS_TEST_ASSERT_ERROR(exit_code, MARS_SUCCESS);
+
+ ret = mars_task_destroy(&task2_id);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+}
+
+int main(void)
+{
+ int ret, i;
+ int32_t exit_code, chk_exit;
+ uint32_t num;
+ uint32_t chk_bit, count;
+
+ ret = mars_context_create(&mars_ctx, 0, 0);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+
+ for (i = 0; i < NUM_LOOP; i++) {
+ notify[0] = 0;
+ chk_bit = 0;
+
+ ret = mars_task_queue_create(
+ mars_ctx,
+ &mpu_to_mpu[i],
+ sizeof(struct queue_entry),
+ depth_size[i],
+ MARS_TASK_QUEUE_MPU_TO_MPU);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+
+ queue_push(i);
+
+ /* create pop task */
+ for (num = 0; num < depth_size[i]; num++) {
+ chk_bit += (1 << num);
+
+ /* create pop task */
+ ret = mars_task_create(mars_ctx, &task1_id[num], NULL,
+ mpu1_prog.elf_image, MARS_TASK_CONTEXT_SAVE_ALL);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+
+ task1_args.type.u64[0] = mpu_to_mpu[i];
+ task1_args.type.u64[1] =
+ mars_ptr_to_ea(&notify);
+ ret = mars_task_schedule(&task1_id[num],
+ &task1_args, 0);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+ }
+
+ /* start pop tasks at the same time */
+ sleep(1);
+ mars_test_counter_set(&notify[0], 1);
+
+ chk_exit = 0;
+ for (num = 0; num < depth_size[i]; num++) {
+ ret = mars_task_wait(&task1_id[num], &exit_code);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+ chk_exit |= exit_code;
+
+ ret = mars_task_destroy(&task1_id[num]);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+ }
+ MARS_TEST_ASSERT_EQUAL((uint32_t)chk_exit, chk_bit);
+
+ /* check queue count */
+ ret = mars_task_queue_count(mpu_to_mpu[i], &count);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+ MARS_TEST_ASSERT_EQUAL(count, 0);
+
+ ret = mars_task_queue_destroy(mpu_to_mpu[i]);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+ }
+
+ ret = mars_context_destroy(mars_ctx);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+
+ return 0;
+}
+
diff --git a/tests/TFP/TFP_4D_006/mpu1.c b/tests/TFP/TFP_4D_006/mpu1.c
new file mode 100644
index 0000000..9b35799
--- /dev/null
+++ b/tests/TFP/TFP_4D_006/mpu1.c
@@ -0,0 +1,54 @@
+/*
+ * Copyright 2008 Sony Corporation
+ *
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a copy
+ * of this software and associated documentation files (the "Software"), to deal
+ * in the Software without restriction, including without limitation the rights
+ * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+ * copies of the Software, and to permit persons to whom the Software is
+ * furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included in
+ * all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+ * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+ * THE SOFTWARE.
+ */
+
+#include <mars/mars.h>
+#include <mars_task_test.h>
+#include <spu_mfcio.h>
+
+#define TEST_DIFF 1
+struct queue_entry {
+ uint64_t val1;
+ uint64_t val2;
+};
+static struct queue_entry data;
+
+int mars_task_main(const struct mars_task_args *task_args)
+{
+ int ret;
+ uint64_t mpu_to_mpu_ea = task_args->type.u64[0];
+ uint64_t notify_ea = task_args->type.u64[1];
+ uint64_t val;
+
+ mars_test_counter_wait(notify_ea, 1);
+
+ ret = mars_task_queue_try_pop(mpu_to_mpu_ea, &data);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+
+ /* check queue data */
+ val = data.val2 - data.val1;
+ MARS_TEST_ASSERT_EQUAL(val, TEST_DIFF);
+
+ mars_task_exit(1 << data.val1);
+
+ return 0;
+}
diff --git a/tests/TFP/TFP_4D_006/mpu2.c b/tests/TFP/TFP_4D_006/mpu2.c
new file mode 100644
index 0000000..c7d8751
--- /dev/null
+++ b/tests/TFP/TFP_4D_006/mpu2.c
@@ -0,0 +1,49 @@
+/*
+ * Copyright 2008 Sony Corporation
+ *
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a copy
+ * of this software and associated documentation files (the "Software"), to deal
+ * in the Software without restriction, including without limitation the rights
+ * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+ * copies of the Software, and to permit persons to whom the Software is
+ * furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included in
+ * all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+ * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+ * THE SOFTWARE.
+ */
+
+#include <mars/mars.h>
+#include <mars_task_test.h>
+
+#define TEST_DIFF 1
+struct queue_entry {
+ uint64_t val1;
+ uint64_t val2;
+};
+static struct queue_entry data;
+
+int mars_task_main(const struct mars_task_args *task_args)
+{
+ int ret, i;
+ uint64_t mpu_to_host_ea = task_args->type.u64[0];
+ uint32_t num = task_args->type.u64[1];
+
+ for (i = 0; i < num; i++) {
+ data.val1 = i;
+ data.val2 = i + TEST_DIFF;
+
+ ret = mars_task_queue_push(mpu_to_host_ea, &data);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+ }
+
+ return 0;
+}
diff --git a/tests/TFP/TFP_4E_001/Makefile b/tests/TFP/TFP_4E_001/Makefile
new file mode 100644
index 0000000..432135a
--- /dev/null
+++ b/tests/TFP/TFP_4E_001/Makefile
@@ -0,0 +1,28 @@
+#
+# Copyright 2008 Sony Corporation
+#
+#
+# Permission is hereby granted, free of charge, to any person obtaining a copy
+# of this software and associated documentation files (the "Software"), to deal
+# in the Software without restriction, including without limitation the rights
+# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+# copies of the Software, and to permit persons to whom the Software is
+# furnished to do so, subject to the following conditions:
+#
+# The above copyright notice and this permission notice shall be included in
+# all copies or substantial portions of the Software.
+#
+# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+# THE SOFTWARE.
+#
+
+top_srcdir = ../..
+test_objs = host.o mpu.task_eo
+
+include $(top_srcdir)/scripts/config.mk
+include $(top_srcdir)/scripts/rules_item.mk
diff --git a/tests/TFP/TFP_4E_001/host.c b/tests/TFP/TFP_4E_001/host.c
new file mode 100644
index 0000000..5661ff5
--- /dev/null
+++ b/tests/TFP/TFP_4E_001/host.c
@@ -0,0 +1,78 @@
+/*
+ * Copyright 2008 Sony Corporation
+ *
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a copy
+ * of this software and associated documentation files (the "Software"), to deal
+ * in the Software without restriction, including without limitation the rights
+ * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+ * copies of the Software, and to permit persons to whom the Software is
+ * furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included in
+ * all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+ * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+ * THE SOFTWARE.
+ */
+
+#include <libspe2.h>
+#include <mars/mars.h>
+#include <mars_test.h>
+
+#define QUEUE_DEPTH 16
+
+extern spe_program_handle_t mpu_prog;
+
+static struct mars_context *mars;
+static struct mars_task_id task_id;
+static struct mars_task_args task_args;
+static uint64_t queue;
+
+int main(void)
+{
+ int exit_code, ret;
+
+ ret = mars_context_create(&mars, 0, 0);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+
+ ret = mars_task_create(
+ mars,
+ &task_id,
+ "4E001",
+ mpu_prog.elf_image,
+ MARS_TASK_CONTEXT_SAVE_ALL);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+
+ ret = mars_task_queue_create(
+ mars,
+ &queue,
+ 16,
+ QUEUE_DEPTH,
+ MARS_TASK_QUEUE_HOST_TO_MPU);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+
+ task_args.type.u64[0] = queue;
+ ret = mars_task_schedule(&task_id, &task_args, 0);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+
+ ret = mars_task_wait(&task_id, &exit_code);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+ MARS_TEST_ASSERT_EQUAL(exit_code, 0);
+
+ ret = mars_task_queue_destroy(queue);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+
+ ret = mars_task_destroy(&task_id);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+
+ ret = mars_context_destroy(mars);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+
+ return 0;
+}
diff --git a/tests/TFP/TFP_4E_001/mpu.c b/tests/TFP/TFP_4E_001/mpu.c
new file mode 100644
index 0000000..81ad7e0
--- /dev/null
+++ b/tests/TFP/TFP_4E_001/mpu.c
@@ -0,0 +1,44 @@
+/*
+ * Copyright 2008 Sony Corporation
+ *
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a copy
+ * of this software and associated documentation files (the "Software"), to deal
+ * in the Software without restriction, including without limitation the rights
+ * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+ * copies of the Software, and to permit persons to whom the Software is
+ * furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included in
+ * all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+ * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+ * THE SOFTWARE.
+ */
+
+#include <string.h>
+#include <mars/mars.h>
+#include "mars_task_test.h"
+
+static uint64_t queue_item[2] __attribute__((aligned(16)));
+
+int mars_task_main(const struct mars_task_args *task_args)
+{
+ int ret;
+ uint64_t queue_ea = task_args->type.u64[0];
+
+ ret = mars_task_queue_try_pop_begin(queue_ea, queue_item, 0);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_ERROR_BUSY);
+
+ ret = mars_task_queue_pop_end(queue_ea, 0);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+
+ mars_task_exit(0);
+
+ return 0;
+}
diff --git a/tests/TFP/TFP_4E_002/Makefile b/tests/TFP/TFP_4E_002/Makefile
new file mode 100644
index 0000000..432135a
--- /dev/null
+++ b/tests/TFP/TFP_4E_002/Makefile
@@ -0,0 +1,28 @@
+#
+# Copyright 2008 Sony Corporation
+#
+#
+# Permission is hereby granted, free of charge, to any person obtaining a copy
+# of this software and associated documentation files (the "Software"), to deal
+# in the Software without restriction, including without limitation the rights
+# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+# copies of the Software, and to permit persons to whom the Software is
+# furnished to do so, subject to the following conditions:
+#
+# The above copyright notice and this permission notice shall be included in
+# all copies or substantial portions of the Software.
+#
+# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+# THE SOFTWARE.
+#
+
+top_srcdir = ../..
+test_objs = host.o mpu.task_eo
+
+include $(top_srcdir)/scripts/config.mk
+include $(top_srcdir)/scripts/rules_item.mk
diff --git a/tests/TFP/TFP_4E_002/host.c b/tests/TFP/TFP_4E_002/host.c
new file mode 100644
index 0000000..b1fafce
--- /dev/null
+++ b/tests/TFP/TFP_4E_002/host.c
@@ -0,0 +1,78 @@
+/*
+ * Copyright 2008 Sony Corporation
+ *
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a copy
+ * of this software and associated documentation files (the "Software"), to deal
+ * in the Software without restriction, including without limitation the rights
+ * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+ * copies of the Software, and to permit persons to whom the Software is
+ * furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included in
+ * all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+ * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+ * THE SOFTWARE.
+ */
+
+#include <libspe2.h>
+#include <mars/mars.h>
+#include <mars_test.h>
+
+#define QUEUE_DEPTH 16
+
+extern spe_program_handle_t mpu_prog;
+
+static struct mars_context *mars;
+static struct mars_task_id task_id;
+static struct mars_task_args task_args;
+static uint64_t queue;
+
+int main(void)
+{
+ int exit_code, ret;
+
+ ret = mars_context_create(&mars, 0, 0);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+
+ ret = mars_task_create(
+ mars,
+ &task_id,
+ "4E002",
+ mpu_prog.elf_image,
+ MARS_TASK_CONTEXT_SAVE_ALL);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+
+ ret = mars_task_queue_create(
+ mars,
+ &queue,
+ 16,
+ QUEUE_DEPTH,
+ MARS_TASK_QUEUE_MPU_TO_MPU);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+
+ task_args.type.u64[0] = queue;
+ ret = mars_task_schedule(&task_id, &task_args, 0);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+
+ ret = mars_task_wait(&task_id, &exit_code);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+ MARS_TEST_ASSERT_EQUAL(exit_code, 0);
+
+ ret = mars_task_queue_destroy(queue);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+
+ ret = mars_task_destroy(&task_id);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+
+ ret = mars_context_destroy(mars);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+
+ return 0;
+}
diff --git a/tests/TFP/TFP_4E_002/mpu.c b/tests/TFP/TFP_4E_002/mpu.c
new file mode 100644
index 0000000..81ad7e0
--- /dev/null
+++ b/tests/TFP/TFP_4E_002/mpu.c
@@ -0,0 +1,44 @@
+/*
+ * Copyright 2008 Sony Corporation
+ *
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a copy
+ * of this software and associated documentation files (the "Software"), to deal
+ * in the Software without restriction, including without limitation the rights
+ * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+ * copies of the Software, and to permit persons to whom the Software is
+ * furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included in
+ * all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+ * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+ * THE SOFTWARE.
+ */
+
+#include <string.h>
+#include <mars/mars.h>
+#include "mars_task_test.h"
+
+static uint64_t queue_item[2] __attribute__((aligned(16)));
+
+int mars_task_main(const struct mars_task_args *task_args)
+{
+ int ret;
+ uint64_t queue_ea = task_args->type.u64[0];
+
+ ret = mars_task_queue_try_pop_begin(queue_ea, queue_item, 0);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_ERROR_BUSY);
+
+ ret = mars_task_queue_pop_end(queue_ea, 0);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+
+ mars_task_exit(0);
+
+ return 0;
+}
diff --git a/tests/TFP/TFP_4E_003/Makefile b/tests/TFP/TFP_4E_003/Makefile
new file mode 100644
index 0000000..ecbce33
--- /dev/null
+++ b/tests/TFP/TFP_4E_003/Makefile
@@ -0,0 +1,28 @@
+#
+# Copyright 2008 Sony Corporation
+#
+#
+# Permission is hereby granted, free of charge, to any person obtaining a copy
+# of this software and associated documentation files (the "Software"), to deal
+# in the Software without restriction, including without limitation the rights
+# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+# copies of the Software, and to permit persons to whom the Software is
+# furnished to do so, subject to the following conditions:
+#
+# The above copyright notice and this permission notice shall be included in
+# all copies or substantial portions of the Software.
+#
+# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+# THE SOFTWARE.
+#
+
+top_srcdir = ../..
+test_objs = host.o mpu1.task_eo mpu2.task_eo
+
+include $(top_srcdir)/scripts/config.mk
+include $(top_srcdir)/scripts/rules_item.mk
diff --git a/tests/TFP/TFP_4E_003/host.c b/tests/TFP/TFP_4E_003/host.c
new file mode 100644
index 0000000..0de04c9
--- /dev/null
+++ b/tests/TFP/TFP_4E_003/host.c
@@ -0,0 +1,121 @@
+/*
+ * Copyright 2008 Sony Corporation
+ *
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a copy
+ * of this software and associated documentation files (the "Software"), to deal
+ * in the Software without restriction, including without limitation the rights
+ * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+ * copies of the Software, and to permit persons to whom the Software is
+ * furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included in
+ * all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+ * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+ * THE SOFTWARE.
+ */
+
+#include <unistd.h>
+#include <mars/mars.h>
+#include <libspe2.h>
+#include <mars_test.h>
+
+struct queue_entry {
+ uint64_t val1;
+ uint64_t val2;
+};
+#define Q_DEPTH (256 * 1024)
+
+#define NUM_LOOP 2
+static uint32_t depth_size[] =
+{
+ 1,
+ Q_DEPTH
+};
+extern spe_program_handle_t mpu1_prog;
+extern spe_program_handle_t mpu2_prog;
+
+static struct mars_context *mars_ctx;
+static struct mars_task_args task1_args, task2_args;
+static struct mars_task_id task1_id, task2_id;
+
+static uint64_t mpu_to_mpu[NUM_LOOP];
+
+static uint32_t shared_resource __attribute((aligned(16)));
+
+int main(void)
+{
+ int ret, i;
+ int32_t exit_code;
+
+ ret = mars_context_create(&mars_ctx, 0, 0);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+
+ for (i = 0; i < NUM_LOOP; i++) {
+ shared_resource = 0;
+
+ ret = mars_task_queue_create(
+ mars_ctx,
+ &mpu_to_mpu[i],
+ sizeof(struct queue_entry),
+ depth_size[i],
+ MARS_TASK_QUEUE_MPU_TO_MPU);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+
+ /* create pop task */
+ ret = mars_task_create(mars_ctx, &task1_id, NULL,
+ mpu1_prog.elf_image, MARS_TASK_CONTEXT_SAVE_ALL);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+
+ task1_args.type.u64[0] = mpu_to_mpu[i];
+ task1_args.type.u64[1] = mars_ptr_to_ea(&shared_resource);
+ task1_args.type.u64[2] = (uint64_t)i;
+ ret = mars_task_schedule(&task1_id, &task1_args, 0);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+
+ /* create push task */
+ ret = mars_task_create(mars_ctx, &task2_id, NULL,
+ mpu2_prog.elf_image, MARS_TASK_CONTEXT_SAVE_ALL);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+
+ /* check if queue pop is blocked in mpu task */
+ sleep(1);
+ MARS_TEST_ASSERT_EQUAL(shared_resource, 0);
+
+ /* push one by mpu */
+ task2_args.type.u64[0] = mpu_to_mpu[i];
+ task2_args.type.u64[1] = (uint64_t)i;
+ ret = mars_task_schedule(&task2_id, &task2_args, 0);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+
+ ret = mars_task_wait(&task2_id, &exit_code);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+ MARS_TEST_ASSERT_ERROR(exit_code, MARS_SUCCESS);
+
+ /* check if pop task is successfly finished */
+ ret = mars_task_wait(&task1_id, &exit_code);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+ MARS_TEST_ASSERT_ERROR(exit_code, MARS_SUCCESS);
+
+ ret = mars_task_destroy(&task1_id);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+
+ ret = mars_task_destroy(&task2_id);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+
+ ret = mars_task_queue_destroy(mpu_to_mpu[i]);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+ }
+
+ ret = mars_context_destroy(mars_ctx);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+
+ return 0;
+}
+
diff --git a/tests/TFP/TFP_4E_003/mpu1.c b/tests/TFP/TFP_4E_003/mpu1.c
new file mode 100644
index 0000000..e60d405
--- /dev/null
+++ b/tests/TFP/TFP_4E_003/mpu1.c
@@ -0,0 +1,64 @@
+/*
+ * Copyright 2008 Sony Corporation
+ *
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a copy
+ * of this software and associated documentation files (the "Software"), to deal
+ * in the Software without restriction, including without limitation the rights
+ * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+ * copies of the Software, and to permit persons to whom the Software is
+ * furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included in
+ * all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+ * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+ * THE SOFTWARE.
+ */
+
+#include <mars/mars.h>
+#include <mars_task_test.h>
+#include <spu_mfcio.h>
+
+struct queue_entry {
+ uint64_t val;
+ uint64_t pad;
+};
+static struct queue_entry data;
+static uint32_t shared_resource __attribute((aligned(16)));
+
+int mars_task_main(const struct mars_task_args *task_args)
+{
+ int ret;
+ uint64_t mpu_to_mpu_ea = task_args->type.u64[0];
+ uint64_t shared_resource_ea = task_args->type.u64[1];
+ uint64_t val = task_args->type.u64[2];
+
+ while (1) {
+ ret = mars_task_queue_try_pop_begin(mpu_to_mpu_ea, &data, 1);
+ if (ret == MARS_SUCCESS)
+ break;
+ else if (ret == MARS_ERROR_BUSY)
+ continue;
+ else
+ MARS_TEST_ASSERT_ERROR(ret, 0);
+ }
+ ret = mars_task_queue_pop_end(mpu_to_mpu_ea, 1);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+
+ MARS_TEST_ASSERT_EQUAL(data.val, val);
+
+ /* if the program reaches here, shared_resource'll be updated */
+ shared_resource = 1;
+ mfc_put(&shared_resource, shared_resource_ea,
+ sizeof(uint32_t), 0, 0, 0);
+ mfc_write_tag_mask(1 << 0);
+ mfc_read_tag_status_all();
+
+ return 0;
+}
diff --git a/tests/TFP/TFP_4E_003/mpu2.c b/tests/TFP/TFP_4E_003/mpu2.c
new file mode 100644
index 0000000..d8e04bc
--- /dev/null
+++ b/tests/TFP/TFP_4E_003/mpu2.c
@@ -0,0 +1,48 @@
+/*
+ * Copyright 2008 Sony Corporation
+ *
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a copy
+ * of this software and associated documentation files (the "Software"), to deal
+ * in the Software without restriction, including without limitation the rights
+ * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+ * copies of the Software, and to permit persons to whom the Software is
+ * furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included in
+ * all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+ * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+ * THE SOFTWARE.
+ */
+
+#include <mars/mars.h>
+#include <mars_task_test.h>
+#include <spu_mfcio.h>
+
+struct queue_entry {
+ uint64_t val1;
+ uint64_t val2;
+};
+static struct queue_entry data;
+
+int mars_task_main(const struct mars_task_args *task_args)
+{
+ int ret;
+ uint64_t mpu_to_mpu_ea = task_args->type.u64[0];
+ uint64_t val = task_args->type.u64[1];
+
+ data.val1 = val;
+ ret = mars_task_queue_push_begin(mpu_to_mpu_ea, &data, 1);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+
+ ret = mars_task_queue_push_end(mpu_to_mpu_ea, 1);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+
+ return 0;
+}
diff --git a/tests/TFP/TFP_4E_004/Makefile b/tests/TFP/TFP_4E_004/Makefile
new file mode 100644
index 0000000..432135a
--- /dev/null
+++ b/tests/TFP/TFP_4E_004/Makefile
@@ -0,0 +1,28 @@
+#
+# Copyright 2008 Sony Corporation
+#
+#
+# Permission is hereby granted, free of charge, to any person obtaining a copy
+# of this software and associated documentation files (the "Software"), to deal
+# in the Software without restriction, including without limitation the rights
+# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+# copies of the Software, and to permit persons to whom the Software is
+# furnished to do so, subject to the following conditions:
+#
+# The above copyright notice and this permission notice shall be included in
+# all copies or substantial portions of the Software.
+#
+# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+# THE SOFTWARE.
+#
+
+top_srcdir = ../..
+test_objs = host.o mpu.task_eo
+
+include $(top_srcdir)/scripts/config.mk
+include $(top_srcdir)/scripts/rules_item.mk
diff --git a/tests/TFP/TFP_4E_004/host.c b/tests/TFP/TFP_4E_004/host.c
new file mode 100644
index 0000000..fdf3de4
--- /dev/null
+++ b/tests/TFP/TFP_4E_004/host.c
@@ -0,0 +1,138 @@
+/*
+ * Copyright 2008 Sony Corporation
+ *
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a copy
+ * of this software and associated documentation files (the "Software"), to deal
+ * in the Software without restriction, including without limitation the rights
+ * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+ * copies of the Software, and to permit persons to whom the Software is
+ * furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included in
+ * all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+ * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+ * THE SOFTWARE.
+ */
+
+#include <unistd.h>
+#include <mars/mars.h>
+#include <libspe2.h>
+#include <mars_test.h>
+
+struct queue_entry {
+ uint64_t val1;
+ uint64_t val2;
+};
+#define Q_DEPTH (MARS_TASK_QUEUE_WAIT_MAX)
+
+#define TEST_DIFF 1
+
+#define NUM_LOOP 5
+static uint32_t depth_size[] =
+{
+ 1,
+ Q_DEPTH / 2,
+ Q_DEPTH,
+ Q_DEPTH,
+ Q_DEPTH
+};
+extern spe_program_handle_t mpu_prog;
+
+static struct mars_context *mars_ctx;
+static struct mars_task_args task_args;
+static struct mars_task_id task_id[Q_DEPTH];
+
+static uint64_t host_to_mpu[NUM_LOOP];
+static uint32_t notify[32] __attribute((aligned(128)));
+static struct queue_entry data;
+
+static void queue_push(uint64_t id, uint64_t count)
+{
+ int ret, i;
+
+ for (i = 0; i < count; i++) {
+ data.val1 = i;
+ data.val2 = i + TEST_DIFF;
+ ret = mars_task_queue_push(host_to_mpu[id], &data);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+ }
+}
+
+int main(void)
+{
+ int ret, i;
+ int32_t exit_code, chk_exit;
+ uint32_t num;
+ uint32_t chk_bit, count;
+
+ ret = mars_context_create(&mars_ctx, 0, 0);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+
+ for (i = 0; i < NUM_LOOP; i++) {
+ notify[0] = 0;
+ chk_bit = 0;
+
+ ret = mars_task_queue_create(
+ mars_ctx,
+ &host_to_mpu[i],
+ sizeof(struct queue_entry),
+ depth_size[i],
+ MARS_TASK_QUEUE_HOST_TO_MPU);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+
+ queue_push(i, depth_size[i]);
+
+ /* create pop task */
+ for (num = 0; num < depth_size[i]; num++) {
+ chk_bit += (1 << num);
+
+ /* create pop task */
+ ret = mars_task_create(mars_ctx, &task_id[num], NULL,
+ mpu_prog.elf_image, MARS_TASK_CONTEXT_SAVE_ALL);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+
+ task_args.type.u64[0] = host_to_mpu[i];
+ task_args.type.u64[1] =
+ mars_ptr_to_ea(&notify);
+ ret = mars_task_schedule(&task_id[num],
+ &task_args, 0);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+ }
+
+ /* start mpu tasks at the same time */
+ sleep(1);
+ mars_test_counter_set(&notify[0], 1);
+
+ chk_exit = 0;
+ for (num = 0; num < depth_size[i]; num++) {
+ ret = mars_task_wait(&task_id[num], &exit_code);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+ chk_exit |= exit_code;
+
+ ret = mars_task_destroy(&task_id[num]);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+ }
+ MARS_TEST_ASSERT_EQUAL((uint32_t)chk_exit, chk_bit);
+
+ /* check queue count */
+ ret = mars_task_queue_count(host_to_mpu[i], &count);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+ MARS_TEST_ASSERT_EQUAL(count, 0);
+
+ ret = mars_task_queue_destroy(host_to_mpu[i]);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+ }
+
+ ret = mars_context_destroy(mars_ctx);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+
+ return 0;
+}
+
diff --git a/tests/TFP/TFP_4E_004/mpu.c b/tests/TFP/TFP_4E_004/mpu.c
new file mode 100644
index 0000000..8c711ca
--- /dev/null
+++ b/tests/TFP/TFP_4E_004/mpu.c
@@ -0,0 +1,57 @@
+/*
+ * Copyright 2008 Sony Corporation
+ *
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a copy
+ * of this software and associated documentation files (the "Software"), to deal
+ * in the Software without restriction, including without limitation the rights
+ * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+ * copies of the Software, and to permit persons to whom the Software is
+ * furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included in
+ * all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+ * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+ * THE SOFTWARE.
+ */
+
+#include <mars/mars.h>
+#include <mars_task_test.h>
+#include <spu_mfcio.h>
+
+#define TEST_DIFF 1
+struct queue_entry {
+ uint64_t val1;
+ uint64_t val2;
+};
+static struct queue_entry data;
+
+int mars_task_main(const struct mars_task_args *task_args)
+{
+ int ret;
+ uint64_t host_to_mpu_ea = task_args->type.u64[0];
+ uint64_t notify_ea = task_args->type.u64[1];
+ uint64_t val;
+
+ mars_test_counter_wait(notify_ea, 1);
+
+ ret = mars_task_queue_try_pop_begin(host_to_mpu_ea, &data, 1);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+
+ ret = mars_task_queue_pop_end(host_to_mpu_ea, 1);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+
+ /* check queue data */
+ val = data.val2 - data.val1;
+ MARS_TEST_ASSERT_EQUAL(val, TEST_DIFF);
+
+ mars_task_exit(1 << data.val1);
+
+ return 0;
+}
diff --git a/tests/TFP/TFP_4E_005/Makefile b/tests/TFP/TFP_4E_005/Makefile
new file mode 100644
index 0000000..ecbce33
--- /dev/null
+++ b/tests/TFP/TFP_4E_005/Makefile
@@ -0,0 +1,28 @@
+#
+# Copyright 2008 Sony Corporation
+#
+#
+# Permission is hereby granted, free of charge, to any person obtaining a copy
+# of this software and associated documentation files (the "Software"), to deal
+# in the Software without restriction, including without limitation the rights
+# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+# copies of the Software, and to permit persons to whom the Software is
+# furnished to do so, subject to the following conditions:
+#
+# The above copyright notice and this permission notice shall be included in
+# all copies or substantial portions of the Software.
+#
+# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+# THE SOFTWARE.
+#
+
+top_srcdir = ../..
+test_objs = host.o mpu1.task_eo mpu2.task_eo
+
+include $(top_srcdir)/scripts/config.mk
+include $(top_srcdir)/scripts/rules_item.mk
diff --git a/tests/TFP/TFP_4E_005/host.c b/tests/TFP/TFP_4E_005/host.c
new file mode 100644
index 0000000..e66bb36
--- /dev/null
+++ b/tests/TFP/TFP_4E_005/host.c
@@ -0,0 +1,150 @@
+/*
+ * Copyright 2008 Sony Corporation
+ *
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a copy
+ * of this software and associated documentation files (the "Software"), to deal
+ * in the Software without restriction, including without limitation the rights
+ * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+ * copies of the Software, and to permit persons to whom the Software is
+ * furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included in
+ * all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+ * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+ * THE SOFTWARE.
+ */
+
+#include <unistd.h>
+#include <mars/mars.h>
+#include <libspe2.h>
+#include <mars_test.h>
+
+struct queue_entry {
+ uint64_t val1;
+ uint64_t val2;
+};
+#define Q_DEPTH (MARS_TASK_QUEUE_WAIT_MAX)
+
+#define TEST_DIFF 1
+
+#define NUM_LOOP 5
+static uint32_t depth_size[] =
+{
+ 1,
+ Q_DEPTH / 2,
+ Q_DEPTH,
+ Q_DEPTH,
+ Q_DEPTH
+};
+extern spe_program_handle_t mpu1_prog;
+extern spe_program_handle_t mpu2_prog;
+
+static struct mars_context *mars_ctx;
+static struct mars_task_args task1_args, task2_args;
+static struct mars_task_id task1_id[Q_DEPTH], task2_id;
+
+static uint64_t mpu_to_mpu[NUM_LOOP];
+static uint32_t notify[32] __attribute((aligned(128)));
+
+static void queue_push(uint64_t id)
+{
+ int ret;
+ int32_t exit_code;
+
+ /* create push task */
+ ret = mars_task_create(mars_ctx, &task2_id, NULL,
+ mpu2_prog.elf_image,
+ MARS_TASK_CONTEXT_SAVE_ALL);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+
+ task2_args.type.u64[0] = mpu_to_mpu[id];
+ task2_args.type.u64[1] = (uint64_t) depth_size[id];
+ ret = mars_task_schedule(&task2_id, &task2_args, 0);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+
+ ret = mars_task_wait(&task2_id, &exit_code);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+ MARS_TEST_ASSERT_ERROR(exit_code, MARS_SUCCESS);
+
+ ret = mars_task_destroy(&task2_id);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+}
+
+int main(void)
+{
+ int ret, i;
+ int32_t exit_code, chk_exit;
+ uint32_t num;
+ uint32_t chk_bit, count;
+
+ ret = mars_context_create(&mars_ctx, 0, 0);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+
+ for (i = 0; i < NUM_LOOP; i++) {
+ notify[0] = 0;
+ chk_bit = 0;
+
+ ret = mars_task_queue_create(
+ mars_ctx,
+ &mpu_to_mpu[i],
+ sizeof(struct queue_entry),
+ depth_size[i],
+ MARS_TASK_QUEUE_MPU_TO_MPU);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+
+ queue_push(i);
+
+ /* create pop task */
+ for (num = 0; num < depth_size[i]; num++) {
+ chk_bit += (1 << num);
+
+ /* create pop task */
+ ret = mars_task_create(mars_ctx, &task1_id[num], NULL,
+ mpu1_prog.elf_image, MARS_TASK_CONTEXT_SAVE_ALL);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+
+ task1_args.type.u64[0] = mpu_to_mpu[i];
+ task1_args.type.u64[1] =
+ mars_ptr_to_ea(&notify);
+ ret = mars_task_schedule(&task1_id[num],
+ &task1_args, 0);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+ }
+
+ /* start pop tasks at the same time */
+ sleep(1);
+ mars_test_counter_set(&notify[0], 1);
+
+ chk_exit = 0;
+ for (num = 0; num < depth_size[i]; num++) {
+ ret = mars_task_wait(&task1_id[num], &exit_code);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+ chk_exit |= exit_code;
+
+ ret = mars_task_destroy(&task1_id[num]);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+ }
+ MARS_TEST_ASSERT_EQUAL((uint32_t)chk_exit, chk_bit);
+
+ /* check queue count */
+ ret = mars_task_queue_count(mpu_to_mpu[i], &count);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+ MARS_TEST_ASSERT_EQUAL(count, 0);
+
+ ret = mars_task_queue_destroy(mpu_to_mpu[i]);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+ }
+
+ ret = mars_context_destroy(mars_ctx);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+
+ return 0;
+}
+
diff --git a/tests/TFP/TFP_4E_005/mpu1.c b/tests/TFP/TFP_4E_005/mpu1.c
new file mode 100644
index 0000000..c376f30
--- /dev/null
+++ b/tests/TFP/TFP_4E_005/mpu1.c
@@ -0,0 +1,57 @@
+/*
+ * Copyright 2008 Sony Corporation
+ *
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a copy
+ * of this software and associated documentation files (the "Software"), to deal
+ * in the Software without restriction, including without limitation the rights
+ * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+ * copies of the Software, and to permit persons to whom the Software is
+ * furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included in
+ * all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+ * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+ * THE SOFTWARE.
+ */
+
+#include <mars/mars.h>
+#include <mars_task_test.h>
+#include <spu_mfcio.h>
+
+#define TEST_DIFF 1
+struct queue_entry {
+ uint64_t val1;
+ uint64_t val2;
+};
+static struct queue_entry data;
+
+int mars_task_main(const struct mars_task_args *task_args)
+{
+ int ret;
+ uint64_t mpu_to_mpu_ea = task_args->type.u64[0];
+ uint64_t notify_ea = task_args->type.u64[1];
+ uint64_t val;
+
+ mars_test_counter_wait(notify_ea, 1);
+
+ ret = mars_task_queue_try_pop_begin(mpu_to_mpu_ea, &data, 1);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+
+ ret = mars_task_queue_pop_end(mpu_to_mpu_ea, 1);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+
+ /* check queue data */
+ val = data.val2 - data.val1;
+ MARS_TEST_ASSERT_EQUAL(val, TEST_DIFF);
+
+ mars_task_exit(1 << data.val1);
+
+ return 0;
+}
diff --git a/tests/TFP/TFP_4E_005/mpu2.c b/tests/TFP/TFP_4E_005/mpu2.c
new file mode 100644
index 0000000..c7d8751
--- /dev/null
+++ b/tests/TFP/TFP_4E_005/mpu2.c
@@ -0,0 +1,49 @@
+/*
+ * Copyright 2008 Sony Corporation
+ *
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a copy
+ * of this software and associated documentation files (the "Software"), to deal
+ * in the Software without restriction, including without limitation the rights
+ * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+ * copies of the Software, and to permit persons to whom the Software is
+ * furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included in
+ * all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+ * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+ * THE SOFTWARE.
+ */
+
+#include <mars/mars.h>
+#include <mars_task_test.h>
+
+#define TEST_DIFF 1
+struct queue_entry {
+ uint64_t val1;
+ uint64_t val2;
+};
+static struct queue_entry data;
+
+int mars_task_main(const struct mars_task_args *task_args)
+{
+ int ret, i;
+ uint64_t mpu_to_host_ea = task_args->type.u64[0];
+ uint32_t num = task_args->type.u64[1];
+
+ for (i = 0; i < num; i++) {
+ data.val1 = i;
+ data.val2 = i + TEST_DIFF;
+
+ ret = mars_task_queue_push(mpu_to_host_ea, &data);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+ }
+
+ return 0;
+}
diff --git a/tests/TFP/TFP_4E_006/Makefile b/tests/TFP/TFP_4E_006/Makefile
new file mode 100644
index 0000000..ecbce33
--- /dev/null
+++ b/tests/TFP/TFP_4E_006/Makefile
@@ -0,0 +1,28 @@
+#
+# Copyright 2008 Sony Corporation
+#
+#
+# Permission is hereby granted, free of charge, to any person obtaining a copy
+# of this software and associated documentation files (the "Software"), to deal
+# in the Software without restriction, including without limitation the rights
+# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+# copies of the Software, and to permit persons to whom the Software is
+# furnished to do so, subject to the following conditions:
+#
+# The above copyright notice and this permission notice shall be included in
+# all copies or substantial portions of the Software.
+#
+# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+# THE SOFTWARE.
+#
+
+top_srcdir = ../..
+test_objs = host.o mpu1.task_eo mpu2.task_eo
+
+include $(top_srcdir)/scripts/config.mk
+include $(top_srcdir)/scripts/rules_item.mk
diff --git a/tests/TFP/TFP_4E_006/host.c b/tests/TFP/TFP_4E_006/host.c
new file mode 100644
index 0000000..0de04c9
--- /dev/null
+++ b/tests/TFP/TFP_4E_006/host.c
@@ -0,0 +1,121 @@
+/*
+ * Copyright 2008 Sony Corporation
+ *
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a copy
+ * of this software and associated documentation files (the "Software"), to deal
+ * in the Software without restriction, including without limitation the rights
+ * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+ * copies of the Software, and to permit persons to whom the Software is
+ * furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included in
+ * all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+ * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+ * THE SOFTWARE.
+ */
+
+#include <unistd.h>
+#include <mars/mars.h>
+#include <libspe2.h>
+#include <mars_test.h>
+
+struct queue_entry {
+ uint64_t val1;
+ uint64_t val2;
+};
+#define Q_DEPTH (256 * 1024)
+
+#define NUM_LOOP 2
+static uint32_t depth_size[] =
+{
+ 1,
+ Q_DEPTH
+};
+extern spe_program_handle_t mpu1_prog;
+extern spe_program_handle_t mpu2_prog;
+
+static struct mars_context *mars_ctx;
+static struct mars_task_args task1_args, task2_args;
+static struct mars_task_id task1_id, task2_id;
+
+static uint64_t mpu_to_mpu[NUM_LOOP];
+
+static uint32_t shared_resource __attribute((aligned(16)));
+
+int main(void)
+{
+ int ret, i;
+ int32_t exit_code;
+
+ ret = mars_context_create(&mars_ctx, 0, 0);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+
+ for (i = 0; i < NUM_LOOP; i++) {
+ shared_resource = 0;
+
+ ret = mars_task_queue_create(
+ mars_ctx,
+ &mpu_to_mpu[i],
+ sizeof(struct queue_entry),
+ depth_size[i],
+ MARS_TASK_QUEUE_MPU_TO_MPU);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+
+ /* create pop task */
+ ret = mars_task_create(mars_ctx, &task1_id, NULL,
+ mpu1_prog.elf_image, MARS_TASK_CONTEXT_SAVE_ALL);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+
+ task1_args.type.u64[0] = mpu_to_mpu[i];
+ task1_args.type.u64[1] = mars_ptr_to_ea(&shared_resource);
+ task1_args.type.u64[2] = (uint64_t)i;
+ ret = mars_task_schedule(&task1_id, &task1_args, 0);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+
+ /* create push task */
+ ret = mars_task_create(mars_ctx, &task2_id, NULL,
+ mpu2_prog.elf_image, MARS_TASK_CONTEXT_SAVE_ALL);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+
+ /* check if queue pop is blocked in mpu task */
+ sleep(1);
+ MARS_TEST_ASSERT_EQUAL(shared_resource, 0);
+
+ /* push one by mpu */
+ task2_args.type.u64[0] = mpu_to_mpu[i];
+ task2_args.type.u64[1] = (uint64_t)i;
+ ret = mars_task_schedule(&task2_id, &task2_args, 0);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+
+ ret = mars_task_wait(&task2_id, &exit_code);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+ MARS_TEST_ASSERT_ERROR(exit_code, MARS_SUCCESS);
+
+ /* check if pop task is successfly finished */
+ ret = mars_task_wait(&task1_id, &exit_code);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+ MARS_TEST_ASSERT_ERROR(exit_code, MARS_SUCCESS);
+
+ ret = mars_task_destroy(&task1_id);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+
+ ret = mars_task_destroy(&task2_id);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+
+ ret = mars_task_queue_destroy(mpu_to_mpu[i]);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+ }
+
+ ret = mars_context_destroy(mars_ctx);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+
+ return 0;
+}
+
diff --git a/tests/TFP/TFP_4E_006/mpu1.c b/tests/TFP/TFP_4E_006/mpu1.c
new file mode 100644
index 0000000..e60d405
--- /dev/null
+++ b/tests/TFP/TFP_4E_006/mpu1.c
@@ -0,0 +1,64 @@
+/*
+ * Copyright 2008 Sony Corporation
+ *
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a copy
+ * of this software and associated documentation files (the "Software"), to deal
+ * in the Software without restriction, including without limitation the rights
+ * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+ * copies of the Software, and to permit persons to whom the Software is
+ * furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included in
+ * all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+ * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+ * THE SOFTWARE.
+ */
+
+#include <mars/mars.h>
+#include <mars_task_test.h>
+#include <spu_mfcio.h>
+
+struct queue_entry {
+ uint64_t val;
+ uint64_t pad;
+};
+static struct queue_entry data;
+static uint32_t shared_resource __attribute((aligned(16)));
+
+int mars_task_main(const struct mars_task_args *task_args)
+{
+ int ret;
+ uint64_t mpu_to_mpu_ea = task_args->type.u64[0];
+ uint64_t shared_resource_ea = task_args->type.u64[1];
+ uint64_t val = task_args->type.u64[2];
+
+ while (1) {
+ ret = mars_task_queue_try_pop_begin(mpu_to_mpu_ea, &data, 1);
+ if (ret == MARS_SUCCESS)
+ break;
+ else if (ret == MARS_ERROR_BUSY)
+ continue;
+ else
+ MARS_TEST_ASSERT_ERROR(ret, 0);
+ }
+ ret = mars_task_queue_pop_end(mpu_to_mpu_ea, 1);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+
+ MARS_TEST_ASSERT_EQUAL(data.val, val);
+
+ /* if the program reaches here, shared_resource'll be updated */
+ shared_resource = 1;
+ mfc_put(&shared_resource, shared_resource_ea,
+ sizeof(uint32_t), 0, 0, 0);
+ mfc_write_tag_mask(1 << 0);
+ mfc_read_tag_status_all();
+
+ return 0;
+}
diff --git a/tests/TFP/TFP_4E_006/mpu2.c b/tests/TFP/TFP_4E_006/mpu2.c
new file mode 100644
index 0000000..2e2124b
--- /dev/null
+++ b/tests/TFP/TFP_4E_006/mpu2.c
@@ -0,0 +1,48 @@
+/*
+ * Copyright 2008 Sony Corporation
+ *
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a copy
+ * of this software and associated documentation files (the "Software"), to deal
+ * in the Software without restriction, including without limitation the rights
+ * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+ * copies of the Software, and to permit persons to whom the Software is
+ * furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included in
+ * all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+ * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+ * THE SOFTWARE.
+ */
+
+#include <mars/mars.h>
+#include <mars_task_test.h>
+#include <spu_mfcio.h>
+
+struct queue_entry {
+ uint64_t val1;
+ uint64_t val2;
+};
+static struct queue_entry data;
+
+int mars_task_main(const struct mars_task_args *task_args)
+{
+ int ret;
+ uint64_t mpu_to_mpu_ea = task_args->type.u64[0];
+ uint64_t val = task_args->type.u64[1];
+
+ data.val1 = val;
+ ret = mars_task_queue_try_push_begin(mpu_to_mpu_ea, &data, 1);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+
+ ret = mars_task_queue_push_end(mpu_to_mpu_ea, 1);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+
+ return 0;
+}
diff --git a/tests/TFP/TFP_4F_001/Makefile b/tests/TFP/TFP_4F_001/Makefile
new file mode 100644
index 0000000..432135a
--- /dev/null
+++ b/tests/TFP/TFP_4F_001/Makefile
@@ -0,0 +1,28 @@
+#
+# Copyright 2008 Sony Corporation
+#
+#
+# Permission is hereby granted, free of charge, to any person obtaining a copy
+# of this software and associated documentation files (the "Software"), to deal
+# in the Software without restriction, including without limitation the rights
+# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+# copies of the Software, and to permit persons to whom the Software is
+# furnished to do so, subject to the following conditions:
+#
+# The above copyright notice and this permission notice shall be included in
+# all copies or substantial portions of the Software.
+#
+# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+# THE SOFTWARE.
+#
+
+top_srcdir = ../..
+test_objs = host.o mpu.task_eo
+
+include $(top_srcdir)/scripts/config.mk
+include $(top_srcdir)/scripts/rules_item.mk
diff --git a/tests/TFP/TFP_4F_001/host.c b/tests/TFP/TFP_4F_001/host.c
new file mode 100644
index 0000000..dc6f73b
--- /dev/null
+++ b/tests/TFP/TFP_4F_001/host.c
@@ -0,0 +1,85 @@
+/*
+ * Copyright 2008 Sony Corporation
+ *
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a copy
+ * of this software and associated documentation files (the "Software"), to deal
+ * in the Software without restriction, including without limitation the rights
+ * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+ * copies of the Software, and to permit persons to whom the Software is
+ * furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included in
+ * all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+ * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+ * THE SOFTWARE.
+ */
+
+#include <libspe2.h>
+#include <mars/mars.h>
+#include <mars_test.h>
+#include "host_and_mpu.h"
+
+extern spe_program_handle_t mpu_prog;
+
+static struct mars_context *mars;
+static struct mars_task_id task_id;
+static struct mars_task_args task_args;
+static uint64_t queue;
+static uint64_t queue_item[2];
+
+int main(void)
+{
+ int i, exit_code, ret;
+
+ ret = mars_context_create(&mars, 0, 0);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+
+ ret = mars_task_create(
+ mars,
+ &task_id,
+ "4F001",
+ mpu_prog.elf_image,
+ MARS_TASK_CONTEXT_SAVE_ALL);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+
+ ret = mars_task_queue_create(
+ mars,
+ &queue,
+ 16,
+ QUEUE_DEPTH,
+ MARS_TASK_QUEUE_HOST_TO_MPU);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+
+ for (i = 0; i < QUEUE_DEPTH; i++) {
+ queue_item[0] = queue_item[1] = QUEUE_DEPTH-i;
+
+ ret = mars_task_queue_push(queue, queue_item);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+ }
+
+ task_args.type.u64[0] = queue;
+ ret = mars_task_schedule(&task_id, &task_args, 0);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+
+ ret = mars_task_wait(&task_id, &exit_code);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+ MARS_TEST_ASSERT_EQUAL(exit_code, 0);
+
+ ret = mars_task_queue_destroy(queue);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+
+ ret = mars_task_destroy(&task_id);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+
+ ret = mars_context_destroy(mars);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+
+ return 0;
+}
diff --git a/tests/TFP/TFP_4F_001/host_and_mpu.h b/tests/TFP/TFP_4F_001/host_and_mpu.h
new file mode 100644
index 0000000..e565e93
--- /dev/null
+++ b/tests/TFP/TFP_4F_001/host_and_mpu.h
@@ -0,0 +1,24 @@
+/*
+ * Copyright 2008 Sony Corporation
+ *
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a copy
+ * of this software and associated documentation files (the "Software"), to deal
+ * in the Software without restriction, including without limitation the rights
+ * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+ * copies of the Software, and to permit persons to whom the Software is
+ * furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included in
+ * all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+ * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+ * THE SOFTWARE.
+ */
+
+#define QUEUE_DEPTH 16
diff --git a/tests/TFP/TFP_4F_001/mpu.c b/tests/TFP/TFP_4F_001/mpu.c
new file mode 100644
index 0000000..c379bcc
--- /dev/null
+++ b/tests/TFP/TFP_4F_001/mpu.c
@@ -0,0 +1,57 @@
+/*
+ * Copyright 2008 Sony Corporation
+ *
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a copy
+ * of this software and associated documentation files (the "Software"), to deal
+ * in the Software without restriction, including without limitation the rights
+ * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+ * copies of the Software, and to permit persons to whom the Software is
+ * furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included in
+ * all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+ * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+ * THE SOFTWARE.
+ */
+
+#include <string.h>
+#include <mars/mars.h>
+#include "mars_task_test.h"
+#include "host_and_mpu.h"
+
+static uint64_t queue_item[2] __attribute__((aligned(16)));
+
+int mars_task_main(const struct mars_task_args *task_args)
+{
+ uint64_t queue_ea = task_args->type.u64[0];
+ uint32_t count;
+ int ret;
+
+ ret = mars_task_queue_count(queue_ea, &count);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+
+ MARS_TEST_ASSERT(count == QUEUE_DEPTH);
+
+ ret = mars_task_queue_peek(queue_ea, queue_item);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+
+ MARS_TEST_ASSERT(
+ queue_item[0] == QUEUE_DEPTH &&
+ queue_item[1] == QUEUE_DEPTH);
+
+ ret = mars_task_queue_count(queue_ea, &count);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+
+ MARS_TEST_ASSERT(count == QUEUE_DEPTH);
+
+ mars_task_exit(0);
+
+ return 0;
+}
diff --git a/tests/TFP/TFP_4F_002/Makefile b/tests/TFP/TFP_4F_002/Makefile
new file mode 100644
index 0000000..432135a
--- /dev/null
+++ b/tests/TFP/TFP_4F_002/Makefile
@@ -0,0 +1,28 @@
+#
+# Copyright 2008 Sony Corporation
+#
+#
+# Permission is hereby granted, free of charge, to any person obtaining a copy
+# of this software and associated documentation files (the "Software"), to deal
+# in the Software without restriction, including without limitation the rights
+# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+# copies of the Software, and to permit persons to whom the Software is
+# furnished to do so, subject to the following conditions:
+#
+# The above copyright notice and this permission notice shall be included in
+# all copies or substantial portions of the Software.
+#
+# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+# THE SOFTWARE.
+#
+
+top_srcdir = ../..
+test_objs = host.o mpu.task_eo
+
+include $(top_srcdir)/scripts/config.mk
+include $(top_srcdir)/scripts/rules_item.mk
diff --git a/tests/TFP/TFP_4F_002/host.c b/tests/TFP/TFP_4F_002/host.c
new file mode 100644
index 0000000..e02cce8
--- /dev/null
+++ b/tests/TFP/TFP_4F_002/host.c
@@ -0,0 +1,96 @@
+/*
+ * Copyright 2008 Sony Corporation
+ *
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a copy
+ * of this software and associated documentation files (the "Software"), to deal
+ * in the Software without restriction, including without limitation the rights
+ * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+ * copies of the Software, and to permit persons to whom the Software is
+ * furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included in
+ * all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+ * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+ * THE SOFTWARE.
+ */
+
+#include <libspe2.h>
+#include <mars/mars.h>
+#include <mars_test.h>
+#include "host_and_mpu.h"
+
+extern spe_program_handle_t mpu_prog;
+
+static struct mars_context *mars;
+static struct mars_task_id task_id;
+static struct mars_task_args task_args;
+static uint64_t queue;
+static uint64_t queue_item[2];
+
+int main(void)
+{
+ int exit_code, ret;
+ uint32_t count;
+
+ ret = mars_context_create(&mars, 0, 0);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+
+ ret = mars_task_create(
+ mars,
+ &task_id,
+ "4F002",
+ mpu_prog.elf_image,
+ MARS_TASK_CONTEXT_SAVE_ALL);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+
+ ret = mars_task_queue_create(
+ mars,
+ &queue,
+ 16,
+ QUEUE_DEPTH,
+ MARS_TASK_QUEUE_MPU_TO_HOST);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+
+ task_args.type.u64[0] = queue;
+ ret = mars_task_schedule(&task_id, &task_args, 0);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+
+ ret = mars_task_wait(&task_id, &exit_code);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+ MARS_TEST_ASSERT_EQUAL(exit_code, 0);
+
+ ret = mars_task_queue_count(queue, &count);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+
+ MARS_TEST_ASSERT(count == QUEUE_DEPTH);
+
+ ret = mars_task_queue_peek(queue, queue_item);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+
+ MARS_TEST_ASSERT(
+ queue_item[0] == QUEUE_DEPTH &&
+ queue_item[1] == QUEUE_DEPTH);
+
+ ret = mars_task_queue_count(queue, &count);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+
+ MARS_TEST_ASSERT(count == QUEUE_DEPTH);
+
+ ret = mars_task_queue_destroy(queue);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+
+ ret = mars_task_destroy(&task_id);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+
+ ret = mars_context_destroy(mars);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+
+ return 0;
+}
diff --git a/tests/TFP/TFP_4F_002/host_and_mpu.h b/tests/TFP/TFP_4F_002/host_and_mpu.h
new file mode 100644
index 0000000..e565e93
--- /dev/null
+++ b/tests/TFP/TFP_4F_002/host_and_mpu.h
@@ -0,0 +1,24 @@
+/*
+ * Copyright 2008 Sony Corporation
+ *
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a copy
+ * of this software and associated documentation files (the "Software"), to deal
+ * in the Software without restriction, including without limitation the rights
+ * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+ * copies of the Software, and to permit persons to whom the Software is
+ * furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included in
+ * all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+ * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+ * THE SOFTWARE.
+ */
+
+#define QUEUE_DEPTH 16
diff --git a/tests/TFP/TFP_4F_002/mpu.c b/tests/TFP/TFP_4F_002/mpu.c
new file mode 100644
index 0000000..d61f5c8
--- /dev/null
+++ b/tests/TFP/TFP_4F_002/mpu.c
@@ -0,0 +1,46 @@
+/*
+ * Copyright 2008 Sony Corporation
+ *
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a copy
+ * of this software and associated documentation files (the "Software"), to deal
+ * in the Software without restriction, including without limitation the rights
+ * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+ * copies of the Software, and to permit persons to whom the Software is
+ * furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included in
+ * all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+ * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+ * THE SOFTWARE.
+ */
+
+#include <string.h>
+#include <mars/mars.h>
+#include "mars_task_test.h"
+#include "host_and_mpu.h"
+
+static uint64_t queue_item[2] __attribute__((aligned(16)));
+
+int mars_task_main(const struct mars_task_args *task_args)
+{
+ uint64_t queue_ea = task_args->type.u64[0];
+ int i, ret;
+
+ for (i = 0; i < QUEUE_DEPTH; i++) {
+ queue_item[0] = queue_item[1] = QUEUE_DEPTH-i;
+
+ ret = mars_task_queue_push(queue_ea, queue_item);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+ }
+
+ mars_task_exit(0);
+
+ return 0;
+}
diff --git a/tests/TFP/TFP_4F_003/Makefile b/tests/TFP/TFP_4F_003/Makefile
new file mode 100644
index 0000000..ecbce33
--- /dev/null
+++ b/tests/TFP/TFP_4F_003/Makefile
@@ -0,0 +1,28 @@
+#
+# Copyright 2008 Sony Corporation
+#
+#
+# Permission is hereby granted, free of charge, to any person obtaining a copy
+# of this software and associated documentation files (the "Software"), to deal
+# in the Software without restriction, including without limitation the rights
+# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+# copies of the Software, and to permit persons to whom the Software is
+# furnished to do so, subject to the following conditions:
+#
+# The above copyright notice and this permission notice shall be included in
+# all copies or substantial portions of the Software.
+#
+# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+# THE SOFTWARE.
+#
+
+top_srcdir = ../..
+test_objs = host.o mpu1.task_eo mpu2.task_eo
+
+include $(top_srcdir)/scripts/config.mk
+include $(top_srcdir)/scripts/rules_item.mk
diff --git a/tests/TFP/TFP_4F_003/host.c b/tests/TFP/TFP_4F_003/host.c
new file mode 100644
index 0000000..829ccc2
--- /dev/null
+++ b/tests/TFP/TFP_4F_003/host.c
@@ -0,0 +1,97 @@
+/*
+ * Copyright 2008 Sony Corporation
+ *
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a copy
+ * of this software and associated documentation files (the "Software"), to deal
+ * in the Software without restriction, including without limitation the rights
+ * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+ * copies of the Software, and to permit persons to whom the Software is
+ * furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included in
+ * all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+ * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+ * THE SOFTWARE.
+ */
+
+#include <libspe2.h>
+#include <mars/mars.h>
+#include <mars_test.h>
+#include "host_and_mpu.h"
+
+extern spe_program_handle_t mpu1_prog, mpu2_prog;
+
+static struct mars_context *mars;
+static struct mars_task_id pusher_task_id, poper_task_id;
+static struct mars_task_args task_args;
+static uint64_t queue;
+static uint32_t notify[32] __attribute__((aligned(16)));
+
+int main(void)
+{
+ int exit_code, ret;
+
+ ret = mars_context_create(&mars, 0, 0);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+
+ ret = mars_task_create(
+ mars,
+ &pusher_task_id,
+ "4F003",
+ mpu1_prog.elf_image,
+ MARS_TASK_CONTEXT_SAVE_ALL);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+
+ ret = mars_task_create(
+ mars,
+ &poper_task_id,
+ "4F003",
+ mpu2_prog.elf_image,
+ MARS_TASK_CONTEXT_SAVE_ALL);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+
+ ret = mars_task_queue_create(
+ mars,
+ &queue,
+ 16,
+ QUEUE_DEPTH,
+ MARS_TASK_QUEUE_MPU_TO_MPU);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+
+ task_args.type.u64[0] = queue;
+ task_args.type.u64[1] = mars_ptr_to_ea(notify);
+ ret = mars_task_schedule(&pusher_task_id, &task_args, 0);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+
+ ret = mars_task_schedule(&poper_task_id, &task_args, 0);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+
+ ret = mars_task_wait(&pusher_task_id, &exit_code);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+ MARS_TEST_ASSERT_EQUAL(exit_code, 0);
+
+ ret = mars_task_wait(&poper_task_id, &exit_code);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+ MARS_TEST_ASSERT_EQUAL(exit_code, 0);
+
+ ret = mars_task_queue_destroy(queue);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+
+ ret = mars_task_destroy(&pusher_task_id);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+
+ ret = mars_task_destroy(&poper_task_id);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+
+ ret = mars_context_destroy(mars);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+
+ return 0;
+}
diff --git a/tests/TFP/TFP_4F_003/host_and_mpu.h b/tests/TFP/TFP_4F_003/host_and_mpu.h
new file mode 100644
index 0000000..e565e93
--- /dev/null
+++ b/tests/TFP/TFP_4F_003/host_and_mpu.h
@@ -0,0 +1,24 @@
+/*
+ * Copyright 2008 Sony Corporation
+ *
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a copy
+ * of this software and associated documentation files (the "Software"), to deal
+ * in the Software without restriction, including without limitation the rights
+ * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+ * copies of the Software, and to permit persons to whom the Software is
+ * furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included in
+ * all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+ * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+ * THE SOFTWARE.
+ */
+
+#define QUEUE_DEPTH 16
diff --git a/tests/TFP/TFP_4F_003/mpu1.c b/tests/TFP/TFP_4F_003/mpu1.c
new file mode 100644
index 0000000..a3f962c
--- /dev/null
+++ b/tests/TFP/TFP_4F_003/mpu1.c
@@ -0,0 +1,50 @@
+/*
+ * Copyright 2008 Sony Corporation
+ *
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a copy
+ * of this software and associated documentation files (the "Software"), to deal
+ * in the Software without restriction, including without limitation the rights
+ * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+ * copies of the Software, and to permit persons to whom the Software is
+ * furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included in
+ * all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+ * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+ * THE SOFTWARE.
+ */
+
+#include <string.h>
+#include <mars/mars.h>
+#include "mars_task_test.h"
+#include "host_and_mpu.h"
+
+static uint64_t queue_item[2] __attribute__((aligned(16)));
+
+int mars_task_main(const struct mars_task_args *task_args)
+{
+ uint64_t queue_ea = task_args->type.u64[0];
+ uint64_t notify_ea = task_args->type.u64[1];
+ uint32_t i;
+ int ret;
+
+ for (i = 0; i < QUEUE_DEPTH; i++) {
+ queue_item[0] = queue_item[1] = QUEUE_DEPTH-i;
+
+ ret = mars_task_queue_push(queue_ea, queue_item);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+ }
+
+ mars_test_counter_set(notify_ea, 1);
+
+ mars_task_exit(0);
+
+ return 0;
+}
diff --git a/tests/TFP/TFP_4F_003/mpu2.c b/tests/TFP/TFP_4F_003/mpu2.c
new file mode 100644
index 0000000..c66f9ab
--- /dev/null
+++ b/tests/TFP/TFP_4F_003/mpu2.c
@@ -0,0 +1,56 @@
+/*
+ * Copyright 2008 Sony Corporation
+ *
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a copy
+ * of this software and associated documentation files (the "Software"), to deal
+ * in the Software without restriction, including without limitation the rights
+ * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+ * copies of the Software, and to permit persons to whom the Software is
+ * furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included in
+ * all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+ * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+ * THE SOFTWARE.
+ */
+
+#include <string.h>
+#include <mars/mars.h>
+#include "mars_task_test.h"
+#include "host_and_mpu.h"
+
+static uint64_t queue_item[2] __attribute__((aligned(16)));
+
+int mars_task_main(const struct mars_task_args *task_args)
+{
+ uint64_t queue_ea = task_args->type.u64[0];
+ uint64_t notify_ea = task_args->type.u64[1];
+ uint32_t count;
+ int ret;
+
+ mars_test_counter_wait(notify_ea, 1);
+
+ ret = mars_task_queue_count(queue_ea, &count);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+ MARS_TEST_ASSERT(count == QUEUE_DEPTH);
+
+ ret = mars_task_queue_peek(queue_ea, queue_item);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+ MARS_TEST_ASSERT(queue_item[0] == QUEUE_DEPTH &&
+ queue_item[1] == QUEUE_DEPTH);
+
+ ret = mars_task_queue_count(queue_ea, &count);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+ MARS_TEST_ASSERT(count == QUEUE_DEPTH);
+
+ mars_task_exit(0);
+
+ return 0;
+}
diff --git a/tests/TFP/TFP_4F_004/Makefile b/tests/TFP/TFP_4F_004/Makefile
new file mode 100644
index 0000000..432135a
--- /dev/null
+++ b/tests/TFP/TFP_4F_004/Makefile
@@ -0,0 +1,28 @@
+#
+# Copyright 2008 Sony Corporation
+#
+#
+# Permission is hereby granted, free of charge, to any person obtaining a copy
+# of this software and associated documentation files (the "Software"), to deal
+# in the Software without restriction, including without limitation the rights
+# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+# copies of the Software, and to permit persons to whom the Software is
+# furnished to do so, subject to the following conditions:
+#
+# The above copyright notice and this permission notice shall be included in
+# all copies or substantial portions of the Software.
+#
+# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+# THE SOFTWARE.
+#
+
+top_srcdir = ../..
+test_objs = host.o mpu.task_eo
+
+include $(top_srcdir)/scripts/config.mk
+include $(top_srcdir)/scripts/rules_item.mk
diff --git a/tests/TFP/TFP_4F_004/host.c b/tests/TFP/TFP_4F_004/host.c
new file mode 100644
index 0000000..2e83afa
--- /dev/null
+++ b/tests/TFP/TFP_4F_004/host.c
@@ -0,0 +1,90 @@
+/*
+ * Copyright 2008 Sony Corporation
+ *
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a copy
+ * of this software and associated documentation files (the "Software"), to deal
+ * in the Software without restriction, including without limitation the rights
+ * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+ * copies of the Software, and to permit persons to whom the Software is
+ * furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included in
+ * all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+ * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+ * THE SOFTWARE.
+ */
+
+#include <unistd.h>
+#include <libspe2.h>
+#include <mars/mars.h>
+#include <mars_test.h>
+
+#define QUEUE_DEPTH 16
+
+extern spe_program_handle_t mpu_prog;
+
+static struct mars_context *mars;
+static struct mars_task_id task_id;
+static struct mars_task_args task_args;
+static uint64_t queue;
+static uint64_t queue_item[2], mpu_answer __attribute__((aligned(16)));
+
+int main(void)
+{
+ int exit_code, ret;
+
+ ret = mars_context_create(&mars, 0, 0);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+
+ ret = mars_task_create(
+ mars,
+ &task_id,
+ "4F004",
+ mpu_prog.elf_image,
+ MARS_TASK_CONTEXT_SAVE_ALL);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+
+ ret = mars_task_queue_create(
+ mars,
+ &queue,
+ 16,
+ QUEUE_DEPTH,
+ MARS_TASK_QUEUE_HOST_TO_MPU);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+
+ mpu_answer = 0;
+
+ task_args.type.u64[0] = queue;
+ task_args.type.u64[1] = mars_ptr_to_ea(&mpu_answer);
+ ret = mars_task_schedule(&task_id, &task_args, 0);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+
+ usleep(200000);
+
+ mpu_answer = 1;
+
+ ret = mars_task_queue_push(queue, queue_item);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+
+ ret = mars_task_wait(&task_id, &exit_code);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+ MARS_TEST_ASSERT_EQUAL(exit_code, 0);
+
+ ret = mars_task_queue_destroy(queue);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+
+ ret = mars_task_destroy(&task_id);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+
+ ret = mars_context_destroy(mars);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+
+ return 0;
+}
diff --git a/tests/TFP/TFP_4F_004/mpu.c b/tests/TFP/TFP_4F_004/mpu.c
new file mode 100644
index 0000000..a73c9b9
--- /dev/null
+++ b/tests/TFP/TFP_4F_004/mpu.c
@@ -0,0 +1,47 @@
+/*
+ * Copyright 2008 Sony Corporation
+ *
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a copy
+ * of this software and associated documentation files (the "Software"), to deal
+ * in the Software without restriction, including without limitation the rights
+ * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+ * copies of the Software, and to permit persons to whom the Software is
+ * furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included in
+ * all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+ * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+ * THE SOFTWARE.
+ */
+
+#include <string.h>
+#include <spu_mfcio.h>
+#include <mars/mars.h>
+#include "mars_task_test.h"
+
+static uint64_t queue_item[2] __attribute__((aligned(16)));
+
+int mars_task_main(const struct mars_task_args *task_args)
+{
+ uint64_t queue_ea = task_args->type.u64[0];
+ uint64_t mpu_answer_ea = task_args->type.u64[1];
+ uint64_t mpu_answer;
+ int ret;
+
+ ret = mars_task_queue_peek(queue_ea, queue_item);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+
+ mpu_answer = mars_test_int64_get(mpu_answer_ea);
+ MARS_TEST_ASSERT(mpu_answer);
+
+ mars_task_exit(0);
+
+ return 0;
+}
diff --git a/tests/TFP/TFP_4F_005/Makefile b/tests/TFP/TFP_4F_005/Makefile
new file mode 100644
index 0000000..432135a
--- /dev/null
+++ b/tests/TFP/TFP_4F_005/Makefile
@@ -0,0 +1,28 @@
+#
+# Copyright 2008 Sony Corporation
+#
+#
+# Permission is hereby granted, free of charge, to any person obtaining a copy
+# of this software and associated documentation files (the "Software"), to deal
+# in the Software without restriction, including without limitation the rights
+# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+# copies of the Software, and to permit persons to whom the Software is
+# furnished to do so, subject to the following conditions:
+#
+# The above copyright notice and this permission notice shall be included in
+# all copies or substantial portions of the Software.
+#
+# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+# THE SOFTWARE.
+#
+
+top_srcdir = ../..
+test_objs = host.o mpu.task_eo
+
+include $(top_srcdir)/scripts/config.mk
+include $(top_srcdir)/scripts/rules_item.mk
diff --git a/tests/TFP/TFP_4F_005/host.c b/tests/TFP/TFP_4F_005/host.c
new file mode 100644
index 0000000..b16b05b
--- /dev/null
+++ b/tests/TFP/TFP_4F_005/host.c
@@ -0,0 +1,92 @@
+/*
+ * Copyright 2008 Sony Corporation
+ *
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a copy
+ * of this software and associated documentation files (the "Software"), to deal
+ * in the Software without restriction, including without limitation the rights
+ * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+ * copies of the Software, and to permit persons to whom the Software is
+ * furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included in
+ * all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+ * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+ * THE SOFTWARE.
+ */
+
+#include <libspe2.h>
+#include <mars/mars.h>
+#include <mars_test.h>
+
+#define QUEUE_DEPTH 16
+
+extern spe_program_handle_t mpu_prog;
+
+static struct mars_context *mars;
+static struct mars_task_id task_id;
+static struct mars_task_args task_args;
+static uint64_t queue;
+static uint64_t queue_item[2], mpu_answer __attribute__((aligned(16)));
+
+int main(void)
+{
+ int exit_code, ret;
+ uint32_t tb_freq;
+
+ ret = mars_test_get_timebase_freq(&tb_freq);
+ MARS_TEST_ASSERT_EQUAL(ret, 0);
+
+ ret = mars_context_create(&mars, 0, 0);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+
+ ret = mars_task_create(
+ mars,
+ &task_id,
+ "4F005",
+ mpu_prog.elf_image,
+ MARS_TASK_CONTEXT_SAVE_ALL);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+
+ ret = mars_task_queue_create(
+ mars,
+ &queue,
+ 16,
+ QUEUE_DEPTH,
+ MARS_TASK_QUEUE_MPU_TO_HOST);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+
+ mpu_answer = 0;
+
+ task_args.type.u64[0] = queue;
+ task_args.type.u64[1] = mars_ptr_to_ea(&mpu_answer);
+ task_args.type.u64[2] = tb_freq;
+ ret = mars_task_schedule(&task_id, &task_args, 0);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+
+ ret = mars_task_queue_peek(queue, queue_item);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+
+ MARS_TEST_ASSERT(mpu_answer);
+
+ ret = mars_task_wait(&task_id, &exit_code);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+ MARS_TEST_ASSERT_EQUAL(exit_code, 0);
+
+ ret = mars_task_queue_destroy(queue);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+
+ ret = mars_task_destroy(&task_id);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+
+ ret = mars_context_destroy(mars);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+
+ return 0;
+}
diff --git a/tests/TFP/TFP_4F_005/mpu.c b/tests/TFP/TFP_4F_005/mpu.c
new file mode 100644
index 0000000..d3a0be3
--- /dev/null
+++ b/tests/TFP/TFP_4F_005/mpu.c
@@ -0,0 +1,48 @@
+/*
+ * Copyright 2008 Sony Corporation
+ *
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a copy
+ * of this software and associated documentation files (the "Software"), to deal
+ * in the Software without restriction, including without limitation the rights
+ * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+ * copies of the Software, and to permit persons to whom the Software is
+ * furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included in
+ * all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+ * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+ * THE SOFTWARE.
+ */
+
+#include <string.h>
+#include <spu_mfcio.h>
+#include <mars/mars.h>
+#include "mars_task_test.h"
+
+static uint64_t queue_item[2] __attribute__((aligned(16)));
+
+int mars_task_main(const struct mars_task_args *task_args)
+{
+ int ret;
+ uint64_t queue_ea = task_args->type.u64[0];
+ uint64_t mpu_answer_ea = task_args->type.u64[1];
+ uint32_t tb_freq = task_args->type.u64[2];
+
+ mars_test_usleep(tb_freq, 200000);
+
+ mars_test_int64_put(mpu_answer_ea, 1);
+
+ ret = mars_task_queue_push(queue_ea, queue_item);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+
+ mars_task_exit(0);
+
+ return 0;
+}
diff --git a/tests/TFP/TFP_4F_006/Makefile b/tests/TFP/TFP_4F_006/Makefile
new file mode 100644
index 0000000..ecbce33
--- /dev/null
+++ b/tests/TFP/TFP_4F_006/Makefile
@@ -0,0 +1,28 @@
+#
+# Copyright 2008 Sony Corporation
+#
+#
+# Permission is hereby granted, free of charge, to any person obtaining a copy
+# of this software and associated documentation files (the "Software"), to deal
+# in the Software without restriction, including without limitation the rights
+# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+# copies of the Software, and to permit persons to whom the Software is
+# furnished to do so, subject to the following conditions:
+#
+# The above copyright notice and this permission notice shall be included in
+# all copies or substantial portions of the Software.
+#
+# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+# THE SOFTWARE.
+#
+
+top_srcdir = ../..
+test_objs = host.o mpu1.task_eo mpu2.task_eo
+
+include $(top_srcdir)/scripts/config.mk
+include $(top_srcdir)/scripts/rules_item.mk
diff --git a/tests/TFP/TFP_4F_006/host.c b/tests/TFP/TFP_4F_006/host.c
new file mode 100644
index 0000000..2f8b93a
--- /dev/null
+++ b/tests/TFP/TFP_4F_006/host.c
@@ -0,0 +1,105 @@
+/*
+ * Copyright 2008 Sony Corporation
+ *
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a copy
+ * of this software and associated documentation files (the "Software"), to deal
+ * in the Software without restriction, including without limitation the rights
+ * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+ * copies of the Software, and to permit persons to whom the Software is
+ * furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included in
+ * all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+ * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+ * THE SOFTWARE.
+ */
+
+#include <libspe2.h>
+#include <mars/mars.h>
+#include <mars_test.h>
+
+#define QUEUE_DEPTH 16
+
+extern spe_program_handle_t mpu1_prog, mpu2_prog;
+
+static struct mars_context *mars;
+static struct mars_task_id pusher_task_id, poper_task_id;
+static struct mars_task_args task_args;
+static uint64_t queue;
+static uint64_t mpu_answer __attribute__((aligned(16)));
+
+int main(void)
+{
+ int exit_code, ret;
+ uint32_t tb_freq;
+
+ ret = mars_test_get_timebase_freq(&tb_freq);
+ MARS_TEST_ASSERT_EQUAL(ret, 0);
+
+ ret = mars_context_create(&mars, 0, 0);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+
+ ret = mars_task_create(
+ mars,
+ &pusher_task_id,
+ "4F006",
+ mpu1_prog.elf_image,
+ MARS_TASK_CONTEXT_SAVE_ALL);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+
+ ret = mars_task_create(
+ mars,
+ &poper_task_id,
+ "4F006",
+ mpu2_prog.elf_image,
+ MARS_TASK_CONTEXT_SAVE_ALL);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+
+ ret = mars_task_queue_create(
+ mars,
+ &queue,
+ 16,
+ QUEUE_DEPTH,
+ MARS_TASK_QUEUE_MPU_TO_MPU);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+
+ mpu_answer = 0;
+
+ task_args.type.u64[0] = queue;
+ task_args.type.u64[1] = mars_ptr_to_ea(&mpu_answer);
+ task_args.type.u64[2] = tb_freq;
+ ret = mars_task_schedule(&pusher_task_id, &task_args, 0);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+
+ ret = mars_task_schedule(&poper_task_id, &task_args, 0);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+
+ ret = mars_task_wait(&pusher_task_id, &exit_code);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+ MARS_TEST_ASSERT_EQUAL(exit_code, 0);
+
+ ret = mars_task_wait(&poper_task_id, &exit_code);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+ MARS_TEST_ASSERT_EQUAL(exit_code, 0);
+
+ ret = mars_task_queue_destroy(queue);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+
+ ret = mars_task_destroy(&pusher_task_id);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+
+ ret = mars_task_destroy(&poper_task_id);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+
+ ret = mars_context_destroy(mars);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+
+ return 0;
+}
diff --git a/tests/TFP/TFP_4F_006/mpu1.c b/tests/TFP/TFP_4F_006/mpu1.c
new file mode 100644
index 0000000..d3a0be3
--- /dev/null
+++ b/tests/TFP/TFP_4F_006/mpu1.c
@@ -0,0 +1,48 @@
+/*
+ * Copyright 2008 Sony Corporation
+ *
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a copy
+ * of this software and associated documentation files (the "Software"), to deal
+ * in the Software without restriction, including without limitation the rights
+ * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+ * copies of the Software, and to permit persons to whom the Software is
+ * furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included in
+ * all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+ * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+ * THE SOFTWARE.
+ */
+
+#include <string.h>
+#include <spu_mfcio.h>
+#include <mars/mars.h>
+#include "mars_task_test.h"
+
+static uint64_t queue_item[2] __attribute__((aligned(16)));
+
+int mars_task_main(const struct mars_task_args *task_args)
+{
+ int ret;
+ uint64_t queue_ea = task_args->type.u64[0];
+ uint64_t mpu_answer_ea = task_args->type.u64[1];
+ uint32_t tb_freq = task_args->type.u64[2];
+
+ mars_test_usleep(tb_freq, 200000);
+
+ mars_test_int64_put(mpu_answer_ea, 1);
+
+ ret = mars_task_queue_push(queue_ea, queue_item);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+
+ mars_task_exit(0);
+
+ return 0;
+}
diff --git a/tests/TFP/TFP_4F_006/mpu2.c b/tests/TFP/TFP_4F_006/mpu2.c
new file mode 100644
index 0000000..a869642
--- /dev/null
+++ b/tests/TFP/TFP_4F_006/mpu2.c
@@ -0,0 +1,48 @@
+/*
+ * Copyright 2008 Sony Corporation
+ *
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a copy
+ * of this software and associated documentation files (the "Software"), to deal
+ * in the Software without restriction, including without limitation the rights
+ * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+ * copies of the Software, and to permit persons to whom the Software is
+ * furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included in
+ * all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+ * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+ * THE SOFTWARE.
+ */
+
+#include <string.h>
+#include <spu_mfcio.h>
+#include <mars/mars.h>
+#include "mars_task_test.h"
+
+static uint64_t queue_item[2] __attribute__((aligned(16)));
+
+int mars_task_main(const struct mars_task_args *task_args)
+{
+ int ret;
+ uint64_t queue_ea = task_args->type.u64[0];
+ uint64_t mpu_answer_ea = task_args->type.u64[1];
+
+ uint64_t mpu_answer;
+
+ ret = mars_task_queue_peek(queue_ea, queue_item);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+
+ mpu_answer = mars_test_int64_get(mpu_answer_ea);
+ MARS_TEST_ASSERT(mpu_answer);
+
+ mars_task_exit(0);
+
+ return 0;
+}
diff --git a/tests/TFP/TFP_4F_007/Makefile b/tests/TFP/TFP_4F_007/Makefile
new file mode 100644
index 0000000..432135a
--- /dev/null
+++ b/tests/TFP/TFP_4F_007/Makefile
@@ -0,0 +1,28 @@
+#
+# Copyright 2008 Sony Corporation
+#
+#
+# Permission is hereby granted, free of charge, to any person obtaining a copy
+# of this software and associated documentation files (the "Software"), to deal
+# in the Software without restriction, including without limitation the rights
+# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+# copies of the Software, and to permit persons to whom the Software is
+# furnished to do so, subject to the following conditions:
+#
+# The above copyright notice and this permission notice shall be included in
+# all copies or substantial portions of the Software.
+#
+# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+# THE SOFTWARE.
+#
+
+top_srcdir = ../..
+test_objs = host.o mpu.task_eo
+
+include $(top_srcdir)/scripts/config.mk
+include $(top_srcdir)/scripts/rules_item.mk
diff --git a/tests/TFP/TFP_4F_007/host.c b/tests/TFP/TFP_4F_007/host.c
new file mode 100644
index 0000000..c407beb
--- /dev/null
+++ b/tests/TFP/TFP_4F_007/host.c
@@ -0,0 +1,120 @@
+/*
+ * Copyright 2008 Sony Corporation
+ *
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a copy
+ * of this software and associated documentation files (the "Software"), to deal
+ * in the Software without restriction, including without limitation the rights
+ * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+ * copies of the Software, and to permit persons to whom the Software is
+ * furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included in
+ * all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+ * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+ * THE SOFTWARE.
+ */
+
+#include <unistd.h>
+#include <mars/mars.h>
+#include <libspe2.h>
+#include <mars_test.h>
+
+struct queue_entry {
+ uint64_t val1;
+ uint64_t val2;
+};
+#define Q_DEPTH (MARS_TASK_QUEUE_WAIT_MAX)
+
+#define NUM_LOOP 5
+static uint32_t depth_size[] =
+{
+ 1,
+ Q_DEPTH / 2,
+ Q_DEPTH,
+ Q_DEPTH,
+ Q_DEPTH
+};
+extern spe_program_handle_t mpu_prog;
+
+static struct mars_context *mars_ctx;
+static struct mars_task_args task_args;
+static struct mars_task_id task_id[Q_DEPTH];
+
+static uint64_t host_to_mpu[NUM_LOOP];
+static uint32_t notify[32] __attribute((aligned(128)));
+static struct queue_entry data;
+
+int main(void)
+{
+ int ret, i;
+ int32_t exit_code;
+ uint32_t num, count;
+
+ ret = mars_context_create(&mars_ctx, 0, 0);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+
+ for (i = 0; i < NUM_LOOP; i++) {
+ notify[0] = 0;
+
+ ret = mars_task_queue_create(
+ mars_ctx,
+ &host_to_mpu[i],
+ sizeof(struct queue_entry),
+ depth_size[i],
+ MARS_TASK_QUEUE_HOST_TO_MPU);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+
+ /* push queue */
+ data.val1 = i;
+ ret = mars_task_queue_push(host_to_mpu[i], &data);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+
+ for (num = 0; num < depth_size[i]; num++) {
+ /* create peek tasks */
+ /* all tasks will peek the same data */
+ ret = mars_task_create(mars_ctx, &task_id[num], NULL,
+ mpu_prog.elf_image, MARS_TASK_CONTEXT_SAVE_ALL);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+
+ task_args.type.u64[0] = host_to_mpu[i];
+ task_args.type.u64[1] =
+ mars_ptr_to_ea(&notify);
+ task_args.type.u64[2] = (uint64_t)i;
+ ret = mars_task_schedule(&task_id[num], &task_args, 0);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+ }
+
+ /* start mpu tasks at the same time */
+ sleep(1);
+ mars_test_counter_set(&notify[0], 1);
+
+ for (num = 0; num < depth_size[i]; num++) {
+ ret = mars_task_wait(&task_id[num], &exit_code);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+ MARS_TEST_ASSERT_ERROR(exit_code, MARS_SUCCESS);
+
+ ret = mars_task_destroy(&task_id[num]);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+ }
+
+ ret = mars_task_queue_count(host_to_mpu[i], &count);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+ MARS_TEST_ASSERT_EQUAL(count, 1);
+
+ ret = mars_task_queue_destroy(host_to_mpu[i]);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+ }
+
+ ret = mars_context_destroy(mars_ctx);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+
+ return 0;
+}
+
diff --git a/tests/TFP/TFP_4F_007/mpu.c b/tests/TFP/TFP_4F_007/mpu.c
new file mode 100644
index 0000000..2c58f70
--- /dev/null
+++ b/tests/TFP/TFP_4F_007/mpu.c
@@ -0,0 +1,50 @@
+/*
+ * Copyright 2008 Sony Corporation
+ *
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a copy
+ * of this software and associated documentation files (the "Software"), to deal
+ * in the Software without restriction, including without limitation the rights
+ * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+ * copies of the Software, and to permit persons to whom the Software is
+ * furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included in
+ * all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+ * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+ * THE SOFTWARE.
+ */
+
+#include <mars/mars.h>
+#include <mars_task_test.h>
+#include <spu_mfcio.h>
+
+struct queue_entry {
+ uint64_t val1;
+ uint64_t val2;
+};
+static struct queue_entry data;
+
+int mars_task_main(const struct mars_task_args *task_args)
+{
+ int ret;
+ uint64_t host_to_mpu_ea = task_args->type.u64[0];
+ uint64_t notify_ea = task_args->type.u64[1];
+ uint32_t id = (uint32_t)task_args->type.u64[2];
+
+ mars_test_counter_wait(notify_ea, 1);
+
+ ret = mars_task_queue_peek(host_to_mpu_ea, &data);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+
+ /* check the peeked data */
+ MARS_TEST_ASSERT_EQUAL(data.val1, id);
+
+ return 0;
+}
diff --git a/tests/TFP/TFP_4F_008/Makefile b/tests/TFP/TFP_4F_008/Makefile
new file mode 100644
index 0000000..432135a
--- /dev/null
+++ b/tests/TFP/TFP_4F_008/Makefile
@@ -0,0 +1,28 @@
+#
+# Copyright 2008 Sony Corporation
+#
+#
+# Permission is hereby granted, free of charge, to any person obtaining a copy
+# of this software and associated documentation files (the "Software"), to deal
+# in the Software without restriction, including without limitation the rights
+# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+# copies of the Software, and to permit persons to whom the Software is
+# furnished to do so, subject to the following conditions:
+#
+# The above copyright notice and this permission notice shall be included in
+# all copies or substantial portions of the Software.
+#
+# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+# THE SOFTWARE.
+#
+
+top_srcdir = ../..
+test_objs = host.o mpu.task_eo
+
+include $(top_srcdir)/scripts/config.mk
+include $(top_srcdir)/scripts/rules_item.mk
diff --git a/tests/TFP/TFP_4F_008/host.c b/tests/TFP/TFP_4F_008/host.c
new file mode 100644
index 0000000..fdd031a
--- /dev/null
+++ b/tests/TFP/TFP_4F_008/host.c
@@ -0,0 +1,142 @@
+/*
+ * Copyright 2008 Sony Corporation
+ *
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a copy
+ * of this software and associated documentation files (the "Software"), to deal
+ * in the Software without restriction, including without limitation the rights
+ * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+ * copies of the Software, and to permit persons to whom the Software is
+ * furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included in
+ * all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+ * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+ * THE SOFTWARE.
+ */
+
+#include <pthread.h>
+#include <unistd.h>
+#include <mars/mars.h>
+#include <libspe2.h>
+#include <mars_test.h>
+
+struct queue_entry {
+ uint64_t val1;
+ uint64_t val2;
+};
+#define Q_DEPTH (MARS_TASK_QUEUE_WAIT_MAX)
+
+#define NUM_LOOP 5
+static uint32_t depth_size[] =
+{
+ 1,
+ Q_DEPTH / 2,
+ Q_DEPTH,
+ Q_DEPTH,
+ Q_DEPTH
+};
+extern spe_program_handle_t mpu_prog;
+
+static struct mars_context *mars_ctx;
+static struct mars_task_args task_args, thread_args[Q_DEPTH];
+static struct mars_task_id task_id;
+
+static uint64_t mpu_to_host[NUM_LOOP];
+static uint32_t shared_resource __attribute((aligned(16)));
+static struct queue_entry data[Q_DEPTH];
+
+static pthread_t thread[Q_DEPTH];
+static void *thread_proc(void *ptr)
+{
+ int ret;
+ struct mars_task_args *task_args = (struct mars_task_args *)ptr;
+ uint32_t id = (uint32_t)task_args->type.u32[0];
+ uint32_t num = (uint32_t)task_args->type.u32[1];
+
+ /* wait for start */
+ while (!shared_resource)
+ usleep(100);
+
+ ret = mars_task_queue_peek(mpu_to_host[id], &data[num]);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+
+ /* check the peeked data */
+ MARS_TEST_ASSERT_EQUAL(data[num].val1, id);
+
+ return NULL;
+}
+
+int main(void)
+{
+ int ret, i;
+ int32_t exit_code;
+ uint32_t num, count;
+
+ ret = mars_context_create(&mars_ctx, 0, 0);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+
+ for (i = 0; i < NUM_LOOP; i++) {
+ shared_resource = 0;
+
+ ret = mars_task_queue_create(
+ mars_ctx,
+ &mpu_to_host[i],
+ sizeof(struct queue_entry),
+ depth_size[i],
+ MARS_TASK_QUEUE_MPU_TO_HOST);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+
+ /* create push task */
+ ret = mars_task_create(mars_ctx, &task_id, NULL,
+ mpu_prog.elf_image, MARS_TASK_CONTEXT_SAVE_ALL);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+
+ task_args.type.u64[0] = mpu_to_host[i];
+ task_args.type.u64[1] = (uint64_t)i;
+ ret = mars_task_schedule(&task_id, &task_args, 0);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+
+ ret = mars_task_wait(&task_id, &exit_code);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+ MARS_TEST_ASSERT_ERROR(exit_code, MARS_SUCCESS);
+
+ for (num = 0; num < depth_size[i]; num++) {
+ /* create peek thread */
+ /* all threads will peek the same queue */
+ thread_args[num].type.u32[0] = (uint32_t)i;
+ thread_args[num].type.u32[1] = (uint32_t)num;
+ pthread_create(&thread[num], NULL,
+ thread_proc, &thread_args[num]);
+ }
+
+ /* start ppe threads at the same time */
+ sleep(1);
+ shared_resource = 1;
+
+ ret = mars_task_destroy(&task_id);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+
+ for (num = 0; num < depth_size[i]; num++)
+ pthread_join(thread[num], NULL);
+
+ ret = mars_task_queue_count(mpu_to_host[i], &count);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+ MARS_TEST_ASSERT_EQUAL(count, 1);
+
+ ret = mars_task_queue_destroy(mpu_to_host[i]);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+ }
+
+ ret = mars_context_destroy(mars_ctx);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+
+ return 0;
+}
+
diff --git a/tests/TFP/TFP_4F_008/mpu.c b/tests/TFP/TFP_4F_008/mpu.c
new file mode 100644
index 0000000..1bf90b4
--- /dev/null
+++ b/tests/TFP/TFP_4F_008/mpu.c
@@ -0,0 +1,45 @@
+/*
+ * Copyright 2008 Sony Corporation
+ *
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a copy
+ * of this software and associated documentation files (the "Software"), to deal
+ * in the Software without restriction, including without limitation the rights
+ * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+ * copies of the Software, and to permit persons to whom the Software is
+ * furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included in
+ * all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+ * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+ * THE SOFTWARE.
+ */
+
+#include <mars/mars.h>
+#include <mars_task_test.h>
+#include <spu_mfcio.h>
+
+struct queue_entry {
+ uint64_t val1;
+ uint64_t val2;
+};
+static struct queue_entry data;
+
+int mars_task_main(const struct mars_task_args *task_args)
+{
+ int ret;
+ uint64_t mpu_to_host_ea = task_args->type.u64[0];
+ uint32_t id = (uint32_t)task_args->type.u64[1];
+
+ data.val1 = id;
+ ret = mars_task_queue_push(mpu_to_host_ea, &data);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+
+ return 0;
+}
diff --git a/tests/TFP/TFP_4F_009/Makefile b/tests/TFP/TFP_4F_009/Makefile
new file mode 100644
index 0000000..ecbce33
--- /dev/null
+++ b/tests/TFP/TFP_4F_009/Makefile
@@ -0,0 +1,28 @@
+#
+# Copyright 2008 Sony Corporation
+#
+#
+# Permission is hereby granted, free of charge, to any person obtaining a copy
+# of this software and associated documentation files (the "Software"), to deal
+# in the Software without restriction, including without limitation the rights
+# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+# copies of the Software, and to permit persons to whom the Software is
+# furnished to do so, subject to the following conditions:
+#
+# The above copyright notice and this permission notice shall be included in
+# all copies or substantial portions of the Software.
+#
+# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+# THE SOFTWARE.
+#
+
+top_srcdir = ../..
+test_objs = host.o mpu1.task_eo mpu2.task_eo
+
+include $(top_srcdir)/scripts/config.mk
+include $(top_srcdir)/scripts/rules_item.mk
diff --git a/tests/TFP/TFP_4F_009/host.c b/tests/TFP/TFP_4F_009/host.c
new file mode 100644
index 0000000..acb9b31
--- /dev/null
+++ b/tests/TFP/TFP_4F_009/host.c
@@ -0,0 +1,133 @@
+/*
+ * Copyright 2008 Sony Corporation
+ *
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a copy
+ * of this software and associated documentation files (the "Software"), to deal
+ * in the Software without restriction, including without limitation the rights
+ * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+ * copies of the Software, and to permit persons to whom the Software is
+ * furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included in
+ * all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+ * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+ * THE SOFTWARE.
+ */
+
+#include <unistd.h>
+#include <mars/mars.h>
+#include <libspe2.h>
+#include <mars_test.h>
+
+struct queue_entry {
+ uint64_t val1;
+ uint64_t val2;
+};
+#define Q_DEPTH (MARS_TASK_QUEUE_WAIT_MAX)
+
+#define NUM_LOOP 5
+static uint32_t depth_size[] =
+{
+ 1,
+ Q_DEPTH / 2,
+ Q_DEPTH,
+ Q_DEPTH,
+ Q_DEPTH
+};
+extern spe_program_handle_t mpu1_prog;
+extern spe_program_handle_t mpu2_prog;
+
+static struct mars_context *mars_ctx;
+static struct mars_task_args task1_args, task2_args;
+static struct mars_task_id task1_id[Q_DEPTH], task2_id;
+
+static uint64_t mpu_to_mpu[NUM_LOOP];
+static uint32_t notify[32] __attribute((aligned(128)));
+
+int main(void)
+{
+ int ret, i;
+ int32_t exit_code;
+ uint32_t num, count;
+
+ ret = mars_context_create(&mars_ctx, 0, 0);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+
+ for (i = 0; i < NUM_LOOP; i++) {
+ notify[0] = 0;
+
+ ret = mars_task_queue_create(
+ mars_ctx,
+ &mpu_to_mpu[i],
+ sizeof(struct queue_entry),
+ depth_size[i],
+ MARS_TASK_QUEUE_MPU_TO_MPU);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+
+ /* create push task */
+ ret = mars_task_create(mars_ctx, &task2_id, NULL,
+ mpu2_prog.elf_image, MARS_TASK_CONTEXT_SAVE_ALL);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+
+ task2_args.type.u64[0] = mpu_to_mpu[i];
+ task2_args.type.u64[1] = (uint64_t)i;
+ ret = mars_task_schedule(&task2_id, &task2_args, 0);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+
+ ret = mars_task_wait(&task2_id, &exit_code);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+ MARS_TEST_ASSERT_ERROR(exit_code, MARS_SUCCESS);
+
+ for (num = 0; num < depth_size[i]; num++) {
+ /* create peek tasks */
+ /* all tasks will peek the same data */
+ ret = mars_task_create(mars_ctx, &task1_id[num], NULL,
+ mpu1_prog.elf_image, MARS_TASK_CONTEXT_SAVE_ALL);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+
+ task1_args.type.u64[0] = mpu_to_mpu[i];
+ task1_args.type.u64[1] =
+ mars_ptr_to_ea(&notify);
+ task1_args.type.u64[2] = (uint64_t)i;
+ ret = mars_task_schedule(&task1_id[num],
+ &task1_args, 0);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+ }
+
+ /* start peek tasks at the same time */
+ sleep(1);
+ mars_test_counter_set(&notify[0], 1);
+
+ for (num = 0; num < depth_size[i]; num++) {
+ ret = mars_task_wait(&task1_id[num], &exit_code);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+ MARS_TEST_ASSERT_ERROR(exit_code, MARS_SUCCESS);
+
+ ret = mars_task_destroy(&task1_id[num]);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+ }
+
+ ret = mars_task_destroy(&task2_id);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+
+ ret = mars_task_queue_count(mpu_to_mpu[i], &count);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+ MARS_TEST_ASSERT_EQUAL(count, 1);
+
+ ret = mars_task_queue_destroy(mpu_to_mpu[i]);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+ }
+
+ ret = mars_context_destroy(mars_ctx);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+
+ return 0;
+}
+
diff --git a/tests/TFP/TFP_4F_009/mpu1.c b/tests/TFP/TFP_4F_009/mpu1.c
new file mode 100644
index 0000000..9412ea0
--- /dev/null
+++ b/tests/TFP/TFP_4F_009/mpu1.c
@@ -0,0 +1,50 @@
+/*
+ * Copyright 2008 Sony Corporation
+ *
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a copy
+ * of this software and associated documentation files (the "Software"), to deal
+ * in the Software without restriction, including without limitation the rights
+ * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+ * copies of the Software, and to permit persons to whom the Software is
+ * furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included in
+ * all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+ * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+ * THE SOFTWARE.
+ */
+
+#include <mars/mars.h>
+#include <mars_task_test.h>
+#include <spu_mfcio.h>
+
+struct queue_entry {
+ uint64_t val1;
+ uint64_t val2;
+};
+static struct queue_entry data;
+
+int mars_task_main(const struct mars_task_args *task_args)
+{
+ int ret;
+ uint64_t mpu_to_mpu_ea = task_args->type.u64[0];
+ uint64_t notify_ea = task_args->type.u64[1];
+ uint32_t id = (uint32_t)task_args->type.u64[2];
+
+ mars_test_counter_wait(notify_ea, 1);
+
+ ret = mars_task_queue_peek(mpu_to_mpu_ea, &data);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+
+ /* check the peeked data */
+ MARS_TEST_ASSERT_EQUAL(data.val1, id);
+
+ return 0;
+}
diff --git a/tests/TFP/TFP_4F_009/mpu2.c b/tests/TFP/TFP_4F_009/mpu2.c
new file mode 100644
index 0000000..a19ff6e
--- /dev/null
+++ b/tests/TFP/TFP_4F_009/mpu2.c
@@ -0,0 +1,45 @@
+/*
+ * Copyright 2008 Sony Corporation
+ *
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a copy
+ * of this software and associated documentation files (the "Software"), to deal
+ * in the Software without restriction, including without limitation the rights
+ * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+ * copies of the Software, and to permit persons to whom the Software is
+ * furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included in
+ * all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+ * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+ * THE SOFTWARE.
+ */
+
+#include <mars/mars.h>
+#include <mars_task_test.h>
+#include <spu_mfcio.h>
+
+struct queue_entry {
+ uint64_t val1;
+ uint64_t val2;
+};
+static struct queue_entry data;
+
+int mars_task_main(const struct mars_task_args *task_args)
+{
+ int ret;
+ uint64_t mpu_to_mpu_ea = task_args->type.u64[0];
+ uint32_t id = (uint32_t)task_args->type.u64[1];
+
+ data.val1 = id;
+ ret = mars_task_queue_push(mpu_to_mpu_ea, &data);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+
+ return 0;
+}
diff --git a/tests/TFP/TFP_4F_010/Makefile b/tests/TFP/TFP_4F_010/Makefile
new file mode 100644
index 0000000..432135a
--- /dev/null
+++ b/tests/TFP/TFP_4F_010/Makefile
@@ -0,0 +1,28 @@
+#
+# Copyright 2008 Sony Corporation
+#
+#
+# Permission is hereby granted, free of charge, to any person obtaining a copy
+# of this software and associated documentation files (the "Software"), to deal
+# in the Software without restriction, including without limitation the rights
+# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+# copies of the Software, and to permit persons to whom the Software is
+# furnished to do so, subject to the following conditions:
+#
+# The above copyright notice and this permission notice shall be included in
+# all copies or substantial portions of the Software.
+#
+# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+# THE SOFTWARE.
+#
+
+top_srcdir = ../..
+test_objs = host.o mpu.task_eo
+
+include $(top_srcdir)/scripts/config.mk
+include $(top_srcdir)/scripts/rules_item.mk
diff --git a/tests/TFP/TFP_4F_010/host.c b/tests/TFP/TFP_4F_010/host.c
new file mode 100644
index 0000000..c777405
--- /dev/null
+++ b/tests/TFP/TFP_4F_010/host.c
@@ -0,0 +1,108 @@
+/*
+ * Copyright 2008 Sony Corporation
+ *
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a copy
+ * of this software and associated documentation files (the "Software"), to deal
+ * in the Software without restriction, including without limitation the rights
+ * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+ * copies of the Software, and to permit persons to whom the Software is
+ * furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included in
+ * all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+ * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+ * THE SOFTWARE.
+ */
+
+#include <unistd.h>
+#include <mars/mars.h>
+#include <libspe2.h>
+#include <mars_test.h>
+
+struct queue_entry {
+ uint64_t val;
+ uint64_t pad;
+};
+#define Q_DEPTH (256 * 1024)
+
+#define NUM_LOOP 2
+static uint32_t depth_size[] =
+{
+ 1,
+ Q_DEPTH
+};
+extern spe_program_handle_t mpu_prog;
+
+static struct mars_context *mars_ctx;
+static struct mars_task_args task_args;
+static struct mars_task_id task_id;
+
+static uint64_t host_to_mpu[NUM_LOOP];
+static struct queue_entry data;
+
+static uint32_t shared_resource __attribute((aligned(16)));
+
+int main(void)
+{
+ int ret, i;
+ int32_t exit_code;
+
+ ret = mars_context_create(&mars_ctx, 0, 0);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+
+ for (i = 0; i < NUM_LOOP; i++) {
+ shared_resource = 0;
+
+ ret = mars_task_queue_create(
+ mars_ctx,
+ &host_to_mpu[i],
+ sizeof(struct queue_entry),
+ depth_size[i],
+ MARS_TASK_QUEUE_HOST_TO_MPU);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+
+ /* create peek task */
+ ret = mars_task_create(mars_ctx, &task_id, NULL,
+ mpu_prog.elf_image, MARS_TASK_CONTEXT_SAVE_ALL);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+
+ task_args.type.u64[0] = host_to_mpu[i];
+ task_args.type.u64[1] = mars_ptr_to_ea(&shared_resource);
+ task_args.type.u64[2] = (uint64_t)i;
+ ret = mars_task_schedule(&task_id, &task_args, 0);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+
+ /* check if queue peek is blocked in mpu task */
+ sleep(1);
+ MARS_TEST_ASSERT_EQUAL(shared_resource, 0);
+
+ /* push one */
+ data.val = i;
+ ret = mars_task_queue_push(host_to_mpu[i], &data);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+
+ /* check if mpu task is successfly finished */
+ ret = mars_task_wait(&task_id, &exit_code);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+ MARS_TEST_ASSERT_ERROR(exit_code, MARS_SUCCESS);
+
+ ret = mars_task_destroy(&task_id);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+
+ ret = mars_task_queue_destroy(host_to_mpu[i]);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+ }
+
+ ret = mars_context_destroy(mars_ctx);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+
+ return 0;
+}
+
diff --git a/tests/TFP/TFP_4F_010/mpu.c b/tests/TFP/TFP_4F_010/mpu.c
new file mode 100644
index 0000000..61862f5
--- /dev/null
+++ b/tests/TFP/TFP_4F_010/mpu.c
@@ -0,0 +1,60 @@
+/*
+ * Copyright 2008 Sony Corporation
+ *
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a copy
+ * of this software and associated documentation files (the "Software"), to deal
+ * in the Software without restriction, including without limitation the rights
+ * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+ * copies of the Software, and to permit persons to whom the Software is
+ * furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included in
+ * all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+ * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+ * THE SOFTWARE.
+ */
+
+#include <mars/mars.h>
+#include <mars_task_test.h>
+#include <spu_mfcio.h>
+
+struct queue_entry {
+ uint64_t val;
+ uint64_t pad;
+};
+static struct queue_entry data;
+static uint32_t shared_resource __attribute((aligned(16)));
+
+int mars_task_main(const struct mars_task_args *task_args)
+{
+ int ret;
+ uint64_t host_to_mpu_ea = task_args->type.u64[0];
+ uint64_t shared_resource_ea = task_args->type.u64[1];
+ uint64_t val = task_args->type.u64[2];
+ uint32_t count;
+
+ ret = mars_task_queue_peek(host_to_mpu_ea, &data);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+ MARS_TEST_ASSERT_EQUAL(data.val, val);
+
+ /* check queue_count */
+ ret = mars_task_queue_count(host_to_mpu_ea, &count);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+ MARS_TEST_ASSERT_EQUAL(count, 1);
+
+ /* if the program reaches here, shared_resource'll be updated */
+ shared_resource = 1;
+ mfc_put(&shared_resource, shared_resource_ea,
+ sizeof(uint32_t), 0, 0, 0);
+ mfc_write_tag_mask(1 << 0);
+ mfc_read_tag_status_all();
+
+ return 0;
+}
diff --git a/tests/TFP/TFP_4F_011/Makefile b/tests/TFP/TFP_4F_011/Makefile
new file mode 100644
index 0000000..432135a
--- /dev/null
+++ b/tests/TFP/TFP_4F_011/Makefile
@@ -0,0 +1,28 @@
+#
+# Copyright 2008 Sony Corporation
+#
+#
+# Permission is hereby granted, free of charge, to any person obtaining a copy
+# of this software and associated documentation files (the "Software"), to deal
+# in the Software without restriction, including without limitation the rights
+# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+# copies of the Software, and to permit persons to whom the Software is
+# furnished to do so, subject to the following conditions:
+#
+# The above copyright notice and this permission notice shall be included in
+# all copies or substantial portions of the Software.
+#
+# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+# THE SOFTWARE.
+#
+
+top_srcdir = ../..
+test_objs = host.o mpu.task_eo
+
+include $(top_srcdir)/scripts/config.mk
+include $(top_srcdir)/scripts/rules_item.mk
diff --git a/tests/TFP/TFP_4F_011/host.c b/tests/TFP/TFP_4F_011/host.c
new file mode 100644
index 0000000..229b93e
--- /dev/null
+++ b/tests/TFP/TFP_4F_011/host.c
@@ -0,0 +1,133 @@
+/*
+ * Copyright 2008 Sony Corporation
+ *
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a copy
+ * of this software and associated documentation files (the "Software"), to deal
+ * in the Software without restriction, including without limitation the rights
+ * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+ * copies of the Software, and to permit persons to whom the Software is
+ * furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included in
+ * all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+ * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+ * THE SOFTWARE.
+ */
+
+#include <pthread.h>
+#include <unistd.h>
+#include <mars/mars.h>
+#include <libspe2.h>
+#include <mars_test.h>
+
+struct queue_entry {
+ uint64_t val1;
+ uint64_t val2;
+};
+#define Q_DEPTH (256 * 1024)
+
+#define NUM_LOOP 2
+static uint32_t depth_size[] =
+{
+ 1,
+ Q_DEPTH
+};
+extern spe_program_handle_t mpu_prog;
+
+static struct mars_context *mars_ctx;
+static struct mars_task_args task_args, thread_args;
+static struct mars_task_id task_id;
+
+static uint64_t mpu_to_host[NUM_LOOP];
+
+static uint32_t shared_resource __attribute((aligned(16)));
+static struct queue_entry data;
+
+static pthread_t thread;
+static void *thread_proc(void *ptr)
+{
+ int ret;
+ struct mars_task_args *task_args = (struct mars_task_args *)ptr;
+ uint32_t id = (uint32_t)task_args->type.u32[0];
+ uint32_t count;
+
+ ret = mars_task_queue_peek(mpu_to_host[id], &data);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+ MARS_TEST_ASSERT_EQUAL(data.val1, id);
+
+ /* check queue_count */
+ ret = mars_task_queue_count(mpu_to_host[id], &count);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+ MARS_TEST_ASSERT_EQUAL(count, 1);
+
+ /* if the program reaches here, shared_resource'll be updated */
+ shared_resource = 1;
+
+ return NULL;
+}
+
+int main(void)
+{
+ int ret, i;
+ int32_t exit_code;
+
+ ret = mars_context_create(&mars_ctx, 0, 0);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+
+ for (i = 0; i < NUM_LOOP; i++) {
+ shared_resource = 0;
+
+ ret = mars_task_queue_create(
+ mars_ctx,
+ &mpu_to_host[i],
+ sizeof(struct queue_entry),
+ depth_size[i],
+ MARS_TASK_QUEUE_MPU_TO_HOST);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+
+ /* create peek thread */
+ thread_args.type.u32[0] = (uint32_t)i;
+ pthread_create(&thread, NULL, thread_proc, &thread_args);
+
+ /* create push task */
+ ret = mars_task_create(mars_ctx, &task_id, NULL,
+ mpu_prog.elf_image, MARS_TASK_CONTEXT_SAVE_ALL);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+
+ /* check if queue peek is blocked in ppe thread */
+ sleep(1);
+ MARS_TEST_ASSERT_EQUAL(shared_resource, 0);
+
+ /* push one by mpu */
+ task_args.type.u64[0] = mpu_to_host[i];
+ task_args.type.u64[1] = (uint64_t)i;
+ ret = mars_task_schedule(&task_id, &task_args, 0);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+
+ ret = mars_task_wait(&task_id, &exit_code);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+ MARS_TEST_ASSERT_ERROR(exit_code, MARS_SUCCESS);
+
+ /* check if the thread wakes up and finished */
+ pthread_join(thread, NULL);
+
+ ret = mars_task_destroy(&task_id);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+
+ ret = mars_task_queue_destroy(mpu_to_host[i]);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+ }
+
+ ret = mars_context_destroy(mars_ctx);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+
+ return 0;
+}
+
diff --git a/tests/TFP/TFP_4F_011/mpu.c b/tests/TFP/TFP_4F_011/mpu.c
new file mode 100644
index 0000000..4ea6b99
--- /dev/null
+++ b/tests/TFP/TFP_4F_011/mpu.c
@@ -0,0 +1,45 @@
+/*
+ * Copyright 2008 Sony Corporation
+ *
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a copy
+ * of this software and associated documentation files (the "Software"), to deal
+ * in the Software without restriction, including without limitation the rights
+ * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+ * copies of the Software, and to permit persons to whom the Software is
+ * furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included in
+ * all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+ * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+ * THE SOFTWARE.
+ */
+
+#include <mars/mars.h>
+#include <mars_task_test.h>
+#include <spu_mfcio.h>
+
+struct queue_entry {
+ uint64_t val1;
+ uint64_t val2;
+};
+static struct queue_entry data;
+
+int mars_task_main(const struct mars_task_args *task_args)
+{
+ int ret;
+ uint64_t mpu_to_host_ea = task_args->type.u64[0];
+ uint64_t val = task_args->type.u64[1];
+
+ data.val1 = val;
+ ret = mars_task_queue_push(mpu_to_host_ea, &data);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+
+ return 0;
+}
diff --git a/tests/TFP/TFP_4F_012/Makefile b/tests/TFP/TFP_4F_012/Makefile
new file mode 100644
index 0000000..ecbce33
--- /dev/null
+++ b/tests/TFP/TFP_4F_012/Makefile
@@ -0,0 +1,28 @@
+#
+# Copyright 2008 Sony Corporation
+#
+#
+# Permission is hereby granted, free of charge, to any person obtaining a copy
+# of this software and associated documentation files (the "Software"), to deal
+# in the Software without restriction, including without limitation the rights
+# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+# copies of the Software, and to permit persons to whom the Software is
+# furnished to do so, subject to the following conditions:
+#
+# The above copyright notice and this permission notice shall be included in
+# all copies or substantial portions of the Software.
+#
+# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+# THE SOFTWARE.
+#
+
+top_srcdir = ../..
+test_objs = host.o mpu1.task_eo mpu2.task_eo
+
+include $(top_srcdir)/scripts/config.mk
+include $(top_srcdir)/scripts/rules_item.mk
diff --git a/tests/TFP/TFP_4F_012/host.c b/tests/TFP/TFP_4F_012/host.c
new file mode 100644
index 0000000..730cbca
--- /dev/null
+++ b/tests/TFP/TFP_4F_012/host.c
@@ -0,0 +1,127 @@
+/*
+ * Copyright 2008 Sony Corporation
+ *
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a copy
+ * of this software and associated documentation files (the "Software"), to deal
+ * in the Software without restriction, including without limitation the rights
+ * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+ * copies of the Software, and to permit persons to whom the Software is
+ * furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included in
+ * all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+ * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+ * THE SOFTWARE.
+ */
+
+#include <unistd.h>
+#include <mars/mars.h>
+#include <libspe2.h>
+#include <mars_test.h>
+
+struct queue_entry {
+ uint64_t val1;
+ uint64_t val2;
+};
+#define Q_DEPTH (256 * 1024)
+
+#define NUM_LOOP 2
+static uint32_t depth_size[] =
+{
+ 1,
+ Q_DEPTH
+};
+extern spe_program_handle_t mpu1_prog;
+extern spe_program_handle_t mpu2_prog;
+
+static struct mars_context *mars_ctx;
+static struct mars_task_args task1_args, task2_args;
+static struct mars_task_id task1_id, task2_id;
+
+static uint64_t mpu_to_mpu[NUM_LOOP];
+
+static uint32_t shared_resource __attribute((aligned(16)));
+
+int main(void)
+{
+ int ret, i;
+ int32_t exit_code;
+ uint32_t count;
+
+ ret = mars_context_create(&mars_ctx, 0, 0);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+
+ for (i = 0; i < NUM_LOOP; i++) {
+ shared_resource = 0;
+
+ ret = mars_task_queue_create(
+ mars_ctx,
+ &mpu_to_mpu[i],
+ sizeof(struct queue_entry),
+ depth_size[i],
+ MARS_TASK_QUEUE_MPU_TO_MPU);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+
+ /* create peek task */
+ ret = mars_task_create(mars_ctx, &task1_id, NULL,
+ mpu1_prog.elf_image, MARS_TASK_CONTEXT_SAVE_ALL);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+
+ task1_args.type.u64[0] = mpu_to_mpu[i];
+ task1_args.type.u64[1] = mars_ptr_to_ea(&shared_resource);
+ task1_args.type.u64[2] = (uint64_t)i;
+ ret = mars_task_schedule(&task1_id, &task1_args, 0);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+
+ /* create push task */
+ ret = mars_task_create(mars_ctx, &task2_id, NULL,
+ mpu2_prog.elf_image, MARS_TASK_CONTEXT_SAVE_ALL);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+
+ /* check if queue peek is blocked in mpu task */
+ sleep(1);
+ MARS_TEST_ASSERT_EQUAL(shared_resource, 0);
+
+ /* push one by mpu */
+ task2_args.type.u64[0] = mpu_to_mpu[i];
+ task2_args.type.u64[1] = (uint64_t)i;
+ ret = mars_task_schedule(&task2_id, &task2_args, 0);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+
+ ret = mars_task_wait(&task2_id, &exit_code);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+ MARS_TEST_ASSERT_ERROR(exit_code, MARS_SUCCESS);
+
+ /* check if peek task is successfly finished */
+ ret = mars_task_wait(&task1_id, &exit_code);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+ MARS_TEST_ASSERT_ERROR(exit_code, MARS_SUCCESS);
+
+ /* queue count should be 1 */
+ ret = mars_task_queue_count(mpu_to_mpu[i], &count);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+ MARS_TEST_ASSERT_EQUAL(count, 1);
+
+ ret = mars_task_destroy(&task1_id);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+
+ ret = mars_task_destroy(&task2_id);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+
+ ret = mars_task_queue_destroy(mpu_to_mpu[i]);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+ }
+
+ ret = mars_context_destroy(mars_ctx);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+
+ return 0;
+}
+
diff --git a/tests/TFP/TFP_4F_012/mpu1.c b/tests/TFP/TFP_4F_012/mpu1.c
new file mode 100644
index 0000000..41a8567
--- /dev/null
+++ b/tests/TFP/TFP_4F_012/mpu1.c
@@ -0,0 +1,54 @@
+/*
+ * Copyright 2008 Sony Corporation
+ *
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a copy
+ * of this software and associated documentation files (the "Software"), to deal
+ * in the Software without restriction, including without limitation the rights
+ * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+ * copies of the Software, and to permit persons to whom the Software is
+ * furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included in
+ * all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+ * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+ * THE SOFTWARE.
+ */
+
+#include <mars/mars.h>
+#include <mars_task_test.h>
+#include <spu_mfcio.h>
+
+struct queue_entry {
+ uint64_t val;
+ uint64_t pad;
+};
+static struct queue_entry data;
+static uint32_t shared_resource __attribute((aligned(16)));
+
+int mars_task_main(const struct mars_task_args *task_args)
+{
+ int ret;
+ uint64_t mpu_to_mpu_ea = task_args->type.u64[0];
+ uint64_t shared_resource_ea = task_args->type.u64[1];
+ uint64_t val = task_args->type.u64[2];
+
+ ret = mars_task_queue_peek(mpu_to_mpu_ea, &data);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+ MARS_TEST_ASSERT_EQUAL(data.val, val);
+
+ /* if the program reaches here, shared_resource'll be updated */
+ shared_resource = 1;
+ mfc_put(&shared_resource, shared_resource_ea,
+ sizeof(uint32_t), 0, 0, 0);
+ mfc_write_tag_mask(1 << 0);
+ mfc_read_tag_status_all();
+
+ return 0;
+}
diff --git a/tests/TFP/TFP_4F_012/mpu2.c b/tests/TFP/TFP_4F_012/mpu2.c
new file mode 100644
index 0000000..fb4a992
--- /dev/null
+++ b/tests/TFP/TFP_4F_012/mpu2.c
@@ -0,0 +1,45 @@
+/*
+ * Copyright 2008 Sony Corporation
+ *
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a copy
+ * of this software and associated documentation files (the "Software"), to deal
+ * in the Software without restriction, including without limitation the rights
+ * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+ * copies of the Software, and to permit persons to whom the Software is
+ * furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included in
+ * all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+ * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+ * THE SOFTWARE.
+ */
+
+#include <mars/mars.h>
+#include <mars_task_test.h>
+#include <spu_mfcio.h>
+
+struct queue_entry {
+ uint64_t val1;
+ uint64_t val2;
+};
+static struct queue_entry data;
+
+int mars_task_main(const struct mars_task_args *task_args)
+{
+ int ret;
+ uint64_t mpu_to_mpu_ea = task_args->type.u64[0];
+ uint64_t val = task_args->type.u64[1];
+
+ data.val1 = val;
+ ret = mars_task_queue_push(mpu_to_mpu_ea, &data);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+
+ return 0;
+}
diff --git a/tests/TFP/TFP_4F_013/Makefile b/tests/TFP/TFP_4F_013/Makefile
new file mode 100644
index 0000000..432135a
--- /dev/null
+++ b/tests/TFP/TFP_4F_013/Makefile
@@ -0,0 +1,28 @@
+#
+# Copyright 2008 Sony Corporation
+#
+#
+# Permission is hereby granted, free of charge, to any person obtaining a copy
+# of this software and associated documentation files (the "Software"), to deal
+# in the Software without restriction, including without limitation the rights
+# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+# copies of the Software, and to permit persons to whom the Software is
+# furnished to do so, subject to the following conditions:
+#
+# The above copyright notice and this permission notice shall be included in
+# all copies or substantial portions of the Software.
+#
+# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+# THE SOFTWARE.
+#
+
+top_srcdir = ../..
+test_objs = host.o mpu.task_eo
+
+include $(top_srcdir)/scripts/config.mk
+include $(top_srcdir)/scripts/rules_item.mk
diff --git a/tests/TFP/TFP_4F_013/host.c b/tests/TFP/TFP_4F_013/host.c
new file mode 100644
index 0000000..229b93e
--- /dev/null
+++ b/tests/TFP/TFP_4F_013/host.c
@@ -0,0 +1,133 @@
+/*
+ * Copyright 2008 Sony Corporation
+ *
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a copy
+ * of this software and associated documentation files (the "Software"), to deal
+ * in the Software without restriction, including without limitation the rights
+ * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+ * copies of the Software, and to permit persons to whom the Software is
+ * furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included in
+ * all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+ * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+ * THE SOFTWARE.
+ */
+
+#include <pthread.h>
+#include <unistd.h>
+#include <mars/mars.h>
+#include <libspe2.h>
+#include <mars_test.h>
+
+struct queue_entry {
+ uint64_t val1;
+ uint64_t val2;
+};
+#define Q_DEPTH (256 * 1024)
+
+#define NUM_LOOP 2
+static uint32_t depth_size[] =
+{
+ 1,
+ Q_DEPTH
+};
+extern spe_program_handle_t mpu_prog;
+
+static struct mars_context *mars_ctx;
+static struct mars_task_args task_args, thread_args;
+static struct mars_task_id task_id;
+
+static uint64_t mpu_to_host[NUM_LOOP];
+
+static uint32_t shared_resource __attribute((aligned(16)));
+static struct queue_entry data;
+
+static pthread_t thread;
+static void *thread_proc(void *ptr)
+{
+ int ret;
+ struct mars_task_args *task_args = (struct mars_task_args *)ptr;
+ uint32_t id = (uint32_t)task_args->type.u32[0];
+ uint32_t count;
+
+ ret = mars_task_queue_peek(mpu_to_host[id], &data);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+ MARS_TEST_ASSERT_EQUAL(data.val1, id);
+
+ /* check queue_count */
+ ret = mars_task_queue_count(mpu_to_host[id], &count);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+ MARS_TEST_ASSERT_EQUAL(count, 1);
+
+ /* if the program reaches here, shared_resource'll be updated */
+ shared_resource = 1;
+
+ return NULL;
+}
+
+int main(void)
+{
+ int ret, i;
+ int32_t exit_code;
+
+ ret = mars_context_create(&mars_ctx, 0, 0);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+
+ for (i = 0; i < NUM_LOOP; i++) {
+ shared_resource = 0;
+
+ ret = mars_task_queue_create(
+ mars_ctx,
+ &mpu_to_host[i],
+ sizeof(struct queue_entry),
+ depth_size[i],
+ MARS_TASK_QUEUE_MPU_TO_HOST);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+
+ /* create peek thread */
+ thread_args.type.u32[0] = (uint32_t)i;
+ pthread_create(&thread, NULL, thread_proc, &thread_args);
+
+ /* create push task */
+ ret = mars_task_create(mars_ctx, &task_id, NULL,
+ mpu_prog.elf_image, MARS_TASK_CONTEXT_SAVE_ALL);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+
+ /* check if queue peek is blocked in ppe thread */
+ sleep(1);
+ MARS_TEST_ASSERT_EQUAL(shared_resource, 0);
+
+ /* push one by mpu */
+ task_args.type.u64[0] = mpu_to_host[i];
+ task_args.type.u64[1] = (uint64_t)i;
+ ret = mars_task_schedule(&task_id, &task_args, 0);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+
+ ret = mars_task_wait(&task_id, &exit_code);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+ MARS_TEST_ASSERT_ERROR(exit_code, MARS_SUCCESS);
+
+ /* check if the thread wakes up and finished */
+ pthread_join(thread, NULL);
+
+ ret = mars_task_destroy(&task_id);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+
+ ret = mars_task_queue_destroy(mpu_to_host[i]);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+ }
+
+ ret = mars_context_destroy(mars_ctx);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+
+ return 0;
+}
+
diff --git a/tests/TFP/TFP_4F_013/mpu.c b/tests/TFP/TFP_4F_013/mpu.c
new file mode 100644
index 0000000..9bab286
--- /dev/null
+++ b/tests/TFP/TFP_4F_013/mpu.c
@@ -0,0 +1,48 @@
+/*
+ * Copyright 2008 Sony Corporation
+ *
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a copy
+ * of this software and associated documentation files (the "Software"), to deal
+ * in the Software without restriction, including without limitation the rights
+ * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+ * copies of the Software, and to permit persons to whom the Software is
+ * furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included in
+ * all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+ * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+ * THE SOFTWARE.
+ */
+
+#include <mars/mars.h>
+#include <mars_task_test.h>
+#include <spu_mfcio.h>
+
+struct queue_entry {
+ uint64_t val1;
+ uint64_t val2;
+};
+static struct queue_entry data;
+
+int mars_task_main(const struct mars_task_args *task_args)
+{
+ int ret;
+ uint64_t mpu_to_host_ea = task_args->type.u64[0];
+ uint64_t val = task_args->type.u64[1];
+
+ data.val1 = val;
+ ret = mars_task_queue_push_begin(mpu_to_host_ea, &data, 1);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+
+ ret = mars_task_queue_push_end(mpu_to_host_ea, 1);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+
+ return 0;
+}
diff --git a/tests/TFP/TFP_4F_014/Makefile b/tests/TFP/TFP_4F_014/Makefile
new file mode 100644
index 0000000..ecbce33
--- /dev/null
+++ b/tests/TFP/TFP_4F_014/Makefile
@@ -0,0 +1,28 @@
+#
+# Copyright 2008 Sony Corporation
+#
+#
+# Permission is hereby granted, free of charge, to any person obtaining a copy
+# of this software and associated documentation files (the "Software"), to deal
+# in the Software without restriction, including without limitation the rights
+# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+# copies of the Software, and to permit persons to whom the Software is
+# furnished to do so, subject to the following conditions:
+#
+# The above copyright notice and this permission notice shall be included in
+# all copies or substantial portions of the Software.
+#
+# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+# THE SOFTWARE.
+#
+
+top_srcdir = ../..
+test_objs = host.o mpu1.task_eo mpu2.task_eo
+
+include $(top_srcdir)/scripts/config.mk
+include $(top_srcdir)/scripts/rules_item.mk
diff --git a/tests/TFP/TFP_4F_014/host.c b/tests/TFP/TFP_4F_014/host.c
new file mode 100644
index 0000000..730cbca
--- /dev/null
+++ b/tests/TFP/TFP_4F_014/host.c
@@ -0,0 +1,127 @@
+/*
+ * Copyright 2008 Sony Corporation
+ *
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a copy
+ * of this software and associated documentation files (the "Software"), to deal
+ * in the Software without restriction, including without limitation the rights
+ * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+ * copies of the Software, and to permit persons to whom the Software is
+ * furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included in
+ * all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+ * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+ * THE SOFTWARE.
+ */
+
+#include <unistd.h>
+#include <mars/mars.h>
+#include <libspe2.h>
+#include <mars_test.h>
+
+struct queue_entry {
+ uint64_t val1;
+ uint64_t val2;
+};
+#define Q_DEPTH (256 * 1024)
+
+#define NUM_LOOP 2
+static uint32_t depth_size[] =
+{
+ 1,
+ Q_DEPTH
+};
+extern spe_program_handle_t mpu1_prog;
+extern spe_program_handle_t mpu2_prog;
+
+static struct mars_context *mars_ctx;
+static struct mars_task_args task1_args, task2_args;
+static struct mars_task_id task1_id, task2_id;
+
+static uint64_t mpu_to_mpu[NUM_LOOP];
+
+static uint32_t shared_resource __attribute((aligned(16)));
+
+int main(void)
+{
+ int ret, i;
+ int32_t exit_code;
+ uint32_t count;
+
+ ret = mars_context_create(&mars_ctx, 0, 0);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+
+ for (i = 0; i < NUM_LOOP; i++) {
+ shared_resource = 0;
+
+ ret = mars_task_queue_create(
+ mars_ctx,
+ &mpu_to_mpu[i],
+ sizeof(struct queue_entry),
+ depth_size[i],
+ MARS_TASK_QUEUE_MPU_TO_MPU);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+
+ /* create peek task */
+ ret = mars_task_create(mars_ctx, &task1_id, NULL,
+ mpu1_prog.elf_image, MARS_TASK_CONTEXT_SAVE_ALL);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+
+ task1_args.type.u64[0] = mpu_to_mpu[i];
+ task1_args.type.u64[1] = mars_ptr_to_ea(&shared_resource);
+ task1_args.type.u64[2] = (uint64_t)i;
+ ret = mars_task_schedule(&task1_id, &task1_args, 0);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+
+ /* create push task */
+ ret = mars_task_create(mars_ctx, &task2_id, NULL,
+ mpu2_prog.elf_image, MARS_TASK_CONTEXT_SAVE_ALL);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+
+ /* check if queue peek is blocked in mpu task */
+ sleep(1);
+ MARS_TEST_ASSERT_EQUAL(shared_resource, 0);
+
+ /* push one by mpu */
+ task2_args.type.u64[0] = mpu_to_mpu[i];
+ task2_args.type.u64[1] = (uint64_t)i;
+ ret = mars_task_schedule(&task2_id, &task2_args, 0);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+
+ ret = mars_task_wait(&task2_id, &exit_code);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+ MARS_TEST_ASSERT_ERROR(exit_code, MARS_SUCCESS);
+
+ /* check if peek task is successfly finished */
+ ret = mars_task_wait(&task1_id, &exit_code);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+ MARS_TEST_ASSERT_ERROR(exit_code, MARS_SUCCESS);
+
+ /* queue count should be 1 */
+ ret = mars_task_queue_count(mpu_to_mpu[i], &count);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+ MARS_TEST_ASSERT_EQUAL(count, 1);
+
+ ret = mars_task_destroy(&task1_id);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+
+ ret = mars_task_destroy(&task2_id);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+
+ ret = mars_task_queue_destroy(mpu_to_mpu[i]);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+ }
+
+ ret = mars_context_destroy(mars_ctx);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+
+ return 0;
+}
+
diff --git a/tests/TFP/TFP_4F_014/mpu1.c b/tests/TFP/TFP_4F_014/mpu1.c
new file mode 100644
index 0000000..41a8567
--- /dev/null
+++ b/tests/TFP/TFP_4F_014/mpu1.c
@@ -0,0 +1,54 @@
+/*
+ * Copyright 2008 Sony Corporation
+ *
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a copy
+ * of this software and associated documentation files (the "Software"), to deal
+ * in the Software without restriction, including without limitation the rights
+ * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+ * copies of the Software, and to permit persons to whom the Software is
+ * furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included in
+ * all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+ * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+ * THE SOFTWARE.
+ */
+
+#include <mars/mars.h>
+#include <mars_task_test.h>
+#include <spu_mfcio.h>
+
+struct queue_entry {
+ uint64_t val;
+ uint64_t pad;
+};
+static struct queue_entry data;
+static uint32_t shared_resource __attribute((aligned(16)));
+
+int mars_task_main(const struct mars_task_args *task_args)
+{
+ int ret;
+ uint64_t mpu_to_mpu_ea = task_args->type.u64[0];
+ uint64_t shared_resource_ea = task_args->type.u64[1];
+ uint64_t val = task_args->type.u64[2];
+
+ ret = mars_task_queue_peek(mpu_to_mpu_ea, &data);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+ MARS_TEST_ASSERT_EQUAL(data.val, val);
+
+ /* if the program reaches here, shared_resource'll be updated */
+ shared_resource = 1;
+ mfc_put(&shared_resource, shared_resource_ea,
+ sizeof(uint32_t), 0, 0, 0);
+ mfc_write_tag_mask(1 << 0);
+ mfc_read_tag_status_all();
+
+ return 0;
+}
diff --git a/tests/TFP/TFP_4F_014/mpu2.c b/tests/TFP/TFP_4F_014/mpu2.c
new file mode 100644
index 0000000..d8e04bc
--- /dev/null
+++ b/tests/TFP/TFP_4F_014/mpu2.c
@@ -0,0 +1,48 @@
+/*
+ * Copyright 2008 Sony Corporation
+ *
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a copy
+ * of this software and associated documentation files (the "Software"), to deal
+ * in the Software without restriction, including without limitation the rights
+ * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+ * copies of the Software, and to permit persons to whom the Software is
+ * furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included in
+ * all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+ * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+ * THE SOFTWARE.
+ */
+
+#include <mars/mars.h>
+#include <mars_task_test.h>
+#include <spu_mfcio.h>
+
+struct queue_entry {
+ uint64_t val1;
+ uint64_t val2;
+};
+static struct queue_entry data;
+
+int mars_task_main(const struct mars_task_args *task_args)
+{
+ int ret;
+ uint64_t mpu_to_mpu_ea = task_args->type.u64[0];
+ uint64_t val = task_args->type.u64[1];
+
+ data.val1 = val;
+ ret = mars_task_queue_push_begin(mpu_to_mpu_ea, &data, 1);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+
+ ret = mars_task_queue_push_end(mpu_to_mpu_ea, 1);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+
+ return 0;
+}
diff --git a/tests/TFP/TFP_4F_015/Makefile b/tests/TFP/TFP_4F_015/Makefile
new file mode 100644
index 0000000..432135a
--- /dev/null
+++ b/tests/TFP/TFP_4F_015/Makefile
@@ -0,0 +1,28 @@
+#
+# Copyright 2008 Sony Corporation
+#
+#
+# Permission is hereby granted, free of charge, to any person obtaining a copy
+# of this software and associated documentation files (the "Software"), to deal
+# in the Software without restriction, including without limitation the rights
+# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+# copies of the Software, and to permit persons to whom the Software is
+# furnished to do so, subject to the following conditions:
+#
+# The above copyright notice and this permission notice shall be included in
+# all copies or substantial portions of the Software.
+#
+# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+# THE SOFTWARE.
+#
+
+top_srcdir = ../..
+test_objs = host.o mpu.task_eo
+
+include $(top_srcdir)/scripts/config.mk
+include $(top_srcdir)/scripts/rules_item.mk
diff --git a/tests/TFP/TFP_4F_015/host.c b/tests/TFP/TFP_4F_015/host.c
new file mode 100644
index 0000000..827c0e0
--- /dev/null
+++ b/tests/TFP/TFP_4F_015/host.c
@@ -0,0 +1,108 @@
+/*
+ * Copyright 2008 Sony Corporation
+ *
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a copy
+ * of this software and associated documentation files (the "Software"), to deal
+ * in the Software without restriction, including without limitation the rights
+ * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+ * copies of the Software, and to permit persons to whom the Software is
+ * furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included in
+ * all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+ * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+ * THE SOFTWARE.
+ */
+
+#include <unistd.h>
+#include <mars/mars.h>
+#include <libspe2.h>
+#include <mars_test.h>
+
+struct queue_entry {
+ uint64_t val;
+ uint64_t pad;
+};
+#define Q_DEPTH (256 * 1024)
+
+#define NUM_LOOP 2
+static uint32_t depth_size[] =
+{
+ 1,
+ Q_DEPTH
+};
+extern spe_program_handle_t mpu_prog;
+
+static struct mars_context *mars_ctx;
+static struct mars_task_args task_args;
+static struct mars_task_id task_id;
+
+static uint64_t host_to_mpu[NUM_LOOP];
+static struct queue_entry data;
+
+static uint32_t shared_resource __attribute((aligned(16)));
+
+int main(void)
+{
+ int ret, i;
+ int32_t exit_code;
+
+ ret = mars_context_create(&mars_ctx, 0, 0);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+
+ for (i = 0; i < NUM_LOOP; i++) {
+ shared_resource = 0;
+
+ ret = mars_task_queue_create(
+ mars_ctx,
+ &host_to_mpu[i],
+ sizeof(struct queue_entry),
+ depth_size[i],
+ MARS_TASK_QUEUE_HOST_TO_MPU);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+
+ /* create peek task */
+ ret = mars_task_create(mars_ctx, &task_id, NULL,
+ mpu_prog.elf_image, MARS_TASK_CONTEXT_SAVE_ALL);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+
+ task_args.type.u64[0] = host_to_mpu[i];
+ task_args.type.u64[1] = mars_ptr_to_ea(&shared_resource);
+ task_args.type.u64[2] = (uint64_t)i;
+ ret = mars_task_schedule(&task_id, &task_args, 0);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+
+ /* check if queue peek is blocked in mpu task */
+ sleep(1);
+ MARS_TEST_ASSERT_EQUAL(shared_resource, 0);
+
+ /* try_push one */
+ data.val = i;
+ ret = mars_task_queue_try_push(host_to_mpu[i], &data);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+
+ /* check if mpu task is successfly finished */
+ ret = mars_task_wait(&task_id, &exit_code);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+ MARS_TEST_ASSERT_ERROR(exit_code, MARS_SUCCESS);
+
+ ret = mars_task_destroy(&task_id);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+
+ ret = mars_task_queue_destroy(host_to_mpu[i]);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+ }
+
+ ret = mars_context_destroy(mars_ctx);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+
+ return 0;
+}
+
diff --git a/tests/TFP/TFP_4F_015/mpu.c b/tests/TFP/TFP_4F_015/mpu.c
new file mode 100644
index 0000000..61862f5
--- /dev/null
+++ b/tests/TFP/TFP_4F_015/mpu.c
@@ -0,0 +1,60 @@
+/*
+ * Copyright 2008 Sony Corporation
+ *
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a copy
+ * of this software and associated documentation files (the "Software"), to deal
+ * in the Software without restriction, including without limitation the rights
+ * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+ * copies of the Software, and to permit persons to whom the Software is
+ * furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included in
+ * all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+ * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+ * THE SOFTWARE.
+ */
+
+#include <mars/mars.h>
+#include <mars_task_test.h>
+#include <spu_mfcio.h>
+
+struct queue_entry {
+ uint64_t val;
+ uint64_t pad;
+};
+static struct queue_entry data;
+static uint32_t shared_resource __attribute((aligned(16)));
+
+int mars_task_main(const struct mars_task_args *task_args)
+{
+ int ret;
+ uint64_t host_to_mpu_ea = task_args->type.u64[0];
+ uint64_t shared_resource_ea = task_args->type.u64[1];
+ uint64_t val = task_args->type.u64[2];
+ uint32_t count;
+
+ ret = mars_task_queue_peek(host_to_mpu_ea, &data);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+ MARS_TEST_ASSERT_EQUAL(data.val, val);
+
+ /* check queue_count */
+ ret = mars_task_queue_count(host_to_mpu_ea, &count);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+ MARS_TEST_ASSERT_EQUAL(count, 1);
+
+ /* if the program reaches here, shared_resource'll be updated */
+ shared_resource = 1;
+ mfc_put(&shared_resource, shared_resource_ea,
+ sizeof(uint32_t), 0, 0, 0);
+ mfc_write_tag_mask(1 << 0);
+ mfc_read_tag_status_all();
+
+ return 0;
+}
diff --git a/tests/TFP/TFP_4F_016/Makefile b/tests/TFP/TFP_4F_016/Makefile
new file mode 100644
index 0000000..432135a
--- /dev/null
+++ b/tests/TFP/TFP_4F_016/Makefile
@@ -0,0 +1,28 @@
+#
+# Copyright 2008 Sony Corporation
+#
+#
+# Permission is hereby granted, free of charge, to any person obtaining a copy
+# of this software and associated documentation files (the "Software"), to deal
+# in the Software without restriction, including without limitation the rights
+# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+# copies of the Software, and to permit persons to whom the Software is
+# furnished to do so, subject to the following conditions:
+#
+# The above copyright notice and this permission notice shall be included in
+# all copies or substantial portions of the Software.
+#
+# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+# THE SOFTWARE.
+#
+
+top_srcdir = ../..
+test_objs = host.o mpu.task_eo
+
+include $(top_srcdir)/scripts/config.mk
+include $(top_srcdir)/scripts/rules_item.mk
diff --git a/tests/TFP/TFP_4F_016/host.c b/tests/TFP/TFP_4F_016/host.c
new file mode 100644
index 0000000..d09fecc
--- /dev/null
+++ b/tests/TFP/TFP_4F_016/host.c
@@ -0,0 +1,133 @@
+/*
+ * Copyright 2008 Sony Corporation
+ *
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a copy
+ * of this software and associated documentation files (the "Software"), to deal
+ * in the Software without restriction, including without limitation the rights
+ * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+ * copies of the Software, and to permit persons to whom the Software is
+ * furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included in
+ * all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+ * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+ * THE SOFTWARE.
+ */
+
+#include <pthread.h>
+#include <unistd.h>
+#include <mars/mars.h>
+#include <libspe2.h>
+#include <mars_test.h>
+
+struct queue_entry {
+ uint64_t val1;
+ uint64_t val2;
+};
+#define Q_DEPTH (256 * 1024)
+
+#define NUM_LOOP 2
+static uint32_t depth_size[] =
+{
+ 1,
+ Q_DEPTH
+};
+extern spe_program_handle_t mpu_prog;
+
+static struct mars_context *mars_ctx;
+static struct mars_task_args task_args, thread_args;
+static struct mars_task_id task_id;
+
+static uint64_t mpu_to_host[NUM_LOOP];
+
+static uint32_t shared_resource __attribute((aligned(16)));
+static struct queue_entry data;
+
+static pthread_t thread;
+static void *thread_proc(void *ptr)
+{
+ int ret;
+ struct mars_task_args *task_args = (struct mars_task_args *)ptr;
+ uint32_t id = (uint32_t)task_args->type.u32[0];
+ uint32_t count;
+
+ ret = mars_task_queue_peek(mpu_to_host[id], &data);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+ MARS_TEST_ASSERT_EQUAL(data.val1, id);
+
+ /* check queue_count */
+ ret = mars_task_queue_count(mpu_to_host[id], &count);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+ MARS_TEST_ASSERT_EQUAL(count, 1);
+
+ /* if the program reaches here, shared_resource'll be updated */
+ shared_resource = 1;
+
+ return NULL;
+}
+
+int main(void)
+{
+ int ret, i;
+ int32_t exit_code;
+
+ ret = mars_context_create(&mars_ctx, 0, 0);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+
+ for (i = 0; i < NUM_LOOP; i++) {
+ shared_resource = 0;
+
+ ret = mars_task_queue_create(
+ mars_ctx,
+ &mpu_to_host[i],
+ sizeof(struct queue_entry),
+ depth_size[i],
+ MARS_TASK_QUEUE_MPU_TO_HOST);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+
+ /* create peek thread */
+ thread_args.type.u32[0] = (uint32_t)i;
+ pthread_create(&thread, NULL, thread_proc, &thread_args);
+
+ /* create try_push task */
+ ret = mars_task_create(mars_ctx, &task_id, NULL,
+ mpu_prog.elf_image, MARS_TASK_CONTEXT_SAVE_ALL);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+
+ /* check if queue peek is blocked in ppe thread */
+ sleep(1);
+ MARS_TEST_ASSERT_EQUAL(shared_resource, 0);
+
+ /* try_push one by mpu */
+ task_args.type.u64[0] = mpu_to_host[i];
+ task_args.type.u64[1] = (uint64_t)i;
+ ret = mars_task_schedule(&task_id, &task_args, 0);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+
+ ret = mars_task_wait(&task_id, &exit_code);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+ MARS_TEST_ASSERT_ERROR(exit_code, MARS_SUCCESS);
+
+ /* check if the thread wakes up and finished */
+ pthread_join(thread, NULL);
+
+ ret = mars_task_destroy(&task_id);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+
+ ret = mars_task_queue_destroy(mpu_to_host[i]);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+ }
+
+ ret = mars_context_destroy(mars_ctx);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+
+ return 0;
+}
+
diff --git a/tests/TFP/TFP_4F_016/mpu.c b/tests/TFP/TFP_4F_016/mpu.c
new file mode 100644
index 0000000..9f5f393
--- /dev/null
+++ b/tests/TFP/TFP_4F_016/mpu.c
@@ -0,0 +1,45 @@
+/*
+ * Copyright 2008 Sony Corporation
+ *
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a copy
+ * of this software and associated documentation files (the "Software"), to deal
+ * in the Software without restriction, including without limitation the rights
+ * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+ * copies of the Software, and to permit persons to whom the Software is
+ * furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included in
+ * all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+ * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+ * THE SOFTWARE.
+ */
+
+#include <mars/mars.h>
+#include <mars_task_test.h>
+#include <spu_mfcio.h>
+
+struct queue_entry {
+ uint64_t val1;
+ uint64_t val2;
+};
+static struct queue_entry data;
+
+int mars_task_main(const struct mars_task_args *task_args)
+{
+ int ret;
+ uint64_t mpu_to_host_ea = task_args->type.u64[0];
+ uint64_t val = task_args->type.u64[1];
+
+ data.val1 = val;
+ ret = mars_task_queue_try_push(mpu_to_host_ea, &data);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+
+ return 0;
+}
diff --git a/tests/TFP/TFP_4F_017/Makefile b/tests/TFP/TFP_4F_017/Makefile
new file mode 100644
index 0000000..ecbce33
--- /dev/null
+++ b/tests/TFP/TFP_4F_017/Makefile
@@ -0,0 +1,28 @@
+#
+# Copyright 2008 Sony Corporation
+#
+#
+# Permission is hereby granted, free of charge, to any person obtaining a copy
+# of this software and associated documentation files (the "Software"), to deal
+# in the Software without restriction, including without limitation the rights
+# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+# copies of the Software, and to permit persons to whom the Software is
+# furnished to do so, subject to the following conditions:
+#
+# The above copyright notice and this permission notice shall be included in
+# all copies or substantial portions of the Software.
+#
+# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+# THE SOFTWARE.
+#
+
+top_srcdir = ../..
+test_objs = host.o mpu1.task_eo mpu2.task_eo
+
+include $(top_srcdir)/scripts/config.mk
+include $(top_srcdir)/scripts/rules_item.mk
diff --git a/tests/TFP/TFP_4F_017/host.c b/tests/TFP/TFP_4F_017/host.c
new file mode 100644
index 0000000..730cbca
--- /dev/null
+++ b/tests/TFP/TFP_4F_017/host.c
@@ -0,0 +1,127 @@
+/*
+ * Copyright 2008 Sony Corporation
+ *
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a copy
+ * of this software and associated documentation files (the "Software"), to deal
+ * in the Software without restriction, including without limitation the rights
+ * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+ * copies of the Software, and to permit persons to whom the Software is
+ * furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included in
+ * all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+ * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+ * THE SOFTWARE.
+ */
+
+#include <unistd.h>
+#include <mars/mars.h>
+#include <libspe2.h>
+#include <mars_test.h>
+
+struct queue_entry {
+ uint64_t val1;
+ uint64_t val2;
+};
+#define Q_DEPTH (256 * 1024)
+
+#define NUM_LOOP 2
+static uint32_t depth_size[] =
+{
+ 1,
+ Q_DEPTH
+};
+extern spe_program_handle_t mpu1_prog;
+extern spe_program_handle_t mpu2_prog;
+
+static struct mars_context *mars_ctx;
+static struct mars_task_args task1_args, task2_args;
+static struct mars_task_id task1_id, task2_id;
+
+static uint64_t mpu_to_mpu[NUM_LOOP];
+
+static uint32_t shared_resource __attribute((aligned(16)));
+
+int main(void)
+{
+ int ret, i;
+ int32_t exit_code;
+ uint32_t count;
+
+ ret = mars_context_create(&mars_ctx, 0, 0);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+
+ for (i = 0; i < NUM_LOOP; i++) {
+ shared_resource = 0;
+
+ ret = mars_task_queue_create(
+ mars_ctx,
+ &mpu_to_mpu[i],
+ sizeof(struct queue_entry),
+ depth_size[i],
+ MARS_TASK_QUEUE_MPU_TO_MPU);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+
+ /* create peek task */
+ ret = mars_task_create(mars_ctx, &task1_id, NULL,
+ mpu1_prog.elf_image, MARS_TASK_CONTEXT_SAVE_ALL);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+
+ task1_args.type.u64[0] = mpu_to_mpu[i];
+ task1_args.type.u64[1] = mars_ptr_to_ea(&shared_resource);
+ task1_args.type.u64[2] = (uint64_t)i;
+ ret = mars_task_schedule(&task1_id, &task1_args, 0);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+
+ /* create push task */
+ ret = mars_task_create(mars_ctx, &task2_id, NULL,
+ mpu2_prog.elf_image, MARS_TASK_CONTEXT_SAVE_ALL);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+
+ /* check if queue peek is blocked in mpu task */
+ sleep(1);
+ MARS_TEST_ASSERT_EQUAL(shared_resource, 0);
+
+ /* push one by mpu */
+ task2_args.type.u64[0] = mpu_to_mpu[i];
+ task2_args.type.u64[1] = (uint64_t)i;
+ ret = mars_task_schedule(&task2_id, &task2_args, 0);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+
+ ret = mars_task_wait(&task2_id, &exit_code);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+ MARS_TEST_ASSERT_ERROR(exit_code, MARS_SUCCESS);
+
+ /* check if peek task is successfly finished */
+ ret = mars_task_wait(&task1_id, &exit_code);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+ MARS_TEST_ASSERT_ERROR(exit_code, MARS_SUCCESS);
+
+ /* queue count should be 1 */
+ ret = mars_task_queue_count(mpu_to_mpu[i], &count);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+ MARS_TEST_ASSERT_EQUAL(count, 1);
+
+ ret = mars_task_destroy(&task1_id);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+
+ ret = mars_task_destroy(&task2_id);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+
+ ret = mars_task_queue_destroy(mpu_to_mpu[i]);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+ }
+
+ ret = mars_context_destroy(mars_ctx);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+
+ return 0;
+}
+
diff --git a/tests/TFP/TFP_4F_017/mpu1.c b/tests/TFP/TFP_4F_017/mpu1.c
new file mode 100644
index 0000000..41a8567
--- /dev/null
+++ b/tests/TFP/TFP_4F_017/mpu1.c
@@ -0,0 +1,54 @@
+/*
+ * Copyright 2008 Sony Corporation
+ *
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a copy
+ * of this software and associated documentation files (the "Software"), to deal
+ * in the Software without restriction, including without limitation the rights
+ * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+ * copies of the Software, and to permit persons to whom the Software is
+ * furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included in
+ * all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+ * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+ * THE SOFTWARE.
+ */
+
+#include <mars/mars.h>
+#include <mars_task_test.h>
+#include <spu_mfcio.h>
+
+struct queue_entry {
+ uint64_t val;
+ uint64_t pad;
+};
+static struct queue_entry data;
+static uint32_t shared_resource __attribute((aligned(16)));
+
+int mars_task_main(const struct mars_task_args *task_args)
+{
+ int ret;
+ uint64_t mpu_to_mpu_ea = task_args->type.u64[0];
+ uint64_t shared_resource_ea = task_args->type.u64[1];
+ uint64_t val = task_args->type.u64[2];
+
+ ret = mars_task_queue_peek(mpu_to_mpu_ea, &data);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+ MARS_TEST_ASSERT_EQUAL(data.val, val);
+
+ /* if the program reaches here, shared_resource'll be updated */
+ shared_resource = 1;
+ mfc_put(&shared_resource, shared_resource_ea,
+ sizeof(uint32_t), 0, 0, 0);
+ mfc_write_tag_mask(1 << 0);
+ mfc_read_tag_status_all();
+
+ return 0;
+}
diff --git a/tests/TFP/TFP_4F_017/mpu2.c b/tests/TFP/TFP_4F_017/mpu2.c
new file mode 100644
index 0000000..2e84740
--- /dev/null
+++ b/tests/TFP/TFP_4F_017/mpu2.c
@@ -0,0 +1,45 @@
+/*
+ * Copyright 2008 Sony Corporation
+ *
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a copy
+ * of this software and associated documentation files (the "Software"), to deal
+ * in the Software without restriction, including without limitation the rights
+ * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+ * copies of the Software, and to permit persons to whom the Software is
+ * furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included in
+ * all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+ * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+ * THE SOFTWARE.
+ */
+
+#include <mars/mars.h>
+#include <mars_task_test.h>
+#include <spu_mfcio.h>
+
+struct queue_entry {
+ uint64_t val1;
+ uint64_t val2;
+};
+static struct queue_entry data;
+
+int mars_task_main(const struct mars_task_args *task_args)
+{
+ int ret;
+ uint64_t mpu_to_mpu_ea = task_args->type.u64[0];
+ uint64_t val = task_args->type.u64[1];
+
+ data.val1 = val;
+ ret = mars_task_queue_try_push(mpu_to_mpu_ea, &data);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+
+ return 0;
+}
diff --git a/tests/TFP/TFP_4F_018/Makefile b/tests/TFP/TFP_4F_018/Makefile
new file mode 100644
index 0000000..432135a
--- /dev/null
+++ b/tests/TFP/TFP_4F_018/Makefile
@@ -0,0 +1,28 @@
+#
+# Copyright 2008 Sony Corporation
+#
+#
+# Permission is hereby granted, free of charge, to any person obtaining a copy
+# of this software and associated documentation files (the "Software"), to deal
+# in the Software without restriction, including without limitation the rights
+# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+# copies of the Software, and to permit persons to whom the Software is
+# furnished to do so, subject to the following conditions:
+#
+# The above copyright notice and this permission notice shall be included in
+# all copies or substantial portions of the Software.
+#
+# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+# THE SOFTWARE.
+#
+
+top_srcdir = ../..
+test_objs = host.o mpu.task_eo
+
+include $(top_srcdir)/scripts/config.mk
+include $(top_srcdir)/scripts/rules_item.mk
diff --git a/tests/TFP/TFP_4F_018/host.c b/tests/TFP/TFP_4F_018/host.c
new file mode 100644
index 0000000..229b93e
--- /dev/null
+++ b/tests/TFP/TFP_4F_018/host.c
@@ -0,0 +1,133 @@
+/*
+ * Copyright 2008 Sony Corporation
+ *
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a copy
+ * of this software and associated documentation files (the "Software"), to deal
+ * in the Software without restriction, including without limitation the rights
+ * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+ * copies of the Software, and to permit persons to whom the Software is
+ * furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included in
+ * all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+ * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+ * THE SOFTWARE.
+ */
+
+#include <pthread.h>
+#include <unistd.h>
+#include <mars/mars.h>
+#include <libspe2.h>
+#include <mars_test.h>
+
+struct queue_entry {
+ uint64_t val1;
+ uint64_t val2;
+};
+#define Q_DEPTH (256 * 1024)
+
+#define NUM_LOOP 2
+static uint32_t depth_size[] =
+{
+ 1,
+ Q_DEPTH
+};
+extern spe_program_handle_t mpu_prog;
+
+static struct mars_context *mars_ctx;
+static struct mars_task_args task_args, thread_args;
+static struct mars_task_id task_id;
+
+static uint64_t mpu_to_host[NUM_LOOP];
+
+static uint32_t shared_resource __attribute((aligned(16)));
+static struct queue_entry data;
+
+static pthread_t thread;
+static void *thread_proc(void *ptr)
+{
+ int ret;
+ struct mars_task_args *task_args = (struct mars_task_args *)ptr;
+ uint32_t id = (uint32_t)task_args->type.u32[0];
+ uint32_t count;
+
+ ret = mars_task_queue_peek(mpu_to_host[id], &data);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+ MARS_TEST_ASSERT_EQUAL(data.val1, id);
+
+ /* check queue_count */
+ ret = mars_task_queue_count(mpu_to_host[id], &count);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+ MARS_TEST_ASSERT_EQUAL(count, 1);
+
+ /* if the program reaches here, shared_resource'll be updated */
+ shared_resource = 1;
+
+ return NULL;
+}
+
+int main(void)
+{
+ int ret, i;
+ int32_t exit_code;
+
+ ret = mars_context_create(&mars_ctx, 0, 0);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+
+ for (i = 0; i < NUM_LOOP; i++) {
+ shared_resource = 0;
+
+ ret = mars_task_queue_create(
+ mars_ctx,
+ &mpu_to_host[i],
+ sizeof(struct queue_entry),
+ depth_size[i],
+ MARS_TASK_QUEUE_MPU_TO_HOST);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+
+ /* create peek thread */
+ thread_args.type.u32[0] = (uint32_t)i;
+ pthread_create(&thread, NULL, thread_proc, &thread_args);
+
+ /* create push task */
+ ret = mars_task_create(mars_ctx, &task_id, NULL,
+ mpu_prog.elf_image, MARS_TASK_CONTEXT_SAVE_ALL);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+
+ /* check if queue peek is blocked in ppe thread */
+ sleep(1);
+ MARS_TEST_ASSERT_EQUAL(shared_resource, 0);
+
+ /* push one by mpu */
+ task_args.type.u64[0] = mpu_to_host[i];
+ task_args.type.u64[1] = (uint64_t)i;
+ ret = mars_task_schedule(&task_id, &task_args, 0);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+
+ ret = mars_task_wait(&task_id, &exit_code);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+ MARS_TEST_ASSERT_ERROR(exit_code, MARS_SUCCESS);
+
+ /* check if the thread wakes up and finished */
+ pthread_join(thread, NULL);
+
+ ret = mars_task_destroy(&task_id);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+
+ ret = mars_task_queue_destroy(mpu_to_host[i]);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+ }
+
+ ret = mars_context_destroy(mars_ctx);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+
+ return 0;
+}
+
diff --git a/tests/TFP/TFP_4F_018/mpu.c b/tests/TFP/TFP_4F_018/mpu.c
new file mode 100644
index 0000000..2b49c2d
--- /dev/null
+++ b/tests/TFP/TFP_4F_018/mpu.c
@@ -0,0 +1,48 @@
+/*
+ * Copyright 2008 Sony Corporation
+ *
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a copy
+ * of this software and associated documentation files (the "Software"), to deal
+ * in the Software without restriction, including without limitation the rights
+ * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+ * copies of the Software, and to permit persons to whom the Software is
+ * furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included in
+ * all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+ * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+ * THE SOFTWARE.
+ */
+
+#include <mars/mars.h>
+#include <mars_task_test.h>
+#include <spu_mfcio.h>
+
+struct queue_entry {
+ uint64_t val1;
+ uint64_t val2;
+};
+static struct queue_entry data;
+
+int mars_task_main(const struct mars_task_args *task_args)
+{
+ int ret;
+ uint64_t mpu_to_host_ea = task_args->type.u64[0];
+ uint64_t val = task_args->type.u64[1];
+
+ data.val1 = val;
+ ret = mars_task_queue_try_push_begin(mpu_to_host_ea, &data, 1);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+
+ ret = mars_task_queue_push_end(mpu_to_host_ea, 1);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+
+ return 0;
+}
diff --git a/tests/TFP/TFP_4F_019/Makefile b/tests/TFP/TFP_4F_019/Makefile
new file mode 100644
index 0000000..ecbce33
--- /dev/null
+++ b/tests/TFP/TFP_4F_019/Makefile
@@ -0,0 +1,28 @@
+#
+# Copyright 2008 Sony Corporation
+#
+#
+# Permission is hereby granted, free of charge, to any person obtaining a copy
+# of this software and associated documentation files (the "Software"), to deal
+# in the Software without restriction, including without limitation the rights
+# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+# copies of the Software, and to permit persons to whom the Software is
+# furnished to do so, subject to the following conditions:
+#
+# The above copyright notice and this permission notice shall be included in
+# all copies or substantial portions of the Software.
+#
+# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+# THE SOFTWARE.
+#
+
+top_srcdir = ../..
+test_objs = host.o mpu1.task_eo mpu2.task_eo
+
+include $(top_srcdir)/scripts/config.mk
+include $(top_srcdir)/scripts/rules_item.mk
diff --git a/tests/TFP/TFP_4F_019/host.c b/tests/TFP/TFP_4F_019/host.c
new file mode 100644
index 0000000..730cbca
--- /dev/null
+++ b/tests/TFP/TFP_4F_019/host.c
@@ -0,0 +1,127 @@
+/*
+ * Copyright 2008 Sony Corporation
+ *
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a copy
+ * of this software and associated documentation files (the "Software"), to deal
+ * in the Software without restriction, including without limitation the rights
+ * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+ * copies of the Software, and to permit persons to whom the Software is
+ * furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included in
+ * all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+ * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+ * THE SOFTWARE.
+ */
+
+#include <unistd.h>
+#include <mars/mars.h>
+#include <libspe2.h>
+#include <mars_test.h>
+
+struct queue_entry {
+ uint64_t val1;
+ uint64_t val2;
+};
+#define Q_DEPTH (256 * 1024)
+
+#define NUM_LOOP 2
+static uint32_t depth_size[] =
+{
+ 1,
+ Q_DEPTH
+};
+extern spe_program_handle_t mpu1_prog;
+extern spe_program_handle_t mpu2_prog;
+
+static struct mars_context *mars_ctx;
+static struct mars_task_args task1_args, task2_args;
+static struct mars_task_id task1_id, task2_id;
+
+static uint64_t mpu_to_mpu[NUM_LOOP];
+
+static uint32_t shared_resource __attribute((aligned(16)));
+
+int main(void)
+{
+ int ret, i;
+ int32_t exit_code;
+ uint32_t count;
+
+ ret = mars_context_create(&mars_ctx, 0, 0);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+
+ for (i = 0; i < NUM_LOOP; i++) {
+ shared_resource = 0;
+
+ ret = mars_task_queue_create(
+ mars_ctx,
+ &mpu_to_mpu[i],
+ sizeof(struct queue_entry),
+ depth_size[i],
+ MARS_TASK_QUEUE_MPU_TO_MPU);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+
+ /* create peek task */
+ ret = mars_task_create(mars_ctx, &task1_id, NULL,
+ mpu1_prog.elf_image, MARS_TASK_CONTEXT_SAVE_ALL);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+
+ task1_args.type.u64[0] = mpu_to_mpu[i];
+ task1_args.type.u64[1] = mars_ptr_to_ea(&shared_resource);
+ task1_args.type.u64[2] = (uint64_t)i;
+ ret = mars_task_schedule(&task1_id, &task1_args, 0);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+
+ /* create push task */
+ ret = mars_task_create(mars_ctx, &task2_id, NULL,
+ mpu2_prog.elf_image, MARS_TASK_CONTEXT_SAVE_ALL);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+
+ /* check if queue peek is blocked in mpu task */
+ sleep(1);
+ MARS_TEST_ASSERT_EQUAL(shared_resource, 0);
+
+ /* push one by mpu */
+ task2_args.type.u64[0] = mpu_to_mpu[i];
+ task2_args.type.u64[1] = (uint64_t)i;
+ ret = mars_task_schedule(&task2_id, &task2_args, 0);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+
+ ret = mars_task_wait(&task2_id, &exit_code);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+ MARS_TEST_ASSERT_ERROR(exit_code, MARS_SUCCESS);
+
+ /* check if peek task is successfly finished */
+ ret = mars_task_wait(&task1_id, &exit_code);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+ MARS_TEST_ASSERT_ERROR(exit_code, MARS_SUCCESS);
+
+ /* queue count should be 1 */
+ ret = mars_task_queue_count(mpu_to_mpu[i], &count);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+ MARS_TEST_ASSERT_EQUAL(count, 1);
+
+ ret = mars_task_destroy(&task1_id);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+
+ ret = mars_task_destroy(&task2_id);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+
+ ret = mars_task_queue_destroy(mpu_to_mpu[i]);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+ }
+
+ ret = mars_context_destroy(mars_ctx);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+
+ return 0;
+}
+
diff --git a/tests/TFP/TFP_4F_019/mpu1.c b/tests/TFP/TFP_4F_019/mpu1.c
new file mode 100644
index 0000000..41a8567
--- /dev/null
+++ b/tests/TFP/TFP_4F_019/mpu1.c
@@ -0,0 +1,54 @@
+/*
+ * Copyright 2008 Sony Corporation
+ *
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a copy
+ * of this software and associated documentation files (the "Software"), to deal
+ * in the Software without restriction, including without limitation the rights
+ * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+ * copies of the Software, and to permit persons to whom the Software is
+ * furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included in
+ * all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+ * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+ * THE SOFTWARE.
+ */
+
+#include <mars/mars.h>
+#include <mars_task_test.h>
+#include <spu_mfcio.h>
+
+struct queue_entry {
+ uint64_t val;
+ uint64_t pad;
+};
+static struct queue_entry data;
+static uint32_t shared_resource __attribute((aligned(16)));
+
+int mars_task_main(const struct mars_task_args *task_args)
+{
+ int ret;
+ uint64_t mpu_to_mpu_ea = task_args->type.u64[0];
+ uint64_t shared_resource_ea = task_args->type.u64[1];
+ uint64_t val = task_args->type.u64[2];
+
+ ret = mars_task_queue_peek(mpu_to_mpu_ea, &data);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+ MARS_TEST_ASSERT_EQUAL(data.val, val);
+
+ /* if the program reaches here, shared_resource'll be updated */
+ shared_resource = 1;
+ mfc_put(&shared_resource, shared_resource_ea,
+ sizeof(uint32_t), 0, 0, 0);
+ mfc_write_tag_mask(1 << 0);
+ mfc_read_tag_status_all();
+
+ return 0;
+}
diff --git a/tests/TFP/TFP_4F_019/mpu2.c b/tests/TFP/TFP_4F_019/mpu2.c
new file mode 100644
index 0000000..2e2124b
--- /dev/null
+++ b/tests/TFP/TFP_4F_019/mpu2.c
@@ -0,0 +1,48 @@
+/*
+ * Copyright 2008 Sony Corporation
+ *
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a copy
+ * of this software and associated documentation files (the "Software"), to deal
+ * in the Software without restriction, including without limitation the rights
+ * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+ * copies of the Software, and to permit persons to whom the Software is
+ * furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included in
+ * all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+ * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+ * THE SOFTWARE.
+ */
+
+#include <mars/mars.h>
+#include <mars_task_test.h>
+#include <spu_mfcio.h>
+
+struct queue_entry {
+ uint64_t val1;
+ uint64_t val2;
+};
+static struct queue_entry data;
+
+int mars_task_main(const struct mars_task_args *task_args)
+{
+ int ret;
+ uint64_t mpu_to_mpu_ea = task_args->type.u64[0];
+ uint64_t val = task_args->type.u64[1];
+
+ data.val1 = val;
+ ret = mars_task_queue_try_push_begin(mpu_to_mpu_ea, &data, 1);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+
+ ret = mars_task_queue_push_end(mpu_to_mpu_ea, 1);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+
+ return 0;
+}
diff --git a/tests/TFP/TFP_4G_001/Makefile b/tests/TFP/TFP_4G_001/Makefile
new file mode 100644
index 0000000..432135a
--- /dev/null
+++ b/tests/TFP/TFP_4G_001/Makefile
@@ -0,0 +1,28 @@
+#
+# Copyright 2008 Sony Corporation
+#
+#
+# Permission is hereby granted, free of charge, to any person obtaining a copy
+# of this software and associated documentation files (the "Software"), to deal
+# in the Software without restriction, including without limitation the rights
+# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+# copies of the Software, and to permit persons to whom the Software is
+# furnished to do so, subject to the following conditions:
+#
+# The above copyright notice and this permission notice shall be included in
+# all copies or substantial portions of the Software.
+#
+# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+# THE SOFTWARE.
+#
+
+top_srcdir = ../..
+test_objs = host.o mpu.task_eo
+
+include $(top_srcdir)/scripts/config.mk
+include $(top_srcdir)/scripts/rules_item.mk
diff --git a/tests/TFP/TFP_4G_001/host.c b/tests/TFP/TFP_4G_001/host.c
new file mode 100644
index 0000000..2ea8c6c
--- /dev/null
+++ b/tests/TFP/TFP_4G_001/host.c
@@ -0,0 +1,85 @@
+/*
+ * Copyright 2008 Sony Corporation
+ *
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a copy
+ * of this software and associated documentation files (the "Software"), to deal
+ * in the Software without restriction, including without limitation the rights
+ * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+ * copies of the Software, and to permit persons to whom the Software is
+ * furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included in
+ * all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+ * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+ * THE SOFTWARE.
+ */
+
+#include <libspe2.h>
+#include <mars/mars.h>
+#include <mars_test.h>
+#include "host_and_mpu.h"
+
+extern spe_program_handle_t mpu_prog;
+
+static struct mars_context *mars;
+static struct mars_task_id task_id;
+static struct mars_task_args task_args;
+static uint64_t queue;
+static uint64_t queue_item[2];
+
+int main(void)
+{
+ int i, exit_code, ret;
+
+ ret = mars_context_create(&mars, 0, 0);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+
+ ret = mars_task_create(
+ mars,
+ &task_id,
+ "4G001",
+ mpu_prog.elf_image,
+ MARS_TASK_CONTEXT_SAVE_ALL);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+
+ ret = mars_task_queue_create(
+ mars,
+ &queue,
+ 16,
+ QUEUE_DEPTH,
+ MARS_TASK_QUEUE_HOST_TO_MPU);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+
+ for (i = 0; i < QUEUE_DEPTH; i++) {
+ queue_item[0] = queue_item[1] = QUEUE_DEPTH-i;
+
+ ret = mars_task_queue_push(queue, queue_item);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+ }
+
+ task_args.type.u64[0] = queue;
+ ret = mars_task_schedule(&task_id, &task_args, 0);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+
+ ret = mars_task_wait(&task_id, &exit_code);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+ MARS_TEST_ASSERT_EQUAL(exit_code, 0);
+
+ ret = mars_task_queue_destroy(queue);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+
+ ret = mars_task_destroy(&task_id);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+
+ ret = mars_context_destroy(mars);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+
+ return 0;
+}
diff --git a/tests/TFP/TFP_4G_001/host_and_mpu.h b/tests/TFP/TFP_4G_001/host_and_mpu.h
new file mode 100644
index 0000000..e565e93
--- /dev/null
+++ b/tests/TFP/TFP_4G_001/host_and_mpu.h
@@ -0,0 +1,24 @@
+/*
+ * Copyright 2008 Sony Corporation
+ *
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a copy
+ * of this software and associated documentation files (the "Software"), to deal
+ * in the Software without restriction, including without limitation the rights
+ * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+ * copies of the Software, and to permit persons to whom the Software is
+ * furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included in
+ * all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+ * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+ * THE SOFTWARE.
+ */
+
+#define QUEUE_DEPTH 16
diff --git a/tests/TFP/TFP_4G_001/mpu.c b/tests/TFP/TFP_4G_001/mpu.c
new file mode 100644
index 0000000..8b42bd6
--- /dev/null
+++ b/tests/TFP/TFP_4G_001/mpu.c
@@ -0,0 +1,60 @@
+/*
+ * Copyright 2008 Sony Corporation
+ *
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a copy
+ * of this software and associated documentation files (the "Software"), to deal
+ * in the Software without restriction, including without limitation the rights
+ * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+ * copies of the Software, and to permit persons to whom the Software is
+ * furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included in
+ * all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+ * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+ * THE SOFTWARE.
+ */
+
+#include <string.h>
+#include <mars/mars.h>
+#include "mars_task_test.h"
+#include "host_and_mpu.h"
+
+static uint64_t queue_item[2] __attribute__((aligned(16)));
+
+int mars_task_main(const struct mars_task_args *task_args)
+{
+ uint64_t queue_ea = task_args->type.u64[0];
+ uint32_t count;
+ int ret;
+
+ ret = mars_task_queue_count(queue_ea, &count);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+
+ MARS_TEST_ASSERT(count == QUEUE_DEPTH);
+
+ ret = mars_task_queue_peek_begin(queue_ea, queue_item, 0);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+
+ ret = mars_task_queue_peek_end(queue_ea, 0);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+
+ MARS_TEST_ASSERT(
+ queue_item[0] == QUEUE_DEPTH &&
+ queue_item[1] == QUEUE_DEPTH);
+
+ ret = mars_task_queue_count(queue_ea, &count);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+
+ MARS_TEST_ASSERT(count == QUEUE_DEPTH);
+
+ mars_task_exit(0);
+
+ return 0;
+}
diff --git a/tests/TFP/TFP_4G_002/Makefile b/tests/TFP/TFP_4G_002/Makefile
new file mode 100644
index 0000000..ecbce33
--- /dev/null
+++ b/tests/TFP/TFP_4G_002/Makefile
@@ -0,0 +1,28 @@
+#
+# Copyright 2008 Sony Corporation
+#
+#
+# Permission is hereby granted, free of charge, to any person obtaining a copy
+# of this software and associated documentation files (the "Software"), to deal
+# in the Software without restriction, including without limitation the rights
+# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+# copies of the Software, and to permit persons to whom the Software is
+# furnished to do so, subject to the following conditions:
+#
+# The above copyright notice and this permission notice shall be included in
+# all copies or substantial portions of the Software.
+#
+# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+# THE SOFTWARE.
+#
+
+top_srcdir = ../..
+test_objs = host.o mpu1.task_eo mpu2.task_eo
+
+include $(top_srcdir)/scripts/config.mk
+include $(top_srcdir)/scripts/rules_item.mk
diff --git a/tests/TFP/TFP_4G_002/host.c b/tests/TFP/TFP_4G_002/host.c
new file mode 100644
index 0000000..4fba1c3
--- /dev/null
+++ b/tests/TFP/TFP_4G_002/host.c
@@ -0,0 +1,97 @@
+/*
+ * Copyright 2008 Sony Corporation
+ *
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a copy
+ * of this software and associated documentation files (the "Software"), to deal
+ * in the Software without restriction, including without limitation the rights
+ * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+ * copies of the Software, and to permit persons to whom the Software is
+ * furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included in
+ * all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+ * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+ * THE SOFTWARE.
+ */
+
+#include <libspe2.h>
+#include <mars/mars.h>
+#include <mars_test.h>
+#include "host_and_mpu.h"
+
+extern spe_program_handle_t mpu1_prog, mpu2_prog;
+
+static struct mars_context *mars;
+static struct mars_task_id pusher_task_id, poper_task_id;
+static struct mars_task_args task_args;
+static uint64_t queue;
+static uint32_t notify[32] __attribute__((aligned(16)));
+
+int main(void)
+{
+ int exit_code, ret;
+
+ ret = mars_context_create(&mars, 0, 0);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+
+ ret = mars_task_create(
+ mars,
+ &pusher_task_id,
+ "4G002",
+ mpu1_prog.elf_image,
+ MARS_TASK_CONTEXT_SAVE_ALL);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+
+ ret = mars_task_create(
+ mars,
+ &poper_task_id,
+ "4G002",
+ mpu2_prog.elf_image,
+ MARS_TASK_CONTEXT_SAVE_ALL);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+
+ ret = mars_task_queue_create(
+ mars,
+ &queue,
+ 16,
+ QUEUE_DEPTH,
+ MARS_TASK_QUEUE_MPU_TO_MPU);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+
+ task_args.type.u64[0] = queue;
+ task_args.type.u64[1] = mars_ptr_to_ea(notify);
+ ret = mars_task_schedule(&pusher_task_id, &task_args, 0);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+
+ ret = mars_task_schedule(&poper_task_id, &task_args, 0);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+
+ ret = mars_task_wait(&pusher_task_id, &exit_code);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+ MARS_TEST_ASSERT_EQUAL(exit_code, 0);
+
+ ret = mars_task_wait(&poper_task_id, &exit_code);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+ MARS_TEST_ASSERT_EQUAL(exit_code, 0);
+
+ ret = mars_task_queue_destroy(queue);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+
+ ret = mars_task_destroy(&pusher_task_id);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+
+ ret = mars_task_destroy(&poper_task_id);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+
+ ret = mars_context_destroy(mars);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+
+ return 0;
+}
diff --git a/tests/TFP/TFP_4G_002/host_and_mpu.h b/tests/TFP/TFP_4G_002/host_and_mpu.h
new file mode 100644
index 0000000..e565e93
--- /dev/null
+++ b/tests/TFP/TFP_4G_002/host_and_mpu.h
@@ -0,0 +1,24 @@
+/*
+ * Copyright 2008 Sony Corporation
+ *
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a copy
+ * of this software and associated documentation files (the "Software"), to deal
+ * in the Software without restriction, including without limitation the rights
+ * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+ * copies of the Software, and to permit persons to whom the Software is
+ * furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included in
+ * all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+ * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+ * THE SOFTWARE.
+ */
+
+#define QUEUE_DEPTH 16
diff --git a/tests/TFP/TFP_4G_002/mpu1.c b/tests/TFP/TFP_4G_002/mpu1.c
new file mode 100644
index 0000000..a3f962c
--- /dev/null
+++ b/tests/TFP/TFP_4G_002/mpu1.c
@@ -0,0 +1,50 @@
+/*
+ * Copyright 2008 Sony Corporation
+ *
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a copy
+ * of this software and associated documentation files (the "Software"), to deal
+ * in the Software without restriction, including without limitation the rights
+ * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+ * copies of the Software, and to permit persons to whom the Software is
+ * furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included in
+ * all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+ * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+ * THE SOFTWARE.
+ */
+
+#include <string.h>
+#include <mars/mars.h>
+#include "mars_task_test.h"
+#include "host_and_mpu.h"
+
+static uint64_t queue_item[2] __attribute__((aligned(16)));
+
+int mars_task_main(const struct mars_task_args *task_args)
+{
+ uint64_t queue_ea = task_args->type.u64[0];
+ uint64_t notify_ea = task_args->type.u64[1];
+ uint32_t i;
+ int ret;
+
+ for (i = 0; i < QUEUE_DEPTH; i++) {
+ queue_item[0] = queue_item[1] = QUEUE_DEPTH-i;
+
+ ret = mars_task_queue_push(queue_ea, queue_item);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+ }
+
+ mars_test_counter_set(notify_ea, 1);
+
+ mars_task_exit(0);
+
+ return 0;
+}
diff --git a/tests/TFP/TFP_4G_002/mpu2.c b/tests/TFP/TFP_4G_002/mpu2.c
new file mode 100644
index 0000000..3dfed80
--- /dev/null
+++ b/tests/TFP/TFP_4G_002/mpu2.c
@@ -0,0 +1,59 @@
+/*
+ * Copyright 2008 Sony Corporation
+ *
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a copy
+ * of this software and associated documentation files (the "Software"), to deal
+ * in the Software without restriction, including without limitation the rights
+ * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+ * copies of the Software, and to permit persons to whom the Software is
+ * furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included in
+ * all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+ * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+ * THE SOFTWARE.
+ */
+
+#include <string.h>
+#include <mars/mars.h>
+#include "mars_task_test.h"
+#include "host_and_mpu.h"
+
+static uint64_t queue_item[2] __attribute__((aligned(16)));
+
+int mars_task_main(const struct mars_task_args *task_args)
+{
+ uint64_t queue_ea = task_args->type.u64[0];
+ uint64_t notify_ea = task_args->type.u64[1];
+ uint32_t count;
+ int ret;
+
+ mars_test_counter_wait(notify_ea, 1);
+
+ ret = mars_task_queue_count(queue_ea, &count);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+ MARS_TEST_ASSERT(count == QUEUE_DEPTH);
+
+ ret = mars_task_queue_peek_begin(queue_ea, queue_item, 0);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+
+ ret = mars_task_queue_peek_end(queue_ea, 0);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+ MARS_TEST_ASSERT(queue_item[0] == QUEUE_DEPTH &&
+ queue_item[1] == QUEUE_DEPTH);
+
+ ret = mars_task_queue_count(queue_ea, &count);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+ MARS_TEST_ASSERT(count == QUEUE_DEPTH);
+
+ mars_task_exit(0);
+
+ return 0;
+}
diff --git a/tests/TFP/TFP_4G_003/Makefile b/tests/TFP/TFP_4G_003/Makefile
new file mode 100644
index 0000000..432135a
--- /dev/null
+++ b/tests/TFP/TFP_4G_003/Makefile
@@ -0,0 +1,28 @@
+#
+# Copyright 2008 Sony Corporation
+#
+#
+# Permission is hereby granted, free of charge, to any person obtaining a copy
+# of this software and associated documentation files (the "Software"), to deal
+# in the Software without restriction, including without limitation the rights
+# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+# copies of the Software, and to permit persons to whom the Software is
+# furnished to do so, subject to the following conditions:
+#
+# The above copyright notice and this permission notice shall be included in
+# all copies or substantial portions of the Software.
+#
+# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+# THE SOFTWARE.
+#
+
+top_srcdir = ../..
+test_objs = host.o mpu.task_eo
+
+include $(top_srcdir)/scripts/config.mk
+include $(top_srcdir)/scripts/rules_item.mk
diff --git a/tests/TFP/TFP_4G_003/host.c b/tests/TFP/TFP_4G_003/host.c
new file mode 100644
index 0000000..a6f83e1
--- /dev/null
+++ b/tests/TFP/TFP_4G_003/host.c
@@ -0,0 +1,90 @@
+/*
+ * Copyright 2008 Sony Corporation
+ *
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a copy
+ * of this software and associated documentation files (the "Software"), to deal
+ * in the Software without restriction, including without limitation the rights
+ * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+ * copies of the Software, and to permit persons to whom the Software is
+ * furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included in
+ * all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+ * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+ * THE SOFTWARE.
+ */
+
+#include <unistd.h>
+#include <libspe2.h>
+#include <mars/mars.h>
+#include <mars_test.h>
+
+#define QUEUE_DEPTH 16
+
+extern spe_program_handle_t mpu_prog;
+
+static struct mars_context *mars;
+static struct mars_task_id task_id;
+static struct mars_task_args task_args;
+static uint64_t queue;
+static uint64_t queue_item[2], mpu_answer __attribute__((aligned(16)));
+
+int main(void)
+{
+ int exit_code, ret;
+
+ ret = mars_context_create(&mars, 0, 0);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+
+ ret = mars_task_create(
+ mars,
+ &task_id,
+ "4G003",
+ mpu_prog.elf_image,
+ MARS_TASK_CONTEXT_SAVE_ALL);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+
+ ret = mars_task_queue_create(
+ mars,
+ &queue,
+ 16,
+ QUEUE_DEPTH,
+ MARS_TASK_QUEUE_HOST_TO_MPU);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+
+ mpu_answer = 0;
+
+ task_args.type.u64[0] = queue;
+ task_args.type.u64[1] = mars_ptr_to_ea(&mpu_answer);
+ ret = mars_task_schedule(&task_id, &task_args, 0);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+
+ usleep(200000);
+
+ mpu_answer = 1;
+
+ ret = mars_task_queue_push(queue, queue_item);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+
+ ret = mars_task_wait(&task_id, &exit_code);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+ MARS_TEST_ASSERT_EQUAL(exit_code, 0);
+
+ ret = mars_task_queue_destroy(queue);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+
+ ret = mars_task_destroy(&task_id);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+
+ ret = mars_context_destroy(mars);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+
+ return 0;
+}
diff --git a/tests/TFP/TFP_4G_003/mpu.c b/tests/TFP/TFP_4G_003/mpu.c
new file mode 100644
index 0000000..988e133
--- /dev/null
+++ b/tests/TFP/TFP_4G_003/mpu.c
@@ -0,0 +1,50 @@
+/*
+ * Copyright 2008 Sony Corporation
+ *
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a copy
+ * of this software and associated documentation files (the "Software"), to deal
+ * in the Software without restriction, including without limitation the rights
+ * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+ * copies of the Software, and to permit persons to whom the Software is
+ * furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included in
+ * all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+ * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+ * THE SOFTWARE.
+ */
+
+#include <string.h>
+#include <spu_mfcio.h>
+#include <mars/mars.h>
+#include "mars_task_test.h"
+
+static uint64_t queue_item[2] __attribute__((aligned(16)));
+
+int mars_task_main(const struct mars_task_args *task_args)
+{
+ int ret;
+ uint64_t queue_ea = task_args->type.u64[0];
+ uint64_t mpu_answer_ea = task_args->type.u64[1];
+ uint64_t mpu_answer;
+
+ ret = mars_task_queue_peek_begin(queue_ea, queue_item, 0);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+
+ ret = mars_task_queue_peek_end(queue_ea, 0);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+
+ mpu_answer = mars_test_int64_get(mpu_answer_ea);
+ MARS_TEST_ASSERT(mpu_answer);
+
+ mars_task_exit(0);
+
+ return 0;
+}
diff --git a/tests/TFP/TFP_4G_004/Makefile b/tests/TFP/TFP_4G_004/Makefile
new file mode 100644
index 0000000..ecbce33
--- /dev/null
+++ b/tests/TFP/TFP_4G_004/Makefile
@@ -0,0 +1,28 @@
+#
+# Copyright 2008 Sony Corporation
+#
+#
+# Permission is hereby granted, free of charge, to any person obtaining a copy
+# of this software and associated documentation files (the "Software"), to deal
+# in the Software without restriction, including without limitation the rights
+# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+# copies of the Software, and to permit persons to whom the Software is
+# furnished to do so, subject to the following conditions:
+#
+# The above copyright notice and this permission notice shall be included in
+# all copies or substantial portions of the Software.
+#
+# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+# THE SOFTWARE.
+#
+
+top_srcdir = ../..
+test_objs = host.o mpu1.task_eo mpu2.task_eo
+
+include $(top_srcdir)/scripts/config.mk
+include $(top_srcdir)/scripts/rules_item.mk
diff --git a/tests/TFP/TFP_4G_004/host.c b/tests/TFP/TFP_4G_004/host.c
new file mode 100644
index 0000000..bb88550
--- /dev/null
+++ b/tests/TFP/TFP_4G_004/host.c
@@ -0,0 +1,105 @@
+/*
+ * Copyright 2008 Sony Corporation
+ *
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a copy
+ * of this software and associated documentation files (the "Software"), to deal
+ * in the Software without restriction, including without limitation the rights
+ * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+ * copies of the Software, and to permit persons to whom the Software is
+ * furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included in
+ * all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+ * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+ * THE SOFTWARE.
+ */
+
+#include <libspe2.h>
+#include <mars/mars.h>
+#include <mars_test.h>
+
+#define QUEUE_DEPTH 16
+
+extern spe_program_handle_t mpu1_prog, mpu2_prog;
+
+static struct mars_context *mars;
+static struct mars_task_id pusher_task_id, peeker_task_id;
+static struct mars_task_args task_args;
+static uint64_t queue;
+static uint64_t mpu_answer __attribute__((aligned(16)));
+
+int main(void)
+{
+ int exit_code, ret;
+ uint32_t tb_freq;
+
+ ret = mars_test_get_timebase_freq(&tb_freq);
+ MARS_TEST_ASSERT_EQUAL(ret, 0);
+
+ ret = mars_context_create(&mars, 0, 0);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+
+ ret = mars_task_create(
+ mars,
+ &pusher_task_id,
+ "4G004",
+ mpu1_prog.elf_image,
+ MARS_TASK_CONTEXT_SAVE_ALL);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+
+ ret = mars_task_create(
+ mars,
+ &peeker_task_id,
+ "4G004",
+ mpu2_prog.elf_image,
+ MARS_TASK_CONTEXT_SAVE_ALL);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+
+ ret = mars_task_queue_create(
+ mars,
+ &queue,
+ 16,
+ QUEUE_DEPTH,
+ MARS_TASK_QUEUE_MPU_TO_MPU);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+
+ mpu_answer = 0;
+
+ task_args.type.u64[0] = queue;
+ task_args.type.u64[1] = mars_ptr_to_ea(&mpu_answer);
+ task_args.type.u64[2] = tb_freq;
+ ret = mars_task_schedule(&pusher_task_id, &task_args, 0);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+
+ ret = mars_task_schedule(&peeker_task_id, &task_args, 0);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+
+ ret = mars_task_wait(&pusher_task_id, &exit_code);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+ MARS_TEST_ASSERT_EQUAL(exit_code, 0);
+
+ ret = mars_task_wait(&peeker_task_id, &exit_code);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+ MARS_TEST_ASSERT_EQUAL(exit_code, 0);
+
+ ret = mars_task_queue_destroy(queue);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+
+ ret = mars_task_destroy(&pusher_task_id);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+
+ ret = mars_task_destroy(&peeker_task_id);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+
+ ret = mars_context_destroy(mars);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+
+ return 0;
+}
diff --git a/tests/TFP/TFP_4G_004/mpu1.c b/tests/TFP/TFP_4G_004/mpu1.c
new file mode 100644
index 0000000..d3a0be3
--- /dev/null
+++ b/tests/TFP/TFP_4G_004/mpu1.c
@@ -0,0 +1,48 @@
+/*
+ * Copyright 2008 Sony Corporation
+ *
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a copy
+ * of this software and associated documentation files (the "Software"), to deal
+ * in the Software without restriction, including without limitation the rights
+ * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+ * copies of the Software, and to permit persons to whom the Software is
+ * furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included in
+ * all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+ * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+ * THE SOFTWARE.
+ */
+
+#include <string.h>
+#include <spu_mfcio.h>
+#include <mars/mars.h>
+#include "mars_task_test.h"
+
+static uint64_t queue_item[2] __attribute__((aligned(16)));
+
+int mars_task_main(const struct mars_task_args *task_args)
+{
+ int ret;
+ uint64_t queue_ea = task_args->type.u64[0];
+ uint64_t mpu_answer_ea = task_args->type.u64[1];
+ uint32_t tb_freq = task_args->type.u64[2];
+
+ mars_test_usleep(tb_freq, 200000);
+
+ mars_test_int64_put(mpu_answer_ea, 1);
+
+ ret = mars_task_queue_push(queue_ea, queue_item);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+
+ mars_task_exit(0);
+
+ return 0;
+}
diff --git a/tests/TFP/TFP_4G_004/mpu2.c b/tests/TFP/TFP_4G_004/mpu2.c
new file mode 100644
index 0000000..7d55f16
--- /dev/null
+++ b/tests/TFP/TFP_4G_004/mpu2.c
@@ -0,0 +1,51 @@
+/*
+ * Copyright 2008 Sony Corporation
+ *
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a copy
+ * of this software and associated documentation files (the "Software"), to deal
+ * in the Software without restriction, including without limitation the rights
+ * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+ * copies of the Software, and to permit persons to whom the Software is
+ * furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included in
+ * all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+ * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+ * THE SOFTWARE.
+ */
+
+#include <string.h>
+#include <spu_mfcio.h>
+#include <mars/mars.h>
+#include "mars_task_test.h"
+
+static uint64_t queue_item[2] __attribute__((aligned(16)));
+
+int mars_task_main(const struct mars_task_args *task_args)
+{
+ int ret;
+ uint64_t queue_ea = task_args->type.u64[0];
+ uint64_t mpu_answer_ea = task_args->type.u64[1];
+
+ uint64_t mpu_answer;
+
+ ret = mars_task_queue_peek_begin(queue_ea, queue_item, 0);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+
+ ret = mars_task_queue_peek_end(queue_ea, 0);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+
+ mpu_answer = mars_test_int64_get(mpu_answer_ea);
+ MARS_TEST_ASSERT(mpu_answer);
+
+ mars_task_exit(0);
+
+ return 0;
+}
diff --git a/tests/TFP/TFP_4G_005/Makefile b/tests/TFP/TFP_4G_005/Makefile
new file mode 100644
index 0000000..432135a
--- /dev/null
+++ b/tests/TFP/TFP_4G_005/Makefile
@@ -0,0 +1,28 @@
+#
+# Copyright 2008 Sony Corporation
+#
+#
+# Permission is hereby granted, free of charge, to any person obtaining a copy
+# of this software and associated documentation files (the "Software"), to deal
+# in the Software without restriction, including without limitation the rights
+# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+# copies of the Software, and to permit persons to whom the Software is
+# furnished to do so, subject to the following conditions:
+#
+# The above copyright notice and this permission notice shall be included in
+# all copies or substantial portions of the Software.
+#
+# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+# THE SOFTWARE.
+#
+
+top_srcdir = ../..
+test_objs = host.o mpu.task_eo
+
+include $(top_srcdir)/scripts/config.mk
+include $(top_srcdir)/scripts/rules_item.mk
diff --git a/tests/TFP/TFP_4G_005/host.c b/tests/TFP/TFP_4G_005/host.c
new file mode 100644
index 0000000..35d0e41
--- /dev/null
+++ b/tests/TFP/TFP_4G_005/host.c
@@ -0,0 +1,90 @@
+/*
+ * Copyright 2008 Sony Corporation
+ *
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a copy
+ * of this software and associated documentation files (the "Software"), to deal
+ * in the Software without restriction, including without limitation the rights
+ * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+ * copies of the Software, and to permit persons to whom the Software is
+ * furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included in
+ * all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+ * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+ * THE SOFTWARE.
+ */
+
+#include <libspe2.h>
+#include <mars/mars.h>
+#include <mars_test.h>
+#include "host_and_mpu.h"
+
+extern spe_program_handle_t mpu_prog;
+
+static struct mars_context *mars;
+static struct mars_task_id task_ids[TASK_COUNT];
+static struct mars_task_args task_args;
+static uint64_t queue;
+static uint64_t queue_item[2];
+
+int main(void)
+{
+ int i, exit_code, ret;
+
+ ret = mars_context_create(&mars, 0, 0);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+
+ ret = mars_task_queue_create(
+ mars,
+ &queue,
+ 16,
+ QUEUE_DEPTH,
+ MARS_TASK_QUEUE_HOST_TO_MPU);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+
+ for (i = 0; i < QUEUE_DEPTH; i++) {
+ ret = mars_task_queue_push(queue, queue_item);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+ }
+
+ for (i = 0; i < TASK_COUNT; i++) {
+ ret = mars_task_create(
+ mars,
+ &task_ids[i],
+ "4G005",
+ mpu_prog.elf_image,
+ MARS_TASK_CONTEXT_SAVE_ALL);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+ }
+
+ task_args.type.u64[0] = queue;
+
+ for (i = 0; i < TASK_COUNT; i++) {
+ ret = mars_task_schedule(&task_ids[i], &task_args, 0);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+ }
+
+ for (i = 0; i < TASK_COUNT; i++) {
+ ret = mars_task_wait(&task_ids[i], &exit_code);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+ MARS_TEST_ASSERT_EQUAL(exit_code, 0);
+
+ ret = mars_task_destroy(&task_ids[i]);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+ }
+
+ ret = mars_task_queue_destroy(queue);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+
+ ret = mars_context_destroy(mars);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+
+ return 0;
+}
diff --git a/tests/TFP/TFP_4G_005/host_and_mpu.h b/tests/TFP/TFP_4G_005/host_and_mpu.h
new file mode 100644
index 0000000..7cb3f27
--- /dev/null
+++ b/tests/TFP/TFP_4G_005/host_and_mpu.h
@@ -0,0 +1,25 @@
+/*
+ * Copyright 2008 Sony Corporation
+ *
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a copy
+ * of this software and associated documentation files (the "Software"), to deal
+ * in the Software without restriction, including without limitation the rights
+ * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+ * copies of the Software, and to permit persons to whom the Software is
+ * furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included in
+ * all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+ * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+ * THE SOFTWARE.
+ */
+
+#define QUEUE_DEPTH 65536
+#define TASK_COUNT 16
diff --git a/tests/TFP/TFP_4G_005/mpu.c b/tests/TFP/TFP_4G_005/mpu.c
new file mode 100644
index 0000000..efa0c59
--- /dev/null
+++ b/tests/TFP/TFP_4G_005/mpu.c
@@ -0,0 +1,49 @@
+/*
+ * Copyright 2008 Sony Corporation
+ *
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a copy
+ * of this software and associated documentation files (the "Software"), to deal
+ * in the Software without restriction, including without limitation the rights
+ * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+ * copies of the Software, and to permit persons to whom the Software is
+ * furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included in
+ * all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+ * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+ * THE SOFTWARE.
+ */
+
+#include <string.h>
+#include <mars/mars.h>
+#include "mars_task_test.h"
+#include "host_and_mpu.h"
+
+#define LOOP_COUNT (QUEUE_DEPTH/(TASK_COUNT*2))
+
+static uint64_t queue_item[2] __attribute__((aligned(16)));
+
+int mars_task_main(const struct mars_task_args *task_args)
+{
+ uint64_t queue_ea = task_args->type.u64[0];
+ int i, ret;
+
+ for (i = 0; i < LOOP_COUNT; i++) {
+ ret = mars_task_queue_peek_begin(queue_ea, queue_item, 0);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+
+ ret = mars_task_queue_peek_end(queue_ea, 0);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+ }
+
+ mars_task_exit(0);
+
+ return 0;
+}
diff --git a/tests/TFP/TFP_4G_006/Makefile b/tests/TFP/TFP_4G_006/Makefile
new file mode 100644
index 0000000..432135a
--- /dev/null
+++ b/tests/TFP/TFP_4G_006/Makefile
@@ -0,0 +1,28 @@
+#
+# Copyright 2008 Sony Corporation
+#
+#
+# Permission is hereby granted, free of charge, to any person obtaining a copy
+# of this software and associated documentation files (the "Software"), to deal
+# in the Software without restriction, including without limitation the rights
+# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+# copies of the Software, and to permit persons to whom the Software is
+# furnished to do so, subject to the following conditions:
+#
+# The above copyright notice and this permission notice shall be included in
+# all copies or substantial portions of the Software.
+#
+# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+# THE SOFTWARE.
+#
+
+top_srcdir = ../..
+test_objs = host.o mpu.task_eo
+
+include $(top_srcdir)/scripts/config.mk
+include $(top_srcdir)/scripts/rules_item.mk
diff --git a/tests/TFP/TFP_4G_006/host.c b/tests/TFP/TFP_4G_006/host.c
new file mode 100644
index 0000000..c777405
--- /dev/null
+++ b/tests/TFP/TFP_4G_006/host.c
@@ -0,0 +1,108 @@
+/*
+ * Copyright 2008 Sony Corporation
+ *
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a copy
+ * of this software and associated documentation files (the "Software"), to deal
+ * in the Software without restriction, including without limitation the rights
+ * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+ * copies of the Software, and to permit persons to whom the Software is
+ * furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included in
+ * all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+ * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+ * THE SOFTWARE.
+ */
+
+#include <unistd.h>
+#include <mars/mars.h>
+#include <libspe2.h>
+#include <mars_test.h>
+
+struct queue_entry {
+ uint64_t val;
+ uint64_t pad;
+};
+#define Q_DEPTH (256 * 1024)
+
+#define NUM_LOOP 2
+static uint32_t depth_size[] =
+{
+ 1,
+ Q_DEPTH
+};
+extern spe_program_handle_t mpu_prog;
+
+static struct mars_context *mars_ctx;
+static struct mars_task_args task_args;
+static struct mars_task_id task_id;
+
+static uint64_t host_to_mpu[NUM_LOOP];
+static struct queue_entry data;
+
+static uint32_t shared_resource __attribute((aligned(16)));
+
+int main(void)
+{
+ int ret, i;
+ int32_t exit_code;
+
+ ret = mars_context_create(&mars_ctx, 0, 0);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+
+ for (i = 0; i < NUM_LOOP; i++) {
+ shared_resource = 0;
+
+ ret = mars_task_queue_create(
+ mars_ctx,
+ &host_to_mpu[i],
+ sizeof(struct queue_entry),
+ depth_size[i],
+ MARS_TASK_QUEUE_HOST_TO_MPU);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+
+ /* create peek task */
+ ret = mars_task_create(mars_ctx, &task_id, NULL,
+ mpu_prog.elf_image, MARS_TASK_CONTEXT_SAVE_ALL);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+
+ task_args.type.u64[0] = host_to_mpu[i];
+ task_args.type.u64[1] = mars_ptr_to_ea(&shared_resource);
+ task_args.type.u64[2] = (uint64_t)i;
+ ret = mars_task_schedule(&task_id, &task_args, 0);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+
+ /* check if queue peek is blocked in mpu task */
+ sleep(1);
+ MARS_TEST_ASSERT_EQUAL(shared_resource, 0);
+
+ /* push one */
+ data.val = i;
+ ret = mars_task_queue_push(host_to_mpu[i], &data);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+
+ /* check if mpu task is successfly finished */
+ ret = mars_task_wait(&task_id, &exit_code);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+ MARS_TEST_ASSERT_ERROR(exit_code, MARS_SUCCESS);
+
+ ret = mars_task_destroy(&task_id);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+
+ ret = mars_task_queue_destroy(host_to_mpu[i]);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+ }
+
+ ret = mars_context_destroy(mars_ctx);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+
+ return 0;
+}
+
diff --git a/tests/TFP/TFP_4G_006/mpu.c b/tests/TFP/TFP_4G_006/mpu.c
new file mode 100644
index 0000000..8b3c611
--- /dev/null
+++ b/tests/TFP/TFP_4G_006/mpu.c
@@ -0,0 +1,64 @@
+/*
+ * Copyright 2008 Sony Corporation
+ *
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a copy
+ * of this software and associated documentation files (the "Software"), to deal
+ * in the Software without restriction, including without limitation the rights
+ * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+ * copies of the Software, and to permit persons to whom the Software is
+ * furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included in
+ * all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+ * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+ * THE SOFTWARE.
+ */
+
+#include <mars/mars.h>
+#include <mars_task_test.h>
+#include <spu_mfcio.h>
+
+struct queue_entry {
+ uint64_t val;
+ uint64_t pad;
+};
+static struct queue_entry data;
+static uint32_t shared_resource __attribute((aligned(16)));
+
+int mars_task_main(const struct mars_task_args *task_args)
+{
+ int ret;
+ uint64_t host_to_mpu_ea = task_args->type.u64[0];
+ uint64_t shared_resource_ea = task_args->type.u64[1];
+ uint64_t val = task_args->type.u64[2];
+ uint32_t count;
+
+ ret = mars_task_queue_peek_begin(host_to_mpu_ea, &data, 1);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+
+ ret = mars_task_queue_peek_end(host_to_mpu_ea, 1);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+
+ MARS_TEST_ASSERT_EQUAL(data.val, val);
+
+ /* check queue_count */
+ ret = mars_task_queue_count(host_to_mpu_ea, &count);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+ MARS_TEST_ASSERT_EQUAL(count, 1);
+
+ /* if the program reaches here, shared_resource'll be updated */
+ shared_resource = 1;
+ mfc_put(&shared_resource, shared_resource_ea,
+ sizeof(uint32_t), 0, 0, 0);
+ mfc_write_tag_mask(1 << 0);
+ mfc_read_tag_status_all();
+
+ return 0;
+}
diff --git a/tests/TFP/TFP_4G_007/Makefile b/tests/TFP/TFP_4G_007/Makefile
new file mode 100644
index 0000000..ecbce33
--- /dev/null
+++ b/tests/TFP/TFP_4G_007/Makefile
@@ -0,0 +1,28 @@
+#
+# Copyright 2008 Sony Corporation
+#
+#
+# Permission is hereby granted, free of charge, to any person obtaining a copy
+# of this software and associated documentation files (the "Software"), to deal
+# in the Software without restriction, including without limitation the rights
+# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+# copies of the Software, and to permit persons to whom the Software is
+# furnished to do so, subject to the following conditions:
+#
+# The above copyright notice and this permission notice shall be included in
+# all copies or substantial portions of the Software.
+#
+# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+# THE SOFTWARE.
+#
+
+top_srcdir = ../..
+test_objs = host.o mpu1.task_eo mpu2.task_eo
+
+include $(top_srcdir)/scripts/config.mk
+include $(top_srcdir)/scripts/rules_item.mk
diff --git a/tests/TFP/TFP_4G_007/host.c b/tests/TFP/TFP_4G_007/host.c
new file mode 100644
index 0000000..730cbca
--- /dev/null
+++ b/tests/TFP/TFP_4G_007/host.c
@@ -0,0 +1,127 @@
+/*
+ * Copyright 2008 Sony Corporation
+ *
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a copy
+ * of this software and associated documentation files (the "Software"), to deal
+ * in the Software without restriction, including without limitation the rights
+ * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+ * copies of the Software, and to permit persons to whom the Software is
+ * furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included in
+ * all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+ * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+ * THE SOFTWARE.
+ */
+
+#include <unistd.h>
+#include <mars/mars.h>
+#include <libspe2.h>
+#include <mars_test.h>
+
+struct queue_entry {
+ uint64_t val1;
+ uint64_t val2;
+};
+#define Q_DEPTH (256 * 1024)
+
+#define NUM_LOOP 2
+static uint32_t depth_size[] =
+{
+ 1,
+ Q_DEPTH
+};
+extern spe_program_handle_t mpu1_prog;
+extern spe_program_handle_t mpu2_prog;
+
+static struct mars_context *mars_ctx;
+static struct mars_task_args task1_args, task2_args;
+static struct mars_task_id task1_id, task2_id;
+
+static uint64_t mpu_to_mpu[NUM_LOOP];
+
+static uint32_t shared_resource __attribute((aligned(16)));
+
+int main(void)
+{
+ int ret, i;
+ int32_t exit_code;
+ uint32_t count;
+
+ ret = mars_context_create(&mars_ctx, 0, 0);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+
+ for (i = 0; i < NUM_LOOP; i++) {
+ shared_resource = 0;
+
+ ret = mars_task_queue_create(
+ mars_ctx,
+ &mpu_to_mpu[i],
+ sizeof(struct queue_entry),
+ depth_size[i],
+ MARS_TASK_QUEUE_MPU_TO_MPU);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+
+ /* create peek task */
+ ret = mars_task_create(mars_ctx, &task1_id, NULL,
+ mpu1_prog.elf_image, MARS_TASK_CONTEXT_SAVE_ALL);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+
+ task1_args.type.u64[0] = mpu_to_mpu[i];
+ task1_args.type.u64[1] = mars_ptr_to_ea(&shared_resource);
+ task1_args.type.u64[2] = (uint64_t)i;
+ ret = mars_task_schedule(&task1_id, &task1_args, 0);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+
+ /* create push task */
+ ret = mars_task_create(mars_ctx, &task2_id, NULL,
+ mpu2_prog.elf_image, MARS_TASK_CONTEXT_SAVE_ALL);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+
+ /* check if queue peek is blocked in mpu task */
+ sleep(1);
+ MARS_TEST_ASSERT_EQUAL(shared_resource, 0);
+
+ /* push one by mpu */
+ task2_args.type.u64[0] = mpu_to_mpu[i];
+ task2_args.type.u64[1] = (uint64_t)i;
+ ret = mars_task_schedule(&task2_id, &task2_args, 0);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+
+ ret = mars_task_wait(&task2_id, &exit_code);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+ MARS_TEST_ASSERT_ERROR(exit_code, MARS_SUCCESS);
+
+ /* check if peek task is successfly finished */
+ ret = mars_task_wait(&task1_id, &exit_code);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+ MARS_TEST_ASSERT_ERROR(exit_code, MARS_SUCCESS);
+
+ /* queue count should be 1 */
+ ret = mars_task_queue_count(mpu_to_mpu[i], &count);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+ MARS_TEST_ASSERT_EQUAL(count, 1);
+
+ ret = mars_task_destroy(&task1_id);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+
+ ret = mars_task_destroy(&task2_id);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+
+ ret = mars_task_queue_destroy(mpu_to_mpu[i]);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+ }
+
+ ret = mars_context_destroy(mars_ctx);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+
+ return 0;
+}
+
diff --git a/tests/TFP/TFP_4G_007/mpu1.c b/tests/TFP/TFP_4G_007/mpu1.c
new file mode 100644
index 0000000..c9dc04f
--- /dev/null
+++ b/tests/TFP/TFP_4G_007/mpu1.c
@@ -0,0 +1,58 @@
+/*
+ * Copyright 2008 Sony Corporation
+ *
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a copy
+ * of this software and associated documentation files (the "Software"), to deal
+ * in the Software without restriction, including without limitation the rights
+ * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+ * copies of the Software, and to permit persons to whom the Software is
+ * furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included in
+ * all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+ * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+ * THE SOFTWARE.
+ */
+
+#include <mars/mars.h>
+#include <mars_task_test.h>
+#include <spu_mfcio.h>
+
+struct queue_entry {
+ uint64_t val;
+ uint64_t pad;
+};
+static struct queue_entry data;
+static uint32_t shared_resource __attribute((aligned(16)));
+
+int mars_task_main(const struct mars_task_args *task_args)
+{
+ int ret;
+ uint64_t mpu_to_mpu_ea = task_args->type.u64[0];
+ uint64_t shared_resource_ea = task_args->type.u64[1];
+ uint64_t val = task_args->type.u64[2];
+
+ ret = mars_task_queue_peek_begin(mpu_to_mpu_ea, &data, 1);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+
+ ret = mars_task_queue_peek_end(mpu_to_mpu_ea, 1);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+
+ MARS_TEST_ASSERT_EQUAL(data.val, val);
+
+ /* if the program reaches here, shared_resource'll be updated */
+ shared_resource = 1;
+ mfc_put(&shared_resource, shared_resource_ea,
+ sizeof(uint32_t), 0, 0, 0);
+ mfc_write_tag_mask(1 << 0);
+ mfc_read_tag_status_all();
+
+ return 0;
+}
diff --git a/tests/TFP/TFP_4G_007/mpu2.c b/tests/TFP/TFP_4G_007/mpu2.c
new file mode 100644
index 0000000..fb4a992
--- /dev/null
+++ b/tests/TFP/TFP_4G_007/mpu2.c
@@ -0,0 +1,45 @@
+/*
+ * Copyright 2008 Sony Corporation
+ *
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a copy
+ * of this software and associated documentation files (the "Software"), to deal
+ * in the Software without restriction, including without limitation the rights
+ * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+ * copies of the Software, and to permit persons to whom the Software is
+ * furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included in
+ * all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+ * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+ * THE SOFTWARE.
+ */
+
+#include <mars/mars.h>
+#include <mars_task_test.h>
+#include <spu_mfcio.h>
+
+struct queue_entry {
+ uint64_t val1;
+ uint64_t val2;
+};
+static struct queue_entry data;
+
+int mars_task_main(const struct mars_task_args *task_args)
+{
+ int ret;
+ uint64_t mpu_to_mpu_ea = task_args->type.u64[0];
+ uint64_t val = task_args->type.u64[1];
+
+ data.val1 = val;
+ ret = mars_task_queue_push(mpu_to_mpu_ea, &data);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+
+ return 0;
+}
diff --git a/tests/TFP/TFP_4G_008/Makefile b/tests/TFP/TFP_4G_008/Makefile
new file mode 100644
index 0000000..ecbce33
--- /dev/null
+++ b/tests/TFP/TFP_4G_008/Makefile
@@ -0,0 +1,28 @@
+#
+# Copyright 2008 Sony Corporation
+#
+#
+# Permission is hereby granted, free of charge, to any person obtaining a copy
+# of this software and associated documentation files (the "Software"), to deal
+# in the Software without restriction, including without limitation the rights
+# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+# copies of the Software, and to permit persons to whom the Software is
+# furnished to do so, subject to the following conditions:
+#
+# The above copyright notice and this permission notice shall be included in
+# all copies or substantial portions of the Software.
+#
+# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+# THE SOFTWARE.
+#
+
+top_srcdir = ../..
+test_objs = host.o mpu1.task_eo mpu2.task_eo
+
+include $(top_srcdir)/scripts/config.mk
+include $(top_srcdir)/scripts/rules_item.mk
diff --git a/tests/TFP/TFP_4G_008/host.c b/tests/TFP/TFP_4G_008/host.c
new file mode 100644
index 0000000..baf5039
--- /dev/null
+++ b/tests/TFP/TFP_4G_008/host.c
@@ -0,0 +1,127 @@
+/*
+ * Copyright (C) 2008 Sony Computer Entertainment Inc.
+ *
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a copy
+ * of this software and associated documentation files (the "Software"), to deal
+ * in the Software without restriction, including without limitation the rights
+ * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+ * copies of the Software, and to permit persons to whom the Software is
+ * furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included in
+ * all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+ * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+ * THE SOFTWARE.
+ */
+
+#include <unistd.h>
+#include <mars/mars.h>
+#include <libspe2.h>
+#include <mars_test.h>
+
+struct queue_entry {
+ uint64_t val1;
+ uint64_t val2;
+};
+#define Q_DEPTH (256 * 1024)
+
+#define NUM_LOOP 2
+static uint32_t depth_size[] =
+{
+ 1,
+ Q_DEPTH
+};
+extern spe_program_handle_t mpu1_prog;
+extern spe_program_handle_t mpu2_prog;
+
+static struct mars_context *mars_ctx;
+static struct mars_task_args task1_args, task2_args;
+static struct mars_task_id task1_id, task2_id;
+
+static uint64_t mpu_to_mpu[NUM_LOOP];
+
+static uint32_t shared_resource __attribute((aligned(16)));
+
+int main(void)
+{
+ int ret, i;
+ int32_t exit_code;
+ uint32_t count;
+
+ ret = mars_context_create(&mars_ctx, 0, 0);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+
+ for (i = 0; i < NUM_LOOP; i++) {
+ shared_resource = 0;
+
+ ret = mars_task_queue_create(
+ mars_ctx,
+ &mpu_to_mpu[i],
+ sizeof(struct queue_entry),
+ depth_size[i],
+ MARS_TASK_QUEUE_MPU_TO_MPU);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+
+ /* create peek task */
+ ret = mars_task_create(mars_ctx, &task1_id, NULL,
+ mpu1_prog.elf_image, MARS_TASK_CONTEXT_SAVE_ALL);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+
+ task1_args.type.u64[0] = mpu_to_mpu[i];
+ task1_args.type.u64[1] = mars_ptr_to_ea(&shared_resource);
+ task1_args.type.u64[2] = (uint64_t)i;
+ ret = mars_task_schedule(&task1_id, &task1_args, 0);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+
+ /* create push task */
+ ret = mars_task_create(mars_ctx, &task2_id, NULL,
+ mpu2_prog.elf_image, MARS_TASK_CONTEXT_SAVE_ALL);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+
+ /* check if queue peek is blocked in mpu task */
+ sleep(1);
+ MARS_TEST_ASSERT_EQUAL(shared_resource, 0);
+
+ /* push one by mpu */
+ task2_args.type.u64[0] = mpu_to_mpu[i];
+ task2_args.type.u64[1] = (uint64_t)i;
+ ret = mars_task_schedule(&task2_id, &task2_args, 0);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+
+ ret = mars_task_wait(&task2_id, &exit_code);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+ MARS_TEST_ASSERT_ERROR(exit_code, MARS_SUCCESS);
+
+ /* check if peek task is successfly finished */
+ ret = mars_task_wait(&task1_id, &exit_code);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+ MARS_TEST_ASSERT_ERROR(exit_code, MARS_SUCCESS);
+
+ /* queue count should be 1 */
+ ret = mars_task_queue_count(mpu_to_mpu[i], &count);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+ MARS_TEST_ASSERT_EQUAL(count, 1);
+
+ ret = mars_task_destroy(&task1_id);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+
+ ret = mars_task_destroy(&task2_id);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+
+ ret = mars_task_queue_destroy(mpu_to_mpu[i]);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+ }
+
+ ret = mars_context_destroy(mars_ctx);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+
+ return 0;
+}
+
diff --git a/tests/TFP/TFP_4G_008/mpu1.c b/tests/TFP/TFP_4G_008/mpu1.c
new file mode 100644
index 0000000..e4a7938
--- /dev/null
+++ b/tests/TFP/TFP_4G_008/mpu1.c
@@ -0,0 +1,57 @@
+/*
+ * Copyright (C) 2008 Sony Computer Entertainment Inc.
+ *
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a copy
+ * of this software and associated documentation files (the "Software"), to deal
+ * in the Software without restriction, including without limitation the rights
+ * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+ * copies of the Software, and to permit persons to whom the Software is
+ * furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included in
+ * all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+ * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+ * THE SOFTWARE.
+ */
+
+#include <mars/mars.h>
+#include <mars_task_test.h>
+#include <spu_mfcio.h>
+
+struct queue_entry {
+ uint64_t val;
+ uint64_t pad;
+};
+static struct queue_entry data;
+static uint32_t shared_resource __attribute((aligned(16)));
+
+int mars_task_main(const struct mars_task_args *task_args)
+{
+ int ret;
+ uint64_t mpu_to_mpu_ea = task_args->type.u64[0];
+ uint64_t shared_resource_ea = task_args->type.u64[1];
+ uint64_t val = task_args->type.u64[2];
+
+ ret = mars_task_queue_peek_begin(mpu_to_mpu_ea, &data, 1);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+
+ ret = mars_task_queue_peek_end(mpu_to_mpu_ea, 1);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+
+ MARS_TEST_ASSERT_EQUAL(data.val, val);
+
+ /* if the program reaches here, shared_resource'll be updated */
+ shared_resource = 1;
+ mfc_put(&shared_resource, shared_resource_ea, sizeof(uint32_t), 0, 0, 0);
+ mfc_write_tag_mask(1 << 0);
+ mfc_read_tag_status_all();
+
+ return 0;
+}
diff --git a/tests/TFP/TFP_4G_008/mpu2.c b/tests/TFP/TFP_4G_008/mpu2.c
new file mode 100644
index 0000000..401706d
--- /dev/null
+++ b/tests/TFP/TFP_4G_008/mpu2.c
@@ -0,0 +1,48 @@
+/*
+ * Copyright (C) 2008 Sony Computer Entertainment Inc.
+ *
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a copy
+ * of this software and associated documentation files (the "Software"), to deal
+ * in the Software without restriction, including without limitation the rights
+ * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+ * copies of the Software, and to permit persons to whom the Software is
+ * furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included in
+ * all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+ * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+ * THE SOFTWARE.
+ */
+
+#include <mars/mars.h>
+#include <mars_task_test.h>
+#include <spu_mfcio.h>
+
+struct queue_entry {
+ uint64_t val1;
+ uint64_t val2;
+};
+static struct queue_entry data;
+
+int mars_task_main(const struct mars_task_args *task_args)
+{
+ int ret;
+ uint64_t mpu_to_mpu_ea = task_args->type.u64[0];
+ uint64_t val = task_args->type.u64[1];
+
+ data.val1 = val;
+ ret = mars_task_queue_push_begin(mpu_to_mpu_ea, &data, 0);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+
+ ret = mars_task_queue_push_end(mpu_to_mpu_ea, 0);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+
+ return 0;
+}
diff --git a/tests/TFP/TFP_4G_009/Makefile b/tests/TFP/TFP_4G_009/Makefile
new file mode 100644
index 0000000..432135a
--- /dev/null
+++ b/tests/TFP/TFP_4G_009/Makefile
@@ -0,0 +1,28 @@
+#
+# Copyright 2008 Sony Corporation
+#
+#
+# Permission is hereby granted, free of charge, to any person obtaining a copy
+# of this software and associated documentation files (the "Software"), to deal
+# in the Software without restriction, including without limitation the rights
+# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+# copies of the Software, and to permit persons to whom the Software is
+# furnished to do so, subject to the following conditions:
+#
+# The above copyright notice and this permission notice shall be included in
+# all copies or substantial portions of the Software.
+#
+# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+# THE SOFTWARE.
+#
+
+top_srcdir = ../..
+test_objs = host.o mpu.task_eo
+
+include $(top_srcdir)/scripts/config.mk
+include $(top_srcdir)/scripts/rules_item.mk
diff --git a/tests/TFP/TFP_4G_009/host.c b/tests/TFP/TFP_4G_009/host.c
new file mode 100644
index 0000000..827c0e0
--- /dev/null
+++ b/tests/TFP/TFP_4G_009/host.c
@@ -0,0 +1,108 @@
+/*
+ * Copyright 2008 Sony Corporation
+ *
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a copy
+ * of this software and associated documentation files (the "Software"), to deal
+ * in the Software without restriction, including without limitation the rights
+ * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+ * copies of the Software, and to permit persons to whom the Software is
+ * furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included in
+ * all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+ * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+ * THE SOFTWARE.
+ */
+
+#include <unistd.h>
+#include <mars/mars.h>
+#include <libspe2.h>
+#include <mars_test.h>
+
+struct queue_entry {
+ uint64_t val;
+ uint64_t pad;
+};
+#define Q_DEPTH (256 * 1024)
+
+#define NUM_LOOP 2
+static uint32_t depth_size[] =
+{
+ 1,
+ Q_DEPTH
+};
+extern spe_program_handle_t mpu_prog;
+
+static struct mars_context *mars_ctx;
+static struct mars_task_args task_args;
+static struct mars_task_id task_id;
+
+static uint64_t host_to_mpu[NUM_LOOP];
+static struct queue_entry data;
+
+static uint32_t shared_resource __attribute((aligned(16)));
+
+int main(void)
+{
+ int ret, i;
+ int32_t exit_code;
+
+ ret = mars_context_create(&mars_ctx, 0, 0);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+
+ for (i = 0; i < NUM_LOOP; i++) {
+ shared_resource = 0;
+
+ ret = mars_task_queue_create(
+ mars_ctx,
+ &host_to_mpu[i],
+ sizeof(struct queue_entry),
+ depth_size[i],
+ MARS_TASK_QUEUE_HOST_TO_MPU);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+
+ /* create peek task */
+ ret = mars_task_create(mars_ctx, &task_id, NULL,
+ mpu_prog.elf_image, MARS_TASK_CONTEXT_SAVE_ALL);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+
+ task_args.type.u64[0] = host_to_mpu[i];
+ task_args.type.u64[1] = mars_ptr_to_ea(&shared_resource);
+ task_args.type.u64[2] = (uint64_t)i;
+ ret = mars_task_schedule(&task_id, &task_args, 0);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+
+ /* check if queue peek is blocked in mpu task */
+ sleep(1);
+ MARS_TEST_ASSERT_EQUAL(shared_resource, 0);
+
+ /* try_push one */
+ data.val = i;
+ ret = mars_task_queue_try_push(host_to_mpu[i], &data);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+
+ /* check if mpu task is successfly finished */
+ ret = mars_task_wait(&task_id, &exit_code);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+ MARS_TEST_ASSERT_ERROR(exit_code, MARS_SUCCESS);
+
+ ret = mars_task_destroy(&task_id);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+
+ ret = mars_task_queue_destroy(host_to_mpu[i]);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+ }
+
+ ret = mars_context_destroy(mars_ctx);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+
+ return 0;
+}
+
diff --git a/tests/TFP/TFP_4G_009/mpu.c b/tests/TFP/TFP_4G_009/mpu.c
new file mode 100644
index 0000000..8b3c611
--- /dev/null
+++ b/tests/TFP/TFP_4G_009/mpu.c
@@ -0,0 +1,64 @@
+/*
+ * Copyright 2008 Sony Corporation
+ *
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a copy
+ * of this software and associated documentation files (the "Software"), to deal
+ * in the Software without restriction, including without limitation the rights
+ * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+ * copies of the Software, and to permit persons to whom the Software is
+ * furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included in
+ * all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+ * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+ * THE SOFTWARE.
+ */
+
+#include <mars/mars.h>
+#include <mars_task_test.h>
+#include <spu_mfcio.h>
+
+struct queue_entry {
+ uint64_t val;
+ uint64_t pad;
+};
+static struct queue_entry data;
+static uint32_t shared_resource __attribute((aligned(16)));
+
+int mars_task_main(const struct mars_task_args *task_args)
+{
+ int ret;
+ uint64_t host_to_mpu_ea = task_args->type.u64[0];
+ uint64_t shared_resource_ea = task_args->type.u64[1];
+ uint64_t val = task_args->type.u64[2];
+ uint32_t count;
+
+ ret = mars_task_queue_peek_begin(host_to_mpu_ea, &data, 1);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+
+ ret = mars_task_queue_peek_end(host_to_mpu_ea, 1);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+
+ MARS_TEST_ASSERT_EQUAL(data.val, val);
+
+ /* check queue_count */
+ ret = mars_task_queue_count(host_to_mpu_ea, &count);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+ MARS_TEST_ASSERT_EQUAL(count, 1);
+
+ /* if the program reaches here, shared_resource'll be updated */
+ shared_resource = 1;
+ mfc_put(&shared_resource, shared_resource_ea,
+ sizeof(uint32_t), 0, 0, 0);
+ mfc_write_tag_mask(1 << 0);
+ mfc_read_tag_status_all();
+
+ return 0;
+}
diff --git a/tests/TFP/TFP_4G_010/Makefile b/tests/TFP/TFP_4G_010/Makefile
new file mode 100644
index 0000000..ecbce33
--- /dev/null
+++ b/tests/TFP/TFP_4G_010/Makefile
@@ -0,0 +1,28 @@
+#
+# Copyright 2008 Sony Corporation
+#
+#
+# Permission is hereby granted, free of charge, to any person obtaining a copy
+# of this software and associated documentation files (the "Software"), to deal
+# in the Software without restriction, including without limitation the rights
+# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+# copies of the Software, and to permit persons to whom the Software is
+# furnished to do so, subject to the following conditions:
+#
+# The above copyright notice and this permission notice shall be included in
+# all copies or substantial portions of the Software.
+#
+# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+# THE SOFTWARE.
+#
+
+top_srcdir = ../..
+test_objs = host.o mpu1.task_eo mpu2.task_eo
+
+include $(top_srcdir)/scripts/config.mk
+include $(top_srcdir)/scripts/rules_item.mk
diff --git a/tests/TFP/TFP_4G_010/host.c b/tests/TFP/TFP_4G_010/host.c
new file mode 100644
index 0000000..730cbca
--- /dev/null
+++ b/tests/TFP/TFP_4G_010/host.c
@@ -0,0 +1,127 @@
+/*
+ * Copyright 2008 Sony Corporation
+ *
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a copy
+ * of this software and associated documentation files (the "Software"), to deal
+ * in the Software without restriction, including without limitation the rights
+ * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+ * copies of the Software, and to permit persons to whom the Software is
+ * furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included in
+ * all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+ * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+ * THE SOFTWARE.
+ */
+
+#include <unistd.h>
+#include <mars/mars.h>
+#include <libspe2.h>
+#include <mars_test.h>
+
+struct queue_entry {
+ uint64_t val1;
+ uint64_t val2;
+};
+#define Q_DEPTH (256 * 1024)
+
+#define NUM_LOOP 2
+static uint32_t depth_size[] =
+{
+ 1,
+ Q_DEPTH
+};
+extern spe_program_handle_t mpu1_prog;
+extern spe_program_handle_t mpu2_prog;
+
+static struct mars_context *mars_ctx;
+static struct mars_task_args task1_args, task2_args;
+static struct mars_task_id task1_id, task2_id;
+
+static uint64_t mpu_to_mpu[NUM_LOOP];
+
+static uint32_t shared_resource __attribute((aligned(16)));
+
+int main(void)
+{
+ int ret, i;
+ int32_t exit_code;
+ uint32_t count;
+
+ ret = mars_context_create(&mars_ctx, 0, 0);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+
+ for (i = 0; i < NUM_LOOP; i++) {
+ shared_resource = 0;
+
+ ret = mars_task_queue_create(
+ mars_ctx,
+ &mpu_to_mpu[i],
+ sizeof(struct queue_entry),
+ depth_size[i],
+ MARS_TASK_QUEUE_MPU_TO_MPU);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+
+ /* create peek task */
+ ret = mars_task_create(mars_ctx, &task1_id, NULL,
+ mpu1_prog.elf_image, MARS_TASK_CONTEXT_SAVE_ALL);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+
+ task1_args.type.u64[0] = mpu_to_mpu[i];
+ task1_args.type.u64[1] = mars_ptr_to_ea(&shared_resource);
+ task1_args.type.u64[2] = (uint64_t)i;
+ ret = mars_task_schedule(&task1_id, &task1_args, 0);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+
+ /* create push task */
+ ret = mars_task_create(mars_ctx, &task2_id, NULL,
+ mpu2_prog.elf_image, MARS_TASK_CONTEXT_SAVE_ALL);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+
+ /* check if queue peek is blocked in mpu task */
+ sleep(1);
+ MARS_TEST_ASSERT_EQUAL(shared_resource, 0);
+
+ /* push one by mpu */
+ task2_args.type.u64[0] = mpu_to_mpu[i];
+ task2_args.type.u64[1] = (uint64_t)i;
+ ret = mars_task_schedule(&task2_id, &task2_args, 0);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+
+ ret = mars_task_wait(&task2_id, &exit_code);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+ MARS_TEST_ASSERT_ERROR(exit_code, MARS_SUCCESS);
+
+ /* check if peek task is successfly finished */
+ ret = mars_task_wait(&task1_id, &exit_code);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+ MARS_TEST_ASSERT_ERROR(exit_code, MARS_SUCCESS);
+
+ /* queue count should be 1 */
+ ret = mars_task_queue_count(mpu_to_mpu[i], &count);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+ MARS_TEST_ASSERT_EQUAL(count, 1);
+
+ ret = mars_task_destroy(&task1_id);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+
+ ret = mars_task_destroy(&task2_id);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+
+ ret = mars_task_queue_destroy(mpu_to_mpu[i]);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+ }
+
+ ret = mars_context_destroy(mars_ctx);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+
+ return 0;
+}
+
diff --git a/tests/TFP/TFP_4G_010/mpu1.c b/tests/TFP/TFP_4G_010/mpu1.c
new file mode 100644
index 0000000..c9dc04f
--- /dev/null
+++ b/tests/TFP/TFP_4G_010/mpu1.c
@@ -0,0 +1,58 @@
+/*
+ * Copyright 2008 Sony Corporation
+ *
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a copy
+ * of this software and associated documentation files (the "Software"), to deal
+ * in the Software without restriction, including without limitation the rights
+ * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+ * copies of the Software, and to permit persons to whom the Software is
+ * furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included in
+ * all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+ * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+ * THE SOFTWARE.
+ */
+
+#include <mars/mars.h>
+#include <mars_task_test.h>
+#include <spu_mfcio.h>
+
+struct queue_entry {
+ uint64_t val;
+ uint64_t pad;
+};
+static struct queue_entry data;
+static uint32_t shared_resource __attribute((aligned(16)));
+
+int mars_task_main(const struct mars_task_args *task_args)
+{
+ int ret;
+ uint64_t mpu_to_mpu_ea = task_args->type.u64[0];
+ uint64_t shared_resource_ea = task_args->type.u64[1];
+ uint64_t val = task_args->type.u64[2];
+
+ ret = mars_task_queue_peek_begin(mpu_to_mpu_ea, &data, 1);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+
+ ret = mars_task_queue_peek_end(mpu_to_mpu_ea, 1);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+
+ MARS_TEST_ASSERT_EQUAL(data.val, val);
+
+ /* if the program reaches here, shared_resource'll be updated */
+ shared_resource = 1;
+ mfc_put(&shared_resource, shared_resource_ea,
+ sizeof(uint32_t), 0, 0, 0);
+ mfc_write_tag_mask(1 << 0);
+ mfc_read_tag_status_all();
+
+ return 0;
+}
diff --git a/tests/TFP/TFP_4G_010/mpu2.c b/tests/TFP/TFP_4G_010/mpu2.c
new file mode 100644
index 0000000..2e84740
--- /dev/null
+++ b/tests/TFP/TFP_4G_010/mpu2.c
@@ -0,0 +1,45 @@
+/*
+ * Copyright 2008 Sony Corporation
+ *
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a copy
+ * of this software and associated documentation files (the "Software"), to deal
+ * in the Software without restriction, including without limitation the rights
+ * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+ * copies of the Software, and to permit persons to whom the Software is
+ * furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included in
+ * all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+ * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+ * THE SOFTWARE.
+ */
+
+#include <mars/mars.h>
+#include <mars_task_test.h>
+#include <spu_mfcio.h>
+
+struct queue_entry {
+ uint64_t val1;
+ uint64_t val2;
+};
+static struct queue_entry data;
+
+int mars_task_main(const struct mars_task_args *task_args)
+{
+ int ret;
+ uint64_t mpu_to_mpu_ea = task_args->type.u64[0];
+ uint64_t val = task_args->type.u64[1];
+
+ data.val1 = val;
+ ret = mars_task_queue_try_push(mpu_to_mpu_ea, &data);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+
+ return 0;
+}
diff --git a/tests/TFP/TFP_4G_011/Makefile b/tests/TFP/TFP_4G_011/Makefile
new file mode 100644
index 0000000..ecbce33
--- /dev/null
+++ b/tests/TFP/TFP_4G_011/Makefile
@@ -0,0 +1,28 @@
+#
+# Copyright 2008 Sony Corporation
+#
+#
+# Permission is hereby granted, free of charge, to any person obtaining a copy
+# of this software and associated documentation files (the "Software"), to deal
+# in the Software without restriction, including without limitation the rights
+# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+# copies of the Software, and to permit persons to whom the Software is
+# furnished to do so, subject to the following conditions:
+#
+# The above copyright notice and this permission notice shall be included in
+# all copies or substantial portions of the Software.
+#
+# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+# THE SOFTWARE.
+#
+
+top_srcdir = ../..
+test_objs = host.o mpu1.task_eo mpu2.task_eo
+
+include $(top_srcdir)/scripts/config.mk
+include $(top_srcdir)/scripts/rules_item.mk
diff --git a/tests/TFP/TFP_4G_011/host.c b/tests/TFP/TFP_4G_011/host.c
new file mode 100644
index 0000000..baf5039
--- /dev/null
+++ b/tests/TFP/TFP_4G_011/host.c
@@ -0,0 +1,127 @@
+/*
+ * Copyright (C) 2008 Sony Computer Entertainment Inc.
+ *
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a copy
+ * of this software and associated documentation files (the "Software"), to deal
+ * in the Software without restriction, including without limitation the rights
+ * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+ * copies of the Software, and to permit persons to whom the Software is
+ * furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included in
+ * all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+ * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+ * THE SOFTWARE.
+ */
+
+#include <unistd.h>
+#include <mars/mars.h>
+#include <libspe2.h>
+#include <mars_test.h>
+
+struct queue_entry {
+ uint64_t val1;
+ uint64_t val2;
+};
+#define Q_DEPTH (256 * 1024)
+
+#define NUM_LOOP 2
+static uint32_t depth_size[] =
+{
+ 1,
+ Q_DEPTH
+};
+extern spe_program_handle_t mpu1_prog;
+extern spe_program_handle_t mpu2_prog;
+
+static struct mars_context *mars_ctx;
+static struct mars_task_args task1_args, task2_args;
+static struct mars_task_id task1_id, task2_id;
+
+static uint64_t mpu_to_mpu[NUM_LOOP];
+
+static uint32_t shared_resource __attribute((aligned(16)));
+
+int main(void)
+{
+ int ret, i;
+ int32_t exit_code;
+ uint32_t count;
+
+ ret = mars_context_create(&mars_ctx, 0, 0);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+
+ for (i = 0; i < NUM_LOOP; i++) {
+ shared_resource = 0;
+
+ ret = mars_task_queue_create(
+ mars_ctx,
+ &mpu_to_mpu[i],
+ sizeof(struct queue_entry),
+ depth_size[i],
+ MARS_TASK_QUEUE_MPU_TO_MPU);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+
+ /* create peek task */
+ ret = mars_task_create(mars_ctx, &task1_id, NULL,
+ mpu1_prog.elf_image, MARS_TASK_CONTEXT_SAVE_ALL);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+
+ task1_args.type.u64[0] = mpu_to_mpu[i];
+ task1_args.type.u64[1] = mars_ptr_to_ea(&shared_resource);
+ task1_args.type.u64[2] = (uint64_t)i;
+ ret = mars_task_schedule(&task1_id, &task1_args, 0);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+
+ /* create push task */
+ ret = mars_task_create(mars_ctx, &task2_id, NULL,
+ mpu2_prog.elf_image, MARS_TASK_CONTEXT_SAVE_ALL);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+
+ /* check if queue peek is blocked in mpu task */
+ sleep(1);
+ MARS_TEST_ASSERT_EQUAL(shared_resource, 0);
+
+ /* push one by mpu */
+ task2_args.type.u64[0] = mpu_to_mpu[i];
+ task2_args.type.u64[1] = (uint64_t)i;
+ ret = mars_task_schedule(&task2_id, &task2_args, 0);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+
+ ret = mars_task_wait(&task2_id, &exit_code);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+ MARS_TEST_ASSERT_ERROR(exit_code, MARS_SUCCESS);
+
+ /* check if peek task is successfly finished */
+ ret = mars_task_wait(&task1_id, &exit_code);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+ MARS_TEST_ASSERT_ERROR(exit_code, MARS_SUCCESS);
+
+ /* queue count should be 1 */
+ ret = mars_task_queue_count(mpu_to_mpu[i], &count);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+ MARS_TEST_ASSERT_EQUAL(count, 1);
+
+ ret = mars_task_destroy(&task1_id);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+
+ ret = mars_task_destroy(&task2_id);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+
+ ret = mars_task_queue_destroy(mpu_to_mpu[i]);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+ }
+
+ ret = mars_context_destroy(mars_ctx);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+
+ return 0;
+}
+
diff --git a/tests/TFP/TFP_4G_011/mpu1.c b/tests/TFP/TFP_4G_011/mpu1.c
new file mode 100644
index 0000000..e4a7938
--- /dev/null
+++ b/tests/TFP/TFP_4G_011/mpu1.c
@@ -0,0 +1,57 @@
+/*
+ * Copyright (C) 2008 Sony Computer Entertainment Inc.
+ *
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a copy
+ * of this software and associated documentation files (the "Software"), to deal
+ * in the Software without restriction, including without limitation the rights
+ * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+ * copies of the Software, and to permit persons to whom the Software is
+ * furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included in
+ * all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+ * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+ * THE SOFTWARE.
+ */
+
+#include <mars/mars.h>
+#include <mars_task_test.h>
+#include <spu_mfcio.h>
+
+struct queue_entry {
+ uint64_t val;
+ uint64_t pad;
+};
+static struct queue_entry data;
+static uint32_t shared_resource __attribute((aligned(16)));
+
+int mars_task_main(const struct mars_task_args *task_args)
+{
+ int ret;
+ uint64_t mpu_to_mpu_ea = task_args->type.u64[0];
+ uint64_t shared_resource_ea = task_args->type.u64[1];
+ uint64_t val = task_args->type.u64[2];
+
+ ret = mars_task_queue_peek_begin(mpu_to_mpu_ea, &data, 1);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+
+ ret = mars_task_queue_peek_end(mpu_to_mpu_ea, 1);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+
+ MARS_TEST_ASSERT_EQUAL(data.val, val);
+
+ /* if the program reaches here, shared_resource'll be updated */
+ shared_resource = 1;
+ mfc_put(&shared_resource, shared_resource_ea, sizeof(uint32_t), 0, 0, 0);
+ mfc_write_tag_mask(1 << 0);
+ mfc_read_tag_status_all();
+
+ return 0;
+}
diff --git a/tests/TFP/TFP_4G_011/mpu2.c b/tests/TFP/TFP_4G_011/mpu2.c
new file mode 100644
index 0000000..b31e09e
--- /dev/null
+++ b/tests/TFP/TFP_4G_011/mpu2.c
@@ -0,0 +1,48 @@
+/*
+ * Copyright (C) 2008 Sony Computer Entertainment Inc.
+ *
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a copy
+ * of this software and associated documentation files (the "Software"), to deal
+ * in the Software without restriction, including without limitation the rights
+ * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+ * copies of the Software, and to permit persons to whom the Software is
+ * furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included in
+ * all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+ * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+ * THE SOFTWARE.
+ */
+
+#include <mars/mars.h>
+#include <mars_task_test.h>
+#include <spu_mfcio.h>
+
+struct queue_entry {
+ uint64_t val1;
+ uint64_t val2;
+};
+static struct queue_entry data;
+
+int mars_task_main(const struct mars_task_args *task_args)
+{
+ int ret;
+ uint64_t mpu_to_mpu_ea = task_args->type.u64[0];
+ uint64_t val = task_args->type.u64[1];
+
+ data.val1 = val;
+ ret = mars_task_queue_try_push_begin(mpu_to_mpu_ea, &data, 0);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+
+ ret = mars_task_queue_push_end(mpu_to_mpu_ea, 0);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+
+ return 0;
+}
diff --git a/tests/TFP/TFP_4H_001/Makefile b/tests/TFP/TFP_4H_001/Makefile
new file mode 100644
index 0000000..ecbce33
--- /dev/null
+++ b/tests/TFP/TFP_4H_001/Makefile
@@ -0,0 +1,28 @@
+#
+# Copyright 2008 Sony Corporation
+#
+#
+# Permission is hereby granted, free of charge, to any person obtaining a copy
+# of this software and associated documentation files (the "Software"), to deal
+# in the Software without restriction, including without limitation the rights
+# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+# copies of the Software, and to permit persons to whom the Software is
+# furnished to do so, subject to the following conditions:
+#
+# The above copyright notice and this permission notice shall be included in
+# all copies or substantial portions of the Software.
+#
+# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+# THE SOFTWARE.
+#
+
+top_srcdir = ../..
+test_objs = host.o mpu1.task_eo mpu2.task_eo
+
+include $(top_srcdir)/scripts/config.mk
+include $(top_srcdir)/scripts/rules_item.mk
diff --git a/tests/TFP/TFP_4H_001/host.c b/tests/TFP/TFP_4H_001/host.c
new file mode 100644
index 0000000..9215da3
--- /dev/null
+++ b/tests/TFP/TFP_4H_001/host.c
@@ -0,0 +1,134 @@
+/*
+ * Copyright 2008 Sony Corporation
+ *
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a copy
+ * of this software and associated documentation files (the "Software"), to deal
+ * in the Software without restriction, including without limitation the rights
+ * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+ * copies of the Software, and to permit persons to whom the Software is
+ * furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included in
+ * all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+ * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+ * THE SOFTWARE.
+ */
+
+#include <unistd.h>
+#include <mars/mars.h>
+#include <libspe2.h>
+#include <mars_test.h>
+
+struct queue_entry {
+ uint64_t val1;
+ uint64_t val2;
+};
+#define Q_DEPTH (MARS_TASK_QUEUE_WAIT_MAX)
+
+#define NUM_LOOP 5
+static uint32_t depth_size[] =
+{
+ 1,
+ Q_DEPTH / 2,
+ Q_DEPTH,
+ Q_DEPTH,
+ Q_DEPTH
+};
+extern spe_program_handle_t mpu1_prog;
+extern spe_program_handle_t mpu2_prog;
+
+static struct mars_context *mars_ctx;
+static struct mars_task_args task1_args, task2_args;
+static struct mars_task_id task1_id[Q_DEPTH], task2_id;
+
+static uint64_t mpu_to_mpu[NUM_LOOP];
+static uint32_t notify[32] __attribute((aligned(128)));
+
+int main(void)
+{
+ int ret, i;
+ int32_t exit_code;
+ uint32_t num, count;
+
+ ret = mars_context_create(&mars_ctx, 0, 0);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+
+ for (i = 0; i < NUM_LOOP; i++) {
+ notify[0] = 0;
+
+ ret = mars_task_queue_create(
+ mars_ctx,
+ &mpu_to_mpu[i],
+ sizeof(struct queue_entry),
+ depth_size[i],
+ MARS_TASK_QUEUE_MPU_TO_MPU);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+
+ /* create push task */
+ ret = mars_task_create(mars_ctx, &task2_id, NULL,
+ mpu2_prog.elf_image, MARS_TASK_CONTEXT_SAVE_ALL);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+
+ task2_args.type.u64[0] = mpu_to_mpu[i];
+ task2_args.type.u64[1] = (uint64_t)i;
+ ret = mars_task_schedule(&task2_id, &task2_args, 0);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+
+ ret = mars_task_wait(&task2_id, &exit_code);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+ MARS_TEST_ASSERT_ERROR(exit_code, MARS_SUCCESS);
+
+ for (num = 0; num < depth_size[i]; num++) {
+ /* create peek tasks */
+ /* all tasks will peek the same data */
+ ret = mars_task_create(mars_ctx, &task1_id[num], NULL,
+ mpu1_prog.elf_image, MARS_TASK_CONTEXT_SAVE_ALL);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+
+ task1_args.type.u64[0] =
+ mpu_to_mpu[i];
+ task1_args.type.u64[1] =
+ mars_ptr_to_ea(&notify);
+ task1_args.type.u64[2] = (uint64_t)i;
+ ret = mars_task_schedule(&task1_id[num],
+ &task1_args, 0);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+ }
+
+ /* start peek tasks at the same time */
+ sleep(1);
+ mars_test_counter_set(&notify[0], 1);
+
+ for (num = 0; num < depth_size[i]; num++) {
+ ret = mars_task_wait(&task1_id[num], &exit_code);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+ MARS_TEST_ASSERT_ERROR(exit_code, MARS_SUCCESS);
+
+ ret = mars_task_destroy(&task1_id[num]);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+ }
+
+ ret = mars_task_destroy(&task2_id);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+
+ ret = mars_task_queue_count(mpu_to_mpu[i], &count);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+ MARS_TEST_ASSERT_EQUAL(count, 1);
+
+ ret = mars_task_queue_destroy(mpu_to_mpu[i]);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+ }
+
+ ret = mars_context_destroy(mars_ctx);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+
+ return 0;
+}
+
diff --git a/tests/TFP/TFP_4H_001/mpu1.c b/tests/TFP/TFP_4H_001/mpu1.c
new file mode 100644
index 0000000..3dc6b55
--- /dev/null
+++ b/tests/TFP/TFP_4H_001/mpu1.c
@@ -0,0 +1,53 @@
+/*
+ * Copyright 2008 Sony Corporation
+ *
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a copy
+ * of this software and associated documentation files (the "Software"), to deal
+ * in the Software without restriction, including without limitation the rights
+ * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+ * copies of the Software, and to permit persons to whom the Software is
+ * furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included in
+ * all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+ * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+ * THE SOFTWARE.
+ */
+
+#include <mars/mars.h>
+#include <mars_task_test.h>
+#include <spu_mfcio.h>
+
+struct queue_entry {
+ uint64_t val1;
+ uint64_t val2;
+};
+static struct queue_entry data;
+
+int mars_task_main(const struct mars_task_args *task_args)
+{
+ int ret;
+ uint64_t mpu_to_mpu_ea = task_args->type.u64[0];
+ uint64_t notify_ea = task_args->type.u64[1];
+ uint32_t id = (uint32_t)task_args->type.u64[2];
+
+ mars_test_counter_wait(notify_ea, 1);
+
+ ret = mars_task_queue_peek_begin(mpu_to_mpu_ea, &data, 1);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+
+ ret = mars_task_queue_peek_end(mpu_to_mpu_ea, 1);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+
+ /* check the peeked data */
+ MARS_TEST_ASSERT_EQUAL(data.val1, id);
+
+ return 0;
+}
diff --git a/tests/TFP/TFP_4H_001/mpu2.c b/tests/TFP/TFP_4H_001/mpu2.c
new file mode 100644
index 0000000..a19ff6e
--- /dev/null
+++ b/tests/TFP/TFP_4H_001/mpu2.c
@@ -0,0 +1,45 @@
+/*
+ * Copyright 2008 Sony Corporation
+ *
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a copy
+ * of this software and associated documentation files (the "Software"), to deal
+ * in the Software without restriction, including without limitation the rights
+ * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+ * copies of the Software, and to permit persons to whom the Software is
+ * furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included in
+ * all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+ * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+ * THE SOFTWARE.
+ */
+
+#include <mars/mars.h>
+#include <mars_task_test.h>
+#include <spu_mfcio.h>
+
+struct queue_entry {
+ uint64_t val1;
+ uint64_t val2;
+};
+static struct queue_entry data;
+
+int mars_task_main(const struct mars_task_args *task_args)
+{
+ int ret;
+ uint64_t mpu_to_mpu_ea = task_args->type.u64[0];
+ uint32_t id = (uint32_t)task_args->type.u64[1];
+
+ data.val1 = id;
+ ret = mars_task_queue_push(mpu_to_mpu_ea, &data);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+
+ return 0;
+}
diff --git a/tests/TFP/TFP_4I_001/Makefile b/tests/TFP/TFP_4I_001/Makefile
new file mode 100644
index 0000000..432135a
--- /dev/null
+++ b/tests/TFP/TFP_4I_001/Makefile
@@ -0,0 +1,28 @@
+#
+# Copyright 2008 Sony Corporation
+#
+#
+# Permission is hereby granted, free of charge, to any person obtaining a copy
+# of this software and associated documentation files (the "Software"), to deal
+# in the Software without restriction, including without limitation the rights
+# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+# copies of the Software, and to permit persons to whom the Software is
+# furnished to do so, subject to the following conditions:
+#
+# The above copyright notice and this permission notice shall be included in
+# all copies or substantial portions of the Software.
+#
+# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+# THE SOFTWARE.
+#
+
+top_srcdir = ../..
+test_objs = host.o mpu.task_eo
+
+include $(top_srcdir)/scripts/config.mk
+include $(top_srcdir)/scripts/rules_item.mk
diff --git a/tests/TFP/TFP_4I_001/host.c b/tests/TFP/TFP_4I_001/host.c
new file mode 100644
index 0000000..b29b1e1
--- /dev/null
+++ b/tests/TFP/TFP_4I_001/host.c
@@ -0,0 +1,85 @@
+/*
+ * Copyright 2008 Sony Corporation
+ *
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a copy
+ * of this software and associated documentation files (the "Software"), to deal
+ * in the Software without restriction, including without limitation the rights
+ * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+ * copies of the Software, and to permit persons to whom the Software is
+ * furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included in
+ * all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+ * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+ * THE SOFTWARE.
+ */
+
+#include <libspe2.h>
+#include <mars/mars.h>
+#include <mars_test.h>
+#include "host_and_mpu.h"
+
+extern spe_program_handle_t mpu_prog;
+
+static struct mars_context *mars;
+static struct mars_task_id task_id;
+static struct mars_task_args task_args;
+static uint64_t queue;
+static uint64_t queue_item[2];
+
+int main(void)
+{
+ int i, exit_code, ret;
+
+ ret = mars_context_create(&mars, 0, 0);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+
+ ret = mars_task_create(
+ mars,
+ &task_id,
+ "4I001",
+ mpu_prog.elf_image,
+ MARS_TASK_CONTEXT_SAVE_ALL);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+
+ ret = mars_task_queue_create(
+ mars,
+ &queue,
+ 16,
+ QUEUE_DEPTH,
+ MARS_TASK_QUEUE_HOST_TO_MPU);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+
+ for (i = 0; i < QUEUE_DEPTH; i++) {
+ queue_item[0] = queue_item[1] = QUEUE_DEPTH-i;
+
+ ret = mars_task_queue_push(queue, queue_item);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+ }
+
+ task_args.type.u64[0] = queue;
+ ret = mars_task_schedule(&task_id, &task_args, 0);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+
+ ret = mars_task_wait(&task_id, &exit_code);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+ MARS_TEST_ASSERT_EQUAL(exit_code, 0);
+
+ ret = mars_task_queue_destroy(queue);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+
+ ret = mars_task_destroy(&task_id);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+
+ ret = mars_context_destroy(mars);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+
+ return 0;
+}
diff --git a/tests/TFP/TFP_4I_001/host_and_mpu.h b/tests/TFP/TFP_4I_001/host_and_mpu.h
new file mode 100644
index 0000000..e565e93
--- /dev/null
+++ b/tests/TFP/TFP_4I_001/host_and_mpu.h
@@ -0,0 +1,24 @@
+/*
+ * Copyright 2008 Sony Corporation
+ *
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a copy
+ * of this software and associated documentation files (the "Software"), to deal
+ * in the Software without restriction, including without limitation the rights
+ * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+ * copies of the Software, and to permit persons to whom the Software is
+ * furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included in
+ * all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+ * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+ * THE SOFTWARE.
+ */
+
+#define QUEUE_DEPTH 16
diff --git a/tests/TFP/TFP_4I_001/mpu.c b/tests/TFP/TFP_4I_001/mpu.c
new file mode 100644
index 0000000..e6fb1ea
--- /dev/null
+++ b/tests/TFP/TFP_4I_001/mpu.c
@@ -0,0 +1,57 @@
+/*
+ * Copyright 2008 Sony Corporation
+ *
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a copy
+ * of this software and associated documentation files (the "Software"), to deal
+ * in the Software without restriction, including without limitation the rights
+ * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+ * copies of the Software, and to permit persons to whom the Software is
+ * furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included in
+ * all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+ * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+ * THE SOFTWARE.
+ */
+
+#include <string.h>
+#include <mars/mars.h>
+#include "mars_task_test.h"
+#include "host_and_mpu.h"
+
+static uint64_t queue_item[2] __attribute__((aligned(16)));
+
+int mars_task_main(const struct mars_task_args *task_args)
+{
+ uint64_t queue_ea = task_args->type.u64[0];
+ uint32_t count;
+ int ret;
+
+ ret = mars_task_queue_count(queue_ea, &count);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+
+ MARS_TEST_ASSERT(count == QUEUE_DEPTH);
+
+ ret = mars_task_queue_try_peek(queue_ea, queue_item);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+
+ MARS_TEST_ASSERT(
+ queue_item[0] == QUEUE_DEPTH &&
+ queue_item[1] == QUEUE_DEPTH);
+
+ ret = mars_task_queue_count(queue_ea, &count);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+
+ MARS_TEST_ASSERT(count == QUEUE_DEPTH);
+
+ mars_task_exit(0);
+
+ return 0;
+}
diff --git a/tests/TFP/TFP_4I_002/Makefile b/tests/TFP/TFP_4I_002/Makefile
new file mode 100644
index 0000000..432135a
--- /dev/null
+++ b/tests/TFP/TFP_4I_002/Makefile
@@ -0,0 +1,28 @@
+#
+# Copyright 2008 Sony Corporation
+#
+#
+# Permission is hereby granted, free of charge, to any person obtaining a copy
+# of this software and associated documentation files (the "Software"), to deal
+# in the Software without restriction, including without limitation the rights
+# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+# copies of the Software, and to permit persons to whom the Software is
+# furnished to do so, subject to the following conditions:
+#
+# The above copyright notice and this permission notice shall be included in
+# all copies or substantial portions of the Software.
+#
+# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+# THE SOFTWARE.
+#
+
+top_srcdir = ../..
+test_objs = host.o mpu.task_eo
+
+include $(top_srcdir)/scripts/config.mk
+include $(top_srcdir)/scripts/rules_item.mk
diff --git a/tests/TFP/TFP_4I_002/host.c b/tests/TFP/TFP_4I_002/host.c
new file mode 100644
index 0000000..591489b
--- /dev/null
+++ b/tests/TFP/TFP_4I_002/host.c
@@ -0,0 +1,96 @@
+/*
+ * Copyright 2008 Sony Corporation
+ *
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a copy
+ * of this software and associated documentation files (the "Software"), to deal
+ * in the Software without restriction, including without limitation the rights
+ * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+ * copies of the Software, and to permit persons to whom the Software is
+ * furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included in
+ * all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+ * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+ * THE SOFTWARE.
+ */
+
+#include <libspe2.h>
+#include <mars/mars.h>
+#include <mars_test.h>
+#include "host_and_mpu.h"
+
+extern spe_program_handle_t mpu_prog;
+
+static struct mars_context *mars;
+static struct mars_task_id task_id;
+static struct mars_task_args task_args;
+static uint64_t queue;
+static uint64_t queue_item[2];
+
+int main(void)
+{
+ int exit_code, ret;
+ uint32_t count;
+
+ ret = mars_context_create(&mars, 0, 0);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+
+ ret = mars_task_create(
+ mars,
+ &task_id,
+ "4I002",
+ mpu_prog.elf_image,
+ MARS_TASK_CONTEXT_SAVE_ALL);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+
+ ret = mars_task_queue_create(
+ mars,
+ &queue,
+ 16,
+ QUEUE_DEPTH,
+ MARS_TASK_QUEUE_MPU_TO_HOST);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+
+ task_args.type.u64[0] = queue;
+ ret = mars_task_schedule(&task_id, &task_args, 0);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+
+ ret = mars_task_wait(&task_id, &exit_code);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+ MARS_TEST_ASSERT_EQUAL(exit_code, 0);
+
+ ret = mars_task_queue_count(queue, &count);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+
+ MARS_TEST_ASSERT(count == QUEUE_DEPTH);
+
+ ret = mars_task_queue_try_peek(queue, queue_item);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+
+ MARS_TEST_ASSERT(
+ queue_item[0] == QUEUE_DEPTH &&
+ queue_item[1] == QUEUE_DEPTH);
+
+ ret = mars_task_queue_count(queue, &count);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+
+ MARS_TEST_ASSERT(count == QUEUE_DEPTH);
+
+ ret = mars_task_queue_destroy(queue);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+
+ ret = mars_task_destroy(&task_id);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+
+ ret = mars_context_destroy(mars);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+
+ return 0;
+}
diff --git a/tests/TFP/TFP_4I_002/host_and_mpu.h b/tests/TFP/TFP_4I_002/host_and_mpu.h
new file mode 100644
index 0000000..e565e93
--- /dev/null
+++ b/tests/TFP/TFP_4I_002/host_and_mpu.h
@@ -0,0 +1,24 @@
+/*
+ * Copyright 2008 Sony Corporation
+ *
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a copy
+ * of this software and associated documentation files (the "Software"), to deal
+ * in the Software without restriction, including without limitation the rights
+ * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+ * copies of the Software, and to permit persons to whom the Software is
+ * furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included in
+ * all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+ * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+ * THE SOFTWARE.
+ */
+
+#define QUEUE_DEPTH 16
diff --git a/tests/TFP/TFP_4I_002/mpu.c b/tests/TFP/TFP_4I_002/mpu.c
new file mode 100644
index 0000000..d61f5c8
--- /dev/null
+++ b/tests/TFP/TFP_4I_002/mpu.c
@@ -0,0 +1,46 @@
+/*
+ * Copyright 2008 Sony Corporation
+ *
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a copy
+ * of this software and associated documentation files (the "Software"), to deal
+ * in the Software without restriction, including without limitation the rights
+ * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+ * copies of the Software, and to permit persons to whom the Software is
+ * furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included in
+ * all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+ * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+ * THE SOFTWARE.
+ */
+
+#include <string.h>
+#include <mars/mars.h>
+#include "mars_task_test.h"
+#include "host_and_mpu.h"
+
+static uint64_t queue_item[2] __attribute__((aligned(16)));
+
+int mars_task_main(const struct mars_task_args *task_args)
+{
+ uint64_t queue_ea = task_args->type.u64[0];
+ int i, ret;
+
+ for (i = 0; i < QUEUE_DEPTH; i++) {
+ queue_item[0] = queue_item[1] = QUEUE_DEPTH-i;
+
+ ret = mars_task_queue_push(queue_ea, queue_item);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+ }
+
+ mars_task_exit(0);
+
+ return 0;
+}
diff --git a/tests/TFP/TFP_4I_003/Makefile b/tests/TFP/TFP_4I_003/Makefile
new file mode 100644
index 0000000..ecbce33
--- /dev/null
+++ b/tests/TFP/TFP_4I_003/Makefile
@@ -0,0 +1,28 @@
+#
+# Copyright 2008 Sony Corporation
+#
+#
+# Permission is hereby granted, free of charge, to any person obtaining a copy
+# of this software and associated documentation files (the "Software"), to deal
+# in the Software without restriction, including without limitation the rights
+# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+# copies of the Software, and to permit persons to whom the Software is
+# furnished to do so, subject to the following conditions:
+#
+# The above copyright notice and this permission notice shall be included in
+# all copies or substantial portions of the Software.
+#
+# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+# THE SOFTWARE.
+#
+
+top_srcdir = ../..
+test_objs = host.o mpu1.task_eo mpu2.task_eo
+
+include $(top_srcdir)/scripts/config.mk
+include $(top_srcdir)/scripts/rules_item.mk
diff --git a/tests/TFP/TFP_4I_003/host.c b/tests/TFP/TFP_4I_003/host.c
new file mode 100644
index 0000000..d75ba4d
--- /dev/null
+++ b/tests/TFP/TFP_4I_003/host.c
@@ -0,0 +1,97 @@
+/*
+ * Copyright 2008 Sony Corporation
+ *
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a copy
+ * of this software and associated documentation files (the "Software"), to deal
+ * in the Software without restriction, including without limitation the rights
+ * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+ * copies of the Software, and to permit persons to whom the Software is
+ * furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included in
+ * all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+ * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+ * THE SOFTWARE.
+ */
+
+#include <libspe2.h>
+#include <mars/mars.h>
+#include <mars_test.h>
+#include "host_and_mpu.h"
+
+extern spe_program_handle_t mpu1_prog, mpu2_prog;
+
+static struct mars_context *mars;
+static struct mars_task_id pusher_task_id, poper_task_id;
+static struct mars_task_args task_args;
+static uint64_t queue;
+static uint32_t notify[32] __attribute__((aligned(16)));
+
+int main(void)
+{
+ int exit_code, ret;
+
+ ret = mars_context_create(&mars, 0, 0);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+
+ ret = mars_task_create(
+ mars,
+ &pusher_task_id,
+ "4I003",
+ mpu1_prog.elf_image,
+ MARS_TASK_CONTEXT_SAVE_ALL);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+
+ ret = mars_task_create(
+ mars,
+ &poper_task_id,
+ "4I003",
+ mpu2_prog.elf_image,
+ MARS_TASK_CONTEXT_SAVE_ALL);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+
+ ret = mars_task_queue_create(
+ mars,
+ &queue,
+ 16,
+ QUEUE_DEPTH,
+ MARS_TASK_QUEUE_MPU_TO_MPU);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+
+ task_args.type.u64[0] = queue;
+ task_args.type.u64[1] = mars_ptr_to_ea(notify);
+ ret = mars_task_schedule(&pusher_task_id, &task_args, 0);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+
+ ret = mars_task_schedule(&poper_task_id, &task_args, 0);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+
+ ret = mars_task_wait(&pusher_task_id, &exit_code);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+ MARS_TEST_ASSERT_EQUAL(exit_code, 0);
+
+ ret = mars_task_wait(&poper_task_id, &exit_code);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+ MARS_TEST_ASSERT_EQUAL(exit_code, 0);
+
+ ret = mars_task_queue_destroy(queue);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+
+ ret = mars_task_destroy(&pusher_task_id);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+
+ ret = mars_task_destroy(&poper_task_id);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+
+ ret = mars_context_destroy(mars);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+
+ return 0;
+}
diff --git a/tests/TFP/TFP_4I_003/host_and_mpu.h b/tests/TFP/TFP_4I_003/host_and_mpu.h
new file mode 100644
index 0000000..e565e93
--- /dev/null
+++ b/tests/TFP/TFP_4I_003/host_and_mpu.h
@@ -0,0 +1,24 @@
+/*
+ * Copyright 2008 Sony Corporation
+ *
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a copy
+ * of this software and associated documentation files (the "Software"), to deal
+ * in the Software without restriction, including without limitation the rights
+ * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+ * copies of the Software, and to permit persons to whom the Software is
+ * furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included in
+ * all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+ * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+ * THE SOFTWARE.
+ */
+
+#define QUEUE_DEPTH 16
diff --git a/tests/TFP/TFP_4I_003/mpu1.c b/tests/TFP/TFP_4I_003/mpu1.c
new file mode 100644
index 0000000..a3f962c
--- /dev/null
+++ b/tests/TFP/TFP_4I_003/mpu1.c
@@ -0,0 +1,50 @@
+/*
+ * Copyright 2008 Sony Corporation
+ *
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a copy
+ * of this software and associated documentation files (the "Software"), to deal
+ * in the Software without restriction, including without limitation the rights
+ * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+ * copies of the Software, and to permit persons to whom the Software is
+ * furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included in
+ * all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+ * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+ * THE SOFTWARE.
+ */
+
+#include <string.h>
+#include <mars/mars.h>
+#include "mars_task_test.h"
+#include "host_and_mpu.h"
+
+static uint64_t queue_item[2] __attribute__((aligned(16)));
+
+int mars_task_main(const struct mars_task_args *task_args)
+{
+ uint64_t queue_ea = task_args->type.u64[0];
+ uint64_t notify_ea = task_args->type.u64[1];
+ uint32_t i;
+ int ret;
+
+ for (i = 0; i < QUEUE_DEPTH; i++) {
+ queue_item[0] = queue_item[1] = QUEUE_DEPTH-i;
+
+ ret = mars_task_queue_push(queue_ea, queue_item);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+ }
+
+ mars_test_counter_set(notify_ea, 1);
+
+ mars_task_exit(0);
+
+ return 0;
+}
diff --git a/tests/TFP/TFP_4I_003/mpu2.c b/tests/TFP/TFP_4I_003/mpu2.c
new file mode 100644
index 0000000..3d17f55
--- /dev/null
+++ b/tests/TFP/TFP_4I_003/mpu2.c
@@ -0,0 +1,56 @@
+/*
+ * Copyright 2008 Sony Corporation
+ *
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a copy
+ * of this software and associated documentation files (the "Software"), to deal
+ * in the Software without restriction, including without limitation the rights
+ * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+ * copies of the Software, and to permit persons to whom the Software is
+ * furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included in
+ * all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+ * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+ * THE SOFTWARE.
+ */
+
+#include <string.h>
+#include <mars/mars.h>
+#include "mars_task_test.h"
+#include "host_and_mpu.h"
+
+static uint64_t queue_item[2] __attribute__((aligned(16)));
+
+int mars_task_main(const struct mars_task_args *task_args)
+{
+ uint64_t queue_ea = task_args->type.u64[0];
+ uint64_t notify_ea = task_args->type.u64[1];
+ uint32_t count;
+ int ret;
+
+ mars_test_counter_wait(notify_ea, 1);
+
+ ret = mars_task_queue_count(queue_ea, &count);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+ MARS_TEST_ASSERT(count == QUEUE_DEPTH);
+
+ ret = mars_task_queue_try_peek(queue_ea, queue_item);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+ MARS_TEST_ASSERT(queue_item[0] == QUEUE_DEPTH &&
+ queue_item[1] == QUEUE_DEPTH);
+
+ ret = mars_task_queue_count(queue_ea, &count);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+ MARS_TEST_ASSERT(count == QUEUE_DEPTH);
+
+ mars_task_exit(0);
+
+ return 0;
+}
diff --git a/tests/TFP/TFP_4I_004/Makefile b/tests/TFP/TFP_4I_004/Makefile
new file mode 100644
index 0000000..432135a
--- /dev/null
+++ b/tests/TFP/TFP_4I_004/Makefile
@@ -0,0 +1,28 @@
+#
+# Copyright 2008 Sony Corporation
+#
+#
+# Permission is hereby granted, free of charge, to any person obtaining a copy
+# of this software and associated documentation files (the "Software"), to deal
+# in the Software without restriction, including without limitation the rights
+# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+# copies of the Software, and to permit persons to whom the Software is
+# furnished to do so, subject to the following conditions:
+#
+# The above copyright notice and this permission notice shall be included in
+# all copies or substantial portions of the Software.
+#
+# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+# THE SOFTWARE.
+#
+
+top_srcdir = ../..
+test_objs = host.o mpu.task_eo
+
+include $(top_srcdir)/scripts/config.mk
+include $(top_srcdir)/scripts/rules_item.mk
diff --git a/tests/TFP/TFP_4I_004/host.c b/tests/TFP/TFP_4I_004/host.c
new file mode 100644
index 0000000..c60c496
--- /dev/null
+++ b/tests/TFP/TFP_4I_004/host.c
@@ -0,0 +1,78 @@
+/*
+ * Copyright 2008 Sony Corporation
+ *
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a copy
+ * of this software and associated documentation files (the "Software"), to deal
+ * in the Software without restriction, including without limitation the rights
+ * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+ * copies of the Software, and to permit persons to whom the Software is
+ * furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included in
+ * all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+ * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+ * THE SOFTWARE.
+ */
+
+#include <libspe2.h>
+#include <mars/mars.h>
+#include <mars_test.h>
+
+#define QUEUE_DEPTH 16
+
+extern spe_program_handle_t mpu_prog;
+
+static struct mars_context *mars;
+static struct mars_task_id task_id;
+static struct mars_task_args task_args;
+static uint64_t queue;
+
+int main(void)
+{
+ int exit_code, ret;
+
+ ret = mars_context_create(&mars, 0, 0);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+
+ ret = mars_task_create(
+ mars,
+ &task_id,
+ "4I004",
+ mpu_prog.elf_image,
+ MARS_TASK_CONTEXT_SAVE_ALL);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+
+ ret = mars_task_queue_create(
+ mars,
+ &queue,
+ 16,
+ QUEUE_DEPTH,
+ MARS_TASK_QUEUE_HOST_TO_MPU);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+
+ task_args.type.u64[0] = queue;
+ ret = mars_task_schedule(&task_id, &task_args, 0);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+
+ ret = mars_task_wait(&task_id, &exit_code);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+ MARS_TEST_ASSERT_EQUAL(exit_code, 0);
+
+ ret = mars_task_queue_destroy(queue);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+
+ ret = mars_task_destroy(&task_id);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+
+ ret = mars_context_destroy(mars);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+
+ return 0;
+}
diff --git a/tests/TFP/TFP_4I_004/mpu.c b/tests/TFP/TFP_4I_004/mpu.c
new file mode 100644
index 0000000..220eaec
--- /dev/null
+++ b/tests/TFP/TFP_4I_004/mpu.c
@@ -0,0 +1,41 @@
+/*
+ * Copyright 2008 Sony Corporation
+ *
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a copy
+ * of this software and associated documentation files (the "Software"), to deal
+ * in the Software without restriction, including without limitation the rights
+ * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+ * copies of the Software, and to permit persons to whom the Software is
+ * furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included in
+ * all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+ * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+ * THE SOFTWARE.
+ */
+
+#include <string.h>
+#include <mars/mars.h>
+#include "mars_task_test.h"
+
+static uint64_t queue_item[2] __attribute__((aligned(16)));
+
+int mars_task_main(const struct mars_task_args *task_args)
+{
+ int ret;
+ uint64_t queue_ea = task_args->type.u64[0];
+
+ ret = mars_task_queue_try_peek(queue_ea, queue_item);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_ERROR_BUSY);
+
+ mars_task_exit(0);
+
+ return 0;
+}
diff --git a/tests/TFP/TFP_4I_005/Makefile b/tests/TFP/TFP_4I_005/Makefile
new file mode 100644
index 0000000..43ba573
--- /dev/null
+++ b/tests/TFP/TFP_4I_005/Makefile
@@ -0,0 +1,28 @@
+#
+# Copyright 2008 Sony Corporation
+#
+#
+# Permission is hereby granted, free of charge, to any person obtaining a copy
+# of this software and associated documentation files (the "Software"), to deal
+# in the Software without restriction, including without limitation the rights
+# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+# copies of the Software, and to permit persons to whom the Software is
+# furnished to do so, subject to the following conditions:
+#
+# The above copyright notice and this permission notice shall be included in
+# all copies or substantial portions of the Software.
+#
+# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+# THE SOFTWARE.
+#
+
+top_srcdir = ../..
+test_objs = host.o
+
+include $(top_srcdir)/scripts/config.mk
+include $(top_srcdir)/scripts/rules_item.mk
diff --git a/tests/TFP/TFP_4I_005/host.c b/tests/TFP/TFP_4I_005/host.c
new file mode 100644
index 0000000..983399a
--- /dev/null
+++ b/tests/TFP/TFP_4I_005/host.c
@@ -0,0 +1,59 @@
+/*
+ * Copyright 2008 Sony Corporation
+ *
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a copy
+ * of this software and associated documentation files (the "Software"), to deal
+ * in the Software without restriction, including without limitation the rights
+ * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+ * copies of the Software, and to permit persons to whom the Software is
+ * furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included in
+ * all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+ * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+ * THE SOFTWARE.
+ */
+
+#include <libspe2.h>
+#include <mars/mars.h>
+#include <mars_test.h>
+
+#define QUEUE_DEPTH 16
+
+static struct mars_context *mars;
+static uint64_t queue;
+static uint64_t queue_item[2];
+
+int main(void)
+{
+ int ret;
+
+ ret = mars_context_create(&mars, 0, 0);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+
+ ret = mars_task_queue_create(
+ mars,
+ &queue,
+ 16,
+ QUEUE_DEPTH,
+ MARS_TASK_QUEUE_MPU_TO_HOST);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+
+ ret = mars_task_queue_try_peek(queue, queue_item);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_ERROR_BUSY);
+
+ ret = mars_task_queue_destroy(queue);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+
+ ret = mars_context_destroy(mars);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+
+ return 0;
+}
diff --git a/tests/TFP/TFP_4I_006/Makefile b/tests/TFP/TFP_4I_006/Makefile
new file mode 100644
index 0000000..432135a
--- /dev/null
+++ b/tests/TFP/TFP_4I_006/Makefile
@@ -0,0 +1,28 @@
+#
+# Copyright 2008 Sony Corporation
+#
+#
+# Permission is hereby granted, free of charge, to any person obtaining a copy
+# of this software and associated documentation files (the "Software"), to deal
+# in the Software without restriction, including without limitation the rights
+# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+# copies of the Software, and to permit persons to whom the Software is
+# furnished to do so, subject to the following conditions:
+#
+# The above copyright notice and this permission notice shall be included in
+# all copies or substantial portions of the Software.
+#
+# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+# THE SOFTWARE.
+#
+
+top_srcdir = ../..
+test_objs = host.o mpu.task_eo
+
+include $(top_srcdir)/scripts/config.mk
+include $(top_srcdir)/scripts/rules_item.mk
diff --git a/tests/TFP/TFP_4I_006/host.c b/tests/TFP/TFP_4I_006/host.c
new file mode 100644
index 0000000..64d304f
--- /dev/null
+++ b/tests/TFP/TFP_4I_006/host.c
@@ -0,0 +1,78 @@
+/*
+ * Copyright 2008 Sony Corporation
+ *
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a copy
+ * of this software and associated documentation files (the "Software"), to deal
+ * in the Software without restriction, including without limitation the rights
+ * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+ * copies of the Software, and to permit persons to whom the Software is
+ * furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included in
+ * all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+ * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+ * THE SOFTWARE.
+ */
+
+#include <libspe2.h>
+#include <mars/mars.h>
+#include <mars_test.h>
+
+#define QUEUE_DEPTH 16
+
+extern spe_program_handle_t mpu_prog;
+
+static struct mars_context *mars;
+static struct mars_task_id task_id;
+static struct mars_task_args task_args;
+static uint64_t queue;
+
+int main(void)
+{
+ int exit_code, ret;
+
+ ret = mars_context_create(&mars, 0, 0);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+
+ ret = mars_task_create(
+ mars,
+ &task_id,
+ "4I006",
+ mpu_prog.elf_image,
+ MARS_TASK_CONTEXT_SAVE_ALL);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+
+ ret = mars_task_queue_create(
+ mars,
+ &queue,
+ 16,
+ QUEUE_DEPTH,
+ MARS_TASK_QUEUE_MPU_TO_MPU);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+
+ task_args.type.u64[0] = queue;
+ ret = mars_task_schedule(&task_id, &task_args, 0);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+
+ ret = mars_task_wait(&task_id, &exit_code);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+ MARS_TEST_ASSERT_EQUAL(exit_code, 0);
+
+ ret = mars_task_queue_destroy(queue);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+
+ ret = mars_task_destroy(&task_id);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+
+ ret = mars_context_destroy(mars);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+
+ return 0;
+}
diff --git a/tests/TFP/TFP_4I_006/mpu.c b/tests/TFP/TFP_4I_006/mpu.c
new file mode 100644
index 0000000..220eaec
--- /dev/null
+++ b/tests/TFP/TFP_4I_006/mpu.c
@@ -0,0 +1,41 @@
+/*
+ * Copyright 2008 Sony Corporation
+ *
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a copy
+ * of this software and associated documentation files (the "Software"), to deal
+ * in the Software without restriction, including without limitation the rights
+ * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+ * copies of the Software, and to permit persons to whom the Software is
+ * furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included in
+ * all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+ * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+ * THE SOFTWARE.
+ */
+
+#include <string.h>
+#include <mars/mars.h>
+#include "mars_task_test.h"
+
+static uint64_t queue_item[2] __attribute__((aligned(16)));
+
+int mars_task_main(const struct mars_task_args *task_args)
+{
+ int ret;
+ uint64_t queue_ea = task_args->type.u64[0];
+
+ ret = mars_task_queue_try_peek(queue_ea, queue_item);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_ERROR_BUSY);
+
+ mars_task_exit(0);
+
+ return 0;
+}
diff --git a/tests/TFP/TFP_4I_007/Makefile b/tests/TFP/TFP_4I_007/Makefile
new file mode 100644
index 0000000..432135a
--- /dev/null
+++ b/tests/TFP/TFP_4I_007/Makefile
@@ -0,0 +1,28 @@
+#
+# Copyright 2008 Sony Corporation
+#
+#
+# Permission is hereby granted, free of charge, to any person obtaining a copy
+# of this software and associated documentation files (the "Software"), to deal
+# in the Software without restriction, including without limitation the rights
+# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+# copies of the Software, and to permit persons to whom the Software is
+# furnished to do so, subject to the following conditions:
+#
+# The above copyright notice and this permission notice shall be included in
+# all copies or substantial portions of the Software.
+#
+# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+# THE SOFTWARE.
+#
+
+top_srcdir = ../..
+test_objs = host.o mpu.task_eo
+
+include $(top_srcdir)/scripts/config.mk
+include $(top_srcdir)/scripts/rules_item.mk
diff --git a/tests/TFP/TFP_4I_007/host.c b/tests/TFP/TFP_4I_007/host.c
new file mode 100644
index 0000000..788845b
--- /dev/null
+++ b/tests/TFP/TFP_4I_007/host.c
@@ -0,0 +1,115 @@
+/*
+ * Copyright 2008 Sony Corporation
+ *
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a copy
+ * of this software and associated documentation files (the "Software"), to deal
+ * in the Software without restriction, including without limitation the rights
+ * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+ * copies of the Software, and to permit persons to whom the Software is
+ * furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included in
+ * all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+ * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+ * THE SOFTWARE.
+ */
+
+#include <unistd.h>
+#include <mars/mars.h>
+#include <libspe2.h>
+#include <mars_test.h>
+
+struct queue_entry {
+ uint64_t val1;
+ uint64_t val2;
+};
+#define Q_DEPTH (MARS_TASK_QUEUE_WAIT_MAX)
+
+#define NUM_LOOP 5
+static uint32_t depth_size[] =
+{
+ 1,
+ Q_DEPTH / 2,
+ Q_DEPTH,
+ Q_DEPTH,
+ Q_DEPTH
+};
+extern spe_program_handle_t mpu_prog;
+
+static struct mars_context *mars_ctx;
+static struct mars_task_args task_args;
+static struct mars_task_id task_id[Q_DEPTH];
+
+static uint64_t host_to_mpu[NUM_LOOP];
+static struct queue_entry data;
+
+int main(void)
+{
+ int ret, i;
+ int32_t exit_code;
+ uint32_t num, count;
+
+ ret = mars_context_create(&mars_ctx, 0, 0);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+
+ for (i = 0; i < NUM_LOOP; i++) {
+
+ ret = mars_task_queue_create(
+ mars_ctx,
+ &host_to_mpu[i],
+ sizeof(struct queue_entry),
+ depth_size[i],
+ MARS_TASK_QUEUE_HOST_TO_MPU);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+
+ for (num = 0; num < depth_size[i]; num++) {
+ /* create peek tasks */
+ /* all tasks will peek the same data */
+ ret = mars_task_create(mars_ctx, &task_id[num], NULL,
+ mpu_prog.elf_image, MARS_TASK_CONTEXT_SAVE_ALL);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+
+ task_args.type.u64[0] = host_to_mpu[i];
+ task_args.type.u64[1] = (uint64_t)i;
+ ret = mars_task_schedule(&task_id[num], &task_args, 0);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+ }
+
+ /* wait for task schedule */
+ sleep(1);
+
+ /* push one data to the queue */
+ data.val1 = i;
+ ret = mars_task_queue_push(host_to_mpu[i], &data);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+
+ for (num = 0; num < depth_size[i]; num++) {
+ ret = mars_task_wait(&task_id[num], &exit_code);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+ MARS_TEST_ASSERT_ERROR(exit_code, MARS_SUCCESS);
+
+ ret = mars_task_destroy(&task_id[num]);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+ }
+
+ ret = mars_task_queue_count(host_to_mpu[i], &count);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+ MARS_TEST_ASSERT_EQUAL(count, 1);
+
+ ret = mars_task_queue_destroy(host_to_mpu[i]);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+ }
+
+ ret = mars_context_destroy(mars_ctx);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+
+ return 0;
+}
+
diff --git a/tests/TFP/TFP_4I_007/mpu.c b/tests/TFP/TFP_4I_007/mpu.c
new file mode 100644
index 0000000..3b25d7f
--- /dev/null
+++ b/tests/TFP/TFP_4I_007/mpu.c
@@ -0,0 +1,53 @@
+/*
+ * Copyright 2008 Sony Corporation
+ *
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a copy
+ * of this software and associated documentation files (the "Software"), to deal
+ * in the Software without restriction, including without limitation the rights
+ * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+ * copies of the Software, and to permit persons to whom the Software is
+ * furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included in
+ * all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+ * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+ * THE SOFTWARE.
+ */
+
+#include <mars/mars.h>
+#include <mars_task_test.h>
+
+struct queue_entry {
+ uint64_t val1;
+ uint64_t val2;
+};
+static struct queue_entry data;
+
+int mars_task_main(const struct mars_task_args *task_args)
+{
+ int ret;
+ uint64_t host_to_mpu_ea = task_args->type.u64[0];
+ uint32_t id = (uint32_t)task_args->type.u64[1];
+
+ while (1) {
+ ret = mars_task_queue_try_peek(host_to_mpu_ea, &data);
+ if (ret == MARS_SUCCESS)
+ break;
+ else if (ret == MARS_ERROR_BUSY)
+ continue;
+ else
+ MARS_TEST_ASSERT_ERROR(ret, 0);
+ }
+
+ /* check the peeked data */
+ MARS_TEST_ASSERT_EQUAL(data.val1, id);
+
+ return 0;
+}
diff --git a/tests/TFP/TFP_4I_008/Makefile b/tests/TFP/TFP_4I_008/Makefile
new file mode 100644
index 0000000..432135a
--- /dev/null
+++ b/tests/TFP/TFP_4I_008/Makefile
@@ -0,0 +1,28 @@
+#
+# Copyright 2008 Sony Corporation
+#
+#
+# Permission is hereby granted, free of charge, to any person obtaining a copy
+# of this software and associated documentation files (the "Software"), to deal
+# in the Software without restriction, including without limitation the rights
+# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+# copies of the Software, and to permit persons to whom the Software is
+# furnished to do so, subject to the following conditions:
+#
+# The above copyright notice and this permission notice shall be included in
+# all copies or substantial portions of the Software.
+#
+# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+# THE SOFTWARE.
+#
+
+top_srcdir = ../..
+test_objs = host.o mpu.task_eo
+
+include $(top_srcdir)/scripts/config.mk
+include $(top_srcdir)/scripts/rules_item.mk
diff --git a/tests/TFP/TFP_4I_008/host.c b/tests/TFP/TFP_4I_008/host.c
new file mode 100644
index 0000000..6ab50f8
--- /dev/null
+++ b/tests/TFP/TFP_4I_008/host.c
@@ -0,0 +1,143 @@
+/*
+ * Copyright 2008 Sony Corporation
+ *
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a copy
+ * of this software and associated documentation files (the "Software"), to deal
+ * in the Software without restriction, including without limitation the rights
+ * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+ * copies of the Software, and to permit persons to whom the Software is
+ * furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included in
+ * all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+ * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+ * THE SOFTWARE.
+ */
+
+#include <pthread.h>
+#include <unistd.h>
+#include <mars/mars.h>
+#include <libspe2.h>
+#include <mars_test.h>
+
+struct queue_entry {
+ uint64_t val1;
+ uint64_t val2;
+};
+#define Q_DEPTH (MARS_TASK_QUEUE_WAIT_MAX)
+
+#define NUM_LOOP 5
+static uint32_t depth_size[] =
+{
+ 1,
+ Q_DEPTH / 2,
+ Q_DEPTH,
+ Q_DEPTH,
+ Q_DEPTH
+};
+extern spe_program_handle_t mpu_prog;
+
+static struct mars_context *mars_ctx;
+static struct mars_task_args task_args, thread_args[Q_DEPTH];
+static struct mars_task_id task_id;
+
+static uint64_t mpu_to_host[NUM_LOOP];
+static struct queue_entry data[Q_DEPTH];
+
+
+static pthread_t thread[Q_DEPTH];
+static void *thread_proc(void *ptr)
+{
+ int ret;
+ struct mars_task_args *task_args = (struct mars_task_args *)ptr;
+ uint32_t id = (uint32_t)task_args->type.u32[0];
+ uint32_t num = (uint32_t)task_args->type.u32[1];
+
+ while (1) {
+ ret = mars_task_queue_try_peek(mpu_to_host[id], &data[num]);
+ if (ret == MARS_SUCCESS)
+ break;
+ else if (ret == MARS_ERROR_BUSY)
+ continue;
+ else
+ MARS_TEST_ASSERT_ERROR(ret, 0);
+ }
+
+ /* check the peeked data */
+ MARS_TEST_ASSERT_EQUAL(data[num].val1, id);
+
+ return NULL;
+}
+
+int main(void)
+{
+ int ret, i;
+ int32_t exit_code;
+ uint32_t num, count;
+
+ ret = mars_context_create(&mars_ctx, 0, 0);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+
+ for (i = 0; i < NUM_LOOP; i++) {
+
+ ret = mars_task_queue_create(
+ mars_ctx,
+ &mpu_to_host[i],
+ sizeof(struct queue_entry),
+ depth_size[i],
+ MARS_TASK_QUEUE_MPU_TO_HOST);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+
+ for (num = 0; num < depth_size[i]; num++) {
+ /* create peek thread */
+ /* all threads will peek the same queue */
+ thread_args[num].type.u32[0] = (uint32_t)i;
+ thread_args[num].type.u32[1] = (uint32_t)num;
+ pthread_create(&thread[num], NULL,
+ thread_proc, &thread_args[num]);
+ }
+
+ /* wait for thread create */
+ sleep(1);
+
+ /* create push task */
+ ret = mars_task_create(mars_ctx, &task_id, NULL,
+ mpu_prog.elf_image, MARS_TASK_CONTEXT_SAVE_ALL);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+
+ task_args.type.u64[0] = mpu_to_host[i];
+ task_args.type.u64[1] = (uint64_t)i;
+ ret = mars_task_schedule(&task_id, &task_args, 0);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+
+ ret = mars_task_wait(&task_id, &exit_code);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+ MARS_TEST_ASSERT_ERROR(exit_code, MARS_SUCCESS);
+
+ for (num = 0; num < depth_size[i]; num++)
+ pthread_join(thread[num], NULL);
+
+ ret = mars_task_destroy(&task_id);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+
+ ret = mars_task_queue_count(mpu_to_host[i], &count);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+ MARS_TEST_ASSERT_EQUAL(count, 1);
+
+ ret = mars_task_queue_destroy(mpu_to_host[i]);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+ }
+
+ ret = mars_context_destroy(mars_ctx);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+
+ return 0;
+}
+
diff --git a/tests/TFP/TFP_4I_008/mpu.c b/tests/TFP/TFP_4I_008/mpu.c
new file mode 100644
index 0000000..1bf90b4
--- /dev/null
+++ b/tests/TFP/TFP_4I_008/mpu.c
@@ -0,0 +1,45 @@
+/*
+ * Copyright 2008 Sony Corporation
+ *
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a copy
+ * of this software and associated documentation files (the "Software"), to deal
+ * in the Software without restriction, including without limitation the rights
+ * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+ * copies of the Software, and to permit persons to whom the Software is
+ * furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included in
+ * all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+ * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+ * THE SOFTWARE.
+ */
+
+#include <mars/mars.h>
+#include <mars_task_test.h>
+#include <spu_mfcio.h>
+
+struct queue_entry {
+ uint64_t val1;
+ uint64_t val2;
+};
+static struct queue_entry data;
+
+int mars_task_main(const struct mars_task_args *task_args)
+{
+ int ret;
+ uint64_t mpu_to_host_ea = task_args->type.u64[0];
+ uint32_t id = (uint32_t)task_args->type.u64[1];
+
+ data.val1 = id;
+ ret = mars_task_queue_push(mpu_to_host_ea, &data);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+
+ return 0;
+}
diff --git a/tests/TFP/TFP_4I_009/Makefile b/tests/TFP/TFP_4I_009/Makefile
new file mode 100644
index 0000000..ecbce33
--- /dev/null
+++ b/tests/TFP/TFP_4I_009/Makefile
@@ -0,0 +1,28 @@
+#
+# Copyright 2008 Sony Corporation
+#
+#
+# Permission is hereby granted, free of charge, to any person obtaining a copy
+# of this software and associated documentation files (the "Software"), to deal
+# in the Software without restriction, including without limitation the rights
+# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+# copies of the Software, and to permit persons to whom the Software is
+# furnished to do so, subject to the following conditions:
+#
+# The above copyright notice and this permission notice shall be included in
+# all copies or substantial portions of the Software.
+#
+# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+# THE SOFTWARE.
+#
+
+top_srcdir = ../..
+test_objs = host.o mpu1.task_eo mpu2.task_eo
+
+include $(top_srcdir)/scripts/config.mk
+include $(top_srcdir)/scripts/rules_item.mk
diff --git a/tests/TFP/TFP_4I_009/host.c b/tests/TFP/TFP_4I_009/host.c
new file mode 100644
index 0000000..ebec15e
--- /dev/null
+++ b/tests/TFP/TFP_4I_009/host.c
@@ -0,0 +1,134 @@
+/*
+ * Copyright 2008 Sony Corporation
+ *
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a copy
+ * of this software and associated documentation files (the "Software"), to deal
+ * in the Software without restriction, including without limitation the rights
+ * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+ * copies of the Software, and to permit persons to whom the Software is
+ * furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included in
+ * all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+ * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+ * THE SOFTWARE.
+ */
+
+#include <unistd.h>
+#include <mars/mars.h>
+#include <libspe2.h>
+#include <mars_test.h>
+
+struct queue_entry {
+ uint64_t val1;
+ uint64_t val2;
+};
+#define Q_DEPTH (256)
+
+#define TASK_MAX 16
+#define NUM_LOOP 5
+static uint32_t tasks[] =
+{
+ 1,
+ TASK_MAX / 4,
+ TASK_MAX / 2,
+ TASK_MAX,
+ TASK_MAX,
+};
+extern spe_program_handle_t mpu1_prog;
+extern spe_program_handle_t mpu2_prog;
+
+static struct mars_context *mars_ctx;
+static struct mars_task_args task1_args, task2_args;
+static struct mars_task_id task1_id[TASK_MAX], task2_id;
+
+static uint64_t mpu_to_mpu[NUM_LOOP];
+
+int main(void)
+{
+ int ret, i;
+ int32_t exit_code;
+ uint32_t num, count, task_num;
+ int spe_cnt = spe_cpu_info_get(SPE_COUNT_PHYSICAL_SPES, -1);
+
+ ret = mars_context_create(&mars_ctx, 0, 0);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+
+ for (i = 0; i < NUM_LOOP; i++) {
+ task_num = tasks[i] > spe_cnt - 1 ? spe_cnt - 1 : tasks[i];
+
+ ret = mars_task_queue_create(
+ mars_ctx,
+ &mpu_to_mpu[i],
+ sizeof(struct queue_entry),
+ Q_DEPTH,
+ MARS_TASK_QUEUE_MPU_TO_MPU);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+
+ for (num = 0; num < task_num; num++) {
+ /* create peek tasks */
+ ret = mars_task_create(mars_ctx, &task1_id[num], NULL,
+ mpu1_prog.elf_image, MARS_TASK_CONTEXT_SAVE_ALL);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+
+ task1_args.type.u64[0] = mpu_to_mpu[i];
+ task1_args.type.u64[1] = (uint64_t)i;
+ ret = mars_task_schedule(&task1_id[num],
+ &task1_args, 0);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+ }
+
+ sleep(1);
+ /* check if all tasks are still running */
+ for (num = 0; num < task_num; num++) {
+ ret = mars_task_try_wait(&task1_id[num], &exit_code);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_ERROR_BUSY);
+ }
+
+ /* create and run push task */
+ ret = mars_task_create(mars_ctx, &task2_id, NULL,
+ mpu2_prog.elf_image, MARS_TASK_CONTEXT_SAVE_ALL);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+
+ task2_args.type.u64[0] = mpu_to_mpu[i];
+ task2_args.type.u64[1] = (uint64_t)i;
+ ret = mars_task_schedule(&task2_id, &task2_args, 0);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+
+ for (num = 0; num < task_num; num++) {
+ ret = mars_task_wait(&task1_id[num], &exit_code);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+ MARS_TEST_ASSERT_ERROR(exit_code, MARS_SUCCESS);
+
+ ret = mars_task_destroy(&task1_id[num]);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+ }
+
+ ret = mars_task_wait(&task2_id, &exit_code);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+ MARS_TEST_ASSERT_ERROR(exit_code, MARS_SUCCESS);
+
+ ret = mars_task_destroy(&task2_id);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+
+ ret = mars_task_queue_count(mpu_to_mpu[i], &count);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+ MARS_TEST_ASSERT_EQUAL(count, 1);
+
+ ret = mars_task_queue_destroy(mpu_to_mpu[i]);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+ }
+
+ ret = mars_context_destroy(mars_ctx);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+
+ return 0;
+}
+
diff --git a/tests/TFP/TFP_4I_009/mpu1.c b/tests/TFP/TFP_4I_009/mpu1.c
new file mode 100644
index 0000000..5eaa5e5
--- /dev/null
+++ b/tests/TFP/TFP_4I_009/mpu1.c
@@ -0,0 +1,54 @@
+/*
+ * Copyright 2008 Sony Corporation
+ *
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a copy
+ * of this software and associated documentation files (the "Software"), to deal
+ * in the Software without restriction, including without limitation the rights
+ * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+ * copies of the Software, and to permit persons to whom the Software is
+ * furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included in
+ * all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+ * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+ * THE SOFTWARE.
+ */
+
+#include <mars/mars.h>
+#include <mars_task_test.h>
+#include <spu_mfcio.h>
+
+struct queue_entry {
+ uint64_t val1;
+ uint64_t val2;
+};
+static struct queue_entry data;
+
+int mars_task_main(const struct mars_task_args *task_args)
+{
+ int ret;
+ uint64_t mpu_to_mpu_ea = task_args->type.u64[0];
+ uint32_t id = (uint32_t)task_args->type.u64[1];
+
+ while (1) {
+ ret = mars_task_queue_try_peek(mpu_to_mpu_ea, &data);
+ if (ret == MARS_SUCCESS)
+ break;
+ else if (ret == MARS_ERROR_BUSY)
+ continue;
+ else
+ MARS_TEST_ASSERT_ERROR(ret, 0);
+ }
+
+ /* check the peeked data */
+ MARS_TEST_ASSERT_EQUAL(data.val1, id);
+
+ return 0;
+}
diff --git a/tests/TFP/TFP_4I_009/mpu2.c b/tests/TFP/TFP_4I_009/mpu2.c
new file mode 100644
index 0000000..a19ff6e
--- /dev/null
+++ b/tests/TFP/TFP_4I_009/mpu2.c
@@ -0,0 +1,45 @@
+/*
+ * Copyright 2008 Sony Corporation
+ *
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a copy
+ * of this software and associated documentation files (the "Software"), to deal
+ * in the Software without restriction, including without limitation the rights
+ * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+ * copies of the Software, and to permit persons to whom the Software is
+ * furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included in
+ * all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+ * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+ * THE SOFTWARE.
+ */
+
+#include <mars/mars.h>
+#include <mars_task_test.h>
+#include <spu_mfcio.h>
+
+struct queue_entry {
+ uint64_t val1;
+ uint64_t val2;
+};
+static struct queue_entry data;
+
+int mars_task_main(const struct mars_task_args *task_args)
+{
+ int ret;
+ uint64_t mpu_to_mpu_ea = task_args->type.u64[0];
+ uint32_t id = (uint32_t)task_args->type.u64[1];
+
+ data.val1 = id;
+ ret = mars_task_queue_push(mpu_to_mpu_ea, &data);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+
+ return 0;
+}
diff --git a/tests/TFP/TFP_4J_001/Makefile b/tests/TFP/TFP_4J_001/Makefile
new file mode 100644
index 0000000..432135a
--- /dev/null
+++ b/tests/TFP/TFP_4J_001/Makefile
@@ -0,0 +1,28 @@
+#
+# Copyright 2008 Sony Corporation
+#
+#
+# Permission is hereby granted, free of charge, to any person obtaining a copy
+# of this software and associated documentation files (the "Software"), to deal
+# in the Software without restriction, including without limitation the rights
+# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+# copies of the Software, and to permit persons to whom the Software is
+# furnished to do so, subject to the following conditions:
+#
+# The above copyright notice and this permission notice shall be included in
+# all copies or substantial portions of the Software.
+#
+# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+# THE SOFTWARE.
+#
+
+top_srcdir = ../..
+test_objs = host.o mpu.task_eo
+
+include $(top_srcdir)/scripts/config.mk
+include $(top_srcdir)/scripts/rules_item.mk
diff --git a/tests/TFP/TFP_4J_001/host.c b/tests/TFP/TFP_4J_001/host.c
new file mode 100644
index 0000000..c71dad7
--- /dev/null
+++ b/tests/TFP/TFP_4J_001/host.c
@@ -0,0 +1,85 @@
+/*
+ * Copyright 2008 Sony Corporation
+ *
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a copy
+ * of this software and associated documentation files (the "Software"), to deal
+ * in the Software without restriction, including without limitation the rights
+ * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+ * copies of the Software, and to permit persons to whom the Software is
+ * furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included in
+ * all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+ * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+ * THE SOFTWARE.
+ */
+
+#include <libspe2.h>
+#include <mars/mars.h>
+#include <mars_test.h>
+#include "host_and_mpu.h"
+
+extern spe_program_handle_t mpu_prog;
+
+static struct mars_context *mars;
+static struct mars_task_id task_id;
+static struct mars_task_args task_args;
+static uint64_t queue;
+static uint64_t queue_item[2];
+
+int main(void)
+{
+ int i, exit_code, ret;
+
+ ret = mars_context_create(&mars, 0, 0);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+
+ ret = mars_task_create(
+ mars,
+ &task_id,
+ "4J001",
+ mpu_prog.elf_image,
+ MARS_TASK_CONTEXT_SAVE_ALL);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+
+ ret = mars_task_queue_create(
+ mars,
+ &queue,
+ 16,
+ QUEUE_DEPTH,
+ MARS_TASK_QUEUE_HOST_TO_MPU);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+
+ for (i = 0; i < QUEUE_DEPTH; i++) {
+ queue_item[0] = queue_item[1] = QUEUE_DEPTH-i;
+
+ ret = mars_task_queue_push(queue, queue_item);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+ }
+
+ task_args.type.u64[0] = queue;
+ ret = mars_task_schedule(&task_id, &task_args, 0);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+
+ ret = mars_task_wait(&task_id, &exit_code);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+ MARS_TEST_ASSERT_EQUAL(exit_code, 0);
+
+ ret = mars_task_queue_destroy(queue);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+
+ ret = mars_task_destroy(&task_id);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+
+ ret = mars_context_destroy(mars);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+
+ return 0;
+}
diff --git a/tests/TFP/TFP_4J_001/host_and_mpu.h b/tests/TFP/TFP_4J_001/host_and_mpu.h
new file mode 100644
index 0000000..e565e93
--- /dev/null
+++ b/tests/TFP/TFP_4J_001/host_and_mpu.h
@@ -0,0 +1,24 @@
+/*
+ * Copyright 2008 Sony Corporation
+ *
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a copy
+ * of this software and associated documentation files (the "Software"), to deal
+ * in the Software without restriction, including without limitation the rights
+ * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+ * copies of the Software, and to permit persons to whom the Software is
+ * furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included in
+ * all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+ * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+ * THE SOFTWARE.
+ */
+
+#define QUEUE_DEPTH 16
diff --git a/tests/TFP/TFP_4J_001/mpu.c b/tests/TFP/TFP_4J_001/mpu.c
new file mode 100644
index 0000000..a3958f9
--- /dev/null
+++ b/tests/TFP/TFP_4J_001/mpu.c
@@ -0,0 +1,60 @@
+/*
+ * Copyright 2008 Sony Corporation
+ *
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a copy
+ * of this software and associated documentation files (the "Software"), to deal
+ * in the Software without restriction, including without limitation the rights
+ * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+ * copies of the Software, and to permit persons to whom the Software is
+ * furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included in
+ * all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+ * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+ * THE SOFTWARE.
+ */
+
+#include <string.h>
+#include <mars/mars.h>
+#include "mars_task_test.h"
+#include "host_and_mpu.h"
+
+static uint64_t queue_item[2] __attribute__((aligned(16)));
+
+int mars_task_main(const struct mars_task_args *task_args)
+{
+ uint64_t queue_ea = task_args->type.u64[0];
+ uint32_t count;
+ int ret;
+
+ ret = mars_task_queue_count(queue_ea, &count);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+
+ MARS_TEST_ASSERT(count == QUEUE_DEPTH);
+
+ ret = mars_task_queue_try_peek_begin(queue_ea, queue_item, 0);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+
+ ret = mars_task_queue_peek_end(queue_ea, 0);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+
+ MARS_TEST_ASSERT(
+ queue_item[0] == QUEUE_DEPTH &&
+ queue_item[1] == QUEUE_DEPTH);
+
+ ret = mars_task_queue_count(queue_ea, &count);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+
+ MARS_TEST_ASSERT(count == QUEUE_DEPTH);
+
+ mars_task_exit(0);
+
+ return 0;
+}
diff --git a/tests/TFP/TFP_4J_002/Makefile b/tests/TFP/TFP_4J_002/Makefile
new file mode 100644
index 0000000..ecbce33
--- /dev/null
+++ b/tests/TFP/TFP_4J_002/Makefile
@@ -0,0 +1,28 @@
+#
+# Copyright 2008 Sony Corporation
+#
+#
+# Permission is hereby granted, free of charge, to any person obtaining a copy
+# of this software and associated documentation files (the "Software"), to deal
+# in the Software without restriction, including without limitation the rights
+# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+# copies of the Software, and to permit persons to whom the Software is
+# furnished to do so, subject to the following conditions:
+#
+# The above copyright notice and this permission notice shall be included in
+# all copies or substantial portions of the Software.
+#
+# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+# THE SOFTWARE.
+#
+
+top_srcdir = ../..
+test_objs = host.o mpu1.task_eo mpu2.task_eo
+
+include $(top_srcdir)/scripts/config.mk
+include $(top_srcdir)/scripts/rules_item.mk
diff --git a/tests/TFP/TFP_4J_002/host.c b/tests/TFP/TFP_4J_002/host.c
new file mode 100644
index 0000000..7edf91d
--- /dev/null
+++ b/tests/TFP/TFP_4J_002/host.c
@@ -0,0 +1,97 @@
+/*
+ * Copyright 2008 Sony Corporation
+ *
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a copy
+ * of this software and associated documentation files (the "Software"), to deal
+ * in the Software without restriction, including without limitation the rights
+ * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+ * copies of the Software, and to permit persons to whom the Software is
+ * furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included in
+ * all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+ * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+ * THE SOFTWARE.
+ */
+
+#include <libspe2.h>
+#include <mars/mars.h>
+#include <mars_test.h>
+#include "host_and_mpu.h"
+
+extern spe_program_handle_t mpu1_prog, mpu2_prog;
+
+static struct mars_context *mars;
+static struct mars_task_id pusher_task_id, poper_task_id;
+static struct mars_task_args task_args;
+static uint64_t queue;
+static uint32_t notify[32] __attribute__((aligned(16)));
+
+int main(void)
+{
+ int exit_code, ret;
+
+ ret = mars_context_create(&mars, 0, 0);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+
+ ret = mars_task_create(
+ mars,
+ &pusher_task_id,
+ "4J002",
+ mpu1_prog.elf_image,
+ MARS_TASK_CONTEXT_SAVE_ALL);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+
+ ret = mars_task_create(
+ mars,
+ &poper_task_id,
+ "4J002",
+ mpu2_prog.elf_image,
+ MARS_TASK_CONTEXT_SAVE_ALL);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+
+ ret = mars_task_queue_create(
+ mars,
+ &queue,
+ 16,
+ QUEUE_DEPTH,
+ MARS_TASK_QUEUE_MPU_TO_MPU);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+
+ task_args.type.u64[0] = queue;
+ task_args.type.u64[1] = mars_ptr_to_ea(notify);
+ ret = mars_task_schedule(&pusher_task_id, &task_args, 0);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+
+ ret = mars_task_schedule(&poper_task_id, &task_args, 0);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+
+ ret = mars_task_wait(&pusher_task_id, &exit_code);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+ MARS_TEST_ASSERT_EQUAL(exit_code, 0);
+
+ ret = mars_task_wait(&poper_task_id, &exit_code);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+ MARS_TEST_ASSERT_EQUAL(exit_code, 0);
+
+ ret = mars_task_queue_destroy(queue);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+
+ ret = mars_task_destroy(&pusher_task_id);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+
+ ret = mars_task_destroy(&poper_task_id);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+
+ ret = mars_context_destroy(mars);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+
+ return 0;
+}
diff --git a/tests/TFP/TFP_4J_002/host_and_mpu.h b/tests/TFP/TFP_4J_002/host_and_mpu.h
new file mode 100644
index 0000000..e565e93
--- /dev/null
+++ b/tests/TFP/TFP_4J_002/host_and_mpu.h
@@ -0,0 +1,24 @@
+/*
+ * Copyright 2008 Sony Corporation
+ *
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a copy
+ * of this software and associated documentation files (the "Software"), to deal
+ * in the Software without restriction, including without limitation the rights
+ * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+ * copies of the Software, and to permit persons to whom the Software is
+ * furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included in
+ * all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+ * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+ * THE SOFTWARE.
+ */
+
+#define QUEUE_DEPTH 16
diff --git a/tests/TFP/TFP_4J_002/mpu1.c b/tests/TFP/TFP_4J_002/mpu1.c
new file mode 100644
index 0000000..a3f962c
--- /dev/null
+++ b/tests/TFP/TFP_4J_002/mpu1.c
@@ -0,0 +1,50 @@
+/*
+ * Copyright 2008 Sony Corporation
+ *
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a copy
+ * of this software and associated documentation files (the "Software"), to deal
+ * in the Software without restriction, including without limitation the rights
+ * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+ * copies of the Software, and to permit persons to whom the Software is
+ * furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included in
+ * all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+ * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+ * THE SOFTWARE.
+ */
+
+#include <string.h>
+#include <mars/mars.h>
+#include "mars_task_test.h"
+#include "host_and_mpu.h"
+
+static uint64_t queue_item[2] __attribute__((aligned(16)));
+
+int mars_task_main(const struct mars_task_args *task_args)
+{
+ uint64_t queue_ea = task_args->type.u64[0];
+ uint64_t notify_ea = task_args->type.u64[1];
+ uint32_t i;
+ int ret;
+
+ for (i = 0; i < QUEUE_DEPTH; i++) {
+ queue_item[0] = queue_item[1] = QUEUE_DEPTH-i;
+
+ ret = mars_task_queue_push(queue_ea, queue_item);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+ }
+
+ mars_test_counter_set(notify_ea, 1);
+
+ mars_task_exit(0);
+
+ return 0;
+}
diff --git a/tests/TFP/TFP_4J_002/mpu2.c b/tests/TFP/TFP_4J_002/mpu2.c
new file mode 100644
index 0000000..d9df91a
--- /dev/null
+++ b/tests/TFP/TFP_4J_002/mpu2.c
@@ -0,0 +1,58 @@
+/*
+ * Copyright 2008 Sony Corporation
+ *
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a copy
+ * of this software and associated documentation files (the "Software"), to deal
+ * in the Software without restriction, including without limitation the rights
+ * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+ * copies of the Software, and to permit persons to whom the Software is
+ * furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included in
+ * all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+ * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+ * THE SOFTWARE.
+ */
+
+#include <string.h>
+#include <mars/mars.h>
+#include "mars_task_test.h"
+#include "host_and_mpu.h"
+
+static uint64_t queue_item[2] __attribute__((aligned(16)));
+
+int mars_task_main(const struct mars_task_args *task_args)
+{
+ uint64_t queue_ea = task_args->type.u64[0];
+ uint64_t notify_ea = task_args->type.u64[1];
+ uint32_t count;
+ int ret;
+
+ mars_test_counter_wait(notify_ea, 1);
+
+ ret = mars_task_queue_count(queue_ea, &count);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+ MARS_TEST_ASSERT(count == QUEUE_DEPTH);
+
+ ret = mars_task_queue_try_peek_begin(queue_ea, queue_item, 0);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+
+ ret = mars_task_queue_peek_end(queue_ea, 0);
+ MARS_TEST_ASSERT(queue_item[0] == QUEUE_DEPTH &&
+ queue_item[1] == QUEUE_DEPTH);
+
+ ret = mars_task_queue_count(queue_ea, &count);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+ MARS_TEST_ASSERT(count == QUEUE_DEPTH);
+
+ mars_task_exit(0);
+
+ return 0;
+}
diff --git a/tests/TFP/TFP_4J_003/Makefile b/tests/TFP/TFP_4J_003/Makefile
new file mode 100644
index 0000000..432135a
--- /dev/null
+++ b/tests/TFP/TFP_4J_003/Makefile
@@ -0,0 +1,28 @@
+#
+# Copyright 2008 Sony Corporation
+#
+#
+# Permission is hereby granted, free of charge, to any person obtaining a copy
+# of this software and associated documentation files (the "Software"), to deal
+# in the Software without restriction, including without limitation the rights
+# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+# copies of the Software, and to permit persons to whom the Software is
+# furnished to do so, subject to the following conditions:
+#
+# The above copyright notice and this permission notice shall be included in
+# all copies or substantial portions of the Software.
+#
+# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+# THE SOFTWARE.
+#
+
+top_srcdir = ../..
+test_objs = host.o mpu.task_eo
+
+include $(top_srcdir)/scripts/config.mk
+include $(top_srcdir)/scripts/rules_item.mk
diff --git a/tests/TFP/TFP_4J_003/host.c b/tests/TFP/TFP_4J_003/host.c
new file mode 100644
index 0000000..024a108
--- /dev/null
+++ b/tests/TFP/TFP_4J_003/host.c
@@ -0,0 +1,78 @@
+/*
+ * Copyright 2008 Sony Corporation
+ *
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a copy
+ * of this software and associated documentation files (the "Software"), to deal
+ * in the Software without restriction, including without limitation the rights
+ * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+ * copies of the Software, and to permit persons to whom the Software is
+ * furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included in
+ * all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+ * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+ * THE SOFTWARE.
+ */
+
+#include <libspe2.h>
+#include <mars/mars.h>
+#include <mars_test.h>
+
+#define QUEUE_DEPTH 16
+
+extern spe_program_handle_t mpu_prog;
+
+static struct mars_context *mars;
+static struct mars_task_id task_id;
+static struct mars_task_args task_args;
+static uint64_t queue;
+
+int main(void)
+{
+ int exit_code, ret;
+
+ ret = mars_context_create(&mars, 0, 0);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+
+ ret = mars_task_create(
+ mars,
+ &task_id,
+ "4J003",
+ mpu_prog.elf_image,
+ MARS_TASK_CONTEXT_SAVE_ALL);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+
+ ret = mars_task_queue_create(
+ mars,
+ &queue,
+ 16,
+ QUEUE_DEPTH,
+ MARS_TASK_QUEUE_HOST_TO_MPU);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+
+ task_args.type.u64[0] = queue;
+ ret = mars_task_schedule(&task_id, &task_args, 0);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+
+ ret = mars_task_wait(&task_id, &exit_code);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+ MARS_TEST_ASSERT_EQUAL(exit_code, 0);
+
+ ret = mars_task_queue_destroy(queue);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+
+ ret = mars_task_destroy(&task_id);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+
+ ret = mars_context_destroy(mars);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+
+ return 0;
+}
diff --git a/tests/TFP/TFP_4J_003/mpu.c b/tests/TFP/TFP_4J_003/mpu.c
new file mode 100644
index 0000000..ddfcded
--- /dev/null
+++ b/tests/TFP/TFP_4J_003/mpu.c
@@ -0,0 +1,44 @@
+/*
+ * Copyright 2008 Sony Corporation
+ *
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a copy
+ * of this software and associated documentation files (the "Software"), to deal
+ * in the Software without restriction, including without limitation the rights
+ * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+ * copies of the Software, and to permit persons to whom the Software is
+ * furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included in
+ * all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+ * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+ * THE SOFTWARE.
+ */
+
+#include <string.h>
+#include <mars/mars.h>
+#include "mars_task_test.h"
+
+static uint64_t queue_item[2] __attribute__((aligned(16)));
+
+int mars_task_main(const struct mars_task_args *task_args)
+{
+ int ret;
+ uint64_t queue_ea = task_args->type.u64[0];
+
+ ret = mars_task_queue_try_peek_begin(queue_ea, queue_item, 0);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_ERROR_BUSY);
+
+ ret = mars_task_queue_peek_end(queue_ea, 0);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+
+ mars_task_exit(0);
+
+ return 0;
+}
diff --git a/tests/TFP/TFP_4J_004/Makefile b/tests/TFP/TFP_4J_004/Makefile
new file mode 100644
index 0000000..432135a
--- /dev/null
+++ b/tests/TFP/TFP_4J_004/Makefile
@@ -0,0 +1,28 @@
+#
+# Copyright 2008 Sony Corporation
+#
+#
+# Permission is hereby granted, free of charge, to any person obtaining a copy
+# of this software and associated documentation files (the "Software"), to deal
+# in the Software without restriction, including without limitation the rights
+# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+# copies of the Software, and to permit persons to whom the Software is
+# furnished to do so, subject to the following conditions:
+#
+# The above copyright notice and this permission notice shall be included in
+# all copies or substantial portions of the Software.
+#
+# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+# THE SOFTWARE.
+#
+
+top_srcdir = ../..
+test_objs = host.o mpu.task_eo
+
+include $(top_srcdir)/scripts/config.mk
+include $(top_srcdir)/scripts/rules_item.mk
diff --git a/tests/TFP/TFP_4J_004/host.c b/tests/TFP/TFP_4J_004/host.c
new file mode 100644
index 0000000..d505ab5
--- /dev/null
+++ b/tests/TFP/TFP_4J_004/host.c
@@ -0,0 +1,78 @@
+/*
+ * Copyright 2008 Sony Corporation
+ *
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a copy
+ * of this software and associated documentation files (the "Software"), to deal
+ * in the Software without restriction, including without limitation the rights
+ * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+ * copies of the Software, and to permit persons to whom the Software is
+ * furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included in
+ * all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+ * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+ * THE SOFTWARE.
+ */
+
+#include <libspe2.h>
+#include <mars/mars.h>
+#include <mars_test.h>
+
+#define QUEUE_DEPTH 16
+
+extern spe_program_handle_t mpu_prog;
+
+static struct mars_context *mars;
+static struct mars_task_id task_id;
+static struct mars_task_args task_args;
+static uint64_t queue;
+
+int main(void)
+{
+ int exit_code, ret;
+
+ ret = mars_context_create(&mars, 0, 0);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+
+ ret = mars_task_create(
+ mars,
+ &task_id,
+ "4J004",
+ mpu_prog.elf_image,
+ MARS_TASK_CONTEXT_SAVE_ALL);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+
+ ret = mars_task_queue_create(
+ mars,
+ &queue,
+ 16,
+ QUEUE_DEPTH,
+ MARS_TASK_QUEUE_MPU_TO_MPU);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+
+ task_args.type.u64[0] = queue;
+ ret = mars_task_schedule(&task_id, &task_args, 0);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+
+ ret = mars_task_wait(&task_id, &exit_code);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+ MARS_TEST_ASSERT_EQUAL(exit_code, 0);
+
+ ret = mars_task_queue_destroy(queue);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+
+ ret = mars_task_destroy(&task_id);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+
+ ret = mars_context_destroy(mars);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+
+ return 0;
+}
diff --git a/tests/TFP/TFP_4J_004/mpu.c b/tests/TFP/TFP_4J_004/mpu.c
new file mode 100644
index 0000000..ddfcded
--- /dev/null
+++ b/tests/TFP/TFP_4J_004/mpu.c
@@ -0,0 +1,44 @@
+/*
+ * Copyright 2008 Sony Corporation
+ *
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a copy
+ * of this software and associated documentation files (the "Software"), to deal
+ * in the Software without restriction, including without limitation the rights
+ * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+ * copies of the Software, and to permit persons to whom the Software is
+ * furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included in
+ * all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+ * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+ * THE SOFTWARE.
+ */
+
+#include <string.h>
+#include <mars/mars.h>
+#include "mars_task_test.h"
+
+static uint64_t queue_item[2] __attribute__((aligned(16)));
+
+int mars_task_main(const struct mars_task_args *task_args)
+{
+ int ret;
+ uint64_t queue_ea = task_args->type.u64[0];
+
+ ret = mars_task_queue_try_peek_begin(queue_ea, queue_item, 0);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_ERROR_BUSY);
+
+ ret = mars_task_queue_peek_end(queue_ea, 0);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+
+ mars_task_exit(0);
+
+ return 0;
+}
diff --git a/tests/TFP/TFP_4J_006/Makefile b/tests/TFP/TFP_4J_006/Makefile
new file mode 100644
index 0000000..432135a
--- /dev/null
+++ b/tests/TFP/TFP_4J_006/Makefile
@@ -0,0 +1,28 @@
+#
+# Copyright 2008 Sony Corporation
+#
+#
+# Permission is hereby granted, free of charge, to any person obtaining a copy
+# of this software and associated documentation files (the "Software"), to deal
+# in the Software without restriction, including without limitation the rights
+# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+# copies of the Software, and to permit persons to whom the Software is
+# furnished to do so, subject to the following conditions:
+#
+# The above copyright notice and this permission notice shall be included in
+# all copies or substantial portions of the Software.
+#
+# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+# THE SOFTWARE.
+#
+
+top_srcdir = ../..
+test_objs = host.o mpu.task_eo
+
+include $(top_srcdir)/scripts/config.mk
+include $(top_srcdir)/scripts/rules_item.mk
diff --git a/tests/TFP/TFP_4J_006/host.c b/tests/TFP/TFP_4J_006/host.c
new file mode 100644
index 0000000..bd79803
--- /dev/null
+++ b/tests/TFP/TFP_4J_006/host.c
@@ -0,0 +1,90 @@
+/*
+ * Copyright 2008 Sony Corporation
+ *
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a copy
+ * of this software and associated documentation files (the "Software"), to deal
+ * in the Software without restriction, including without limitation the rights
+ * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+ * copies of the Software, and to permit persons to whom the Software is
+ * furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included in
+ * all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+ * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+ * THE SOFTWARE.
+ */
+
+#include <libspe2.h>
+#include <mars/mars.h>
+#include <mars_test.h>
+#include "host_and_mpu.h"
+
+extern spe_program_handle_t mpu_prog;
+
+static struct mars_context *mars;
+static struct mars_task_id task_ids[TASK_COUNT];
+static struct mars_task_args task_args;
+static uint64_t queue;
+static uint64_t queue_item[2];
+
+int main(void)
+{
+ int i, exit_code, ret;
+
+ ret = mars_context_create(&mars, 0, 0);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+
+ ret = mars_task_queue_create(
+ mars,
+ &queue,
+ 16,
+ QUEUE_DEPTH,
+ MARS_TASK_QUEUE_HOST_TO_MPU);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+
+ for (i = 0; i < QUEUE_DEPTH; i++) {
+ ret = mars_task_queue_push(queue, queue_item);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+ }
+
+ for (i = 0; i < TASK_COUNT; i++) {
+ ret = mars_task_create(
+ mars,
+ &task_ids[i],
+ "4J006",
+ mpu_prog.elf_image,
+ MARS_TASK_CONTEXT_SAVE_ALL);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+ }
+
+ task_args.type.u64[0] = queue;
+
+ for (i = 0; i < TASK_COUNT; i++) {
+ ret = mars_task_schedule(&task_ids[i], &task_args, 0);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+ }
+
+ for (i = 0; i < TASK_COUNT; i++) {
+ ret = mars_task_wait(&task_ids[i], &exit_code);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+ MARS_TEST_ASSERT_EQUAL(exit_code, 0);
+
+ ret = mars_task_destroy(&task_ids[i]);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+ }
+
+ ret = mars_task_queue_destroy(queue);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+
+ ret = mars_context_destroy(mars);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+
+ return 0;
+}
diff --git a/tests/TFP/TFP_4J_006/host_and_mpu.h b/tests/TFP/TFP_4J_006/host_and_mpu.h
new file mode 100644
index 0000000..7cb3f27
--- /dev/null
+++ b/tests/TFP/TFP_4J_006/host_and_mpu.h
@@ -0,0 +1,25 @@
+/*
+ * Copyright 2008 Sony Corporation
+ *
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a copy
+ * of this software and associated documentation files (the "Software"), to deal
+ * in the Software without restriction, including without limitation the rights
+ * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+ * copies of the Software, and to permit persons to whom the Software is
+ * furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included in
+ * all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+ * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+ * THE SOFTWARE.
+ */
+
+#define QUEUE_DEPTH 65536
+#define TASK_COUNT 16
diff --git a/tests/TFP/TFP_4J_006/mpu.c b/tests/TFP/TFP_4J_006/mpu.c
new file mode 100644
index 0000000..2199515
--- /dev/null
+++ b/tests/TFP/TFP_4J_006/mpu.c
@@ -0,0 +1,49 @@
+/*
+ * Copyright 2008 Sony Corporation
+ *
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a copy
+ * of this software and associated documentation files (the "Software"), to deal
+ * in the Software without restriction, including without limitation the rights
+ * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+ * copies of the Software, and to permit persons to whom the Software is
+ * furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included in
+ * all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+ * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+ * THE SOFTWARE.
+ */
+
+#include <string.h>
+#include <mars/mars.h>
+#include "mars_task_test.h"
+#include "host_and_mpu.h"
+
+#define LOOP_COUNT (QUEUE_DEPTH/(TASK_COUNT*2))
+
+static uint64_t queue_item[2] __attribute__((aligned(16)));
+
+int mars_task_main(const struct mars_task_args *task_args)
+{
+ uint64_t queue_ea = task_args->type.u64[0];
+ int i, ret;
+
+ for (i = 0; i < LOOP_COUNT; i++) {
+ ret = mars_task_queue_try_peek_begin(queue_ea, queue_item, 0);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+
+ ret = mars_task_queue_peek_end(queue_ea, 0);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+ }
+
+ mars_task_exit(0);
+
+ return 0;
+}
diff --git a/tests/TFP/TFP_4J_007/Makefile b/tests/TFP/TFP_4J_007/Makefile
new file mode 100644
index 0000000..ecbce33
--- /dev/null
+++ b/tests/TFP/TFP_4J_007/Makefile
@@ -0,0 +1,28 @@
+#
+# Copyright 2008 Sony Corporation
+#
+#
+# Permission is hereby granted, free of charge, to any person obtaining a copy
+# of this software and associated documentation files (the "Software"), to deal
+# in the Software without restriction, including without limitation the rights
+# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+# copies of the Software, and to permit persons to whom the Software is
+# furnished to do so, subject to the following conditions:
+#
+# The above copyright notice and this permission notice shall be included in
+# all copies or substantial portions of the Software.
+#
+# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+# THE SOFTWARE.
+#
+
+top_srcdir = ../..
+test_objs = host.o mpu1.task_eo mpu2.task_eo
+
+include $(top_srcdir)/scripts/config.mk
+include $(top_srcdir)/scripts/rules_item.mk
diff --git a/tests/TFP/TFP_4J_007/host.c b/tests/TFP/TFP_4J_007/host.c
new file mode 100644
index 0000000..ebec15e
--- /dev/null
+++ b/tests/TFP/TFP_4J_007/host.c
@@ -0,0 +1,134 @@
+/*
+ * Copyright 2008 Sony Corporation
+ *
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a copy
+ * of this software and associated documentation files (the "Software"), to deal
+ * in the Software without restriction, including without limitation the rights
+ * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+ * copies of the Software, and to permit persons to whom the Software is
+ * furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included in
+ * all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+ * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+ * THE SOFTWARE.
+ */
+
+#include <unistd.h>
+#include <mars/mars.h>
+#include <libspe2.h>
+#include <mars_test.h>
+
+struct queue_entry {
+ uint64_t val1;
+ uint64_t val2;
+};
+#define Q_DEPTH (256)
+
+#define TASK_MAX 16
+#define NUM_LOOP 5
+static uint32_t tasks[] =
+{
+ 1,
+ TASK_MAX / 4,
+ TASK_MAX / 2,
+ TASK_MAX,
+ TASK_MAX,
+};
+extern spe_program_handle_t mpu1_prog;
+extern spe_program_handle_t mpu2_prog;
+
+static struct mars_context *mars_ctx;
+static struct mars_task_args task1_args, task2_args;
+static struct mars_task_id task1_id[TASK_MAX], task2_id;
+
+static uint64_t mpu_to_mpu[NUM_LOOP];
+
+int main(void)
+{
+ int ret, i;
+ int32_t exit_code;
+ uint32_t num, count, task_num;
+ int spe_cnt = spe_cpu_info_get(SPE_COUNT_PHYSICAL_SPES, -1);
+
+ ret = mars_context_create(&mars_ctx, 0, 0);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+
+ for (i = 0; i < NUM_LOOP; i++) {
+ task_num = tasks[i] > spe_cnt - 1 ? spe_cnt - 1 : tasks[i];
+
+ ret = mars_task_queue_create(
+ mars_ctx,
+ &mpu_to_mpu[i],
+ sizeof(struct queue_entry),
+ Q_DEPTH,
+ MARS_TASK_QUEUE_MPU_TO_MPU);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+
+ for (num = 0; num < task_num; num++) {
+ /* create peek tasks */
+ ret = mars_task_create(mars_ctx, &task1_id[num], NULL,
+ mpu1_prog.elf_image, MARS_TASK_CONTEXT_SAVE_ALL);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+
+ task1_args.type.u64[0] = mpu_to_mpu[i];
+ task1_args.type.u64[1] = (uint64_t)i;
+ ret = mars_task_schedule(&task1_id[num],
+ &task1_args, 0);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+ }
+
+ sleep(1);
+ /* check if all tasks are still running */
+ for (num = 0; num < task_num; num++) {
+ ret = mars_task_try_wait(&task1_id[num], &exit_code);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_ERROR_BUSY);
+ }
+
+ /* create and run push task */
+ ret = mars_task_create(mars_ctx, &task2_id, NULL,
+ mpu2_prog.elf_image, MARS_TASK_CONTEXT_SAVE_ALL);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+
+ task2_args.type.u64[0] = mpu_to_mpu[i];
+ task2_args.type.u64[1] = (uint64_t)i;
+ ret = mars_task_schedule(&task2_id, &task2_args, 0);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+
+ for (num = 0; num < task_num; num++) {
+ ret = mars_task_wait(&task1_id[num], &exit_code);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+ MARS_TEST_ASSERT_ERROR(exit_code, MARS_SUCCESS);
+
+ ret = mars_task_destroy(&task1_id[num]);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+ }
+
+ ret = mars_task_wait(&task2_id, &exit_code);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+ MARS_TEST_ASSERT_ERROR(exit_code, MARS_SUCCESS);
+
+ ret = mars_task_destroy(&task2_id);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+
+ ret = mars_task_queue_count(mpu_to_mpu[i], &count);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+ MARS_TEST_ASSERT_EQUAL(count, 1);
+
+ ret = mars_task_queue_destroy(mpu_to_mpu[i]);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+ }
+
+ ret = mars_context_destroy(mars_ctx);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+
+ return 0;
+}
+
diff --git a/tests/TFP/TFP_4J_007/mpu1.c b/tests/TFP/TFP_4J_007/mpu1.c
new file mode 100644
index 0000000..7629fe5
--- /dev/null
+++ b/tests/TFP/TFP_4J_007/mpu1.c
@@ -0,0 +1,56 @@
+/*
+ * Copyright 2008 Sony Corporation
+ *
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a copy
+ * of this software and associated documentation files (the "Software"), to deal
+ * in the Software without restriction, including without limitation the rights
+ * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+ * copies of the Software, and to permit persons to whom the Software is
+ * furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included in
+ * all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+ * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+ * THE SOFTWARE.
+ */
+
+#include <mars/mars.h>
+#include <mars_task_test.h>
+#include <spu_mfcio.h>
+
+struct queue_entry {
+ uint64_t val1;
+ uint64_t val2;
+};
+static struct queue_entry data;
+
+int mars_task_main(const struct mars_task_args *task_args)
+{
+ int ret;
+ uint64_t mpu_to_mpu_ea = task_args->type.u64[0];
+ uint32_t id = (uint32_t)task_args->type.u64[1];
+
+ while (1) {
+ ret = mars_task_queue_try_peek_begin(mpu_to_mpu_ea, &data, 1);
+ if (ret == MARS_SUCCESS)
+ break;
+ else if (ret == MARS_ERROR_BUSY)
+ continue;
+ else
+ MARS_TEST_ASSERT_ERROR(ret, 0);
+ }
+ ret = mars_task_queue_peek_end(mpu_to_mpu_ea, 1);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+
+ /* check the peeked data */
+ MARS_TEST_ASSERT_EQUAL(data.val1, id);
+
+ return 0;
+}
diff --git a/tests/TFP/TFP_4J_007/mpu2.c b/tests/TFP/TFP_4J_007/mpu2.c
new file mode 100644
index 0000000..a19ff6e
--- /dev/null
+++ b/tests/TFP/TFP_4J_007/mpu2.c
@@ -0,0 +1,45 @@
+/*
+ * Copyright 2008 Sony Corporation
+ *
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a copy
+ * of this software and associated documentation files (the "Software"), to deal
+ * in the Software without restriction, including without limitation the rights
+ * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+ * copies of the Software, and to permit persons to whom the Software is
+ * furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included in
+ * all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+ * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+ * THE SOFTWARE.
+ */
+
+#include <mars/mars.h>
+#include <mars_task_test.h>
+#include <spu_mfcio.h>
+
+struct queue_entry {
+ uint64_t val1;
+ uint64_t val2;
+};
+static struct queue_entry data;
+
+int mars_task_main(const struct mars_task_args *task_args)
+{
+ int ret;
+ uint64_t mpu_to_mpu_ea = task_args->type.u64[0];
+ uint32_t id = (uint32_t)task_args->type.u64[1];
+
+ data.val1 = id;
+ ret = mars_task_queue_push(mpu_to_mpu_ea, &data);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+
+ return 0;
+}
diff --git a/tests/TFP/TFP_51_001/Makefile b/tests/TFP/TFP_51_001/Makefile
new file mode 100644
index 0000000..43ba573
--- /dev/null
+++ b/tests/TFP/TFP_51_001/Makefile
@@ -0,0 +1,28 @@
+#
+# Copyright 2008 Sony Corporation
+#
+#
+# Permission is hereby granted, free of charge, to any person obtaining a copy
+# of this software and associated documentation files (the "Software"), to deal
+# in the Software without restriction, including without limitation the rights
+# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+# copies of the Software, and to permit persons to whom the Software is
+# furnished to do so, subject to the following conditions:
+#
+# The above copyright notice and this permission notice shall be included in
+# all copies or substantial portions of the Software.
+#
+# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+# THE SOFTWARE.
+#
+
+top_srcdir = ../..
+test_objs = host.o
+
+include $(top_srcdir)/scripts/config.mk
+include $(top_srcdir)/scripts/rules_item.mk
diff --git a/tests/TFP/TFP_51_001/host.c b/tests/TFP/TFP_51_001/host.c
new file mode 100644
index 0000000..4f33ad7
--- /dev/null
+++ b/tests/TFP/TFP_51_001/host.c
@@ -0,0 +1,49 @@
+/*
+ * Copyright 2008 Sony Corporation
+ *
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a copy
+ * of this software and associated documentation files (the "Software"), to deal
+ * in the Software without restriction, including without limitation the rights
+ * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+ * copies of the Software, and to permit persons to whom the Software is
+ * furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included in
+ * all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+ * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+ * THE SOFTWARE.
+ */
+
+#include <libspe2.h>
+#include <mars/mars.h>
+#include <mars_test.h>
+
+static struct mars_context *mars;
+static uint64_t semaphore;
+
+int main(void)
+{
+ int ret;
+
+ ret = mars_context_create(&mars, 0, 0);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+
+ ret = mars_task_semaphore_create(
+ mars,
+ &semaphore,
+ 1);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+
+ ret = mars_context_destroy(mars);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+
+ return 0;
+}
+
diff --git a/tests/TFP/TFP_51_002/Makefile b/tests/TFP/TFP_51_002/Makefile
new file mode 100644
index 0000000..43ba573
--- /dev/null
+++ b/tests/TFP/TFP_51_002/Makefile
@@ -0,0 +1,28 @@
+#
+# Copyright 2008 Sony Corporation
+#
+#
+# Permission is hereby granted, free of charge, to any person obtaining a copy
+# of this software and associated documentation files (the "Software"), to deal
+# in the Software without restriction, including without limitation the rights
+# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+# copies of the Software, and to permit persons to whom the Software is
+# furnished to do so, subject to the following conditions:
+#
+# The above copyright notice and this permission notice shall be included in
+# all copies or substantial portions of the Software.
+#
+# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+# THE SOFTWARE.
+#
+
+top_srcdir = ../..
+test_objs = host.o
+
+include $(top_srcdir)/scripts/config.mk
+include $(top_srcdir)/scripts/rules_item.mk
diff --git a/tests/TFP/TFP_51_002/host.c b/tests/TFP/TFP_51_002/host.c
new file mode 100644
index 0000000..8fc2d0b
--- /dev/null
+++ b/tests/TFP/TFP_51_002/host.c
@@ -0,0 +1,52 @@
+/*
+ * Copyright 2008 Sony Corporation
+ *
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a copy
+ * of this software and associated documentation files (the "Software"), to deal
+ * in the Software without restriction, including without limitation the rights
+ * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+ * copies of the Software, and to permit persons to whom the Software is
+ * furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included in
+ * all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+ * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+ * THE SOFTWARE.
+ */
+
+#include <mars/mars.h>
+#include <libspe2.h>
+#include <mars_test.h>
+
+static struct mars_context *mars_ctx;
+static uint64_t semaphore;
+
+int main(void)
+{
+ int ret;
+
+ ret = mars_context_create(&mars_ctx, 0, 0);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+
+ ret = mars_task_semaphore_create(
+ mars_ctx,
+ &semaphore,
+ MARS_TASK_SEMAPHORE_WAIT_MAX);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+
+ ret = mars_task_semaphore_destroy(semaphore);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+
+ ret = mars_context_destroy(mars_ctx);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+
+ return 0;
+}
+
diff --git a/tests/TFP/TFP_53_001/Makefile b/tests/TFP/TFP_53_001/Makefile
new file mode 100644
index 0000000..432135a
--- /dev/null
+++ b/tests/TFP/TFP_53_001/Makefile
@@ -0,0 +1,28 @@
+#
+# Copyright 2008 Sony Corporation
+#
+#
+# Permission is hereby granted, free of charge, to any person obtaining a copy
+# of this software and associated documentation files (the "Software"), to deal
+# in the Software without restriction, including without limitation the rights
+# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+# copies of the Software, and to permit persons to whom the Software is
+# furnished to do so, subject to the following conditions:
+#
+# The above copyright notice and this permission notice shall be included in
+# all copies or substantial portions of the Software.
+#
+# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+# THE SOFTWARE.
+#
+
+top_srcdir = ../..
+test_objs = host.o mpu.task_eo
+
+include $(top_srcdir)/scripts/config.mk
+include $(top_srcdir)/scripts/rules_item.mk
diff --git a/tests/TFP/TFP_53_001/host.c b/tests/TFP/TFP_53_001/host.c
new file mode 100644
index 0000000..af7a948
--- /dev/null
+++ b/tests/TFP/TFP_53_001/host.c
@@ -0,0 +1,75 @@
+/*
+ * Copyright 2008 Sony Corporation
+ *
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a copy
+ * of this software and associated documentation files (the "Software"), to deal
+ * in the Software without restriction, including without limitation the rights
+ * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+ * copies of the Software, and to permit persons to whom the Software is
+ * furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included in
+ * all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+ * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+ * THE SOFTWARE.
+ */
+
+#include <mars/mars.h>
+#include <libspe2.h>
+#include <mars_test.h>
+
+#define SEMAPHORE_COUNTS 10
+
+extern spe_program_handle_t mpu_prog;
+
+static struct mars_context *mars_ctx;
+static struct mars_task_id task_id;
+static struct mars_task_args task_args;
+static uint64_t semaphore;
+
+int main(void)
+{
+ int ret;
+ int32_t exit_code;
+
+ ret = mars_context_create(&mars_ctx, 0, 0);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+
+ ret = mars_task_semaphore_create(
+ mars_ctx,
+ &semaphore,
+ SEMAPHORE_COUNTS);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+
+ ret = mars_task_create(mars_ctx, &task_id, NULL,
+ mpu_prog.elf_image, MARS_TASK_CONTEXT_SAVE_ALL);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+
+ task_args.type.u64[0] = semaphore;
+ task_args.type.u64[1] = SEMAPHORE_COUNTS;
+ ret = mars_task_schedule(&task_id, &task_args, 0);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+
+ ret = mars_task_wait(&task_id, &exit_code);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+ MARS_TEST_ASSERT_ERROR(exit_code, MARS_SUCCESS);
+
+ ret = mars_task_destroy(&task_id);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+
+ ret = mars_task_semaphore_destroy(semaphore);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+
+ ret = mars_context_destroy(mars_ctx);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+
+ return 0;
+}
+
diff --git a/tests/TFP/TFP_53_001/mpu.c b/tests/TFP/TFP_53_001/mpu.c
new file mode 100644
index 0000000..5642abd
--- /dev/null
+++ b/tests/TFP/TFP_53_001/mpu.c
@@ -0,0 +1,40 @@
+/*
+ * Copyright 2008 Sony Corporation
+ *
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a copy
+ * of this software and associated documentation files (the "Software"), to deal
+ * in the Software without restriction, including without limitation the rights
+ * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+ * copies of the Software, and to permit persons to whom the Software is
+ * furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included in
+ * all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+ * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+ * THE SOFTWARE.
+ */
+
+#include <mars/mars.h>
+#include <mars_task_test.h>
+
+
+int mars_task_main(const struct mars_task_args *task_args)
+{
+ int ret, i;
+ uint64_t semaphore_ea = task_args->type.u64[0];
+ uint64_t counts = task_args->type.u64[1];
+
+ for (i = 0; i < counts; i++) {
+ ret = mars_task_semaphore_acquire(semaphore_ea);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+ }
+
+ return 0;
+}
diff --git a/tests/TFP/TFP_53_002/Makefile b/tests/TFP/TFP_53_002/Makefile
new file mode 100644
index 0000000..432135a
--- /dev/null
+++ b/tests/TFP/TFP_53_002/Makefile
@@ -0,0 +1,28 @@
+#
+# Copyright 2008 Sony Corporation
+#
+#
+# Permission is hereby granted, free of charge, to any person obtaining a copy
+# of this software and associated documentation files (the "Software"), to deal
+# in the Software without restriction, including without limitation the rights
+# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+# copies of the Software, and to permit persons to whom the Software is
+# furnished to do so, subject to the following conditions:
+#
+# The above copyright notice and this permission notice shall be included in
+# all copies or substantial portions of the Software.
+#
+# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+# THE SOFTWARE.
+#
+
+top_srcdir = ../..
+test_objs = host.o mpu.task_eo
+
+include $(top_srcdir)/scripts/config.mk
+include $(top_srcdir)/scripts/rules_item.mk
diff --git a/tests/TFP/TFP_53_002/host.c b/tests/TFP/TFP_53_002/host.c
new file mode 100644
index 0000000..32768d3
--- /dev/null
+++ b/tests/TFP/TFP_53_002/host.c
@@ -0,0 +1,75 @@
+/*
+ * Copyright 2008 Sony Corporation
+ *
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a copy
+ * of this software and associated documentation files (the "Software"), to deal
+ * in the Software without restriction, including without limitation the rights
+ * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+ * copies of the Software, and to permit persons to whom the Software is
+ * furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included in
+ * all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+ * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+ * THE SOFTWARE.
+ */
+
+#include <unistd.h>
+#include <mars/mars.h>
+#include <libspe2.h>
+#include <mars_test.h>
+
+#define SEMAPHORE_COUNTS 10
+
+#define WAIT_SEC 2
+extern spe_program_handle_t mpu_prog;
+
+static struct mars_context *mars_ctx;
+static struct mars_task_id task_id;
+static struct mars_task_args task_args;
+static uint64_t semaphore;
+static uint32_t shared_resource __attribute__((aligned(16)));
+
+int main(void)
+{
+ int ret;
+
+ ret = mars_context_create(&mars_ctx, 0, 0);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+
+ ret = mars_task_semaphore_create(
+ mars_ctx,
+ &semaphore,
+ SEMAPHORE_COUNTS);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+
+ ret = mars_task_create(mars_ctx, &task_id, NULL,
+ mpu_prog.elf_image, MARS_TASK_CONTEXT_SAVE_ALL);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+
+ shared_resource = 0;
+ task_args.type.u64[0] = semaphore;
+ task_args.type.u64[1] = mars_ptr_to_ea(&shared_resource);
+ task_args.type.u64[2] = SEMAPHORE_COUNTS;
+ ret = mars_task_schedule(&task_id, &task_args, 0);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+
+ /* wait for blocking */
+ sleep(WAIT_SEC);
+
+ /* Check if shared_resource hasn't been changed */
+ MARS_TEST_ASSERT_EQUAL(shared_resource, 0);
+
+ ret = mars_task_semaphore_destroy(semaphore);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+
+ exit(0);
+}
+
diff --git a/tests/TFP/TFP_53_002/mpu.c b/tests/TFP/TFP_53_002/mpu.c
new file mode 100644
index 0000000..68c269f
--- /dev/null
+++ b/tests/TFP/TFP_53_002/mpu.c
@@ -0,0 +1,54 @@
+/*
+ * Copyright 2008 Sony Corporation
+ *
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a copy
+ * of this software and associated documentation files (the "Software"), to deal
+ * in the Software without restriction, including without limitation the rights
+ * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+ * copies of the Software, and to permit persons to whom the Software is
+ * furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included in
+ * all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+ * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+ * THE SOFTWARE.
+ */
+
+#include <mars/mars.h>
+#include <mars_task_test.h>
+#include <spu_mfcio.h>
+
+static uint32_t shared_resource __attribute((aligned(16)));
+
+int mars_task_main(const struct mars_task_args *task_args)
+{
+ int ret, i;
+ uint64_t semaphore_ea = task_args->type.u64[0];
+ uint64_t shared_resource_ea = task_args->type.u64[1];
+ uint64_t count = task_args->type.u64[2];
+
+ for (i = 0; i < count; i++) {
+ ret = mars_task_semaphore_acquire(semaphore_ea);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+ }
+
+ /* limit check */
+ ret = mars_task_semaphore_acquire(semaphore_ea);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+
+ /* if program reaches here, shared_resource'll be updated */
+ shared_resource = 1;
+ mfc_put(&shared_resource, shared_resource_ea,
+ sizeof(uint32_t), 0, 0, 0);
+ mfc_write_tag_mask(1 << 0);
+ mfc_read_tag_status_all();
+
+ return 0;
+}
diff --git a/tests/TFP/TFP_53_003/Makefile b/tests/TFP/TFP_53_003/Makefile
new file mode 100644
index 0000000..ecbce33
--- /dev/null
+++ b/tests/TFP/TFP_53_003/Makefile
@@ -0,0 +1,28 @@
+#
+# Copyright 2008 Sony Corporation
+#
+#
+# Permission is hereby granted, free of charge, to any person obtaining a copy
+# of this software and associated documentation files (the "Software"), to deal
+# in the Software without restriction, including without limitation the rights
+# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+# copies of the Software, and to permit persons to whom the Software is
+# furnished to do so, subject to the following conditions:
+#
+# The above copyright notice and this permission notice shall be included in
+# all copies or substantial portions of the Software.
+#
+# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+# THE SOFTWARE.
+#
+
+top_srcdir = ../..
+test_objs = host.o mpu1.task_eo mpu2.task_eo
+
+include $(top_srcdir)/scripts/config.mk
+include $(top_srcdir)/scripts/rules_item.mk
diff --git a/tests/TFP/TFP_53_003/host.c b/tests/TFP/TFP_53_003/host.c
new file mode 100644
index 0000000..db3d4cd
--- /dev/null
+++ b/tests/TFP/TFP_53_003/host.c
@@ -0,0 +1,110 @@
+/*
+ * Copyright 2008 Sony Corporation
+ *
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a copy
+ * of this software and associated documentation files (the "Software"), to deal
+ * in the Software without restriction, including without limitation the rights
+ * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+ * copies of the Software, and to permit persons to whom the Software is
+ * furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included in
+ * all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+ * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+ * THE SOFTWARE.
+ */
+
+#include <unistd.h>
+#include <mars/mars.h>
+#include <libspe2.h>
+#include <mars_test.h>
+
+#define NUM_TASKS 10
+#define SEMAPHORE_COUNTS 5
+
+#define WAIT_SEC 2
+
+extern spe_program_handle_t mpu1_prog;
+extern spe_program_handle_t mpu2_prog;
+
+static struct mars_context *mars_ctx;
+static struct mars_task_id task_id[NUM_TASKS];
+static struct mars_task_args task_args;
+static uint64_t semaphore;
+static uint32_t notify[32] __attribute__((aligned(128)));
+
+int main(void)
+{
+ int ret, i;
+ int32_t exit_code;
+
+ MARS_TEST_ASSERT( \
+ MARS_TASK_SEMAPHORE_WAIT_MAX >= (NUM_TASKS * SEMAPHORE_COUNTS));
+
+ ret = mars_context_create(&mars_ctx, 0, 0);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+
+ ret = mars_task_semaphore_create(
+ mars_ctx,
+ &semaphore,
+ NUM_TASKS * SEMAPHORE_COUNTS);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+
+ notify[0] = 0;
+ for (i = 0; i < NUM_TASKS; i++) {
+ char name[MARS_TASK_NAME_LEN_MAX];
+
+ snprintf(name, MARS_TASK_NAME_LEN_MAX, "Task %d", i + 1);
+ ret = mars_task_create(mars_ctx, &task_id[i], name,
+ mpu1_prog.elf_image, MARS_TASK_CONTEXT_SAVE_ALL);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+
+ task_args.type.u64[0] = semaphore;
+ task_args.type.u64[1] = mars_ptr_to_ea(&notify);
+ task_args.type.u64[2] = SEMAPHORE_COUNTS;
+ ret = mars_task_schedule(&task_id[i], &task_args, 0);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+ }
+
+ /* run task */
+ mars_test_counter_set(&notify[0], 1);
+
+ for (i = 0; i < NUM_TASKS; i++) {
+ ret = mars_task_wait(&task_id[i], &exit_code);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+ MARS_TEST_ASSERT_ERROR(exit_code, MARS_SUCCESS);
+
+ ret = mars_task_destroy(&task_id[i]);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+ }
+
+ /* check semaphore count */
+ notify[0] = 0;
+ ret = mars_task_create(mars_ctx, &task_id[0], NULL,
+ mpu2_prog.elf_image, MARS_TASK_CONTEXT_SAVE_ALL);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+
+ task_args.type.u64[0] = semaphore;
+ task_args.type.u64[1] = mars_ptr_to_ea(&notify);
+ ret = mars_task_schedule(&task_id[0], &task_args, 0);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+
+ /* wait for blocking */
+ sleep(WAIT_SEC);
+
+ /* Check if shared_resource hasn't been changed */
+ MARS_TEST_ASSERT_EQUAL(notify[0], 0);
+
+ ret = mars_task_semaphore_destroy(semaphore);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+
+ exit(0);
+}
+
diff --git a/tests/TFP/TFP_53_003/mpu1.c b/tests/TFP/TFP_53_003/mpu1.c
new file mode 100644
index 0000000..ab9bc8d
--- /dev/null
+++ b/tests/TFP/TFP_53_003/mpu1.c
@@ -0,0 +1,43 @@
+/*
+ * Copyright 2008 Sony Corporation
+ *
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a copy
+ * of this software and associated documentation files (the "Software"), to deal
+ * in the Software without restriction, including without limitation the rights
+ * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+ * copies of the Software, and to permit persons to whom the Software is
+ * furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included in
+ * all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+ * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+ * THE SOFTWARE.
+ */
+
+#include <mars/mars.h>
+#include <mars_task_test.h>
+#include <spu_mfcio.h>
+
+int mars_task_main(const struct mars_task_args *task_args)
+{
+ int ret, i;
+ uint64_t semaphore_ea = task_args->type.u64[0];
+ uint64_t notify_ea = task_args->type.u64[1];
+ uint64_t counts = task_args->type.u64[2];
+
+ mars_test_counter_wait(notify_ea, 1);
+
+ for (i = 0; i < counts; i++) {
+ ret = mars_task_semaphore_acquire(semaphore_ea);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+ }
+
+ return 0;
+}
diff --git a/tests/TFP/TFP_53_003/mpu2.c b/tests/TFP/TFP_53_003/mpu2.c
new file mode 100644
index 0000000..18f5465
--- /dev/null
+++ b/tests/TFP/TFP_53_003/mpu2.c
@@ -0,0 +1,41 @@
+/*
+ * Copyright 2008 Sony Corporation
+ *
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a copy
+ * of this software and associated documentation files (the "Software"), to deal
+ * in the Software without restriction, including without limitation the rights
+ * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+ * copies of the Software, and to permit persons to whom the Software is
+ * furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included in
+ * all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+ * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+ * THE SOFTWARE.
+ */
+
+#include <mars/mars.h>
+#include <mars_task_test.h>
+#include <spu_mfcio.h>
+
+int mars_task_main(const struct mars_task_args *task_args)
+{
+ int ret;
+ uint64_t semaphore_ea = task_args->type.u64[0];
+ uint64_t notify_ea = task_args->type.u64[1];
+
+ ret = mars_task_semaphore_acquire(semaphore_ea);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+
+ /* if program reaches here, shared_resource'll be updated */
+ mars_test_counter_set(notify_ea, 1);
+
+ return 0;
+}
diff --git a/tests/TFP/TFP_53_004/Makefile b/tests/TFP/TFP_53_004/Makefile
new file mode 100644
index 0000000..432135a
--- /dev/null
+++ b/tests/TFP/TFP_53_004/Makefile
@@ -0,0 +1,28 @@
+#
+# Copyright 2008 Sony Corporation
+#
+#
+# Permission is hereby granted, free of charge, to any person obtaining a copy
+# of this software and associated documentation files (the "Software"), to deal
+# in the Software without restriction, including without limitation the rights
+# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+# copies of the Software, and to permit persons to whom the Software is
+# furnished to do so, subject to the following conditions:
+#
+# The above copyright notice and this permission notice shall be included in
+# all copies or substantial portions of the Software.
+#
+# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+# THE SOFTWARE.
+#
+
+top_srcdir = ../..
+test_objs = host.o mpu.task_eo
+
+include $(top_srcdir)/scripts/config.mk
+include $(top_srcdir)/scripts/rules_item.mk
diff --git a/tests/TFP/TFP_53_004/host.c b/tests/TFP/TFP_53_004/host.c
new file mode 100644
index 0000000..3ffb24d
--- /dev/null
+++ b/tests/TFP/TFP_53_004/host.c
@@ -0,0 +1,83 @@
+/*
+ * Copyright 2008 Sony Corporation
+ *
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a copy
+ * of this software and associated documentation files (the "Software"), to deal
+ * in the Software without restriction, including without limitation the rights
+ * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+ * copies of the Software, and to permit persons to whom the Software is
+ * furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included in
+ * all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+ * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+ * THE SOFTWARE.
+ */
+
+#include <libspe2.h>
+#include <mars/mars.h>
+#include <mars_test.h>
+
+#define TASK_COUNT 16
+
+extern spe_program_handle_t mpu_prog;
+
+static struct mars_context *mars;
+static struct mars_task_id task_ids[TASK_COUNT];
+static struct mars_task_args task_args;
+static uint64_t semaphores[TASK_COUNT];
+
+int main(void)
+{
+ int i, exit_code, ret;
+
+ ret = mars_context_create(&mars, 0, 0);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+
+ for (i = 0; i < TASK_COUNT; i++) {
+ ret = mars_task_create(
+ mars,
+ &task_ids[i],
+ "53004",
+ mpu_prog.elf_image,
+ MARS_TASK_CONTEXT_SAVE_ALL);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+
+ ret = mars_task_semaphore_create(mars, &semaphores[i], 1);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+ }
+
+ for (i = 0; i < TASK_COUNT; i++) {
+ task_args.type.u64[0] = semaphores[i];
+
+ ret = mars_task_schedule(&task_ids[i], &task_args, 0);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+ }
+
+ for (i = 0; i < TASK_COUNT; i++) {
+ ret = mars_task_wait(&task_ids[i], &exit_code);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+
+ MARS_TEST_ASSERT_EQUAL(exit_code, 0);
+ }
+
+ for (i = 0; i < TASK_COUNT; i++) {
+ ret = mars_task_semaphore_destroy(semaphores[i]);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+
+ ret = mars_task_destroy(&task_ids[i]);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+ }
+
+ ret = mars_context_destroy(mars);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+
+ return 0;
+}
diff --git a/tests/TFP/TFP_53_004/mpu.c b/tests/TFP/TFP_53_004/mpu.c
new file mode 100644
index 0000000..c2c0c99
--- /dev/null
+++ b/tests/TFP/TFP_53_004/mpu.c
@@ -0,0 +1,38 @@
+/*
+ * Copyright 2008 Sony Corporation
+ *
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a copy
+ * of this software and associated documentation files (the "Software"), to deal
+ * in the Software without restriction, including without limitation the rights
+ * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+ * copies of the Software, and to permit persons to whom the Software is
+ * furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included in
+ * all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+ * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+ * THE SOFTWARE.
+ */
+
+#include <mars/mars.h>
+#include "mars_task_test.h"
+
+int mars_task_main(const struct mars_task_args *task_args)
+{
+ int ret;
+ uint64_t semaphore_ea = task_args->type.u64[0];
+
+ ret = mars_task_semaphore_acquire(semaphore_ea);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+
+ mars_task_exit(0);
+
+ return 0;
+}
diff --git a/tests/TFP/TFP_53_005/Makefile b/tests/TFP/TFP_53_005/Makefile
new file mode 100644
index 0000000..432135a
--- /dev/null
+++ b/tests/TFP/TFP_53_005/Makefile
@@ -0,0 +1,28 @@
+#
+# Copyright 2008 Sony Corporation
+#
+#
+# Permission is hereby granted, free of charge, to any person obtaining a copy
+# of this software and associated documentation files (the "Software"), to deal
+# in the Software without restriction, including without limitation the rights
+# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+# copies of the Software, and to permit persons to whom the Software is
+# furnished to do so, subject to the following conditions:
+#
+# The above copyright notice and this permission notice shall be included in
+# all copies or substantial portions of the Software.
+#
+# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+# THE SOFTWARE.
+#
+
+top_srcdir = ../..
+test_objs = host.o mpu.task_eo
+
+include $(top_srcdir)/scripts/config.mk
+include $(top_srcdir)/scripts/rules_item.mk
diff --git a/tests/TFP/TFP_53_005/host.c b/tests/TFP/TFP_53_005/host.c
new file mode 100644
index 0000000..fa6e682
--- /dev/null
+++ b/tests/TFP/TFP_53_005/host.c
@@ -0,0 +1,87 @@
+/*
+ * Copyright 2008 Sony Corporation
+ *
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a copy
+ * of this software and associated documentation files (the "Software"), to deal
+ * in the Software without restriction, including without limitation the rights
+ * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+ * copies of the Software, and to permit persons to whom the Software is
+ * furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included in
+ * all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+ * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+ * THE SOFTWARE.
+ */
+
+#include <libspe2.h>
+#include <mars/mars.h>
+#include <mars_test.h>
+
+#define MAX_TASK_COUNT 256
+
+extern spe_program_handle_t mpu_prog;
+
+static struct mars_context *mars;
+static struct mars_task_id task_ids[MAX_TASK_COUNT];
+static struct mars_task_args task_args;
+static uint64_t semaphore;
+
+int main(void)
+{
+ int i, exit_code, ret;
+
+ int spe_cnt = spe_cpu_info_get(SPE_COUNT_PHYSICAL_SPES, -1);
+
+ MARS_TEST_ASSERT(spe_cnt <= MAX_TASK_COUNT);
+
+ ret = mars_context_create(&mars, spe_cnt, 0);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+
+ ret = mars_task_semaphore_create(mars, &semaphore, spe_cnt);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+
+ for (i = 0; i < spe_cnt; i++) {
+ ret = mars_task_create(
+ mars,
+ &task_ids[i],
+ "53005",
+ mpu_prog.elf_image,
+ MARS_TASK_CONTEXT_SAVE_ALL);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+ }
+
+ task_args.type.u64[0] = semaphore;
+
+ for (i = 0; i < spe_cnt; i++) {
+ ret = mars_task_schedule(&task_ids[i], &task_args, 0);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+ }
+
+ for (i = 0; i < spe_cnt; i++) {
+ ret = mars_task_wait(&task_ids[i], &exit_code);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+
+ MARS_TEST_ASSERT_EQUAL(exit_code, 0);
+ }
+
+ for (i = 0; i < spe_cnt; i++) {
+ ret = mars_task_destroy(&task_ids[i]);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+ }
+
+ ret = mars_task_semaphore_destroy(semaphore);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+
+ ret = mars_context_destroy(mars);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+
+ return 0;
+}
diff --git a/tests/TFP/TFP_53_005/mpu.c b/tests/TFP/TFP_53_005/mpu.c
new file mode 100644
index 0000000..1aa9065
--- /dev/null
+++ b/tests/TFP/TFP_53_005/mpu.c
@@ -0,0 +1,45 @@
+/*
+ * Copyright 2008 Sony Corporation
+ *
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a copy
+ * of this software and associated documentation files (the "Software"), to deal
+ * in the Software without restriction, including without limitation the rights
+ * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+ * copies of the Software, and to permit persons to whom the Software is
+ * furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included in
+ * all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+ * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+ * THE SOFTWARE.
+ */
+
+#include <mars/mars.h>
+#include "mars_task_test.h"
+
+#define LOOP_COUNT 1024
+
+int mars_task_main(const struct mars_task_args *task_args)
+{
+ int i, ret;
+ uint64_t semaphore_ea = task_args->type.u64[0];
+
+ for (i = 0; i < LOOP_COUNT; i++) {
+ ret = mars_task_semaphore_acquire(semaphore_ea);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+
+ ret = mars_task_semaphore_release(semaphore_ea);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+ }
+
+ mars_task_exit(0);
+
+ return 0;
+}
diff --git a/tests/TFP/TFP_53_006/Makefile b/tests/TFP/TFP_53_006/Makefile
new file mode 100644
index 0000000..432135a
--- /dev/null
+++ b/tests/TFP/TFP_53_006/Makefile
@@ -0,0 +1,28 @@
+#
+# Copyright 2008 Sony Corporation
+#
+#
+# Permission is hereby granted, free of charge, to any person obtaining a copy
+# of this software and associated documentation files (the "Software"), to deal
+# in the Software without restriction, including without limitation the rights
+# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+# copies of the Software, and to permit persons to whom the Software is
+# furnished to do so, subject to the following conditions:
+#
+# The above copyright notice and this permission notice shall be included in
+# all copies or substantial portions of the Software.
+#
+# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+# THE SOFTWARE.
+#
+
+top_srcdir = ../..
+test_objs = host.o mpu.task_eo
+
+include $(top_srcdir)/scripts/config.mk
+include $(top_srcdir)/scripts/rules_item.mk
diff --git a/tests/TFP/TFP_53_006/host.c b/tests/TFP/TFP_53_006/host.c
new file mode 100644
index 0000000..d27ba19
--- /dev/null
+++ b/tests/TFP/TFP_53_006/host.c
@@ -0,0 +1,87 @@
+/*
+ * Copyright 2008 Sony Corporation
+ *
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a copy
+ * of this software and associated documentation files (the "Software"), to deal
+ * in the Software without restriction, including without limitation the rights
+ * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+ * copies of the Software, and to permit persons to whom the Software is
+ * furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included in
+ * all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+ * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+ * THE SOFTWARE.
+ */
+
+#include <libspe2.h>
+#include <mars/mars.h>
+#include <mars_test.h>
+
+#define MAX_TASK_COUNT 256
+
+extern spe_program_handle_t mpu_prog;
+
+static struct mars_context *mars;
+static struct mars_task_id task_ids[MAX_TASK_COUNT];
+static struct mars_task_args task_args;
+static uint64_t semaphores[MAX_TASK_COUNT];
+
+int main(void)
+{
+ int i, exit_code, ret;
+
+ int spe_cnt = spe_cpu_info_get(SPE_COUNT_PHYSICAL_SPES, -1);
+
+ MARS_TEST_ASSERT(spe_cnt <= MAX_TASK_COUNT);
+
+ ret = mars_context_create(&mars, spe_cnt, 0);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+
+ for (i = 0; i < spe_cnt; i++) {
+ ret = mars_task_create(
+ mars,
+ &task_ids[i],
+ "53006",
+ mpu_prog.elf_image,
+ MARS_TASK_CONTEXT_SAVE_ALL);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+
+ ret = mars_task_semaphore_create(mars, &semaphores[i], 1);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+ }
+
+ for (i = 0; i < spe_cnt; i++) {
+ task_args.type.u64[0] = semaphores[i];
+
+ ret = mars_task_schedule(&task_ids[i], &task_args, 0);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+ }
+
+ for (i = 0; i < spe_cnt; i++) {
+ ret = mars_task_wait(&task_ids[i], &exit_code);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+
+ MARS_TEST_ASSERT_EQUAL(exit_code, 0);
+ }
+
+ for (i = 0; i < spe_cnt; i++) {
+ ret = mars_task_semaphore_destroy(semaphores[i]);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+
+ ret = mars_task_destroy(&task_ids[i]);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+ }
+
+ ret = mars_context_destroy(mars);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+
+ return 0;
+}
diff --git a/tests/TFP/TFP_53_006/mpu.c b/tests/TFP/TFP_53_006/mpu.c
new file mode 100644
index 0000000..1aa9065
--- /dev/null
+++ b/tests/TFP/TFP_53_006/mpu.c
@@ -0,0 +1,45 @@
+/*
+ * Copyright 2008 Sony Corporation
+ *
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a copy
+ * of this software and associated documentation files (the "Software"), to deal
+ * in the Software without restriction, including without limitation the rights
+ * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+ * copies of the Software, and to permit persons to whom the Software is
+ * furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included in
+ * all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+ * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+ * THE SOFTWARE.
+ */
+
+#include <mars/mars.h>
+#include "mars_task_test.h"
+
+#define LOOP_COUNT 1024
+
+int mars_task_main(const struct mars_task_args *task_args)
+{
+ int i, ret;
+ uint64_t semaphore_ea = task_args->type.u64[0];
+
+ for (i = 0; i < LOOP_COUNT; i++) {
+ ret = mars_task_semaphore_acquire(semaphore_ea);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+
+ ret = mars_task_semaphore_release(semaphore_ea);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+ }
+
+ mars_task_exit(0);
+
+ return 0;
+}
diff --git a/tests/TFP/TFP_54_001/Makefile b/tests/TFP/TFP_54_001/Makefile
new file mode 100644
index 0000000..432135a
--- /dev/null
+++ b/tests/TFP/TFP_54_001/Makefile
@@ -0,0 +1,28 @@
+#
+# Copyright 2008 Sony Corporation
+#
+#
+# Permission is hereby granted, free of charge, to any person obtaining a copy
+# of this software and associated documentation files (the "Software"), to deal
+# in the Software without restriction, including without limitation the rights
+# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+# copies of the Software, and to permit persons to whom the Software is
+# furnished to do so, subject to the following conditions:
+#
+# The above copyright notice and this permission notice shall be included in
+# all copies or substantial portions of the Software.
+#
+# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+# THE SOFTWARE.
+#
+
+top_srcdir = ../..
+test_objs = host.o mpu.task_eo
+
+include $(top_srcdir)/scripts/config.mk
+include $(top_srcdir)/scripts/rules_item.mk
diff --git a/tests/TFP/TFP_54_001/host.c b/tests/TFP/TFP_54_001/host.c
new file mode 100644
index 0000000..7e503a8
--- /dev/null
+++ b/tests/TFP/TFP_54_001/host.c
@@ -0,0 +1,72 @@
+/*
+ * Copyright 2008 Sony Corporation
+ *
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a copy
+ * of this software and associated documentation files (the "Software"), to deal
+ * in the Software without restriction, including without limitation the rights
+ * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+ * copies of the Software, and to permit persons to whom the Software is
+ * furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included in
+ * all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+ * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+ * THE SOFTWARE.
+ */
+
+#include <mars/mars.h>
+#include <libspe2.h>
+#include <mars_test.h>
+
+extern spe_program_handle_t mpu_prog;
+
+static struct mars_context *mars_ctx;
+static struct mars_task_id task_id;
+static struct mars_task_args task_args;
+static uint64_t semaphore;
+
+int main(void)
+{
+ int ret;
+ int32_t exit_code;
+
+ ret = mars_context_create(&mars_ctx, 0, 0);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+
+ ret = mars_task_semaphore_create(
+ mars_ctx,
+ &semaphore,
+ MARS_TASK_SEMAPHORE_WAIT_MAX);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+
+ ret = mars_task_create(mars_ctx, &task_id, NULL,
+ mpu_prog.elf_image, MARS_TASK_CONTEXT_SAVE_ALL);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+
+ task_args.type.u64[0] = semaphore;
+ ret = mars_task_schedule(&task_id, &task_args, 0);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+
+ ret = mars_task_wait(&task_id, &exit_code);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+ MARS_TEST_ASSERT_ERROR(exit_code, MARS_SUCCESS);
+
+ ret = mars_task_destroy(&task_id);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+
+ ret = mars_task_semaphore_destroy(semaphore);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+
+ ret = mars_context_destroy(mars_ctx);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+
+ return 0;
+}
+
diff --git a/tests/TFP/TFP_54_001/mpu.c b/tests/TFP/TFP_54_001/mpu.c
new file mode 100644
index 0000000..20430d1
--- /dev/null
+++ b/tests/TFP/TFP_54_001/mpu.c
@@ -0,0 +1,61 @@
+/*
+ * Copyright 2008 Sony Corporation
+ *
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a copy
+ * of this software and associated documentation files (the "Software"), to deal
+ * in the Software without restriction, including without limitation the rights
+ * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+ * copies of the Software, and to permit persons to whom the Software is
+ * furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included in
+ * all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+ * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+ * THE SOFTWARE.
+ */
+
+#include <mars/mars.h>
+#include <mars_task_test.h>
+
+#define SEMAPHORE_COUNTS 10
+
+int mars_task_main(const struct mars_task_args *task_args)
+{
+ int ret, i;
+ uint64_t semaphore_ea = task_args->type.u64[0];
+
+ /* count: 1 */
+ ret = mars_task_semaphore_acquire(semaphore_ea);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+ ret = mars_task_semaphore_release(semaphore_ea);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+
+ /* count: SEMAPHORE_COUNTS */
+ for (i = 0; i < SEMAPHORE_COUNTS; i++) {
+ ret = mars_task_semaphore_acquire(semaphore_ea);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+ }
+ for (i = 0; i < SEMAPHORE_COUNTS; i++) {
+ ret = mars_task_semaphore_release(semaphore_ea);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+ }
+
+ /* count: MAX */
+ for (i = 0; i < MARS_TASK_SEMAPHORE_WAIT_MAX; i++) {
+ ret = mars_task_semaphore_acquire(semaphore_ea);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+ }
+ for (i = 0; i < MARS_TASK_SEMAPHORE_WAIT_MAX; i++) {
+ ret = mars_task_semaphore_release(semaphore_ea);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+ }
+
+ return 0;
+}
diff --git a/tests/TFP/TFP_54_002/Makefile b/tests/TFP/TFP_54_002/Makefile
new file mode 100644
index 0000000..ecbce33
--- /dev/null
+++ b/tests/TFP/TFP_54_002/Makefile
@@ -0,0 +1,28 @@
+#
+# Copyright 2008 Sony Corporation
+#
+#
+# Permission is hereby granted, free of charge, to any person obtaining a copy
+# of this software and associated documentation files (the "Software"), to deal
+# in the Software without restriction, including without limitation the rights
+# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+# copies of the Software, and to permit persons to whom the Software is
+# furnished to do so, subject to the following conditions:
+#
+# The above copyright notice and this permission notice shall be included in
+# all copies or substantial portions of the Software.
+#
+# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+# THE SOFTWARE.
+#
+
+top_srcdir = ../..
+test_objs = host.o mpu1.task_eo mpu2.task_eo
+
+include $(top_srcdir)/scripts/config.mk
+include $(top_srcdir)/scripts/rules_item.mk
diff --git a/tests/TFP/TFP_54_002/host.c b/tests/TFP/TFP_54_002/host.c
new file mode 100644
index 0000000..673838b
--- /dev/null
+++ b/tests/TFP/TFP_54_002/host.c
@@ -0,0 +1,127 @@
+/*
+ * Copyright 2008 Sony Corporation
+ *
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a copy
+ * of this software and associated documentation files (the "Software"), to deal
+ * in the Software without restriction, including without limitation the rights
+ * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+ * copies of the Software, and to permit persons to whom the Software is
+ * furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included in
+ * all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+ * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+ * THE SOFTWARE.
+ */
+
+#include <unistd.h>
+#include <mars/mars.h>
+#include <libspe2.h>
+#include <mars_test.h>
+
+#define NUM_TASKS 10
+#define SEMAPHORE_COUNTS 5
+
+extern spe_program_handle_t mpu1_prog;
+extern spe_program_handle_t mpu2_prog;
+
+static struct mars_context *mars_ctx;
+static struct mars_task_id task_id[NUM_TASKS];
+static struct mars_task_args task_args;
+static uint64_t semaphore;
+static uint32_t notify[32] __attribute__((aligned(128)));
+
+int main(void)
+{
+ int ret, i;
+ int32_t exit_code;
+
+ MARS_TEST_ASSERT( \
+ MARS_TASK_SEMAPHORE_WAIT_MAX >= (NUM_TASKS * SEMAPHORE_COUNTS));
+ ret = mars_context_create(&mars_ctx, 0, 0);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+
+ ret = mars_task_semaphore_create(
+ mars_ctx,
+ &semaphore,
+ NUM_TASKS * SEMAPHORE_COUNTS);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+
+ /* acuire all semaphores */
+ ret = mars_task_create(mars_ctx, &task_id[0], NULL,
+ mpu1_prog.elf_image, MARS_TASK_CONTEXT_SAVE_ALL);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+
+ task_args.type.u64[0] = semaphore;
+ task_args.type.u64[1] = NUM_TASKS * SEMAPHORE_COUNTS;
+ ret = mars_task_schedule(&task_id[0], &task_args, 0);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+
+ ret = mars_task_wait(&task_id[0], &exit_code);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+
+ ret = mars_task_destroy(&task_id[0]);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+
+ /* main tasks */
+ notify[0] = 0;
+ for (i = 0; i < NUM_TASKS; i++) {
+ char name[MARS_TASK_NAME_LEN_MAX];
+
+ snprintf(name, MARS_TASK_NAME_LEN_MAX, "Task %d", i + 1);
+ ret = mars_task_create(mars_ctx, &task_id[i], name,
+ mpu2_prog.elf_image, MARS_TASK_CONTEXT_SAVE_ALL);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+
+ task_args.type.u64[0] = semaphore;
+ task_args.type.u64[1] = mars_ptr_to_ea(&notify);
+ task_args.type.u64[2] = SEMAPHORE_COUNTS;
+ ret = mars_task_schedule(&task_id[i], &task_args, 0);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+ }
+
+ /* run task */
+ mars_test_counter_set(&notify[0], 1);
+
+ for (i = 0; i < NUM_TASKS; i++) {
+ ret = mars_task_wait(&task_id[i], &exit_code);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+ MARS_TEST_ASSERT_ERROR(exit_code, MARS_SUCCESS);
+
+ ret = mars_task_destroy(&task_id[i]);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+ }
+
+ /* acuire all semaphores */
+ ret = mars_task_create(mars_ctx, &task_id[0], NULL,
+ mpu1_prog.elf_image, MARS_TASK_CONTEXT_SAVE_ALL);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+
+ task_args.type.u64[0] = semaphore;
+ task_args.type.u64[1] = NUM_TASKS * SEMAPHORE_COUNTS;
+ ret = mars_task_schedule(&task_id[0], &task_args, 0);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+
+ ret = mars_task_wait(&task_id[0], &exit_code);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+ MARS_TEST_ASSERT_ERROR(exit_code, MARS_SUCCESS);
+
+ ret = mars_task_destroy(&task_id[0]);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+
+ ret = mars_task_semaphore_destroy(semaphore);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+
+ ret = mars_context_destroy(mars_ctx);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+
+ return 0;
+}
+
diff --git a/tests/TFP/TFP_54_002/mpu1.c b/tests/TFP/TFP_54_002/mpu1.c
new file mode 100644
index 0000000..532d82f
--- /dev/null
+++ b/tests/TFP/TFP_54_002/mpu1.c
@@ -0,0 +1,39 @@
+/*
+ * Copyright 2008 Sony Corporation
+ *
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a copy
+ * of this software and associated documentation files (the "Software"), to deal
+ * in the Software without restriction, including without limitation the rights
+ * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+ * copies of the Software, and to permit persons to whom the Software is
+ * furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included in
+ * all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+ * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+ * THE SOFTWARE.
+ */
+
+#include <mars/mars.h>
+#include <mars_task_test.h>
+
+int mars_task_main(const struct mars_task_args *task_args)
+{
+ int ret, i;
+ uint64_t semaphore_ea = task_args->type.u64[0];
+ uint64_t counts = task_args->type.u64[1];
+
+ for (i = 0; i < counts; i++) {
+ ret = mars_task_semaphore_acquire(semaphore_ea);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+ }
+
+ return 0;
+}
diff --git a/tests/TFP/TFP_54_002/mpu2.c b/tests/TFP/TFP_54_002/mpu2.c
new file mode 100644
index 0000000..86ea670
--- /dev/null
+++ b/tests/TFP/TFP_54_002/mpu2.c
@@ -0,0 +1,43 @@
+/*
+ * Copyright 2008 Sony Corporation
+ *
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a copy
+ * of this software and associated documentation files (the "Software"), to deal
+ * in the Software without restriction, including without limitation the rights
+ * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+ * copies of the Software, and to permit persons to whom the Software is
+ * furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included in
+ * all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+ * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+ * THE SOFTWARE.
+ */
+
+#include <mars/mars.h>
+#include <mars_task_test.h>
+#include <spu_mfcio.h>
+
+int mars_task_main(const struct mars_task_args *task_args)
+{
+ int ret, i;
+ uint64_t semaphore_ea = task_args->type.u64[0];
+ uint64_t notify_ea = task_args->type.u64[1];
+ uint64_t counts = task_args->type.u64[2];
+
+ mars_test_counter_wait(notify_ea, 1);
+
+ for (i = 0; i < counts; i++) {
+ ret = mars_task_semaphore_release(semaphore_ea);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+ }
+
+ return 0;
+}
diff --git a/tests/TFP/TFP_54_003/Makefile b/tests/TFP/TFP_54_003/Makefile
new file mode 100644
index 0000000..432135a
--- /dev/null
+++ b/tests/TFP/TFP_54_003/Makefile
@@ -0,0 +1,28 @@
+#
+# Copyright 2008 Sony Corporation
+#
+#
+# Permission is hereby granted, free of charge, to any person obtaining a copy
+# of this software and associated documentation files (the "Software"), to deal
+# in the Software without restriction, including without limitation the rights
+# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+# copies of the Software, and to permit persons to whom the Software is
+# furnished to do so, subject to the following conditions:
+#
+# The above copyright notice and this permission notice shall be included in
+# all copies or substantial portions of the Software.
+#
+# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+# THE SOFTWARE.
+#
+
+top_srcdir = ../..
+test_objs = host.o mpu.task_eo
+
+include $(top_srcdir)/scripts/config.mk
+include $(top_srcdir)/scripts/rules_item.mk
diff --git a/tests/TFP/TFP_54_003/host.c b/tests/TFP/TFP_54_003/host.c
new file mode 100644
index 0000000..1ac5bb4
--- /dev/null
+++ b/tests/TFP/TFP_54_003/host.c
@@ -0,0 +1,83 @@
+/*
+ * Copyright 2008 Sony Corporation
+ *
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a copy
+ * of this software and associated documentation files (the "Software"), to deal
+ * in the Software without restriction, including without limitation the rights
+ * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+ * copies of the Software, and to permit persons to whom the Software is
+ * furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included in
+ * all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+ * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+ * THE SOFTWARE.
+ */
+
+#include <libspe2.h>
+#include <mars/mars.h>
+#include <mars_test.h>
+
+#define TASK_COUNT 16
+
+extern spe_program_handle_t mpu_prog;
+
+static struct mars_context *mars;
+static struct mars_task_id task_ids[TASK_COUNT];
+static struct mars_task_args task_args;
+static uint64_t semaphores[TASK_COUNT];
+
+int main(void)
+{
+ int i, exit_code, ret;
+
+ ret = mars_context_create(&mars, 0, 0);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+
+ for (i = 0; i < TASK_COUNT; i++) {
+ ret = mars_task_create(
+ mars,
+ &task_ids[i],
+ "54003",
+ mpu_prog.elf_image,
+ MARS_TASK_CONTEXT_SAVE_ALL);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+
+ ret = mars_task_semaphore_create(mars, &semaphores[i], 1);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+ }
+
+ for (i = 0; i < TASK_COUNT; i++) {
+ task_args.type.u64[0] = semaphores[i];
+
+ ret = mars_task_schedule(&task_ids[i], &task_args, 0);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+ }
+
+ for (i = 0; i < TASK_COUNT; i++) {
+ ret = mars_task_wait(&task_ids[i], &exit_code);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+
+ MARS_TEST_ASSERT_EQUAL(exit_code, 0);
+ }
+
+ for (i = 0; i < TASK_COUNT; i++) {
+ ret = mars_task_semaphore_destroy(semaphores[i]);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+
+ ret = mars_task_destroy(&task_ids[i]);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+ }
+
+ ret = mars_context_destroy(mars);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+
+ return 0;
+}
diff --git a/tests/TFP/TFP_54_003/mpu.c b/tests/TFP/TFP_54_003/mpu.c
new file mode 100644
index 0000000..09ce45a
--- /dev/null
+++ b/tests/TFP/TFP_54_003/mpu.c
@@ -0,0 +1,41 @@
+/*
+ * Copyright 2008 Sony Corporation
+ *
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a copy
+ * of this software and associated documentation files (the "Software"), to deal
+ * in the Software without restriction, including without limitation the rights
+ * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+ * copies of the Software, and to permit persons to whom the Software is
+ * furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included in
+ * all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+ * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+ * THE SOFTWARE.
+ */
+
+#include <mars/mars.h>
+#include "mars_task_test.h"
+
+int mars_task_main(const struct mars_task_args *task_args)
+{
+ int ret;
+ uint64_t semaphore_ea = task_args->type.u64[0];
+
+ ret = mars_task_semaphore_acquire(semaphore_ea);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+
+ ret = mars_task_semaphore_release(semaphore_ea);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+
+ mars_task_exit(0);
+
+ return 0;
+}
diff --git a/tests/TFP/TFP_61_001/Makefile b/tests/TFP/TFP_61_001/Makefile
new file mode 100644
index 0000000..432135a
--- /dev/null
+++ b/tests/TFP/TFP_61_001/Makefile
@@ -0,0 +1,28 @@
+#
+# Copyright 2008 Sony Corporation
+#
+#
+# Permission is hereby granted, free of charge, to any person obtaining a copy
+# of this software and associated documentation files (the "Software"), to deal
+# in the Software without restriction, including without limitation the rights
+# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+# copies of the Software, and to permit persons to whom the Software is
+# furnished to do so, subject to the following conditions:
+#
+# The above copyright notice and this permission notice shall be included in
+# all copies or substantial portions of the Software.
+#
+# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+# THE SOFTWARE.
+#
+
+top_srcdir = ../..
+test_objs = host.o mpu.task_eo
+
+include $(top_srcdir)/scripts/config.mk
+include $(top_srcdir)/scripts/rules_item.mk
diff --git a/tests/TFP/TFP_61_001/host.c b/tests/TFP/TFP_61_001/host.c
new file mode 100644
index 0000000..828e677
--- /dev/null
+++ b/tests/TFP/TFP_61_001/host.c
@@ -0,0 +1,73 @@
+/*
+ * Copyright 2008 Sony Corporation
+ *
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a copy
+ * of this software and associated documentation files (the "Software"), to deal
+ * in the Software without restriction, including without limitation the rights
+ * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+ * copies of the Software, and to permit persons to whom the Software is
+ * furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included in
+ * all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+ * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+ * THE SOFTWARE.
+ */
+
+#include <unistd.h>
+#include <mars/mars.h>
+#include <libspe2.h>
+#include <mars_test.h>
+
+#define WAIT_SEC 1
+
+extern spe_program_handle_t mpu_prog;
+
+static struct mars_context *mars_ctx;
+static struct mars_task_id task_id;
+static struct mars_task_args task_args;
+static uint32_t shared_resource __attribute__((aligned(16)));
+
+int main(void)
+{
+ int ret;
+ int32_t exit_code;
+
+ ret = mars_context_create(&mars_ctx, 0, 0);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+
+ shared_resource = 0;
+ ret = mars_task_create(mars_ctx, &task_id, NULL,
+ mpu_prog.elf_image, MARS_TASK_CONTEXT_SAVE_ALL);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+
+ task_args.type.u64[0] = mars_ptr_to_ea(&shared_resource);
+ ret = mars_task_schedule(&task_id, &task_args, 0);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+
+ sleep(WAIT_SEC);
+ MARS_TEST_ASSERT_EQUAL(shared_resource, 0);
+
+ ret = mars_task_signal_send(&task_id);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+
+ ret = mars_task_wait(&task_id, &exit_code);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+ MARS_TEST_ASSERT_ERROR(exit_code, MARS_SUCCESS);
+
+ ret = mars_task_destroy(&task_id);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+
+ ret = mars_context_destroy(mars_ctx);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+
+ return 0;
+}
+
diff --git a/tests/TFP/TFP_61_001/mpu.c b/tests/TFP/TFP_61_001/mpu.c
new file mode 100644
index 0000000..52d924d
--- /dev/null
+++ b/tests/TFP/TFP_61_001/mpu.c
@@ -0,0 +1,46 @@
+/*
+ * Copyright 2008 Sony Corporation
+ *
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a copy
+ * of this software and associated documentation files (the "Software"), to deal
+ * in the Software without restriction, including without limitation the rights
+ * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+ * copies of the Software, and to permit persons to whom the Software is
+ * furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included in
+ * all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+ * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+ * THE SOFTWARE.
+ */
+
+#include <mars/mars.h>
+#include <mars_task_test.h>
+#include <spu_mfcio.h>
+
+static uint32_t shared_resource __attribute((aligned(16)));
+
+int mars_task_main(const struct mars_task_args *task_args)
+{
+ int ret;
+ uint64_t shared_resource_ea = task_args->type.u64[0];
+
+ ret = mars_task_signal_wait();
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+
+ /* if program reaches here, shared_resource'll be updated */
+ shared_resource = 1;
+ mfc_put(&shared_resource, shared_resource_ea,
+ sizeof(uint32_t), 0, 0, 0);
+ mfc_write_tag_mask(1 << 0);
+ mfc_read_tag_status_all();
+
+ return 0;
+}
diff --git a/tests/TFP/TFP_61_002/Makefile b/tests/TFP/TFP_61_002/Makefile
new file mode 100644
index 0000000..ecbce33
--- /dev/null
+++ b/tests/TFP/TFP_61_002/Makefile
@@ -0,0 +1,28 @@
+#
+# Copyright 2008 Sony Corporation
+#
+#
+# Permission is hereby granted, free of charge, to any person obtaining a copy
+# of this software and associated documentation files (the "Software"), to deal
+# in the Software without restriction, including without limitation the rights
+# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+# copies of the Software, and to permit persons to whom the Software is
+# furnished to do so, subject to the following conditions:
+#
+# The above copyright notice and this permission notice shall be included in
+# all copies or substantial portions of the Software.
+#
+# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+# THE SOFTWARE.
+#
+
+top_srcdir = ../..
+test_objs = host.o mpu1.task_eo mpu2.task_eo
+
+include $(top_srcdir)/scripts/config.mk
+include $(top_srcdir)/scripts/rules_item.mk
diff --git a/tests/TFP/TFP_61_002/host.c b/tests/TFP/TFP_61_002/host.c
new file mode 100644
index 0000000..036d2bf
--- /dev/null
+++ b/tests/TFP/TFP_61_002/host.c
@@ -0,0 +1,87 @@
+/*
+ * Copyright 2008 Sony Corporation
+ *
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a copy
+ * of this software and associated documentation files (the "Software"), to deal
+ * in the Software without restriction, including without limitation the rights
+ * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+ * copies of the Software, and to permit persons to whom the Software is
+ * furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included in
+ * all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+ * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+ * THE SOFTWARE.
+ */
+
+#include <unistd.h>
+#include <mars/mars.h>
+#include <libspe2.h>
+#include <mars_test.h>
+
+#define WAIT_SEC 1
+extern spe_program_handle_t mpu1_prog;
+extern spe_program_handle_t mpu2_prog;
+
+static struct mars_context *mars_ctx;
+static struct mars_task_id task1_id __attribute__((aligned(16)));
+static struct mars_task_id task2_id __attribute__((aligned(16)));
+static struct mars_task_args task_args;
+
+int main(void)
+{
+ int ret;
+ int32_t exit_code;
+
+ ret = mars_context_create(&mars_ctx, 0, 0);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+
+ ret = mars_task_create(mars_ctx, &task1_id, NULL,
+ mpu1_prog.elf_image, MARS_TASK_CONTEXT_SAVE_ALL);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+
+ ret = mars_task_create(mars_ctx, &task2_id, NULL,
+ mpu2_prog.elf_image, MARS_TASK_CONTEXT_SAVE_ALL);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+
+ /* task1: wait task */
+ ret = mars_task_schedule(&task1_id, &task_args, 0);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+
+ sleep(WAIT_SEC);
+ /* check if task1 still running */
+ ret = mars_task_try_wait(&task1_id, &exit_code);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_ERROR_BUSY);
+
+ /* task2: send task */
+ task_args.type.u64[0] = mars_ptr_to_ea(&task1_id);
+ ret = mars_task_schedule(&task2_id, &task_args, 0);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+
+ ret = mars_task_wait(&task1_id, &exit_code);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+ MARS_TEST_ASSERT_ERROR(exit_code, MARS_SUCCESS);
+
+ ret = mars_task_wait(&task2_id, &exit_code);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+ MARS_TEST_ASSERT_ERROR(exit_code, MARS_SUCCESS);
+
+ ret = mars_task_destroy(&task1_id);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+
+ ret = mars_task_destroy(&task2_id);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+
+ ret = mars_context_destroy(mars_ctx);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+
+ return 0;
+}
+
diff --git a/tests/TFP/TFP_61_002/mpu1.c b/tests/TFP/TFP_61_002/mpu1.c
new file mode 100644
index 0000000..19dfded
--- /dev/null
+++ b/tests/TFP/TFP_61_002/mpu1.c
@@ -0,0 +1,35 @@
+/*
+ * Copyright 2008 Sony Corporation
+ *
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a copy
+ * of this software and associated documentation files (the "Software"), to deal
+ * in the Software without restriction, including without limitation the rights
+ * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+ * copies of the Software, and to permit persons to whom the Software is
+ * furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included in
+ * all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+ * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+ * THE SOFTWARE.
+ */
+
+#include <mars/mars.h>
+#include <mars_task_test.h>
+
+int mars_task_main(const struct mars_task_args *task_args)
+{
+ int ret;
+
+ ret = mars_task_signal_wait();
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+
+ return 0;
+}
diff --git a/tests/TFP/TFP_61_002/mpu2.c b/tests/TFP/TFP_61_002/mpu2.c
new file mode 100644
index 0000000..8965dd4
--- /dev/null
+++ b/tests/TFP/TFP_61_002/mpu2.c
@@ -0,0 +1,44 @@
+/*
+ * Copyright 2008 Sony Corporation
+ *
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a copy
+ * of this software and associated documentation files (the "Software"), to deal
+ * in the Software without restriction, including without limitation the rights
+ * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+ * copies of the Software, and to permit persons to whom the Software is
+ * furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included in
+ * all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+ * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+ * THE SOFTWARE.
+ */
+
+#include <mars/mars.h>
+#include <mars_task_test.h>
+#include <spu_mfcio.h>
+
+static struct mars_task_id task1_id __attribute__((aligned(16)));
+
+int mars_task_main(const struct mars_task_args *task_args)
+{
+ int ret;
+
+ mfc_get(&task1_id,
+ task_args->type.u64[0],
+ sizeof(struct mars_task_id), 0, 0, 0);
+ mfc_write_tag_mask(1 << 0);
+ mfc_read_tag_status_all();
+
+ ret = mars_task_signal_send(&task1_id);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+
+ return 0;
+}
diff --git a/tests/TFP/TFP_62_001/Makefile b/tests/TFP/TFP_62_001/Makefile
new file mode 100644
index 0000000..432135a
--- /dev/null
+++ b/tests/TFP/TFP_62_001/Makefile
@@ -0,0 +1,28 @@
+#
+# Copyright 2008 Sony Corporation
+#
+#
+# Permission is hereby granted, free of charge, to any person obtaining a copy
+# of this software and associated documentation files (the "Software"), to deal
+# in the Software without restriction, including without limitation the rights
+# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+# copies of the Software, and to permit persons to whom the Software is
+# furnished to do so, subject to the following conditions:
+#
+# The above copyright notice and this permission notice shall be included in
+# all copies or substantial portions of the Software.
+#
+# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+# THE SOFTWARE.
+#
+
+top_srcdir = ../..
+test_objs = host.o mpu.task_eo
+
+include $(top_srcdir)/scripts/config.mk
+include $(top_srcdir)/scripts/rules_item.mk
diff --git a/tests/TFP/TFP_62_001/host.c b/tests/TFP/TFP_62_001/host.c
new file mode 100644
index 0000000..d1feeb7
--- /dev/null
+++ b/tests/TFP/TFP_62_001/host.c
@@ -0,0 +1,76 @@
+/*
+ * Copyright 2008 Sony Corporation
+ *
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a copy
+ * of this software and associated documentation files (the "Software"), to deal
+ * in the Software without restriction, including without limitation the rights
+ * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+ * copies of the Software, and to permit persons to whom the Software is
+ * furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included in
+ * all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+ * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+ * THE SOFTWARE.
+ */
+
+#include <unistd.h>
+#include <mars/mars.h>
+#include <libspe2.h>
+#include <mars_test.h>
+
+#define WAIT_SEC 1
+
+extern spe_program_handle_t mpu_prog;
+
+static struct mars_context *mars_ctx;
+static struct mars_task_id task_id;
+static struct mars_task_args task_args;
+static uint32_t notify[32] __attribute__((aligned(128)));
+
+int main(void)
+{
+ int ret;
+ int32_t exit_code;
+
+ ret = mars_context_create(&mars_ctx, 0, 0);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+
+ notify[0] = 0;
+ ret = mars_task_create(mars_ctx, &task_id, NULL,
+ mpu_prog.elf_image, MARS_TASK_CONTEXT_SAVE_ALL);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+
+ task_args.type.u64[0] = mars_ptr_to_ea(&notify);
+ ret = mars_task_schedule(&task_id, &task_args, 0);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+
+ sleep(WAIT_SEC);
+
+ /* send signal before wait */
+ ret = mars_task_signal_send(&task_id);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+
+ /* release wait in mpu task */
+ mars_test_counter_set(&notify[0], 1);
+
+ ret = mars_task_wait(&task_id, &exit_code);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+ MARS_TEST_ASSERT_ERROR(exit_code, MARS_SUCCESS);
+
+ ret = mars_task_destroy(&task_id);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+
+ ret = mars_context_destroy(mars_ctx);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+
+ return 0;
+}
+
diff --git a/tests/TFP/TFP_62_001/mpu.c b/tests/TFP/TFP_62_001/mpu.c
new file mode 100644
index 0000000..6b5df7b
--- /dev/null
+++ b/tests/TFP/TFP_62_001/mpu.c
@@ -0,0 +1,40 @@
+/*
+ * Copyright 2008 Sony Corporation
+ *
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a copy
+ * of this software and associated documentation files (the "Software"), to deal
+ * in the Software without restriction, including without limitation the rights
+ * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+ * copies of the Software, and to permit persons to whom the Software is
+ * furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included in
+ * all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+ * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+ * THE SOFTWARE.
+ */
+
+#include <mars/mars.h>
+#include <mars_task_test.h>
+#include <spu_mfcio.h>
+
+
+int mars_task_main(const struct mars_task_args *task_args)
+{
+ int ret;
+ uint64_t notify_ea = task_args->type.u64[0];
+
+ mars_test_counter_wait(notify_ea, 1);
+
+ ret = mars_task_signal_wait();
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+
+ return 0;
+}
diff --git a/tests/TFP/TFP_62_002/Makefile b/tests/TFP/TFP_62_002/Makefile
new file mode 100644
index 0000000..ecbce33
--- /dev/null
+++ b/tests/TFP/TFP_62_002/Makefile
@@ -0,0 +1,28 @@
+#
+# Copyright 2008 Sony Corporation
+#
+#
+# Permission is hereby granted, free of charge, to any person obtaining a copy
+# of this software and associated documentation files (the "Software"), to deal
+# in the Software without restriction, including without limitation the rights
+# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+# copies of the Software, and to permit persons to whom the Software is
+# furnished to do so, subject to the following conditions:
+#
+# The above copyright notice and this permission notice shall be included in
+# all copies or substantial portions of the Software.
+#
+# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+# THE SOFTWARE.
+#
+
+top_srcdir = ../..
+test_objs = host.o mpu1.task_eo mpu2.task_eo
+
+include $(top_srcdir)/scripts/config.mk
+include $(top_srcdir)/scripts/rules_item.mk
diff --git a/tests/TFP/TFP_62_002/host.c b/tests/TFP/TFP_62_002/host.c
new file mode 100644
index 0000000..a9c77f1
--- /dev/null
+++ b/tests/TFP/TFP_62_002/host.c
@@ -0,0 +1,85 @@
+/*
+ * Copyright 2008 Sony Corporation
+ *
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a copy
+ * of this software and associated documentation files (the "Software"), to deal
+ * in the Software without restriction, including without limitation the rights
+ * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+ * copies of the Software, and to permit persons to whom the Software is
+ * furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included in
+ * all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+ * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+ * THE SOFTWARE.
+ */
+
+#include <unistd.h>
+#include <mars/mars.h>
+#include <libspe2.h>
+#include <mars_test.h>
+
+#define WAIT_SEC 1
+
+extern spe_program_handle_t mpu1_prog;
+extern spe_program_handle_t mpu2_prog;
+
+static struct mars_context *mars_ctx;
+static struct mars_task_id task1_id __attribute__((aligned(16)));
+static struct mars_task_id task2_id __attribute__((aligned(16)));
+static struct mars_task_args task_args;
+static uint32_t notify[32] __attribute__((aligned(128)));
+
+int main(void)
+{
+ int ret;
+ int32_t exit_code;
+
+ ret = mars_context_create(&mars_ctx, 0, 0);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+
+ notify[0] = 0;
+ ret = mars_task_create(mars_ctx, &task1_id, NULL,
+ mpu1_prog.elf_image, MARS_TASK_CONTEXT_SAVE_ALL);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+
+ ret = mars_task_create(mars_ctx, &task2_id, NULL,
+ mpu2_prog.elf_image, MARS_TASK_CONTEXT_SAVE_ALL);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+
+ task_args.type.u64[0] = mars_ptr_to_ea(&notify);
+ ret = mars_task_schedule(&task1_id, &task_args, 0);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+
+ task_args.type.u64[0] = mars_ptr_to_ea(&notify);
+ task_args.type.u64[1] = mars_ptr_to_ea(&task1_id);
+ ret = mars_task_schedule(&task2_id, &task_args, 0);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+
+ ret = mars_task_wait(&task1_id, &exit_code);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+ MARS_TEST_ASSERT_ERROR(exit_code, MARS_SUCCESS);
+
+ ret = mars_task_wait(&task2_id, &exit_code);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+ MARS_TEST_ASSERT_ERROR(exit_code, MARS_SUCCESS);
+
+ ret = mars_task_destroy(&task1_id);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+
+ ret = mars_task_destroy(&task2_id);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+
+ ret = mars_context_destroy(mars_ctx);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+
+ return 0;
+}
+
diff --git a/tests/TFP/TFP_62_002/mpu1.c b/tests/TFP/TFP_62_002/mpu1.c
new file mode 100644
index 0000000..3ac81df
--- /dev/null
+++ b/tests/TFP/TFP_62_002/mpu1.c
@@ -0,0 +1,39 @@
+/*
+ * Copyright 2008 Sony Corporation
+ *
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a copy
+ * of this software and associated documentation files (the "Software"), to deal
+ * in the Software without restriction, including without limitation the rights
+ * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+ * copies of the Software, and to permit persons to whom the Software is
+ * furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included in
+ * all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+ * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+ * THE SOFTWARE.
+ */
+
+#include <mars/mars.h>
+#include <mars_task_test.h>
+#include <spu_mfcio.h>
+
+int mars_task_main(const struct mars_task_args *task_args)
+{
+ int ret;
+ uint64_t notify_ea = task_args->type.u64[0];
+
+ mars_test_counter_wait(notify_ea, 1);
+
+ ret = mars_task_signal_wait();
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+
+ return 0;
+}
diff --git a/tests/TFP/TFP_62_002/mpu2.c b/tests/TFP/TFP_62_002/mpu2.c
new file mode 100644
index 0000000..f1282fd
--- /dev/null
+++ b/tests/TFP/TFP_62_002/mpu2.c
@@ -0,0 +1,47 @@
+/*
+ * Copyright 2008 Sony Corporation
+ *
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a copy
+ * of this software and associated documentation files (the "Software"), to deal
+ * in the Software without restriction, including without limitation the rights
+ * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+ * copies of the Software, and to permit persons to whom the Software is
+ * furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included in
+ * all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+ * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+ * THE SOFTWARE.
+ */
+
+#include <mars/mars.h>
+#include <mars_task_test.h>
+#include <spu_mfcio.h>
+
+static struct mars_task_id task1_id __attribute__((aligned(16)));
+
+int mars_task_main(const struct mars_task_args *task_args)
+{
+ int ret;
+ uint64_t notify_ea = task_args->type.u64[0];
+
+ mfc_get(&task1_id,
+ task_args->type.u64[1],
+ sizeof(struct mars_task_id), 0, 0, 0);
+ mfc_write_tag_mask(1 << 0);
+ mfc_read_tag_status_all();
+
+ ret = mars_task_signal_send(&task1_id);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+
+ mars_test_counter_set(notify_ea, 1);
+
+ return 0;
+}
diff --git a/tests/TFP/TFP_63_001/Makefile b/tests/TFP/TFP_63_001/Makefile
new file mode 100644
index 0000000..432135a
--- /dev/null
+++ b/tests/TFP/TFP_63_001/Makefile
@@ -0,0 +1,28 @@
+#
+# Copyright 2008 Sony Corporation
+#
+#
+# Permission is hereby granted, free of charge, to any person obtaining a copy
+# of this software and associated documentation files (the "Software"), to deal
+# in the Software without restriction, including without limitation the rights
+# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+# copies of the Software, and to permit persons to whom the Software is
+# furnished to do so, subject to the following conditions:
+#
+# The above copyright notice and this permission notice shall be included in
+# all copies or substantial portions of the Software.
+#
+# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+# THE SOFTWARE.
+#
+
+top_srcdir = ../..
+test_objs = host.o mpu.task_eo
+
+include $(top_srcdir)/scripts/config.mk
+include $(top_srcdir)/scripts/rules_item.mk
diff --git a/tests/TFP/TFP_63_001/host.c b/tests/TFP/TFP_63_001/host.c
new file mode 100644
index 0000000..d1feeb7
--- /dev/null
+++ b/tests/TFP/TFP_63_001/host.c
@@ -0,0 +1,76 @@
+/*
+ * Copyright 2008 Sony Corporation
+ *
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a copy
+ * of this software and associated documentation files (the "Software"), to deal
+ * in the Software without restriction, including without limitation the rights
+ * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+ * copies of the Software, and to permit persons to whom the Software is
+ * furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included in
+ * all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+ * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+ * THE SOFTWARE.
+ */
+
+#include <unistd.h>
+#include <mars/mars.h>
+#include <libspe2.h>
+#include <mars_test.h>
+
+#define WAIT_SEC 1
+
+extern spe_program_handle_t mpu_prog;
+
+static struct mars_context *mars_ctx;
+static struct mars_task_id task_id;
+static struct mars_task_args task_args;
+static uint32_t notify[32] __attribute__((aligned(128)));
+
+int main(void)
+{
+ int ret;
+ int32_t exit_code;
+
+ ret = mars_context_create(&mars_ctx, 0, 0);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+
+ notify[0] = 0;
+ ret = mars_task_create(mars_ctx, &task_id, NULL,
+ mpu_prog.elf_image, MARS_TASK_CONTEXT_SAVE_ALL);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+
+ task_args.type.u64[0] = mars_ptr_to_ea(&notify);
+ ret = mars_task_schedule(&task_id, &task_args, 0);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+
+ sleep(WAIT_SEC);
+
+ /* send signal before wait */
+ ret = mars_task_signal_send(&task_id);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+
+ /* release wait in mpu task */
+ mars_test_counter_set(&notify[0], 1);
+
+ ret = mars_task_wait(&task_id, &exit_code);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+ MARS_TEST_ASSERT_ERROR(exit_code, MARS_SUCCESS);
+
+ ret = mars_task_destroy(&task_id);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+
+ ret = mars_context_destroy(mars_ctx);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+
+ return 0;
+}
+
diff --git a/tests/TFP/TFP_63_001/mpu.c b/tests/TFP/TFP_63_001/mpu.c
new file mode 100644
index 0000000..d424acd
--- /dev/null
+++ b/tests/TFP/TFP_63_001/mpu.c
@@ -0,0 +1,40 @@
+/*
+ * Copyright 2008 Sony Corporation
+ *
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a copy
+ * of this software and associated documentation files (the "Software"), to deal
+ * in the Software without restriction, including without limitation the rights
+ * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+ * copies of the Software, and to permit persons to whom the Software is
+ * furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included in
+ * all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+ * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+ * THE SOFTWARE.
+ */
+
+#include <mars/mars.h>
+#include <mars_task_test.h>
+#include <spu_mfcio.h>
+
+
+int mars_task_main(const struct mars_task_args *task_args)
+{
+ int ret;
+ uint64_t notify_ea = task_args->type.u64[0];
+
+ mars_test_counter_wait(notify_ea, 1);
+
+ ret = mars_task_signal_try_wait();
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+
+ return 0;
+}
diff --git a/tests/TFP/TFP_63_002/Makefile b/tests/TFP/TFP_63_002/Makefile
new file mode 100644
index 0000000..ecbce33
--- /dev/null
+++ b/tests/TFP/TFP_63_002/Makefile
@@ -0,0 +1,28 @@
+#
+# Copyright 2008 Sony Corporation
+#
+#
+# Permission is hereby granted, free of charge, to any person obtaining a copy
+# of this software and associated documentation files (the "Software"), to deal
+# in the Software without restriction, including without limitation the rights
+# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+# copies of the Software, and to permit persons to whom the Software is
+# furnished to do so, subject to the following conditions:
+#
+# The above copyright notice and this permission notice shall be included in
+# all copies or substantial portions of the Software.
+#
+# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+# THE SOFTWARE.
+#
+
+top_srcdir = ../..
+test_objs = host.o mpu1.task_eo mpu2.task_eo
+
+include $(top_srcdir)/scripts/config.mk
+include $(top_srcdir)/scripts/rules_item.mk
diff --git a/tests/TFP/TFP_63_002/host.c b/tests/TFP/TFP_63_002/host.c
new file mode 100644
index 0000000..a9c77f1
--- /dev/null
+++ b/tests/TFP/TFP_63_002/host.c
@@ -0,0 +1,85 @@
+/*
+ * Copyright 2008 Sony Corporation
+ *
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a copy
+ * of this software and associated documentation files (the "Software"), to deal
+ * in the Software without restriction, including without limitation the rights
+ * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+ * copies of the Software, and to permit persons to whom the Software is
+ * furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included in
+ * all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+ * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+ * THE SOFTWARE.
+ */
+
+#include <unistd.h>
+#include <mars/mars.h>
+#include <libspe2.h>
+#include <mars_test.h>
+
+#define WAIT_SEC 1
+
+extern spe_program_handle_t mpu1_prog;
+extern spe_program_handle_t mpu2_prog;
+
+static struct mars_context *mars_ctx;
+static struct mars_task_id task1_id __attribute__((aligned(16)));
+static struct mars_task_id task2_id __attribute__((aligned(16)));
+static struct mars_task_args task_args;
+static uint32_t notify[32] __attribute__((aligned(128)));
+
+int main(void)
+{
+ int ret;
+ int32_t exit_code;
+
+ ret = mars_context_create(&mars_ctx, 0, 0);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+
+ notify[0] = 0;
+ ret = mars_task_create(mars_ctx, &task1_id, NULL,
+ mpu1_prog.elf_image, MARS_TASK_CONTEXT_SAVE_ALL);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+
+ ret = mars_task_create(mars_ctx, &task2_id, NULL,
+ mpu2_prog.elf_image, MARS_TASK_CONTEXT_SAVE_ALL);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+
+ task_args.type.u64[0] = mars_ptr_to_ea(&notify);
+ ret = mars_task_schedule(&task1_id, &task_args, 0);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+
+ task_args.type.u64[0] = mars_ptr_to_ea(&notify);
+ task_args.type.u64[1] = mars_ptr_to_ea(&task1_id);
+ ret = mars_task_schedule(&task2_id, &task_args, 0);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+
+ ret = mars_task_wait(&task1_id, &exit_code);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+ MARS_TEST_ASSERT_ERROR(exit_code, MARS_SUCCESS);
+
+ ret = mars_task_wait(&task2_id, &exit_code);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+ MARS_TEST_ASSERT_ERROR(exit_code, MARS_SUCCESS);
+
+ ret = mars_task_destroy(&task1_id);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+
+ ret = mars_task_destroy(&task2_id);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+
+ ret = mars_context_destroy(mars_ctx);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+
+ return 0;
+}
+
diff --git a/tests/TFP/TFP_63_002/mpu1.c b/tests/TFP/TFP_63_002/mpu1.c
new file mode 100644
index 0000000..d424acd
--- /dev/null
+++ b/tests/TFP/TFP_63_002/mpu1.c
@@ -0,0 +1,40 @@
+/*
+ * Copyright 2008 Sony Corporation
+ *
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a copy
+ * of this software and associated documentation files (the "Software"), to deal
+ * in the Software without restriction, including without limitation the rights
+ * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+ * copies of the Software, and to permit persons to whom the Software is
+ * furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included in
+ * all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+ * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+ * THE SOFTWARE.
+ */
+
+#include <mars/mars.h>
+#include <mars_task_test.h>
+#include <spu_mfcio.h>
+
+
+int mars_task_main(const struct mars_task_args *task_args)
+{
+ int ret;
+ uint64_t notify_ea = task_args->type.u64[0];
+
+ mars_test_counter_wait(notify_ea, 1);
+
+ ret = mars_task_signal_try_wait();
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+
+ return 0;
+}
diff --git a/tests/TFP/TFP_63_002/mpu2.c b/tests/TFP/TFP_63_002/mpu2.c
new file mode 100644
index 0000000..f1282fd
--- /dev/null
+++ b/tests/TFP/TFP_63_002/mpu2.c
@@ -0,0 +1,47 @@
+/*
+ * Copyright 2008 Sony Corporation
+ *
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a copy
+ * of this software and associated documentation files (the "Software"), to deal
+ * in the Software without restriction, including without limitation the rights
+ * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+ * copies of the Software, and to permit persons to whom the Software is
+ * furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included in
+ * all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+ * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+ * THE SOFTWARE.
+ */
+
+#include <mars/mars.h>
+#include <mars_task_test.h>
+#include <spu_mfcio.h>
+
+static struct mars_task_id task1_id __attribute__((aligned(16)));
+
+int mars_task_main(const struct mars_task_args *task_args)
+{
+ int ret;
+ uint64_t notify_ea = task_args->type.u64[0];
+
+ mfc_get(&task1_id,
+ task_args->type.u64[1],
+ sizeof(struct mars_task_id), 0, 0, 0);
+ mfc_write_tag_mask(1 << 0);
+ mfc_read_tag_status_all();
+
+ ret = mars_task_signal_send(&task1_id);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+
+ mars_test_counter_set(notify_ea, 1);
+
+ return 0;
+}
diff --git a/tests/TFP/TFP_63_003/Makefile b/tests/TFP/TFP_63_003/Makefile
new file mode 100644
index 0000000..432135a
--- /dev/null
+++ b/tests/TFP/TFP_63_003/Makefile
@@ -0,0 +1,28 @@
+#
+# Copyright 2008 Sony Corporation
+#
+#
+# Permission is hereby granted, free of charge, to any person obtaining a copy
+# of this software and associated documentation files (the "Software"), to deal
+# in the Software without restriction, including without limitation the rights
+# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+# copies of the Software, and to permit persons to whom the Software is
+# furnished to do so, subject to the following conditions:
+#
+# The above copyright notice and this permission notice shall be included in
+# all copies or substantial portions of the Software.
+#
+# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+# THE SOFTWARE.
+#
+
+top_srcdir = ../..
+test_objs = host.o mpu.task_eo
+
+include $(top_srcdir)/scripts/config.mk
+include $(top_srcdir)/scripts/rules_item.mk
diff --git a/tests/TFP/TFP_63_003/host.c b/tests/TFP/TFP_63_003/host.c
new file mode 100644
index 0000000..bf5a633
--- /dev/null
+++ b/tests/TFP/TFP_63_003/host.c
@@ -0,0 +1,76 @@
+/*
+ * Copyright 2008 Sony Corporation
+ *
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a copy
+ * of this software and associated documentation files (the "Software"), to deal
+ * in the Software without restriction, including without limitation the rights
+ * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+ * copies of the Software, and to permit persons to whom the Software is
+ * furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included in
+ * all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+ * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+ * THE SOFTWARE.
+ */
+
+#include <unistd.h>
+#include <mars/mars.h>
+#include <libspe2.h>
+#include <mars_test.h>
+
+#define WAIT_SEC 1
+
+extern spe_program_handle_t mpu_prog;
+
+static struct mars_context *mars_ctx;
+static struct mars_task_id task_id;
+static struct mars_task_args task_args;
+static uint32_t notify[32] __attribute__((aligned(128)));
+
+int main(void)
+{
+ int ret;
+ int32_t exit_code;
+
+ ret = mars_context_create(&mars_ctx, 0, 0);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+
+ notify[0] = 0;
+ ret = mars_task_create(mars_ctx, &task_id, NULL,
+ mpu_prog.elf_image, MARS_TASK_CONTEXT_SAVE_ALL);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+
+ task_args.type.u64[0] = mars_ptr_to_ea(&notify);
+ ret = mars_task_schedule(&task_id, &task_args, 0);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+
+ sleep(WAIT_SEC);
+
+ /* send No signal */
+ /* ret = mars_task_signal_send(&task_id); */
+ /* MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS); */
+
+ /* release wait in mpu task */
+ mars_test_counter_set(&notify[0], 1);
+
+ ret = mars_task_wait(&task_id, &exit_code);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+ MARS_TEST_ASSERT_ERROR(exit_code, MARS_SUCCESS);
+
+ ret = mars_task_destroy(&task_id);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+
+ ret = mars_context_destroy(mars_ctx);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+
+ return 0;
+}
+
diff --git a/tests/TFP/TFP_63_003/mpu.c b/tests/TFP/TFP_63_003/mpu.c
new file mode 100644
index 0000000..b0140fe
--- /dev/null
+++ b/tests/TFP/TFP_63_003/mpu.c
@@ -0,0 +1,39 @@
+/*
+ * Copyright 2008 Sony Corporation
+ *
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a copy
+ * of this software and associated documentation files (the "Software"), to deal
+ * in the Software without restriction, including without limitation the rights
+ * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+ * copies of the Software, and to permit persons to whom the Software is
+ * furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included in
+ * all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+ * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+ * THE SOFTWARE.
+ */
+
+#include <mars/mars.h>
+#include <mars_task_test.h>
+#include <spu_mfcio.h>
+
+int mars_task_main(const struct mars_task_args *task_args)
+{
+ int ret;
+ uint64_t notify_ea = task_args->type.u64[0];
+
+ mars_test_counter_wait(notify_ea, 1);
+
+ ret = mars_task_signal_try_wait();
+ MARS_TEST_ASSERT_ERROR(ret, MARS_ERROR_BUSY);
+
+ return 0;
+}
diff --git a/tests/TFP/TFP_71_001/Makefile b/tests/TFP/TFP_71_001/Makefile
new file mode 100644
index 0000000..43ba573
--- /dev/null
+++ b/tests/TFP/TFP_71_001/Makefile
@@ -0,0 +1,28 @@
+#
+# Copyright 2008 Sony Corporation
+#
+#
+# Permission is hereby granted, free of charge, to any person obtaining a copy
+# of this software and associated documentation files (the "Software"), to deal
+# in the Software without restriction, including without limitation the rights
+# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+# copies of the Software, and to permit persons to whom the Software is
+# furnished to do so, subject to the following conditions:
+#
+# The above copyright notice and this permission notice shall be included in
+# all copies or substantial portions of the Software.
+#
+# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+# THE SOFTWARE.
+#
+
+top_srcdir = ../..
+test_objs = host.o
+
+include $(top_srcdir)/scripts/config.mk
+include $(top_srcdir)/scripts/rules_item.mk
diff --git a/tests/TFP/TFP_71_001/host.c b/tests/TFP/TFP_71_001/host.c
new file mode 100644
index 0000000..d28a199
--- /dev/null
+++ b/tests/TFP/TFP_71_001/host.c
@@ -0,0 +1,42 @@
+/*
+ * Copyright (C) 2008 Sony Computer Entertainment Inc.
+ *
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a copy
+ * of this software and associated documentation files (the "Software"), to deal
+ * in the Software without restriction, including without limitation the rights
+ * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+ * copies of the Software, and to permit persons to whom the Software is
+ * furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included in
+ * all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+ * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+ * THE SOFTWARE.
+ */
+
+#include <mars/mars.h>
+#include <mars_test.h>
+
+uint64_t mutex;
+
+int main(void)
+{
+ int ret;
+
+ ret = mars_mutex_create(&mutex);
+ MARS_TEST_ASSERT_EQUAL(ret, MARS_SUCCESS);
+
+ ret = mars_mutex_destroy(mutex);
+ MARS_TEST_ASSERT_EQUAL(ret, MARS_SUCCESS);
+
+ return 0;
+}
+
+
diff --git a/tests/TFP/TFP_71_003/Makefile b/tests/TFP/TFP_71_003/Makefile
new file mode 100644
index 0000000..43ba573
--- /dev/null
+++ b/tests/TFP/TFP_71_003/Makefile
@@ -0,0 +1,28 @@
+#
+# Copyright 2008 Sony Corporation
+#
+#
+# Permission is hereby granted, free of charge, to any person obtaining a copy
+# of this software and associated documentation files (the "Software"), to deal
+# in the Software without restriction, including without limitation the rights
+# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+# copies of the Software, and to permit persons to whom the Software is
+# furnished to do so, subject to the following conditions:
+#
+# The above copyright notice and this permission notice shall be included in
+# all copies or substantial portions of the Software.
+#
+# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+# THE SOFTWARE.
+#
+
+top_srcdir = ../..
+test_objs = host.o
+
+include $(top_srcdir)/scripts/config.mk
+include $(top_srcdir)/scripts/rules_item.mk
diff --git a/tests/TFP/TFP_71_003/host.c b/tests/TFP/TFP_71_003/host.c
new file mode 100644
index 0000000..60e2528
--- /dev/null
+++ b/tests/TFP/TFP_71_003/host.c
@@ -0,0 +1,74 @@
+/*
+ * Copyright 2008 Sony Corporation
+ *
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a copy
+ * of this software and associated documentation files (the "Software"), to deal
+ * in the Software without restriction, including without limitation the rights
+ * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+ * copies of the Software, and to permit persons to whom the Software is
+ * furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included in
+ * all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+ * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+ * THE SOFTWARE.
+ */
+
+#include <pthread.h>
+#include <unistd.h>
+#include <libspe2.h>
+#include <mars/mars.h>
+#include <mars_test.h>
+
+#define THREAD_COUNT 100
+#define LOOP_COUNT 1000
+
+extern spe_program_handle_t mpu_prog;
+
+static uint64_t mutexes[THREAD_COUNT];
+static pthread_t threads[THREAD_COUNT];
+static int barrier;
+
+void *thread_proc(void *arg)
+{
+ int ret, i;
+
+ while (barrier)
+ usleep(1);
+
+ for (i = 0; i < LOOP_COUNT; i++) {
+ ret = mars_mutex_create(&mutexes[(int)(intptr_t)arg]);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+
+ ret = mars_mutex_destroy(mutexes[(int)(intptr_t)arg]);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+ }
+
+ return NULL;
+}
+
+int main(void)
+{
+ int i;
+
+ barrier = 1;
+
+ for (i = 0; i < THREAD_COUNT; i++)
+ pthread_create(&threads[i], NULL, thread_proc, (void *)(uintptr_t)i);
+
+ sleep(1);
+
+ barrier = 0;
+
+ for (i = 0; i < THREAD_COUNT; i++)
+ pthread_join(threads[i], NULL);
+
+ return 0;
+}
diff --git a/tests/TFP/TFP_74_001/Makefile b/tests/TFP/TFP_74_001/Makefile
new file mode 100644
index 0000000..43ba573
--- /dev/null
+++ b/tests/TFP/TFP_74_001/Makefile
@@ -0,0 +1,28 @@
+#
+# Copyright 2008 Sony Corporation
+#
+#
+# Permission is hereby granted, free of charge, to any person obtaining a copy
+# of this software and associated documentation files (the "Software"), to deal
+# in the Software without restriction, including without limitation the rights
+# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+# copies of the Software, and to permit persons to whom the Software is
+# furnished to do so, subject to the following conditions:
+#
+# The above copyright notice and this permission notice shall be included in
+# all copies or substantial portions of the Software.
+#
+# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+# THE SOFTWARE.
+#
+
+top_srcdir = ../..
+test_objs = host.o
+
+include $(top_srcdir)/scripts/config.mk
+include $(top_srcdir)/scripts/rules_item.mk
diff --git a/tests/TFP/TFP_74_001/host.c b/tests/TFP/TFP_74_001/host.c
new file mode 100644
index 0000000..f057007
--- /dev/null
+++ b/tests/TFP/TFP_74_001/host.c
@@ -0,0 +1,72 @@
+/*
+ * Copyright 2008 Sony Corporation
+ *
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a copy
+ * of this software and associated documentation files (the "Software"), to deal
+ * in the Software without restriction, including without limitation the rights
+ * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+ * copies of the Software, and to permit persons to whom the Software is
+ * furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included in
+ * all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+ * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+ * THE SOFTWARE.
+ */
+
+#include <pthread.h>
+#include <unistd.h>
+#include <libspe2.h>
+#include <mars/mars.h>
+#include <mars_test.h>
+
+#define THREAD_COUNT 16
+
+static uint64_t mutex;
+static pthread_t threads[THREAD_COUNT];
+static int shared_resource;
+
+void *thread_proc(void *arg)
+{
+ int ret;
+
+ ret = mars_mutex_lock(mutex);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+
+ shared_resource = (int)(uintptr_t)arg;
+
+ usleep(100000);
+
+ MARS_TEST_ASSERT(shared_resource == (int)(uintptr_t)arg);
+
+ ret = mars_mutex_unlock(mutex);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+
+ return NULL;
+}
+
+int main(void)
+{
+ int i, ret;
+
+ ret = mars_mutex_create(&mutex);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+
+ for (i = 0; i < THREAD_COUNT; i++)
+ pthread_create(&threads[i], NULL, thread_proc, (void *)(uintptr_t)i);
+
+ for (i = 0; i < THREAD_COUNT; i++)
+ pthread_join(threads[i], NULL);
+
+ ret = mars_mutex_destroy(mutex);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+
+ return 0;
+}
diff --git a/tests/TFP/TFP_74_002/Makefile b/tests/TFP/TFP_74_002/Makefile
new file mode 100644
index 0000000..1be569a
--- /dev/null
+++ b/tests/TFP/TFP_74_002/Makefile
@@ -0,0 +1,28 @@
+#
+# Copyright 2008 Sony Corporation
+#
+#
+# Permission is hereby granted, free of charge, to any person obtaining a copy
+# of this software and associated documentation files (the "Software"), to deal
+# in the Software without restriction, including without limitation the rights
+# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+# copies of the Software, and to permit persons to whom the Software is
+# furnished to do so, subject to the following conditions:
+#
+# The above copyright notice and this permission notice shall be included in
+# all copies or substantial portions of the Software.
+#
+# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+# THE SOFTWARE.
+#
+
+top_srcdir = ../..
+test_objs = host.o mpu.mpu_eo
+
+include $(top_srcdir)/scripts/config.mk
+include $(top_srcdir)/scripts/rules_item.mk
diff --git a/tests/TFP/TFP_74_002/host.c b/tests/TFP/TFP_74_002/host.c
new file mode 100644
index 0000000..060d9cf
--- /dev/null
+++ b/tests/TFP/TFP_74_002/host.c
@@ -0,0 +1,90 @@
+/*
+ * Copyright 2008 Sony Corporation
+ *
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a copy
+ * of this software and associated documentation files (the "Software"), to deal
+ * in the Software without restriction, including without limitation the rights
+ * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+ * copies of the Software, and to permit persons to whom the Software is
+ * furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included in
+ * all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+ * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+ * THE SOFTWARE.
+ */
+
+#include <pthread.h>
+#include <libspe2.h>
+#include <mars/mars.h>
+#include <mars_test.h>
+#include "host_and_mpu.h"
+
+#define MAX_TASK_COUNT 256
+
+extern spe_program_handle_t mpu_prog;
+
+static pthread_t task_threads[MAX_TASK_COUNT];
+static uint64_t mutex;
+static struct TASK_ARGS task_args __attribute__((aligned(16)));
+static uint64_t shared_resource __attribute__((aligned(16)));
+
+void *task_thread_proc(void *arg)
+{
+ int ret;
+ unsigned int entry = SPE_DEFAULT_ENTRY;
+ struct spe_context *spe;
+
+ spe = spe_context_create(0, NULL);
+ MARS_TEST_ASSERT(spe);
+
+ ret = spe_program_load(spe, &mpu_prog);
+ MARS_TEST_ASSERT(ret == 0);
+
+ ret = spe_context_run(spe, &entry, 0, &task_args, NULL, NULL);
+ MARS_TEST_ASSERT(ret == 0);
+
+ ret = spe_context_destroy(spe);
+ MARS_TEST_ASSERT(ret == 0);
+
+ return NULL;
+}
+
+int main(void)
+{
+ int i, ret;
+ uint32_t tb_freq;
+
+ int spe_cnt = spe_cpu_info_get(SPE_COUNT_PHYSICAL_SPES, -1);
+
+ if (spe_cnt > MAX_TASK_COUNT)
+ spe_cnt = MAX_TASK_COUNT;
+
+ ret = mars_test_get_timebase_freq(&tb_freq);
+ MARS_TEST_ASSERT_EQUAL(ret, 0);
+
+ ret = mars_mutex_create(&mutex);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+
+ task_args.mutex_ea = mutex;
+ task_args.shared_resource_ea = mars_ptr_to_ea(&shared_resource);
+ task_args.tb_freq = tb_freq;
+
+ for (i = 0; i < spe_cnt; i++)
+ pthread_create(&task_threads[i], NULL, task_thread_proc, NULL);
+
+ for (i = 0; i < spe_cnt; i++)
+ pthread_join(task_threads[i], NULL);
+
+ ret = mars_mutex_destroy(mutex);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+
+ return 0;
+}
diff --git a/tests/TFP/TFP_74_002/host_and_mpu.h b/tests/TFP/TFP_74_002/host_and_mpu.h
new file mode 100644
index 0000000..5cfdc73
--- /dev/null
+++ b/tests/TFP/TFP_74_002/host_and_mpu.h
@@ -0,0 +1,30 @@
+/*
+ * Copyright 2008 Sony Corporation
+ *
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a copy
+ * of this software and associated documentation files (the "Software"), to deal
+ * in the Software without restriction, including without limitation the rights
+ * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+ * copies of the Software, and to permit persons to whom the Software is
+ * furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included in
+ * all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+ * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+ * THE SOFTWARE.
+ */
+
+struct TASK_ARGS
+{
+ uint64_t mutex_ea;
+ uint64_t shared_resource_ea;
+ uint32_t tb_freq;
+ uint8_t pad[12];
+};
diff --git a/tests/TFP/TFP_74_002/mpu.c b/tests/TFP/TFP_74_002/mpu.c
new file mode 100644
index 0000000..319807a
--- /dev/null
+++ b/tests/TFP/TFP_74_002/mpu.c
@@ -0,0 +1,69 @@
+/*
+ * Copyright 2008 Sony Corporation
+ *
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a copy
+ * of this software and associated documentation files (the "Software"), to deal
+ * in the Software without restriction, including without limitation the rights
+ * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+ * copies of the Software, and to permit persons to whom the Software is
+ * furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included in
+ * all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+ * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+ * THE SOFTWARE.
+ */
+
+#include <spu_mfcio.h>
+#include <mars/mars.h>
+#include <mars_test.h>
+#include "host_and_mpu.h"
+
+static inline void dma_wait(uint32_t tag)
+{
+ mfc_write_tag_mask(1 << tag);
+ mfc_write_tag_update_all();
+ mfc_read_tag_status();
+ mfc_sync(tag);
+}
+
+static inline void dma_get_and_wait(void *ls, uint64_t ea,
+ uint32_t size, uint32_t tag)
+{
+ mfc_get((volatile void *)ls, ea, size, tag, 0, 0);
+ dma_wait(tag);
+}
+
+static struct TASK_ARGS task_args __attribute__((aligned(16)));
+
+int main(unsigned long long spuid, unsigned long long argp, unsigned long long envp)
+{
+ int ret;
+ uint64_t task_args_ea = argp;
+ uint64_t shared_resource;
+
+ dma_get_and_wait(&task_args, task_args_ea, sizeof(task_args), 0);
+
+ ret = mars_mutex_lock(task_args.mutex_ea);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+
+ shared_resource = spuid;
+ mars_test_int64_put(task_args.shared_resource_ea, shared_resource);
+
+ mars_test_usleep(task_args.tb_freq, 100000);
+
+ shared_resource = mars_test_int64_get(task_args.shared_resource_ea);
+ MARS_TEST_ASSERT(shared_resource == spuid);
+
+ ret = mars_mutex_unlock(task_args.mutex_ea);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+
+ return 0;
+}
diff --git a/tests/TFP/TFP_74_003/Makefile b/tests/TFP/TFP_74_003/Makefile
new file mode 100644
index 0000000..1be569a
--- /dev/null
+++ b/tests/TFP/TFP_74_003/Makefile
@@ -0,0 +1,28 @@
+#
+# Copyright 2008 Sony Corporation
+#
+#
+# Permission is hereby granted, free of charge, to any person obtaining a copy
+# of this software and associated documentation files (the "Software"), to deal
+# in the Software without restriction, including without limitation the rights
+# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+# copies of the Software, and to permit persons to whom the Software is
+# furnished to do so, subject to the following conditions:
+#
+# The above copyright notice and this permission notice shall be included in
+# all copies or substantial portions of the Software.
+#
+# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+# THE SOFTWARE.
+#
+
+top_srcdir = ../..
+test_objs = host.o mpu.mpu_eo
+
+include $(top_srcdir)/scripts/config.mk
+include $(top_srcdir)/scripts/rules_item.mk
diff --git a/tests/TFP/TFP_74_003/host.c b/tests/TFP/TFP_74_003/host.c
new file mode 100644
index 0000000..f9c663f
--- /dev/null
+++ b/tests/TFP/TFP_74_003/host.c
@@ -0,0 +1,117 @@
+/*
+ * Copyright 2008 Sony Corporation
+ *
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a copy
+ * of this software and associated documentation files (the "Software"), to deal
+ * in the Software without restriction, including without limitation the rights
+ * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+ * copies of the Software, and to permit persons to whom the Software is
+ * furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included in
+ * all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+ * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+ * THE SOFTWARE.
+ */
+
+#include <pthread.h>
+#include <unistd.h>
+#include <libspe2.h>
+#include <mars/mars.h>
+#include <mars_test.h>
+#include "host_and_mpu.h"
+
+#define THREAD_COUNT 16
+#define MAX_TASK_COUNT 16
+
+extern spe_program_handle_t mpu_prog;
+
+static pthread_t task_threads[MAX_TASK_COUNT], threads[THREAD_COUNT];
+static uint64_t mutex;
+static struct TASK_ARGS task_args __attribute__((aligned(16)));
+static int64_t shared_resource __attribute__((aligned(16)));
+
+void *task_thread_proc(void *arg)
+{
+ int ret;
+ unsigned int entry = SPE_DEFAULT_ENTRY;
+ struct spe_context *spe;
+
+ spe = spe_context_create(0, NULL);
+ MARS_TEST_ASSERT(spe);
+
+ ret = spe_program_load(spe, &mpu_prog);
+ MARS_TEST_ASSERT(ret == 0);
+
+ ret = spe_context_run(spe, &entry, 0, &task_args, NULL, NULL);
+ MARS_TEST_ASSERT(ret == 0);
+
+ ret = spe_context_destroy(spe);
+ MARS_TEST_ASSERT(ret == 0);
+
+ return NULL;
+}
+
+void *thread_proc(void *arg)
+{
+ int ret;
+
+ ret = mars_mutex_lock(mutex);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+
+ shared_resource = (int)(uintptr_t)arg;
+
+ usleep(100000);
+
+ MARS_TEST_ASSERT(shared_resource == (int)(uintptr_t)arg);
+
+ ret = mars_mutex_unlock(mutex);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+
+ return NULL;
+}
+
+int main(void)
+{
+ int i, ret;
+ uint32_t tb_freq;
+
+ int spe_cnt = spe_cpu_info_get(SPE_COUNT_PHYSICAL_SPES, -1);
+
+ if (spe_cnt > MAX_TASK_COUNT)
+ spe_cnt = MAX_TASK_COUNT;
+
+ ret = mars_test_get_timebase_freq(&tb_freq);
+ MARS_TEST_ASSERT_EQUAL(ret, 0);
+
+ ret = mars_mutex_create(&mutex);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+
+ task_args.mutex_ea = mutex;
+ task_args.shared_resource_ea = mars_ptr_to_ea(&shared_resource);
+ task_args.tb_freq = tb_freq;
+
+ for (i = 0; i < spe_cnt; i++)
+ pthread_create(&task_threads[i], NULL, task_thread_proc, NULL);
+
+ for (i = 0; i < THREAD_COUNT; i++)
+ pthread_create(&threads[i], NULL, thread_proc, (void *)(uintptr_t)i);
+
+ for (i = 0; i < THREAD_COUNT; i++)
+ pthread_join(threads[i], NULL);
+
+ for (i = 0; i < spe_cnt; i++)
+ pthread_join(task_threads[i], NULL);
+
+ ret = mars_mutex_destroy(mutex);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+
+ return 0;
+}
diff --git a/tests/TFP/TFP_74_003/host_and_mpu.h b/tests/TFP/TFP_74_003/host_and_mpu.h
new file mode 100644
index 0000000..5cfdc73
--- /dev/null
+++ b/tests/TFP/TFP_74_003/host_and_mpu.h
@@ -0,0 +1,30 @@
+/*
+ * Copyright 2008 Sony Corporation
+ *
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a copy
+ * of this software and associated documentation files (the "Software"), to deal
+ * in the Software without restriction, including without limitation the rights
+ * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+ * copies of the Software, and to permit persons to whom the Software is
+ * furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included in
+ * all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+ * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+ * THE SOFTWARE.
+ */
+
+struct TASK_ARGS
+{
+ uint64_t mutex_ea;
+ uint64_t shared_resource_ea;
+ uint32_t tb_freq;
+ uint8_t pad[12];
+};
diff --git a/tests/TFP/TFP_74_003/mpu.c b/tests/TFP/TFP_74_003/mpu.c
new file mode 100644
index 0000000..319807a
--- /dev/null
+++ b/tests/TFP/TFP_74_003/mpu.c
@@ -0,0 +1,69 @@
+/*
+ * Copyright 2008 Sony Corporation
+ *
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a copy
+ * of this software and associated documentation files (the "Software"), to deal
+ * in the Software without restriction, including without limitation the rights
+ * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+ * copies of the Software, and to permit persons to whom the Software is
+ * furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included in
+ * all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+ * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+ * THE SOFTWARE.
+ */
+
+#include <spu_mfcio.h>
+#include <mars/mars.h>
+#include <mars_test.h>
+#include "host_and_mpu.h"
+
+static inline void dma_wait(uint32_t tag)
+{
+ mfc_write_tag_mask(1 << tag);
+ mfc_write_tag_update_all();
+ mfc_read_tag_status();
+ mfc_sync(tag);
+}
+
+static inline void dma_get_and_wait(void *ls, uint64_t ea,
+ uint32_t size, uint32_t tag)
+{
+ mfc_get((volatile void *)ls, ea, size, tag, 0, 0);
+ dma_wait(tag);
+}
+
+static struct TASK_ARGS task_args __attribute__((aligned(16)));
+
+int main(unsigned long long spuid, unsigned long long argp, unsigned long long envp)
+{
+ int ret;
+ uint64_t task_args_ea = argp;
+ uint64_t shared_resource;
+
+ dma_get_and_wait(&task_args, task_args_ea, sizeof(task_args), 0);
+
+ ret = mars_mutex_lock(task_args.mutex_ea);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+
+ shared_resource = spuid;
+ mars_test_int64_put(task_args.shared_resource_ea, shared_resource);
+
+ mars_test_usleep(task_args.tb_freq, 100000);
+
+ shared_resource = mars_test_int64_get(task_args.shared_resource_ea);
+ MARS_TEST_ASSERT(shared_resource == spuid);
+
+ ret = mars_mutex_unlock(task_args.mutex_ea);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+
+ return 0;
+}
diff --git a/tests/TFP/TFP_75_001/Makefile b/tests/TFP/TFP_75_001/Makefile
new file mode 100644
index 0000000..43ba573
--- /dev/null
+++ b/tests/TFP/TFP_75_001/Makefile
@@ -0,0 +1,28 @@
+#
+# Copyright 2008 Sony Corporation
+#
+#
+# Permission is hereby granted, free of charge, to any person obtaining a copy
+# of this software and associated documentation files (the "Software"), to deal
+# in the Software without restriction, including without limitation the rights
+# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+# copies of the Software, and to permit persons to whom the Software is
+# furnished to do so, subject to the following conditions:
+#
+# The above copyright notice and this permission notice shall be included in
+# all copies or substantial portions of the Software.
+#
+# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+# THE SOFTWARE.
+#
+
+top_srcdir = ../..
+test_objs = host.o
+
+include $(top_srcdir)/scripts/config.mk
+include $(top_srcdir)/scripts/rules_item.mk
diff --git a/tests/TFP/TFP_75_001/host.c b/tests/TFP/TFP_75_001/host.c
new file mode 100644
index 0000000..b71bb20
--- /dev/null
+++ b/tests/TFP/TFP_75_001/host.c
@@ -0,0 +1,80 @@
+/*
+ * Copyright 2008 Sony Corporation
+ *
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a copy
+ * of this software and associated documentation files (the "Software"), to deal
+ * in the Software without restriction, including without limitation the rights
+ * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+ * copies of the Software, and to permit persons to whom the Software is
+ * furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included in
+ * all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+ * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+ * THE SOFTWARE.
+ */
+
+#include <pthread.h>
+#include <unistd.h>
+#include <libspe2.h>
+#include <mars/mars.h>
+#include <mars_test.h>
+
+static uint64_t mutex;
+static pthread_t thread;
+static int locked;
+
+void *thread_proc(void *arg)
+{
+ int ret;
+
+ ret = mars_mutex_lock(mutex);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+
+ sleep(1);
+
+ ret = mars_mutex_unlock(mutex);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+
+ usleep(100000);
+
+ MARS_TEST_ASSERT(locked);
+
+ return NULL;
+}
+
+int main(void)
+{
+ int ret;
+
+ locked = 0;
+
+ ret = mars_mutex_create(&mutex);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+
+ pthread_create(&thread, NULL, thread_proc, NULL);
+
+ usleep(100000);
+
+ ret = mars_mutex_lock(mutex);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+
+ locked = 1;
+
+ ret = mars_mutex_unlock(mutex);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+
+ pthread_join(thread, NULL);
+
+ ret = mars_mutex_destroy(mutex);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+
+ return 0;
+}
diff --git a/tests/TFP/TFP_75_002/Makefile b/tests/TFP/TFP_75_002/Makefile
new file mode 100644
index 0000000..26b330c
--- /dev/null
+++ b/tests/TFP/TFP_75_002/Makefile
@@ -0,0 +1,32 @@
+#
+# Copyright 2008 Sony Corporation
+#
+#
+# Permission is hereby granted, free of charge, to any person obtaining a copy
+# of this software and associated documentation files (the "Software"), to deal
+# in the Software without restriction, including without limitation the rights
+# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+# copies of the Software, and to permit persons to whom the Software is
+# furnished to do so, subject to the following conditions:
+#
+# The above copyright notice and this permission notice shall be included in
+# all copies or substantial portions of the Software.
+#
+# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+# THE SOFTWARE.
+#
+
+top_srcdir = ../..
+test_objs = host.o mpu1.mpu_eo mpu2.mpu_eo
+
+include $(top_srcdir)/scripts/config.mk
+include $(top_srcdir)/scripts/rules_item.mk
+
+host.o: host_and_mpu.h
+mpu1.mpu_o: host_and_mpu.h
+mpu2.mpu_o: host_and_mpu.h
diff --git a/tests/TFP/TFP_75_002/host.c b/tests/TFP/TFP_75_002/host.c
new file mode 100644
index 0000000..1f3c9f6
--- /dev/null
+++ b/tests/TFP/TFP_75_002/host.c
@@ -0,0 +1,88 @@
+/*
+ * Copyright 2008 Sony Corporation
+ *
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a copy
+ * of this software and associated documentation files (the "Software"), to deal
+ * in the Software without restriction, including without limitation the rights
+ * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+ * copies of the Software, and to permit persons to whom the Software is
+ * furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included in
+ * all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+ * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+ * THE SOFTWARE.
+ */
+
+#include <pthread.h>
+#include <unistd.h>
+#include <libspe2.h>
+#include <mars/mars.h>
+#include <mars_test.h>
+#include "host_and_mpu.h"
+
+extern spe_program_handle_t mpu1_prog, mpu2_prog;
+
+static pthread_t task_1_thread, task_2_thread;
+static struct TASK_ARGS task_args;
+static uint64_t mutex;
+static uint32_t locked __attribute__((aligned(16)));
+
+void *task_thread_proc(void *arg)
+{
+ int ret;
+ unsigned int entry = SPE_DEFAULT_ENTRY;
+ struct spe_context *spe;
+
+ spe = spe_context_create(0, NULL);
+ MARS_TEST_ASSERT(spe);
+
+ ret = spe_program_load(spe, (spe_program_handle_t *)arg);
+ MARS_TEST_ASSERT(ret == 0);
+
+ ret = spe_context_run(spe, &entry, 0, &task_args, NULL, NULL);
+ MARS_TEST_ASSERT(ret == 0);
+
+ ret = spe_context_destroy(spe);
+ MARS_TEST_ASSERT(ret == 0);
+
+ return NULL;
+}
+
+int main(void)
+{
+ int ret;
+ uint32_t tb_freq;
+
+ ret = mars_test_get_timebase_freq(&tb_freq);
+ MARS_TEST_ASSERT_EQUAL(ret, 0);
+
+ ret = mars_mutex_create(&mutex);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+
+ task_args.mutex_ea = mutex;
+ task_args.locked_ea = mars_ptr_to_ea(&locked);
+ task_args.tb_freq = tb_freq;
+
+ pthread_create(&task_1_thread, NULL, task_thread_proc, &mpu1_prog);
+
+ usleep(100000);
+
+ pthread_create(&task_2_thread, NULL, task_thread_proc, &mpu2_prog);
+
+ pthread_join(task_1_thread, NULL);
+
+ pthread_join(task_2_thread, NULL);
+
+ ret = mars_mutex_destroy(mutex);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+
+ return 0;
+}
diff --git a/tests/TFP/TFP_75_002/host_and_mpu.h b/tests/TFP/TFP_75_002/host_and_mpu.h
new file mode 100644
index 0000000..05c3fd2
--- /dev/null
+++ b/tests/TFP/TFP_75_002/host_and_mpu.h
@@ -0,0 +1,29 @@
+/*
+ * Copyright 2008 Sony Corporation
+ *
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a copy
+ * of this software and associated documentation files (the "Software"), to deal
+ * in the Software without restriction, including without limitation the rights
+ * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+ * copies of the Software, and to permit persons to whom the Software is
+ * furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included in
+ * all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+ * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+ * THE SOFTWARE.
+ */
+
+struct TASK_ARGS {
+ uint64_t mutex_ea;
+ uint64_t locked_ea;
+ uint32_t tb_freq;
+ uint8_t pad[12];
+} __attribute__((aligned(16)));
diff --git a/tests/TFP/TFP_75_002/mpu1.c b/tests/TFP/TFP_75_002/mpu1.c
new file mode 100644
index 0000000..d35ae41
--- /dev/null
+++ b/tests/TFP/TFP_75_002/mpu1.c
@@ -0,0 +1,72 @@
+/*
+ * Copyright 2008 Sony Corporation
+ *
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a copy
+ * of this software and associated documentation files (the "Software"), to deal
+ * in the Software without restriction, including without limitation the rights
+ * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+ * copies of the Software, and to permit persons to whom the Software is
+ * furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included in
+ * all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+ * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+ * THE SOFTWARE.
+ */
+
+#include <spu_mfcio.h>
+#include <mars/mars.h>
+#include <mars_test.h>
+#include "host_and_mpu.h"
+
+static inline void dma_wait(uint32_t tag)
+{
+ mfc_write_tag_mask(1 << tag);
+ mfc_write_tag_update_all();
+ mfc_read_tag_status();
+ mfc_sync(tag);
+}
+
+static inline void dma_get_and_wait(void *ls, uint64_t ea,
+ uint32_t size, uint32_t tag)
+{
+ mfc_get((volatile void *)ls, ea, size, tag, 0, 0);
+ dma_wait(tag);
+}
+
+static struct TASK_ARGS task_args;
+
+int main(unsigned long long spuid,
+ unsigned long long argp,
+ unsigned long long envp)
+{
+ int ret;
+ uint32_t locked;
+ uint64_t task_args_ea = argp;
+
+ dma_get_and_wait(&task_args, task_args_ea, sizeof(task_args), 0);
+
+ spu_write_decrementer(UINT32_MAX);
+
+ ret = mars_mutex_lock(task_args.mutex_ea);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+
+ mars_test_sleep(task_args.tb_freq, 1);
+
+ ret = mars_mutex_unlock(task_args.mutex_ea);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+
+ mars_test_usleep(task_args.tb_freq, 100000);
+
+ locked = mars_test_int32_get(task_args.locked_ea);
+ MARS_TEST_ASSERT_EQUAL(locked, 1);
+
+ return 0;
+}
diff --git a/tests/TFP/TFP_75_002/mpu2.c b/tests/TFP/TFP_75_002/mpu2.c
new file mode 100644
index 0000000..a270d0f
--- /dev/null
+++ b/tests/TFP/TFP_75_002/mpu2.c
@@ -0,0 +1,64 @@
+/*
+ * Copyright 2008 Sony Corporation
+ *
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a copy
+ * of this software and associated documentation files (the "Software"), to deal
+ * in the Software without restriction, including without limitation the rights
+ * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+ * copies of the Software, and to permit persons to whom the Software is
+ * furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included in
+ * all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+ * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+ * THE SOFTWARE.
+ */
+
+#include <spu_mfcio.h>
+#include <mars/mars.h>
+#include <mars_test.h>
+#include "host_and_mpu.h"
+
+static inline void dma_wait(uint32_t tag)
+{
+ mfc_write_tag_mask(1 << tag);
+ mfc_write_tag_update_all();
+ mfc_read_tag_status();
+ mfc_sync(tag);
+}
+
+static inline void dma_get_and_wait(void *ls, uint64_t ea,
+ uint32_t size, uint32_t tag)
+{
+ mfc_get((volatile void *)ls, ea, size, tag, 0, 0);
+ dma_wait(tag);
+}
+
+static struct TASK_ARGS task_args;
+
+int main(unsigned long long spuid,
+ unsigned long long argp,
+ unsigned long long envp)
+{
+ int ret;
+ uint64_t task_args_ea = argp;
+
+ dma_get_and_wait(&task_args, task_args_ea, sizeof(task_args), 0);
+
+ ret = mars_mutex_lock(task_args.mutex_ea);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+
+ mars_test_int32_put(task_args.locked_ea, 1);
+
+ ret = mars_mutex_unlock(task_args.mutex_ea);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+
+ return 0;
+}
diff --git a/tests/TFP/TFP_75_003/Makefile b/tests/TFP/TFP_75_003/Makefile
new file mode 100644
index 0000000..1be569a
--- /dev/null
+++ b/tests/TFP/TFP_75_003/Makefile
@@ -0,0 +1,28 @@
+#
+# Copyright 2008 Sony Corporation
+#
+#
+# Permission is hereby granted, free of charge, to any person obtaining a copy
+# of this software and associated documentation files (the "Software"), to deal
+# in the Software without restriction, including without limitation the rights
+# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+# copies of the Software, and to permit persons to whom the Software is
+# furnished to do so, subject to the following conditions:
+#
+# The above copyright notice and this permission notice shall be included in
+# all copies or substantial portions of the Software.
+#
+# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+# THE SOFTWARE.
+#
+
+top_srcdir = ../..
+test_objs = host.o mpu.mpu_eo
+
+include $(top_srcdir)/scripts/config.mk
+include $(top_srcdir)/scripts/rules_item.mk
diff --git a/tests/TFP/TFP_75_003/host.c b/tests/TFP/TFP_75_003/host.c
new file mode 100644
index 0000000..03d8ae8
--- /dev/null
+++ b/tests/TFP/TFP_75_003/host.c
@@ -0,0 +1,91 @@
+/*
+ * Copyright 2008 Sony Corporation
+ *
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a copy
+ * of this software and associated documentation files (the "Software"), to deal
+ * in the Software without restriction, including without limitation the rights
+ * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+ * copies of the Software, and to permit persons to whom the Software is
+ * furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included in
+ * all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+ * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+ * THE SOFTWARE.
+ */
+
+#include <pthread.h>
+#include <unistd.h>
+#include <libspe2.h>
+#include <mars/mars.h>
+#include <mars_test.h>
+
+#define TASK_COUNT 16
+
+extern spe_program_handle_t mpu_prog;
+
+static pthread_t task_threads[TASK_COUNT];
+static uint64_t mutex;
+static int32_t lock_counter __attribute__((aligned(16)));
+
+void *task_thread_proc(void *arg)
+{
+ int ret;
+ unsigned int entry = SPE_DEFAULT_ENTRY;
+ struct spe_context *spe;
+
+ spe = spe_context_create(0, NULL);
+ MARS_TEST_ASSERT(spe);
+
+ ret = spe_program_load(spe, &mpu_prog);
+ MARS_TEST_ASSERT(ret == 0);
+
+ ret = spe_context_run(spe, &entry, 0,
+ mars_ea_to_ptr(mutex), &lock_counter, NULL);
+ MARS_TEST_ASSERT(ret == 0);
+
+ ret = spe_context_destroy(spe);
+ MARS_TEST_ASSERT(ret == 0);
+
+ return NULL;
+}
+
+int main(void)
+{
+ int i, ret;
+
+ lock_counter = 0;
+
+ ret = mars_mutex_create(&mutex);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+
+ ret = mars_mutex_lock(mutex);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+
+ for (i = 0; i < TASK_COUNT; i++)
+ pthread_create(&task_threads[i], NULL, task_thread_proc, NULL);
+
+ usleep(100000);
+
+ ret = mars_mutex_unlock(mutex);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+
+ usleep(100000);
+
+ MARS_TEST_ASSERT(lock_counter == TASK_COUNT);
+
+ for (i = 0; i < TASK_COUNT; i++)
+ pthread_join(task_threads[i], NULL);
+
+ ret = mars_mutex_destroy(mutex);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+
+ return 0;
+}
diff --git a/tests/TFP/TFP_75_003/mpu.c b/tests/TFP/TFP_75_003/mpu.c
new file mode 100644
index 0000000..5c1bf51
--- /dev/null
+++ b/tests/TFP/TFP_75_003/mpu.c
@@ -0,0 +1,48 @@
+/*
+ * Copyright 2008 Sony Corporation
+ *
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a copy
+ * of this software and associated documentation files (the "Software"), to deal
+ * in the Software without restriction, including without limitation the rights
+ * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+ * copies of the Software, and to permit persons to whom the Software is
+ * furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included in
+ * all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+ * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+ * THE SOFTWARE.
+ */
+
+#include <spu_mfcio.h>
+#include <mars/mars.h>
+#include <mars_test.h>
+
+int main(unsigned long long spuid, unsigned long long argp, unsigned long long envp)
+{
+ int ret;
+ uint64_t mutex_ea = argp;
+ uint64_t lock_counter_ea = envp;
+ int32_t lock_counter;
+
+ ret = mars_mutex_lock(mutex_ea);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+
+ lock_counter = mars_test_int32_get(lock_counter_ea);
+
+ lock_counter++;
+
+ mars_test_int32_put(lock_counter_ea, lock_counter);
+
+ ret = mars_mutex_unlock(mutex_ea);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+
+ return 0;
+}
diff --git a/tests/TFP/TFP_75_004/Makefile b/tests/TFP/TFP_75_004/Makefile
new file mode 100644
index 0000000..1be569a
--- /dev/null
+++ b/tests/TFP/TFP_75_004/Makefile
@@ -0,0 +1,28 @@
+#
+# Copyright 2008 Sony Corporation
+#
+#
+# Permission is hereby granted, free of charge, to any person obtaining a copy
+# of this software and associated documentation files (the "Software"), to deal
+# in the Software without restriction, including without limitation the rights
+# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+# copies of the Software, and to permit persons to whom the Software is
+# furnished to do so, subject to the following conditions:
+#
+# The above copyright notice and this permission notice shall be included in
+# all copies or substantial portions of the Software.
+#
+# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+# THE SOFTWARE.
+#
+
+top_srcdir = ../..
+test_objs = host.o mpu.mpu_eo
+
+include $(top_srcdir)/scripts/config.mk
+include $(top_srcdir)/scripts/rules_item.mk
diff --git a/tests/TFP/TFP_75_004/host.c b/tests/TFP/TFP_75_004/host.c
new file mode 100644
index 0000000..db358e1
--- /dev/null
+++ b/tests/TFP/TFP_75_004/host.c
@@ -0,0 +1,106 @@
+/*
+ * Copyright 2008 Sony Corporation
+ *
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a copy
+ * of this software and associated documentation files (the "Software"), to deal
+ * in the Software without restriction, including without limitation the rights
+ * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+ * copies of the Software, and to permit persons to whom the Software is
+ * furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included in
+ * all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+ * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+ * THE SOFTWARE.
+ */
+
+#include <pthread.h>
+#include <unistd.h>
+#include <libspe2.h>
+#include <mars/mars.h>
+#include <mars_test.h>
+
+#define THREAD_COUNT 16
+
+extern spe_program_handle_t mpu_prog;
+
+static pthread_t threads[THREAD_COUNT], task_thread;
+static uint64_t mutex;
+static int32_t lock_counter;
+
+void *task_thread_proc(void *arg)
+{
+ int ret;
+ unsigned int entry = SPE_DEFAULT_ENTRY;
+ struct spe_context *spe;
+ uint32_t tb_freq;
+
+ ret = mars_test_get_timebase_freq(&tb_freq);
+ MARS_TEST_ASSERT_EQUAL(ret, 0);
+
+ spe = spe_context_create(0, NULL);
+ MARS_TEST_ASSERT(spe);
+
+ ret = spe_program_load(spe, &mpu_prog);
+ MARS_TEST_ASSERT(ret == 0);
+
+ ret = spe_context_run(spe, &entry, 0,
+ mars_ea_to_ptr(mutex), (void *)tb_freq, NULL);
+ MARS_TEST_ASSERT(ret == 0);
+
+ ret = spe_context_destroy(spe);
+ MARS_TEST_ASSERT(ret == 0);
+
+ return NULL;
+}
+
+void *thread_proc(void *arg)
+{
+ int ret;
+
+ ret = mars_mutex_lock(mutex);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+
+ lock_counter++;
+
+ ret = mars_mutex_unlock(mutex);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+
+ return NULL;
+}
+
+int main(void)
+{
+ int i, ret;
+
+ lock_counter = 0;
+
+ ret = mars_mutex_create(&mutex);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+
+ pthread_create(&task_thread, NULL, task_thread_proc, NULL);
+
+ for (i = 0; i < THREAD_COUNT; i++)
+ pthread_create(&threads[i], NULL, thread_proc, (void *)(uintptr_t)i);
+
+ usleep(200000);
+
+ MARS_TEST_ASSERT(lock_counter == THREAD_COUNT);
+
+ for (i = 0; i < THREAD_COUNT; i++)
+ pthread_join(threads[i], NULL);
+
+ pthread_join(task_thread, NULL);
+
+ ret = mars_mutex_destroy(mutex);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+
+ return 0;
+}
diff --git a/tests/TFP/TFP_75_004/mpu.c b/tests/TFP/TFP_75_004/mpu.c
new file mode 100644
index 0000000..8fe0e1d
--- /dev/null
+++ b/tests/TFP/TFP_75_004/mpu.c
@@ -0,0 +1,44 @@
+/*
+ * Copyright 2008 Sony Corporation
+ *
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a copy
+ * of this software and associated documentation files (the "Software"), to deal
+ * in the Software without restriction, including without limitation the rights
+ * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+ * copies of the Software, and to permit persons to whom the Software is
+ * furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included in
+ * all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+ * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+ * THE SOFTWARE.
+ */
+
+#include <mars/mars.h>
+#include <mars_test.h>
+
+int main(unsigned long long spuid,
+ unsigned long long argp,
+ unsigned long long envp)
+{
+ int ret;
+ uint64_t mutex_ea = argp;
+ uint32_t tb_freq = envp;
+
+ ret = mars_mutex_lock(mutex_ea);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+
+ mars_test_usleep(tb_freq, 100000);
+
+ ret = mars_mutex_unlock(mutex_ea);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+
+ return 0;
+}
diff --git a/tests/TTF/Makefile b/tests/TTF/Makefile
new file mode 100644
index 0000000..e8fa439
--- /dev/null
+++ b/tests/TTF/Makefile
@@ -0,0 +1,39 @@
+#
+# Copyright 2008 Sony Corporation
+#
+#
+# Permission is hereby granted, free of charge, to any person obtaining a copy
+# of this software and associated documentation files (the "Software"), to deal
+# in the Software without restriction, including without limitation the rights
+# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+# copies of the Software, and to permit persons to whom the Software is
+# furnished to do so, subject to the following conditions:
+#
+# The above copyright notice and this permission notice shall be included in
+# all copies or substantial portions of the Software.
+#
+# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+# THE SOFTWARE.
+#
+
+top_srcdir = ..
+test_items = \
+ TTF_00_001 \
+ TTF_00_002 \
+ TTF_00_003 \
+ TTF_00_004 \
+ TTF_00_101 \
+ TTF_00_102 \
+ TTF_00_103 \
+ TTF_00_104 \
+ TTF_00_105 \
+ TTF_00_106 \
+ TTF_00_107
+
+include $(top_srcdir)/scripts/config.mk
+include $(top_srcdir)/scripts/rules_class.mk
diff --git a/tests/TTF/README b/tests/TTF/README
new file mode 100644
index 0000000..53483e0
--- /dev/null
+++ b/tests/TTF/README
@@ -0,0 +1,7 @@
+* Note
+
+ - This directory contains "tests for test framework". They are *NOT*
+ a part of the MARS test suite.
+
+---
+EOF
diff --git a/tests/TTF/TTF_00_001/Makefile b/tests/TTF/TTF_00_001/Makefile
new file mode 100644
index 0000000..43ba573
--- /dev/null
+++ b/tests/TTF/TTF_00_001/Makefile
@@ -0,0 +1,28 @@
+#
+# Copyright 2008 Sony Corporation
+#
+#
+# Permission is hereby granted, free of charge, to any person obtaining a copy
+# of this software and associated documentation files (the "Software"), to deal
+# in the Software without restriction, including without limitation the rights
+# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+# copies of the Software, and to permit persons to whom the Software is
+# furnished to do so, subject to the following conditions:
+#
+# The above copyright notice and this permission notice shall be included in
+# all copies or substantial portions of the Software.
+#
+# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+# THE SOFTWARE.
+#
+
+top_srcdir = ../..
+test_objs = host.o
+
+include $(top_srcdir)/scripts/config.mk
+include $(top_srcdir)/scripts/rules_item.mk
diff --git a/tests/TTF/TTF_00_001/host.c b/tests/TTF/TTF_00_001/host.c
new file mode 100644
index 0000000..807a9c0
--- /dev/null
+++ b/tests/TTF/TTF_00_001/host.c
@@ -0,0 +1,35 @@
+/*
+ * Copyright 2008 Sony Corporation
+ *
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a copy
+ * of this software and associated documentation files (the "Software"), to deal
+ * in the Software without restriction, including without limitation the rights
+ * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+ * copies of the Software, and to permit persons to whom the Software is
+ * furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included in
+ * all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+ * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+ * THE SOFTWARE.
+ */
+
+#include <mars_test.h>
+
+unsigned int n = 0;
+
+int main(void)
+{
+ MARS_TEST_MESSAGE("comment, n == %u\n", n);
+
+ MARS_TEST_ASSERT(n == 0);
+
+ return 0;
+}
diff --git a/tests/TTF/TTF_00_002/Makefile b/tests/TTF/TTF_00_002/Makefile
new file mode 100644
index 0000000..43ba573
--- /dev/null
+++ b/tests/TTF/TTF_00_002/Makefile
@@ -0,0 +1,28 @@
+#
+# Copyright 2008 Sony Corporation
+#
+#
+# Permission is hereby granted, free of charge, to any person obtaining a copy
+# of this software and associated documentation files (the "Software"), to deal
+# in the Software without restriction, including without limitation the rights
+# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+# copies of the Software, and to permit persons to whom the Software is
+# furnished to do so, subject to the following conditions:
+#
+# The above copyright notice and this permission notice shall be included in
+# all copies or substantial portions of the Software.
+#
+# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+# THE SOFTWARE.
+#
+
+top_srcdir = ../..
+test_objs = host.o
+
+include $(top_srcdir)/scripts/config.mk
+include $(top_srcdir)/scripts/rules_item.mk
diff --git a/tests/TTF/TTF_00_002/host.c b/tests/TTF/TTF_00_002/host.c
new file mode 100644
index 0000000..0595323
--- /dev/null
+++ b/tests/TTF/TTF_00_002/host.c
@@ -0,0 +1,33 @@
+/*
+ * Copyright 2008 Sony Corporation
+ *
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a copy
+ * of this software and associated documentation files (the "Software"), to deal
+ * in the Software without restriction, including without limitation the rights
+ * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+ * copies of the Software, and to permit persons to whom the Software is
+ * furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included in
+ * all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+ * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+ * THE SOFTWARE.
+ */
+
+#include <mars_test.h>
+
+int ret = MARS_ERROR_ALIGN;
+
+int main(void)
+{
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+
+ return 0;
+}
diff --git a/tests/TTF/TTF_00_003/Makefile b/tests/TTF/TTF_00_003/Makefile
new file mode 100644
index 0000000..8a34894
--- /dev/null
+++ b/tests/TTF/TTF_00_003/Makefile
@@ -0,0 +1,31 @@
+#
+# Copyright 2008 Sony Corporation
+#
+#
+# Permission is hereby granted, free of charge, to any person obtaining a copy
+# of this software and associated documentation files (the "Software"), to deal
+# in the Software without restriction, including without limitation the rights
+# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+# copies of the Software, and to permit persons to whom the Software is
+# furnished to do so, subject to the following conditions:
+#
+# The above copyright notice and this permission notice shall be included in
+# all copies or substantial portions of the Software.
+#
+# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+# THE SOFTWARE.
+#
+
+top_srcdir = ../..
+test_objs = host.o
+
+# override timeout time
+timeout = 7
+
+include $(top_srcdir)/scripts/config.mk
+include $(top_srcdir)/scripts/rules_item.mk
diff --git a/tests/TTF/TTF_00_003/host.c b/tests/TTF/TTF_00_003/host.c
new file mode 100644
index 0000000..421e792
--- /dev/null
+++ b/tests/TTF/TTF_00_003/host.c
@@ -0,0 +1,30 @@
+/*
+ * Copyright 2008 Sony Corporation
+ *
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a copy
+ * of this software and associated documentation files (the "Software"), to deal
+ * in the Software without restriction, including without limitation the rights
+ * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+ * copies of the Software, and to permit persons to whom the Software is
+ * furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included in
+ * all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+ * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+ * THE SOFTWARE.
+ */
+
+int main(void)
+{
+ /* infinite loop */
+ for ( ; ; ) ;
+
+ return 0;
+}
diff --git a/tests/TTF/TTF_00_004/Makefile b/tests/TTF/TTF_00_004/Makefile
new file mode 100644
index 0000000..43ba573
--- /dev/null
+++ b/tests/TTF/TTF_00_004/Makefile
@@ -0,0 +1,28 @@
+#
+# Copyright 2008 Sony Corporation
+#
+#
+# Permission is hereby granted, free of charge, to any person obtaining a copy
+# of this software and associated documentation files (the "Software"), to deal
+# in the Software without restriction, including without limitation the rights
+# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+# copies of the Software, and to permit persons to whom the Software is
+# furnished to do so, subject to the following conditions:
+#
+# The above copyright notice and this permission notice shall be included in
+# all copies or substantial portions of the Software.
+#
+# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+# THE SOFTWARE.
+#
+
+top_srcdir = ../..
+test_objs = host.o
+
+include $(top_srcdir)/scripts/config.mk
+include $(top_srcdir)/scripts/rules_item.mk
diff --git a/tests/TTF/TTF_00_004/host.c b/tests/TTF/TTF_00_004/host.c
new file mode 100644
index 0000000..b32a191
--- /dev/null
+++ b/tests/TTF/TTF_00_004/host.c
@@ -0,0 +1,32 @@
+/*
+ * Copyright 2008 Sony Corporation
+ *
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a copy
+ * of this software and associated documentation files (the "Software"), to deal
+ * in the Software without restriction, including without limitation the rights
+ * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+ * copies of the Software, and to permit persons to whom the Software is
+ * furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included in
+ * all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+ * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+ * THE SOFTWARE.
+ */
+
+#include <stddef.h>
+
+int main(void)
+{
+ /* do invalid memory access intentionally */
+ *(int *)NULL = 1;
+
+ return 0;
+}
diff --git a/tests/TTF/TTF_00_101/Makefile b/tests/TTF/TTF_00_101/Makefile
new file mode 100644
index 0000000..432135a
--- /dev/null
+++ b/tests/TTF/TTF_00_101/Makefile
@@ -0,0 +1,28 @@
+#
+# Copyright 2008 Sony Corporation
+#
+#
+# Permission is hereby granted, free of charge, to any person obtaining a copy
+# of this software and associated documentation files (the "Software"), to deal
+# in the Software without restriction, including without limitation the rights
+# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+# copies of the Software, and to permit persons to whom the Software is
+# furnished to do so, subject to the following conditions:
+#
+# The above copyright notice and this permission notice shall be included in
+# all copies or substantial portions of the Software.
+#
+# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+# THE SOFTWARE.
+#
+
+top_srcdir = ../..
+test_objs = host.o mpu.task_eo
+
+include $(top_srcdir)/scripts/config.mk
+include $(top_srcdir)/scripts/rules_item.mk
diff --git a/tests/TTF/TTF_00_101/host.c b/tests/TTF/TTF_00_101/host.c
new file mode 100644
index 0000000..eb6bfcb
--- /dev/null
+++ b/tests/TTF/TTF_00_101/host.c
@@ -0,0 +1,74 @@
+/*
+ * Copyright 2008 Sony Corporation
+ *
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a copy
+ * of this software and associated documentation files (the "Software"), to deal
+ * in the Software without restriction, including without limitation the rights
+ * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+ * copies of the Software, and to permit persons to whom the Software is
+ * furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included in
+ * all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+ * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+ * THE SOFTWARE.
+ */
+
+#include <mars/mars.h>
+#include <libspe2.h>
+#include <mars_test.h>
+
+
+#define NUM_SPES 4
+#define NUM_TASKS 4
+
+extern spe_program_handle_t mpu_prog;
+
+static struct mars_task_id task_id[NUM_TASKS];
+static struct mars_task_args task_args;
+
+
+int main(void)
+{
+ int ret, i;
+ struct mars_context *mars_ctx;
+
+ ret = mars_context_create(&mars_ctx, NUM_SPES, 0);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+
+ for (i = 0; i < NUM_TASKS; i++) {
+ char name[MARS_TASK_NAME_LEN_MAX];
+
+ snprintf(name, MARS_TASK_NAME_LEN_MAX, "Task %d", i + 1);
+ ret = mars_task_create(mars_ctx, &task_id[i], name,
+ mpu_prog.elf_image, MARS_TASK_CONTEXT_SAVE_ALL);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+
+ ret = mars_task_schedule(&task_id[i], &task_args, 0);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+ }
+
+ for (i = 0; i < NUM_TASKS; i++) {
+ int32_t exit_code;
+ ret = mars_task_wait(&task_id[i], &exit_code);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+ MARS_TEST_ASSERT(exit_code == 0);
+
+ ret = mars_task_destroy(&task_id[i]);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+ }
+
+ ret = mars_context_destroy(mars_ctx);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+
+ return 0;
+}
+
+
diff --git a/tests/TTF/TTF_00_101/mpu.c b/tests/TTF/TTF_00_101/mpu.c
new file mode 100644
index 0000000..8fd74e6
--- /dev/null
+++ b/tests/TTF/TTF_00_101/mpu.c
@@ -0,0 +1,34 @@
+/*
+ * Copyright 2008 Sony Corporation
+ *
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a copy
+ * of this software and associated documentation files (the "Software"), to deal
+ * in the Software without restriction, including without limitation the rights
+ * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+ * copies of the Software, and to permit persons to whom the Software is
+ * furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included in
+ * all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+ * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+ * THE SOFTWARE.
+ */
+
+#include <mars/mars.h>
+#include <mars_task_test.h>
+
+int n = 0;
+
+int mars_task_main(const struct mars_task_args *task_args)
+{
+ MARS_TEST_ASSERT(n == 0);
+
+ return 0;
+}
diff --git a/tests/TTF/TTF_00_102/Makefile b/tests/TTF/TTF_00_102/Makefile
new file mode 100644
index 0000000..432135a
--- /dev/null
+++ b/tests/TTF/TTF_00_102/Makefile
@@ -0,0 +1,28 @@
+#
+# Copyright 2008 Sony Corporation
+#
+#
+# Permission is hereby granted, free of charge, to any person obtaining a copy
+# of this software and associated documentation files (the "Software"), to deal
+# in the Software without restriction, including without limitation the rights
+# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+# copies of the Software, and to permit persons to whom the Software is
+# furnished to do so, subject to the following conditions:
+#
+# The above copyright notice and this permission notice shall be included in
+# all copies or substantial portions of the Software.
+#
+# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+# THE SOFTWARE.
+#
+
+top_srcdir = ../..
+test_objs = host.o mpu.task_eo
+
+include $(top_srcdir)/scripts/config.mk
+include $(top_srcdir)/scripts/rules_item.mk
diff --git a/tests/TTF/TTF_00_102/host.c b/tests/TTF/TTF_00_102/host.c
new file mode 100644
index 0000000..b2d4477
--- /dev/null
+++ b/tests/TTF/TTF_00_102/host.c
@@ -0,0 +1,72 @@
+/*
+ * Copyright 2008 Sony Corporation
+ *
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a copy
+ * of this software and associated documentation files (the "Software"), to deal
+ * in the Software without restriction, including without limitation the rights
+ * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+ * copies of the Software, and to permit persons to whom the Software is
+ * furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included in
+ * all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+ * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+ * THE SOFTWARE.
+ */
+
+#include <mars/mars.h>
+#include <libspe2.h>
+#include <mars_test.h>
+
+
+#define NUM_SPES 4
+#define NUM_TASKS 4
+
+extern spe_program_handle_t mpu_prog;
+
+static struct mars_task_id task_id[NUM_TASKS];
+static struct mars_task_args task_args;
+
+
+int main(void)
+{
+ int ret, i;
+ struct mars_context *mars_ctx;
+
+ ret = mars_context_create(&mars_ctx, NUM_SPES, 0);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+
+ for (i = 0; i < NUM_TASKS; i++) {
+ char name[MARS_TASK_NAME_LEN_MAX];
+
+ snprintf(name, MARS_TASK_NAME_LEN_MAX, "Task %d", i + 1);
+ ret = mars_task_create(mars_ctx, &task_id[i], name,
+ mpu_prog.elf_image, MARS_TASK_CONTEXT_SAVE_ALL);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+
+ ret = mars_task_schedule(&task_id[i], &task_args, 0);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+ }
+
+ for (i = 0; i < NUM_TASKS; i++) {
+ int32_t exit_code;
+ ret = mars_task_wait(&task_id[i], &exit_code);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+ MARS_TEST_ASSERT(exit_code == 0);
+
+ ret = mars_task_destroy(&task_id[i]);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+ }
+
+ ret = mars_context_destroy(mars_ctx);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+
+ return 0;
+}
diff --git a/tests/TTF/TTF_00_102/mpu.c b/tests/TTF/TTF_00_102/mpu.c
new file mode 100644
index 0000000..2dc1a5c
--- /dev/null
+++ b/tests/TTF/TTF_00_102/mpu.c
@@ -0,0 +1,34 @@
+/*
+ * Copyright 2008 Sony Corporation
+ *
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a copy
+ * of this software and associated documentation files (the "Software"), to deal
+ * in the Software without restriction, including without limitation the rights
+ * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+ * copies of the Software, and to permit persons to whom the Software is
+ * furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included in
+ * all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+ * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+ * THE SOFTWARE.
+ */
+
+#include <mars/mars.h>
+#include <mars_task_test.h>
+
+int n = 0;
+
+int mars_task_main(const struct mars_task_args *task_args)
+{
+ MARS_TEST_ASSERT_EQUAL(n, 1);
+
+ return 0;
+}
diff --git a/tests/TTF/TTF_00_103/Makefile b/tests/TTF/TTF_00_103/Makefile
new file mode 100644
index 0000000..2e5e4c7
--- /dev/null
+++ b/tests/TTF/TTF_00_103/Makefile
@@ -0,0 +1,31 @@
+#
+# Copyright 2008 Sony Corporation
+#
+#
+# Permission is hereby granted, free of charge, to any person obtaining a copy
+# of this software and associated documentation files (the "Software"), to deal
+# in the Software without restriction, including without limitation the rights
+# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+# copies of the Software, and to permit persons to whom the Software is
+# furnished to do so, subject to the following conditions:
+#
+# The above copyright notice and this permission notice shall be included in
+# all copies or substantial portions of the Software.
+#
+# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+# THE SOFTWARE.
+#
+
+top_srcdir = ../..
+test_objs = host.o mpu.task_eo
+
+# override timeout time
+timeout = 10
+
+include $(top_srcdir)/scripts/config.mk
+include $(top_srcdir)/scripts/rules_item.mk
diff --git a/tests/TTF/TTF_00_103/host.c b/tests/TTF/TTF_00_103/host.c
new file mode 100644
index 0000000..b2d4477
--- /dev/null
+++ b/tests/TTF/TTF_00_103/host.c
@@ -0,0 +1,72 @@
+/*
+ * Copyright 2008 Sony Corporation
+ *
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a copy
+ * of this software and associated documentation files (the "Software"), to deal
+ * in the Software without restriction, including without limitation the rights
+ * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+ * copies of the Software, and to permit persons to whom the Software is
+ * furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included in
+ * all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+ * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+ * THE SOFTWARE.
+ */
+
+#include <mars/mars.h>
+#include <libspe2.h>
+#include <mars_test.h>
+
+
+#define NUM_SPES 4
+#define NUM_TASKS 4
+
+extern spe_program_handle_t mpu_prog;
+
+static struct mars_task_id task_id[NUM_TASKS];
+static struct mars_task_args task_args;
+
+
+int main(void)
+{
+ int ret, i;
+ struct mars_context *mars_ctx;
+
+ ret = mars_context_create(&mars_ctx, NUM_SPES, 0);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+
+ for (i = 0; i < NUM_TASKS; i++) {
+ char name[MARS_TASK_NAME_LEN_MAX];
+
+ snprintf(name, MARS_TASK_NAME_LEN_MAX, "Task %d", i + 1);
+ ret = mars_task_create(mars_ctx, &task_id[i], name,
+ mpu_prog.elf_image, MARS_TASK_CONTEXT_SAVE_ALL);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+
+ ret = mars_task_schedule(&task_id[i], &task_args, 0);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+ }
+
+ for (i = 0; i < NUM_TASKS; i++) {
+ int32_t exit_code;
+ ret = mars_task_wait(&task_id[i], &exit_code);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+ MARS_TEST_ASSERT(exit_code == 0);
+
+ ret = mars_task_destroy(&task_id[i]);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+ }
+
+ ret = mars_context_destroy(mars_ctx);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+
+ return 0;
+}
diff --git a/tests/TTF/TTF_00_103/mpu.c b/tests/TTF/TTF_00_103/mpu.c
new file mode 100644
index 0000000..a2d7063
--- /dev/null
+++ b/tests/TTF/TTF_00_103/mpu.c
@@ -0,0 +1,33 @@
+/*
+ * Copyright 2008 Sony Corporation
+ *
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a copy
+ * of this software and associated documentation files (the "Software"), to deal
+ * in the Software without restriction, including without limitation the rights
+ * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+ * copies of the Software, and to permit persons to whom the Software is
+ * furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included in
+ * all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+ * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+ * THE SOFTWARE.
+ */
+
+#include <mars/mars.h>
+#include <mars_task_test.h>
+
+int mars_task_main(const struct mars_task_args *task_args)
+{
+ /* infinite loop */
+ for ( ; ; ) ;
+
+ return 0;
+}
diff --git a/tests/TTF/TTF_00_104/Makefile b/tests/TTF/TTF_00_104/Makefile
new file mode 100644
index 0000000..432135a
--- /dev/null
+++ b/tests/TTF/TTF_00_104/Makefile
@@ -0,0 +1,28 @@
+#
+# Copyright 2008 Sony Corporation
+#
+#
+# Permission is hereby granted, free of charge, to any person obtaining a copy
+# of this software and associated documentation files (the "Software"), to deal
+# in the Software without restriction, including without limitation the rights
+# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+# copies of the Software, and to permit persons to whom the Software is
+# furnished to do so, subject to the following conditions:
+#
+# The above copyright notice and this permission notice shall be included in
+# all copies or substantial portions of the Software.
+#
+# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+# THE SOFTWARE.
+#
+
+top_srcdir = ../..
+test_objs = host.o mpu.task_eo
+
+include $(top_srcdir)/scripts/config.mk
+include $(top_srcdir)/scripts/rules_item.mk
diff --git a/tests/TTF/TTF_00_104/host.c b/tests/TTF/TTF_00_104/host.c
new file mode 100644
index 0000000..b2d4477
--- /dev/null
+++ b/tests/TTF/TTF_00_104/host.c
@@ -0,0 +1,72 @@
+/*
+ * Copyright 2008 Sony Corporation
+ *
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a copy
+ * of this software and associated documentation files (the "Software"), to deal
+ * in the Software without restriction, including without limitation the rights
+ * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+ * copies of the Software, and to permit persons to whom the Software is
+ * furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included in
+ * all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+ * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+ * THE SOFTWARE.
+ */
+
+#include <mars/mars.h>
+#include <libspe2.h>
+#include <mars_test.h>
+
+
+#define NUM_SPES 4
+#define NUM_TASKS 4
+
+extern spe_program_handle_t mpu_prog;
+
+static struct mars_task_id task_id[NUM_TASKS];
+static struct mars_task_args task_args;
+
+
+int main(void)
+{
+ int ret, i;
+ struct mars_context *mars_ctx;
+
+ ret = mars_context_create(&mars_ctx, NUM_SPES, 0);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+
+ for (i = 0; i < NUM_TASKS; i++) {
+ char name[MARS_TASK_NAME_LEN_MAX];
+
+ snprintf(name, MARS_TASK_NAME_LEN_MAX, "Task %d", i + 1);
+ ret = mars_task_create(mars_ctx, &task_id[i], name,
+ mpu_prog.elf_image, MARS_TASK_CONTEXT_SAVE_ALL);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+
+ ret = mars_task_schedule(&task_id[i], &task_args, 0);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+ }
+
+ for (i = 0; i < NUM_TASKS; i++) {
+ int32_t exit_code;
+ ret = mars_task_wait(&task_id[i], &exit_code);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+ MARS_TEST_ASSERT(exit_code == 0);
+
+ ret = mars_task_destroy(&task_id[i]);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+ }
+
+ ret = mars_context_destroy(mars_ctx);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+
+ return 0;
+}
diff --git a/tests/TTF/TTF_00_104/mpu.c b/tests/TTF/TTF_00_104/mpu.c
new file mode 100644
index 0000000..1165d2d
--- /dev/null
+++ b/tests/TTF/TTF_00_104/mpu.c
@@ -0,0 +1,39 @@
+/*
+ * Copyright 2008 Sony Corporation
+ *
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a copy
+ * of this software and associated documentation files (the "Software"), to deal
+ * in the Software without restriction, including without limitation the rights
+ * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+ * copies of the Software, and to permit persons to whom the Software is
+ * furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included in
+ * all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+ * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+ * THE SOFTWARE.
+ */
+
+#include <mars/mars.h>
+#include <mars_task_test.h>
+
+#include <spu_mfcio.h>
+
+static char buf[16];
+
+int mars_task_main(const struct mars_task_args *task_args)
+{
+ /* do invalid memory access intentionally */
+ mfc_get(buf, 0, sizeof(buf), 0, 0, 0);
+ mfc_write_tag_mask(1);
+ mfc_read_tag_status_all();
+
+ return 0;
+}
diff --git a/tests/TTF/TTF_00_105/Makefile b/tests/TTF/TTF_00_105/Makefile
new file mode 100644
index 0000000..1be569a
--- /dev/null
+++ b/tests/TTF/TTF_00_105/Makefile
@@ -0,0 +1,28 @@
+#
+# Copyright 2008 Sony Corporation
+#
+#
+# Permission is hereby granted, free of charge, to any person obtaining a copy
+# of this software and associated documentation files (the "Software"), to deal
+# in the Software without restriction, including without limitation the rights
+# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+# copies of the Software, and to permit persons to whom the Software is
+# furnished to do so, subject to the following conditions:
+#
+# The above copyright notice and this permission notice shall be included in
+# all copies or substantial portions of the Software.
+#
+# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+# THE SOFTWARE.
+#
+
+top_srcdir = ../..
+test_objs = host.o mpu.mpu_eo
+
+include $(top_srcdir)/scripts/config.mk
+include $(top_srcdir)/scripts/rules_item.mk
diff --git a/tests/TTF/TTF_00_105/host.c b/tests/TTF/TTF_00_105/host.c
new file mode 100644
index 0000000..54c8ab0
--- /dev/null
+++ b/tests/TTF/TTF_00_105/host.c
@@ -0,0 +1,74 @@
+/*
+ * Copyright 2008 Sony Corporation
+ *
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a copy
+ * of this software and associated documentation files (the "Software"), to deal
+ * in the Software without restriction, including without limitation the rights
+ * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+ * copies of the Software, and to permit persons to whom the Software is
+ * furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included in
+ * all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+ * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+ * THE SOFTWARE.
+ */
+
+#include <mars/mars.h>
+#include <libspe2.h>
+#include <pthread.h>
+#include <mars_test.h>
+
+#define NUM_SPES 4
+
+extern spe_program_handle_t mpu_prog;
+
+void *thread_proc(void *arg)
+{
+ int ret;
+ spe_context_ptr_t spe;
+ unsigned int entry = SPE_DEFAULT_ENTRY;
+ spe_stop_info_t stopinfo;
+
+ spe = spe_context_create(0, NULL);
+ MARS_TEST_ASSERT(spe);
+
+ ret = spe_program_load(spe, &mpu_prog);
+ MARS_TEST_ASSERT(ret == 0);
+
+ ret = spe_context_run(spe, &entry, 0,
+ (void *)(uintptr_t)1, (void *)(uintptr_t)2, &stopinfo);
+ MARS_TEST_ASSERT(ret == 0);
+ MARS_TEST_ASSERT(stopinfo.stop_reason == SPE_EXIT);
+ MARS_TEST_ASSERT(stopinfo.result.spe_exit_code == 0);
+
+ ret = spe_context_destroy(spe);
+ MARS_TEST_ASSERT(ret == 0);
+
+ return NULL;
+}
+
+int main(void)
+{
+ int ret, i;
+ pthread_t threads[NUM_SPES];
+
+ for (i = 0; i < NUM_SPES; i++) {
+ ret = pthread_create(&threads[i], NULL, thread_proc, NULL);
+ MARS_TEST_ASSERT(ret == 0);
+ }
+
+ for (i = 0; i < NUM_SPES; i++) {
+ ret = pthread_join(threads[i], NULL);
+ MARS_TEST_ASSERT(ret == 0);
+ }
+
+ return 0;
+}
diff --git a/tests/TTF/TTF_00_105/mpu.c b/tests/TTF/TTF_00_105/mpu.c
new file mode 100644
index 0000000..9ebdec5
--- /dev/null
+++ b/tests/TTF/TTF_00_105/mpu.c
@@ -0,0 +1,35 @@
+/*
+ * Copyright 2008 Sony Corporation
+ *
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a copy
+ * of this software and associated documentation files (the "Software"), to deal
+ * in the Software without restriction, including without limitation the rights
+ * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+ * copies of the Software, and to permit persons to whom the Software is
+ * furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included in
+ * all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+ * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+ * THE SOFTWARE.
+ */
+
+#include <mars/mars.h>
+#include <mars_test.h>
+
+int n = 0;
+
+int main(unsigned long long spe,
+ unsigned long long argp, unsigned long long envp)
+{
+ MARS_TEST_ASSERT(n == 0);
+
+ return (argp != 1 || envp != 2);
+}
diff --git a/tests/TTF/TTF_00_106/Makefile b/tests/TTF/TTF_00_106/Makefile
new file mode 100644
index 0000000..432135a
--- /dev/null
+++ b/tests/TTF/TTF_00_106/Makefile
@@ -0,0 +1,28 @@
+#
+# Copyright 2008 Sony Corporation
+#
+#
+# Permission is hereby granted, free of charge, to any person obtaining a copy
+# of this software and associated documentation files (the "Software"), to deal
+# in the Software without restriction, including without limitation the rights
+# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+# copies of the Software, and to permit persons to whom the Software is
+# furnished to do so, subject to the following conditions:
+#
+# The above copyright notice and this permission notice shall be included in
+# all copies or substantial portions of the Software.
+#
+# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+# THE SOFTWARE.
+#
+
+top_srcdir = ../..
+test_objs = host.o mpu.task_eo
+
+include $(top_srcdir)/scripts/config.mk
+include $(top_srcdir)/scripts/rules_item.mk
diff --git a/tests/TTF/TTF_00_106/host.c b/tests/TTF/TTF_00_106/host.c
new file mode 100644
index 0000000..6c30d0c
--- /dev/null
+++ b/tests/TTF/TTF_00_106/host.c
@@ -0,0 +1,124 @@
+/*
+ * Copyright 2008 Sony Corporation
+ *
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a copy
+ * of this software and associated documentation files (the "Software"), to deal
+ * in the Software without restriction, including without limitation the rights
+ * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+ * copies of the Software, and to permit persons to whom the Software is
+ * furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included in
+ * all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+ * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+ * THE SOFTWARE.
+ */
+
+#include <mars/mars.h>
+#include <libspe2.h>
+#include <pthread.h>
+#include <mars_test.h>
+
+#include "test.h"
+
+extern spe_program_handle_t mpu_prog;
+
+static struct mars_task_id task_id[NUM_TASKS];
+static struct mars_task_args task_args;
+static pthread_t threads[NUM_THREADS];
+
+static uint32_t notify[32] __attribute__((aligned(128)));
+
+static void *thread_proc(void *arg)
+{
+ int index = (uintptr_t)arg;
+
+ if (index == 0) {
+ fprintf(stderr, "Thread %d: Sleep 3 seconds before incrementing counter.\n",
+ index);
+ sleep(3);
+ }
+
+ mars_test_counter_add(&notify[0], 1);
+
+ mars_test_counter_wait(&notify[0], NUM_TASKS + NUM_THREADS + 2);
+
+ return NULL;
+}
+
+int main(void)
+{
+ int ret, i;
+ struct mars_context *mars_ctx;
+
+ ret = mars_context_create(&mars_ctx, NUM_SPES, 0);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+
+ mars_test_counter_set(&notify[0], 1);
+
+ for (i = 0; i < NUM_TASKS; i++) {
+ char name[MARS_TASK_NAME_LEN_MAX];
+
+ snprintf(name, MARS_TASK_NAME_LEN_MAX, "Task %d", i + 1);
+ ret = mars_task_create(mars_ctx, &task_id[i], name,
+ mpu_prog.elf_image, MARS_TASK_CONTEXT_SAVE_ALL);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+
+ task_args.type.u64[0] = (uintptr_t)&notify;
+ ret = mars_task_schedule(&task_id[i], &task_args, 0);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+ }
+
+ fprintf(stderr, "Sleep 3 seconds before notification.\n");
+ sleep(3);
+ mars_test_counter_set(&notify[0], 2);
+
+ fprintf(stderr, "Waiting for notification from tasks.\n");
+ mars_test_counter_wait(&notify[0], NUM_TASKS + 2);
+ fprintf(stderr, "Done.\n");
+
+ fprintf(stderr, "Starting threads.\n");
+ for (i = 0; i < NUM_THREADS; i++) {
+ ret = pthread_create(&threads[i], NULL,
+ thread_proc, (void *)(uintptr_t)i);
+ MARS_TEST_ASSERT(ret == 0);
+ }
+
+ for (i = 0; i < NUM_THREADS; i++) {
+ ret = pthread_join(threads[i], NULL);
+ MARS_TEST_ASSERT(ret == 0);
+ }
+ fprintf(stderr, "Done.\n");
+
+ fprintf(stderr, "Sleep 3 seconds before notification.\n");
+ sleep(3);
+ mars_test_counter_set(&notify[0], NUM_TASKS + NUM_THREADS + 3);
+
+ fprintf(stderr, "Waiting for notification from tasks.\n");
+ mars_test_counter_wait(&notify[0], NUM_TASKS + NUM_THREADS + 4);
+ fprintf(stderr, "Done.\n");
+
+ for (i = 0; i < NUM_TASKS; i++) {
+ int32_t exit_code;
+ ret = mars_task_wait(&task_id[i], &exit_code);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+ MARS_TEST_ASSERT(exit_code == 0);
+
+ ret = mars_task_destroy(&task_id[i]);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+ }
+
+ ret = mars_context_destroy(mars_ctx);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+
+ return 0;
+}
+
+
diff --git a/tests/TTF/TTF_00_106/mpu.c b/tests/TTF/TTF_00_106/mpu.c
new file mode 100644
index 0000000..eed4107
--- /dev/null
+++ b/tests/TTF/TTF_00_106/mpu.c
@@ -0,0 +1,51 @@
+/*
+ * Copyright 2008 Sony Corporation
+ *
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a copy
+ * of this software and associated documentation files (the "Software"), to deal
+ * in the Software without restriction, including without limitation the rights
+ * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+ * copies of the Software, and to permit persons to whom the Software is
+ * furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included in
+ * all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+ * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+ * THE SOFTWARE.
+ */
+
+#include <mars/mars.h>
+#include <mars_task_test.h>
+
+#include "test.h"
+
+int mars_task_main(const struct mars_task_args *task_args)
+{
+ uint64_t ea = task_args->type.u64[0];
+ volatile int i;
+
+ mars_test_counter_wait(ea, 2);
+
+ for (i = 0; i < 0x20000000; i++) {
+ /* spin */
+ }
+
+ mars_test_counter_add(ea, 1);
+
+ mars_test_counter_wait(ea, NUM_TASKS + NUM_THREADS + 3);
+
+ for (i = 0; i < 0x20000000; i++) {
+ /* spin */
+ }
+
+ mars_test_counter_set(ea, NUM_TASKS + NUM_THREADS + 4);
+
+ return 0;
+}
diff --git a/tests/TTF/TTF_00_106/test.h b/tests/TTF/TTF_00_106/test.h
new file mode 100644
index 0000000..d9aeafa
--- /dev/null
+++ b/tests/TTF/TTF_00_106/test.h
@@ -0,0 +1,31 @@
+/*
+ * Copyright 2008 Sony Corporation
+ *
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a copy
+ * of this software and associated documentation files (the "Software"), to deal
+ * in the Software without restriction, including without limitation the rights
+ * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+ * copies of the Software, and to permit persons to whom the Software is
+ * furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included in
+ * all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+ * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+ * THE SOFTWARE.
+ */
+
+#ifndef TEST_H
+#define TEST_H 1
+
+#define NUM_SPES 4
+#define NUM_TASKS 4
+#define NUM_THREADS 100
+
+#endif /* TEST_H */
diff --git a/tests/TTF/TTF_00_107/Makefile b/tests/TTF/TTF_00_107/Makefile
new file mode 100644
index 0000000..432135a
--- /dev/null
+++ b/tests/TTF/TTF_00_107/Makefile
@@ -0,0 +1,28 @@
+#
+# Copyright 2008 Sony Corporation
+#
+#
+# Permission is hereby granted, free of charge, to any person obtaining a copy
+# of this software and associated documentation files (the "Software"), to deal
+# in the Software without restriction, including without limitation the rights
+# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+# copies of the Software, and to permit persons to whom the Software is
+# furnished to do so, subject to the following conditions:
+#
+# The above copyright notice and this permission notice shall be included in
+# all copies or substantial portions of the Software.
+#
+# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+# THE SOFTWARE.
+#
+
+top_srcdir = ../..
+test_objs = host.o mpu.task_eo
+
+include $(top_srcdir)/scripts/config.mk
+include $(top_srcdir)/scripts/rules_item.mk
diff --git a/tests/TTF/TTF_00_107/host.c b/tests/TTF/TTF_00_107/host.c
new file mode 100644
index 0000000..a913191
--- /dev/null
+++ b/tests/TTF/TTF_00_107/host.c
@@ -0,0 +1,91 @@
+/*
+ * Copyright 2008 Sony Corporation
+ *
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a copy
+ * of this software and associated documentation files (the "Software"), to deal
+ * in the Software without restriction, including without limitation the rights
+ * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+ * copies of the Software, and to permit persons to whom the Software is
+ * furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included in
+ * all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+ * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+ * THE SOFTWARE.
+ */
+
+#include <mars/mars.h>
+#include <libspe2.h>
+#include <mars_test.h>
+
+#define NUM_SPES 4
+#define NUM_TASKS 4
+
+extern spe_program_handle_t mpu_prog;
+
+static struct mars_task_id task_id[NUM_TASKS];
+static struct mars_task_args task_args;
+
+static uint32_t task_time[NUM_TASKS];
+
+int main(void)
+{
+ int ret, i;
+ struct mars_context *mars_ctx;
+ uint32_t start, end;
+
+ MARS_TEST_PERF_INIT();
+
+ start = mars_get_ticks(); /* start measurement */
+ ret = mars_context_create(&mars_ctx, NUM_SPES, 0);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+
+ for (i = 0; i < NUM_TASKS; i++) {
+ char name[MARS_TASK_NAME_LEN_MAX];
+
+ snprintf(name, MARS_TASK_NAME_LEN_MAX, "Task %d", i + 1);
+ ret = mars_task_create(mars_ctx, &task_id[i], name,
+ mpu_prog.elf_image, MARS_TASK_CONTEXT_SAVE_ALL);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+
+ task_args.type.u64[0] = i;
+ task_args.type.u64[1] = (uintptr_t)&task_time[i];
+
+ ret = mars_task_schedule(&task_id[i], &task_args, 0);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+ }
+
+ for (i = 0; i < NUM_TASKS; i++) {
+ int32_t exit_code;
+ ret = mars_task_wait(&task_id[i], &exit_code);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+ MARS_TEST_ASSERT(exit_code == 0);
+
+ ret = mars_task_destroy(&task_id[i]);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+ }
+
+ ret = mars_context_destroy(mars_ctx);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+
+ end = mars_get_ticks(); /* end measurement */
+
+ MARS_TEST_PERF_RESULT_PRINT("HOST", end - start);
+
+ for (i = 0; i < NUM_TASKS; i++) {
+ char name[10];
+ sprintf(name, "TASK%u", i);
+ MARS_TEST_PERF_RESULT_PRINT(name, task_time[i]);
+ }
+
+ return 0;
+}
+
+
diff --git a/tests/TTF/TTF_00_107/mpu.c b/tests/TTF/TTF_00_107/mpu.c
new file mode 100644
index 0000000..9b5246a
--- /dev/null
+++ b/tests/TTF/TTF_00_107/mpu.c
@@ -0,0 +1,50 @@
+/*
+ * Copyright 2008 Sony Corporation
+ *
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a copy
+ * of this software and associated documentation files (the "Software"), to deal
+ * in the Software without restriction, including without limitation the rights
+ * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+ * copies of the Software, and to permit persons to whom the Software is
+ * furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included in
+ * all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+ * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+ * THE SOFTWARE.
+ */
+
+#include <mars/mars.h>
+#include <mars_task_test.h>
+
+int mars_task_main(const struct mars_task_args *task_args)
+{
+ int i;
+ uint32_t time = 0;
+
+ MARS_TEST_PERF_INIT();
+
+ for (i = 0; i < task_args->type.u64[0] + 1; i++) {
+ volatile int j;
+ uint32_t start, end;
+ start = mars_task_get_ticks(); /* start measurement */
+
+ for (j = 0; j < 0x1000000; j++) {
+ /* spin */
+ }
+
+ end = mars_task_get_ticks(); /* update */
+ time += end - start;
+ }
+
+ MARS_TEST_PERF_RESULT_SUBMIT(task_args->type.u64[1], time);
+
+ return 0;
+}
diff --git a/tests/include/common/mars_test.h b/tests/include/common/mars_test.h
new file mode 100644
index 0000000..935a6ee
--- /dev/null
+++ b/tests/include/common/mars_test.h
@@ -0,0 +1,108 @@
+/*
+ * Copyright 2008 Sony Corporation
+ *
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a copy
+ * of this software and associated documentation files (the "Software"), to deal
+ * in the Software without restriction, including without limitation the rights
+ * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+ * copies of the Software, and to permit persons to whom the Software is
+ * furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included in
+ * all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+ * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+ * THE SOFTWARE.
+ */
+
+#ifndef COMMON_MARS_TEST_H
+#define COMMON_MARS_TEST_H 1
+
+#include <mars/mars.h>
+#include <stdio.h>
+#include <stdlib.h>
+
+#ifndef MARS_TEST_ABORT
+# define MARS_TEST_ABORT abort()
+#endif
+
+#ifndef MARS_TEST_NAME
+# define MARS_TEST_NAME "UNKNOWN_TEST"
+#endif
+
+/*** assertion amcros ***/
+
+/* generic forms */
+#define MARS_TEST_ASSERT_PRINTF(e, f...) \
+ do { \
+ if (!(e)) { \
+ fprintf(stderr, \
+ MARS_TEST_NAME ": ERROR: " __FILE__ ":" \
+ __MARS_TEST_STRING_EXPAND(__LINE__) \
+ ": Assertion failed: " f); \
+ MARS_TEST_ABORT; \
+ } \
+ } while (0)
+
+#define MARS_TEST_ASSERT(e) MARS_TEST_ASSERT_PRINTF(e, "%s\n", #e)
+
+/* comparison */
+#define MARS_TEST_ASSERT_COMPARE_INT(e, op, x) \
+ do { \
+ int be = (e); \
+ int bx = (x); \
+ MARS_TEST_ASSERT_PRINTF(be op bx, \
+ #e " " #op " " #x \
+ " (value: %d == 0x%x," \
+ " expected: %d == 0x%x)\n", \
+ be, be, bx, bx); \
+ } while (0)
+#define MARS_TEST_ASSERT_EQUAL_INT(e, x) MARS_TEST_ASSERT_COMPARE_INT(e, ==, x)
+
+#define MARS_TEST_ASSERT_ENUM(e, x, v2s) \
+ do { \
+ int be = (e); \
+ int bx = (x); \
+ MARS_TEST_ASSERT_PRINTF(be == bx, \
+ #e " == " #x \
+ " (value: %d == %s," \
+ " expected: %d == %s)\n", \
+ be, v2s(be), bx, v2s(bx)); \
+ } while (0)
+
+
+/* short forms */
+#define MARS_TEST_ASSERT_EQUAL(e, x) MARS_TEST_ASSERT_EQUAL_INT(e, x)
+#define MARS_TEST_ASSERT_ERROR(e, x) MARS_TEST_ASSERT_ENUM(e, x, mars_test_strerr)
+
+
+/*** internal macros and functions. don't use directly. ***/
+#define __MARS_TEST_STRING_EXPAND(s) __MARS_TEST_STRING(s)
+#define __MARS_TEST_STRING(s) #s
+
+#define __MARS_TEST_ENUM_STR(e) case e: return # e
+static inline const char *mars_test_strerr(int err)
+{
+ switch (err) {
+ __MARS_TEST_ENUM_STR(MARS_SUCCESS);
+ __MARS_TEST_ENUM_STR(MARS_ERROR_NULL);
+ __MARS_TEST_ENUM_STR(MARS_ERROR_PARAMS);
+ __MARS_TEST_ENUM_STR(MARS_ERROR_INTERNAL);
+ __MARS_TEST_ENUM_STR(MARS_ERROR_MEMORY);
+ __MARS_TEST_ENUM_STR(MARS_ERROR_ALIGN);
+ __MARS_TEST_ENUM_STR(MARS_ERROR_LIMIT);
+ __MARS_TEST_ENUM_STR(MARS_ERROR_STATE);
+ __MARS_TEST_ENUM_STR(MARS_ERROR_FORMAT);
+ __MARS_TEST_ENUM_STR(MARS_ERROR_BUSY);
+ default:
+ return "UNKNOWN";
+ }
+}
+
+#endif /* COMMON_MARS_TEST_H */
diff --git a/tests/include/host/mars_test.h b/tests/include/host/mars_test.h
new file mode 100644
index 0000000..9a9f251
--- /dev/null
+++ b/tests/include/host/mars_test.h
@@ -0,0 +1,181 @@
+/*
+ * Copyright 2008 Sony Corporation
+ *
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a copy
+ * of this software and associated documentation files (the "Software"), to deal
+ * in the Software without restriction, including without limitation the rights
+ * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+ * copies of the Software, and to permit persons to whom the Software is
+ * furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included in
+ * all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+ * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+ * THE SOFTWARE.
+ */
+
+#ifndef HOST_MARS_TEST_H
+#define HOST_MARS_TEST_H 1
+
+#include "../common/mars_test.h"
+
+#include <unistd.h>
+#include <stdio.h>
+#include <math.h>
+
+#define MARS_TEST_BUFSIZ 128
+
+static inline uint32_t mars_test_lwarx(const void *p)
+{
+ uint32_t r;
+ asm volatile("lwarx %[r],0,%[p]" : [r]"=r"(r) : [p]"b"(p));
+ return r;
+}
+
+static inline uint32_t mars_test_stwcx(void *p, uint32_t v)
+{
+ uint32_t r;
+ asm volatile("stwcx. %[v],0,%[p]\n"
+ "mfcr %[r]" : [r]"=r"(r) : [p]"b"(p), [v]"r"(v));
+ return r & 0x20000000;
+}
+
+static inline void mars_test_lwsync(void)
+{
+ asm volatile("lwsync");
+}
+
+static inline void mars_test_counter_set(uint32_t *ptr, uint32_t val)
+{
+ mars_test_lwsync();
+
+ *ptr = val;
+}
+
+static inline uint32_t mars_test_counter_get(uint32_t *ptr)
+{
+ return *ptr;
+}
+
+static inline uint32_t mars_test_counter_add(uint32_t *ptr, int32_t diff)
+{
+ uint32_t cur;
+
+ mars_test_lwsync();
+
+ do {
+ cur = mars_test_lwarx(ptr);
+ cur += diff;
+ } while (!mars_test_stwcx(ptr, cur));
+
+ return cur;
+}
+
+static inline void mars_test_counter_wait(uint32_t *ptr, uint32_t val)
+{
+ while (*ptr != val)
+ usleep(1);
+}
+
+static inline int mars_test_get_timebase_freq(uint32_t *timebase_freq)
+{
+ FILE *fp;
+ char string[MARS_TEST_BUFSIZ];
+
+ fp = fopen("/proc/cpuinfo", "r");
+ if (fp == NULL)
+ return -1;
+
+ while (feof(fp) == 0) {
+ string[MARS_TEST_BUFSIZ - 1] = '\0';
+ if (fgets(string, MARS_TEST_BUFSIZ - 1, fp) == NULL &&
+ ferror(fp) != 0) {
+ return -1;
+ }
+
+ sscanf(string, "timebase : %u", timebase_freq);
+ }
+
+ if (fclose(fp) == EOF)
+ return -1;
+
+ return 0;
+}
+/* performance test support */
+
+#define MARS_TEST_PERF_INIT() /* do nothing */
+
+#define MARS_TEST_MESSAGE(f...) \
+ do { \
+ fprintf(stderr, \
+ MARS_TEST_NAME ": # " __FILE__ ":" \
+ __MARS_TEST_STRING_EXPAND(__LINE__) \
+ ": " f); \
+ } while (0)
+
+#define MARS_TEST_PERF_RESULT_PRINT(tag, ticks) \
+ do { \
+ uint32_t __freq; \
+ int64_t __ticks = (ticks); \
+ mars_test_get_timebase_freq(&__freq); \
+ fprintf(stderr, MARS_TEST_NAME ": PERF: %s: %lld ticks: %f msec\n", \
+ tag, __ticks, \
+ (double)__ticks * 1000.0 / (double)__freq); \
+ } while (0)
+
+static inline void mars_test_tally_statistics(const int32_t *ticks, int count,
+ double *average, double *variance, int32_t *maximum, int32_t *minimum)
+{
+ int i;
+
+ *average = 0.0;
+ *maximum = INT32_MIN;
+ *minimum = INT32_MAX;
+
+ for (i = 0; i < count; i++) {
+ *average += ticks[i];
+ if (*maximum < ticks[i])
+ *maximum = ticks[i];
+ if (*minimum > ticks[i])
+ *minimum = ticks[i];
+ }
+ *average /= count;
+
+ *variance = 0.0;
+ for (i = 0; i < count; i++) {
+ double tmp = ticks[i] - *average;
+ *variance += tmp * tmp;
+ }
+ *variance = sqrt(*variance / count);
+}
+
+static inline void mars_test_print_statistics(
+ const int32_t *ticks, int count, char *description)
+{
+ double ave, var;
+ int32_t max, min;
+ char buf[256];
+
+ mars_test_tally_statistics(ticks, count, &ave, &var, &max, &min);
+
+ sprintf(buf, "%s: average", description);
+ MARS_TEST_PERF_RESULT_PRINT(buf, (int64_t)ave);
+
+ sprintf(buf, "%s: variance", description);
+ MARS_TEST_PERF_RESULT_PRINT(buf, (int64_t)var);
+
+ sprintf(buf, "%s: maximum", description);
+ MARS_TEST_PERF_RESULT_PRINT(buf, max);
+
+ sprintf(buf, "%s: minimum", description);
+ MARS_TEST_PERF_RESULT_PRINT(buf, min);
+}
+
+#endif /* HOST_MARS_TEST_H */
diff --git a/tests/include/mpu/mars_task_test.h b/tests/include/mpu/mars_task_test.h
new file mode 100644
index 0000000..bd798bc
--- /dev/null
+++ b/tests/include/mpu/mars_task_test.h
@@ -0,0 +1,31 @@
+/*
+ * Copyright 2008 Sony Corporation
+ *
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a copy
+ * of this software and associated documentation files (the "Software"), to deal
+ * in the Software without restriction, including without limitation the rights
+ * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+ * copies of the Software, and to permit persons to whom the Software is
+ * furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included in
+ * all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+ * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+ * THE SOFTWARE.
+ */
+
+#ifndef MPU_MARS_TASK_TEST_H
+#define MPU_MARS_TASK_TEST_H 1
+
+#define MARS_TEST_ABORT mars_task_exit(1)
+
+#include "mars_test.h"
+
+#endif /* MPU_MARS_TASK_TEST_H */
diff --git a/tests/include/mpu/mars_test.h b/tests/include/mpu/mars_test.h
new file mode 100644
index 0000000..9ebac9d
--- /dev/null
+++ b/tests/include/mpu/mars_test.h
@@ -0,0 +1,175 @@
+/*
+ * Copyright 2008 Sony Corporation
+ *
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a copy
+ * of this software and associated documentation files (the "Software"), to deal
+ * in the Software without restriction, including without limitation the rights
+ * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+ * copies of the Software, and to permit persons to whom the Software is
+ * furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included in
+ * all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+ * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+ * THE SOFTWARE.
+ */
+
+#ifndef MPU_MARS_TEST_H
+#define MPU_MARS_TEST_H 1
+
+#ifndef MARS_TEST_ABORT
+# define MARS_TEST_ABORT exit(1)
+#endif /* !MARS_TEST_ABORT */
+
+#include "../common/mars_test.h"
+
+#include <spu_mfcio.h>
+
+static inline void mars_test_int32_put(uint64_t ea, uint32_t val)
+{
+ const int tag = 0;
+ static uint32_t buf[4] __attribute__((aligned(16)));
+ int offset = ((ea & 0x0f) >> 2);
+
+ buf[offset] = val;
+ mfc_put(&buf[offset], ea, sizeof(buf[0]), tag, 0, 0);
+ mfc_write_tag_mask(1 << tag);
+ mfc_read_tag_status_all();
+}
+
+static inline uint32_t mars_test_int32_get(uint64_t ea)
+{
+ const int tag = 0;
+ static uint32_t buf[4] __attribute__((aligned(16)));
+ int offset = ((ea & 0x0f) >> 2);
+
+ mfc_get(&buf[offset], ea, sizeof(buf[0]), tag, 0, 0);
+ mfc_write_tag_mask(1 << tag);
+ mfc_read_tag_status_all();
+
+ return buf[offset];
+}
+
+static inline void mars_test_int64_put(uint64_t ea, uint64_t val)
+{
+ const int tag = 0;
+ static uint64_t buf[2] __attribute__((aligned(16)));
+ int offset = ((ea & 0x0f) >> 3);
+
+ buf[offset] = val;
+ mfc_put(&buf[offset], ea, sizeof(buf[0]), tag, 0, 0);
+ mfc_write_tag_mask(1 << tag);
+ mfc_read_tag_status_all();
+}
+
+static inline uint64_t mars_test_int64_get(uint64_t ea)
+{
+ const int tag = 0;
+ static uint64_t buf[2] __attribute__((aligned(16)));
+ int offset = ((ea & 0x0f) >> 3);
+
+ mfc_get(&buf[offset], ea, sizeof(buf[0]), tag, 0, 0);
+ mfc_write_tag_mask(1 << tag);
+ mfc_read_tag_status_all();
+
+ return buf[offset];
+}
+
+static inline void mars_test_counter_set(uint64_t ea, uint32_t val)
+{
+ const int tag = 0;
+
+ mfc_sync(tag);
+ mars_test_int32_put(ea, val);
+}
+
+static inline uint32_t mars_test_counter_get(uint64_t ea)
+{
+ return mars_test_int32_get(ea);
+}
+
+static inline uint32_t mars_test_counter_add(uint64_t ea, int32_t diff)
+{
+ const int tag = 0;
+ static uint32_t buf[32] __attribute__((aligned(128)));
+ int offset = ((ea & 0x7f) >> 2);
+
+ mfc_sync(tag);
+
+ do {
+ spu_write_event_mask(MFC_LLR_LOST_EVENT);
+ spu_write_event_ack(MFC_LLR_LOST_EVENT);
+
+ mfc_getllar(&buf, ea, 0, 0);
+ mfc_read_atomic_status();
+
+ buf[offset] += diff;
+ spu_dsync();
+ mfc_putllc(&buf, ea & ~0x7fLLU, 0, 0);
+ } while (mfc_read_atomic_status() & MFC_PUTLLC_STATUS);
+
+ return buf[offset];
+}
+
+static inline void mars_test_counter_wait(uint64_t ea, uint32_t val)
+{
+ static uint32_t buf[32] __attribute__((aligned(128)));
+ int cont = 1;
+ do {
+ spu_write_event_mask(MFC_LLR_LOST_EVENT);
+ spu_write_event_ack(MFC_LLR_LOST_EVENT);
+
+ mfc_getllar(&buf, ea & ~0x7fLLU, 0, 0);
+ mfc_read_atomic_status();
+
+ if (buf[(ea & 0x7f) >> 2] == val)
+ cont = 0;
+ else
+ spu_read_event_status();
+ } while (cont);
+}
+
+static inline void mars_test_usleep(uint32_t timebase_freq, uint32_t usec)
+{
+ uint32_t wait_count, initial, target, tick;
+
+ if (usec == 0)
+ return;
+
+ initial = spu_read_decrementer();
+ wait_count = (uint64_t)timebase_freq * usec / 1000000;
+ target = initial - wait_count;
+
+ if (target < initial) {
+ do {
+ tick = spu_read_decrementer();
+ } while (target < tick && tick < initial);
+ } else {
+ do {
+ tick = spu_read_decrementer();
+ } while (tick < initial || target < tick);
+ }
+}
+
+static inline void mars_test_sleep(uint32_t timebase_freq, uint32_t sec)
+{
+ mars_test_usleep(timebase_freq, sec * 1000000);
+}
+
+/* performance test support */
+
+#define MARS_TEST_PERF_INIT() /* do nothing */
+
+static inline void MARS_TEST_PERF_RESULT_SUBMIT(uint64_t ea, uint32_t time)
+{
+ mars_test_int32_put(ea, time);
+}
+
+#endif /* MPU_MARS_TEST_H */
diff --git a/tests/scripts/config.mk b/tests/scripts/config.mk
new file mode 100644
index 0000000..b5c9fc1
--- /dev/null
+++ b/tests/scripts/config.mk
@@ -0,0 +1,96 @@
+#
+# Copyright 2008 Sony Corporation
+#
+#
+# Permission is hereby granted, free of charge, to any person obtaining a copy
+# of this software and associated documentation files (the "Software"), to deal
+# in the Software without restriction, including without limitation the rights
+# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+# copies of the Software, and to permit persons to whom the Software is
+# furnished to do so, subject to the following conditions:
+#
+# The above copyright notice and this permission notice shall be included in
+# all copies or substantial portions of the Software.
+#
+# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+# THE SOFTWARE.
+#
+
+CROSS =
+CC = $(CROSS)gcc
+CFLAGS = \
+ -I$(top_srcdir)/include/host \
+ -g -Wall $(OPT_CFLAGS) $(DEFS_CFLAGS) \
+ $(ARCH_CFLAGS) $(INCLUDE_CFLAGS) $(EXTRA_CFLAGS)
+LDFLAGS = \
+ -lmars_task -lmars_core -lspe2 \
+ $(LIB_LDFLAGS) $(EXTRA_LDFLAGS)
+EMBEDSPU = $(CROSS)embedspu
+
+MPU_TYPE = spu
+MPU_CROSS = $(MPU_TYPE)-
+MPU_CC = $(MPU_CROSS)gcc
+MPU_CFLAGS = \
+ -I$(top_srcdir)/include/mpu \
+ -g -Wall $(OPT_CFLAGS) $(DEFS_CFLAGS) \
+ $(MPU_INCLUDE_CFLAGS) $(EXTRA_MPU_CFLAGS)
+MPU_TASK_CFLAGS = \
+ $(MPU_CFLAGS)
+MPU_LDFLAGS = \
+ -lmars_task -lmars_core \
+ -Wl,-gc-sections \
+ $(MPU_LIB_LDFLAGS) $(EXTRA_MPU_LDFLAGS)
+MPU_TASK_LDFLAGS = \
+ $(MPU_LDFLAGS) \
+ -Wl,-N -Wl,--section-start,.init=0x8000
+
+OPT_CFLAGS = -O3
+DEFS_CFLAGS = -DMARS_TEST_NAME=\"$(test)\"
+
+# Internal common variables
+test = $(notdir $(shell pwd))
+
+ifneq ($(ARCH),)
+ ARCH_CFLAGS = -m$(ARCH)
+endif
+
+ifneq ($(MARS_SRC),)
+ MARS_BUILD = $(MARS_SRC)
+
+ INCLUDE_CFLAGS = \
+ -I$(MARS_SRC)/include/host \
+ -I$(MARS_SRC)/include/common
+ LIB_LDFLAGS = -L$(MARS_BUILD)/src/host/lib/.libs
+
+ MPU_INCLUDE_CFLAGS = \
+ -I$(MARS_SRC)/include/mpu \
+ -I$(MARS_SRC)/include/common
+ MPU_LIB_LDFLAGS = -L$(MARS_BUILD)/src/mpu/lib
+
+ RUN_LD_LIBRARY_PATH = LD_LIBRARY_PATH=$(MARS_BUILD)/src/host/lib/.libs
+else
+ifneq ($(MARS_PREFIX),)
+ INCLUDE_CFLAGS = -I$(MARS_PREFIX)/include
+ LIB_LDFLAGS = -L$(MARS_PREFIX)/lib$(ARCH) -L$(MARS_PREFIX)/lib
+
+ MPU_INCLUDE_CFLAGS = -I$(MARS_PREFIX)/$(MPU_TYPE)/include
+ MPU_LIB_LDFLAGS = -L$(MARS_PREFIX)/$(MPU_TYPE)/lib
+
+ RUN_LD_LIBRARY_PATH = LD_LIBRARY_PATH=$(MARS_PREFIX)/lib$(ARCH):$(MARS_PREFIX)/lib
+endif
+endif
+
+ifneq ($(RUN_LD_LIBRARY_PATH),)
+ifneq ($(LD_LIBRARY_PATH),)
+ RUN_LD_LIBRARY_PATH += :$(LD_LIBRARY_PATH)
+endif
+endif
+
+RUN_ENV = $(RUN_LD_LIBRARY_PATH) TIMEOUT=$(timeout)
+
+# EOF
diff --git a/tests/scripts/config_internal.mk b/tests/scripts/config_internal.mk
new file mode 100644
index 0000000..846f3c0
--- /dev/null
+++ b/tests/scripts/config_internal.mk
@@ -0,0 +1,30 @@
+#
+# Copyright 2008 Sony Corporation
+#
+#
+# Permission is hereby granted, free of charge, to any person obtaining a copy
+# of this software and associated documentation files (the "Software"), to deal
+# in the Software without restriction, including without limitation the rights
+# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+# copies of the Software, and to permit persons to whom the Software is
+# furnished to do so, subject to the following conditions:
+#
+# The above copyright notice and this permission notice shall be included in
+# all copies or substantial portions of the Software.
+#
+# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+# THE SOFTWARE.
+#
+
+include $(top_srcdir)/scripts/config.mk
+
+INCLUDE_CFLAGS += \
+ -I$(MARS_SRC)/src/host/lib
+
+MPU_INCLUDE_CFLAGS += \
+ -I$(MARS_SRC)/src/mpu/lib
diff --git a/tests/scripts/desc.sh b/tests/scripts/desc.sh
new file mode 100644
index 0000000..70d2fa0
--- /dev/null
+++ b/tests/scripts/desc.sh
@@ -0,0 +1,63 @@
+#!/bin/sh
+#
+# Copyright 2008 Sony Corporation
+#
+#
+# Permission is hereby granted, free of charge, to any person obtaining a copy
+# of this software and associated documentation files (the "Software"), to deal
+# in the Software without restriction, including without limitation the rights
+# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+# copies of the Software, and to permit persons to whom the Software is
+# furnished to do so, subject to the following conditions:
+#
+# The above copyright notice and this permission notice shall be included in
+# all copies or substantial portions of the Software.
+#
+# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+# THE SOFTWARE.
+#
+# Usage: desc.sh <TEST_ID>
+#
+
+scripts_dir="`dirname $0`"
+
+. "$scripts_dir"/run_functions
+
+list="$scripts_dir/tests.csv"
+
+for t in "$@"
+do
+ id="`echo $t|sed -e 's,_,,g'`"
+ awk '
+BEGIN {
+ FS=";"
+}
+$4 == "'$id'" {
+ printf("\n")
+
+ printf("Class: %s\n", $3)
+ printf("Id: %s\n", $4)
+ printf("Processor: %s\n", $7)
+ printf("Function: %s\n", $8);
+
+ summary = $9
+ sub(/^"/, "", summary)
+ sub(/"[[:space:]]*$/, "", summary)
+ printf("Summary: %s\n", summary);
+
+ desc = $0
+ sub(/^[^;]*;[^;]*;[^;]*;[^;]*;[^;]*;[^;]*;[^;]*;[^;]*;[^;]*;/, "", desc)
+ sub(/^"/, "", desc)
+ sub(/"[[:space:]]*$/, "", desc)
+ gsub(/\f/, "\n", desc)
+
+ printf("Description:\n")
+ print desc | "fold -c68 -s | sed -e \"s,^, ,\""
+}
+' "$list"
+done
diff --git a/tests/scripts/rules_class.mk b/tests/scripts/rules_class.mk
new file mode 100644
index 0000000..4a14d19
--- /dev/null
+++ b/tests/scripts/rules_class.mk
@@ -0,0 +1,44 @@
+#
+# Copyright 2008 Sony Corporation
+#
+#
+# Permission is hereby granted, free of charge, to any person obtaining a copy
+# of this software and associated documentation files (the "Software"), to deal
+# in the Software without restriction, including without limitation the rights
+# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+# copies of the Software, and to permit persons to whom the Software is
+# furnished to do so, subject to the following conditions:
+#
+# The above copyright notice and this permission notice shall be included in
+# all copies or substantial portions of the Software.
+#
+# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+# THE SOFTWARE.
+#
+
+.PHONY: all build check clean distclean clean-top
+
+all: build
+
+build:
+ @for d in $(test_items); do $(MAKE) -C $$d all || exit 1; done
+
+check:
+ @$(top_srcdir)/scripts/run_items.sh $(test) $(test_items)
+
+clean: clean-top
+ -for d in $(test_items); do $(MAKE) -s -C $$d clean; done
+
+clean-top:
+ -rm -f .stamp*
+
+distclean: clean-top
+ -rm -f *~ check.log
+ -for d in $(test_items); do $(MAKE) -s -C $$d distclean; done
+
+# EOF
diff --git a/tests/scripts/rules_item.mk b/tests/scripts/rules_item.mk
new file mode 100644
index 0000000..1890a3a
--- /dev/null
+++ b/tests/scripts/rules_item.mk
@@ -0,0 +1,69 @@
+#
+# Copyright 2008 Sony Corporation
+#
+#
+# Permission is hereby granted, free of charge, to any person obtaining a copy
+# of this software and associated documentation files (the "Software"), to deal
+# in the Software without restriction, including without limitation the rights
+# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+# copies of the Software, and to permit persons to whom the Software is
+# furnished to do so, subject to the following conditions:
+#
+# The above copyright notice and this permission notice shall be included in
+# all copies or substantial portions of the Software.
+#
+# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+# THE SOFTWARE.
+#
+
+.SUFFIXES: .o .mpu_eo .mpu .mpu_o .task_eo .task .task_o
+.c.o:
+ $(CC) $(CFLAGS) -c -o $@ $<
+.c.mpu_o:
+ $(MPU_CC) $(MPU_CFLAGS) -c -o $@ $<
+.mpu_o.mpu:
+ $(MPU_CC) $(MPU_CFLAGS) -o $@ $< $(MPU_LDFLAGS)
+.mpu.mpu_eo:
+ $(EMBEDSPU) $(CFLAGS) $*_prog $< $@
+.c.task_o:
+ $(MPU_CC) $(MPU_TASK_CFLAGS) -c -o $@ $<
+.task_o.task:
+ $(MPU_CC) $(MPU_TASK_CFLAGS) -o $@ $< $(MPU_TASK_LDFLAGS)
+.task.task_eo:
+ $(EMBEDSPU) $(CFLAGS) $*_prog $< $@
+
+# don't remove intermediate files for debugging
+.SECONDARY:
+
+.PHONY: all build progs check clean distclean desc
+
+all: build
+
+build:
+ @echo "$(test): COMPILING" >&2
+ @$(MAKE) progs
+
+progs: $(test)
+
+$(test): $(test_objs)
+ $(CC) $(CFLAGS) -o $@ $(test_objs) $(LDFLAGS)
+
+check: build
+ $(RUN_ENV) $(top_srcdir)/scripts/run.sh $(test) ./$(test)
+
+desc:
+ @$(top_srcdir)/scripts/desc.sh $(test)
+
+clean:
+ -rm -f *.o *.mpu_eo *.mpu *.mpu_o *.task_o *.task *.task_eo $(test) check.log
+ -rm -f .stamp*
+
+distclean: clean
+ -rm -f *~ check.log
+
+# EOF
diff --git a/tests/scripts/run.sh b/tests/scripts/run.sh
new file mode 100644
index 0000000..7f57d84
--- /dev/null
+++ b/tests/scripts/run.sh
@@ -0,0 +1,105 @@
+#!/bin/sh
+#
+# Copyright 2008 Sony Corporation
+#
+#
+# Permission is hereby granted, free of charge, to any person obtaining a copy
+# of this software and associated documentation files (the "Software"), to deal
+# in the Software without restriction, including without limitation the rights
+# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+# copies of the Software, and to permit persons to whom the Software is
+# furnished to do so, subject to the following conditions:
+#
+# The above copyright notice and this permission notice shall be included in
+# all copies or substantial portions of the Software.
+#
+# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+# THE SOFTWARE.
+#
+# Usage: <NAME> <COMMAND> [<COMMAND-ARGS>]
+#
+
+TIMEOUT=${TIMEOUT:-30}
+
+scripts_dir="`dirname $0`"
+
+. "$scripts_dir"/run_functions
+
+name="$1"
+shift
+
+log="check.log"
+
+abort_command()
+{
+ echo >&2
+ echo "Abort $test_pid" >&2
+
+ if [ -n "$timer_pid" ]; then
+ kill -USR1 $timer_pid 2>/dev/null
+ fi
+ if [ -n "$test_pid" ]; then
+ kill -KILL $test_pid 2>/dev/null
+ fi
+}
+
+stop_timer()
+{
+ if [ -n "$sleep_pid" ]; then
+ kill -KILL $sleep_pid 2>/dev/null
+ fi
+ timer_aborted=1
+}
+
+run_command()
+{
+ trap 'abort_command' TERM INT PIPE
+ trap 'stop_timer' USR1
+
+ echo "$name: RUNNING" >&2
+ test_pid=
+ "$@" &
+ test_pid=$!
+
+ (
+ trap 'stop_timer' USR1
+ sleep_pid=
+ sleep $TIMEOUT &
+ sleep_pid=$!
+
+ if [ "$timer_aborted" = 1 ]; then
+ kill -KILL $sleep_pid 2>/dev/null
+ fi
+
+ wait $sleep_pid 2>/dev/null
+ if [ "$?" = 0 ]; then
+ kill -KILL $test_pid 2>/dev/null
+ echo "$name: TIMEOUT ($TIMEOUT seconds)" >&2
+ fi
+ ) &
+ timer_pid=$!
+
+ wait $test_pid
+ result=$?
+
+ kill -USR1 $timer_pid 2>/dev/null
+
+ if [ "$result" = 0 ]; then
+ echo "$name: PASS" >&2
+ else
+ echo "$name: FAIL" >&2
+ fi
+
+ return $result
+}
+
+
+rm -f "$log"
+run_log "$log" run_command "$@"
+
+# EOF
diff --git a/tests/scripts/run_classes.sh b/tests/scripts/run_classes.sh
new file mode 100644
index 0000000..68aa71f
--- /dev/null
+++ b/tests/scripts/run_classes.sh
@@ -0,0 +1,47 @@
+#!/bin/sh
+#
+# Copyright 2008 Sony Corporation
+#
+#
+# Permission is hereby granted, free of charge, to any person obtaining a copy
+# of this software and associated documentation files (the "Software"), to deal
+# in the Software without restriction, including without limitation the rights
+# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+# copies of the Software, and to permit persons to whom the Software is
+# furnished to do so, subject to the following conditions:
+#
+# The above copyright notice and this permission notice shall be included in
+# all copies or substantial portions of the Software.
+#
+# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+# THE SOFTWARE.
+#
+
+scripts_dir="`dirname $0`"
+
+. "$scripts_dir"/run_functions
+
+classes="$@"
+log="check.log"
+
+rm -f "$log"
+for c in $classes
+do
+ run_log "$log" run_make -C "$c" check
+ if [ "$?" = 0 ]; then
+ passed="$passed $c"
+ else
+ failed="$failed $c"
+ fi
+done
+
+show_summary "Summary (all)" "$passed" "$failed" | tee -a $log
+
+[ -z "$failed" ]
+
+# EOF
diff --git a/tests/scripts/run_functions b/tests/scripts/run_functions
new file mode 100644
index 0000000..7066cf6
--- /dev/null
+++ b/tests/scripts/run_functions
@@ -0,0 +1,73 @@
+#!/bin/sh
+#
+# Copyright 2008 Sony Corporation
+#
+#
+# Permission is hereby granted, free of charge, to any person obtaining a copy
+# of this software and associated documentation files (the "Software"), to deal
+# in the Software without restriction, including without limitation the rights
+# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+# copies of the Software, and to permit persons to whom the Software is
+# furnished to do so, subject to the following conditions:
+#
+# The above copyright notice and this permission notice shall be included in
+# all copies or substantial portions of the Software.
+#
+# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+# THE SOFTWARE.
+#
+
+
+run_make()
+{
+ local opt
+ if [ -z "$VERBOSE" -o "$VERBOSE" = 0 ]; then
+ opt="-s"
+ fi
+ make $opt "$@"
+}
+
+run_log()
+{
+ local log="$1"
+ shift
+
+ local stamp=".stamp.$$"
+
+ rm -f $stamp
+ ( ( "$@" || touch $stamp ) 2>&1 | tee -a "$log" )
+ [ ! -e $stamp ]
+ local result="$?"
+
+ rm -f $stamp
+
+ return $result
+}
+
+show_summary()
+{
+ local title="$1"
+ local passed="$2"
+ local failed="$3"
+
+ local num_pass="`echo $passed | wc | awk '{print $2}'`"
+ local num_fail="`echo $failed | wc | awk '{print $2}'`"
+ local num_total="`expr $num_pass + $num_fail`"
+
+cat <<EOF
+==========================
+$title
+
+PASS: $num_pass/$num_total: $passed
+
+FAIL: $num_fail/$num_total: $failed
+==========================
+EOF
+}
+
+# EOF
diff --git a/tests/scripts/run_items.sh b/tests/scripts/run_items.sh
new file mode 100644
index 0000000..75ab47e
--- /dev/null
+++ b/tests/scripts/run_items.sh
@@ -0,0 +1,52 @@
+#!/bin/sh
+#
+# Copyright 2008 Sony Corporation
+#
+#
+# Permission is hereby granted, free of charge, to any person obtaining a copy
+# of this software and associated documentation files (the "Software"), to deal
+# in the Software without restriction, including without limitation the rights
+# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+# copies of the Software, and to permit persons to whom the Software is
+# furnished to do so, subject to the following conditions:
+#
+# The above copyright notice and this permission notice shall be included in
+# all copies or substantial portions of the Software.
+#
+# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+# THE SOFTWARE.
+#
+# Usage: <NAME> <TEST-1> [<TEST-2> ... <TEST-N>]
+#
+
+scripts_dir="`dirname $0`"
+
+. "$scripts_dir"/run_functions
+
+name="$1"
+shift
+
+items="$@"
+log="check.log"
+
+rm -f "$log"
+for i in $items
+do
+ run_log "$log" run_make -C "$i" check
+ if [ "$?" = 0 ]; then
+ passed="$passed $i"
+ else
+ failed="$failed $i"
+ fi
+done
+
+show_summary "Summary ($name)" "$passed" "$failed" | tee -a $log
+
+[ -z "$failed" ]
+
+# EOF
diff --git a/tests/scripts/tests.csv b/tests/scripts/tests.csv
new file mode 100644
index 0000000..f41ca31
--- /dev/null
+++ b/tests/scripts/tests.csv
@@ -0,0 +1,359 @@
+TICKET#;STATUS;CLASS;ID;DIFFICULT;PRIORITY;PROCESSOR;FUNCTION(S);DESCRIPTION;DETAILS
+13;closed;POS. FUNC.;TFP11001;N;B;HOST;mars_task_create;"Check if a MARS task is initialized correctly with context_save_size=0.";"Call mars_task_create with context_save_size=0 and name=NULL and check if the call returns MARS_SUCCESS."
+14;closed;POS. FUNC.;TFP11002;N;A;HOST;mars_task_create;"Check if a MARS task is initialized correctly with context_save_size=MARS_TASK_CONTEXT_SAVE_SIZE_MAX.";"Call mars_task_create with context_save_size=MAX_TASK_CONTEXT_SAVE_SIZE_MAX and name=NULL and check if the call returns MARS_SUCCESS."
+15;closed;POS. FUNC.;TFP11003;N;A;HOST;mars_task_create;"Check if the same number of MARS tasks as physical MPU are initialized correctly.";"Call mars_task_create the number of times same as physical MPUs and check if the all calls returns MARS_SUCCESS."
+16;closed;POS. FUNC.;TFP11004;N;B;HOST;mars_task_create;"Check if the same number of MARS tasks as that of physical MPU+1 are initialized correctly.";"Call mars_task_create the number of times same as what added 1 to physical MPUs and check if the all calls returns MARS_SUCCESS."
+17;closed;POS. FUNC.;TFP11005;N;B;HOST;mars_task_create;"Check if the upper limit number of MARS tasks are initialized correctly.";"Call mars_task_create the number of times same as MARS_WORKLOAD_MAX and check if all calls returns MARS_SUCCESS."
+18;closed;POS. FUNC.;TFP11006;N;A;HOST;mars_task_create;"Check if mars_task_create is thread-safe.";"Create MARS tasks respectively for multiple host side threads with same MARS context by calling mars_task_create simultaneously and check if all calls return MARS_SUCCESS."
+19;closed;POS. FUNC.;TFP12001;N;A;HOST;mars_task_destroy;"Check if a MARS task is finalized correctly without execution.";"The state of a new task is 'finished state' and can be finalized. Create a MARS task and call mars_task_destroy to destroy it without executing it. Check if the return value is MARS_TASK_SUCCESS."
+20;closed;POS. FUNC.;TFP12002;N;A;HOST;mars_task_destroy;"Check if a MARS task is finalized correctly after execution.";"Create a MARS task and execute it. After the execution is completed, call mars_task_destroy and check if the return value is MARS_TASK_SUCCESS."
+21;closed;POS. FUNC.;TFP12003;N;A;HOST;mars_task_destroy;"Check if mars_task_destroy is thread-safe.";"Create MARS tasks respectively for multiple host side threads with same the MARS context. After that call mars_task_destroy on all threads simultaneously and check if all calls return MARS_SUCCESS."
+22;closed;POS. FUNC.;TFP11007;N;B;HOST;mars_task_create/mars_task_destroy;"Check if mars_task_create and mars_task_destroy are thread-safe.";"Create MARS tasks by multiple host side threads. After that call mars_task_destroy by those threads and call mars_task_create by other multiple host side threads simultaneously. Check if the all calls return MARS_SUCCESS."
+23;closed;POS. FUNC.;TFP13001;N;B;HOST;mars_task_schedule/mars_task_wait;"Check if a MARS task is executed with args=NULL and able to path the return code correctly.";"Create a MARS task and call mars_task_schedule with args=NULL. Then, return a value from the MARS task, choosing one which seems to hardly appear by chance. And using mars_task_wait, get the value and check if it is correct and the all calls have returned MARS_SUCCESS or not."
+24;closed;POS. FUNC.;TFP13002;N;A;HOST;mars_task_schedule/mars_task_wait;"Check if a MARS task is executed correctly with args!=NULL.";"Create a MARS task and call mars_task_schedule with args!=NULL. Then, in the MARS task, check if the argument is correct and return a value, choosing one which seems to hardly appear by chance. And using mars_task_wait, get the value and check if it is correct and the all calls have returned MARS_SUCCESS or not."
+25;closed;POS. FUNC.;TFP13003;N;B;HOST;mars_task_schedule;"Check if a MARS task is executed correctly with priority=0 and priority=255.";"Check if the mars_task_schedule return MARS_SUCCESS when priotiry=0 and priority=255."
+26;closed;POS. FUNC.;TFP13004;Y;B;HOST;mars_task_schedule;"Check if a MARS task executed with priority=255 have higher priority than that of priority=1 actually.";"Execute MARS tasks of the number same as physical MPUs with priority=0. Then create and call mars_task_schedule for other new two task which priority=0 and priority=255. After that call mars_task_yield from one of the tasks which priority=0 and check the tasks is switched to that of priority=255 actually."
+27;closed;POS. FUNC.;TFP13005;N;B;HOST;mars_task_schedule;"Check if the same number of MARS tasks as physical MPU allocated by MARS context are simultaneously executed correctly.";""
+28;closed;POS. FUNC.;TFP13006;N;A;HOST;mars_task_schedule;"Check if the same number of MARS tasks as that of MPU+1 allocated by MARS context are simultaneously executed correctly.";""
+29;closed;POS. FUNC.;TFP13007;N;C;HOST;mars_task_schedule;"Check if the upper limit number of MARS tasks are simultaneously executed correctly.";""
+30;closed;POS. FUNC.;TFP13008;N;A;HOST;mars_task_schedule;"Check if task_schedule is thread-safe.";"Check if MARS task are executed correctly when multiple host-side threads call mars_task_schedule simultaneously."
+31;closed;POS. FUNC.;TFP14001;Y;A;HOST;mars_task_wait;"Check if mars_task_wait doesn't return until the specified task finishes.";""
+32;closed;POS. FUNC.;TFP14002;Y;C;HOST;mars_task_wait;"Check if all the host-side threads waiting for same one MARS task are woken up after the task has finished.";"Check if mars_task_wait is thread-safe, too. Refer [mars-sony 304]."
+33;closed;POS. FUNC.;TFP15001;Y;A;HOST;mars_task_try_wait;"Check if mars_task_try_wait succeeds when the id is valid and the task has finished.";""
+34;closed;POS. FUNC.;TFP15002;Y;A;HOST;mars_task_try_wait;"Check if mars_task_try_wait returns MARS_ERROR_BUSY when the id is valid and the task hasn't been finished.";""
+35;closed;POS. FUNC.;TFP17001;Y;A;MPU;mars_task_exit;"Check if the caller task finishes actually.";"How do we know a task have finished or not?"
+36;closed;POS. FUNC.;TFP18001;Y;A;MPU;mars_task_yield;"Check if the caller task is yielded actually when there are runnable tasks.";"When a task calls mars_task_yield and there are runnable state tasks, check if the caller is yielded and one of runnable state task is resumed actually."
+37;closed;POS. FUNC.;TFP18002;Y;B;MPU;mars_task_yield;"Check if the caller task isn't yielded when there are no runnable tasks.";"When a task calls mars_task_yield but there are no runnable state task, check if the caller isn't suspended."
+38;closed;POS. FUNC.;TFP19001;N;A;MPU;mars_task_get_kernel_id;"Check if the mars_task_get_kernel_id returns a valid id.";""
+39;closed;POS. FUNC.;TFP1A001;N;A;MPU;mars_task_get_id;"Check if the return value is correct.";"Pass id from PPE."
+40;closed;POS. FUNC.;TFP11008;N;A;HOST/MPU;mars_task_create/mars_task_get_name;"Check if a MARS task is initialized correctly with name=NULL.";"Call mars_task_create with context_save_size=MARS_TASK_CONTEXT_SIZE_MAX and name=NULL and check if the call returns MARS_SUCCESS. After that, using mars_task_get_name, check if the name is NULL on MARS_task."
+41;closed;POS. FUNC.;TFP11009;N;C;HOST/MPU;mars_task_create/mars_task_get_name;"Check if a MARS task is initialized correctly with name=??.";"Call mars_task_create with context_save_size=MARS_TASK_CONTEXT_SIZE_MAX and name=?? and check if the call returns MARS_SUCCESS. After that, using mars_task_get_name, check if the name is corrent on MARS_task."
+42;closed;POS. FUNC.;TFP11010;N;C;HOST/MPU;mars_task_create/mars_task_get_name;"Check if a MARS task is initialized correctly with name=?a?.";"Call mars_task_create with context_save_size=MARS_TASK_CONTEXT_SIZE_MAX and name=?a? and check if the call returns MARS_SUCCESS. After that, using mars_task_get_name, check if the name is corrent on MARS_task."
+43;closed;POS. FUNC.;TFP11011;N;A;HOST/MPU;mars_task_create/mars_task_get_name;"Check if a MARS task is initialized correctly with name which length equals to the upper limit.";"Call mars_task_create with context_save_size=MARS_TASK_CONTEXT_SIZE_MAX and the name which length(including '\0') equals to MARS_TASK_NAME_LEN_MAX and check if the call returns MARS_SUCCESS. After that, using mars_task_get_name, check if the name is corrent on MARS_task."
+45;closed;POS. FUNC.;TFP71002;N;A;MPU;mars_mutex_create;"Check if mars_mutex_create works correctly.";"Call mars_mutex_create and check if the return vallue is MARS_SUCCESS."
+46;closed;POS. FUNC.;TFP71003;Y;B;HOST;mars_mutex_create;"Check if mars_mutex_create is thread-safe.";"Check if something doen't go wrong when mars_mutex_create is called simaltaneously by multiple PPE threads."
+47;closed;POS. FUNC.;TFP71004;Y;B;MPU;mars_mutex_create;"Check if mars_mutex_create is thread-safe.";"Check if something doen't go wrong when mars_mutex_create is called simaltaneously by multiple MARS tasks."
+48;closed;POS. FUNC.;TFP71005;Y;C;HOST/MPU;mars_mutex_create;"Check if mars_mutex_create is thread-safe.";"Check if something doen't go wrong when mars_mutex_create is called simaltaneously by multiple PPE threads and MARS tasks."
+49;closed;POS. FUNC.;TFP74001;Y;A;HOST;mars_mutex_lock;"Check if only one host side thread can get a lock.";"Check if one mutex is't acquired by multiple PPE threads at the same time."
+50;closed;POS. FUNC.;TFP74002;Y;A;MPU;mars_mutex_lock;"Check if only one MARS task can get a lock.";"Check if one mutex is't acquired by multiple MARS tasks at the same time."
+51;closed;POS. FUNC.;TFP74003;Y;A;HOST/MPU;mars_mutex_lock;"Check if only one host side thread or MARS task can get lock.";"Check if one mutex is't acquired by multiple PPE threads or MARS tasks at the same time."
+52;closed;POS. FUNC.;TFP75001;Y;A;HOST;mars_mutex_unlock;"Check if another host side thread gets the lock immediately after a host side thread unlock it.";"Check if a mutex is aquired immediately by a PPE thread which have been waiting for it after the mutex is released by other PPE thread."
+53;closed;POS. FUNC.;TFP75002;Y;A;MPU;mars_mutex_unlock;"Check if another MARS task gets the lock immediately after a MARS task unlock it.";"Check if a mutex is aquired immediately by a MARS task which have been waiting for it after the mutex is released by other MARS task."
+54;closed;POS. FUNC.;TFP75003;Y;A;HOST/MPU;mars_mutex_unlock;"Check if a MARS task gets the lock immediately after the host side threads unlock it when there are multiple MARS task and one host side threads.";"When there are several MARS tasks which are waiting for a mutex and one PPE thread which is holding a mutex, check if one of the MARS tasks acquire the mutex immediately after the PPE thread releases it."
+55;closed;POS. FUNC.;TFP75004;Y;A;HOST/MPU;mars_mutex_unlock;"Check if a host side thread gets the lock immediately after the MARS task unlock it when there are multiple host side thread and one MARS task.";"When there are several PPE threads which are waiting for a mutex and one MARS task which is holding a mutex, check if one of the PPE threads acquire the mutex immediately after the MARS task releases it."
+56;closed;POS. FUNC.;TFP21001;N;B;HOST;mars_task_barrier_create;"Check if a task barrier is initialized correctly with total=1.";"Check if the return value is MARS_SUCCESS."
+57;closed;POS. FUNC.;TFP21002;N;A;HOST;mars_task_barrier_create;"Check if a task barrier is initialized correctly when total equals to the upper limit.";"Check if the return value is MARS_SUCCESS."
+58;closed;POS. FUNC.;TFP21003;N;B;HOST;mars_task_barrier_create;"Check if mars_task_barrier_create is thread-safe.";"Check if task barriers are initialized correctly when multiple host-side threads call mars_task_barrier_create simultaneously."
+59;closed;POS. FUNC.;TFP12004;N;B;MPU;mars_task_barrier_create;"Check if a task barrier is initialized correctly with total=1.";"Check if the return value is MARS_SUCCESS."
+60;closed;POS. FUNC.;TFP12005;N;A;MPU;mars_task_barrier_create;"Check if a task barrier is initialized correctly when total equals to the upper limit.";"Check if the return value is MARS_SUCCESS."
+61;closed;POS. FUNC.;TFP12006;Y;B;MPU;mars_task_barrier_create;"Check if mars_task_barrier_create is thread-safe.";"Check if task barriers are initialized correctly when multiple MARS tasks call mars_task_barrier_create simultaneously. Reservation Lost Event is useful for this test."
+62;closed;POS. FUNC.;TFP12007;Y;B;HOST/MPU;mars_task_barrier_create;"Check if mars_task_barrier_initialize with simultaneous usage of host and MPU side is thread-safe.";"Check if task barriers are initialized correctly when multiple host-die threads and MARS tasks call mars_task_barrier_create simultaneously. The combination of the polling the memory from PPU and Reservation Lost Event from SPE to the same memory region may be reasonable."
+63;closed;POS. FUNC.;TFP23001;Y;A;MPU;mars_task_barrier_notify;"Check if mars_task_barrier_notify succeeds.";"Check if mars_task_barrier_notify succeeds while total notification doesn't reach the argument total of mars_task_barrier_create."
+64;closed;POS. FUNC.;TFP23002;Y;A;MPU;mars_task_barrier_notify;"Check if mars_task_barrier_notify is thread-safe.";"Check if mars_task_barrier_notify is blocked when the number of MARS tasks exceeds the the argument of mars_task_barrier_initialize."
+65;closed;POS. FUNC.;TFP24001;Y;A;MPU;mars_task_barrier_wait;"Check if mars_task_barrier_wait succeeds when barrier_ea is valid.";"Call mars_task_barrier_wait after mars_task_barrier_notify, and check if the caller isn't blocked. The aim of this test is to check the caller is not blocked under the situation where it should not be blocked."
+66;closed;POS. FUNC.;TFP24002;Y;A;MPU;mars_task_barrier_wait;"Check if mars_task_barrier_wait doesn't return until the condition is met.";"Check if mars_task_barrier_wait doesn't return until the total notification reaches the argument total of mars_task_barrier_create. The aim of this test is to check the caller is blocked under the situation where it should be blocked."
+67;closed;POS. FUNC.;TFP24003;N;A;HOST;mars_task_barrier_wait;"Check if the barrier is cleared after the barrier synchronization is completed.";""
+68;closed;POS. FUNC.;TFP31001;N;A;HOST/MPU;mars_task_event_flag_create/mars_task_event_flag_try_wait;"Check if a task_event_flag is initialized correctly.";"(NOTE: This test needs the specification change of mars_task_event_flag_try_wait to be able to know which event occured.) After the initialization by mars_task_event_flag_create, get flags by mars_task_event_flag_try_wait and check if all the bits are cleared. Do this test with following condition: mars_task_initialize.direction=MARS_TASK_EVENT_FLAG_HOST_TO_MPU The caller of mars_task_event_flag_create is HOST. The caller of mars_task_event_flag_try_wait is MPU. Do this test about each combination of the following condition: mars_task_event_flag_initialize.clear_mode=MARS_TASK_EVENT_FLAG_CLEAR_AUTO,MATS_TASK_EVENT_FLAG_CLEAR_MANUAL mars_task_event_flag_try_wait.mask_mode=MARS_TASK_EVENT_FLAG_MASK_AND,MARS_TASK_EVENT_FLAG_MASK_OR"
+70;closed;POS. FUNC.;TFP31003;N;B;MPU;mars_task_event_flag_create/mars_task_event_flag_try_wait;"Check if a task_event_flag is initialized correctly.";"(NOTE: This test needs the specification change of mars_task_event_flag_try_wait to be able to know which event occured.) After the initialization by mars_task_event_flag_create, get flags by mars_task_event_flag_try_wait and check if all the bits are cleared. Do this test with following condition: mars_task_initialize.direction=MARS_TASK_EVENT_FLAG_MPU_TO_MPU The caller of mars_task_event_flag_create is HOST. The caller of mars_task_event_flag_try_wait is MPU. Do this test about each combination of the following condition: mars_task_event_flag_create.clear_mode=MARS_TASK_EVENT_FLAG_CLEAR_AUTO,MATS_TASK_EVENT_FLAG_CLEAR_MANUAL mars_task_event_flag_try_wait.mask_mode=MARS_TASK_EVENT_FLAG_MASK_AND,MARS_TASK_EVENT_FLAG_MASK_OR"
+71;closed;POS. FUNC.;TFP34001;N;A;HOST/MPU;mars_task_event_flag_set/mars_task_event_flag_try_wait;"Check if each bit of the bit argument can be set one by one.";"(NOTE: This test needs the specification change of mars_task_event_flag_try_wait to be able to know which event occured.) 1. Set one bit by mars_task_event_flag_set. And using mars_task_event_flag_try_wait, check if only the bit is setted. 2. Calling mars_task_event_flag_try_wait with mask which is setted only the bit, check if the return value is MARS_SUCCESS. 3. Calling mars_task_event_flag_try_wait with mask which is setted only one bit that is not the bit, check if the return value is MARS_ERROR_BUSY. Repeat this about all bits except the bit. Do this test with following condition: mar_task_initialize.direction=MARS_TASK_EVENT_FLAG_HOST_TO_MPU The caller of mars_task_event_flag_initialize is HOST. The caller of mars_task_event_flag_try_wait is MPU. Do this test about each combination of the following condition: mars_task_event_flag_initialize.clear_mode=MARS_TASK_EVENT_FLAG_CLEAR_AUTO,MATS_TASK_EVENT_FLAG_CLEAR_MANUAL mars_task_event_flag_try_wait.mask_mode=MARS_TASK_EVENT_FLAG_MASK_AND,MARS_TASK_EVENT_FLAG_MASK_OR"
+72;closed;POS. FUNC.;TFP34002;N;A;HOST/MPU;mars_task_event_flag_set/mars_task_event_flag_try_wait;"Check if each bit of the bit argument can be set one by one.";"(NOTE: This test needs the specification change of mars_task_event_flag_try_wait to be able to know which event occured.) 1. Set one bit by mars_task_event_flag_set. And using mars_task_event_flag_try_wait, check if only the bit is setted. 2. Calling mars_task_event_flag_try_wait with mask which is setted only the bit, check if the return value is MARS_SUCCESS. 3. Calling mars_task_event_flag_try_wait with mask which is setted only one bit that is not the bit, check if the return value is MARS_ERROR_BUSY. Repeat this about all bits except the bit. Do this test with following condition: mar_task_initialize.direction=MARS_TASK_EVENT_FLAG_MPU_TO_HOST The caller of mars_task_event_flag_create is MPU. The caller of mars_task_event_flag_try_wait is HOST. Do this test about each combination of the following condition: mars_task_event_flag_initialize.clear_mode=MARS_TASK_EVENT_FLAG_CLEAR_AUTO,MATS_TASK_EVENT_FLAG_CLEAR_MANUAL mars_task_event_flag_try_wait.mask_mode=MARS_TASK_EVENT_FLAG_MASK_AND,MARS_TASK_EVENT_FLAG_MASK_OR"
+73;closed;POS. FUNC.;TFP34003;N;B;MPU;mars_task_event_flag_set/mars_task_event_flag_try_wait;"Check if each bit of the bit argument can be set one by one.";"(NOTE: This test needs the specification change of mars_task_event_flag_try_wait to be able to know which event occured.) 1. Set one bit by mars_task_event_flag_set. And using mars_task_event_flag_try_wait, check if only the bit is setted. 2. Calling mars_task_event_flag_try_wait with mask which is setted only the bit, check if the return value is MARS_SUCCESS. 3. Calling mars_task_event_flag_try_wait with mask which is setted only one bit that is not the bit, check if the return value is MARS_ERROR_BUSY. Repeat this about all bits except the bit. Do this test with following condition: mar_task_initialize.direction=MARS_TASK_EVENT_FLAG_MPU_TO_MPU The caller of mars_task_event_flag_create is MPU. The caller of mars_task_event_flag_try_wait is MPU. Do this test about each combination of the following condition: mars_task_event_flag_create.clear_mode=MARS_TASK_EVENT_FLAG_CLEAR_AUTO,MATS_TASK_EVENT_FLAG_CLEAR_MANUAL mars_task_event_flag_try_wait.mask_mode=MARS_TASK_EVENT_FLAG_MASK_AND,MARS_TASK_EVENT_FLAG_MASK_OR"
+74;closed;POS. FUNC.;TFP31004;Y;B;HOST;mars_task_event_flag_create;"Check if mars_task_event_flag_create is thread-safe.";"Check if task event flags are initialized correctly when multiple host-side threads call mars_task_event_flag simultaneously."
+75;closed;POS. FUNC.;TFP31005;Y;B;MPU;mars_task_event_flag_create;"Check if mars_task_event_flag_create is thread-safe.";"Check if task event flags are initialized correctly when multiple MPU tasks call mars_task_event_flag simultaneously."
+76;closed;POS. FUNC.;TFP31006;Y;B;HOST/MPU;mars_task_event_flag_create;"Check if mars_task_event_flag_create is thread-safe.";"Check if task event flags are initialized correctly when multiple host side threads and multiple MPU tasks call mars_task_event_flag simultaneously."
+77;closed;POS. FUNC.;TFP36001;N;A;HOST/MPU;mars_task_event_flag_try_wait;"Check if mars_task_event_flag_try_wait with mask_mode=MARS_TASK_EVENT_FLAG_MASK_AND work correctly.";"Using mars_task_event_flag_try_wait, wait for multiple events. Using mars_task_event_flag_set, set bits one by one. And check if mars_task_event_flag_try_wait doesn't return MARS_SUCCESS until all the bits are setted. Do this test with following condition: mars_task_event_flag_create.direction=MARS_TASK_EVENT_FLAG_HOST_TO_MPU mars_task_event_flag_try_wait.mask_mode=MARS_TASK_EVENT_FLAG_MASK_AND"
+79;closed;POS. FUNC.;TFP36003;N;B;MPU;mars_task_event_flag_try_wait;"Check if mars_task_event_flag_try_wait with mask_mode=MARS_TASK_EVENT_FLAG_MASK_AND work correctly.";"Using mars_task_event_flag_try_wait, wait for multiple events. Using mars_task_event_flag_set, set bits one by one. And check if mars_task_event_flag_try_wait doesn't return MARS_SUCCESS until all the bits are setted. Do this test with following condition: mars_task_event_flag_create.direction=MARS_TASK_EVENT_FLAG_MPU_TO_MPU mars_task_event_flag_try_wait.mask_mode=MARS_TASK_EVENT_FLAG_MASK_AND"
+80;closed;POS. FUNC.;TFP36004;N;A;HOST/MPU;mars_task_event_flag_try_wait;"Check if mars_task_event_flag_try_wait with mask_mode=MARS_TASK_EVENT_FLAG_MASK_OR work correctly.";"Using mars_task_event_flag_try_wait, wait for multiple events. Check if mars_task_event_flag_try_wait returns MARS_ERROR_BUSY, when no flag is setted. Check if mars_task_event_flag_try_wait returns MARS_SUCCESS, when one of the waiting flag is settend. Do this test with following condition: mars_task_event_flag_create.direction=MARS_TASK_EVENT_FLAG_HOST_TO_MPU mars_task_event_flag_try_wait.mask_mode=MARS_TASK_EVENT_FLAG_MASK_OR"
+81;closed;POS. FUNC.;TFP36005;N;A;HOST/MPU;mars_task_event_flag_try_wait;"Check if mars_task_event_flag_try_wait with mask_mode=MARS_TASK_EVENT_FLAG_MASK_OR work correctly.";"Using mars_task_event_flag_try_wait, wait for multiple events. Check if mars_task_event_flag_try_wait returns MARS_ERROR_BUSY, when no flag is setted. Check if mars_task_event_flag_try_wait returns MARS_SUCCESS, when one of the waiting flag is settend. Do this test with following condition: mars_task_event_flag_create.direction=MARS_TASK_EVENT_FLAG_MPU_TO_HOST mars_task_event_flag_try_wait.mask_mode=MARS_TASK_EVENT_FLAG_MASK_OR"
+82;closed;POS. FUNC.;TFP36006;N;B;MPU;mars_task_event_flag_try_wait;"Check if mars_task_event_flag_try_wait with mask_mode=MARS_TASK_EVENT_FLAG_MASK_OR work correctly.";"Using mars_task_event_flag_try_wait, wait for multiple events. Check if mars_task_event_flag_try_wait returns MARS_ERROR_BUSY, when no flag is setted. Check if mars_task_event_flag_try_wait returns MARS_SUCCESS, when one of the waiting flag is settend. Do this test with following condition: mars_task_event_flag_create.direction=MARS_TASK_EVENT_FLAG_MPU_TO_MPU mars_task_event_flag_try_wait.mask_mode=MARS_TASK_EVENT_FLAG_MASK_OR"
+83;closed;POS. FUNC.;TFP34004;N;A;HOST/MPU;mars_task_event_flag_set;"Check if mars_task_event_flag_set is thread-safe.";"Call mars_task_event_flag_set by multiple PPE threads simltaneously. And using mars_task_event_flag_try_wait, check if only the correct flags are setted. Do this test with following condition: mars_task_event_flag_create.direction=MARS_TASK_EVENT_FLAG_HOST_TO_MPU"
+84;closed;POS. FUNC.;TFP34005;N;A;HOST/MPU;mars_task_event_flag_set;"Check if mars_task_event_flag_set is thread-safe.";"Call mars_task_event_flag_set by multiple MARS task simltaneously. And using mars_task_event_flag_try_wait, check if only the correct flags are setted. Do this test with following condition: mars_task_event_flag_create.direction=MARS_TASK_EVENT_FLAG_MPU_TO_HOST"
+85;closed;POS. FUNC.;TFP35001;Y;A;HOST/MPU;mars_task_event_flag_wait;"Check if mars_task_event_flag_try_wait with mask_mode=MARS_TASK_EVENT_FLAG_MASK_AND work correctly.";"Using mars_task_event_flag_wait, wait for multiple events. Using mars_task_event_flag_set, set bits one by one and check if mars_task_event_flag_wait desn't return until all waiting bits are setted. Do this test with following condition: mars_task_event_flag_create.direction=MARS_TASK_EVENT_FLAG_HOST_TO_MPU mars_task_event_flag_wait.mask_mode=MARS_TASK_EVENT_FLAG_MASK_AND"
+86;closed;POS. FUNC.;TFP35002;Y;A;HOST/MPU;mars_task_event_flag_wait;"Check if mars_task_event_flag_try_wait with mask_mode=MARS_TASK_EVENT_FLAG_MASK_AND work correctly.";"Using mars_task_event_flag_wait, wait for multiple events. Using mars_task_event_flag_set, set bits one by one and check if mars_task_event_flag_wait desn't return until all waiting bits are setted. Do this test with following condition: mars_task_event_flag_create.direction=MARS_TASK_EVENT_FLAG_MPU_TO_HOST mars_task_event_flag_wait.mask_mode=MARS_TASK_EVENT_FLAG_MASK_AND"
+87;closed;POS. FUNC.;TFP35003;Y;B;MPU;mars_task_event_flag_wait;"Check if mars_task_event_flag_try_wait with mask_mode=MARS_TASK_EVENT_FLAG_MASK_AND work correctly.";"Using mars_task_event_flag_wait, wait for multiple events. Using mars_task_event_flag_set, set bits one by one and check if mars_task_event_flag_wait desn't return until all waiting bits are setted. Do this test with following condition: mars_task_event_flag_create.direction=MARS_TASK_EVENT_FLAG_MPU_TO_MPU mars_task_event_flag_wait.mask_mode=MARS_TASK_EVENT_FLAG_MASK_AND"
+88;closed;POS. FUNC.;TFP35004;N;A;HOST/MPU;mars_task_event_flag_wait;"Check if mars_task_event_flag_try_wait with mask_mode=MARS_TASK_EVENT_FLAG_MASK_OR work correctly.";"Using mars_task_event_flag_wait, wait for multiple events. Check if mars_task_event_flag_wait returns when one waiting bit is setted by mars_task_event_flag_set. Do this test with following condition: mars_task_event_flag_create.direction=MARS_TASK_EVENT_FLAG_HOST_TO_MPU mars_task_event_flag_wait.wait_mode=MARS_TASK_EVENT_FLAG_MASK_OR"
+89;closed;POS. FUNC.;TFP35005;N;A;HOST/MPU;mars_task_event_flag_wait;"Check if mars_task_event_flag_try_wait with mask_mode=MARS_TASK_EVENT_FLAG_MASK_OR work correctly.";"Using mars_task_event_flag_wait, wait for multiple events. Check if mars_task_event_flag_wait returns when one waiting bit is setted by mars_task_event_flag_set. Do this test with following condition: mars_task_event_flag_create.direction=MARS_TASK_EVENT_FLAG_MPU_TO_HOST mars_task_event_flag_wait.wait_mode=MARS_TASK_EVENT_FLAG_MASK_OR"
+90;closed;POS. FUNC.;TFP35006;N;B;MPU;mars_task_event_flag_wait;"Check if mars_task_event_flag_try_wait with mask_mode=MARS_TASK_EVENT_FLAG_MASK_OR work correctly.";"Using mars_task_event_flag_wait, wait for multiple events. Check if mars_task_event_flag_wait returns when one waiting bit is setted by mars_task_event_flag_set. Do this test with following condition: mars_task_event_flag_create.direction=MARS_TASK_EVENT_FLAG_MPU_TO_MPU mars_task_event_flag_wait.wait_mode=MARS_TASK_EVENT_FLAG_MASK_OR"
+91;closed;POS. FUNC.;TFP35007;Y;A;HOST/MPU;mars_task_event_flag_wait;"Check if mars_task_event_flag_wait returns immediately when the condition had met already.";"In the state that a waiting condition was satisfied beforehand, call mars_task_event_flag_wait and check if the call returns immediately. Do this test with following condition: mars_task_evet_flag_create.direction=MARS_TASK_EVENT_FLAG_HOST_TO_MPU Do this test about each following condition: mars_task_event_flat_wait.wait_mode=MARS_TASK_EVENT_FLAG_MASK_AND,MARS_TASK_EVENT_FLAG_MASK_OR"
+92;closed;POS. FUNC.;TFP35008;Y;A;HOST/MPU;mars_task_event_flag_wait;"Check if mars_task_event_flag_wait returns immediately when the condition had met already.";"In the state that a waiting condition was satisfied beforehand, call mars_task_event_flag_wait and check if the call returns immediately. Do this test with following condition: mars_task_evet_flag_create.direction=MARS_TASK_EVENT_FLAG_MPU_TO_HOST Do this test about each following condition: mars_task_event_flat_wait.wait_mode=MARS_TASK_EVENT_FLAG_MASK_AND,MARS_TASK_EVENT_FLAG_MASK_OR"
+93;closed;POS. FUNC.;TFP35009;Y;B;MPU;mars_task_event_flag_wait;"Check if mars_task_event_flag_wait returns immediately when the condition had met already.";"In the state that a waiting condition was satisfied beforehand, call mars_task_event_flag_wait and check if the call returns immediately. Do this test with following condition: mars_task_evet_flag_create.direction=MARS_TASK_EVENT_FLAG_MPU_TO_MPU Do this test about each following condition: mars_task_event_flat_wait.wait_mode=MARS_TASK_EVENT_FLAG_MASK_AND,MARS_TASK_EVENT_FLAG_MASK_OR"
+94;closed;POS. FUNC.;TFP36007;N;A;HOST/MPU;mars_task_event_flag_try_wait;"Check is the flags is cleared when clear_mode=MARS_TASK_EVENT_FLAG_CLEAR_AUTO.";"Call mars_task_create with clear_mode=MARS_TASK_EVENT_FLAG_CLEAR_AUTO. Then satisfy the waiting condition, call mars_task_event_flag_try_wait and check if the event flag is cleared. Do this test with following condition: mars_task_event_flag_create.direction=MARS_TASK_EVENT_FLAG_HOST_TO_MPU"
+95;closed;POS. FUNC.;TFP36008;N;A;HOST/MPU;mars_task_event_flag_try_wait;"Check is the flags is cleared when clear_mode=MARS_TASK_EVENT_FLAG_CLEAR_AUTO.";"Call mars_task_create with clear_mode=MARS_TASK_EVENT_FLAG_CLEAR_AUTO. Then satisfy the waiting condition, call mars_task_event_flag_try_wait and check if the event flag is cleared. Do this test with following condition: mars_task_event_flag_create.direction=MARS_TASK_EVENT_FLAG_MPU_TO_HOST"
+96;closed;POS. FUNC.;TFP36009;N;B;MPU;mars_task_event_flag_try_wait;"Check is the flags is cleared when clear_mode=MARS_TASK_EVENT_FLAG_CLEAR_AUTO.";"Call mars_task_create with clear_mode=MARS_TASK_EVENT_FLAG_CLEAR_AUTO. Then satisfy the waiting condition, call mars_task_event_flag_try_wait and check if the event flag is cleared. Do this test with following condition: mars_task_event_flag_create.direction=MARS_TASK_EVENT_FLAG_MPU_TO_MPU"
+97;closed;POS. FUNC.;TFP36010;N;A;HOST/MPU;mars_task_event_flag_try_wait;"Check isn't the flags is cleared when clear_mode=MARS_TASK_EVENT_FLAG_CLEAR_MANUAL.";"Call mars_task_create with clear_mode=MARS_TASK_EVENT_FLAG_CLEAR_MANUAL. Then satisfy the waiting condition, call mars_task_event_flag_try_wait and check if the event flag isn't cleared. Do this test with following condition: mars_task_event_flag_create.direction=MARS_TASK_EVENT_FLAG_HOST_TO_MPU"
+98;closed;POS. FUNC.;TFP36011;N;A;HOST/MPU;mars_task_event_flag_try_wait;"Check isn't the flags is cleared when clear_mode=MARS_TASK_EVENT_FLAG_CLEAR_MANUAL.";"Call mars_task_create with clear_mode=MARS_TASK_EVENT_FLAG_CLEAR_MANUAL. Then satisfy the waiting condition, call mars_task_event_flag_try_wait and check if the event flag isn't cleared. Do this test with following condition: mars_task_event_flag_create.direction=MARS_TASK_EVENT_FLAG_MPU_TO_HOST"
+99;closed;POS. FUNC.;TFP36012;N;B;MPU;mars_task_event_flag_try_wait;"Check isn't the flags is cleared when clear_mode=MARS_TASK_EVENT_FLAG_CLEAR_MANUAL.";"Call mars_task_create with clear_mode=MARS_TASK_EVENT_FLAG_CLEAR_MANUAL. Then satisfy the waiting condition, call mars_task_event_flag_try_wait and check if the event flag isn't cleared. Do this test with following condition: mars_task_event_flag_create.direction=MARS_TASK_EVENT_FLAG_MPU_TO_MPU"
+100;closed;POS. FUNC.;TFP35010;N;A;HOST/MPU;mars_task_event_flag_wait;"Check is the flags is cleared when clear_mode=MARS_TASK_EVENT_FLAG_CLEAR_AUTO.";"Call mars_task_create with clear_mode=MARS_TASK_EVENT_FLAG_CLEAR_AUTO. Then satisfy the waiting condition, call mars_task_event_flag_wait and check if the event flag is cleared. Do this test with following condition: mars_task_event_flag_create.direction=MARS_TASK_EVENT_FLAG_HOST_TO_MPU"
+101;closed;POS. FUNC.;TFP35011;N;A;HOST/MPU;mars_task_event_flag_wait;"Check is the flags is cleared when clear_mode=MARS_TASK_EVENT_FLAG_CLEAR_AUTO.";"Call mars_task_create with clear_mode=MARS_TASK_EVENT_FLAG_CLEAR_AUTO. Then satisfy the waiting condition, call mars_task_event_flag_wait and check if the event flag is cleared. Do this test with following condition: mars_task_event_flag_create.direction=MARS_TASK_EVENT_FLAG_MPU_TO_HOST"
+102;closed;POS. FUNC.;TFP35012;N;B;MPU;mars_task_event_flag_wait;"Check is the flags is cleared when clear_mode=MARS_TASK_EVENT_FLAG_CLEAR_AUTO.";"Call mars_task_create with clear_mode=MARS_TASK_EVENT_FLAG_CLEAR_AUTO. Then satisfy the waiting condition, call mars_task_event_flag_wait and check if the event flag is cleared. Do this test with following condition: mars_task_event_flag_create.direction=MARS_TASK_EVENT_FLAG_MPU_TO_MPU"
+103;closed;POS. FUNC.;TFP35013;N;A;HOST/MPU;mars_task_event_flag_wait;"Check isn't the flags is cleared when clear_mode=MARS_TASK_EVENT_FLAG_CLEAR_MANUAL.";"Call mars_task_create with clear_mode=MARS_TASK_EVENT_FLAG_CLEAR_MANUAL. Then satisfy the waiting condition, call mars_task_event_flag_wait and check if the event flag isn't cleared. Do this test with following condition: mars_task_event_flag_create.direction=MARS_TASK_EVENT_FLAG_MPU_TO_HOST"
+104;closed;POS. FUNC.;TFP35014;N;A;HOST/MPU;mars_task_event_flag_wait;"Check isn't the flags is cleared when clear_mode=MARS_TASK_EVENT_FLAG_CLEAR_MANUAL.";"Call mars_task_create with clear_mode=MARS_TASK_EVENT_FLAG_CLEAR_MANUAL. Then satisfy the waiting condition, call mars_task_event_flag_wait and check if the event flag isn't cleared. Do this test with following condition: mars_task_evet_flag_create.direction=MARS_TASK_EVENT_FLAG_HOST_TO_MPU"
+105;closed;POS. FUNC.;TFP35015;N;B;MPU;mars_task_event_flag_wait;"Check isn't the flags is cleared when clear_mode=MARS_TASK_EVENT_FLAG_CLEAR_MANUAL.";"Call mars_task_create with clear_mode=MARS_TASK_EVENT_FLAG_CLEAR_MANUAL. Then satisfy the waiting condition, call mars_task_event_flag_wait and check if the event flag isn't cleared. Do this test with following condition: mars_task_event_flag_create.direction=MARS_TASK_EVENT_FLAG_MPU_TO_MPU"
+106;closed;POS. FUNC.;TFP35016;Y;A;HOST/MPU;mars_task_event_flag_wait;"Check if mars_task_event_flag_wait is thread-safe.";"Call mars_task_event_flag_wait against same event flag from multiple MARS tasks. Check if all threads are blocked and those are woken up when the waiting condition is satisfied. Do this test with following condition: mars_task_event_flag_create.direction=MARS_TASK_EVENT_FLAG_HOST_TO_MPU"
+107;closed;POS. FUNC.;TFP35017;Y;A;HOST/MPU;mars_task_event_flag_wait;"Check if mars_task_event_flag_wait is thread-safe.";"Call mars_task_event_flag_wait against same event flag from multiple PPE threads. Check if all MARS tasks are blocked and those are woken up when the waiting condition is satisfied. Do this test with following condition: mars_task_event_flag_create.direction=MARS_TASK_EVENT_FLAG_MPU_TO_HOST"
+108;closed;POS. FUNC.;TFP35018;Y;B;MPU;mars_task_event_flag_wait;"Check if mars_task_event_flag_wait is thread-safe.";"Call mars_task_event_flag_wait against same event flag from multiple MARS tasks. Check if all MARS tasks are blocked and those are woken up when the waiting condition is satisfied. Do this test with following condition: mars_task_event_flag_create.direction=MARS_TASK_EVENT_FLAG_MPU_TO_MPU"
+109;closed;POS. FUNC.;TFP33001;N;A;HOST/MPU;mars_task_event_flag_clear;"Check if each bit of the bit argument can be clear one by one.";"Attempt to clear event flag one bit by one bit. And check if the bits are cleared one by one actually. Do this test with following condition: mars_task_event_flag_create.direction=MARS_TASK_EVENT_FLAG_HOST_TO_MPU"
+110;closed;POS. FUNC.;TFP33002;N;A;HOST/MPU;mars_task_event_flag_clear;"Check if each bit of the bit argument can be clear one by one.";"Attempt to clear event flag one bit by one bit. And check if the bits are cleared one by one actually. Do this test with following condition: mars_task_event_flag_clear.direction=MARS_TASK_EVENT_FLAG_MPU_TO_HOST"
+111;closed;POS. FUNC.;TFP33003;N;B;MPU;mars_task_event_flag_clear;"Check if each bit of the bit argument can be clear one by one.";"Attempt to clear event flag one bit by one bit. And check if the bits are cleared one by one actually. Do this test with following condition: mars_task_event_flag_create.direction=MARS_TASK_EVENT_FLAG_MPU_TO_MPU"
+112;closed;POS. FUNC.;TFP33004;Y;A;HOST/MPU;mars_task_event_flag_clear;"Check if it works correctly when multiple PPE threads call mars_task_event_flag_clear at the same time. Do this test with following condition: mar_task_event_flag_create.direction=MARS_TASK_EVENT_FLAG_HOST_TO_MPU";
+113;closed;POS. FUNC.;TFP33005;Y;A;HOST/MPU;mars_task_event_flag_clear;"Check if it works correctly when multiple PPE threads call mars_task_event_flag_clear at the same time. Do this test with following condition: mar_task_event_flag_create.direction=MARS_TASK_EVENT_FLAG_MPU_TO_HOST";
+114;closed;POS. FUNC.;TFP34006;Y;A;HOST/MPU;mars_task_event_flag_set/mars_task_event_flag_clear;"Check if mars_task_event_flag_set and mars_task_event_flag_clear are thread-safe";"Check if it works correctly when multiple PPE threads call mars_task_event_flag_clear and mars_task_event_flag_set at the same time. Do this test with following condition: mar_task_event_flag_create.direction=MARS_TASK_EVENT_FLAG_HOST_TO_MPU"
+115;closed;POS. FUNC.;TFP34007;Y;A;HOST/MPU;mars_task_event_flag_set/mars_task_event_flag_clear;"Check if it works correctly when multiple PPE threads call mars_task_event_flag_clear and mars_task_event_flag_set at the same time. Do this test with following condition: mar_task_event_flag_create.direction=MARS_TASK_EVENT_FLAG_MPU_TO_HOST";
+116;closed;POS. FUNC.;TFP51001;N;B;HOST;mars_task_semaphore_create;"Check if a task semaphore is initialized correctly with count=1";""
+117;closed;POS. FUNC.;TFP51002;N;A;HOST;mars_task_semaphore_create;"Check if a task semaphore is initialized correctly with equals to the upper limit. (If the upper limit exists.)";""
+118;closed;POS. FUNC.;TFP51003;N;B;MPU;mars_task_semaphore_create;"Check if a task semaphore is initialized correctly with count=1";""
+119;closed;POS. FUNC.;TFP51004;N;A;MPU;mars_task_semaphore_create;"Check if a task semaphore is initialized correctly with equals to the upper limit. (If the upper limit exists.)";""
+120;closed;POS. FUNC.;TFP53001;N;A;MPU;mars_task_semaphore_acquire;"Check if a MARS task which calls mars_task_semaphore_acquire succeeds without being blocked when the number of MARS tasks acquiring semaphore doesn't reach the limit.";""
+121;closed;POS. FUNC.;TFP53002;N;A;MPU;mars_task_semaphore_acquire;"Check if a MARS task which calls mars_task_semaphore_acquire succeeds with being blocked when the number of MARS tasks acquiring semaphore reaches the limit.";""
+122;closed;POS. FUNC.;TFP54001;N;A;MPU;mars_task_semaphore_release;"Check if mars_task_semaphore works correctly.";"Check the return value is MARS_SUCCESS."
+123;closed;POS. FUNC.;TFP53003;Y;A;MPU;mars_task_semaphore_acquire;"Check if mars_task_semaphore_acquire is thread-safe.";"Attempt to acquire the same semaphore from multiple MARS tasks."
+124;closed;POS. FUNC.;TFP53004;Y;B;MPU;mars_task_semaphore_acquire;"Check if mars_task_semaphore_acquire is thread-safe.";"Attempt to acquire the respective semaphores from multiple MARS tasks."
+125;closed;POS. FUNC.;TFP54002;Y;A;MPU;mars_task_semaphore_release;"Attempt to release the same semaphore from multiple MARS tasks.";
+126;closed;POS. FUNC.;TFP54003;Y;B;MPU;mars_task_semaphore_release;"Check if mars_task_semaphore_release is thread-safe";"Attempt to release the respective semaphores from multiple MARS tasks."
+127;closed;POS. FUNC.;TFP53005;Y;B;MPU;mars_task_semaphore_acquire/mars_task_semaphore_release;"Check if mars_task_semaphore_acquire and mars_task_semaphore_release are thread-safe.";"Create MARS task of the same number of MPU and call mars_task_semaphore_acquire and mars_task_semaphore_release with one semaphore many times simaultaneously by multiple MPU tasks. And check if the the semaphore is not broken."
+128;closed;POS. FUNC.;TFP53006;Y;B;MPU;mars_task_semaphore_acquire/mars_task_semaphore_release;"Check if mars_task_semaphore_acquire and mars_task_semaphore_release are thread-safe.";"Create MARS task of the same number of MPU and call mars_task_semaphore_acquire and mars_task_semaphore_release with respective semaphores many times simaultaneously by multiple MPU tasks. And check if the the semaphores is not broken."
+129;closed;POS. FUNC.;TFP61001;N;A;HOST;mars_task_signal_send/mars_task_signal_wait;"Check if mars_task_signal succeeds when there is no MARS task waiting for the signal.";"Call mars_task_signal_wait before calling mars_task_signal_send and check if the caller is blocked. After that, call mars_task_signal_send by a host side thread and check if it returns MARS_SUCCESS and the blocked task is resumed."
+130;closed;POS. FUNC.;TFP61002;N;A;MPU;mars_task_signal_send/mars_task_signal_wait;"Check if mars_task_signal succeeds when there is no MARS task waiting for the signal.";"Call mars_task_signal_wait before calling mars_task_signal_send and check if the caller is blocked. After that, call mars_task_signal_send by anoter MARS task and check if it returns MARS_SUCCESS and the blocked task is resumed."
+131;closed;POS. FUNC.;TFP62001;Y;A;MPU;mars_task_signal_wait;"Check if the MARS task called mars_task_receive is not blocked and immediately return when the signal had already sent by a host side thread.";""
+132;closed;POS. FUNC.;TFP62002;Y;A;MPU;mars_task_signal_wait;"Check if the MARS task called mars_task_receive is not blocked and immediately return when the signal had already sent by a MARS task.";""
+133;closed;POS. FUNC.;TFP63001;Y;A;MPU;mars_task_signal_try_wait;"Check if the MARS task called mars_task_signal_try_wait succeeds when the signal had already send by a host side thread.";""
+134;closed;POS. FUNC.;TFP63002;Y;A;MPU;mars_task_signal_try_wait;"Check if the MARS task called mars_task_signal_try_wait succeeds when the signal had already send by a MPU task.";""
+135;closed;POS. FUNC.;TFP63003;Y;A;MPU;mars_task_signal_try_wait;"Check if the MARS task called mars_task_signal_try_wait returns MARS_ERROR_BUSY when the signal had not send yet.";""
+136;closed;POS. FUNC.;TFP41001;N;A;HOST;mars_task_queue_create;"Check if the task queue is initialized correctly.";"Do this test about each combination of the following condition: mars_task_queue_create.size=16,16K mars_task_queue_create.depth=1,maximum mars_task_queue_create.direction=MARS_TASK_QUEUE_HOST_TO_MPU,MARS_TASK_QUEUE_MPU_TO_HOST,MARS_TASK_QUEUE_MPU_TO_MPU After each initialization, check if the count=0, using mars_task_queue_count"
+137;closed;POS. FUNC.;TFP41002;N;A;MPU;mars_task_queue_create;"Check if the task queue is initialized correctly.";"Do this test about each combination of the following condition: mars_task_queue_create.size=16,16K mars_task_queue_create.depth=1,maximum mars_task_queue_create.direction=MARS_TASK_QUEUE_HOST_TO_MPU,MARS_TASK_QUEUE_MPU_TO_HOST,MARS_TASK_QUEUE_MPU_TO_MPU After each initialization, check if the count=0, using mars_task_queue_count"
+138;closed;POS. FUNC.;TFP41003;Y;B;HOST;mars_task_queue_create;"Check if the mars_task_queue_create is thread-safe.";"Check if it works OK when mars_task_queue is called by multiple PPE threads at the same time."
+139;closed;POS. FUNC.;TFP41004;Y;B;MPU;mars_task_queue_create;"Check if the mars_task_queue_create is thread-safe.";"Check if it works OK when mars_task_queue is called by multiple MARS tasks at the same time."
+140;closed;POS. FUNC.;TFP41005;Y;B;MPU/HOST;mars_task_queue_create;"Check if the mars_task_queue_create is thread-safe.";"Check if it works OK when mars_task_queue is called by multiple PPE threads and MARS tasks at the same time."
+141;closed;POS. FUNC.;TFP43001;N;A;HOST/MPU;mars_task_queue_count/mars_task_queue_push;"Check if the queue count is incremented when a data is pushed.";"Does the count increase when we push against a empty queue? direction=MARS_TASK_QUEUE_MPU_TO_HOST"
+142;closed;POS. FUNC.;TFP43002;N;A;HOST/MPU;mars_task_queue_count/mars_task_queue_push;"Check if the queue count is incremented when a data is pushed.";"Does the count increase when we push against a empty queue? direction=MARS_TASK_QUEUE_HOST_TO_MPU"
+143;closed;POS. FUNC.;TFP43003;N;B;MPU;mars_task_queue_count/mars_task_queue_push;"Check if the queue count is incremented when a data is pushed.";"Does the count increase when we push against a empty queue? direction=MARS_TASK_QUEUE_MPU_TO_MPU"
+144;closed;POS. FUNC.;TFP43004;N;B;HOST/MPU;mars_task_queue_count/mars_task_queue_try_push;"Check if the queue count is incremented when a data is pushed.";"Does the count increase when we push against a empty queue? direction=MARS_TASK_QUEUE_MPU_TO_HOST"
+145;closed;POS. FUNC.;TFP43005;N;B;HOST/MPU;mars_task_queue_count/mars_task_queue_try_push;"Check if the queue count is incremented when a data is pushed.";"Does the count increase when we push against a empty queue? direction=MARS_TASK_QUEUE_HOST_TO_MPU"
+146;closed;POS. FUNC.;TFP43006;N;B;MPU;mars_task_queue_count/mars_task_queue_try_push;"Check if the queue count is incremented when a data is pushed.";"Does the count increase when we push against a empty queue? direction=MARS_TASK_QUEUE_MPU_TO_MPU"
+147;closed;POS. FUNC.;TFP43007;N;B;MPU;mars_task_queue_count/mars_task_queue_push_begin/mars_task_queue_push_end;"Check if the queue count is incremented when a data is pushed.";"Does the count increase when we push_begin/end against a empty queue? direction=MARS_TASK_QUEUE_MPU_TO_MPU"
+148;closed;POS. FUNC.;TFP43008;N;B;MPU;mars_task_queue_count/mars_task_queue_try_push_begin/mars_task_queue_try_push_end;"Check if the queue count is incremented when a data is pushed.";"Does the count increase when we push_begin/end against a empty queue? direction=MARS_TASK_QUEUE_MPU_TO_MPU"
+149;closed;POS. FUNC.;TFP43009;N;A;HOST/MPU;mars_task_queue_count/mars_task_queue_pop;"Check if the queue count is decremented when a data is popped.";"Does the count decrease when we pop from a full queue? direction=MARS_TASK_QUEUE_MPU_TO_HOST"
+150;closed;POS. FUNC.;TFP43010;N;A;HOST/MPU;mars_task_queue_count/mars_task_queue_pop;"Check if the queue count is decremented when a data is popped.";"Does the count decrease when we pop from a full queue? direction=MARS_TASK_QUEUE_HOST_TO_MPU"
+151;closed;POS. FUNC.;TFP43011;N;B;MPU;mars_task_queue_count/mars_task_queue_pop;"Check if the queue count is decremented when a data is popped.";"Does the count decrease when we pop from a full queue? direction=MARS_TASK_QUEUE_MPU_TO_MPU"
+152;closed;POS. FUNC.;TFP43012;N;B;HOST/MPU;mars_task_queue_count/mars_task_queue_try_pop;"Check if the queue count is decremented when a data is popped.";"Does the count decrease when we try_pop from a full queue? direction=MARS_TASK_QUEUE_MPU_TO_HOST"
+153;closed;POS. FUNC.;TFP43013;N;B;HOST/MPU;mars_task_queue_count/mars_task_queue_try_pop;"Check if the queue count is decremented when a data is popped.";"Does the count decrease when we try_pop from a full queue? direction=MARS_TASK_QUEUE_HOST_TO_MPU"
+154;closed;POS. FUNC.;TFP43014;N;B;MPU;mars_task_queue_count/mars_task_queue_try_pop;"Check if the queue count is decremented when a data is popped.";"Does the count decrease when we try_pop from a queue which is full? direction=MARS_TASK_QUEUE_MPU_TO_MPU"
+155;closed;POS. FUNC.;TFP43015;N;B;HOST/MPU;mars_task_queue_count/mars_task_queue_pop_begin/mars_task_queue_pop_end;"Check if the queue count is decremented when a data is popped.";"Does the count decrease when we pop_begin/end from a full queue? direction=MARS_TASK_QUEUE_HOST_TO_MPU."
+156;closed;POS. FUNC.;TFP43016;N;B;MPU;mars_task_queue_count/mars_task_queue_pop_begin/mars_task_queue_pop_end;"Check if the queue count is decremented when a data is popped.";"Does the count decrease when we pop_begin/end from a full queue? direction=MARS_TASK_QUEUE_MPU_TO_MPU"
+157;closed;POS. FUNC.;TFP43017;N;B;HOST/MPU;mars_task_queue_count/mars_task_queue_try_pop_begin/mars_task_queue_try_pop_end;"Check if the queue count is decremented when a data is popped.";"Does the count decrease when we try_pop_begin/end from a full queue? direction=MARS_TASK_QUEUE_HOST_TO_MPU"
+158;closed;POS. FUNC.;TFP43018;N;B;MPU;mars_task_queue_count/mars_task_queue_try_pop_begin/mars_task_queue_try_pop_end;"Check if the queue count is decremented when a data is popped.";"Does the count decrease when we try_pop_begin/end from a full queue? direction=MARS_TASK_QUEUE_MPU_TO_MPU"
+159;closed;POS. FUNC.;TFP45001;Y;B;HOST/MPU;mars_task_queue_push;"Check if the caller is blocked when it push into a full queue.";"Push data of the number same as the queue entry+1 to a empty queue and check if the last call is blocked. Pop all data and check if those data are popped in correct order and overwrites haven't occurred. direction=MARS_TASK_QUEUE_HOST_TO_MPU"
+160;closed;POS. FUNC.;TFP45002;Y;B;HOST/MPU;mars_task_queue_push;"Check if the caller is blocked when it push into a full queue.";"Push data of the number same as the queue entry+1 to a empty queue and check if the last call is blocked. Pop all data and check if those data are popped in correct order and overwrites haven't occurred. direction=MARS_TASK_QUEUE_MPU_TO_HOST"
+161;closed;POS. FUNC.;TFP45003;Y;C;MPU;mars_task_queue_push;"Check if the caller is blocked when it push into a full queue.";"Push data of the number same as the queue entry+1 to a empty queue and check if the last call is blocked. Pop all data and check if those data are popped in correct order and overwrites haven't occurred. direction=MARS_TASK_QUEUE_MPU_TO_MPU"
+162;closed;POS. FUNC.;TFP48001;N;A;HOST/MPU;mars_task_queue_try_push;"Check if the func returns MARS_TASK_ERROR_BUSY when it push into a full queue.";"Push data of the number same as the queue entry+1 to a empty queue and check if the last call returns MARS_ERROR_BUSY. Pop all data and check if those data are popped in correct order and overwrites haven't occurred. direction=MARS_TASK_QUEUE_HOST_TO_MPU"
+163;closed;POS. FUNC.;TFP48002;N;A;HOST/MPU;mars_task_queue_try_push;"Check if the func returns MARS_TASK_ERROR_BUSY when it push into a full queue.";"Push data of the number same as the queue entry+1 to a empty queue and check if the last call returns MARS_ERROR_BUSY. Pop all data and check if those data are popped in correct order and overwrites haven't occurred. direction=MARS_TASK_QUEUE_MPU_TO_HOST"
+164;closed;POS. FUNC.;TFP48003;N;C;MPU;mars_task_queue_try_push;"Check if the func returns MARS_TASK_ERROR_BUSY when it push into a full queue.";"Push data of the number same as the queue entry+1 to a empty queue and check if the last call returns MARS_ERROR_BUSY. Pop all data and check if those data are popped in correct order and overwrites haven't occurred. direction=MARS_TASK_QUEUE_MPU_TO_MPU"
+165;closed;POS. FUNC.;TFP46001;Y;B;HOST/MPU;mars_task_queue_push_begin;"Check if the caller is blocked when it push into a full queue.";"Push data of the number same as the queue entry+1 to a empty queue and check if the last call is blocked. Pop all data and check if those data are popped in correct order and overwrites haven't occurred. direction=MARS_TASK_QUEUE_MPU_TO_HOST"
+166;closed;POS. FUNC.;TFP46002;Y;C;MPU;mars_task_queue_push_begin;"Check if the caller is blocked when it push into a full queue.";"Push data of the number same as the queue entry+1 to a empty queue and check if the last call is blocked. Pop all data and check if those data are popped in correct order and overwrites haven't occurred. direction=MARS_TASK_QUEUE_MPU_TO_MPU"
+167;closed;POS. FUNC.;TFP49001;N;B;HOST/MPU;mars_task_queue_try_push_begin;"Check if the func returns MARS_TASK_ERROR_BUSY when it push into a full queue.";"Push data of the number same as the queue entry+1 to a empty queue and check if the last call returns MARS_ERROR_BUSY. Pop all data and check if those data are popped in correct order and overwrites haven't occurred. direction=MARS_TASK_QUEUE_MPU_TO_HOST"
+168;closed;POS. FUNC.;TFP49002;N;C;MPU;mars_task_queue_try_push_begin;"Check if the func returns MARS_TASK_ERROR_BUSY when it push into a full queue.";"Push data of the number same as the queue entry+1 to a empty queue and check if the last call returns MARS_ERROR_BUSY. Pop all data and check if those data are popped in correct order and overwrites haven't occurred. direction=MARS_TASK_QUEUE_MPU_TO_MPU"
+169;closed;POS. FUNC.;TFP4A001;Y;B;HOST/MPU;mars_task_queue_pop;"Check if the caller is blocked when it pop from a empty queue.";"Is the caller blocked when we attempt to pop from a empty queue? direction=MARS_TASK_QUEUE_HOST_TO_MPU"
+170;closed;POS. FUNC.;TFP4A002;Y;B;HOST/MPU;mars_task_queue_pop;"Check if the caller is blocked when it pop from a empty queue.";"Is the caller blocked when we attempt to pop from a empty queue? direction=MARS_TASK_QUEUE_MPU_TO_HOST"
+171;closed;POS. FUNC.;TFP4A003;Y;C;MPU;mars_task_queue_pop;"Check if the caller is blocked when it pop from a empty queue.";"Is the caller blocked when we attempt to pop from a empty queue? direction=MARS_TASK_QUEUE_MPU_TO_MPU"
+172;closed;POS. FUNC.;TFP4D001;N;A;HOST/MPU;mars_task_queue_try_pop;"Check if the func returns MARS_TASK_ERROR_BUSY when it pop from a empty queue.";"Is the return value MARS_ERROR_BUSY when we attempt to pop from a empty queue? direction=MARS_TASK_QUEUE_HOST_TO_MPU"
+173;closed;POS. FUNC.;TFP4D002;N;A;HOST/MPU;mars_task_queue_try_pop;"Check if the func returns MARS_TASK_ERROR_BUSY when it pop from a empty queue.";"Is the return value MARS_ERROR_BUSY when we attempt to pop from a empty queue? direction=MARS_TASK_QUEUE_MPU_TO_HOST"
+174;closed;POS. FUNC.;TFP4D003;N;C;MPU;mars_task_queue_try_pop;"Check if the func returns MARS_TASK_ERROR_BUSY when it pop from a empty queue.";"Is the return value MARS_ERROR_BUSY when we attempt to pop from a empty queue? direction=MARS_TASK_QUEUE_MPU_TO_MPU"
+175;closed;POS. FUNC.;TFP4B001;Y;B;HOST/MPU;mars_task_queue_pop_begin;"Check if the caller is blocked when it pop from a empty queue.";"Is the caller blocked when we attempt to pop from a empty queue? direction=MARS_TASK_QUEUE_HOST_TO_MPU"
+176;closed;POS. FUNC.;TFP4B002;Y;C;MPU;mars_task_queue_pop_begin;"Check if the caller is blocked when it pop from a empty queue.";"Is the caller blocked when we attempt to pop from a empty queue? direction=MARS_TASK_QUEUE_MPU_TO_MPU"
+177;closed;POS. FUNC.;TFP4E001;N;B;HOST/MPU;mars_task_queue_try_pop_begin;"Check if the func returns MARS_TASK_ERROR_BUSY when it pop from a empty queue.";"Is the return value MARS_ERROR_BUSY when we attempt to pop from a empty queue? direction=MARS_TASK_QUEUE_HOST_TO_MPU"
+178;closed;POS. FUNC.;TFP4E002;N;C;MPU;mars_task_queue_try_pop_begin;"Check if the func returns MARS_TASK_ERROR_BUSY when it pop from a empty queue.";"Is the return value MARS_ERROR_BUSY when we attempt to pop from a empty queue? direction=MARS_TASK_QUEUE_MPU_TO_MPU"
+179;closed;POS. FUNC.;TFP4F001;N;B;HOST/MPU;mars_task_queue_peek;"Check if the func works correctly when the queue is full.";"Does peek work correctly when the queue is full? direction=MARS_TASK_QUEUE_HOST_TO_MPU"
+180;closed;POS. FUNC.;TFP4F002;N;B;HOST/MPU;mars_task_queue_peek;"Check if the func works correctly when the queue is full.";"Does peek work correctly when the queue is full? direction=MARS_TASK_QUEUE_MPU_TO_HOST"
+181;closed;POS. FUNC.;TFP4F003;N;C;MPU;mars_task_queue_peek;"Check if the func works correctly when the queue is full.";"Does peek work correctly when the queue is full? direction=MARS_TASK_QUEUE_MPU_TO_MPU"
+182;closed;POS. FUNC.;TFP4I001;N;B;HOST/MPU;mars_task_queue_try_peek;"Check if the func works correctly when the queue is full.";"Does peek work correctly when the queue is full? direction=MARS_TASK_QUEUE_HOST_TO_MPU"
+183;closed;POS. FUNC.;TFP4I002;N;B;HOST/MPU;mars_task_queue_try_peek;"Check if the func works correctly when the queue is full.";"Does peek work correctly when the queue is full? direction=MARS_TASK_QUEUE_MPU_TO_HOST"
+184;closed;POS. FUNC.;TFP4I003;N;C;MPU;mars_task_queue_try_peek;"Check if the func works correctly when the queue is full.";"Does peek work correctly when the queue is full? direction=MARS_TASK_QUEUE_MPU_TO_MPU"
+185;closed;POS. FUNC.;TFP4G001;N;B;HOST/MPU;mars_task_queue_peek_begin/mars_task_queue_peek_end;"Check if the func works correctly when the queue is full.";"Does peek work correctly when the queue is full? direction=MARS_TASK_QUEUE_HOST_TO_MPU"
+186;closed;POS. FUNC.;TFP4G002;N;C;MPU;mars_task_queue_peek_begin/mars_task_queue_peek_end;"Check if the func works correctly when the queue is full.";"Does peek work correctly when the queue is full? direction=MARS_TASK_QUEUE_MPU_TO_MPU"
+187;closed;POS. FUNC.;TFP4J001;N;B;HOST/MPU;mars_task_queue_try_peek_begin/mars_task_queue_try_peek_end;"Check if the func works correctly when the queue is full.";"Does peek work correctly when the queue is full? direction=MARS_TASK_QUEUE_HOST_TO_MPU"
+188;closed;POS. FUNC.;TFP4J002;N;C;MPU;mars_task_queue_try_peek_begin/mars_task_queue_try_peek_end;"Check if the func works correctly when the queue is full.";"Does peek work correctly when the queue is full? direction=MARS_TASK_QUEUE_MPU_TO_MPU"
+189;closed;POS. FUNC.;TFP4F004;Y;B;HOST/MPU;mars_task_queue_peek;"Check if the caller is blocked when it peek from a empty queue.";"Is the caller blocked when the queue is empty? direction=MARS_TASK_QUEUE_HOST_TO_MPU"
+190;closed;POS. FUNC.;TFP4F005;Y;B;HOST/MPU;mars_task_queue_peek;"Check if the caller is blocked when it peek from a empty queue.";"Is the caller blocked when the queue is empty? direction=MARS_TASK_QUEUE_MPU_TO_HOST"
+191;closed;POS. FUNC.;TFP4F006;Y;C;MPU;mars_task_queue_peek;"Check if the caller is blocked when it peek from a empty queue.";"Is the caller blocked when the queue is empty? direction=MARS_TASK_QUEUE_MPU_TO_MPU"
+192;closed;POS. FUNC.;TFP4I004;N;B;HOST/MPU;mars_task_queue_try_peek;"Check if the func returns MARS_TASK_ERROR_BUSY when it peek from a empty queue.";"Is the return value MARS_ERROR_BUSY when the queue is empty? direction=MARS_TASK_QUEUE_HOST_TO_MPU"
+193;closed;POS. FUNC.;TFP4I005;N;B;HOST/MPU;mars_task_queue_try_peek;"Check if the func returns MARS_TASK_ERROR_BUSY when it peek from a empty queue.";"Is the return value MARS_ERROR_BUSY when the queue is empty? direction=MARS_TASK_QUEUE_MPU_TO_HOST"
+194;closed;POS. FUNC.;TFP4I006;N;C;MPU;mars_task_queue_try_peek;"Check if the func returns MARS_TASK_ERROR_BUSY when it peek from a empty queue.";"Is the return value MARS_ERROR_BUSY when the queue is empty? direction=MARS_TASK_QUEUE_MPU_TO_MPU"
+195;closed;POS. FUNC.;TFP4G003;N;B;HOST/MPU;mars_task_queue_peek_begin;"Check if the caller is blocked when it peek from a empty queue.";"Is the caller blocked when the queue is empty? direction=MARS_TASK_QUEUE_HOST_TO_MPU"
+196;closed;POS. FUNC.;TFP4G004;N;B;MPU;mars_task_queue_peek_begin;"Check if the caller is blocked when it peek from a empty queue.";"Is the caller blocked when the queue is empty? direction=MARS_TASK_QUEUE_MPU_TO_MPU"
+197;closed;POS. FUNC.;TFP4J003;N;C;HOST/MPU;mars_task_queue_try_peek_begin;"Check if the func returns MARS_TASK_ERROR_BUSY when it peek from a empty queue.";"Is the return value MARS_ERROR_BUSY when the queue is empty? direction=MARS_TASK_QUEUE_HOST_TO_MPU"
+198;closed;POS. FUNC.;TFP4J004;N;C;MPU;mars_task_queue_try_peek_begin;"Check if the func returns MARS_TASK_ERROR_BUSY when it peek from a empty queue.";"Is the return value MARS_ERROR_BUSY when the queue is empty? direction=MARS_TASK_QUEUE_MPU_TO_MPU"
+199;closed;POS. FUNC.;TFP45010;Y;B;HOST/MPU;mars_task_queue_push/mars_task_queue_pop;"Check if a task which is blocked by calling push is resumed when a data is popped from the queue.";"Is a PPE thread which have been blocked by push woken up by pop? direction=MARS_TASK_QUEUE_HOST_TO_MPU"
+200;closed;POS. FUNC.;TFP45011;Y;B;HOST/MPU;mars_task_queue_push/mars_task_queue_pop;"Check if a task which is blocked by calling push is resumed when a data is popped from the queue.";"Is a MPU task which have been blocked by push woken up by pop? direction=MARS_TASK_QUEUE_MPU_TO_HOST"
+201;closed;POS. FUNC.;TFP45012;Y;C;MPU;mars_task_queue_push/mars_task_queue_pop;"Check if a task which is blocked by calling push is resumed when a data is popped from the queue.";"Is a MPU task which have been blocked by push woken up by pop? direction=MARS_TASK_QUEUE_MPU_TO_MPU"
+202;closed;POS. FUNC.;TFP45018;Y;B;HOST/MPU;mars_task_queue_push/mars_task_queue_try_pop;"Check if a task which is blocked by calling push is resumed when a data is popped from the queue.";"Is a PPE thread which have been blocked by push woken up by pop? direction=MARS_TASK_QUEUE_HOST_TO_MPU"
+203;closed;POS. FUNC.;TFP45019;Y;B;HOST/MPU;mars_task_queue_push/mars_task_queue_try_pop;"Check if a task which is blocked by calling push is resumed when a data is popped from the queue.";"Is a MPU task which have been blocked by push woken up by pop? direction=MARS_TASK_QUEUE_MPU_TO_HOST"
+204;closed;POS. FUNC.;TFP45020;Y;C;MPU;mars_task_queue_push/mars_task_queue_try_pop;"Check if a task which is blocked by calling push is resumed when a data is popped from the queue.";"Is a MPU task which have been blocked by push woken up by pop? direction=MARS_TASK_QUEUE_MPU_TO_MPU"
+205;closed;POS. FUNC.;TFP45016;Y;B;HOST/MPU;mars_task_queue_push/mars_task_queue_pop_begin/mars_task_queue_pop_end;"Check if a task which is blocked by calling push is resumed when a data is popped from the queue.";"Is a MPU task which have been blocked by push woken up by pop? direction=MARS_TASK_QUEUE_HOST_TO_MPU"
+206;closed;POS. FUNC.;TFP45017;Y;C;MPU;mars_task_queue_push/mars_task_queue_pop_begin/mars_task_queue_pop_end;"Check if a task which is blocked by calling push is resumed when a data is popped from the queue.";"Is a MPU task which have been blocked by push woken up by pop? direction=MARS_TASK_QUEUE_MPU_TO_MPU"
+207;closed;POS. FUNC.;TFP45021;Y;A;HOST/MPU;mars_task_queue_push/mars_task_queue_try_pop_begin/mars_task_queue_try_pop_end;"Check if a task which is blocked by calling push is resumed when a data is popped from the queue.";"Is a MPU task which have been blocked by push woken up by pop? direction=MARS_TASK_QUEUE_HOST_TO_MPU"
+208;closed;POS. FUNC.;TFP45022;Y;C;MPU;mars_task_queue_push/mars_task_queue_try_pop_begin/mars_task_queue_try_pop_end;"Check if a task which is blocked by calling push is resumed when a data is popped from the queue.";"Is a MPU task which have been blocked by push woken up by pop? direction=MARS_TASK_QUEUE_MPU_TO_MPU"
+209;closed;POS. FUNC.;TFP46003;Y;A;HOST/MPU;mars_task_queue_push_begin/mars_task_queue_pop;"Check if a task which is blocked by calling push is resumed when a data is popped from the queue.";"Is a MPU task which have been blocked by push woken up by pop? direction=MARS_TASK_QUEUE_MPU_TO_HOST"
+210;closed;POS. FUNC.;TFP46004;Y;C;MPU;mars_task_queue_push_begin/mars_task_queue_pop;"Check if a task which is blocked by calling push is resumed when a data is popped from the queue.";"Is a MPU task which have been blocked by push woken up by pop? direction=MARS_TASK_QUEUE_MPU_TO_MPU"
+211;closed;POS. FUNC.;TFP46008;Y;B;HOST/MPU;mars_task_queue_push_begin/mars_task_queue_try_pop;"Check if a task which is blocked by calling push is resumed when a data is popped from the queue.";"Is a MPU task which have been blocked by push woken up by pop? direction=MARS_TASK_QUEUE_MPU_TO_HOST"
+212;closed;POS. FUNC.;TFP46009;Y;C;MPU;mars_task_queue_push_begin/mars_task_queue_try_pop;"Check if a task which is blocked by calling push is resumed when a data is popped from the queue.";"Is a MPU task which have been blocked by push woken up by pop? direction=MARS_TASK_QUEUE_MPU_TO_MPU"
+213;closed;POS. FUNC.;TFP46006;Y;C;MPU;mars_task_queue_push_begin/mars_task_queue_pop_begin/mars_task_queueu_pop_end;"Check if a task which is blocked by calling push is resumed when a data is popped from the queue.";"Is a MPU task which have been blocked by push woken up by pop? direction=MARS_TASK_QUEUE_MPU_TO_MPU"
+214;closed;POS. FUNC.;TFP46005;Y;C;MPU;mars_task_queue_push_begin/mars_task_queue_pop_begin/mars_task_queue_pop_end;"Check if a task which is blocked by calling push is resumed when a data is popped from the queue.";"Is a MPU task which have been blocked by push woken up by pop? direction=MARS_TASK_QUEUE_MPU_TO_MPU"
+215;closed;POS. FUNC.;TFP46011;Y;C;MPU;mars_task_queue_push_begin/mars_task_queue_try_pop_begin/mars_task_queue_try_pop_end;"Check if a task which is blocked by calling push is resumed when a data is popped from the queue.";"Is a MPU task which have been blocked by push woken up by pop? direction=MARS_TASK_QUEUE_MPU_TO_MPU"
+216;closed;POS. FUNC.;TFP46010;Y;C;MPU;mars_task_queue_push_begin/mars_task_queue_try_pop_begin/mars_task_queue_try_pop_end;"Check if a task which is blocked by calling push is resumed when a data is popped from the queue.";"Is a MPU task which have been blocked by push woken up by pop? direction=MARS_TASK_QUEUE_MPU_TO_MPU"
+217;closed;POS. FUNC.;TFP4A010;Y;B;HOST/MPU;mars_task_queue_pop/mars_task_queue_push;"Check if a task which is blocked by calling pop is resumed when data a data is pushed into the queue.";"Is a MPU task which have been blocked by pop woken up by push? direction=MARS_TASK_QUEUE_HOST_TO_MPU"
+218;closed;POS. FUNC.;TFP4A011;Y;B;HOST/MPU;mars_task_queue_pop/mars_task_queue_push;"Check if a task which is blocked by calling pop is resumed when data a data is pushed into the queue.";"Is a PPE thread which have been blocked by pop woken up by push? direction=MARS_TASK_QUEUE_MPU_TO_HOST"
+219;closed;POS. FUNC.;TFP4A012;Y;C;MPU;mars_task_queue_pop/mars_task_queue_push;"Check if a task which is blocked by calling pop is resumed when data a data is pushed into the queue.";"Is a MPU task which have been blocked by pop woken up by push? direction=MARS_TASK_QUEUE_MPU_TO_MPU"
+220;closed;POS. FUNC.;TFP4A015;Y;B;HOST/MPU;mars_task_queue_pop/mars_task_queue_try_push;"Check if a task which is blocked by calling pop is resumed when data a data is pushed into the queue.";"Is a MPU task which have been blocked by pop woken up by push? direction=MARS_TASK_QUEUE_HOST_TO_MPU"
+221;closed;POS. FUNC.;TFP4A016;Y;B;HOST/MPU;mars_task_queue_pop/mars_task_queue_try_push;"Check if a task which is blocked by calling pop is resumed when data a data is pushed into the queue.";"Is a PPE thread which have been blocked by pop woken up by push? direction=MARS_TASK_QUEUE_MPU_TO_HOST"
+222;closed;POS. FUNC.;TFP4A017;Y;C;MPU;mars_task_queue_pop/mars_task_queue_try_push;"Check if a task which is blocked by calling pop is resumed when data a data is pushed into the queue.";"Is a MPU task which have been blocked by pop woken up by push? direction=MARS_TASK_QUEUE_MPU_TO_MPU"
+223;closed;POS. FUNC.;TFP4A013;Y;B;HOST/MPU;mars_task_queue_pop/mars_task_queue_push_begin/mars_task_queue_push_end;"Check if a task which is blocked by calling pop is resumed when data a data is pushed into the queue.";"Is a PPE thread which have been blocked by pop woken up by push? direction=MARS_TASK_QUEUE_MPU_TO_HOST"
+224;closed;POS. FUNC.;TFP4A014;Y;C;MPU;mars_task_queue_pop/mars_task_queue_push_begin/mars_task_queue_push_end;"Check if a task which is blocked by calling pop is resumed when data a data is pushed into the queue.";"Is a MPU task which have been blocked by pop woken up by push? direction=MARS_TASK_QUEUE_MPU_TO_MPU"
+225;closed;POS. FUNC.;TFP4A018;Y;A;HOST/MPU;mars_task_queue_pop/mars_task_queue_try_push_begin/mars_task_queue_try_push_end;"Check if a task which is blocked by calling pop is resumed when data a data is pushed into the queue.";"Is a PPE thread which have been blocked by pop woken up by push? direction=MARS_TASK_QUEUE_MPU_TO_HOST"
+226;closed;POS. FUNC.;TFP4A019;Y;C;MPU;mars_task_queue_pop/mars_task_queue_try_push_begin/mars_task_queue_try_push_end;"Check if a task which is blocked by calling pop is resumed when data a data is pushed into the queue.";"Is a MPU task which have been blocked by pop woken up by push? direction=MARS_TASK_QUEUE_MPU_TO_MPU"
+227;closed;POS. FUNC.;TFP4B004;Y;A;HOST/MPU;mars_task_queue_pop_begin/mars_task_queue_push;"Check if a task which is blocked by calling pop is resumed when data a data is pushed into the queue.";"Is a MPU task which have been blocked by pop woken up by push? direction=MARS_TASK_QUEUE_HOST_TO_MPU"
+228;closed;POS. FUNC.;TFP4B005;Y;C;MPU;mars_task_queue_pop_begin/mars_task_queue_push;"Check if a task which is blocked by calling pop is resumed when data a data is pushed into the queue.";"Is a MPU task which have been blocked by pop woken up by push? direction=MARS_TASK_QUEUE_MPU_TO_MPU"
+229;closed;POS. FUNC.;TFP4B007;Y;B;HOST/MPU;mars_task_queue_pop_begin/mars_task_queue_try_push;"Check if a task which is blocked by calling pop is resumed when data a data is pushed into the queue.";"Is a MPU task which have been blocked by pop woken up by push? direction=MARS_TASK_QUEUE_HOST_TO_MPU"
+230;closed;POS. FUNC.;TFP4B008;Y;C;MPU;mars_task_queue_pop_begin/mars_task_queue_try_push;"Check if a task which is blocked by calling pop is resumed when data a data is pushed into the queue.";"Is a MPU task which have been blocked by pop woken up by push? direction=MARS_TASK_QUEUE_MPU_TO_MPU"
+231;closed;POS. FUNC.;TFP4B006;Y;C;MPU;mars_task_queue_pop_begin/mars_task_queue_push_begin/mars_task_queue_push_end;"Check if a task which is blocked by calling pop is resumed when data a data is pushed into the queue.";"Is a MPU task which have been blocked by pop woken up by push? direction=MARS_TASK_QUEUE_MPU_TO_MPU"
+232;closed;POS. FUNC.;TFP4E003;Y;C;MPU;mars_task_queue_pop_begin/mars_task_queue_push_begin/mars_task_queue_push_end;"Check if a task which is blocked by calling pop is resumed when data a data is pushed into the queue.";"Is a MPU task which have been blocked by pop woken up by push? direction=MARS_TASK_QUEUE_MPU_TO_MPU"
+233;closed;POS. FUNC.;TFP4B009;Y;C;MPU;mars_task_queue_pop_begin/mars_task_queue_try_push_begin/mars_task_queue_push_end;"Check if a task which is blocked by calling pop is resumed when data a data is pushed into the queue.";"Is a MPU task which have been blocked by pop woken up by push? direction=MARS_TASK_QUEUE_MPU_TO_MPU"
+234;closed;POS. FUNC.;TFP4E006;Y;C;MPU;mars_task_queue_pop_begin/mars_task_queue_try_push_begin/mars_task_queue_try_push_end;"Check if a task which is blocked by calling pop is resumed when data a data is pushed into the queue.";"Is a MPU task which have been blocked by pop woken up by push? direction=MARS_TASK_QUEUE_MPU_TO_MPU"
+235;closed;POS. FUNC.;TFP4F010;Y;B;HOST/MPU;mars_task_queue_peek/mars_task_queue_push;"Check if a task which is blocked by calling peek is resumed when data a data is pushed into the queue.";"Is a MPU task which have been blocked by peek woken up by push? direction=MARS_TASK_QUEUE_HOST_TO_MPU"
+236;closed;POS. FUNC.;TFP4F011;Y;B;HOST/MPU;mars_task_queue_peek/mars_task_queue_push;"Check if a task which is blocked by calling peek is resumed when data a data is pushed into the queue.";"Is a PPE thread which have been blocked by peek woken up by push? direction=MARS_TASK_QUEUE_MPU_TO_HOST"
+237;closed;POS. FUNC.;TFP4F012;Y;C;MPU;mars_task_queue_peek/mars_task_queue_push;"Check if a task which is blocked by calling peek is resumed when data a data is pushed into the queue.";"Is a MPU task which have been blocked by peek woken up by push? direction=MARS_TASK_QUEUE_MPU_TO_MPU"
+238;closed;POS. FUNC.;TFP4F015;Y;B;HOST/MPU;mars_task_queue_peek/mars_task_queue_try_push;"Check if a task which is blocked by calling peek is resumed when data a data is pushed into the queue.";"Is a MPU task which have been blocked by peek woken up by push? direction=MARS_TASK_QUEUE_HOST_TO_MPU"
+239;closed;POS. FUNC.;TFP4F016;Y;B;HOST/MPU;mars_task_queue_peek/mars_task_queue_try_push;"Check if a task which is blocked by calling peek is resumed when data a data is pushed into the queue.";"Is a PPE thread which have been blocked by peek woken up by push? direction=MARS_TASK_QUEUE_MPU_TO_HOST"
+240;closed;POS. FUNC.;TFP4F017;Y;C;MPU;mars_task_queue_peek/mars_task_queue_try_push;"Check if a task which is blocked by calling peek is resumed when data a data is pushed into the queue.";"Is a MPU task which have been blocked by peek woken up by push? direction=MARS_TASK_QUEUE_MPU_TO_MPU"
+241;closed;POS. FUNC.;TFP4F013;Y;B;HOST/MPU;mars_task_queue_peek/mars_task_queue_push_begin/mars_task_queue_push_end;"Check if a task which is blocked by calling peek is resumed when data a data is pushed into the queue.";"Is a PPE thread which have been blocked by peek woken up by push? direction=MARS_TASK_QUEUE_MPU_TO_HOST"
+242;closed;POS. FUNC.;TFP4F014;Y;C;MPU;mars_task_queue_peek/mars_task_queue_push_begin/mars_task_queue_push_end;"Check if a task which is blocked by calling peek is resumed when data a data is pushed into the queue.";"Is a MPU task which have been blocked by peek woken up by push? direction=MARS_TASK_QUEUE_MPU_TO_MPU"
+243;closed;POS. FUNC.;TFP4F018;Y;B;HOST/MPU;mars_task_queue_peek/mars_task_queue_try_push_begin/mars_task_queue_try_push_end;"Check if a task which is blocked by calling peek is resumed when data a data is pushed into the queue.";"Is a PPE thread which have been blocked by peek woken up by push? direction=MARS_TASK_QUEUE_MPU_TO_HOST"
+244;closed;POS. FUNC.;TFP4F019;Y;C;MPU;mars_task_queue_peek/mars_task_queue_try_push_begin/mars_task_queue_try_push_end;"Check if a task which is blocked by calling peek is resumed when data a data is pushed into the queue.";"Is a MPU task which have been blocked by peek woken up by push? direction=MARS_TASK_QUEUE_MPU_TO_MPU"
+245;closed;POS. FUNC.;TFP4G006;Y;B;HOST/MPU;mars_task_queue_peek_begin/mars_task_queue_push;"Check if a task which is blocked by calling peek is resumed when data a data is pushed into the queue.";"Is a MPU task which have been blocked by peek woken up by push? direction=MARS_TASK_QUEUE_HOST_TO_MPU"
+246;closed;POS. FUNC.;TFP4G007;Y;C;MPU;mars_task_queue_peek_begin/mars_task_queue_push;"Check if a task which is blocked by calling peek is resumed when data a data is pushed into the queue.";"Is a MPU task which have been blocked by peek woken up by push? direction=MARS_TASK_QUEUE_MPU_TO_MPU"
+247;closed;POS. FUNC.;TFP4G009;Y;B;HOST/MPU;mars_task_queue_peek_begin/mars_task_queue_try_push;"Check if a task which is blocked by calling peek is resumed when data a data is pushed into the queue.";"Is a MPU task which have been blocked by peek woken up by push? direction=MARS_TASK_QUEUE_HOST_TO_MPU"
+248;closed;POS. FUNC.;TFP4G010;Y;C;MPU;mars_task_queue_peek_begin/mars_task_queue_try_push;"Check if a task which is blocked by calling peek is resumed when data a data is pushed into the queue.";"Is a MPU task which have been blocked by peek woken up by push? direction=MARS_TASK_QUEUE_MPU_TO_MPU"
+249;closed;POS. FUNC.;TFP4G008;Y;A;MPU;mars_task_queue_peek_begin/mars_task_queue_push_begin/mars_task_queue_push_end;"Check if a task which is blocked by calling peek is resumed when data a data is pushed into the queue.";"Is a MPU task which have been blocked by peek woken up by push? direction=MARS_TASK_QUEUE_MPU_TO_MPU"
+250;closed;POS. FUNC.;TFP4J005;Y;A;MPU;mars_task_queue_peek_begin/mars_task_queue_push_begin/mars_task_queue_push_end;"Check if a task which is blocked by calling peek is resumed when a data is pushed into the queue.";"Is a MPU task which have been blocked by peek woken up by push? direction=MARS_TASK_QUEUE_MPU_TO_MPU"
+251;closed;POS. FUNC.;TFP4G011;Y;A;MPU;mars_task_queue_peek_begin/mars_task_queue_try_push_begin/mars_task_queue_push_end;"Check if a task which is blocked by calling peek is resumed when data a data is pushed into the queue.";"Is a MPU task which have been blocked by peek woken up by push? direction=MARS_TASK_QUEUE_MPU_TO_MPU"
+252;closed;POS. FUNC.;TFP4J008;Y;A;MPU;mars_task_queue_peek_begin/mars_task_queue_try_push_begin/mars_task_queue_try_push_end;"Check if a task which is blocked by calling peek is resumed when a data is pushed into the queue.";"Is a MPU task which have been blocked by peek woken up by push? direction=MARS_TASK_QUEUE_MPU_TO_MPU"
+253;closed;POS. FUNC.;TFP45004;Y;B;HOST/MPU;mars_task_queue_push;"Check if the func is thread-safe.";"Is push thread-safe? direction=MARS_TASK_QUEUE_HOST_TO_MPU"
+254;closed;POS. FUNC.;TFP45005;Y;B;HOST/MPU;mars_task_queue_push;"Check if the func is thread-safe.";"Is push thread-safe? direction=MARS_TASK_QUEUE_MPU_TO_HOST"
+255;closed;POS. FUNC.;TFP45006;Y;C;MPU;mars_task_queue_push;"Check if the func is thread-safe.";"Is push thread-safe? direction=MARS_TASK_QUEUE_MPU_TO_MPU"
+256;closed;POS. FUNC.;TFP48004;Y;B;HOST/MPU;mars_task_queue_try_push;"Check if the func is thread-safe.";"Is push thread-safe? direction=MARS_TASK_QUEUE_HOST_TO_MPU"
+257;closed;POS. FUNC.;TFP48005;Y;B;HOST/MPU;mars_task_queue_try_push;"Check if the func is thread-safe.";"Is push thread-safe? direction=MARS_TASK_QUEUE_MPU_TO_HOST"
+258;closed;POS. FUNC.;TFP48006;Y;C;MPU;mars_task_queue_try_push;"Check if the func is thread-safe.";"Is push thread-safe? direction=MARS_TASK_QUEUE_MPU_TO_MPU"
+259;closed;POS. FUNC.;TFP46007;Y;B;HOST/MPU;mars_task_queue_push_begin/mars_task_queue_push_end;"Check if the func is thread-safe.";"Is push thread-safe? direction=MARS_TASK_QUEUE_MPU_TO_HOST"
+260;closed;POS. FUNC.;TFP47001;Y;C;MPU;mars_task_queue_push_end/mars_task_queue_push_end;"Check if the func is thread-safe.";"Is push thread-safe? direction=MARS_TASK_QUEUE_MPU_TO_MPU"
+261;closed;POS. FUNC.;TFP49003;Y;B;HOST/MPU;mars_task_queue_try_push_begin/mars_task_queue_try_push_end;"Check if the func is thread-safe.";"Is push thread-safe? direction=MARS_TASK_QUEUE_MPU_TO_HOST"
+262;closed;POS. FUNC.;TFP49004;Y;C;MPU;mars_task_queue_try_push_begin/mars_task_queue_try_push_end;"Check if the func is thread-safe.";"Is push thread-safe? direction=MARS_TASK_QUEUE_MPU_TO_MPU"
+263;new;POS. FUNC.;TFP4A004;Y;B;HOST/MPU;mars_task_queue_pop;"Check if the func is thread-safe.";"Is pop thread-safe? direction=MARS_TASK_QUEUE_HOST_TO_MPU"
+264;closed;POS. FUNC.;TFP4A005;Y;B;HOST/MPU;mars_task_queue_pop;"Check if the func is thread-safe.";"Is pop thread-safe? direction=MARS_TASK_QUEUE_MPU_TO_HOST"
+265;closed;POS. FUNC.;TFP4A006;Y;C;MPU;mars_task_queue_pop;"Check if the func is thread-safe.";"Is pop thread-safe? direction=MARS_TASK_QUEUE_MPU_TO_MPU"
+266;closed;POS. FUNC.;TFP4D004;Y;B;HOST/MPU;mars_task_queue_try_pop;"Check if the func is thread-safe.";"Is pop thread-safe? direction=MARS_TASK_QUEUE_HOST_TO_MPU"
+267;closed;POS. FUNC.;TFP4D005;Y;B;HOST/MPU;mars_task_queue_try_pop;"Check if the func is thread-safe.";"Is pop thread-safe? direction=MARS_TASK_QUEUE_MPU_TO_HOST"
+268;closed;POS. FUNC.;TFP4D006;Y;C;MPU;mars_task_queue_try_pop;"Check if the func is thread-safe.";"Is pop thread-safe? direction=MARS_TASK_QUEUE_MPU_TO_MPU"
+269;closed;POS. FUNC.;TFP4B003;Y;B;HOST/MPU;mars_task_queue_pop_begin/mars_task_queue_pop_end;"Check if the func is thread-safe.";"Is pop thread-safe? direction=MARS_TASK_QUEUE_HOST_TO_MPU"
+270;closed;POS. FUNC.;TFP4C001;Y;C;MPU;mars_task_queue_pop_end/mars_task_queue_pop_end;"Check if the func is thread-safe.";"Is pop thread-safe? direction=MARS_TASK_QUEUE_MPU_TO_MPU"
+271;closed;POS. FUNC.;TFP4E004;Y;B;HOST/MPU;mars_task_queue_try_pop_begin/mars_task_queue_try_pop_end;"Check if the func is thread-safe.";"Is pop thread-safe? direction=MARS_TASK_QUEUE_HOST_TO_MPU"
+272;closed;POS. FUNC.;TFP4E005;Y;C;MPU;mars_task_queue_try_pop_begin/mars_task_queue_try_pop_end;"Check if the func is thread-safe.";"Is pop thread-safe? direction=MARS_TASK_QUEUE_MPU_TO_MPU"
+273;closed;POS. FUNC.;TFP4F007;Y;B;HOST/MPU;mars_task_queue_peek;"Check if the func is thread-safe.";"Is peek thread-safe? direction=MARS_TASK_QUEUE_HOST_TO_MPU"
+274;closed;POS. FUNC.;TFP4F008;Y;B;HOST/MPU;mars_task_queue_peek;"Check if the func is thread-safe.";"Is peek thread-safe? direction=MARS_TASK_QUEUE_MPU_TO_HOST"
+275;closed;POS. FUNC.;TFP4F009;Y;C;MPU;mars_task_queue_peek;"Check if the func is thread-safe.";"Is peek thread-safe? direction=MARS_TASK_QUEUE_MPU_TO_MPU"
+276;closed;POS. FUNC.;TFP4I007;Y;B;HOST/MPU;mars_task_queue_try_peek;"Check if the func is thread-safe.";"Is peek thread-safe? direction=MARS_TASK_QUEUE_HOST_TO_MPU"
+277;closed;POS. FUNC.;TFP4I008;Y;B;HOST/MPU;mars_task_queue_try_peek;"Check if the func is thread-safe.";"Is peek thread-safe? direction=MARS_TASK_QUEUE_MPU_TO_HOST"
+278;closed;POS. FUNC.;TFP4I009;Y;C;MPU;mars_task_queue_try_peek;"Check if the func is thread-safe.";"Is peek thread-safe? direction=MARS_TASK_QUEUE_MPU_TO_MPU"
+279;closed;POS. FUNC.;TFP4G005;Y;B;HOST/MPU;mars_task_queue_peek_begin/mars_task_queue_peek_end;"Check if the func is thread-safe.";"Is peek thread-safe? direction=MARS_TASK_QUEUE_HOST_TO_MPU"
+280;closed;POS. FUNC.;TFP4H001;Y;C;MPU;mars_task_queue_peek_end/mars_task_queue_peek_end;"Check if the func is thread-safe.";"Is peek thread-safe? direction=MARS_TASK_QUEUE_MPU_TO_MPU"
+281;closed;POS. FUNC.;TFP4J006;Y;B;HOST/MPU;mars_task_queue_try_peek_begin/mars_task_queue_try_peek_end;"Check if the func is thread-safe.";"Is peek thread-safe? direction=MARS_TASK_QUEUE_HOST_TO_MPU"
+282;closed;POS. FUNC.;TFP4J007;Y;C;MPU;mars_task_queue_try_peek_begin/mars_task_queue_try_peek_end;"Check if the func is thread-safe.";"Is peek thread-safe? direction=MARS_TASK_QUEUE_MPU_TO_MPU"
+283;closed;POS. FUNC.;TFP45013;Y;A;HOST/MPU;mars_task_queue_push/mars_task_queue_pop;"Check if the func is thread-safe.";"Is the mixed use of push and pop at the same time is thread-safe? direction=MARS_TASK_QUEUE_HOST_TO_MPU"
+284;closed;POS. FUNC.;TFP45014;Y;A;HOST/MPU;mars_task_queue_push/mars_task_queue_pop;"Check if the func is thread-safe.";"Is the mixed use of push and popat the same time is thread-safe? direction=MARS_TASK_QUEUE_MPU_TO_HOST"
+285;closed;POS. FUNC.;TFP45015;Y;C;MPU;mars_task_queue_push/mars_task_queue_pop;"Check if the func is thread-safe.";"Is the mixed use of push and pop at the same time is thread-safe? direction=MARS_TASK_QUEUE_MPU_TO_MPU"
+286;closed;POS. FUNC.;TFP45007;Y;A;HOST/MPU;mars_task_queue_push/mars_task_queue_peek;"Check if the func is thread-safe.";"Is the mixed use of push and peek at the same time is thread-safe? direction=MARS_TASK_QUEUE_HOST_TO_MPU"
+287;closed;POS. FUNC.;TFP45008;Y;A;HOST/MPU;mars_task_queue_push/mars_task_queue_peek;"Check if the func is thread-safe.";"Is the mixed use of push and peek at the same time is thread-safe? direction=MARS_TASK_QUEUE_MPU_TO_HOST"
+288;closed;POS. FUNC.;TFP45009;Y;C;MPU;mars_task_queue_push/mars_task_queue_peek;"Check if the func is thread-safe.";"Is the mixed use of push and peek at the same time is thread-safe? direction=MARS_TASK_QUEUE_MPU_TO_MPU"
+289;closed;POS. FUNC.;TFP4A007;Y;B;HOST/MPU;mars_task_queue_pop/mars_task_queue_peek;"Check if the func is thread-safe.";"Is the mixed use of pop and peek at the same time is thread-safe? direction=MARS_TASK_QUEUE_HOST_TO_MPU"
+290;closed;POS. FUNC.;TFP4A008;Y;B;HOST/MPU;mars_task_queue_pop/mars_task_queue_peek;"Check if the func is thread-safe.";"Is the mixed use of pop and peek at the same time is thread-safe? direction=MARS_TASK_QUEUE_MPU_TO_HOST"
+291;closed;POS. FUNC.;TFP4A009;Y;C;MPU;mars_task_queue_pop/mars_task_queue_peek;"Check if the func is thread-safe.";"Is the mixed use of push and peek at the same time is thread-safe? direction=MARS_TASK_QUEUE_MPU_TO_MPU"
+292;closed;POS. FUNC.;TFP01001;N;B;HOST;mars_context_create;"Check if a MARS context is initialized correctly with num_mpus=1.";"Check if the call returns MARS_SUCCESS."
+293;closed;POS. FUNC.;TFP01002;N;A;HOST;mars_context_create;"Check if a MARS context is initialized correctly when num_mpus equals to the number of physical MPUs.";"Check if the call returns MARS_SUCCESS."
+294;closed;POS. FUNC.;TFP01003;N;C;HOST;mars_context_create;"Check if mars_initialize is thread-safe.";"Create MARS contexts respectively for multiple host side threads by calling mars_initialize simultaneously and check if all calls return MARS_SUCCESS."
+295;closed;POS. FUNC.;TFP02001;N;A;HOST;mars_context_destroy;"Check if a MARS context is finalized correctly";"Check if the call returns MARS_SUCCESS."
+296;closed;POS. FUNC.;TFP02002;N;C;HOST;mars_context_destroy;"Check if mars_context_destroy is thread-safe.";"Create MARS contexts respectively for multiple host side thread by calling mars_context_create. After that, call mars_task_finalize by all threads with each contexts simultaneously and check if all calls return MARS_SUCCESS."
+297;closed;POS. FUNC.;TFP01004;N;C;HOST;mars_context_create/mars_context_destroy;"Check if mars_context_create and mars_context_destroy are thread-safe.";"Create MARS contexts respectively for multiple host side thread by calling mars_context_create. After that, call mars_task_finalize by those threads and call mars_task_initialize by other multiple threads. All these calls need to be done simultaneously. Check if all calls return MARS_SUCCESS."
+309;closed;POS. FUNC.;TFP01005;N;A;HOST;mars_context_create;"Check if a shared MARS context is initialized correctly.";"Call mars_task_create two times with shared=1 and check if the result of both call is MARS_SUCCESS and the address of both context is same."
+400;closed;POS. FUNC.;TFP25001;Y;B;MPU;mars_task_barrier_try_notify;"Check if mars_task_barrier_try_notify succeeds.";"Check if mars_task_barrier_try_notify succeeds while total notification doesn't reach the argument total of mars_task_barrier_initialize."
+401;closed;POS. FUNC.;TFP25002;Y;B;MPU;mars_task_barrier_try_notify;"Check if mars_task_barrier_try_notify is thread-safe.";"Check if one of the calls of mars_task_barrier_try_notify returns MARS_ERROR_BUSY when MARS tasks of the same number that added 1 to the argument total of mars_task_barrier_initialize call it simultaneously. Above isn't sufficient. It may be better that checking the waiting condition is compliant to the specification. Discuss the way of test at the time of implementation."
+402;closed;POS. FUNC.;TFP26001;Y;B;MPU;mars_task_barrier_try_wait;"Check if mars_task_barrier_try_wait succeeds when barrier_ea is valid.";"Call mars_task_barrier_try_wait after mars_task_barrier_notify, and check if the caller returns MARS_SUCCESS.. The aim of this test is to check the caller doesn't return MARS_ERROR_BUSY under the satisfied situation."
+403;closed;POS. FUNC.;TFP26002;Y;B;MPU;mars_task_barrier_try_wait;"Check if mars_task_barrier_try_wait doesn't return MARS_SUCCESS until the condition is met.";"Check if mars_task_barrier_try_wait doesn't return until the total notification reaches the argument total of mars_task_barrier_initialize. The aim of this test is to check the caller doesn't return MARS_ERROR_BUSY under ther satisfied situation."
+328;new;PERFORMANCE;TPF10001;N;B;;;"Measure time to initialize/finalize tasks. Sample implementation: 1. Start measurement. 2. Do following steps on host repeatedly. i. Create tasks until the workload queue becomes full. ii. Finalize all the tasks 3. Finish measurement.";
+329;new;PERFORMANCE;TPF10002;N;B;;;"Measure time to schedule/wait for tasks by host. Sample implementation: 1. Create tasks which do nothing (just returns from main function) until the workload queue becomes full. 2. Start measurement. 3. Schedule all the tasks and wait for them on host repeatedly. 4. Finish measurement. 5. Finalize the tasks.";
+330;closed;PERFORMANCE;TPF10003;N;A;;;"Measure performance of scheduler with single priority. Sample implementation: 1. Create tasks which call mars_task_yield repeatedly. 2. Start measurement until the workload queue becomes full. 2. Start measurement. 3. Schedule all the tasks with the same priority and wait for them on host. 4. Finish measurement. 5. Finalize the tasks.";
+331;closed;PERFORMANCE;TPF10004;N;A;;;"Measure performance of scheduler with various priorities. Sample implementation: 1. Create tasks which call mars_task_yield repeatedly. 2. Start measurement until the workload queue becomes full. 2. Start measurement. 3. Schedule all the tasks with various priorities and wait for them on host. 4. Finish measurement. 5. Finalize the tasks.";
+332;new;PERFORMANCE;TPF70001;N;A;;;"Measure performance of mutex with single host thread. Sample implementation:";
+333;new;PERFORMANCE;TPF70002;N;A;;;"Measure performance of mutex with single task. Sample implementation:";
+334;new;PERFORMANCE;TPF70003;N;A;;;"Measure performance of mutex with two host threads with intentional contention. Sample implementation:";
+335;new;PERFORMANCE;TPF70004;N;A;;;"Measure performance of mutex with two tasks with intentional contention. Sample implementation:";
+336;new;PERFORMANCE;TPF70005;N;A;;;"Measure performance of mutex with single host thread and single task with intentional contention. Sample implementation:";
+337;new;PERFORMANCE;TPF60001;N;C;;;"Measure performance of signal from HOST to MPU with single task. Sample implementation:";
+338;new;PERFORMANCE;TPF60002;N;C;;;"Measure performance of signal from HOST to MPU with multiple tasks (<= # of MPUs). Sample implementation:";
+339;new;PERFORMANCE;TPF60003;N;C;;;"Measure performance of signal from HOST to MPU with multiple tasks (> # of MPUs). Sample implementation:";
+340;new;PERFORMANCE;TPF60004;N;C;;;"Measure performance of signal from MPU to MPU with single task. Sample implementation:";
+341;new;PERFORMANCE;TPF60005;N;C;;;"Measure performance of signal from MPU to MPU with multiple tasks (<= # of MPUs). Sample implementation:";
+342;new;PERFORMANCE;TPF60006;N;C;;;"Measure performance of signal from MPU to MPU with multiple tasks (> # of MPUs). Sample implementation:";
+343;new;PERFORMANCE;TPF20001;N;B;;;"Measure performance of barrier with multiple tasks (<= # of MPUs). Sample implementation: 1. Create tasks which do following steps repeatedly: i. Notify barrier. ii. Wait for the barrier. 2. Start measurement. 3. Schedule the tasks and wait for them on host. 4. Finish measurement. 5. Finalize the tasks.";
+344;new;PERFORMANCE;TPF20002;N;B;;;"Measure performance of barrier with multiple tasks (> # of MPUs). Sample implementation: 1. Create tasks which do following steps repeatedly: i. Notify barrier. ii. Wait for the barrier. 2. Start measurement. 3. Schedule the tasks and wait for them on host. 4. Finish measurement. 5. Finalize the tasks.";
+345;closed;PERFORMANCE;TPF30001;N;A;;;"Measure performance of MPU to HOST event flag with multiple tasks (<= # of MPUs). Sample implementation:";
+346;closed;PERFORMANCE;TPF30002;N;A;;;"Measure performance of MPU to HOST event flag with multiple tasks (> # of MPUs). Sample implementation:";
+347;assigned;PERFORMANCE;TPF30003;N;A;;;"Measure performance of MPU to MPU event flag with multiple tasks (<= # of MPUs). Sample implementation:";
+348;assigned;PERFORMANCE;TPF30004;N;A;;;"Measure performance of MPU to MPU event flag with multiple tasks (> # of MPUs). Sample implementation:";
+349;new;PERFORMANCE;TPF50001;N;C;;;"Measure performance of semaphore with single task. Sample implementation:";
+350;new;PERFORMANCE;TPF50002;N;B;;;"Measure performance of semaphore with multiple tasks (<= #of MPUs) without intentional contention. Sample implementation:";
+351;new;PERFORMANCE;TPF50003;N;B;;;"Measure performance of semaphore with multiple tasks (> #of MPUs) without intentional contention. Sample implementation:";
+352;new;PERFORMANCE;TPF50004;N;B;;;"Measure performance of semaphore with multiple tasks (<= #of MPUs) with intentional contention. Sample implementation:";
+353;new;PERFORMANCE;TPF50005;N;B;;;"Measure performance of semaphore with multiple tasks (> #of MPUs) with intentional contention. Sample implementation:";
+354;closed;PERFORMANCE;TPF40001;N;A;;;"Measure performance of 1 HOST to 1 MPU queue with single task mainly with empty condition. Sample implementation:";
+355;closed;PERFORMANCE;TPF40002;N;A;;;"Measure performance of 1 HOST to 1 MPU queue with single task mainly with full condition. Sample implementation:";
+356;closed;PERFORMANCE;TPF40003;Y;C;;;"Measure performance of 1 HOST to 1 MPU queue with single task mainly with intermediate condition. Sample implementation:";
+357;closed;PERFORMANCE;TPF40004;N;A;;;"Measure performance of 1 MPU to 1 HOST queue with single task mainly with empty condition. Sample implementation:";
+358;closed;PERFORMANCE;TPF40005;N;A;;;"Measure performance of 1 MPU to 1 HOST queue with single task mainly with full condition. Sample implementation:";
+359;closed;PERFORMANCE;TPF40006;Y;C;;;"Measure performance of 1 MPU to 1 HOST queue with single task mainly with intermediate condition. Sample implementation:";
+360;closed;PERFORMANCE;TPF40007;N;A;;;"Measure performance of 1 MPU to 1 MPU queue with single task mainly with empty condition. Sample implementation:";
+361;closed;PERFORMANCE;TPF40008;N;A;;;"Measure performance of 1 MPU to 1 MPU queue with single task mainly with full condition. Sample implementation:";
+362;closed;PERFORMANCE;TPF40009;Y;C;;;"Measure performance of 1 MPU to 1 MPU queue with single task mainly with intermediate condition. Sample implementation:";
+363;closed;PERFORMANCE;TPF40010;N;A;;;"Measure performance of 1 HOST to 1 MPU queue with multiple tasks (<= # of MPUs) mainly with empty condition. Sample implementation:";
+364;closed;PERFORMANCE;TPF40011;N;A;;;"Measure performance of 1 HOST to 1 MPU queue with multiple tasks (<= # of MPUs) mainly with full condition. Sample implementation:";
+365;new;PERFORMANCE;TPF40012;Y;C;;;"Measure performance of 1 HOST to 1 MPU queue with multiple tasks (<= # of MPUs) mainly with intermediate condition. Sample implementation:";
+366;reopened;PERFORMANCE;TPF40013;N;A;;;"Measure performance of 1 MPU to 1 HOST queue with multiple tasks (<= # of MPUs) mainly with empty condition. Sample implementation:";
+367;closed;PERFORMANCE;TPF40014;N;A;;;"Measure performance of 1 MPU to 1 HOST queue with multiple tasks (<= # of MPUs) mainly with full condition. Sample implementation:";
+368;new;PERFORMANCE;TPF40015;Y;C;;;"Measure performance of 1 MPU to 1 HOST queue with multiple tasks (<= # of MPUs) mainly with intermediate condition. Sample implementation:";
+369;closed;PERFORMANCE;TPF40016;N;A;;;"Measure performance of 1 MPU to 1 MPU queue with multiple tasks (<= # of MPUs) mainly with empty condition. Sample implementation:";
+370;closed;PERFORMANCE;TPF40017;N;A;;;"Measure performance of 1 MPU to 1 MPU queue with multiple tasks (<= # of MPUs) mainly with full condition. Sample implementation:";
+371;new;PERFORMANCE;TPF40018;Y;C;;;"Measure performance of 1 MPU to 1 MPU queue with multiple tasks (<= # of MPUs) mainly with intermediate condition. Sample implementation:";
+372;closed;PERFORMANCE;TPF40019;N;A;;;"Measure performance of 1 host to 1 MPU queue with multiple tasks (> # of MPUs) mainly with empty condition. Sample implementation:";
+373;closed;PERFORMANCE;TPF40020;N;A;;;"Measure performance of 1 HOST to 1 MPU queue with multiple tasks (> # of MPUs) mainly with full condition. Sample implementation:";
+374;new;PERFORMANCE;TPF40021;Y;C;;;"Measure performance of 1 HOST to 1 MPU queue with multiple tasks (> # of MPUs) mainly with intermediate condition. Sample implementation:";
+375;closed;PERFORMANCE;TPF40022;N;A;;;"Measure performance of 1 MPU to 1 HOST queue with multiple tasks (> # of MPUs) mainly with empty condition. Sample implementation:";
+376;closed;PERFORMANCE;TPF40023;N;A;;;"Measure performance of 1 MPU to 1 HOST queue with multiple tasks (> # of MPUs) mainly with full condition. Sample implementation:";
+377;new;PERFORMANCE;TPF40024;Y;C;;;"Measure performance of 1 MPU to 1 HOST queue with multiple tasks (> # of MPUs) mainly with intermediate condition. Sample implementation:";
+378;closed;PERFORMANCE;TPF40025;N;A;;;"Measure performance of 1 MPU to 1 MPU queue with multiple tasks (> # of MPUs) mainly with empty condition. Sample implementation:";
+379;closed;PERFORMANCE;TPF40026;N;A;;;"Measure performance of 1 MPU to 1 MPU queue with multiple tasks (> # of MPUs) mainly with full condition. Sample implementation:";
+380;new;PERFORMANCE;TPF40027;Y;C;;;"Measure performance of 1 MPU to 1 MPU queue with multiple tasks (> # of MPUs) mainly with intermediate condition. Sample implementation:";
+381;new;PERFORMANCE;TPF40028;N;A;;;"Measure performance of multiple HOST threads to 1 MPU queue with single task mainly with empty condition. Sample implementation:";
+382;new;PERFORMANCE;TPF40029;N;A;;;"Measure performance of multiple HOST threads to 1 MPU queue with single task mainly with full condition. Sample implementation:";
+383;new;PERFORMANCE;TPF40030;Y;C;;;"Measure performance of multiple HOST threads to 1 MPU queue with single task mainly with intermediate condition. Sample implementation:";
+384;new;PERFORMANCE;TPF40031;N;A;;;"Measure performance of 1 MPU to multiple HOST threads queue with single task mainly with empty condition. Sample implementation:";
+385;new;PERFORMANCE;TPF40032;N;A;;;"Measure performance of 1 MPU to multiple HOST threads queue with single task mainly with full condition. Sample implementation:";
+386;new;PERFORMANCE;TPF40033;Y;C;;;"Measure performance of 1 MPU to multiple HOST threads queue with single task mainly with intermediate condition. Sample implementation:";
+387;new;PERFORMANCE;TPF40034;N;A;;;"Measure performance of 1 MPU to multiple MPU (<= # of MPUs) queue mainly with empty condition. Sample implementation:";
+388;new;PERFORMANCE;TPF40035;N;A;;;"Measure performance of 1 MPU to multiple MPU (<= # of MPUs) queue mainly with full condition. Sample implementation:";
+389;new;PERFORMANCE;TPF40036;Y;C;;;"Measure performance of 1 MPU to multiple MPU (<= # of MPUs) queue mainly with intermediate condition. Sample implementation:";
+390;new;PERFORMANCE;TPF40037;N;A;;;"Measure performance of 1 MPU to multiple MPU (> # of MPUs) queue mainly with empty condition. Sample implementation:";
+391;new;PERFORMANCE;TPF40038;N;A;;;"Measure performance of 1 MPU to multiple MPU (> # of MPUs) queue mainly with full condition. Sample implementation:";
+392;new;PERFORMANCE;TPF40039;Y;C;;;"Measure performance of 1 MPU to multiple MPU (> # of MPUs) queue mainly with intermediate condition. Sample implementation:";
+393;new;PERFORMANCE;TPF40040;N;A;;;"Measure performance of 1 HOST to multiple MPU (<= # of MPUs) queue mainly with empty condition. Sample implementation:";
+394;new;PERFORMANCE;TPF40041;N;A;;;"Measure performance of 1 HOST to multiple MPU (<= # of MPUs) queue mainly with full condition. Sample implementation:";
+395;new;PERFORMANCE;TPF40042;Y;C;;;"Measure performance of 1 HOST to multiple MPU (<= # of MPUs) queue mainly with intermediate condition. Sample implementation:";
+396;new;PERFORMANCE;TPF40043;N;A;;;"Measure performance of 1 HOST to multiple MPU (> # of MPUs) queue mainly with empty condition. Sample implementation:";
+397;new;PERFORMANCE;TPF40044;N;A;;;"Measure performance of 1 HOST to multiple MPU (> # of MPUs) queue mainly with full condition. Sample implementation:";
+398;new;PERFORMANCE;TPF40045;Y;C;;;"Measure performance of 1 HOST to multiple MPU (> # of MPUs) queue mainly with intermediate condition. Sample implementation:";