aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorYuji Mano <yuji.mano@am.sony.com>2009-03-27 14:50:54 -0700
committerYuji Mano <yuji.mano@am.sony.com>2009-03-27 14:50:54 -0700
commitdae0393bda5d7d77adec3b686b4fc41e30176cae (patch)
tree591f1f5dc764beda9a6a0687c51d8b2dced4834e
parent23c72f3195573697275618bdd8da484f5bb8bfe5 (diff)
downloadmars-src-dae0393bda5d7d77adec3b686b4fc41e30176cae.tar.gz
tests: Merge branch-1.1.2
-rw-r--r--tests/Makefile6
-rw-r--r--tests/TFI/Makefile1
-rw-r--r--tests/TFI/TFI_01_002/Makefile28
-rw-r--r--tests/TFI/TFI_01_002/host.c (renamed from tests/TFP/TFP_34_007/mpu1.c)28
-rw-r--r--tests/TFP/TFP_14_001/Makefile4
-rw-r--r--tests/TFP/TFP_14_001/common.h2
-rw-r--r--tests/TFP/TFP_14_001/host.c21
-rw-r--r--tests/TFP/TFP_14_001/mpu.c7
-rw-r--r--tests/TFP/TFP_14_002/common.h24
-rw-r--r--tests/TFP/TFP_14_002/host.c39
-rw-r--r--tests/TFP/TFP_14_002/mpu.c13
-rw-r--r--tests/TFP/TFP_17_001/common.h1
-rw-r--r--tests/TFP/TFP_17_001/host.c63
-rw-r--r--tests/TFP/TFP_17_001/mpu.c22
-rw-r--r--tests/TFP/TFP_18_001/host.c145
-rw-r--r--tests/TFP/TFP_18_001/mpu.c59
-rw-r--r--tests/TFP/TFP_18_002/Makefile2
-rw-r--r--tests/TFP/TFP_18_002/common.h24
-rw-r--r--tests/TFP/TFP_18_002/host.c96
-rw-r--r--tests/TFP/TFP_18_002/mpu.c (renamed from tests/TFP/TFP_34_007/mpu2.c)33
-rw-r--r--tests/TFP/TFP_23_002/host.c84
-rw-r--r--tests/TFP/TFP_23_002/mpu.c18
-rw-r--r--tests/TFP/TFP_24_002/Makefile2
-rw-r--r--tests/TFP/TFP_24_002/host.c134
-rw-r--r--tests/TFP/TFP_24_002/mpu1.c18
-rw-r--r--tests/TFP/TFP_24_002/mpu2.c9
-rw-r--r--tests/TFP/TFP_24_002/mpu3.c36
-rw-r--r--tests/TFP/TFP_24_003/Makefile2
-rw-r--r--tests/TFP/TFP_24_003/common.h24
-rw-r--r--tests/TFP/TFP_24_003/host.c165
-rw-r--r--tests/TFP/TFP_24_003/mpu.c58
-rw-r--r--tests/TFP/TFP_25_002/common.h24
-rw-r--r--tests/TFP/TFP_25_002/host.c159
-rw-r--r--tests/TFP/TFP_25_002/mpu.c31
-rw-r--r--tests/TFP/TFP_26_002/common.h24
-rw-r--r--tests/TFP/TFP_26_002/host.c113
-rw-r--r--tests/TFP/TFP_26_002/mpu1.c58
-rw-r--r--tests/TFP/TFP_26_002/mpu2.c26
-rw-r--r--tests/TFP/TFP_33_001/host.c1
-rw-r--r--tests/TFP/TFP_33_003/host.c1
-rw-r--r--tests/TFP/TFP_33_005/host.c263
-rw-r--r--tests/TFP/TFP_33_005/mpu.c17
-rw-r--r--tests/TFP/TFP_34_002/host.c22
-rw-r--r--tests/TFP/TFP_34_003/host.c26
-rw-r--r--tests/TFP/TFP_34_004/host.c109
-rw-r--r--tests/TFP/TFP_34_004/mpu.c8
-rw-r--r--tests/TFP/TFP_34_005/host.c115
-rw-r--r--tests/TFP/TFP_34_005/mpu.c12
-rw-r--r--tests/TFP/TFP_34_007/Makefile2
-rw-r--r--tests/TFP/TFP_34_007/host.c249
-rw-r--r--tests/TFP/TFP_34_007/mpu.c52
-rw-r--r--tests/TFP/TFP_35_001/Makefile2
-rw-r--r--tests/TFP/TFP_35_001/common.h24
-rw-r--r--tests/TFP/TFP_35_001/host.c146
-rw-r--r--tests/TFP/TFP_35_001/mpu1.c (renamed from tests/TFP/TFP_35_007/mpu2.c)21
-rw-r--r--tests/TFP/TFP_35_001/mpu2.c31
-rw-r--r--tests/TFP/TFP_35_004/host.c100
-rw-r--r--tests/TFP/TFP_35_004/mpu.c18
-rw-r--r--tests/TFP/TFP_35_005/host.c10
-rw-r--r--tests/TFP/TFP_35_006/host.c9
-rw-r--r--tests/TFP/TFP_35_006/mpu1.c3
-rw-r--r--tests/TFP/TFP_35_007/Makefile2
-rw-r--r--tests/TFP/TFP_35_007/common.h28
-rw-r--r--tests/TFP/TFP_35_007/host.c202
-rw-r--r--tests/TFP/TFP_35_007/mpu.c (renamed from tests/TFP/TFP_35_007/mpu1.c)32
-rw-r--r--tests/TFP/TFP_35_008/host.c120
-rw-r--r--tests/TFP/TFP_35_008/mpu.c6
-rw-r--r--tests/TFP/TFP_35_009/host.c157
-rw-r--r--tests/TFP/TFP_35_009/mpu1.c14
-rw-r--r--tests/TFP/TFP_35_009/mpu2.c24
-rw-r--r--tests/TFP/TFP_35_009/mpu3.c19
-rw-r--r--tests/TFP/TFP_35_010/host.c20
-rw-r--r--tests/TFP/TFP_35_012/host.c45
-rw-r--r--tests/TFP/TFP_35_013/Makefile2
-rw-r--r--tests/TFP/TFP_35_013/host.c130
-rw-r--r--tests/TFP/TFP_35_013/mpu.c (renamed from tests/TFP/TFP_35_014/mpu.c)0
-rw-r--r--tests/TFP/TFP_35_014/Makefile2
-rw-r--r--tests/TFP/TFP_35_014/host.c129
-rw-r--r--tests/TFP/TFP_35_014/mpu1.c (renamed from tests/TFP/TFP_35_013/mpu1.c)0
-rw-r--r--tests/TFP/TFP_35_014/mpu2.c (renamed from tests/TFP/TFP_35_013/mpu2.c)0
-rw-r--r--tests/TFP/TFP_35_015/host.c47
-rw-r--r--tests/TFP/TFP_35_016/host.c58
-rw-r--r--tests/TFP/TFP_35_016/mpu.c26
-rw-r--r--tests/TFP/TFP_35_017/host.c67
-rw-r--r--tests/TFP/TFP_35_017/mpu.c6
-rw-r--r--tests/TFP/TFP_35_018/host.c64
-rw-r--r--tests/TFP/TFP_35_018/mpu1.c26
-rw-r--r--tests/TFP/TFP_35_018/mpu2.c6
-rw-r--r--tests/TFP/TFP_36_001/host.c77
-rw-r--r--tests/TFP/TFP_36_001/mpu.c31
-rw-r--r--tests/TFP/TFP_36_004/host.c90
-rw-r--r--tests/TFP/TFP_36_004/mpu.c31
-rw-r--r--tests/TFP/TFP_36_007/Makefile2
-rw-r--r--tests/TFP/TFP_36_007/host.c95
-rw-r--r--tests/TFP/TFP_36_007/mpu.c (renamed from tests/TFP/TFP_61_001/mpu.c)26
-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_009/Makefile2
-rw-r--r--tests/TFP/TFP_36_009/host.c119
-rw-r--r--tests/TFP/TFP_36_009/mpu1.c43
-rw-r--r--tests/TFP/TFP_36_009/mpu2.c34
-rw-r--r--tests/TFP/TFP_36_010/Makefile2
-rw-r--r--tests/TFP/TFP_36_010/host.c96
-rw-r--r--tests/TFP/TFP_36_010/mpu.c48
-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_012/Makefile2
-rw-r--r--tests/TFP/TFP_36_012/host.c120
-rw-r--r--tests/TFP/TFP_36_012/mpu1.c44
-rw-r--r--tests/TFP/TFP_36_012/mpu2.c34
-rw-r--r--tests/TFP/TFP_43_004/host.c49
-rw-r--r--tests/TFP/TFP_43_004/mpu.c8
-rw-r--r--tests/TFP/TFP_43_012/host.c8
-rw-r--r--tests/TFP/TFP_43_012/mpu.c3
-rw-r--r--tests/TFP/TFP_45_001/host.c126
-rw-r--r--tests/TFP/TFP_45_001/mpu.c9
-rw-r--r--tests/TFP/TFP_45_002/Makefile2
-rw-r--r--tests/TFP/TFP_45_002/host.c78
-rw-r--r--tests/TFP/TFP_45_002/mpu1.c (renamed from tests/TFP/TFP_45_002/mpu.c)13
-rw-r--r--tests/TFP/TFP_45_002/mpu2.c (renamed from tests/TFP/TFP_34_007/mpu3.c)13
-rw-r--r--tests/TFP/TFP_45_003/Makefile2
-rw-r--r--tests/TFP/TFP_45_003/host.c39
-rw-r--r--tests/TFP/TFP_45_003/mpu1.c12
-rw-r--r--tests/TFP/TFP_45_003/mpu2.c10
-rw-r--r--tests/TFP/TFP_45_003/mpu3.c33
-rw-r--r--tests/TFP/TFP_45_004/host.c21
-rw-r--r--tests/TFP/TFP_45_005/host.c23
-rw-r--r--tests/TFP/TFP_45_005/mpu.c10
-rw-r--r--tests/TFP/TFP_45_006/host.c29
-rw-r--r--tests/TFP/TFP_45_006/mpu1.c10
-rw-r--r--tests/TFP/TFP_45_006/mpu2.c6
-rw-r--r--tests/TFP/TFP_45_007/host.c36
-rw-r--r--tests/TFP/TFP_45_007/mpu.c9
-rw-r--r--tests/TFP/TFP_45_008/host.c44
-rw-r--r--tests/TFP/TFP_45_008/mpu.c8
-rw-r--r--tests/TFP/TFP_45_010/host.c69
-rw-r--r--tests/TFP/TFP_45_011/Makefile2
-rw-r--r--tests/TFP/TFP_45_011/host.c58
-rw-r--r--tests/TFP/TFP_45_011/mpu1.c (renamed from tests/TFP/TFP_45_011/mpu.c)20
-rw-r--r--tests/TFP/TFP_45_011/mpu2.c30
-rw-r--r--tests/TFP/TFP_45_012/Makefile2
-rw-r--r--tests/TFP/TFP_45_012/host.c54
-rw-r--r--tests/TFP/TFP_45_012/mpu1.c22
-rw-r--r--tests/TFP/TFP_45_012/mpu2.c2
-rw-r--r--tests/TFP/TFP_45_012/mpu3.c30
-rw-r--r--tests/TFP/TFP_45_013/host.c41
-rw-r--r--tests/TFP/TFP_45_013/mpu.c2
-rw-r--r--tests/TFP/TFP_45_014/host.c44
-rw-r--r--tests/TFP/TFP_45_014/mpu.c9
-rw-r--r--tests/TFP/TFP_45_016/host.c86
-rw-r--r--tests/TFP/TFP_45_017/Makefile2
-rw-r--r--tests/TFP/TFP_45_017/host.c47
-rw-r--r--tests/TFP/TFP_45_017/mpu1.c18
-rw-r--r--tests/TFP/TFP_45_017/mpu3.c30
-rw-r--r--tests/TFP/TFP_45_018/host.c86
-rw-r--r--tests/TFP/TFP_45_019/Makefile2
-rw-r--r--tests/TFP/TFP_45_019/host.c60
-rw-r--r--tests/TFP/TFP_45_019/mpu1.c (renamed from tests/TFP/TFP_45_019/mpu.c)20
-rw-r--r--tests/TFP/TFP_45_019/mpu2.c30
-rw-r--r--tests/TFP/TFP_45_020/Makefile2
-rw-r--r--tests/TFP/TFP_45_020/host.c54
-rw-r--r--tests/TFP/TFP_45_020/mpu1.c22
-rw-r--r--tests/TFP/TFP_45_020/mpu2.c2
-rw-r--r--tests/TFP/TFP_45_020/mpu3.c30
-rw-r--r--tests/TFP/TFP_45_021/host.c84
-rw-r--r--tests/TFP/TFP_45_022/Makefile2
-rw-r--r--tests/TFP/TFP_45_022/host.c48
-rw-r--r--tests/TFP/TFP_45_022/mpu1.c18
-rw-r--r--tests/TFP/TFP_45_022/mpu3.c30
-rw-r--r--tests/TFP/TFP_46_001/host.c87
-rw-r--r--tests/TFP/TFP_46_001/host_and_mpu.h7
-rw-r--r--tests/TFP/TFP_46_001/mpu.c22
-rw-r--r--tests/TFP/TFP_46_002/host.c41
-rw-r--r--tests/TFP/TFP_46_002/host_and_mpu.h7
-rw-r--r--tests/TFP/TFP_46_002/mpu1.c16
-rw-r--r--tests/TFP/TFP_46_002/mpu2.c44
-rw-r--r--tests/TFP/TFP_46_003/Makefile2
-rw-r--r--tests/TFP/TFP_46_003/host.c61
-rw-r--r--tests/TFP/TFP_46_003/mpu1.c (renamed from tests/TFP/TFP_46_008/mpu.c)23
-rw-r--r--tests/TFP/TFP_46_003/mpu2.c30
-rw-r--r--tests/TFP/TFP_46_004/Makefile2
-rw-r--r--tests/TFP/TFP_46_004/host.c54
-rw-r--r--tests/TFP/TFP_46_004/mpu1.c25
-rw-r--r--tests/TFP/TFP_46_004/mpu2.c2
-rw-r--r--tests/TFP/TFP_46_004/mpu3.c30
-rw-r--r--tests/TFP/TFP_46_005/Makefile2
-rw-r--r--tests/TFP/TFP_46_005/host.c54
-rw-r--r--tests/TFP/TFP_46_005/mpu1.c25
-rw-r--r--tests/TFP/TFP_46_005/mpu2.c3
-rw-r--r--tests/TFP/TFP_46_005/mpu3.c30
-rw-r--r--tests/TFP/TFP_46_007/host.c25
-rw-r--r--tests/TFP/TFP_46_007/mpu.c11
-rw-r--r--tests/TFP/TFP_46_008/Makefile2
-rw-r--r--tests/TFP/TFP_46_008/host.c63
-rw-r--r--tests/TFP/TFP_46_008/mpu1.c (renamed from tests/TFP/TFP_46_003/mpu.c)23
-rw-r--r--tests/TFP/TFP_46_008/mpu2.c30
-rw-r--r--tests/TFP/TFP_46_009/Makefile2
-rw-r--r--tests/TFP/TFP_46_009/host.c54
-rw-r--r--tests/TFP/TFP_46_009/mpu1.c25
-rw-r--r--tests/TFP/TFP_46_009/mpu2.c2
-rw-r--r--tests/TFP/TFP_46_009/mpu3.c30
-rw-r--r--tests/TFP/TFP_46_010/Makefile2
-rw-r--r--tests/TFP/TFP_46_010/host.c54
-rw-r--r--tests/TFP/TFP_46_010/mpu1.c25
-rw-r--r--tests/TFP/TFP_46_010/mpu2.c3
-rw-r--r--tests/TFP/TFP_46_010/mpu3.c30
-rw-r--r--tests/TFP/TFP_47_001/host.c30
-rw-r--r--tests/TFP/TFP_47_001/mpu1.c11
-rw-r--r--tests/TFP/TFP_47_001/mpu2.c6
-rw-r--r--tests/TFP/TFP_48_004/host.c23
-rw-r--r--tests/TFP/TFP_48_005/host.c23
-rw-r--r--tests/TFP/TFP_48_005/mpu.c10
-rw-r--r--tests/TFP/TFP_48_006/host.c30
-rw-r--r--tests/TFP/TFP_48_006/mpu1.c10
-rw-r--r--tests/TFP/TFP_48_006/mpu2.c6
-rw-r--r--tests/TFP/TFP_49_001/host.c100
-rw-r--r--tests/TFP/TFP_49_001/mpu.c43
-rw-r--r--tests/TFP/TFP_49_003/host.c26
-rw-r--r--tests/TFP/TFP_49_003/mpu.c11
-rw-r--r--tests/TFP/TFP_49_004/host.c30
-rw-r--r--tests/TFP/TFP_49_004/mpu1.c11
-rw-r--r--tests/TFP/TFP_49_004/mpu2.c6
-rw-r--r--tests/TFP/TFP_4A_001/Makefile2
-rw-r--r--tests/TFP/TFP_4A_001/host.c42
-rw-r--r--tests/TFP/TFP_4A_001/mpu1.c (renamed from tests/TFP/TFP_4A_001/mpu.c)14
-rw-r--r--tests/TFP/TFP_4A_001/mpu2.c29
-rw-r--r--tests/TFP/TFP_4A_002/host.c105
-rw-r--r--tests/TFP/TFP_4A_002/mpu.c8
-rw-r--r--tests/TFP/TFP_4A_003/Makefile2
-rw-r--r--tests/TFP/TFP_4A_003/host.c46
-rw-r--r--tests/TFP/TFP_4A_003/mpu1.c8
-rw-r--r--tests/TFP/TFP_4A_003/mpu2.c12
-rw-r--r--tests/TFP/TFP_4A_003/mpu3.c30
-rw-r--r--tests/TFP/TFP_4A_004/host.c41
-rw-r--r--tests/TFP/TFP_4A_004/mpu.c4
-rw-r--r--tests/TFP/TFP_4A_005/host.c14
-rw-r--r--tests/TFP/TFP_4A_006/host.c33
-rw-r--r--tests/TFP/TFP_4A_006/mpu1.c2
-rw-r--r--tests/TFP/TFP_4A_010/Makefile2
-rw-r--r--tests/TFP/TFP_4A_010/host.c55
-rw-r--r--tests/TFP/TFP_4A_010/mpu1.c (renamed from tests/TFP/TFP_4A_015/mpu.c)13
-rw-r--r--tests/TFP/TFP_4A_010/mpu2.c29
-rw-r--r--tests/TFP/TFP_4A_011/host.c79
-rw-r--r--tests/TFP/TFP_4A_012/Makefile2
-rw-r--r--tests/TFP/TFP_4A_012/host.c45
-rw-r--r--tests/TFP/TFP_4A_012/mpu1.c14
-rw-r--r--tests/TFP/TFP_4A_012/mpu3.c (renamed from tests/TFP/TFP_36_012/mpu3.c)7
-rw-r--r--tests/TFP/TFP_4A_013/host.c93
-rw-r--r--tests/TFP/TFP_4A_014/Makefile2
-rw-r--r--tests/TFP/TFP_4A_014/host.c47
-rw-r--r--tests/TFP/TFP_4A_014/mpu1.c14
-rw-r--r--tests/TFP/TFP_4A_014/mpu2.c1
-rw-r--r--tests/TFP/TFP_4A_014/mpu3.c30
-rw-r--r--tests/TFP/TFP_4A_015/Makefile2
-rw-r--r--tests/TFP/TFP_4A_015/host.c47
-rw-r--r--tests/TFP/TFP_4A_015/mpu1.c (renamed from tests/TFP/TFP_4A_010/mpu.c)13
-rw-r--r--tests/TFP/TFP_4A_015/mpu2.c30
-rw-r--r--tests/TFP/TFP_4A_016/host.c100
-rw-r--r--tests/TFP/TFP_4A_016/mpu.c1
-rw-r--r--tests/TFP/TFP_4A_017/Makefile2
-rw-r--r--tests/TFP/TFP_4A_017/host.c39
-rw-r--r--tests/TFP/TFP_4A_017/mpu1.c12
-rw-r--r--tests/TFP/TFP_4A_017/mpu2.c1
-rw-r--r--tests/TFP/TFP_4A_017/mpu3.c30
-rw-r--r--tests/TFP/TFP_4A_018/host.c101
-rw-r--r--tests/TFP/TFP_4A_018/mpu.c5
-rw-r--r--tests/TFP/TFP_4A_019/Makefile2
-rw-r--r--tests/TFP/TFP_4A_019/host.c45
-rw-r--r--tests/TFP/TFP_4A_019/mpu1.c13
-rw-r--r--tests/TFP/TFP_4A_019/mpu3.c30
-rw-r--r--tests/TFP/TFP_4B_001/Makefile2
-rw-r--r--tests/TFP/TFP_4B_001/host.c46
-rw-r--r--tests/TFP/TFP_4B_001/mpu1.c (renamed from tests/TFP/TFP_4B_001/mpu.c)10
-rw-r--r--tests/TFP/TFP_4B_001/mpu2.c30
-rw-r--r--tests/TFP/TFP_4B_002/Makefile2
-rw-r--r--tests/TFP/TFP_4B_002/host.c43
-rw-r--r--tests/TFP/TFP_4B_002/mpu1.c8
-rw-r--r--tests/TFP/TFP_4B_002/mpu2.c9
-rw-r--r--tests/TFP/TFP_4B_002/mpu3.c30
-rw-r--r--tests/TFP/TFP_4B_003/host.c33
-rw-r--r--tests/TFP/TFP_4B_003/mpu.c4
-rw-r--r--tests/TFP/TFP_4B_004/Makefile2
-rw-r--r--tests/TFP/TFP_4B_004/host.c45
-rw-r--r--tests/TFP/TFP_4B_004/mpu1.c (renamed from tests/TFP/TFP_4B_004/mpu.c)5
-rw-r--r--tests/TFP/TFP_4B_004/mpu2.c30
-rw-r--r--tests/TFP/TFP_4B_005/Makefile2
-rw-r--r--tests/TFP/TFP_4B_005/host.c42
-rw-r--r--tests/TFP/TFP_4B_005/mpu1.c15
-rw-r--r--tests/TFP/TFP_4B_005/mpu3.c30
-rw-r--r--tests/TFP/TFP_4B_006/Makefile2
-rw-r--r--tests/TFP/TFP_4B_006/host.c40
-rw-r--r--tests/TFP/TFP_4B_006/mpu1.c16
-rw-r--r--tests/TFP/TFP_4B_006/mpu3.c30
-rw-r--r--tests/TFP/TFP_4B_007/Makefile2
-rw-r--r--tests/TFP/TFP_4B_007/host.c39
-rw-r--r--tests/TFP/TFP_4B_007/mpu1.c (renamed from tests/TFP/TFP_4B_007/mpu.c)16
-rw-r--r--tests/TFP/TFP_4B_007/mpu2.c30
-rw-r--r--tests/TFP/TFP_4B_008/Makefile2
-rw-r--r--tests/TFP/TFP_4B_008/host.c41
-rw-r--r--tests/TFP/TFP_4B_008/mpu1.c15
-rw-r--r--tests/TFP/TFP_4B_008/mpu3.c30
-rw-r--r--tests/TFP/TFP_4B_009/Makefile2
-rw-r--r--tests/TFP/TFP_4B_009/host.c46
-rw-r--r--tests/TFP/TFP_4B_009/mpu1.c15
-rw-r--r--tests/TFP/TFP_4B_009/mpu3.c30
-rw-r--r--tests/TFP/TFP_4C_001/host.c31
-rw-r--r--tests/TFP/TFP_4C_001/mpu1.c2
-rw-r--r--tests/TFP/TFP_4D_004/host.c32
-rw-r--r--tests/TFP/TFP_4D_004/mpu.c3
-rw-r--r--tests/TFP/TFP_4D_005/host.c35
-rw-r--r--tests/TFP/TFP_4D_006/host.c32
-rw-r--r--tests/TFP/TFP_4D_006/mpu1.c3
-rw-r--r--tests/TFP/TFP_4E_003/Makefile2
-rw-r--r--tests/TFP/TFP_4E_003/host.c51
-rw-r--r--tests/TFP/TFP_4E_003/mpu1.c26
-rw-r--r--tests/TFP/TFP_4E_003/mpu3.c30
-rw-r--r--tests/TFP/TFP_4E_004/host.c38
-rw-r--r--tests/TFP/TFP_4E_004/mpu.c2
-rw-r--r--tests/TFP/TFP_4E_005/host.c31
-rw-r--r--tests/TFP/TFP_4E_005/mpu1.c2
-rw-r--r--tests/TFP/TFP_4E_006/Makefile2
-rw-r--r--tests/TFP/TFP_4E_006/host.c46
-rw-r--r--tests/TFP/TFP_4E_006/mpu1.c28
-rw-r--r--tests/TFP/TFP_4E_006/mpu3.c30
-rw-r--r--tests/TFP/TFP_4F_004/Makefile2
-rw-r--r--tests/TFP/TFP_4F_004/host.c35
-rw-r--r--tests/TFP/TFP_4F_004/mpu1.c (renamed from tests/TFP/TFP_4F_004/mpu.c)11
-rw-r--r--tests/TFP/TFP_4F_004/mpu2.c31
-rw-r--r--tests/TFP/TFP_4F_005/host.c109
-rw-r--r--tests/TFP/TFP_4F_005/mpu.c9
-rw-r--r--tests/TFP/TFP_4F_006/Makefile2
-rw-r--r--tests/TFP/TFP_4F_006/host.c67
-rw-r--r--tests/TFP/TFP_4F_006/mpu1.c11
-rw-r--r--tests/TFP/TFP_4F_006/mpu2.c11
-rw-r--r--tests/TFP/TFP_4F_006/mpu3.c30
-rw-r--r--tests/TFP/TFP_4F_007/host.c31
-rw-r--r--tests/TFP/TFP_4F_007/mpu.c3
-rw-r--r--tests/TFP/TFP_4F_008/host.c13
-rw-r--r--tests/TFP/TFP_4F_009/host.c32
-rw-r--r--tests/TFP/TFP_4F_009/mpu1.c3
-rw-r--r--tests/TFP/TFP_4F_009/mpu2.c1
-rw-r--r--tests/TFP/TFP_4F_010/Makefile2
-rw-r--r--tests/TFP/TFP_4F_010/host.c53
-rw-r--r--tests/TFP/TFP_4F_010/mpu1.c (renamed from tests/TFP/TFP_18_002/mpu1.c)8
-rw-r--r--tests/TFP/TFP_4F_010/mpu2.c (renamed from tests/TFP/TFP_4F_015/mpu.c)14
-rw-r--r--tests/TFP/TFP_4F_011/host.c85
-rw-r--r--tests/TFP/TFP_4F_011/mpu.c1
-rw-r--r--tests/TFP/TFP_4F_012/Makefile2
-rw-r--r--tests/TFP/TFP_4F_012/host.c53
-rw-r--r--tests/TFP/TFP_4F_012/mpu1.c14
-rw-r--r--tests/TFP/TFP_4F_012/mpu2.c1
-rw-r--r--tests/TFP/TFP_4F_012/mpu3.c30
-rw-r--r--tests/TFP/TFP_4F_013/host.c94
-rw-r--r--tests/TFP/TFP_4F_014/Makefile2
-rw-r--r--tests/TFP/TFP_4F_014/host.c54
-rw-r--r--tests/TFP/TFP_4F_014/mpu1.c12
-rw-r--r--tests/TFP/TFP_4F_014/mpu3.c30
-rw-r--r--tests/TFP/TFP_4F_015/Makefile2
-rw-r--r--tests/TFP/TFP_4F_015/host.c50
-rw-r--r--tests/TFP/TFP_4F_015/mpu1.c (renamed from tests/TFP/TFP_4F_010/mpu.c)13
-rw-r--r--tests/TFP/TFP_4F_015/mpu2.c30
-rw-r--r--tests/TFP/TFP_4F_016/host.c87
-rw-r--r--tests/TFP/TFP_4F_016/mpu.c1
-rw-r--r--tests/TFP/TFP_4F_017/Makefile2
-rw-r--r--tests/TFP/TFP_4F_017/host.c46
-rw-r--r--tests/TFP/TFP_4F_017/mpu1.c14
-rw-r--r--tests/TFP/TFP_4F_017/mpu3.c30
-rw-r--r--tests/TFP/TFP_4F_018/host.c90
-rw-r--r--tests/TFP/TFP_4F_018/mpu.c1
-rw-r--r--tests/TFP/TFP_4F_019/Makefile2
-rw-r--r--tests/TFP/TFP_4F_019/host.c54
-rw-r--r--tests/TFP/TFP_4F_019/mpu1.c13
-rw-r--r--tests/TFP/TFP_4F_019/mpu2.c1
-rw-r--r--tests/TFP/TFP_4F_019/mpu3.c35
-rw-r--r--tests/TFP/TFP_4G_003/Makefile2
-rw-r--r--tests/TFP/TFP_4G_003/host.c47
-rw-r--r--tests/TFP/TFP_4G_003/mpu1.c (renamed from tests/TFP/TFP_4G_003/mpu.c)11
-rw-r--r--tests/TFP/TFP_4G_003/mpu2.c30
-rw-r--r--tests/TFP/TFP_4G_004/Makefile2
-rw-r--r--tests/TFP/TFP_4G_004/host.c46
-rw-r--r--tests/TFP/TFP_4G_004/mpu1.c9
-rw-r--r--tests/TFP/TFP_4G_004/mpu2.c13
-rw-r--r--tests/TFP/TFP_4G_004/mpu3.c30
-rw-r--r--tests/TFP/TFP_4G_006/Makefile2
-rw-r--r--tests/TFP/TFP_4G_006/host.c51
-rw-r--r--tests/TFP/TFP_4G_006/mpu1.c (renamed from tests/TFP/TFP_4G_006/mpu.c)15
-rw-r--r--tests/TFP/TFP_4G_006/mpu2.c30
-rw-r--r--tests/TFP/TFP_4G_007/Makefile2
-rw-r--r--tests/TFP/TFP_4G_007/host.c40
-rw-r--r--tests/TFP/TFP_4G_007/mpu1.c16
-rw-r--r--tests/TFP/TFP_4G_007/mpu2.c1
-rw-r--r--tests/TFP/TFP_4G_007/mpu3.c30
-rw-r--r--tests/TFP/TFP_4G_008/Makefile2
-rw-r--r--tests/TFP/TFP_4G_008/host.c42
-rw-r--r--tests/TFP/TFP_4G_008/mpu1.c17
-rw-r--r--tests/TFP/TFP_4G_008/mpu2.c7
-rw-r--r--tests/TFP/TFP_4G_008/mpu3.c30
-rw-r--r--tests/TFP/TFP_4G_009/Makefile2
-rw-r--r--tests/TFP/TFP_4G_009/host.c53
-rw-r--r--tests/TFP/TFP_4G_009/mpu1.c (renamed from tests/TFP/TFP_4G_009/mpu.c)15
-rw-r--r--tests/TFP/TFP_4G_009/mpu2.c30
-rw-r--r--tests/TFP/TFP_4G_010/Makefile2
-rw-r--r--tests/TFP/TFP_4G_010/host.c41
-rw-r--r--tests/TFP/TFP_4G_010/mpu1.c14
-rw-r--r--tests/TFP/TFP_4G_010/mpu2.c1
-rw-r--r--tests/TFP/TFP_4G_010/mpu3.c30
-rw-r--r--tests/TFP/TFP_4G_011/Makefile2
-rw-r--r--tests/TFP/TFP_4G_011/host.c41
-rw-r--r--tests/TFP/TFP_4G_011/mpu1.c14
-rw-r--r--tests/TFP/TFP_4G_011/mpu2.c1
-rw-r--r--tests/TFP/TFP_4G_011/mpu3.c30
-rw-r--r--tests/TFP/TFP_4H_001/host.c33
-rw-r--r--tests/TFP/TFP_4H_001/mpu1.c3
-rw-r--r--tests/TFP/TFP_4I_007/host.c32
-rw-r--r--tests/TFP/TFP_4I_007/mpu.c24
-rw-r--r--tests/TFP/TFP_4I_008/host.c46
-rw-r--r--tests/TFP/TFP_4I_009/host.c28
-rw-r--r--tests/TFP/TFP_4I_009/mpu1.c20
-rw-r--r--tests/TFP/TFP_4J_007/host.c19
-rw-r--r--tests/TFP/TFP_4J_007/mpu1.c34
-rw-r--r--tests/TFP/TFP_53_002/Makefile2
-rw-r--r--tests/TFP/TFP_53_002/host.c57
-rw-r--r--tests/TFP/TFP_53_002/mpu1.c (renamed from tests/TFP/TFP_53_002/mpu.c)17
-rw-r--r--tests/TFP/TFP_53_002/mpu2.c (renamed from tests/TFP/TFP_24_003/mpu2.c)8
-rw-r--r--tests/TFP/TFP_53_003/Makefile2
-rw-r--r--tests/TFP/TFP_53_003/host.c93
-rw-r--r--tests/TFP/TFP_53_003/mpu1.c5
-rw-r--r--tests/TFP/TFP_53_003/mpu2.c8
-rw-r--r--tests/TFP/TFP_53_003/mpu3.c36
-rw-r--r--tests/TFP/TFP_53_003/mpu4.c30
-rw-r--r--tests/TFP/TFP_61_001/Makefile2
-rw-r--r--tests/TFP/TFP_61_001/host.c51
-rw-r--r--tests/TFP/TFP_61_001/mpu1.c (renamed from tests/TFP/TFP_36_009/mpu3.c)11
-rw-r--r--tests/TFP/TFP_61_001/mpu2.c30
-rw-r--r--tests/TFP/TFP_61_002/Makefile2
-rw-r--r--tests/TFP/TFP_61_002/host.c58
-rw-r--r--tests/TFP/TFP_61_002/mpu1.c7
-rw-r--r--tests/TFP/TFP_61_002/mpu2.c2
-rw-r--r--tests/TFP/TFP_61_002/mpu3.c30
-rw-r--r--tests/TFP/TFP_62_001/host.c11
-rw-r--r--tests/TFP/TFP_62_001/mpu.c3
-rw-r--r--tests/TFP/TFP_63_001/host.c7
-rw-r--r--tests/TFP/TFP_63_001/mpu.c4
-rw-r--r--tests/TFP/TFP_63_003/host.c10
-rw-r--r--tests/TFP/TFP_63_003/mpu.c2
-rw-r--r--tests/TPF/Makefile93
-rw-r--r--tests/TPF/TPF_10_001/Makefile31
-rw-r--r--tests/TPF/TPF_10_001/host.c80
-rw-r--r--tests/TPF/TPF_10_001/mpu.c30
-rw-r--r--tests/TPF/TPF_10_002/Makefile31
-rw-r--r--tests/TPF/TPF_10_002/host.c91
-rw-r--r--tests/TPF/TPF_10_002/mpu.c30
-rw-r--r--tests/TPF/TPF_10_003/Makefile30
-rw-r--r--tests/TPF/TPF_10_003/host.c101
-rw-r--r--tests/TPF/TPF_10_003/mpu.c38
-rw-r--r--tests/TPF/TPF_10_004/Makefile30
-rw-r--r--tests/TPF/TPF_10_004/host.c102
-rw-r--r--tests/TPF/TPF_10_004/mpu.c38
-rw-r--r--tests/TPF/TPF_20_001/Makefile38
-rw-r--r--tests/TPF/TPF_20_001/common.h45
-rw-r--r--tests/TPF/TPF_20_001/host.c325
-rw-r--r--tests/TPF/TPF_20_001/mpu1.c63
-rw-r--r--tests/TPF/TPF_20_001/mpu2.c56
-rw-r--r--tests/TPF/TPF_20_001/mpu3.c70
-rw-r--r--tests/TPF/TPF_20_002/Makefile38
-rw-r--r--tests/TPF/TPF_20_002/common.h45
-rw-r--r--tests/TPF/TPF_20_002/host.c24
-rw-r--r--tests/TPF/TPF_20_002/mpu1.c24
-rw-r--r--tests/TPF/TPF_20_002/mpu2.c24
-rw-r--r--tests/TPF/TPF_20_002/mpu3.c24
-rw-r--r--tests/TPF/TPF_30_001/Makefile38
-rw-r--r--tests/TPF/TPF_30_001/common.h43
-rw-r--r--tests/TPF/TPF_30_001/host.c198
-rw-r--r--tests/TPF/TPF_30_001/mpu1.c63
-rw-r--r--tests/TPF/TPF_30_002/Makefile38
-rw-r--r--tests/TPF/TPF_30_002/common.h43
-rw-r--r--tests/TPF/TPF_30_002/host.c24
-rw-r--r--tests/TPF/TPF_30_002/mpu1.c24
-rw-r--r--tests/TPF/TPF_30_003/Makefile38
-rw-r--r--tests/TPF/TPF_30_003/common.h43
-rw-r--r--tests/TPF/TPF_30_003/host.c205
-rw-r--r--tests/TPF/TPF_30_003/mpu1.c63
-rw-r--r--tests/TPF/TPF_30_003/mpu2.c57
-rw-r--r--tests/TPF/TPF_30_004/Makefile38
-rw-r--r--tests/TPF/TPF_30_004/common.h43
-rw-r--r--tests/TPF/TPF_30_004/host.c24
-rw-r--r--tests/TPF/TPF_30_004/mpu1.c24
-rw-r--r--tests/TPF/TPF_30_004/mpu2.c24
-rw-r--r--tests/TPF/TPF_40_001/Makefile37
-rw-r--r--tests/TPF/TPF_40_001/common.h78
-rw-r--r--tests/TPF/TPF_40_001/host.c236
-rw-r--r--tests/TPF/TPF_40_001/mpu1.c57
-rw-r--r--tests/TPF/TPF_40_001/mpu2.c57
-rw-r--r--tests/TPF/TPF_40_001/mpu3.c57
-rw-r--r--tests/TPF/TPF_40_002/Makefile37
-rw-r--r--tests/TPF/TPF_40_002/common.h45
-rw-r--r--tests/TPF/TPF_40_002/host.c248
-rw-r--r--tests/TPF/TPF_40_002/mpu1.c60
-rw-r--r--tests/TPF/TPF_40_002/mpu2.c61
-rw-r--r--tests/TPF/TPF_40_002/mpu3.c61
-rw-r--r--tests/TPF/TPF_40_003/Makefile35
-rw-r--r--tests/TPF/TPF_40_003/common.h43
-rw-r--r--tests/TPF/TPF_40_003/host.c99
-rw-r--r--tests/TPF/TPF_40_003/mpu.c57
-rw-r--r--tests/TPF/TPF_40_004/Makefile37
-rw-r--r--tests/TPF/TPF_40_004/common.h45
-rw-r--r--tests/TPF/TPF_40_004/host.c233
-rw-r--r--tests/TPF/TPF_40_004/mpu1.c56
-rw-r--r--tests/TPF/TPF_40_004/mpu2.c57
-rw-r--r--tests/TPF/TPF_40_004/mpu3.c57
-rw-r--r--tests/TPF/TPF_40_005/Makefile37
-rw-r--r--tests/TPF/TPF_40_005/common.h45
-rw-r--r--tests/TPF/TPF_40_005/host.c235
-rw-r--r--tests/TPF/TPF_40_005/mpu1.c61
-rw-r--r--tests/TPF/TPF_40_005/mpu2.c62
-rw-r--r--tests/TPF/TPF_40_005/mpu3.c60
-rw-r--r--tests/TPF/TPF_40_006/Makefile35
-rw-r--r--tests/TPF/TPF_40_006/common.h43
-rw-r--r--tests/TPF/TPF_40_006/host.c95
-rw-r--r--tests/TPF/TPF_40_006/mpu.c61
-rw-r--r--tests/TPF/TPF_40_007/Makefile38
-rw-r--r--tests/TPF/TPF_40_007/common.h (renamed from tests/TFP/TFP_18_002/mpu2.c)32
-rw-r--r--tests/TPF/TPF_40_007/host.c205
-rw-r--r--tests/TPF/TPF_40_007/mpu1.c63
-rw-r--r--tests/TPF/TPF_40_007/mpu2.c57
-rw-r--r--tests/TPF/TPF_40_008/Makefile38
-rw-r--r--tests/TPF/TPF_40_008/common.h45
-rw-r--r--tests/TPF/TPF_40_008/host.c205
-rw-r--r--tests/TPF/TPF_40_008/mpu1.c60
-rw-r--r--tests/TPF/TPF_40_008/mpu2.c65
-rw-r--r--tests/TPF/TPF_40_009/Makefile38
-rw-r--r--tests/TPF/TPF_40_009/common.h45
-rw-r--r--tests/TPF/TPF_40_009/host.c182
-rw-r--r--tests/TPF/TPF_40_009/mpu1.c64
-rw-r--r--tests/TPF/TPF_40_009/mpu2.c59
-rw-r--r--tests/TPF/TPF_40_010/Makefile39
-rw-r--r--tests/TPF/TPF_40_010/common.h80
-rw-r--r--tests/TPF/TPF_40_010/host.c384
-rw-r--r--tests/TPF/TPF_40_010/mpu1.c57
-rw-r--r--tests/TPF/TPF_40_010/mpu2.c57
-rw-r--r--tests/TPF/TPF_40_010/mpu3.c57
-rw-r--r--tests/TPF/TPF_40_011/Makefile39
-rw-r--r--tests/TPF/TPF_40_011/common.h47
-rw-r--r--tests/TPF/TPF_40_011/host.c398
-rw-r--r--tests/TPF/TPF_40_011/mpu1.c60
-rw-r--r--tests/TPF/TPF_40_011/mpu2.c61
-rw-r--r--tests/TPF/TPF_40_011/mpu3.c62
-rw-r--r--tests/TPF/TPF_40_012/Makefile39
-rw-r--r--tests/TPF/TPF_40_012/common.h80
-rw-r--r--tests/TPF/TPF_40_012/host.c175
-rw-r--r--tests/TPF/TPF_40_012/mpu1.c57
-rw-r--r--tests/TPF/TPF_40_013/Makefile39
-rw-r--r--tests/TPF/TPF_40_013/common.h48
-rw-r--r--tests/TPF/TPF_40_013/host.c386
-rw-r--r--tests/TPF/TPF_40_013/mpu1.c62
-rw-r--r--tests/TPF/TPF_40_013/mpu2.c62
-rw-r--r--tests/TPF/TPF_40_013/mpu3.c62
-rw-r--r--tests/TPF/TPF_40_014/Makefile39
-rw-r--r--tests/TPF/TPF_40_014/common.h48
-rw-r--r--tests/TPF/TPF_40_014/host.c391
-rw-r--r--tests/TPF/TPF_40_014/mpu1.c67
-rw-r--r--tests/TPF/TPF_40_014/mpu2.c66
-rw-r--r--tests/TPF/TPF_40_014/mpu3.c66
-rw-r--r--tests/TPF/TPF_40_015/Makefile39
-rw-r--r--tests/TPF/TPF_40_015/common.h48
-rw-r--r--tests/TPF/TPF_40_015/host.c172
-rw-r--r--tests/TPF/TPF_40_015/mpu1.c68
-rw-r--r--tests/TPF/TPF_40_016/Makefile38
-rw-r--r--tests/TPF/TPF_40_016/common.h45
-rw-r--r--tests/TPF/TPF_40_016/host.c24
-rw-r--r--tests/TPF/TPF_40_016/mpu1.c24
-rw-r--r--tests/TPF/TPF_40_016/mpu2.c24
-rw-r--r--tests/TPF/TPF_40_017/Makefile38
-rw-r--r--tests/TPF/TPF_40_017/common.h45
-rw-r--r--tests/TPF/TPF_40_017/host.c24
-rw-r--r--tests/TPF/TPF_40_017/mpu1.c24
-rw-r--r--tests/TPF/TPF_40_017/mpu2.c24
-rw-r--r--tests/TPF/TPF_40_018/Makefile38
-rw-r--r--tests/TPF/TPF_40_018/common.h45
-rw-r--r--tests/TPF/TPF_40_018/host.c24
-rw-r--r--tests/TPF/TPF_40_018/mpu1.c24
-rw-r--r--tests/TPF/TPF_40_018/mpu2.c24
-rw-r--r--tests/TPF/TPF_40_019/Makefile39
-rw-r--r--tests/TPF/TPF_40_019/common.h80
-rw-r--r--tests/TPF/TPF_40_019/host.c24
-rw-r--r--tests/TPF/TPF_40_019/mpu1.c24
-rw-r--r--tests/TPF/TPF_40_019/mpu2.c24
-rw-r--r--tests/TPF/TPF_40_019/mpu3.c24
-rw-r--r--tests/TPF/TPF_40_020/Makefile39
-rw-r--r--tests/TPF/TPF_40_020/common.h46
-rw-r--r--tests/TPF/TPF_40_020/host.c24
-rw-r--r--tests/TPF/TPF_40_020/mpu1.c24
-rw-r--r--tests/TPF/TPF_40_020/mpu2.c24
-rw-r--r--tests/TPF/TPF_40_020/mpu3.c24
-rw-r--r--tests/TPF/TPF_40_021/Makefile37
-rw-r--r--tests/TPF/TPF_40_021/common.h80
-rw-r--r--tests/TPF/TPF_40_021/host.c24
-rw-r--r--tests/TPF/TPF_40_021/mpu1.c24
-rw-r--r--tests/TPF/TPF_40_022/Makefile39
-rw-r--r--tests/TPF/TPF_40_022/common.h48
-rw-r--r--tests/TPF/TPF_40_022/host.c24
-rw-r--r--tests/TPF/TPF_40_022/mpu1.c24
-rw-r--r--tests/TPF/TPF_40_022/mpu2.c24
-rw-r--r--tests/TPF/TPF_40_022/mpu3.c24
-rw-r--r--tests/TPF/TPF_40_023/Makefile39
-rw-r--r--tests/TPF/TPF_40_023/common.h48
-rw-r--r--tests/TPF/TPF_40_023/host.c24
-rw-r--r--tests/TPF/TPF_40_023/mpu1.c24
-rw-r--r--tests/TPF/TPF_40_023/mpu2.c24
-rw-r--r--tests/TPF/TPF_40_023/mpu3.c24
-rw-r--r--tests/TPF/TPF_40_024/Makefile37
-rw-r--r--tests/TPF/TPF_40_024/common.h48
-rw-r--r--tests/TPF/TPF_40_024/host.c24
-rw-r--r--tests/TPF/TPF_40_024/mpu1.c24
-rw-r--r--tests/TPF/TPF_40_025/Makefile38
-rw-r--r--tests/TPF/TPF_40_025/common.h45
-rw-r--r--tests/TPF/TPF_40_025/host.c24
-rw-r--r--tests/TPF/TPF_40_025/mpu1.c24
-rw-r--r--tests/TPF/TPF_40_025/mpu2.c24
-rw-r--r--tests/TPF/TPF_40_026/Makefile38
-rw-r--r--tests/TPF/TPF_40_026/common.h45
-rw-r--r--tests/TPF/TPF_40_026/host.c24
-rw-r--r--tests/TPF/TPF_40_026/mpu1.c24
-rw-r--r--tests/TPF/TPF_40_026/mpu2.c24
-rw-r--r--tests/TPF/TPF_40_027/Makefile38
-rw-r--r--tests/TPF/TPF_40_027/common.h45
-rw-r--r--tests/TPF/TPF_40_027/host.c24
-rw-r--r--tests/TPF/TPF_40_027/mpu1.c24
-rw-r--r--tests/TPF/TPF_40_027/mpu2.c24
-rw-r--r--tests/TPF/TPF_40_028/Makefile39
-rw-r--r--tests/TPF/TPF_40_028/common.h48
-rw-r--r--tests/TPF/TPF_40_028/host.c478
-rw-r--r--tests/TPF/TPF_40_028/mpu1.c72
-rw-r--r--tests/TPF/TPF_40_028/mpu2.c71
-rw-r--r--tests/TPF/TPF_40_028/mpu3.c67
-rw-r--r--tests/TPF/TPF_40_029/Makefile39
-rw-r--r--tests/TPF/TPF_40_029/common.h48
-rw-r--r--tests/TPF/TPF_40_029/host.c24
-rw-r--r--tests/TPF/TPF_40_029/mpu1.c24
-rw-r--r--tests/TPF/TPF_40_029/mpu2.c24
-rw-r--r--tests/TPF/TPF_40_029/mpu3.c24
-rw-r--r--tests/TPF/TPF_40_030/Makefile40
-rw-r--r--tests/TPF/TPF_40_030/common.h48
-rw-r--r--tests/TPF/TPF_40_030/host.c24
-rw-r--r--tests/TPF/TPF_40_030/mpu1.c24
-rw-r--r--tests/TPF/TPF_40_030/mpu2.c24
-rw-r--r--tests/TPF/TPF_40_030/mpu3.c24
-rw-r--r--tests/TPF/TPF_40_031/Makefile40
-rw-r--r--tests/TPF/TPF_40_031/common.h48
-rw-r--r--tests/TPF/TPF_40_031/host.c454
-rw-r--r--tests/TPF/TPF_40_031/mpu1.c72
-rw-r--r--tests/TPF/TPF_40_031/mpu2.c77
-rw-r--r--tests/TPF/TPF_40_031/mpu3.c75
-rw-r--r--tests/TPF/TPF_40_032/Makefile40
-rw-r--r--tests/TPF/TPF_40_032/common.h48
-rw-r--r--tests/TPF/TPF_40_032/host.c24
-rw-r--r--tests/TPF/TPF_40_032/mpu1.c24
-rw-r--r--tests/TPF/TPF_40_032/mpu2.c24
-rw-r--r--tests/TPF/TPF_40_032/mpu3.c24
-rw-r--r--tests/TPF/TPF_40_033/Makefile40
-rw-r--r--tests/TPF/TPF_40_033/common.h48
-rw-r--r--tests/TPF/TPF_40_033/host.c24
-rw-r--r--tests/TPF/TPF_40_033/mpu1.c24
-rw-r--r--tests/TPF/TPF_40_033/mpu2.c24
-rw-r--r--tests/TPF/TPF_40_033/mpu3.c24
-rw-r--r--tests/TPF/TPF_40_034/Makefile46
-rw-r--r--tests/TPF/TPF_40_034/common.h58
-rw-r--r--tests/TPF/TPF_40_034/host.c405
-rw-r--r--tests/TPF/TPF_40_034/mpu1.c107
-rw-r--r--tests/TPF/TPF_40_034/mpu2.c64
-rw-r--r--tests/TPF/TPF_40_034/mpu3.c115
-rw-r--r--tests/TPF/TPF_40_034/mpu4.c84
-rw-r--r--tests/TPF/TPF_40_034/mpu5.c111
-rw-r--r--tests/TPF/TPF_40_034/mpu6.c89
-rw-r--r--tests/TPF/TPF_40_035/Makefile46
-rw-r--r--tests/TPF/TPF_40_035/common.h58
-rw-r--r--tests/TPF/TPF_40_035/host.c24
-rw-r--r--tests/TPF/TPF_40_035/mpu1.c24
-rw-r--r--tests/TPF/TPF_40_035/mpu2.c24
-rw-r--r--tests/TPF/TPF_40_035/mpu3.c24
-rw-r--r--tests/TPF/TPF_40_035/mpu4.c24
-rw-r--r--tests/TPF/TPF_40_035/mpu5.c24
-rw-r--r--tests/TPF/TPF_40_035/mpu6.c24
-rw-r--r--tests/TPF/TPF_40_036/Makefile46
-rw-r--r--tests/TPF/TPF_40_036/common.h58
-rw-r--r--tests/TPF/TPF_40_036/host.c24
-rw-r--r--tests/TPF/TPF_40_036/mpu1.c24
-rw-r--r--tests/TPF/TPF_40_036/mpu2.c24
-rw-r--r--tests/TPF/TPF_40_036/mpu3.c24
-rw-r--r--tests/TPF/TPF_40_036/mpu4.c24
-rw-r--r--tests/TPF/TPF_40_036/mpu5.c24
-rw-r--r--tests/TPF/TPF_40_036/mpu6.c24
-rw-r--r--tests/TPF/TPF_40_037/Makefile46
-rw-r--r--tests/TPF/TPF_40_037/common.h58
-rw-r--r--tests/TPF/TPF_40_037/host.c24
-rw-r--r--tests/TPF/TPF_40_037/mpu1.c24
-rw-r--r--tests/TPF/TPF_40_037/mpu2.c24
-rw-r--r--tests/TPF/TPF_40_037/mpu3.c24
-rw-r--r--tests/TPF/TPF_40_037/mpu4.c24
-rw-r--r--tests/TPF/TPF_40_037/mpu5.c24
-rw-r--r--tests/TPF/TPF_40_037/mpu6.c24
-rw-r--r--tests/TPF/TPF_40_038/Makefile46
-rw-r--r--tests/TPF/TPF_40_038/common.h58
-rw-r--r--tests/TPF/TPF_40_038/host.c24
-rw-r--r--tests/TPF/TPF_40_038/mpu1.c24
-rw-r--r--tests/TPF/TPF_40_038/mpu2.c24
-rw-r--r--tests/TPF/TPF_40_038/mpu3.c24
-rw-r--r--tests/TPF/TPF_40_038/mpu4.c24
-rw-r--r--tests/TPF/TPF_40_038/mpu5.c24
-rw-r--r--tests/TPF/TPF_40_038/mpu6.c24
-rw-r--r--tests/TPF/TPF_40_039/Makefile46
-rw-r--r--tests/TPF/TPF_40_039/common.h58
-rw-r--r--tests/TPF/TPF_40_039/host.c24
-rw-r--r--tests/TPF/TPF_40_039/mpu1.c24
-rw-r--r--tests/TPF/TPF_40_039/mpu2.c24
-rw-r--r--tests/TPF/TPF_40_039/mpu3.c24
-rw-r--r--tests/TPF/TPF_40_039/mpu4.c24
-rw-r--r--tests/TPF/TPF_40_039/mpu5.c24
-rw-r--r--tests/TPF/TPF_40_039/mpu6.c24
-rw-r--r--tests/TPF/TPF_40_040/Makefile46
-rw-r--r--tests/TPF/TPF_40_040/common.h58
-rw-r--r--tests/TPF/TPF_40_040/host.c492
-rw-r--r--tests/TPF/TPF_40_040/mpu1.c72
-rw-r--r--tests/TPF/TPF_40_040/mpu2.c24
-rw-r--r--tests/TPF/TPF_40_040/mpu3.c93
-rw-r--r--tests/TPF/TPF_40_040/mpu4.c24
-rw-r--r--tests/TPF/TPF_40_040/mpu5.c91
-rw-r--r--tests/TPF/TPF_40_040/mpu6.c24
-rw-r--r--tests/TPF/TPF_40_041/Makefile46
-rw-r--r--tests/TPF/TPF_40_041/common.h58
-rw-r--r--tests/TPF/TPF_40_041/host.c24
-rw-r--r--tests/TPF/TPF_40_041/mpu1.c24
-rw-r--r--tests/TPF/TPF_40_041/mpu2.c24
-rw-r--r--tests/TPF/TPF_40_041/mpu3.c24
-rw-r--r--tests/TPF/TPF_40_041/mpu4.c24
-rw-r--r--tests/TPF/TPF_40_041/mpu5.c24
-rw-r--r--tests/TPF/TPF_40_041/mpu6.c24
-rw-r--r--tests/TPF/TPF_40_042/Makefile46
-rw-r--r--tests/TPF/TPF_40_042/common.h58
-rw-r--r--tests/TPF/TPF_40_042/host.c24
-rw-r--r--tests/TPF/TPF_40_042/mpu1.c24
-rw-r--r--tests/TPF/TPF_40_042/mpu2.c24
-rw-r--r--tests/TPF/TPF_40_042/mpu3.c24
-rw-r--r--tests/TPF/TPF_40_042/mpu4.c24
-rw-r--r--tests/TPF/TPF_40_042/mpu5.c24
-rw-r--r--tests/TPF/TPF_40_042/mpu6.c24
-rw-r--r--tests/TPF/TPF_40_043/Makefile46
-rw-r--r--tests/TPF/TPF_40_043/common.h58
-rw-r--r--tests/TPF/TPF_40_043/host.c24
-rw-r--r--tests/TPF/TPF_40_043/mpu1.c24
-rw-r--r--tests/TPF/TPF_40_043/mpu2.c24
-rw-r--r--tests/TPF/TPF_40_043/mpu3.c24
-rw-r--r--tests/TPF/TPF_40_043/mpu4.c24
-rw-r--r--tests/TPF/TPF_40_043/mpu5.c24
-rw-r--r--tests/TPF/TPF_40_043/mpu6.c24
-rw-r--r--tests/TPF/TPF_40_044/Makefile46
-rw-r--r--tests/TPF/TPF_40_044/common.h58
-rw-r--r--tests/TPF/TPF_40_044/host.c24
-rw-r--r--tests/TPF/TPF_40_044/mpu1.c24
-rw-r--r--tests/TPF/TPF_40_044/mpu2.c24
-rw-r--r--tests/TPF/TPF_40_044/mpu3.c24
-rw-r--r--tests/TPF/TPF_40_044/mpu4.c24
-rw-r--r--tests/TPF/TPF_40_044/mpu5.c24
-rw-r--r--tests/TPF/TPF_40_044/mpu6.c24
-rw-r--r--tests/TPF/TPF_40_045/Makefile46
-rw-r--r--tests/TPF/TPF_40_045/common.h58
-rw-r--r--tests/TPF/TPF_40_045/host.c24
-rw-r--r--tests/TPF/TPF_40_045/mpu1.c24
-rw-r--r--tests/TPF/TPF_40_045/mpu2.c24
-rw-r--r--tests/TPF/TPF_40_045/mpu3.c24
-rw-r--r--tests/TPF/TPF_40_045/mpu4.c24
-rw-r--r--tests/TPF/TPF_40_045/mpu5.c24
-rw-r--r--tests/TPF/TPF_40_045/mpu6.c24
-rw-r--r--tests/TPF/TPF_50_001/Makefile31
-rw-r--r--tests/TPF/TPF_50_001/common.h32
-rw-r--r--tests/TPF/TPF_50_001/host.c143
-rw-r--r--tests/TPF/TPF_50_001/mpu1.c64
-rw-r--r--tests/TPF/TPF_50_001/mpu2.c68
-rw-r--r--tests/TPF/TPF_50_002/Makefile38
-rw-r--r--tests/TPF/TPF_50_002/common.h46
-rw-r--r--tests/TPF/TPF_50_002/host.c226
-rw-r--r--tests/TPF/TPF_50_002/mpu1.c69
-rw-r--r--tests/TPF/TPF_50_002/mpu2.c70
-rw-r--r--tests/TPF/TPF_50_003/Makefile38
-rw-r--r--tests/TPF/TPF_50_003/common.h46
-rw-r--r--tests/TPF/TPF_50_003/host.c24
-rw-r--r--tests/TPF/TPF_50_003/mpu1.c24
-rw-r--r--tests/TPF/TPF_50_003/mpu2.c24
-rw-r--r--tests/TPF/TPF_50_004/Makefile38
-rw-r--r--tests/TPF/TPF_50_004/common.h49
-rw-r--r--tests/TPF/TPF_50_004/host.c280
-rw-r--r--tests/TPF/TPF_50_004/mpu1.c68
-rw-r--r--tests/TPF/TPF_50_004/mpu2.c75
-rw-r--r--tests/TPF/TPF_50_005/Makefile38
-rw-r--r--tests/TPF/TPF_50_005/common.h49
-rw-r--r--tests/TPF/TPF_50_005/host.c24
-rw-r--r--tests/TPF/TPF_50_005/mpu1.c24
-rw-r--r--tests/TPF/TPF_50_005/mpu2.c24
-rw-r--r--tests/TPF/TPF_60_001/Makefile38
-rw-r--r--tests/TPF/TPF_60_001/common.h40
-rw-r--r--tests/TPF/TPF_60_001/host.c181
-rw-r--r--tests/TPF/TPF_60_001/mpu1.c (renamed from tests/TFP/TFP_35_001/mpu.c)39
-rw-r--r--tests/TPF/TPF_60_002/Makefile38
-rw-r--r--tests/TPF/TPF_60_002/common.h40
-rw-r--r--tests/TPF/TPF_60_002/host.c24
-rw-r--r--tests/TPF/TPF_60_002/mpu1.c24
-rw-r--r--tests/TPF/TPF_60_003/Makefile38
-rw-r--r--tests/TPF/TPF_60_003/common.h41
-rw-r--r--tests/TPF/TPF_60_003/host.c24
-rw-r--r--tests/TPF/TPF_60_003/mpu1.c24
-rw-r--r--tests/TPF/TPF_60_004/Makefile38
-rw-r--r--tests/TPF/TPF_60_004/common.h43
-rw-r--r--tests/TPF/TPF_60_004/host.c199
-rw-r--r--tests/TPF/TPF_60_004/mpu1.c62
-rw-r--r--tests/TPF/TPF_60_004/mpu2.c54
-rw-r--r--tests/TPF/TPF_60_005/Makefile38
-rw-r--r--tests/TPF/TPF_60_005/common.h43
-rw-r--r--tests/TPF/TPF_60_005/host.c24
-rw-r--r--tests/TPF/TPF_60_005/mpu1.c24
-rw-r--r--tests/TPF/TPF_60_005/mpu2.c24
-rw-r--r--tests/TPF/TPF_60_006/Makefile38
-rw-r--r--tests/TPF/TPF_60_006/common.h43
-rw-r--r--tests/TPF/TPF_60_006/host.c24
-rw-r--r--tests/TPF/TPF_60_006/mpu1.c24
-rw-r--r--tests/TPF/TPF_60_006/mpu2.c24
-rw-r--r--tests/TPI/Makefile32
-rw-r--r--tests/TPI/TPI_10_001/Makefile33
-rw-r--r--tests/TPI/TPI_10_001/host.c112
-rw-r--r--tests/TPI/TPI_10_002/Makefile32
-rw-r--r--tests/TPI/TPI_10_002/common.h32
-rw-r--r--tests/TPI/TPI_10_002/host.c94
-rw-r--r--tests/TPI/TPI_10_002/mpu1.c67
-rw-r--r--tests/TPI/TPI_10_003/Makefile33
-rw-r--r--tests/TPI/TPI_10_003/host.c158
-rw-r--r--tests/TPI/TPI_10_004/Makefile33
-rw-r--r--tests/TPI/TPI_10_004/common.h33
-rw-r--r--tests/TPI/TPI_10_004/host.c105
-rw-r--r--tests/TPI/TPI_10_004/mpu1.c62
-rw-r--r--tests/TPI/TPI_10_004/mpu2.c61
-rw-r--r--tests/TPI/TPI_10_005/Makefile36
-rw-r--r--tests/TPI/TPI_10_005/common.h44
-rw-r--r--tests/TPI/TPI_10_005/host.c149
-rw-r--r--tests/TPI/TPI_10_005/mpu1.c (renamed from tests/TFP/TFP_24_003/mpu1.c)46
-rw-r--r--tests/scripts/config.mk12
-rw-r--r--tests/scripts/rules_tpf.mk1
-rw-r--r--tests/scripts/tests.csv121
846 files changed, 31107 insertions, 5093 deletions
diff --git a/tests/Makefile b/tests/Makefile
index 063be00..ab50d5c 100644
--- a/tests/Makefile
+++ b/tests/Makefile
@@ -22,13 +22,13 @@
#
top_srcdir = .
-test_classes = TFP
+test_classes = TFP TPF
extra_classes = TTF
ifneq ($(MARS_SRC),)
-test_classes := TFI $(test_classes)
+test_classes := TFI TPI $(test_classes)
else
-extra_classes += TFI
+extra_classes += TFI TPI
endif
include $(top_srcdir)/scripts/config.mk
diff --git a/tests/TFI/Makefile b/tests/TFI/Makefile
index b02c40a..62ac9fe 100644
--- a/tests/TFI/Makefile
+++ b/tests/TFI/Makefile
@@ -24,6 +24,7 @@
top_srcdir = ..
test_items = \
TFI_01_001 \
+ TFI_01_002 \
TFI_11_001 \
TFI_11_003 \
TFI_14_001 \
diff --git a/tests/TFI/TFI_01_002/Makefile b/tests/TFI/TFI_01_002/Makefile
new file mode 100644
index 0000000..9aa348e
--- /dev/null
+++ b/tests/TFI/TFI_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_internal.mk
+include $(top_srcdir)/scripts/rules_item.mk
diff --git a/tests/TFP/TFP_34_007/mpu1.c b/tests/TFI/TFI_01_002/host.c
index 1141eee..873e008 100644
--- a/tests/TFP/TFP_34_007/mpu1.c
+++ b/tests/TFI/TFI_01_002/host.c
@@ -1,5 +1,5 @@
/*
- * Copyright 2008 Sony Corporation
+ * Copyright 2009 Sony Corporation
*
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
@@ -21,21 +21,27 @@
* THE SOFTWARE.
*/
+#include "config.h"
+#include "context_internal.h"
+
+#include <memory.h>
+#include <libspe2.h>
#include <mars/task.h>
-#include <mars_task_test.h>
-#include <spu_mfcio.h>
+#include <mars_test.h>
+
+struct mars_context *mars;
-int mars_task_main(const struct mars_task_args *task_args)
+int main(void)
{
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);
+
+ /* Allocate mars_context and set to zero */
+ mars = mars_malloc(sizeof(struct mars_context));
+ memset(mars, 0, sizeof(struct mars_context));
- ret = mars_task_event_flag_set(mpu_to_host_ea, chk_bit);
- MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+ /* Check resiliance */
+ ret = mars_context_destroy(mars);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_ERROR_PARAMS);
return 0;
}
diff --git a/tests/TFP/TFP_14_001/Makefile b/tests/TFP/TFP_14_001/Makefile
index 432135a..8ee6f02 100644
--- a/tests/TFP/TFP_14_001/Makefile
+++ b/tests/TFP/TFP_14_001/Makefile
@@ -20,7 +20,9 @@
# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
# THE SOFTWARE.
#
-
+#
+# Sony CONFIDENTIAL
+#
top_srcdir = ../..
test_objs = host.o mpu.task_eo
diff --git a/tests/TFP/TFP_14_001/common.h b/tests/TFP/TFP_14_001/common.h
index c49c401..6b10266 100644
--- a/tests/TFP/TFP_14_001/common.h
+++ b/tests/TFP/TFP_14_001/common.h
@@ -21,4 +21,4 @@
* THE SOFTWARE.
*/
-#define MAGIC_UINT32 0x89ABCDEF
+#define MAGIC_INT32 0x79ABCDEF
diff --git a/tests/TFP/TFP_14_001/host.c b/tests/TFP/TFP_14_001/host.c
index ca5a8e4..e10aa33 100644
--- a/tests/TFP/TFP_14_001/host.c
+++ b/tests/TFP/TFP_14_001/host.c
@@ -37,11 +37,7 @@ 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);
+ int32_t exit_code = 0;
ret = mars_context_create(&mars_ctx, 0, 0);
MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
@@ -51,17 +47,22 @@ int main(void)
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 */
+ /* wait MPU task to run */
mars_test_counter_wait(&shared_resource, 1);
-
+ /*
+ * Soon after the task sets the counter as 1,
+ * it will exit with return code MAGIC_INT32.
+ * If the mars_task_wait() does not wait for the
+ * task finish, it is unlikely to happen that
+ * the return value will match with the magic number.
+ */
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);
+ MARS_TEST_ASSERT_ERROR(exit_code, MAGIC_INT32);
ret = mars_task_destroy(&task_id);
MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
diff --git a/tests/TFP/TFP_14_001/mpu.c b/tests/TFP/TFP_14_001/mpu.c
index f4fede4..5a93ca1 100644
--- a/tests/TFP/TFP_14_001/mpu.c
+++ b/tests/TFP/TFP_14_001/mpu.c
@@ -29,13 +29,8 @@
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;
+ return MAGIC_INT32;
}
diff --git a/tests/TFP/TFP_14_002/common.h b/tests/TFP/TFP_14_002/common.h
new file mode 100644
index 0000000..04cfc82
--- /dev/null
+++ b/tests/TFP/TFP_14_002/common.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 MAGIC_INT32 0x789abcde
diff --git a/tests/TFP/TFP_14_002/host.c b/tests/TFP/TFP_14_002/host.c
index 5a8aafe..25d58a2 100644
--- a/tests/TFP/TFP_14_002/host.c
+++ b/tests/TFP/TFP_14_002/host.c
@@ -26,6 +26,7 @@
#include <libspe2.h>
#include <mars/task.h>
#include <mars_test.h>
+#include "common.h"
#define THREAD_COUNT 16
@@ -37,13 +38,18 @@ static struct mars_task_args task_args;
static pthread_t threads[THREAD_COUNT];
static int finished[THREAD_COUNT];
+static uint32_t notify __attribute((aligned(128)));
+
void *thread_proc(void *arg)
{
- int exit_code, ret;
+ int exit_code =0 , ret;
+ /*
+ * If the task exits, the return code should be MAGIC_INT32
+ */
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_EQUAL(exit_code, MAGIC_INT32);
finished[mars_ptr_to_ea(arg)] = 1;
@@ -61,13 +67,30 @@ int main(void)
ret = mars_context_create(&mars, 0, 0);
MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+ /*
+ * Create a task.
+ */
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;
+ /*
+ * Start the task before threads start.
+ * As the state of the task that is just created and has been
+ * never run is FINISHED, we can not start host threads before
+ * the task actually runs.
+ */
+ task_args.type.u32[0] = mars_ptr_to_ea(&notify);
ret = mars_task_schedule(&task_id, &task_args, 0);
MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+ /*
+ * wait for the task being running
+ */
+ mars_test_counter_wait(&notify, 1);
+
+ /*
+ * Now start threads
+ */
for (i = 0; i < THREAD_COUNT; i++) {
finished[i] = 0;
@@ -78,14 +101,20 @@ int main(void)
(void *)(uintptr_t)i);
}
- sleep(2);
-
+ /*
+ * As the task has been running and it should
+ * exit soon after, these threads exits in short time
+ * as well
+ */
for (i = 0; i < THREAD_COUNT; i++) {
MARS_TEST_ASSERT(finished[i]);
pthread_join(threads[i], NULL);
}
+ /*
+ * Clean up
+ */
ret = mars_task_destroy(&task_id);
MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
diff --git a/tests/TFP/TFP_14_002/mpu.c b/tests/TFP/TFP_14_002/mpu.c
index 136e8f0..c406357 100644
--- a/tests/TFP/TFP_14_002/mpu.c
+++ b/tests/TFP/TFP_14_002/mpu.c
@@ -23,14 +23,21 @@
#include <mars/task.h>
#include <mars_test.h>
+#include "common.h"
int mars_task_main(const struct mars_task_args *task_args)
{
- uint32_t tb_freq = task_args->type.u32[0];
+ uint64_t notify_ea = task_args->type.u32[0];
- mars_test_sleep(tb_freq, 1);
+ /*
+ * Say host we are running
+ */
+ mars_test_counter_set(notify_ea, 1);
- mars_task_exit(0);
+ /*
+ * Return with a magic number
+ */
+ mars_task_exit(MAGIC_INT32);
return 0;
}
diff --git a/tests/TFP/TFP_17_001/common.h b/tests/TFP/TFP_17_001/common.h
index 1dec3fb..53b47b7 100644
--- a/tests/TFP/TFP_17_001/common.h
+++ b/tests/TFP/TFP_17_001/common.h
@@ -22,5 +22,4 @@
*/
#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
index 6df6680..fc8729e 100644
--- a/tests/TFP/TFP_17_001/host.c
+++ b/tests/TFP/TFP_17_001/host.c
@@ -32,36 +32,77 @@ 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;
+static uint32_t shared_resource __attribute__((aligned(128)));
int main(void)
{
int ret;
int32_t exit_code;
+ int done;
ret = mars_context_create(&mars_ctx, 0, 0);
MARS_TEST_ASSERT_EQUAL(ret, MARS_SUCCESS);
- ret = mars_task_create(mars_ctx, &task_id, NULL,
+ /*
+ * Create a task
+ */
+ ret = mars_task_create(mars_ctx, &task_id, "17001",
mpu_prog.elf_image, MARS_TASK_CONTEXT_SAVE_SIZE_MAX);
MARS_TEST_ASSERT_EQUAL(ret, MARS_SUCCESS);
task_args.type.u64[0] = mars_ptr_to_ea(&shared_resource);
+ /*
+ * Start the task
+ */
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 */
+ /*
+ * Wait for the task being running
+ */
+ mars_test_counter_wait(&shared_resource, 1);
+
+ /*
+ * Try to wait for the task's finish
+ * If the task runs forever, the test framework will detect
+ * as a timeout.
+ */
+ done = 0;
+ exit_code = 0;
+ do {
+ ret = mars_task_try_wait(&task_id, &exit_code);
+ switch (ret) {
+ case MARS_SUCCESS:
+ /*
+ * Most likely happened
+ */
+ done = 1;
+ break;
+ case MARS_ERROR_BUSY:
+ /*
+ * the task is still running
+ */
+ break;
+ default:
+ /*
+ * Other code should be error
+ */
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+ break;
+ }
+ } while (!done);
+
+
+ /*
+ * check the assumption
+ */
MARS_TEST_ASSERT_EQUAL(exit_code, MAGIC_INT32);
+ MARS_TEST_ASSERT_EQUAL(shared_resource, 1);
- sleep(1);
-
- MARS_TEST_ASSERT_EQUAL(shared_resource, MAGIC_UINT32);
-
+ /*
+ * clean up
+ */
ret = mars_task_destroy(&task_id);
MARS_TEST_ASSERT_EQUAL(ret, MARS_SUCCESS);
diff --git a/tests/TFP/TFP_17_001/mpu.c b/tests/TFP/TFP_17_001/mpu.c
index ab035c4..a6c19d9 100644
--- a/tests/TFP/TFP_17_001/mpu.c
+++ b/tests/TFP/TFP_17_001/mpu.c
@@ -21,23 +21,29 @@
* THE SOFTWARE.
*/
-#include <spu_mfcio.h>
+#include <mars_test.h>
#include <mars/task.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];
+ /*
+ * Say the host we are running
+ */
+ mars_test_counter_set(shared_resource_ea, 1);
+ /*
+ * Just exit
+ */
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();
+ /*
+ * Never reach here!
+ */
+ mars_test_counter_set(shared_resource_ea, 2);
+loop:
+ goto loop;
return 0;
}
diff --git a/tests/TFP/TFP_18_001/host.c b/tests/TFP/TFP_18_001/host.c
index 59b75f0..beb1edc 100644
--- a/tests/TFP/TFP_18_001/host.c
+++ b/tests/TFP/TFP_18_001/host.c
@@ -47,78 +47,138 @@ struct aligned_int {
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;
+ int i, ret, num_mpu, yield_target,
+ running_tasks, changed_tasks;
+ int state[2][NUM_TASK]; /* 0: before yield request, 1:after request */
int32_t exit_code;
+ /*
+ * Create and run more tasks than the number of actual
+ * MPUs so that the task which would call yield() can really yield
+ * the execution to the other task.
+ */
num_mpu = spe_cpu_info_get(SPE_COUNT_PHYSICAL_SPES, -1);
MARS_TEST_ASSERT(num_mpu > 0);
- MARS_TEST_ASSERT(num_mpu < NUM_TASK);
+ MARS_TEST_ASSERT_PRINTF(num_mpu < NUM_TASK,
+ "usable MPUs are %d and should be less than %d\n",
+ 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_SIZE_MAX);
MARS_TEST_ASSERT_EQUAL(ret, MARS_SUCCESS);
- cmd[i].val = CMD_NOP;
+ cmd[i].val = CMD_HELLO;
+ res[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);
+ /*
+ * In this test, we can not continue if this
+ * function fails.
+ */
MARS_TEST_ASSERT_EQUAL(ret, MARS_SUCCESS);
}
- /* Check status of all tasks */
- running_task = 0;
+ /*
+ * Check the state of each tasks. Then pick
+ * one of running tasks up to be told to yield.
+ * As w can assume mars_task_schedule() works as defined,
+ * running tasks should be equal to num_mpu.
+ * Wait until the number of running tasks reaches as num_mpu
+ * If something goes wrong and this loop does not exit,
+ * the test framework will detect the timeout and abort us.
+ */
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;
+ do {
+ running_tasks = 0;
+ for (i = 0; i < NUM_TASK; i++) {
+ if (res[i].val == CMD_HELLO) {
+ state[0][i] = TASK_STATE_RUNNING;
+ running_tasks++;
+ yield_target = i;
+ } else
+ state[0][i] = TASK_STATE_SLEEPING;
}
+ } while (running_tasks < num_mpu);
+
+ /*
+ * See if MARS puts tasks runnable more than num_mpus.
+ * This test is a bit excessive because we already assumed
+ * mars_task_schedule() worked fine above...
+ */
+ MARS_TEST_ASSERT_EQUAL(running_tasks, num_mpu);
+
+ /*
+ * clear answers
+ */
+ for (i = 0; i < NUM_TASK; i++) {
+ res[i].val = CMD_NOP;
+ cmd[i].val = CMD_NOP;
}
- 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;
+ /*
+ * Ask say hello again to all except the target
+ */
for (i = 0; i < NUM_TASK; i++) {
- if (is_running(i) && (state[i] == TASK_STATE_SLEEPING))
- yielded_task++;
+ if (i == yield_target)
+ cmd[i].val = CMD_YIELD;
+ else
+ cmd[i].val = CMD_HELLO;
}
-
- /* 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);
+ mars_test_lwsync();
+
+ /*
+ * Wait for scheduling being occured
+ */
+ do {
+ running_tasks = 0;
+ for (i = 0; i < NUM_TASK; i++) {
+ if (res[i].val == CMD_HELLO) {
+ state[1][i] = TASK_STATE_RUNNING;
+ running_tasks++;
+ } else
+ state[1][i] = TASK_STATE_SLEEPING;
+ }
+ } while (running_tasks < num_mpu);
+ /*
+ * The res[yield_target] remains CMD_NOP
+ * even if the task which calls yield(), so
+ * if the invocation of yield() just returned without
+ * acutuall yielding, that is, if the task is still running
+ * after yield(), the task will be counted as sleeping.
+ * If the above occurs, the loop above will not end.
+ */
+ MARS_TEST_ASSERT_EQUAL(running_tasks, num_mpu);
+
+ /*
+ * Check the result
+ */
+
+ /*
+ * The task issued yield should be in sleep state
+ */
+ MARS_TEST_ASSERT(state[1][yield_target] == TASK_STATE_SLEEPING);
+ /*
+ * One of the tasks which have been running is in sleep state
+ */
+ changed_tasks = 0;
+ for (i = 0; i < NUM_TASK; i++) {
+ if (i != yield_target && state[0][i] != state[1][i])
+ changed_tasks++;
+ }
+ MARS_TEST_ASSERT_EQUAL(changed_tasks, 1);
/* Command all tasks to exit */
for (i = 0; i < NUM_TASK; i++)
cmd[i].val = CMD_EXIT;
+ mars_test_lwsync();
/* Join all tasks */
for (i = 0; i < NUM_TASK; i++) {
@@ -135,4 +195,3 @@ int main(void)
return 0;
}
-
diff --git a/tests/TFP/TFP_18_001/mpu.c b/tests/TFP/TFP_18_001/mpu.c
index 4cf7119..5d68bea 100644
--- a/tests/TFP/TFP_18_001/mpu.c
+++ b/tests/TFP/TFP_18_001/mpu.c
@@ -27,6 +27,7 @@
#include "cmd.h"
#define FAST_DMA_ALIGN 128
+#define MFC_TAG_NO 0
static int32_t cmd __attribute__((aligned(FAST_DMA_ALIGN)));
static int32_t res __attribute__((aligned(FAST_DMA_ALIGN)));
@@ -34,29 +35,65 @@ static int32_t res __attribute__((aligned(FAST_DMA_ALIGN)));
int mars_task_main(const struct mars_task_args *task_args)
{
int ret;
+ int32_t cmd_copy;
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_get(&cmd, cmd_ea, sizeof(int32_t), MFC_TAG_NO, 0, 0);
+ mfc_write_tag_mask(1 << MFC_TAG_NO);
mfc_read_tag_status_all();
- if (cmd == CMD_NOP)
- continue;
- if (cmd == CMD_EXIT)
+ cmd_copy = cmd;
+ /*
+ * clear command
+ */
+ if (cmd != CMD_NOP) {
+ cmd = CMD_NOP;
+ mfc_put(&cmd, cmd_ea, sizeof(int32_t), MFC_TAG_NO, 0, 0);
+ mfc_write_tag_mask(1 << MFC_TAG_NO);
+ mfc_read_tag_status_all();
+ mfc_sync(MFC_TAG_NO);
+ }
+
+ switch (cmd_copy) {
+ case CMD_NOP:
+ break;
+ case CMD_EXIT:
+ goto done;
break;
- if (cmd == CMD_YIELD) {
+ case CMD_YIELD:
+ /*
+ * OK, we will yield.
+ */
ret = mars_task_yield();
+ /*
+ * yield() should not return error except
+ * no context save area reserved
+ */
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);
+ break;
+ case CMD_HELLO:
+ /*
+ * host asked me to say hello
+ */
+ res = CMD_HELLO;
+ mfc_put(&res, res_ea, sizeof(int32_t), MFC_TAG_NO, 0, 0);
+ mfc_write_tag_mask(1 << MFC_TAG_NO);
mfc_read_tag_status_all();
+ mfc_sync(MFC_TAG_NO);
+ break;
+ default:
+ /*
+ * the host should not issue commands except
+ * listed above
+ */
+ MARS_TEST_ASSERT_PRINTF(0, "unknown CMD %d\n",
+ cmd);
+ break;
}
}
+done:
return 0;
}
diff --git a/tests/TFP/TFP_18_002/Makefile b/tests/TFP/TFP_18_002/Makefile
index ecbce33..432135a 100644
--- a/tests/TFP/TFP_18_002/Makefile
+++ b/tests/TFP/TFP_18_002/Makefile
@@ -22,7 +22,7 @@
#
top_srcdir = ../..
-test_objs = host.o mpu1.task_eo mpu2.task_eo
+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_002/common.h b/tests/TFP/TFP_18_002/common.h
new file mode 100644
index 0000000..04cfc82
--- /dev/null
+++ b/tests/TFP/TFP_18_002/common.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 MAGIC_INT32 0x789abcde
diff --git a/tests/TFP/TFP_18_002/host.c b/tests/TFP/TFP_18_002/host.c
index 19b6891..4b9dea6 100644
--- a/tests/TFP/TFP_18_002/host.c
+++ b/tests/TFP/TFP_18_002/host.c
@@ -27,86 +27,92 @@
#include <libspe2.h>
#include <mars/task.h>
#include <mars_test.h>
+#include "common.h"
#define MAX_TASK_COUNT 256
-#define VALID_TIME 10000
-extern spe_program_handle_t mpu1_prog, mpu2_prog;
+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 pthread_t threads[2];
-static long long times[2];
-static struct mars_task_args triggers[2] __attribute__((aligned(16)));
+static uint32_t notify __attribute__((aligned(128)));
+static uint32_t counter __attribute__((aligned(128)));
-long long int get_ticks()
-{
- struct timeval tv;
-
- gettimeofday(&tv, NULL);
- return (long long int)tv.tv_sec*1000000 + tv.tv_usec;
-}
+static int spe_cnt;
-void *thread_proc(void *arg)
+/*
+ * select the task which does 'yield()'
+ */
+uint64_t select_role(int task_id)
{
- mars_test_counter_wait(&triggers[(int)(intptr_t)arg].type.u32[0], 1);
-
- times[(int)(intptr_t)arg] = get_ticks();
-
- return NULL;
-}
+ return task_id == (spe_cnt / 2);
+};
int main(void)
{
int i, exit_code, ret;
- uint32_t tb_freq;
-
- int spe_cnt = spe_cpu_info_get(SPE_COUNT_PHYSICAL_SPES, -1);
+ 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);
+ /*
+ * Create tasks as many as physical SPEs
+ */
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,
+ mpu_prog.elf_image,
MARS_TASK_CONTEXT_SAVE_SIZE_MAX);
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]);
+ task_args.type.u64[0] = mars_ptr_to_ea(&notify);
+ task_args.type.u64[1] = mars_ptr_to_ea(&counter);
- for (i = 0; i < spe_cnt; i++)
+ /*
+ * Start task
+ */
+ for (i = 0; i < spe_cnt; i++) {
+ /*
+ * Set the role for the task
+ */
+ task_args.type.u64[2] = select_role(i);
ret = mars_task_schedule(&task_ids[i], &task_args, 0);
MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
-
+ }
+ /*
+ * As each tasks increments the counter,
+ * wait for the counter being spe_cnt
+ */
+ mars_test_counter_wait(&counter, spe_cnt);
+
+ /*
+ * Tell the tasks do the role
+ */
+ mars_test_counter_set(&notify, 1);
+
+ /*
+ * all tasks should terminate
+ */
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);
+ MARS_TEST_ASSERT_EQUAL(exit_code, MAGIC_INT32);
}
-
- pthread_join(threads[0], NULL);
- pthread_join(threads[1], NULL);
-
+ /*
+ * if all tasks exit as expected, counter should be zero
+ */
+ MARS_TEST_ASSERT_EQUAL(counter, 0);
+
+ /*
+ * Clean up
+ */
for (i = 0; i < spe_cnt; i++) {
ret = mars_task_destroy(&task_ids[i]);
MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
@@ -115,7 +121,5 @@ int main(void)
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_34_007/mpu2.c b/tests/TFP/TFP_18_002/mpu.c
index eedbcd2..119d6ca 100644
--- a/tests/TFP/TFP_34_007/mpu2.c
+++ b/tests/TFP/TFP_18_002/mpu.c
@@ -21,21 +21,40 @@
* THE SOFTWARE.
*/
-#include <mars/task.h>
#include <mars_task_test.h>
-#include <spu_mfcio.h>
+#include <mars/task.h>
+#include "common.h"
int mars_task_main(const struct mars_task_args *task_args)
{
+ uint64_t notify_ea = task_args->type.u64[0];
+ uint64_t counter_ea = task_args->type.u64[1];
+ uint64_t role = task_args->type.u64[2];
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];
+ /*
+ * Say the host we are ready
+ */
+ mars_test_counter_add(counter_ea, 1);
+
+ /*
+ * Wait for host command
+ */
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);
+ /*
+ * Do the role
+ */
+ if (role) {
+ /* I'm going to yield */
+ ret = mars_task_yield();
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+ } else {
+ /* I'm just going to exit */
+ }
+
+ mars_test_counter_add(counter_ea, -1);
+ mars_task_exit(MAGIC_INT32);
return 0;
}
diff --git a/tests/TFP/TFP_23_002/host.c b/tests/TFP/TFP_23_002/host.c
index c8f0fef..8e8e17e 100644
--- a/tests/TFP/TFP_23_002/host.c
+++ b/tests/TFP/TFP_23_002/host.c
@@ -21,7 +21,6 @@
* THE SOFTWARE.
*/
-#include <unistd.h>
#include <mars/task.h>
#include <libspe2.h>
#include <mars_test.h>
@@ -33,56 +32,75 @@ 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 struct mars_task_args task_args;
static uint64_t barrier;
-static uint32_t notify[32] __attribute((aligned(128)));
-static uint32_t shared_ret[NUM_TASKS * 4] __attribute((aligned(16)));
+static uint32_t notify __attribute((aligned(128)));
+static uint32_t counter __attribute((aligned(16)));
int main(void)
{
- int ret, count, num_success;
+ int ret, i, exited, blocked;
+ 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_barrier_create(mars_ctx,
- &barrier, WAIT_NUM);
+ /*
+ * Create a barrier
+ */
+ 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_SIZE_MAX);
+ /*
+ * Create and start tasks
+ */
+ for (i = 0; i < NUM_TASKS; i++) {
+ ret = mars_task_create(mars_ctx, &task_id[i], NULL,
+ mpu_prog.elf_image,
+ MARS_TASK_CONTEXT_SAVE_SIZE_MAX);
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);
+ task_args.type.u64[0] = barrier;
+ task_args.type.u64[1] = mars_ptr_to_ea(&notify);
+ task_args.type.u64[2] = mars_ptr_to_ea(&counter);
+ ret = mars_task_schedule(&task_id[i], &task_args, 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);
+ /* tell the tasks to notify barrier */
+ mars_test_counter_set(&notify, 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);
+ /*
+ * If mars_task_bariier_notify() works as expected,
+ * the number of WAIT_NUM tasked should increment the counter,
+ * and the rest should be blocked.
+ */
+ mars_test_counter_wait(&counter, WAIT_NUM);
+
+ /*
+ * Check the state of the tasks
+ */
+ do {
+ exited = 0;
+ blocked = 0;
+ for (i = 0; i < NUM_TASKS; i++) {
+ ret = mars_task_try_wait(&task_id[i], &exit_code);
+ switch (ret) {
+ case MARS_SUCCESS:
+ exited ++;
+ break;
+ case MARS_ERROR_BUSY:
+ blocked ++;
+ break;
+ default:
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+ break;
+ }
+ }
+ } while (exited != WAIT_NUM || blocked != (NUM_TASKS - WAIT_NUM));
- /* blocking MPU tasks can not be destroyed by host */
+ /* 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
index 953adec..0d6f5a6 100644
--- a/tests/TFP/TFP_23_002/mpu.c
+++ b/tests/TFP/TFP_23_002/mpu.c
@@ -23,27 +23,27 @@
#include <mars/task.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];
+ uint64_t counter_ea = task_args->type.u64[2];
+ /*
+ * Wait for the command from the host
+ */
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();
+ /*
+ * The number of WAIT_NUM tasks can be reached here.
+ * The rest should be blocked in mars_task_barrier_notify()
+ */
+ mars_test_counter_add(counter_ea, 1);
return 0;
}
diff --git a/tests/TFP/TFP_24_002/Makefile b/tests/TFP/TFP_24_002/Makefile
index ecbce33..72cf999 100644
--- a/tests/TFP/TFP_24_002/Makefile
+++ b/tests/TFP/TFP_24_002/Makefile
@@ -22,7 +22,7 @@
#
top_srcdir = ../..
-test_objs = host.o mpu1.task_eo mpu2.task_eo
+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_24_002/host.c b/tests/TFP/TFP_24_002/host.c
index 9e858a0..166a559 100644
--- a/tests/TFP/TFP_24_002/host.c
+++ b/tests/TFP/TFP_24_002/host.c
@@ -27,16 +27,20 @@
#include <mars_test.h>
#define NUM_TASKS MARS_TASK_BARRIER_WAIT_MAX
-
+/* maximum number of usable mpu in one system is 16 (8 SPU x 2 Cell) */
+#define DUMMY_TASKS 16
extern spe_program_handle_t mpu1_prog;
extern spe_program_handle_t mpu2_prog;
+extern spe_program_handle_t mpu3_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)));
-
+static struct mars_task_id task1_id, task2_id;
+static struct mars_task_id dummy_task_id[DUMMY_TASKS];
+static struct mars_task_args task_args, dummy_task_args;
+static uint64_t barrier;
+static uint32_t counter __attribute__((aligned(16)));
+static uint32_t dummy_task_counter __attribute__((aligned(16)));
+static uint32_t dummy_notify __attribute__((aligned(16)));
#define CHK_NUM 3
static uint32_t chk_num[] = {
1,
@@ -44,58 +48,111 @@ static uint32_t chk_num[] = {
NUM_TASKS,
};
+/*
+ * See if there are 'mpus' number of SPU usable.
+ * If there are less than the specified, this function blocks
+ * forever and then the test framework will detect as timeout.
+ */
+void test_usable_mpus(int mpus)
+{
+ int ret, i;
+ int32_t exit_code;
+
+ MARS_TEST_ASSERT(mpus <= DUMMY_TASKS);
+
+ mars_test_counter_set(&dummy_task_counter, 0);
+ mars_test_counter_set(&dummy_notify, 0);
+
+ dummy_task_args.type.u64[0] = mars_ptr_to_ea(&dummy_task_counter);
+ dummy_task_args.type.u64[1] = mars_ptr_to_ea(&dummy_notify);
+
+ for (i = 0; i < mpus; i++) {
+ ret = mars_task_create(mars_ctx, &dummy_task_id[i], NULL,
+ mpu3_prog.elf_image,
+ MARS_TASK_CONTEXT_SAVE_SIZE_MAX);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+
+ ret = mars_task_schedule(&dummy_task_id[i], &dummy_task_args, 0);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+ }
+ /*
+ * If the number of usable mpus is less than specified,
+ * the following is never returned.
+ */
+ mars_test_counter_wait(&dummy_task_counter, mpus);
+
+ mars_test_counter_set(&dummy_notify, 1);
+
+ for (i = 0; i < mpus; i++) {
+ ret = mars_task_wait(&dummy_task_id[i], &exit_code);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+ MARS_TEST_ASSERT_ERROR(exit_code, MARS_SUCCESS);
+
+ ret = mars_task_destroy(&dummy_task_id[i]);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+ }
+}
+
int main(void)
{
- int ret, i, count;
+ int ret, i;
int32_t exit_code;
+ int num_mpu;
+
+ num_mpu = 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 < CHK_NUM; i++) {
- shared_resource = 0;
+ mars_test_counter_set(&counter, 0);
- ret = mars_task_barrier_create(mars_ctx,
- &barrier[i], chk_num[i]);
+ ret = mars_task_barrier_create(mars_ctx, &barrier, 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_SIZE_MAX);
+ mpu1_prog.elf_image,
+ MARS_TASK_CONTEXT_SAVE_SIZE_MAX);
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);
+ task_args.type.u64[1] = barrier;
+ task_args.type.u64[2] = mars_ptr_to_ea(&counter);
+ ret = mars_task_schedule(&task1_id, &task_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_SIZE_MAX);
- MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+ /* create notifier task */
+ ret = mars_task_create(mars_ctx, &task2_id, NULL,
+ mpu2_prog.elf_image, MARS_TASK_CONTEXT_SAVE_SIZE_MAX);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
- task_args[count].type.u64[0] = barrier[i];
+ task_args.type.u32[0] = chk_num[i] - 1;
+ ret = mars_task_schedule(&task2_id, &task_args, 0);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
- /* 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);
- }
- }
+ 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 mpu task is waiting */
- sleep(1);
- MARS_TEST_ASSERT_EQUAL(shared_resource, 0);
+ mars_test_counter_wait(&counter, 1);
+ test_usable_mpus(num_mpu);
+ ret = mars_task_try_wait(&task1_id, &exit_code);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_ERROR_BUSY);
+
+ /* notify last one time */
+ task_args.type.u32[0] = 1;
+ ret = mars_task_schedule(&task2_id, &task_args, 0);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
- /* schedule the last one */
- count--;
- ret = mars_task_schedule(
- &task_id[count], &task_args[count], 0);
+ 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 wait task will exit */
+ mars_test_counter_wait(&counter, 2);
+ mars_test_counter_add(&counter, 1);
+
ret = mars_task_wait(&task1_id, &exit_code);
MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
MARS_TEST_ASSERT_ERROR(exit_code, MARS_SUCCESS);
@@ -103,15 +160,10 @@ int main(void)
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(&task2_id);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
- ret = mars_task_destroy(&task_id[count]);
- MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
- }
- ret = mars_task_barrier_destroy(barrier[i]);
+ ret = mars_task_barrier_destroy(barrier);
MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
}
diff --git a/tests/TFP/TFP_24_002/mpu1.c b/tests/TFP/TFP_24_002/mpu1.c
index 4dee4c7..dac0713 100644
--- a/tests/TFP/TFP_24_002/mpu1.c
+++ b/tests/TFP/TFP_24_002/mpu1.c
@@ -23,25 +23,21 @@
#include <mars/task.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];
+ uint64_t barrier_ea = task_args->type.u64[1];
+ uint64_t counter_ea = task_args->type.u64[2];
+
+ mars_test_counter_add(counter_ea, 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();
+ mars_test_counter_add(counter_ea, 1);
+
+ mars_test_counter_wait(counter_ea, 3);
return 0;
}
diff --git a/tests/TFP/TFP_24_002/mpu2.c b/tests/TFP/TFP_24_002/mpu2.c
index 04a423a..03d926e 100644
--- a/tests/TFP/TFP_24_002/mpu2.c
+++ b/tests/TFP/TFP_24_002/mpu2.c
@@ -27,10 +27,13 @@
int mars_task_main(const struct mars_task_args *task_args)
{
int ret;
- uint64_t barrier_ea = task_args->type.u64[0];
+ uint32_t count = task_args->type.u32[0];
+ uint64_t barrier_ea = task_args->type.u64[1];
- ret = mars_task_barrier_notify(barrier_ea);
- MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+ for (; count; count--) {
+ ret = mars_task_barrier_notify(barrier_ea);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+ }
return 0;
}
diff --git a/tests/TFP/TFP_24_002/mpu3.c b/tests/TFP/TFP_24_002/mpu3.c
new file mode 100644
index 0000000..760364c
--- /dev/null
+++ b/tests/TFP/TFP_24_002/mpu3.c
@@ -0,0 +1,36 @@
+/*
+ * Copyright 2009 Sony Corporation
+ *
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a copy
+ * of this software and associated documentation files (the "Software"), to deal
+ * in the Software without restriction, including without limitation the rights
+ * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+ * copies of the Software, and to permit persons to whom the Software is
+ * furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included in
+ * all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+ * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, 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.h>
+#include <mars_task_test.h>
+
+int mars_task_main(const struct mars_task_args *task_args)
+{
+ uint64_t counter_ea = task_args->type.u64[0];
+ uint64_t notify_ea = task_args->type.u64[1];
+
+ mars_test_counter_add(counter_ea, 1);
+ mars_test_counter_wait(notify_ea, 1);
+
+ return 0;
+}
diff --git a/tests/TFP/TFP_24_003/Makefile b/tests/TFP/TFP_24_003/Makefile
index ecbce33..432135a 100644
--- a/tests/TFP/TFP_24_003/Makefile
+++ b/tests/TFP/TFP_24_003/Makefile
@@ -22,7 +22,7 @@
#
top_srcdir = ../..
-test_objs = host.o mpu1.task_eo mpu2.task_eo
+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_24_003/common.h b/tests/TFP/TFP_24_003/common.h
new file mode 100644
index 0000000..021838f
--- /dev/null
+++ b/tests/TFP/TFP_24_003/common.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 MAGIC_UINT32 0x789abcde
diff --git a/tests/TFP/TFP_24_003/host.c b/tests/TFP/TFP_24_003/host.c
index 4f6d181..8e0e4b0 100644
--- a/tests/TFP/TFP_24_003/host.c
+++ b/tests/TFP/TFP_24_003/host.c
@@ -25,102 +25,129 @@
#include <mars/task.h>
#include <libspe2.h>
#include <mars_test.h>
+#include "common.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
+enum {
+ WAITER_TASK,
+ NOTIFIER_TASK,
+ 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)));
+extern spe_program_handle_t mpu_prog;
+static struct mars_task_id task_id[TASKS];
+static struct mars_task_args task_args;
+
+static uint32_t barrier_notify_num[] = {
+ MARS_TASK_BARRIER_WAIT_MAX,
+ MARS_TASK_BARRIER_WAIT_MAX / 2,
+ 1,
+};
+
+static uint64_t barrier;
+
+static uint32_t counter __attribute((aligned(16)));
+
+#define ARRYSIZE(a) (sizeof(a)/sizeof(a[0]))
int main(void)
{
- int ret, i, count;
+ int ret, i;
int32_t exit_code;
+ /*
+ * Create context
+ */
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;
-
+ for (i = 0; i < ARRYSIZE(barrier_notify_num); i++) {
+ /*
+ * (Re-)create barrier
+ */
ret = mars_task_barrier_create(mars_ctx,
- &barrier[i], chk_num[i]);
+ &barrier,
+ barrier_notify_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_SIZE_MAX);
- 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_SIZE_MAX);
+ /*
+ * (Re-)Create a task that will notify (N-1) times
+ * and wait.
+ */
+ mars_test_counter_set(&counter, 0);
+
+ ret = mars_task_create(mars_ctx,
+ &task_id[WAITER_TASK],
+ NULL,
+ mpu_prog.elf_image,
+ MARS_TASK_CONTEXT_SAVE_SIZE_MAX);
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);
+ /*
+ * Run the task
+ */
+ task_args.type.u32[0] = barrier_notify_num[i] - 1;
+ task_args.type.u32[1] = 1; /* call wait() */
+ task_args.type.u64[1] = barrier;
+ task_args.type.u64[2] = mars_ptr_to_ea(&counter);
+
+ ret = mars_task_schedule(&task_id[WAITER_TASK],
+ &task_args, 0);
- 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);
+
+ /*
+ * See if the task has called notify() (N-1) times
+ * if something goes wrong, the following will not
+ * be satisfied forever, then the framework will detect
+ * it as a timeout
+ */
+ mars_test_counter_wait(&counter, barrier_notify_num[i] - 1);
+
+ /*
+ * (Re-)create a task that will notify just ONCE
+ */
+ ret = mars_task_create(mars_ctx,
+ &task_id[NOTIFIER_TASK],
+ "notifier",
+ mpu_prog.elf_image,
+ MARS_TASK_CONTEXT_SAVE_SIZE_MAX);
MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
- ret = mars_task_wait(&task2_id, &exit_code);
+ /*
+ * Run it
+ */
+ task_args.type.u32[0] = 1; /* call notify() once */
+ task_args.type.u32[1] = 0; /* do not call wait() */
+
+ ret = mars_task_schedule(&task_id[NOTIFIER_TASK],
+ &task_args, 0);
+
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);
+ /*
+ * Then the two tasks should be going to exit.
+ * If something goes wrong, the following will not
+ * be satisfied forever, then the framework will detect
+ * it as a timeout.
+ */
+ ret = mars_task_wait(&task_id[WAITER_TASK], &exit_code);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+ MARS_TEST_ASSERT_ERROR(exit_code, MAGIC_UINT32);
- ret = mars_task_destroy(&task1_id[count]);
- MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
- }
+ ret = mars_task_wait(&task_id[NOTIFIER_TASK], &exit_code);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+ MARS_TEST_ASSERT_ERROR(exit_code, MAGIC_UINT32);
- ret = mars_task_destroy(&task2_id);
+ /*
+ * Cleanup for the next iteration
+ */
+ ret = mars_task_destroy(&task_id[WAITER_TASK]);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+ ret = mars_task_destroy(&task_id[NOTIFIER_TASK]);
MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
- ret = mars_task_barrier_destroy(barrier[i]);
+ ret = mars_task_barrier_destroy(barrier);
MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
}
diff --git a/tests/TFP/TFP_24_003/mpu.c b/tests/TFP/TFP_24_003/mpu.c
new file mode 100644
index 0000000..9e7cb2e
--- /dev/null
+++ b/tests/TFP/TFP_24_003/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/task.h>
+#include <mars_task_test.h>
+#include "common.h"
+
+int mars_task_main(const struct mars_task_args *task_args)
+{
+ int i, ret;
+ uint32_t notify_num = task_args->type.u32[0];
+ uint32_t wait = task_args->type.u32[1];
+ uint64_t barrier_ea = task_args->type.u64[1];
+ uint64_t counter_ea = task_args->type.u64[2];
+
+ /*
+ * Notify in requested times.
+ * waiter: N - 1 times
+ * notifier: 1 time
+ */
+ for (i = 0; i < notify_num; i++) {
+ ret = mars_task_barrier_notify(barrier_ea);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+
+ mars_test_counter_add(counter_ea, 1);
+ }
+
+ /*
+ * If we are the waiter, we will block in mars_task_barrier_wait()
+ * until the notifier calls the last notify.
+ */
+ if (wait) {
+ ret = mars_task_barrier_wait(barrier_ea);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+ }
+
+ return MAGIC_UINT32;
+}
diff --git a/tests/TFP/TFP_25_002/common.h b/tests/TFP/TFP_25_002/common.h
new file mode 100644
index 0000000..021838f
--- /dev/null
+++ b/tests/TFP/TFP_25_002/common.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 MAGIC_UINT32 0x789abcde
diff --git a/tests/TFP/TFP_25_002/host.c b/tests/TFP/TFP_25_002/host.c
index cd4e227..1576b38 100644
--- a/tests/TFP/TFP_25_002/host.c
+++ b/tests/TFP/TFP_25_002/host.c
@@ -25,79 +25,126 @@
#include <mars/task.h>
#include <libspe2.h>
#include <mars_test.h>
+#include "common.h"
-#define NUM_TASKS MARS_TASK_BARRIER_WAIT_MAX
-
-extern spe_program_handle_t mpu_prog;
+enum {
+ NOTIFY_TASK,
+ TRY_TASK,
+ TASKS
+};
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)));
+extern spe_program_handle_t mpu_prog;
+static struct mars_task_id task_id[TASKS];
+static struct mars_task_args task_args;
-#define CHK_NUM 5
-static uint32_t chk_num[] = {
+static uint32_t barrier_notify_num[] = {
+ MARS_TASK_BARRIER_WAIT_MAX,
+ MARS_TASK_BARRIER_WAIT_MAX / 2,
1,
- NUM_TASKS / 2,
- NUM_TASKS,
- NUM_TASKS,
- NUM_TASKS
};
+static uint64_t barrier;
+
+static uint32_t counter __attribute((aligned(16)));
+
+#define ARRYSIZE(a) (sizeof(a)/sizeof(a[0]))
+
int main(void)
{
- int ret, i, count, num_success;
+ int ret, i;
int32_t exit_code;
+ /*
+ * Create context
+ */
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;
-
+ for (i = 0; i < ARRYSIZE(barrier_notify_num); i++) {
+ /*
+ * (Re-)create barrier
+ */
ret = mars_task_barrier_create(mars_ctx,
- &barrier[i], chk_num[i]);
+ &barrier,
+ barrier_notify_num[i]);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+
+ /*
+ * (Re-)Create a task that will notify N times
+ */
+ mars_test_counter_set(&counter, 0);
+
+ ret = mars_task_create(mars_ctx,
+ &task_id[NOTIFY_TASK],
+ NULL,
+ mpu_prog.elf_image,
+ MARS_TASK_CONTEXT_SAVE_SIZE_MAX);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+
+ /*
+ * Run the task
+ */
+ task_args.type.u32[0] = barrier_notify_num[i];
+ task_args.type.u64[1] = barrier;
+ task_args.type.u64[2] = mars_ptr_to_ea(&counter);
+
+ ret = mars_task_schedule(&task_id[NOTIFY_TASK],
+ &task_args, 0);
+
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+
+ /*
+ * See if the task has called notify() N times
+ * if something goes wrong, the following will not
+ * be satisfied forever, then the framework will detect
+ * it as a timeout
+ */
+ mars_test_counter_wait(&counter, barrier_notify_num[i]);
+
+ /*
+ * (Re-)create a task that will try_notify just ONCE
+ */
+ ret = mars_task_create(mars_ctx,
+ &task_id[TRY_TASK],
+ NULL,
+ mpu_prog.elf_image,
+ MARS_TASK_CONTEXT_SAVE_SIZE_MAX);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+
+ /*
+ * Run it
+ */
+ task_args.type.u32[0] = 0; /* do not call notify() */
+
+ ret = mars_task_schedule(&task_id[TRY_TASK],
+ &task_args, 0);
+
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+
+ /*
+ * Then the two tasks should be going to exit.
+ * If something goes wrong, the following will not
+ * be satisfied forever, then the framework will detect
+ * it as a timeout.
+ */
+ ret = mars_task_wait(&task_id[NOTIFY_TASK], &exit_code);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+ MARS_TEST_ASSERT_ERROR(exit_code, MAGIC_UINT32);
+
+ ret = mars_task_wait(&task_id[TRY_TASK], &exit_code);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+ MARS_TEST_ASSERT_ERROR(exit_code, MAGIC_UINT32);
+
+ /*
+ * Cleanup for the next iteration
+ */
+ ret = mars_task_destroy(&task_id[NOTIFY_TASK]);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+ ret = mars_task_destroy(&task_id[TRY_TASK]);
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_SIZE_MAX);
- 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]);
+ ret = mars_task_barrier_destroy(barrier);
MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
}
diff --git a/tests/TFP/TFP_25_002/mpu.c b/tests/TFP/TFP_25_002/mpu.c
index 11fa60a..318d941 100644
--- a/tests/TFP/TFP_25_002/mpu.c
+++ b/tests/TFP/TFP_25_002/mpu.c
@@ -23,18 +23,33 @@
#include <mars/task.h>
#include <mars_task_test.h>
-#include <spu_mfcio.h>
+#include "common.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];
+ int i, ret;
+ uint32_t notify_num = task_args->type.u32[0];
+ uint64_t barrier_ea = task_args->type.u64[1];
+ uint64_t counter_ea = task_args->type.u64[2];
- mars_test_counter_wait(notify_ea, 1);
+ /*
+ * Notify in requested times.
+ */
+ for (i = 0; i < notify_num; i++) {
+ ret = mars_task_barrier_notify(barrier_ea);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
- ret = mars_task_barrier_try_notify(barrier_ea);
- mars_task_exit(ret);
+ mars_test_counter_add(counter_ea, 1);
+ }
- return 0;
+ /*
+ * Try notify if we didn't notify() above.
+ * It should be going to fail with MARS_ERROR_BUSY
+ */
+ if (!notify_num) {
+ ret = mars_task_barrier_try_notify(barrier_ea);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_ERROR_BUSY);
+ }
+
+ return MAGIC_UINT32;
}
diff --git a/tests/TFP/TFP_26_002/common.h b/tests/TFP/TFP_26_002/common.h
new file mode 100644
index 0000000..ca39152
--- /dev/null
+++ b/tests/TFP/TFP_26_002/common.h
@@ -0,0 +1,24 @@
+/*
+ * Copyright 2009 Sony Corporation
+ *
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a copy
+ * of this software and associated documentation files (the "Software"), to deal
+ * in the Software without restriction, including without limitation the rights
+ * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+ * copies of the Software, and to permit persons to whom the Software is
+ * furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included in
+ * all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+ * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ * LIABILITY, WHETHER IN AN ACTION 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 0x789abcde
diff --git a/tests/TFP/TFP_26_002/host.c b/tests/TFP/TFP_26_002/host.c
index 9485f10..6895d0f 100644
--- a/tests/TFP/TFP_26_002/host.c
+++ b/tests/TFP/TFP_26_002/host.c
@@ -25,83 +25,106 @@
#include <mars/task.h>
#include <libspe2.h>
#include <mars_test.h>
-
-#define NUM_TASKS MARS_TASK_BARRIER_WAIT_MAX
+#include "common.h"
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)));
+static struct mars_task_id task1_id, task2_id;
+static struct mars_task_args task_args;
+static uint64_t barrier;
+
+static uint32_t counter __attribute((aligned(16)));
+static uint32_t notify __attribute((aligned(16)));
-#define CHK_NUM 3
-static uint32_t chk_num[] = {
+static uint32_t barrier_wait_num[] = {
+ MARS_TASK_BARRIER_WAIT_MAX,
+ MARS_TASK_BARRIER_WAIT_MAX / 2,
1,
- NUM_TASKS / 2,
- NUM_TASKS,
};
+#define ARRYSIZE(a) (sizeof(a)/sizeof(a[0]))
+
int main(void)
{
- int ret, i, count;
+ 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 < CHK_NUM; i++) {
- shared_resource = 0;
+ for (i = 0; i < ARRYSIZE(barrier_wait_num); i++) {
+
+ mars_test_counter_set(&counter, 0);
+ mars_test_counter_set(&notify, 0);
+ /*
+ * Create a barrier with specified count of waiter
+ */
ret = mars_task_barrier_create(mars_ctx,
- &barrier[i], chk_num[i]);
- MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+ &barrier,
+ barrier_wait_num[i]);
- /* create wait task */
- ret = mars_task_create(mars_ctx, &task1_id, NULL,
- mpu1_prog.elf_image, MARS_TASK_CONTEXT_SAVE_SIZE_MAX);
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);
+ /*
+ * Create a waiter task
+ */
+ ret = mars_task_create(mars_ctx,
+ &task1_id,
+ NULL,
+ mpu1_prog.elf_image,
+ MARS_TASK_CONTEXT_SAVE_SIZE_MAX);
MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
- sleep(1);
- /* check if barrier_try_wait is still BUSY */
- MARS_TEST_ASSERT_EQUAL(shared_resource, 0);
+ task_args.type.u32[0] = barrier_wait_num[i];
+ task_args.type.u64[1] = barrier;
+ task_args.type.u64[2] = mars_ptr_to_ea(&notify);
+ task_args.type.u64[3] = mars_ptr_to_ea(&counter);
- /* 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_SIZE_MAX);
- MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+ /*
+ * Start the task
+ */
+ ret = mars_task_schedule(&task1_id, &task_args, 0);
+ 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 a notiy task
+ */
+ ret = mars_task_create(mars_ctx,
+ &task2_id,
+ NULL,
+ mpu2_prog.elf_image,
+ MARS_TASK_CONTEXT_SAVE_SIZE_MAX);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+ /*
+ * Start the task
+ */
+ ret = mars_task_schedule(&task2_id, &task_args, 0);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+
+ /*
+ * Wait for the completion of the tasks
+ */
ret = mars_task_wait(&task1_id, &exit_code);
MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
- MARS_TEST_ASSERT_ERROR(exit_code, MARS_SUCCESS);
+ MARS_TEST_ASSERT_ERROR(exit_code, MAGIC_INT32);
- ret = mars_task_destroy(&task1_id);
+ ret = mars_task_wait(&task2_id, &exit_code);
MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+ MARS_TEST_ASSERT_ERROR(exit_code, MAGIC_INT32);
- 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);
+ /*
+ * Cleanup for the next iteration
+ */
+ 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_destroy(&task_id[count]);
- MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
- }
- ret = mars_task_barrier_destroy(barrier[i]);
+ ret = mars_task_barrier_destroy(barrier);
MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
}
diff --git a/tests/TFP/TFP_26_002/mpu1.c b/tests/TFP/TFP_26_002/mpu1.c
index 55a1cce..41257eb 100644
--- a/tests/TFP/TFP_26_002/mpu1.c
+++ b/tests/TFP/TFP_26_002/mpu1.c
@@ -23,33 +23,53 @@
#include <mars/task.h>
#include <mars_task_test.h>
-#include <spu_mfcio.h>
-
-
-static uint32_t shared_resource __attribute((aligned(16)));
+#include "common.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 shared_resource_ea = task_args->type.u64[1];
+ uint32_t iteration = task_args->type.u32[0];
+ uint64_t barrier_ea = task_args->type.u64[1];
+ uint64_t notify_ea = task_args->type.u64[2];
+ uint64_t counter_ea = task_args->type.u64[3];
+
+ /*
+ * Tell we've started
+ */
+ mars_test_counter_add(counter_ea, 1);
+ /*
+ * Wait for the peer's ready
+ */
+ mars_test_counter_wait(counter_ea, 2);
+
+ /*
+ * do try_wait() repeatedly until the condition satisfied
+ */
while (1) {
ret = mars_task_barrier_try_wait(barrier_ea);
- if (ret == MARS_SUCCESS)
+
+ switch (ret) {
+ case MARS_ERROR_BUSY:
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();
+ case MARS_SUCCESS:
+ /*
+ * See if the condition is really met
+ */
+ MARS_TEST_ASSERT_EQUAL_INT(mars_test_counter_get(notify_ea),
+ iteration);
+ goto done;
+ break;
- return 0;
+ default:
+ /*
+ * should not occured
+ */
+ MARS_TEST_ASSERT_ERROR(ret, 0);
+ break;
+ }
+ }
+done:
+ return MAGIC_INT32;
}
diff --git a/tests/TFP/TFP_26_002/mpu2.c b/tests/TFP/TFP_26_002/mpu2.c
index 04a423a..e54c68c 100644
--- a/tests/TFP/TFP_26_002/mpu2.c
+++ b/tests/TFP/TFP_26_002/mpu2.c
@@ -23,14 +23,30 @@
#include <mars/task.h>
#include <mars_task_test.h>
+#include "common.h"
int mars_task_main(const struct mars_task_args *task_args)
{
- int ret;
- uint64_t barrier_ea = task_args->type.u64[0];
+ int ret, i;
+ uint32_t iteration = task_args->type.u32[0];
+ uint64_t barrier_ea = task_args->type.u64[1];
+ uint64_t notify_ea = task_args->type.u64[2];
+ uint64_t counter_ea = task_args->type.u64[3];
- ret = mars_task_barrier_notify(barrier_ea);
- MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+ /*
+ * Tell we've started
+ */
+ mars_test_counter_add(counter_ea, 1);
- return 0;
+ /*
+ * Call notify in the specified times
+ */
+ for (i = 0; i < iteration; i++) {
+ mars_test_counter_add(notify_ea, 1);
+
+ ret = mars_task_barrier_notify(barrier_ea);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+ }
+
+ return MAGIC_INT32;
}
diff --git a/tests/TFP/TFP_33_001/host.c b/tests/TFP/TFP_33_001/host.c
index ed77d95..7061e27 100644
--- a/tests/TFP/TFP_33_001/host.c
+++ b/tests/TFP/TFP_33_001/host.c
@@ -53,7 +53,6 @@ int main(void)
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++) {
diff --git a/tests/TFP/TFP_33_003/host.c b/tests/TFP/TFP_33_003/host.c
index 8eac25b..dd14224 100644
--- a/tests/TFP/TFP_33_003/host.c
+++ b/tests/TFP/TFP_33_003/host.c
@@ -69,7 +69,6 @@ int main(void)
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++) {
diff --git a/tests/TFP/TFP_33_005/host.c b/tests/TFP/TFP_33_005/host.c
index c2b071a..33775f5 100644
--- a/tests/TFP/TFP_33_005/host.c
+++ b/tests/TFP/TFP_33_005/host.c
@@ -22,200 +22,154 @@
*/
#include <unistd.h>
+#include <pthread.h>
#include <mars/task.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[] = {
+
+static uint32_t patterns[] = {
0x00000001UL,
- 0x0000CAFEUL,
0x10203040UL,
0x5A5A5A5AUL,
0xFFFFFFFFUL
};
+
+#define ARRYSIZE(a) (sizeof(a)/sizeof(a[0]))
+#define MAX_THREADS (sizeof(uint32_t) * 8)
+
+struct thread_arg {
+ uint32_t clear_pattern;
+};
+
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 struct mars_task_id task_id;
+static pthread_t thread_id[MAX_THREADS];
+static struct mars_task_args task_args;
+static struct thread_arg thread_arg[MAX_THREADS];
+static uint64_t event_flag;
+static pthread_barrier_t pthread_barrier;
-static void check_flag(uint32_t id, uint32_t pat)
+
+void * clear_thread(void * v)
{
- 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;
- }
-}
+ struct thread_arg *arg = v;
+ int ret;
+
+ /*
+ * Try to clear the event flag simultaenously with other threads
+ * As the last waited thread will get PTHREAD_SERIAL_THREAD,
+ * we can not test with MARS_TEST_ASSERT_EQUAL_INT(ret, 0)
+ */
+ pthread_barrier_wait(&pthread_barrier);
+
+ /*
+ * Clear the specified bit
+ */
+ ret = mars_task_event_flag_clear(event_flag, arg->clear_pattern);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+
+ return NULL;
+};
int main(void)
{
- int ret, i, bits;
+ int ret, i, j;
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;
+ /*
+ * Try the test with many patterns
+ */
+ for (i = 0; i < ARRYSIZE(patterns); i++) {
+ int bits;
+ uint32_t returned_pattern;
+ /*
+ * Create an event flag with the mode of 'MPU_to_HOST'
+ */
ret = mars_task_event_flag_create(
mars_ctx,
- &mpu_to_host[i],
+ &event_flag,
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_SIZE_MAX);
- 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_SIZE_MAX);
- 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);
+ /*
+ * Set the event flag with the specified pattern,
+ * that is, set the event flag asserted.
+ */
+ ret = mars_task_create(mars_ctx, &task_id, NULL,
+ mpu_prog.elf_image,
+ MARS_TASK_CONTEXT_SAVE_SIZE_MAX);
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_SIZE_MAX);
- MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+ task_args.type.u32[0] = patterns[i];
+ task_args.type.u64[1] = event_flag;
- 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);
+ ret = mars_task_schedule(&task_id, &task_args, 0);
MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
- ret = mars_task_wait(&task1_id, &exit_code);
+ 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(&task1_id);
+ ret = mars_task_destroy(&task_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_SIZE_MAX);
- 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);
+ /*
+ * Counts the asserted bits and clearing bitmasks
+ */
+ bits = 0;
+ for (j = 0; j < MAX_THREADS; j++) {
+ if (patterns[i] & (1 << j)) {
+ thread_arg[bits].clear_pattern = 1 << j;
+ bits++;
+ }
}
-
- 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);
+ /*
+ * Create pthread barriers to synchronize pthreads
+ */
+ ret = pthread_barrier_init(&pthread_barrier, NULL, bits);
+ MARS_TEST_ASSERT_ERROR(ret, 0);
+
+ /*
+ * Create pthreads.
+ * They will clear the event flag each with the specified bit.
+ */
+ for (j = 0; j < bits; j++) {
+ ret = pthread_create(&thread_id[j], NULL, clear_thread,
+ &thread_arg[j]);
+ MARS_TEST_ASSERT_EQUAL_INT(ret, 0);
}
-
- /* 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);
+ /*
+ * Wait for the completion of the pthreads
+ */
+ for (j = 0; j < bits; j++) {
+ void * value_ptr;
+ ret = pthread_join(thread_id[j], &value_ptr);
+ MARS_TEST_ASSERT_EQUAL_INT(ret, 0);
}
- ret = mars_task_event_flag_destroy(mpu_to_host[i]);
+
+ /*
+ * Now the event flag should be reverted to unasserted,
+ * thus the condition is never met. Test it.
+ */
+ ret = mars_task_event_flag_try_wait(event_flag,
+ patterns[i],
+ MARS_TASK_EVENT_FLAG_MASK_OR,
+ &returned_pattern);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_ERROR_BUSY);
+
+ /*
+ * Cleanup for the next iternation
+ */
+ ret = pthread_barrier_destroy(&pthread_barrier);
+ MARS_TEST_ASSERT_EQUAL_INT(ret, 0);
+
+ ret = mars_task_event_flag_destroy(event_flag);
MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
}
@@ -224,4 +178,3 @@ int main(void)
return 0;
}
-
diff --git a/tests/TFP/TFP_33_005/mpu.c b/tests/TFP/TFP_33_005/mpu.c
index 2a40bda..facdd05 100644
--- a/tests/TFP/TFP_33_005/mpu.c
+++ b/tests/TFP/TFP_33_005/mpu.c
@@ -23,25 +23,14 @@
#include <mars/task.h>
#include <mars_task_test.h>
-#include <spu_mfcio.h>
int mars_task_main(const struct mars_task_args *task_args)
{
+ uint32_t pattern = task_args->type.u32[0];
+ uint64_t flag = task_args->type.u64[1];
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);
+ ret = mars_task_event_flag_set(flag, pattern);
MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
return 0;
diff --git a/tests/TFP/TFP_34_002/host.c b/tests/TFP/TFP_34_002/host.c
index f0d8912..a846a93 100644
--- a/tests/TFP/TFP_34_002/host.c
+++ b/tests/TFP/TFP_34_002/host.c
@@ -135,18 +135,6 @@ int main(void)
}
/* 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);
@@ -163,6 +151,16 @@ int main(void)
MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
}
+ 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++) {
for (j = 0; j < 2; j++) {
ret = mars_task_event_flag_destroy(
diff --git a/tests/TFP/TFP_34_003/host.c b/tests/TFP/TFP_34_003/host.c
index f2810e5..53d4273 100644
--- a/tests/TFP/TFP_34_003/host.c
+++ b/tests/TFP/TFP_34_003/host.c
@@ -130,20 +130,6 @@ int main(void)
}
/* 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);
@@ -160,6 +146,18 @@ int main(void)
MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
}
+ /* 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++) {
for (j = 0; j < 2; j++) {
ret = mars_task_event_flag_destroy(
diff --git a/tests/TFP/TFP_34_004/host.c b/tests/TFP/TFP_34_004/host.c
index a8beb2e..7f8ae13 100644
--- a/tests/TFP/TFP_34_004/host.c
+++ b/tests/TFP/TFP_34_004/host.c
@@ -30,34 +30,39 @@
#define EVENT_FLAG_SIZE 32
extern spe_program_handle_t mpu_prog;
-#define NUM_PATTERNS 5
-static uint32_t pattern[NUM_PATTERNS] = {
+
+static uint32_t patterns[] = {
0x00000001UL,
0x0000CAFEUL,
0x01010101UL,
0x5A5A5A5AUL,
0xFFFFFFFFUL
};
+
+#define NUM_PATTERNS (sizeof(patterns)/sizeof(patterns[0]))
+
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 struct mars_task_args task_args;
+static uint64_t host_to_mpu;
static uint32_t shared_resource __attribute((aligned(16)));
-
+static pthread_barrier_t barrier;
static pthread_t thread[EVENT_FLAG_SIZE];
+struct thread_arg {
+ uint32_t flag_bit;
+};
+
+struct thread_arg thread_args[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];
+ struct thread_arg *args = ptr;
- while (!shared_resource)
- usleep(100);
+ pthread_barrier_wait(&barrier);
- ret = mars_task_event_flag_set(
- host_to_mpu[i], chk_bit);
+ ret = mars_task_event_flag_set(host_to_mpu, args->flag_bit);
MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
return NULL;
@@ -65,8 +70,8 @@ static void *thread_proc(void *ptr)
int main(void)
{
- int ret, i, bits;
- uint32_t chk_bit, pat;
+ int ret, i, bits, j;
+ uint32_t pattern;
int32_t exit_code;
ret = mars_context_create(&mars_ctx, 0, 0);
@@ -76,40 +81,60 @@ int main(void)
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);
+ &host_to_mpu,
+ 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]);
+ /*
+ * Count asserted bits
+ */
+ bits = 0;
+ pattern = patterns[i];
+ while (pattern) {
+ if (pattern & 1)
+ bits++;
+ pattern >>= 1;
+ };
+
+ if (!bits)
+ continue;
+ /*
+ * Create a pthread barrier to synchronize the threads
+ */
+ ret = pthread_barrier_init(&barrier, NULL, bits);
+ MARS_TEST_ASSERT_EQUAL_INT(ret, 0);
+
+ /*
+ * Create pthreads which will set the event flag
+ */
+ for (j = 0; j < EVENT_FLAG_SIZE; j++) {
+ if (patterns[i] & (1 << j)) {
+ thread_args[j].flag_bit = 1 << j;
+
+ pthread_create(&thread[j], NULL, thread_proc,
+ &thread_args[j]);
}
- 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);
+ /*
+ * Wait for the completion of the pthreads
+ */
+ for (j = 0; j < EVENT_FLAG_SIZE; j++) {
+ if (patterns[i] & (1 << j))
+ pthread_join(thread[j], NULL);
}
+ /*
+ * See if the condition will be met
+ */
ret = mars_task_create(mars_ctx, &task_id, NULL,
- mpu_prog.elf_image,
- MARS_TASK_CONTEXT_SAVE_SIZE_MAX);
+ mpu_prog.elf_image,
+ MARS_TASK_CONTEXT_SAVE_SIZE_MAX);
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[1] = host_to_mpu;
+ task_args.type.u32[0] = patterns[i];
ret = mars_task_schedule(&task_id, &task_args, 0);
MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
@@ -121,7 +146,13 @@ int main(void)
ret = mars_task_destroy(&task_id);
MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
- ret = mars_task_event_flag_destroy(host_to_mpu[i]);
+ /*
+ * Cleanup for the next iteration
+ */
+ ret = pthread_barrier_destroy(&barrier);
+ MARS_TEST_ASSERT_EQUAL_INT(ret, 0);
+
+ ret = mars_task_event_flag_destroy(host_to_mpu);
MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
}
diff --git a/tests/TFP/TFP_34_004/mpu.c b/tests/TFP/TFP_34_004/mpu.c
index 35ef5f2..4cc189d 100644
--- a/tests/TFP/TFP_34_004/mpu.c
+++ b/tests/TFP/TFP_34_004/mpu.c
@@ -27,17 +27,17 @@
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 pattern = task_args->type.u32[0];
+ uint64_t host_to_mpu_ea = task_args->type.u64[1];
uint32_t val = 0;
ret = mars_task_event_flag_try_wait(
host_to_mpu_ea,
- chk_bit,
+ pattern,
MARS_TASK_EVENT_FLAG_MASK_OR, &val);
MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
- MARS_TEST_ASSERT_EQUAL(chk_bit, val);
+ MARS_TEST_ASSERT_EQUAL(val, pattern);
return 0;
}
diff --git a/tests/TFP/TFP_34_005/host.c b/tests/TFP/TFP_34_005/host.c
index 1bd47cd..1aa6099 100644
--- a/tests/TFP/TFP_34_005/host.c
+++ b/tests/TFP/TFP_34_005/host.c
@@ -29,90 +29,107 @@
#define EVENT_FLAG_SIZE 32
extern spe_program_handle_t mpu_prog;
-#define NUM_PATTERNS 5
-static uint32_t pattern[NUM_PATTERNS] = {
+
+static uint32_t patterns[] = {
0x00000001UL,
0x0000CAFEUL,
0x01010101UL,
0x5A5A5A5AUL,
- 0xFFFFFFFFUL
};
+#define NUM_PATTERNS (sizeof(patterns)/sizeof(patterns[0]))
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);
-}
+static struct mars_task_args task_args[EVENT_FLAG_SIZE];
+static uint64_t mpu_to_host;
+static uint64_t barrier;
int main(void)
{
- int ret, i, bits;
- uint32_t chk_bit, pat;
+ int ret, i, j, bits;
+ uint32_t pattern, val;
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],
+ &mpu_to_host,
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))
+ /*
+ * Count bits asserted
+ */
+ pattern = patterns[i];
+ bits = 0;
+ while (pattern) {
+ if (pattern & 1)
+ bits ++;
+ pattern >>= 1;
+ }
+
+ if (!bits || (MARS_TASK_BARRIER_WAIT_MAX < bits))
+ continue;
+
+ /*
+ * Create barrier
+ */
+ ret = mars_task_barrier_create(mars_ctx, &barrier, bits);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+
+ /*
+ * Create and run tasks
+ */
+ for (j = 0; j < EVENT_FLAG_SIZE; j++) {
+ if (!(patterns[i] & (1 << j)))
continue;
- ret = mars_task_create(mars_ctx, &task_id[bits], NULL,
- mpu_prog.elf_image,
- MARS_TASK_CONTEXT_SAVE_SIZE_MAX);
- 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);
+ ret = mars_task_create(mars_ctx, &task_id[j], NULL,
+ mpu_prog.elf_image,
+ MARS_TASK_CONTEXT_SAVE_SIZE_MAX);
MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
- }
- sleep(1);
- /* start all tasks */
- mars_test_counter_set(&notify[0], 1);
+ task_args[j].type.u32[0] = 1 << j;
+ task_args[j].type.u64[1] = mpu_to_host;
+ task_args[j].type.u64[2] = barrier;
- pat = pattern[i];
- for (bits = 0; pat; bits++, pat >>= 1) {
- if (!(pat & 0x01))
+ ret = mars_task_schedule(&task_id[j], &task_args[j], 0);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+ }
+ /*
+ * Wait for the completion of the tasks
+ */
+ for (j = 0; j < EVENT_FLAG_SIZE; j++) {
+ if (!(patterns[i] & (1 << j)))
continue;
- ret = mars_task_wait(&task_id[bits], &exit_code);
+
+ ret = mars_task_wait(&task_id[j], &exit_code);
MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
MARS_TEST_ASSERT_ERROR(exit_code, MARS_SUCCESS);
- ret = mars_task_destroy(&task_id[bits]);
+ ret = mars_task_destroy(&task_id[j]);
MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
}
- check_flag(i, pattern[i]);
+ /*
+ * See if the flag is actually set
+ */
+ ret = mars_task_event_flag_try_wait(mpu_to_host,
+ patterns[i],
+ MARS_TASK_EVENT_FLAG_MASK_AND,
+ &val);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+ MARS_TEST_ASSERT_EQUAL(val, patterns[i]);
+ /*
+ * Clean up for the next iteration
+ */
+ ret = mars_task_event_flag_destroy(mpu_to_host);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
- ret = mars_task_event_flag_destroy(mpu_to_host[i]);
+ ret = mars_task_barrier_destroy(barrier);
MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
}
diff --git a/tests/TFP/TFP_34_005/mpu.c b/tests/TFP/TFP_34_005/mpu.c
index 1141eee..88e7b43 100644
--- a/tests/TFP/TFP_34_005/mpu.c
+++ b/tests/TFP/TFP_34_005/mpu.c
@@ -28,13 +28,15 @@
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];
+ uint32_t pattern = task_args->type.u32[0];
+ uint64_t mpu_to_host_ea = task_args->type.u64[1];
+ uint64_t barrier = task_args->type.u64[2];
- mars_test_counter_wait(notify_ea, 1);
+ mars_task_barrier_notify(barrier);
+ mars_task_barrier_wait(barrier);
+
+ ret = mars_task_event_flag_set(mpu_to_host_ea, pattern);
- 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/Makefile b/tests/TFP/TFP_34_007/Makefile
index 72cf999..432135a 100644
--- a/tests/TFP/TFP_34_007/Makefile
+++ b/tests/TFP/TFP_34_007/Makefile
@@ -22,7 +22,7 @@
#
top_srcdir = ../..
-test_objs = host.o mpu1.task_eo mpu2.task_eo mpu3.task_eo
+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_007/host.c b/tests/TFP/TFP_34_007/host.c
index 16cf4f3..aca1439 100644
--- a/tests/TFP/TFP_34_007/host.c
+++ b/tests/TFP/TFP_34_007/host.c
@@ -26,219 +26,124 @@
#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[] = {
+extern spe_program_handle_t mpu_prog;
+
+static uint32_t patterns[] = {
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;
- }
-}
+#define NUM_PATTERNS (sizeof(patterns)/sizeof(patterns[0]))
+#define EVENT_FLAG_SIZE (sizeof(uint32_t) * 8)
+
+static struct mars_context *mars_ctx;
+static struct mars_task_id task_id[EVENT_FLAG_SIZE];
+static struct mars_task_args task_args[EVENT_FLAG_SIZE];
+static uint64_t eventflag;
+static uint32_t counter __attribute__((aligned(128)));
+static uint32_t notify __attribute__((aligned(128)));
int main(void)
{
- int ret, i, bits;
+ int ret, i, bits, num_mpu;
int32_t exit_code;
- uint32_t chk_bit, pat;
+ uint32_t returned_bits;
+
+ num_mpu = spe_cpu_info_get(SPE_COUNT_PHYSICAL_SPES, -1);
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;
-
+ /*
+ * Create eventflag
+ */
ret = mars_task_event_flag_create(
mars_ctx,
- &mpu_to_host[i],
+ &eventflag,
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_SIZE_MAX);
- 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_TASK_EVENT_FLAG_CLEAR_MANUAL);
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_SIZE_MAX);
- 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_SIZE_MAX);
- 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]);
+ /*
+ * Invoke the number of EVENT_FLAG_SIZE tasks
+ * and class them into two categories, setters and resetters,
+ * according to the specified flag patterns.
+ */
for (bits = 0; bits < EVENT_FLAG_SIZE; bits++) {
- ret = mars_task_destroy(&task_id[bits]);
+ ret = mars_task_create(mars_ctx, &task_id[bits],
+ NULL, mpu_prog.elf_image,
+ MARS_TASK_CONTEXT_SAVE_SIZE_MAX);
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_SIZE_MAX);
- 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);
+ if (patterns[i] & (1 << bits))
+ task_args[bits].type.u32[0] = 1; /* set task */
+ else
+ task_args[bits].type.u32[0] = 0; /* clear task */
+ task_args[bits].type.u32[1] = 1 << bits;
+ task_args[bits].type.u64[1] = eventflag;
+ task_args[bits].type.u64[2] = mars_ptr_to_ea(&counter);
+ task_args[bits].type.u64[3] = mars_ptr_to_ea(&notify);
- 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_SIZE_MAX);
- 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_SIZE_MAX);
- 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);
+ ret = mars_task_schedule(&task_id[bits], &task_args[bits], 0);
MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
- pat >>= 1;
- chk_bit <<= 1;
}
+ /*
+ * Trigger the task to do the job
+ * As there are less usable SPUS than
+ * EVENT_FLAG_SIZE in usual systems, treat that case
+ */
+ if (num_mpu < EVENT_FLAG_SIZE)
+ mars_test_counter_wait(&counter, num_mpu);
+ else
+ mars_test_counter_wait(&counter, EVENT_FLAG_SIZE);
+ mars_test_counter_set(&notify, 1);
- sleep(1);
- /* start mpu tasks at the same time */
- mars_test_counter_set(&notify[0], 1);
-
+ /*
+ * Wait for the completion of set/clear tasks
+ */
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]);
+ /*
+ * See if the event flag is actually set as desired.
+ * First, check asserte bits with AND operation
+ * Second, deasserted bits witn OR operation with nagated mask
+ */
+ ret = mars_task_event_flag_try_wait(eventflag,
+ patterns[i],
+ MARS_TASK_EVENT_FLAG_MASK_AND,
+ &returned_bits);
+ /* the condition should be satisfied */
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+
+ ret = mars_task_event_flag_try_wait(eventflag,
+ ~patterns[i],
+ MARS_TASK_EVENT_FLAG_MASK_OR,
+ &returned_bits);
+ /* the condition should _NOT_ be satisfied */
+ MARS_TEST_ASSERT_ERROR(ret, MARS_ERROR_BUSY);
+ /*
+ * Cleanup for the next iteration
+ */
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]);
+
+ ret = mars_task_event_flag_destroy(eventflag);
MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
- }
+ mars_test_counter_set(&counter, 0);
+ mars_test_counter_set(&notify, 0);
+ }
ret = mars_context_destroy(mars_ctx);
MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
diff --git a/tests/TFP/TFP_34_007/mpu.c b/tests/TFP/TFP_34_007/mpu.c
new file mode 100644
index 0000000..51e8a45
--- /dev/null
+++ b/tests/TFP/TFP_34_007/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/task.h>
+#include <mars_task_test.h>
+#include <spu_mfcio.h>
+
+int mars_task_main(const struct mars_task_args *task_args)
+{
+ int ret;
+ uint32_t role = task_args->type.u32[0];
+ uint32_t pattern = task_args->type.u32[1];
+ uint64_t eventflag = task_args->type.u64[1];
+ uint64_t counter_ea = task_args->type.u64[2];
+ uint64_t notify_ea = task_args->type.u64[3];
+
+ /*
+ * Sync with other tasks as much as possible
+ */
+ mars_test_counter_add(counter_ea, 1);
+ mars_test_counter_wait(notify_ea, 1);
+
+ if (role) {
+ ret = mars_task_event_flag_set(eventflag, pattern);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+ } else {
+ ret = mars_task_event_flag_clear(eventflag, pattern);
+ 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
index 432135a..ecbce33 100644
--- a/tests/TFP/TFP_35_001/Makefile
+++ b/tests/TFP/TFP_35_001/Makefile
@@ -22,7 +22,7 @@
#
top_srcdir = ../..
-test_objs = host.o mpu.task_eo
+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_001/common.h b/tests/TFP/TFP_35_001/common.h
new file mode 100644
index 0000000..ca39152
--- /dev/null
+++ b/tests/TFP/TFP_35_001/common.h
@@ -0,0 +1,24 @@
+/*
+ * Copyright 2009 Sony Corporation
+ *
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a copy
+ * of this software and associated documentation files (the "Software"), to deal
+ * in the Software without restriction, including without limitation the rights
+ * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+ * copies of the Software, and to permit persons to whom the Software is
+ * furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included in
+ * all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+ * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ * LIABILITY, WHETHER IN AN ACTION 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 0x789abcde
diff --git a/tests/TFP/TFP_35_001/host.c b/tests/TFP/TFP_35_001/host.c
index a739d3e..01c3728 100644
--- a/tests/TFP/TFP_35_001/host.c
+++ b/tests/TFP/TFP_35_001/host.c
@@ -25,73 +25,139 @@
#include <mars/task.h>
#include <libspe2.h>
#include <mars_test.h>
+#include "common.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 }
+extern spe_program_handle_t mpu1_prog;
+extern spe_program_handle_t mpu2_prog;
+
+static uint32_t patterns[] = {
+ 0x00000001,
+ 0xDEADBEEF,
+ 0xFFFFFFFF,
};
+
+#define NUM_PATTERNS (sizeof(patterns) / sizeof(patterns[0]))
+#define EVENT_FLAG_LENGTH (sizeof(uint32_t) * 8)
+
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)));
+static struct mars_task_id task1_id, task2_id;
+static struct mars_task_args task1_args;
+static uint64_t eventflag;
+static uint32_t counter __attribute__((aligned(128)));
int main(void)
{
- int ret, i, bits;
- uint32_t chk_bit;
+ int ret, i, j, bits;
int32_t exit_code;
- ret = mars_context_create(&mars_ctx, 0, 0);
+ /*
+ * Create mars context which uses just _ONE_ mpu
+ */
+ ret = mars_context_create(&mars_ctx, 1, 0);
MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
for (i = 0; i < NUM_PATTERNS; i++) {
- shared_resource = 0;
+ /*
+ * Create an event flag
+ */
ret = mars_task_event_flag_create(
mars_ctx,
- &host_to_mpu[i],
+ &eventflag,
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_SIZE_MAX);
+ /*
+ * Invoke a task which will wait for the specified pattern
+ * with AND operation
+ */
+ ret = mars_task_create(mars_ctx, &task1_id, NULL,
+ mpu1_prog.elf_image,
+ MARS_TASK_CONTEXT_SAVE_SIZE_MAX);
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);
+ task1_args.type.u32[0] = patterns[i];
+ task1_args.type.u64[1] = eventflag;
+ task1_args.type.u64[2] = mars_ptr_to_ea(&counter);
+
+ 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] - 1; bits++) {
- ret = mars_task_event_flag_set(
- host_to_mpu[i], chk_bit);
- MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
- chk_bit <<= 1;
+ /*
+ * Wait for the schedule of the task
+ */
+ mars_test_counter_wait(&counter, 1);
+
+ /*
+ * Set one bit of the event flag each
+ * and see if the task is still in waiting state
+ * by invoking another task.
+ */
+ bits = 0;
+ for (j = 0; j < EVENT_FLAG_LENGTH; j++) {
+ if (patterns[i] & (1 << j))
+ bits ++;
+ }
+ if (!bits)
+ continue;
+
+ for (j = 0; j < EVENT_FLAG_LENGTH; j++) {
+ if (patterns[i] & (1 << j)) {
+ /*
+ * Set the bit of the flag
+ */
+ ret = mars_task_event_flag_set(eventflag,
+ 1 << j);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+
+ if (--bits) {
+ /*
+ * If the task which has called wait() is in
+ * waiting state, the new task will be scheduled
+ * soon and exit.
+ */
+ ret = mars_task_create(mars_ctx, &task2_id, NULL,
+ mpu2_prog.elf_image,
+ MARS_TASK_CONTEXT_SAVE_SIZE_MAX);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+
+ ret = mars_task_schedule(&task2_id, NULL, 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, MAGIC_INT32);
+ /*
+ * See if the counter is still 1
+ */
+ MARS_TEST_ASSERT_EQUAL_INT(mars_test_counter_get(&counter),
+ 1);
+
+ ret = mars_task_destroy(&task2_id);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+ } else {
+ /*
+ * last bit set, so the task should be
+ * unblocked and increment the counter
+ * and exit.
+ */
+ ret = mars_task_wait(&task1_id, &exit_code);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+ MARS_TEST_ASSERT_ERROR(exit_code, MAGIC_INT32);
+ MARS_TEST_ASSERT_EQUAL_INT(mars_test_counter_get(&counter),
+ 2);
+ break;
+ }
+ }
}
- 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);
+ ret = mars_task_destroy(&task1_id);
MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
- MARS_TEST_ASSERT_ERROR(exit_code, MARS_SUCCESS);
- ret = mars_task_destroy(&task_id);
+ ret = mars_task_event_flag_destroy(eventflag);
MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
- ret = mars_task_event_flag_destroy(host_to_mpu[i]);
- MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+ mars_test_counter_set(&counter, 0);
}
diff --git a/tests/TFP/TFP_35_007/mpu2.c b/tests/TFP/TFP_35_001/mpu1.c
index 911cccb..cdfa0f4 100644
--- a/tests/TFP/TFP_35_007/mpu2.c
+++ b/tests/TFP/TFP_35_001/mpu1.c
@@ -23,24 +23,25 @@
#include <mars/task.h>
#include <mars_task_test.h>
-#include <spu_mfcio.h>
+#include "common.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];
+ uint32_t pattern = task_args->type.u32[0];
+ uint64_t eventflag = task_args->type.u64[1];
+ uint64_t counter_ea = task_args->type.u64[2];
- mars_test_counter_wait(notify_ea, 1);
+
+ mars_test_counter_add(counter_ea, 1);
ret = mars_task_event_flag_wait(
- host_to_mpu_ea,
- chk_bit,
- MARS_TASK_EVENT_FLAG_MASK_OR, NULL);
+ eventflag,
+ pattern,
+ MARS_TASK_EVENT_FLAG_MASK_AND, NULL);
MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
- mars_test_counter_set(notify_ea, 2);
+ mars_test_counter_add(counter_ea, 1);
- return 0;
+ return MAGIC_INT32;
}
diff --git a/tests/TFP/TFP_35_001/mpu2.c b/tests/TFP/TFP_35_001/mpu2.c
new file mode 100644
index 0000000..9d0ad25
--- /dev/null
+++ b/tests/TFP/TFP_35_001/mpu2.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/task.h>
+#include <mars_task_test.h>
+#include "common.h"
+
+int mars_task_main(const struct mars_task_args *task_args)
+{
+ return MAGIC_INT32;
+}
diff --git a/tests/TFP/TFP_35_004/host.c b/tests/TFP/TFP_35_004/host.c
index 670a34c..4bfe890 100644
--- a/tests/TFP/TFP_35_004/host.c
+++ b/tests/TFP/TFP_35_004/host.c
@@ -26,82 +26,88 @@
#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] = {
+
+static uint32_t pattern[] = {
0x000000F0UL,
0x0000CAFEUL,
0xFFFFFFFFUL
};
+
+#define NUM_PATTERNS (sizeof(pattern)/sizeof(pattern[0]))
+#define EVENT_FLAG_SIZE (sizeof(uint32_t) * 8)
+
static struct mars_context *mars_ctx;
-static struct mars_task_id task_id[NUM_PATTERNS][EVENT_FLAG_SIZE];
+static struct mars_task_id task_id;
static struct mars_task_args task_args;
-static uint64_t host_to_mpu[NUM_PATTERNS][EVENT_FLAG_SIZE];
+static uint64_t eventflag;
+static uint32_t notify __attribute__((aligned(128)));
int main(void)
{
- int ret, i, bits;
- uint32_t chk_bit, pat;
+ int ret, i, j;
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))
+ ret = mars_task_event_flag_create(
+ mars_ctx,
+ &eventflag,
+ MARS_TASK_EVENT_FLAG_HOST_TO_MPU,
+ MARS_TASK_EVENT_FLAG_CLEAR_AUTO);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+
+ for (j = 0; j < EVENT_FLAG_SIZE; j++) {
+ if (!(pattern[i] & (1 << j)))
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);
+ /*
+ * create a waiting task
+ */
+ ret = mars_task_create(mars_ctx, &task_id,
+ NULL, mpu_prog.elf_image,
+ MARS_TASK_CONTEXT_SAVE_SIZE_MAX);
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_SIZE_MAX);
- MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+ task_args.type.u32[0] = pattern[i];
+ task_args.type.u32[1] = 1 << j;
+ task_args.type.u64[1] = eventflag;
+ task_args.type.u64[2] = mars_ptr_to_ea(&notify);
- 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);
+ ret = mars_task_schedule(&task_id, &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);
- }
+ /*
+ * Wait for the schedule of the task
+ */
+ mars_test_counter_wait(&notify, 1);
- /* 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);
+ /*
+ * Set one bit of the event flag
+ */
+ ret = mars_task_event_flag_set(eventflag, 1 << j);
MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
- MARS_TEST_ASSERT_ERROR(exit_code, MARS_SUCCESS);
- ret = mars_task_destroy(&task_id[i][bits]);
+ /*
+ * continue the task
+ */
+ mars_test_counter_add(&notify, 1);
+
+ /*
+ * Wait for the completion of the task
+ */
+ ret = mars_task_wait(&task_id, &exit_code);
MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
- ret = mars_task_event_flag_destroy(
- host_to_mpu[i][bits]);
+ ret = mars_task_destroy(&task_id);
MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+
+ mars_test_counter_set(&notify, 0);
}
+
+ ret = mars_task_event_flag_destroy(eventflag);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
}
ret = mars_context_destroy(mars_ctx);
diff --git a/tests/TFP/TFP_35_004/mpu.c b/tests/TFP/TFP_35_004/mpu.c
index d5c2cfc..6756d2b 100644
--- a/tests/TFP/TFP_35_004/mpu.c
+++ b/tests/TFP/TFP_35_004/mpu.c
@@ -27,14 +27,22 @@
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 wait_pattern = task_args->type.u32[0];
+ uint32_t expected_pattern = task_args->type.u32[1];
+ uint64_t eventflag = task_args->type.u64[1];
+ uint64_t notify = task_args->type.u64[2];
+ uint32_t returned_pattern;
+
+
+ mars_test_counter_set(notify, 1);
+ mars_test_counter_wait(notify, 2);
ret = mars_task_event_flag_wait(
- host_to_mpu_ea,
- chk_bit,
- MARS_TASK_EVENT_FLAG_MASK_OR, NULL);
+ eventflag,
+ wait_pattern,
+ MARS_TASK_EVENT_FLAG_MASK_OR, &returned_pattern);
MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+ MARS_TEST_ASSERT_EQUAL(returned_pattern, expected_pattern);
return 0;
}
diff --git a/tests/TFP/TFP_35_005/host.c b/tests/TFP/TFP_35_005/host.c
index 1f83c3c..7617db0 100644
--- a/tests/TFP/TFP_35_005/host.c
+++ b/tests/TFP/TFP_35_005/host.c
@@ -42,6 +42,7 @@ 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 uint32_t counter __attribute__((aligned(128)));
static void *thread_proc(void *ptr)
{
@@ -51,6 +52,7 @@ static void *thread_proc(void *ptr)
uint32_t bits = (uint32_t)task_args->type.u32[1];
uint32_t chk_bit = task_args->type.u32[2];
+ mars_test_counter_add(&counter, 1);
ret = mars_task_event_flag_wait(
mpu_to_host[i][bits],
chk_bit,
@@ -62,7 +64,7 @@ static void *thread_proc(void *ptr)
int main(void)
{
- int ret, i, bits;
+ int ret, i, bits, threads;
uint32_t chk_bit, pat;
int32_t exit_code;
@@ -71,7 +73,9 @@ int main(void)
for (i = 0; i < NUM_PATTERNS; i++) {
/* create wait threads */
+ mars_test_counter_set(&counter, 0);
pat = pattern[i];
+ threads = 0;
for (bits = 0; pat ; bits++, pat >>= 1) {
if (!(pat & 0x01))
continue;
@@ -87,8 +91,10 @@ int main(void)
thread_args[i][bits].type.u32[2] = pattern[i];
pthread_create(&thread[i][bits], NULL,
thread_proc, &thread_args[i][bits]);
+ threads++;
}
- sleep(1);
+
+ mars_test_counter_wait(&counter, threads);
/* run mpu task */
chk_bit = 0x01;
diff --git a/tests/TFP/TFP_35_006/host.c b/tests/TFP/TFP_35_006/host.c
index e0a3e39..28d9b63 100644
--- a/tests/TFP/TFP_35_006/host.c
+++ b/tests/TFP/TFP_35_006/host.c
@@ -41,10 +41,11 @@ 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];
+static uint32_t counter __attribute__((aligned(128)));
int main(void)
{
- int ret, i, bits;
+ int ret, i, bits, tasks;
uint32_t chk_bit, pat;
int32_t exit_code;
@@ -54,6 +55,8 @@ int main(void)
for (i = 0; i < NUM_PATTERNS; i++) {
/* create all wait task */
pat = pattern[i];
+ tasks = 0;
+ mars_test_counter_set(&counter, 0);
for (bits = 0; pat; bits++, pat >>= 1) {
if (!(pat & 0x01))
continue;
@@ -71,12 +74,14 @@ int main(void)
task1_args.type.u64[0] = mpu_to_mpu[i][bits];
task1_args.type.u64[1] = (uint64_t)pattern[i];
+ task1_args.type.u64[2] = mars_ptr_to_ea(&counter);
ret = mars_task_schedule(&task1_id[i][bits],
&task1_args, 0);
MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+ tasks++;
}
- sleep(1);
+ mars_test_counter_wait(&counter, tasks);
chk_bit = 0x01;
/* set flags */
pat = pattern[i];
diff --git a/tests/TFP/TFP_35_006/mpu1.c b/tests/TFP/TFP_35_006/mpu1.c
index ff4d71f..247c81f 100644
--- a/tests/TFP/TFP_35_006/mpu1.c
+++ b/tests/TFP/TFP_35_006/mpu1.c
@@ -29,6 +29,9 @@ 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 counter_ea = task_args->type.u64[2];
+
+ mars_test_counter_add(counter_ea, 1);
ret = mars_task_event_flag_wait(
mpu_to_mpu_ea,
diff --git a/tests/TFP/TFP_35_007/Makefile b/tests/TFP/TFP_35_007/Makefile
index ecbce33..432135a 100644
--- a/tests/TFP/TFP_35_007/Makefile
+++ b/tests/TFP/TFP_35_007/Makefile
@@ -22,7 +22,7 @@
#
top_srcdir = ../..
-test_objs = host.o mpu1.task_eo mpu2.task_eo
+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_007/common.h b/tests/TFP/TFP_35_007/common.h
new file mode 100644
index 0000000..bdd36fa
--- /dev/null
+++ b/tests/TFP/TFP_35_007/common.h
@@ -0,0 +1,28 @@
+/*
+ * Copyright 2008 Sony Corporation
+ *
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a copy
+ * of this software and associated documentation files (the "Software"), to deal
+ * in the Software without restriction, including without limitation the rights
+ * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+ * copies of the Software, and to permit persons to whom the Software is
+ * furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included in
+ * all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+ * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+ * THE SOFTWARE.
+ */
+
+enum {
+ STATE_NONE,
+ STATE_READY,
+ STATE_EVENT_SET,
+};
diff --git a/tests/TFP/TFP_35_007/host.c b/tests/TFP/TFP_35_007/host.c
index 665d7d3..e8c9126 100644
--- a/tests/TFP/TFP_35_007/host.c
+++ b/tests/TFP/TFP_35_007/host.c
@@ -25,114 +25,130 @@
#include <mars/task.h>
#include <libspe2.h>
#include <mars_test.h>
+#include "common.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 }
+extern spe_program_handle_t mpu_prog;
+
+static uint32_t patterns[] = {
+ 0x0000000001,
+ 0x0000CAFEUL,
+ 0x10203040UL,
+};
+
+static uint8_t modes[] = {
+ MARS_TASK_EVENT_FLAG_MASK_AND,
+ MARS_TASK_EVENT_FLAG_MASK_OR,
};
+
+#define ARRYSIZE(x) (sizeof(x) / sizeof(x[0]))
+
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)));
+static uint64_t eventflag;
+static uint32_t notify __attribute((aligned(128)));
+
+uint32_t make_wait_pattern(uint8_t wait_mode, uint32_t asserted_pattern)
+{
+ int i;
+ uint32_t ret;
+
+ if (wait_mode == MARS_TASK_EVENT_FLAG_MASK_AND)
+ return asserted_pattern;
+
+ /*
+ * find the first asserted bit
+ */
+ ret = 0;
+ for (i = 0; i < (sizeof(asserted_pattern) * 8); i++) {
+ ret = 1 << i;
+ if (asserted_pattern & ret)
+ break;
+ }
+ return ret;
+};
int main(void)
{
- int ret, i;
+ int ret, pattern, mode;
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_SIZE_MAX);
- 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],
+ for (mode = 0; mode < ARRYSIZE(modes); mode++) {
+ for (pattern = 0; pattern < ARRYSIZE(patterns); pattern++) {
+ /*
+ * Create a HOST to MPU event flag
+ * with AUTO clear mode
+ */
+ ret = mars_task_event_flag_create(
+ mars_ctx,
+ &eventflag,
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_SIZE_MAX);
- 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);
+ /* If fails, can't continue the test */
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+
+ /*
+ * Create a task which will wait for
+ * the event flag
+ */
+ ret = mars_task_create(mars_ctx, &task_id, NULL,
+ mpu_prog.elf_image,
+ MARS_TASK_CONTEXT_SAVE_SIZE_MAX);
+ /* If fails, can't continue the test */
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+
+ /*
+ * Setup arguments to MPU
+ */
+ task_args.type.u64[0] = eventflag;
+ task_args.type.u64[1] = (uint64_t)make_wait_pattern(modes[mode],
+ patterns[pattern]);
+ task_args.type.u64[2] = mars_ptr_to_ea(&notify);
+ task_args.type.u64[3] = (uint64_t)modes[mode]; /* waiting mode */
+
+ /*
+ * Start MPU program
+ */
+ ret = mars_task_schedule(&task_id, &task_args, 0);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+
+ /*
+ * Wait for the MPU program to be ready
+ */
+ mars_test_counter_wait(&notify, STATE_READY);
+
+ /*
+ * Make the event flag asserted
+ */
+ ret = mars_task_event_flag_set(eventflag, patterns[pattern]);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+
+ /*
+ * Tell the MPU program to start waiting the event flag
+ */
+ mars_test_counter_set(&notify, STATE_EVENT_SET);
+
+ /*
+ * If everything goes OK, the MPU program exits immediately.
+ * If not, it may never return. The test framework
+ * will detect it as a timeout and kill us
+ */
+ ret = mars_task_wait(&task_id, &exit_code);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+ MARS_TEST_ASSERT_ERROR(exit_code, MARS_SUCCESS);
+
+ /*
+ * cleanup
+ */
+ ret = mars_task_destroy(&task_id);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+
+ ret = mars_task_event_flag_destroy(eventflag);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+ }
}
ret = mars_context_destroy(mars_ctx);
diff --git a/tests/TFP/TFP_35_007/mpu1.c b/tests/TFP/TFP_35_007/mpu.c
index 1612d23..7b07adf 100644
--- a/tests/TFP/TFP_35_007/mpu1.c
+++ b/tests/TFP/TFP_35_007/mpu.c
@@ -24,23 +24,39 @@
#include <mars/task.h>
#include <mars_task_test.h>
#include <spu_mfcio.h>
+#include "common.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 eventflag_ea = task_args->type.u64[0];
+ uint32_t pattern = (uint32_t)task_args->type.u64[1];
uint64_t notify_ea = task_args->type.u64[2];
+ uint8_t mode = (uint8_t)task_args->type.u64[3];
- mars_test_counter_wait(notify_ea, 1);
+ /*
+ * Say I'm ready to the host
+ */
+ mars_test_counter_set(notify_ea, STATE_READY);
+ /*
+ * Waiting for the host to set the eventflag aserted
+ */
+ mars_test_counter_wait(notify_ea, STATE_EVENT_SET);
+ /*
+ * Try to wait for the event flag
+ * which should be already aserted, thus will return
+ * immediately.
+ */
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);
+ eventflag_ea,
+ pattern,
+ mode, NULL);
- mars_test_counter_set(notify_ea, 2);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+ /*
+ * returns OK
+ */
return 0;
}
diff --git a/tests/TFP/TFP_35_008/host.c b/tests/TFP/TFP_35_008/host.c
index b6d0772..cb4a4cd 100644
--- a/tests/TFP/TFP_35_008/host.c
+++ b/tests/TFP/TFP_35_008/host.c
@@ -27,8 +27,6 @@
#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;
@@ -41,50 +39,8 @@ static uint32_t pattern[NUM_PATTERNS][2] = {
};
static struct mars_context *mars_ctx;
static struct mars_task_id task_id;
-static struct mars_task_args task_args, thread_args;
+static struct mars_task_args task_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)
{
@@ -94,56 +50,8 @@ int main(void)
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_SIZE_MAX);
- 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],
@@ -151,10 +59,6 @@ int main(void)
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,
@@ -164,18 +68,9 @@ int main(void)
/* 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);
@@ -183,7 +78,18 @@ int main(void)
ret = mars_task_destroy(&task_id);
MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
- pthread_join(thread, NULL);
+ /*
+ * The following should not be blocked.
+ */
+ ret = mars_task_event_flag_wait(
+ mpu_to_host[i],
+ pattern[i][0],
+ MARS_TASK_EVENT_FLAG_MASK_OR, NULL);
+ /*
+ * We can't tell whether the call has been blocked but released
+ * or returned without blocking...
+ */
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
ret = mars_task_event_flag_destroy(mpu_to_host[i]);
MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
diff --git a/tests/TFP/TFP_35_008/mpu.c b/tests/TFP/TFP_35_008/mpu.c
index 29d46ba..c40d224 100644
--- a/tests/TFP/TFP_35_008/mpu.c
+++ b/tests/TFP/TFP_35_008/mpu.c
@@ -23,21 +23,15 @@
#include <mars/task.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/host.c b/tests/TFP/TFP_35_009/host.c
index d8ef732..e94dca6 100644
--- a/tests/TFP/TFP_35_009/host.c
+++ b/tests/TFP/TFP_35_009/host.c
@@ -26,151 +26,120 @@
#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 uint32_t patterns[] = {
+ 0x00000001UL,
+ 0x0000CAFEUL,
+ 0x10203040UL,
};
+
+#define NUM_PATTERNS (sizeof(patterns)/sizeof(patterns[0]))
+
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)));
+static struct mars_task_id task_id, task2_id, task3_id;
+static struct mars_task_args task_args;
+static uint64_t eventflag;
+static uint32_t counter __attribute__((aligned(128)));
int main(void)
{
int ret, i;
int32_t exit_code;
- ret = mars_context_create(&mars_ctx, 0, 0);
+ /*
+ * Create mars context with ONE usable mpu
+ */
+ ret = mars_context_create(&mars_ctx, 1, 0);
MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
- /* wait conditon AND */
for (i = 0; i < NUM_PATTERNS; i++) {
- notify[0] = 0;
+
+ /*
+ * Create an event flag
+ */
ret = mars_task_event_flag_create(
mars_ctx,
- &mpu_to_mpu[i],
+ &eventflag,
MARS_TASK_EVENT_FLAG_MPU_TO_MPU,
MARS_TASK_EVENT_FLAG_CLEAR_AUTO);
MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+ task_args.type.u32[0] = patterns[i];
+ task_args.type.u64[1] = eventflag;
+ task_args.type.u64[2] = mars_ptr_to_ea(&counter);
+ /*
+ * Let the eventflag asserted
+ */
ret = mars_task_create(mars_ctx, &task_id, NULL,
- mpu1_prog.elf_image,
- MARS_TASK_CONTEXT_SAVE_SIZE_MAX);
+ mpu1_prog.elf_image,
+ MARS_TASK_CONTEXT_SAVE_SIZE_MAX);
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_SIZE_MAX);
- 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);
+ /*
+ * Run a task which will call flag_wait().
+ * It will do busy wait before the call of flag_wait()
+ * so there's no chance for another task to be scheduled
+ * because there's only one usable mpu in the mars context.
+ * We use this symptom to verify the call of flag_wait() would
+ * not be blocked.
+ */
+ ret = mars_task_create(mars_ctx, &task2_id, NULL,
+ mpu2_prog.elf_image,
+ MARS_TASK_CONTEXT_SAVE_SIZE_MAX);
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_SIZE_MAX);
+ ret = mars_task_schedule(&task2_id, &task_args, 0);
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);
+ /*
+ * Wait for the schedule of the task
+ */
+ mars_test_counter_wait(&counter, 1);
- ret = mars_task_schedule(&task_id, &task_args, 0);
- MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
-
- /* create flag_set task */
+ /*
+ * Then, create another task and let it be in runnable state
+ */
ret = mars_task_create(mars_ctx, &task3_id, NULL,
- mpu3_prog.elf_image,
- MARS_TASK_CONTEXT_SAVE_SIZE_MAX);
+ mpu3_prog.elf_image,
+ MARS_TASK_CONTEXT_SAVE_SIZE_MAX);
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);
+ ret = mars_task_schedule(&task3_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);
-
+ /*
+ * Then release the waiter task so that it can call mars_task_event_flag_wait
+ */
+ mars_test_counter_add(&counter, 1); /* going to be 2 */
- /* 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);
+ /*
+ * Clean up for the next iternation
+ */
+ 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(&task_id);
+ ret = mars_task_destroy(&task2_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]);
+ ret = mars_task_event_flag_destroy(eventflag);
MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+
+ mars_test_counter_set(&counter, 0);
}
ret = mars_context_destroy(mars_ctx);
diff --git a/tests/TFP/TFP_35_009/mpu1.c b/tests/TFP/TFP_35_009/mpu1.c
index 17bb53b..a161fd2 100644
--- a/tests/TFP/TFP_35_009/mpu1.c
+++ b/tests/TFP/TFP_35_009/mpu1.c
@@ -28,19 +28,11 @@
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];
+ uint32_t pattern = task_args->type.u32[0];
+ uint64_t eventflag = task_args->type.u64[1];
- 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);
+ ret = mars_task_event_flag_set(eventflag, pattern);
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
index 212ba5d..699f05b 100644
--- a/tests/TFP/TFP_35_009/mpu2.c
+++ b/tests/TFP/TFP_35_009/mpu2.c
@@ -28,19 +28,23 @@
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];
+ uint32_t pattern = task_args->type.u32[0];
+ uint64_t eventflag = task_args->type.u64[1];
+ uint64_t counter_ea = task_args->type.u64[2];
- mars_test_counter_wait(notify_ea, 2);
+ /*
+ * Do busy loop before the invocation of mars_task_event_flag_wait()
+ */
+ mars_test_counter_add(counter_ea, 1);
+ mars_test_counter_wait(counter_ea, 2);
- ret = mars_task_event_flag_wait(
- mpu_to_mpu_ea,
- chk_bit,
- MARS_TASK_EVENT_FLAG_MASK_OR, NULL);
+ ret = mars_task_event_flag_wait(eventflag, pattern,
+ MARS_TASK_EVENT_FLAG_MASK_OR, NULL);
+ /*
+ * Increment the counter to verify that the peer task has not been scheduled
+ */
+ mars_test_counter_add(counter_ea, 1);
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
index 9514da7..8594abb 100644
--- a/tests/TFP/TFP_35_009/mpu3.c
+++ b/tests/TFP/TFP_35_009/mpu3.c
@@ -27,17 +27,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 notify_ea = task_args->type.u64[2];
+ uint64_t counter_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);
+ /*
+ * If the call of mars_task_event_flag_wait() of the waiter task
+ * makes task swtich, we will see the counter remains 2 because
+ * the peer task should increment the counter AFTER the return of
+ * the mars_task_event_flag_wait() and BEFORE exit.
+ * If everything is expected, the counter should be 3
+ */
+ MARS_TEST_ASSERT_EQUAL_INT(mars_test_counter_get(counter_ea), 3);
return 0;
}
diff --git a/tests/TFP/TFP_35_010/host.c b/tests/TFP/TFP_35_010/host.c
index 6de7848..7fb816c 100644
--- a/tests/TFP/TFP_35_010/host.c
+++ b/tests/TFP/TFP_35_010/host.c
@@ -64,6 +64,15 @@ int main(void)
MARS_TASK_EVENT_FLAG_CLEAR_AUTO);
MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+ /* 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_create(mars_ctx, &task1_id, NULL,
mpu1_prog.elf_image, MARS_TASK_CONTEXT_SAVE_SIZE_MAX);
MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
@@ -82,17 +91,6 @@ int main(void)
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);
diff --git a/tests/TFP/TFP_35_012/host.c b/tests/TFP/TFP_35_012/host.c
index 1c8cec2..3968dcf 100644
--- a/tests/TFP/TFP_35_012/host.c
+++ b/tests/TFP/TFP_35_012/host.c
@@ -65,26 +65,6 @@ int main(void)
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_SIZE_MAX);
- MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
-
- ret = mars_task_create(mars_ctx, &task2_id, NULL,
- mpu2_prog.elf_image, MARS_TASK_CONTEXT_SAVE_SIZE_MAX);
- 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_SIZE_MAX);
@@ -99,14 +79,8 @@ int main(void)
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_SIZE_MAX);
- 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);
@@ -119,6 +93,25 @@ int main(void)
ret = mars_task_destroy(&task3_id);
MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+ ret = mars_task_create(mars_ctx, &task1_id, NULL,
+ mpu1_prog.elf_image, MARS_TASK_CONTEXT_SAVE_SIZE_MAX);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+
+ ret = mars_task_create(mars_ctx, &task2_id, NULL,
+ mpu2_prog.elf_image, MARS_TASK_CONTEXT_SAVE_SIZE_MAX);
+ 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);
+
+
/* wait for flag_wait task */
ret = mars_task_wait(&task1_id, &exit_code);
MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
diff --git a/tests/TFP/TFP_35_013/Makefile b/tests/TFP/TFP_35_013/Makefile
index ecbce33..432135a 100644
--- a/tests/TFP/TFP_35_013/Makefile
+++ b/tests/TFP/TFP_35_013/Makefile
@@ -22,7 +22,7 @@
#
top_srcdir = ../..
-test_objs = host.o mpu1.task_eo mpu2.task_eo
+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_013/host.c b/tests/TFP/TFP_35_013/host.c
index 7d73bcb..d51247d 100644
--- a/tests/TFP/TFP_35_013/host.c
+++ b/tests/TFP/TFP_35_013/host.c
@@ -21,13 +21,14 @@
* THE SOFTWARE.
*/
-#include <unistd.h>
+#include <pthread.h>
#include <mars/task.h>
#include <libspe2.h>
#include <mars_test.h>
-extern spe_program_handle_t mpu1_prog;
-extern spe_program_handle_t mpu2_prog;
+#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 */
@@ -38,8 +39,77 @@ static uint32_t pattern[NUM_PATTERNS][2] = {
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];
+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)
{
@@ -52,47 +122,53 @@ int main(void)
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,
+ &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,
- &host_to_mpu_or[i],
- MARS_TASK_EVENT_FLAG_HOST_TO_MPU,
+ &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,
- mpu1_prog.elf_image, MARS_TASK_CONTEXT_SAVE_SIZE_MAX);
+ mpu_prog.elf_image,
+ MARS_TASK_CONTEXT_SAVE_SIZE_MAX);
MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
ret = mars_task_create(mars_ctx, &task2_id, NULL,
- mpu2_prog.elf_image, MARS_TASK_CONTEXT_SAVE_SIZE_MAX);
+ mpu_prog.elf_image,
+ MARS_TASK_CONTEXT_SAVE_SIZE_MAX);
MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
- task1_args.type.u64[0] = host_to_mpu_and[i];
+ 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);
- 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];
+ /* 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);
- 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);
+ pthread_join(thread1, NULL);
+ pthread_join(thread2, NULL);
ret = mars_task_wait(&task1_id, &exit_code);
MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
@@ -108,10 +184,10 @@ int main(void)
ret = mars_task_destroy(&task2_id);
MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
- ret = mars_task_event_flag_destroy(host_to_mpu_and[i]);
+ ret = mars_task_event_flag_destroy(mpu_to_host_and[i]);
MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
- ret = mars_task_event_flag_destroy(host_to_mpu_or[i]);
+ ret = mars_task_event_flag_destroy(mpu_to_host_or[i]);
MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
}
diff --git a/tests/TFP/TFP_35_014/mpu.c b/tests/TFP/TFP_35_013/mpu.c
index c40d224..c40d224 100644
--- a/tests/TFP/TFP_35_014/mpu.c
+++ b/tests/TFP/TFP_35_013/mpu.c
diff --git a/tests/TFP/TFP_35_014/Makefile b/tests/TFP/TFP_35_014/Makefile
index 432135a..ecbce33 100644
--- a/tests/TFP/TFP_35_014/Makefile
+++ b/tests/TFP/TFP_35_014/Makefile
@@ -22,7 +22,7 @@
#
top_srcdir = ../..
-test_objs = host.o mpu.task_eo
+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_014/host.c b/tests/TFP/TFP_35_014/host.c
index d51247d..3f87fe6 100644
--- a/tests/TFP/TFP_35_014/host.c
+++ b/tests/TFP/TFP_35_014/host.c
@@ -21,14 +21,13 @@
* THE SOFTWARE.
*/
-#include <pthread.h>
+#include <unistd.h>
#include <mars/task.h>
#include <libspe2.h>
#include <mars_test.h>
-#define EVENT_FLAG_SIZE 32
-
-extern spe_program_handle_t mpu_prog;
+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 */
@@ -39,77 +38,8 @@ static uint32_t pattern[NUM_PATTERNS][2] = {
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;
-}
+static uint64_t host_to_mpu_and[NUM_PATTERNS];
+static uint64_t host_to_mpu_or[NUM_PATTERNS];
int main(void)
{
@@ -122,53 +52,46 @@ int main(void)
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,
+ &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,
- &mpu_to_host_or[i],
- MARS_TASK_EVENT_FLAG_MPU_TO_HOST,
+ &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);
+ /* 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_create(mars_ctx, &task1_id, NULL,
- mpu_prog.elf_image,
- MARS_TASK_CONTEXT_SAVE_SIZE_MAX);
+ mpu1_prog.elf_image, MARS_TASK_CONTEXT_SAVE_SIZE_MAX);
MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
ret = mars_task_create(mars_ctx, &task2_id, NULL,
- mpu_prog.elf_image,
- MARS_TASK_CONTEXT_SAVE_SIZE_MAX);
+ mpu2_prog.elf_image, MARS_TASK_CONTEXT_SAVE_SIZE_MAX);
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[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);
- /* set flags OR conditon */
- task2_args.type.u64[0] = mpu_to_host_or[i];
- task2_args.type.u64[1] = (uint64_t)pattern[i][1];
+ 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);
- pthread_join(thread1, NULL);
- pthread_join(thread2, NULL);
ret = mars_task_wait(&task1_id, &exit_code);
MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
@@ -184,10 +107,10 @@ int main(void)
ret = mars_task_destroy(&task2_id);
MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
- ret = mars_task_event_flag_destroy(mpu_to_host_and[i]);
+ ret = mars_task_event_flag_destroy(host_to_mpu_and[i]);
MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
- ret = mars_task_event_flag_destroy(mpu_to_host_or[i]);
+ ret = mars_task_event_flag_destroy(host_to_mpu_or[i]);
MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
}
diff --git a/tests/TFP/TFP_35_013/mpu1.c b/tests/TFP/TFP_35_014/mpu1.c
index bd87602..bd87602 100644
--- a/tests/TFP/TFP_35_013/mpu1.c
+++ b/tests/TFP/TFP_35_014/mpu1.c
diff --git a/tests/TFP/TFP_35_013/mpu2.c b/tests/TFP/TFP_35_014/mpu2.c
index d99004a..d99004a 100644
--- a/tests/TFP/TFP_35_013/mpu2.c
+++ b/tests/TFP/TFP_35_014/mpu2.c
diff --git a/tests/TFP/TFP_35_015/host.c b/tests/TFP/TFP_35_015/host.c
index 00454de..5772a10 100644
--- a/tests/TFP/TFP_35_015/host.c
+++ b/tests/TFP/TFP_35_015/host.c
@@ -65,27 +65,6 @@ int main(void)
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_SIZE_MAX);
- MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
-
- ret = mars_task_create(mars_ctx, &task2_id, NULL,
- mpu2_prog.elf_image, MARS_TASK_CONTEXT_SAVE_SIZE_MAX);
- 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_SIZE_MAX);
@@ -100,14 +79,7 @@ int main(void)
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_SIZE_MAX);
- 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);
@@ -120,7 +92,26 @@ int main(void)
ret = mars_task_destroy(&task3_id);
MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+ ret = mars_task_create(mars_ctx, &task1_id, NULL,
+ mpu1_prog.elf_image, MARS_TASK_CONTEXT_SAVE_SIZE_MAX);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+
+ ret = mars_task_create(mars_ctx, &task2_id, NULL,
+ mpu2_prog.elf_image, MARS_TASK_CONTEXT_SAVE_SIZE_MAX);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+
/* wait flag_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];
+ 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);
+
ret = mars_task_wait(&task1_id, &exit_code);
MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
MARS_TEST_ASSERT_ERROR(exit_code, MARS_SUCCESS);
diff --git a/tests/TFP/TFP_35_016/host.c b/tests/TFP/TFP_35_016/host.c
index dadf4f8..ad4d56f 100644
--- a/tests/TFP/TFP_35_016/host.c
+++ b/tests/TFP/TFP_35_016/host.c
@@ -28,9 +28,7 @@
#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,
@@ -38,15 +36,20 @@ static uint32_t pattern[] = {
0x5A5A5A5AUL,
0xFFFFFFFFUL
};
+
+#define NUM_PATTERNS (sizeof(pattern)/sizeof(pattern[0]))
+#define EVENT_FLAG_SIZE (sizeof(uint32_t) * 8)
+
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)));
+static uint64_t eventflag;
+static uint32_t counter __attribute((aligned(128)));
+static uint32_t unblocked __attribute((aligned(128)));
int main(void)
{
- int ret, i, count;
+ int ret, i, task;
int32_t exit_code;
ret = mars_context_create(&mars_ctx, 0, 0);
@@ -55,49 +58,52 @@ int main(void)
for (i = 0; i < NUM_PATTERNS; i++) {
ret = mars_task_event_flag_create(
mars_ctx,
- &host_to_mpu[i],
+ &eventflag,
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,
+ for (task = 0; task < TASK_MAX; task++) {
+ ret = mars_task_create(mars_ctx, &task_id[task], NULL,
mpu_prog.elf_image,
MARS_TASK_CONTEXT_SAVE_SIZE_MAX);
- 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]);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
- ret = mars_task_schedule(&task_id[count],
- &task_args, 0);
+ task_args.type.u32[0] = pattern[i];
+ task_args.type.u64[1] = eventflag;
+ task_args.type.u64[2] = mars_ptr_to_ea(&counter);
+ task_args.type.u64[3] = mars_ptr_to_ea(&unblocked);
+ ret = mars_task_schedule(&task_id[task], &task_args, 0);
MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
}
+ /*
+ * All tasks has been scheduled?
+ */
+ mars_test_counter_wait(&counter, TASK_MAX);
- sleep(1);
/* check if all tasks are waiting */
- for (count = 0; count < TASK_MAX; count++)
- MARS_TEST_ASSERT_EQUAL(shared_resource[count * 4], 0);
+ MARS_TEST_ASSERT_EQUAL(mars_test_counter_get(&unblocked), 0);
/* set event flag */
- ret = mars_task_event_flag_set(host_to_mpu[i], pattern[i]);
+ ret = mars_task_event_flag_set(eventflag, 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);
+ for (task = 0; task < TASK_MAX; task++) {
+ ret = mars_task_wait(&task_id[task], &exit_code);
MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
- MARS_TEST_ASSERT_ERROR(exit_code, MARS_SUCCESS);
- ret = mars_task_destroy(&task_id[count]);
+ ret = mars_task_destroy(&task_id[task]);
MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
}
- ret = mars_task_event_flag_destroy(host_to_mpu[i]);
+ MARS_TEST_ASSERT_EQUAL(mars_test_counter_get(&unblocked), TASK_MAX);
+
+ ret = mars_task_event_flag_destroy(eventflag);
MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+
+ mars_test_counter_set(&counter, 0);
+ mars_test_counter_set(&unblocked, 0);
}
ret = mars_context_destroy(mars_ctx);
diff --git a/tests/TFP/TFP_35_016/mpu.c b/tests/TFP/TFP_35_016/mpu.c
index abe2abe..8c42148 100644
--- a/tests/TFP/TFP_35_016/mpu.c
+++ b/tests/TFP/TFP_35_016/mpu.c
@@ -23,30 +23,22 @@
#include <mars/task.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];
+ uint32_t pattern = task_args->type.u32[0];
+ uint64_t eventflag = task_args->type.u64[1];
+ uint64_t counter = task_args->type.u64[2];
+ uint64_t unblocked = task_args->type.u64[3];
- 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_add(counter, 1);
- /* 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();
+ ret = mars_task_event_flag_wait(eventflag, pattern,
+ MARS_TASK_EVENT_FLAG_MASK_AND, NULL);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+ mars_test_counter_add(unblocked, 1);
return 0;
}
diff --git a/tests/TFP/TFP_35_017/host.c b/tests/TFP/TFP_35_017/host.c
index d3e3c79..2c0f5ac 100644
--- a/tests/TFP/TFP_35_017/host.c
+++ b/tests/TFP/TFP_35_017/host.c
@@ -29,10 +29,8 @@
#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,
@@ -40,30 +38,28 @@ static uint32_t pattern[] = {
0x5A5A5A5AUL,
0xFFFFFFFFUL
};
+#define NUM_PATTERNS (sizeof(pattern)/sizeof(pattern[0]))
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 struct mars_task_args task_args, thread_args;
+static uint64_t eventflag;
+static uint32_t counter __attribute__((aligned(128)));
+static uint32_t unblocked __attribute__((aligned(128)));
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);
+ uint32_t pattern = task_args->type.u32[0];
+
+ mars_test_counter_add(&counter, 1);
+
+ ret = mars_task_event_flag_wait(eventflag, pattern,
+ 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;
+ mars_test_counter_add(&unblocked, 1);
return NULL;
}
@@ -80,50 +76,51 @@ int main(void)
/* 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],
+ &eventflag,
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]);
+ thread_args.type.u32[0] = pattern[i];
+ pthread_create(&thread[count], NULL, thread_proc,
+ &thread_args);
}
- sleep(1);
/* check if all threads are waiting */
- for (count = 0; count < TASK_MAX; count++)
- MARS_TEST_ASSERT_EQUAL(shared_resource[count], 0);
+ mars_test_counter_wait(&counter, TASK_MAX);
+ MARS_TEST_ASSERT_EQUAL(mars_test_counter_get(&unblocked), 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_SIZE_MAX);
+ mpu_prog.elf_image,
+ MARS_TASK_CONTEXT_SAVE_SIZE_MAX);
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];
+ task_args.type.u64[1] = eventflag;
+ task_args.type.u32[0] = 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(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 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);
+ MARS_TEST_ASSERT_EQUAL(mars_test_counter_get(&unblocked), TASK_MAX);
- ret = mars_task_event_flag_destroy(mpu_to_host[i]);
+ ret = mars_task_event_flag_destroy(eventflag);
MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+
+ mars_test_counter_set(&counter, 0);
+ mars_test_counter_set(&unblocked, 0);
}
ret = mars_context_destroy(mars_ctx);
diff --git a/tests/TFP/TFP_35_017/mpu.c b/tests/TFP/TFP_35_017/mpu.c
index c40d224..cd7ea75 100644
--- a/tests/TFP/TFP_35_017/mpu.c
+++ b/tests/TFP/TFP_35_017/mpu.c
@@ -27,10 +27,10 @@
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];
+ uint32_t pattern = task_args->type.u32[0];
+ uint64_t eventflag = task_args->type.u64[1];
- ret = mars_task_event_flag_set(mpu_to_host_ea, chk_bit);
+ ret = mars_task_event_flag_set(eventflag, pattern);
MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
return 0;
diff --git a/tests/TFP/TFP_35_018/host.c b/tests/TFP/TFP_35_018/host.c
index 862a9fc..cdd0ebf 100644
--- a/tests/TFP/TFP_35_018/host.c
+++ b/tests/TFP/TFP_35_018/host.c
@@ -28,22 +28,23 @@
#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] = {
+
+static uint32_t pattern[] = {
0x00000001UL,
0x0000CAFEUL,
0x10203040UL,
0x5A5A5A5AUL,
0xFFFFFFFFUL
};
+#define NUM_PATTERNS (sizeof(pattern)/sizeof(pattern[0]))
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)));
+static struct mars_task_args task_args;
+static uint64_t eventflag;
+static uint32_t counter __attribute__((aligned(128)));
+static uint32_t unblocked __attribute__((aligned(128)));
int main(void)
{
@@ -54,45 +55,39 @@ int main(void)
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);
+ ret = mars_task_event_flag_create(mars_ctx,
+ &eventflag,
+ MARS_TASK_EVENT_FLAG_MPU_TO_MPU,
+ MARS_TASK_EVENT_FLAG_CLEAR_AUTO);
MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+ task_args.type.u32[0] = pattern[i];
+ task_args.type.u64[1] = eventflag;
+ task_args.type.u64[2] = mars_ptr_to_ea(&counter);
+ task_args.type.u64[3] = mars_ptr_to_ea(&unblocked);
+
/* 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_SIZE_MAX);
- 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]);
+ mpu1_prog.elf_image,
+ MARS_TASK_CONTEXT_SAVE_SIZE_MAX);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
- ret = mars_task_schedule(&task_id[count],
- &task_args, 0);
+ ret = mars_task_schedule(&task_id[count], &task_args, 0);
MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
}
- sleep(1);
+ mars_test_counter_wait(&counter, TASK_MAX);
+ MARS_TEST_ASSERT_EQUAL(mars_test_counter_get(&unblocked), 0);
/* 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_SIZE_MAX);
- MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+ mpu2_prog.elf_image,
+ MARS_TASK_CONTEXT_SAVE_SIZE_MAX);
+ 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);
+ ret = mars_task_schedule(&task2_id, &task_args, 0);
MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
ret = mars_task_wait(&task2_id, &exit_code);
@@ -109,11 +104,16 @@ int main(void)
MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
}
+ MARS_TEST_ASSERT_EQUAL(mars_test_counter_get(&unblocked), TASK_MAX);
+
ret = mars_task_destroy(&task2_id);
MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
- ret = mars_task_event_flag_destroy(mpu_to_mpu[i]);
+ ret = mars_task_event_flag_destroy(eventflag);
MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+
+ mars_test_counter_set(&counter, 0);
+ mars_test_counter_set(&unblocked, 0);
}
ret = mars_context_destroy(mars_ctx);
diff --git a/tests/TFP/TFP_35_018/mpu1.c b/tests/TFP/TFP_35_018/mpu1.c
index 79c7085..8c42148 100644
--- a/tests/TFP/TFP_35_018/mpu1.c
+++ b/tests/TFP/TFP_35_018/mpu1.c
@@ -23,30 +23,22 @@
#include <mars/task.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];
+ uint32_t pattern = task_args->type.u32[0];
+ uint64_t eventflag = task_args->type.u64[1];
+ uint64_t counter = task_args->type.u64[2];
+ uint64_t unblocked = task_args->type.u64[3];
- 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_add(counter, 1);
- /* 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();
+ ret = mars_task_event_flag_wait(eventflag, pattern,
+ MARS_TASK_EVENT_FLAG_MASK_AND, NULL);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+ mars_test_counter_add(unblocked, 1);
return 0;
}
diff --git a/tests/TFP/TFP_35_018/mpu2.c b/tests/TFP/TFP_35_018/mpu2.c
index 69cca3e..cd7ea75 100644
--- a/tests/TFP/TFP_35_018/mpu2.c
+++ b/tests/TFP/TFP_35_018/mpu2.c
@@ -27,10 +27,10 @@
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];
+ uint32_t pattern = task_args->type.u32[0];
+ uint64_t eventflag = task_args->type.u64[1];
- ret = mars_task_event_flag_set(mpu_to_mpu_ea, chk_bit);
+ ret = mars_task_event_flag_set(eventflag, pattern);
MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
return 0;
diff --git a/tests/TFP/TFP_36_001/host.c b/tests/TFP/TFP_36_001/host.c
index a739d3e..4cb0f9d 100644
--- a/tests/TFP/TFP_36_001/host.c
+++ b/tests/TFP/TFP_36_001/host.c
@@ -27,73 +27,74 @@
#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 uint32_t pattern[]= {
+ 0x000000FF,
+ 0xdeadbeef,
+ 0xFFFFFFFF,
};
+
+#define NUM_PATTERNS (sizeof(pattern)/sizeof(pattern[0]))
+#define EVENT_FLAG_LENGTH (sizeof(uint32_t) * 8)
+
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)));
+static uint64_t eventflag;
int main(void)
{
- int ret, i, bits;
- uint32_t chk_bit;
+ int ret, i, j;
+ uint32_t set;
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, &task_id, NULL,
+ mpu_prog.elf_image, MARS_TASK_CONTEXT_SAVE_SIZE_MAX);
+ 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],
+ &eventflag,
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_SIZE_MAX);
- MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+ set = 0;
+ for (j = 0; j < EVENT_FLAG_LENGTH; j++) {
+ if (!(pattern[i] & (1 << j)))
+ continue;
- 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);
+ set |= 1 << j;
- chk_bit = 0x01;
- for (bits = 0; bits < pattern[i][0] - 1; bits++) {
- ret = mars_task_event_flag_set(
- host_to_mpu[i], chk_bit);
+ ret = mars_task_event_flag_set(eventflag, 1 << j);
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);
+ task_args.type.u32[0] = pattern[i];
+ task_args.type.u32[1] = (set == pattern[i]) ?
+ MARS_SUCCESS : MARS_ERROR_BUSY;
+ task_args.type.u64[1] = eventflag;
- 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_schedule(&task_id, &task_args, 0);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
- ret = mars_task_destroy(&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);
+
+ if (set == pattern[i])
+ break;
+ }
- ret = mars_task_event_flag_destroy(host_to_mpu[i]);
+ ret = mars_task_event_flag_destroy(eventflag);
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_ctx);
MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
diff --git a/tests/TFP/TFP_36_001/mpu.c b/tests/TFP/TFP_36_001/mpu.c
index 6e9014f..0b6d1df 100644
--- a/tests/TFP/TFP_36_001/mpu.c
+++ b/tests/TFP/TFP_36_001/mpu.c
@@ -23,36 +23,17 @@
#include <mars/task.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);
- }
+ uint32_t pattern = task_args->type.u32[0];
+ uint32_t result = task_args->type.u32[1];
+ uint64_t eventflag = task_args->type.u64[1];
- /* 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();
+ ret = mars_task_event_flag_try_wait(eventflag, pattern,
+ MARS_TASK_EVENT_FLAG_MASK_AND, NULL);
+ MARS_TEST_ASSERT_ERROR(ret, result);
return 0;
}
diff --git a/tests/TFP/TFP_36_004/host.c b/tests/TFP/TFP_36_004/host.c
index 80d0f9f..cdd40b0 100644
--- a/tests/TFP/TFP_36_004/host.c
+++ b/tests/TFP/TFP_36_004/host.c
@@ -27,76 +27,68 @@
#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 uint32_t pattern[]= {
+ 0x000000FF,
+ 0xdeadbeef,
+ 0xFFFFFFFF,
};
+
+#define NUM_PATTERNS (sizeof(pattern)/sizeof(pattern[0]))
+#define EVENT_FLAG_LENGTH (sizeof(uint32_t) * 8)
+
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)));
+static uint64_t eventflag;
int main(void)
{
- int ret, i, bits;
- uint32_t chk_bit;
+ int ret, i, j;
+ uint32_t set;
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, &task_id, NULL,
+ mpu_prog.elf_image, MARS_TASK_CONTEXT_SAVE_SIZE_MAX);
+ 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_SIZE_MAX);
- 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);
+ for (j = 0; j < EVENT_FLAG_LENGTH; j++) {
+ ret = mars_task_event_flag_create(
+ mars_ctx,
+ &eventflag,
+ MARS_TASK_EVENT_FLAG_HOST_TO_MPU,
+ MARS_TASK_EVENT_FLAG_CLEAR_AUTO);
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 = 1 << j;
+
+ ret = mars_task_event_flag_set(eventflag, set);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
- /* set another one bit */
- ret = mars_task_event_flag_set(
- host_to_mpu[i], chk_bit);
- MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+ task_args.type.u32[0] = pattern[i];
+ task_args.type.u32[1] = (set & pattern[i]) ?
+ MARS_SUCCESS : MARS_ERROR_BUSY;
+ task_args.type.u64[1] = eventflag;
- 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_schedule(&task_id, &task_args, 0);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
- ret = mars_task_destroy(&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_event_flag_destroy(host_to_mpu[i]);
- MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+ ret = mars_task_event_flag_destroy(eventflag);
+ 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_ctx);
MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
diff --git a/tests/TFP/TFP_36_004/mpu.c b/tests/TFP/TFP_36_004/mpu.c
index 1c1b186..cdebe89 100644
--- a/tests/TFP/TFP_36_004/mpu.c
+++ b/tests/TFP/TFP_36_004/mpu.c
@@ -23,36 +23,17 @@
#include <mars/task.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);
- }
+ uint32_t pattern = task_args->type.u32[0];
+ uint32_t result = task_args->type.u32[1];
+ uint64_t eventflag = task_args->type.u64[1];
- /* 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();
+ ret = mars_task_event_flag_try_wait(eventflag, pattern,
+ MARS_TASK_EVENT_FLAG_MASK_OR, NULL);
+ MARS_TEST_ASSERT_ERROR(ret, result);
return 0;
}
diff --git a/tests/TFP/TFP_36_007/Makefile b/tests/TFP/TFP_36_007/Makefile
index ecbce33..432135a 100644
--- a/tests/TFP/TFP_36_007/Makefile
+++ b/tests/TFP/TFP_36_007/Makefile
@@ -22,7 +22,7 @@
#
top_srcdir = ../..
-test_objs = host.o mpu1.task_eo mpu2.task_eo
+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_007/host.c b/tests/TFP/TFP_36_007/host.c
index 6de7848..79d8542 100644
--- a/tests/TFP/TFP_36_007/host.c
+++ b/tests/TFP/TFP_36_007/host.c
@@ -26,20 +26,21 @@
#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 }
+extern spe_program_handle_t mpu_prog;
+
+static uint32_t pattern[] = {
+ 0x00000001,
+ 0x0000CAFE,
+ 0x10203040,
+ 0xffffffff,
};
+#define NUM_PATTERNS (sizeof(pattern)/sizeof(pattern[0]))
+#define EVENT_FLAG_LENGTH (sizeof(uint32_t) * 8)
+
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];
+static struct mars_task_id task_id;
+static struct mars_task_args task_args;
+static uint64_t eventflag;
int main(void)
{
@@ -49,71 +50,51 @@ int main(void)
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, &task_id, NULL,
+ mpu_prog.elf_image, MARS_TASK_CONTEXT_SAVE_SIZE_MAX);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
- ret = mars_task_create(mars_ctx, &task1_id, NULL,
- mpu1_prog.elf_image, MARS_TASK_CONTEXT_SAVE_SIZE_MAX);
+ for (i = 0; i < NUM_PATTERNS; i++) {
+ ret = mars_task_event_flag_create(mars_ctx, &eventflag,
+ 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, &task2_id, NULL,
- mpu2_prog.elf_image, MARS_TASK_CONTEXT_SAVE_SIZE_MAX);
+ /* AND */
+ ret = mars_task_event_flag_set(eventflag, pattern[i]);
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);
+ task_args.type.u32[0] = pattern[i];
+ task_args.type.u32[1] = MARS_TASK_EVENT_FLAG_MASK_AND;
+ task_args.type.u64[1] = eventflag;
+ ret = mars_task_schedule(&task_id, &task_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);
+ ret = mars_task_wait(&task_id, &exit_code);
+ MARS_TEST_ASSERT_ERROR(exit_code, MARS_SUCCESS);
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]);
+ /* OR */
+ ret = mars_task_event_flag_set(eventflag, pattern[i]);
MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
- ret = mars_task_wait(&task1_id, &exit_code);
+ task_args.type.u32[1] = MARS_TASK_EVENT_FLAG_MASK_OR;
+ ret = mars_task_schedule(&task_id, &task_args, 0);
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);
+ ret = mars_task_wait(&task_id, &exit_code);
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);
+ MARS_TEST_ASSERT_ERROR(exit_code, MARS_SUCCESS);
- ret = mars_task_event_flag_destroy(host_to_mpu_or[i]);
+ ret = mars_task_event_flag_destroy(eventflag);
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_ctx);
MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
diff --git a/tests/TFP/TFP_61_001/mpu.c b/tests/TFP/TFP_36_007/mpu.c
index bd0f8d5..0e829bd 100644
--- a/tests/TFP/TFP_61_001/mpu.c
+++ b/tests/TFP/TFP_36_007/mpu.c
@@ -23,24 +23,26 @@
#include <mars/task.h>
#include <mars_task_test.h>
-#include <spu_mfcio.h>
-
-static uint32_t shared_resource __attribute((aligned(16)));
+#define EVENT_FLAG_LENGTH (sizeof(uint32_t) * 8)
int mars_task_main(const struct mars_task_args *task_args)
{
- int ret;
- uint64_t shared_resource_ea = task_args->type.u64[0];
+ int ret, i;
+ uint32_t flags = task_args->type.u32[0];
+ uint32_t mode = task_args->type.u32[1];
+ uint64_t eventflag = task_args->type.u64[1];
- ret = mars_task_signal_wait();
+ ret = mars_task_event_flag_try_wait(eventflag, flags, mode, 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();
+ /* check if all bits are cleard */
+ for (i = 0; i < EVENT_FLAG_LENGTH; i++) {
+ if (!(flags & (1 << i)))
+ continue;
+ ret = mars_task_event_flag_try_wait(eventflag, 1 << i,
+ MARS_TASK_EVENT_FLAG_MASK_OR, NULL);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_ERROR_BUSY);
+ }
return 0;
}
diff --git a/tests/TFP/TFP_36_007/mpu1.c b/tests/TFP/TFP_36_007/mpu1.c
deleted file mode 100644
index dffa761..0000000
--- a/tests/TFP/TFP_36_007/mpu1.c
+++ /dev/null
@@ -1,63 +0,0 @@
-/*
- * Copyright 2008 Sony Corporation
- *
- *
- * Permission is hereby granted, free of charge, to any person obtaining a copy
- * of this software and associated documentation files (the "Software"), to deal
- * in the Software without restriction, including without limitation the rights
- * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
- * copies of the Software, and to permit persons to whom the Software is
- * furnished to do so, subject to the following conditions:
- *
- * The above copyright notice and this permission notice shall be included in
- * all copies or substantial portions of the Software.
- *
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
- * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
- * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
- * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
- * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, 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.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
deleted file mode 100644
index 1d57b93..0000000
--- a/tests/TFP/TFP_36_007/mpu2.c
+++ /dev/null
@@ -1,63 +0,0 @@
-/*
- * Copyright 2008 Sony Corporation
- *
- *
- * Permission is hereby granted, free of charge, to any person obtaining a copy
- * of this software and associated documentation files (the "Software"), to deal
- * in the Software without restriction, including without limitation the rights
- * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
- * copies of the Software, and to permit persons to whom the Software is
- * furnished to do so, subject to the following conditions:
- *
- * The above copyright notice and this permission notice shall be included in
- * all copies or substantial portions of the Software.
- *
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
- * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
- * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
- * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
- * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, 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.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_009/Makefile b/tests/TFP/TFP_36_009/Makefile
index 72cf999..ecbce33 100644
--- a/tests/TFP/TFP_36_009/Makefile
+++ b/tests/TFP/TFP_36_009/Makefile
@@ -22,7 +22,7 @@
#
top_srcdir = ../..
-test_objs = host.o mpu1.task_eo mpu2.task_eo mpu3.task_eo
+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_009/host.c b/tests/TFP/TFP_36_009/host.c
index 89e94a5..0d85325 100644
--- a/tests/TFP/TFP_36_009/host.c
+++ b/tests/TFP/TFP_36_009/host.c
@@ -28,19 +28,19 @@
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 uint32_t pattern[] = {
+ 0x00000001,
+ 0x0000CAFE,
+ 0x10203040,
+ 0xffffffff,
};
+#define NUM_PATTERNS (sizeof(pattern)/sizeof(pattern[0]))
+
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];
+static struct mars_task_id task1_id, task2_id;
+static struct mars_task_args task_args;
+static uint64_t eventflag;
int main(void)
{
@@ -50,99 +50,62 @@ int main(void)
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_SIZE_MAX);
- MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
-
- ret = mars_task_create(mars_ctx, &task2_id, NULL,
- mpu2_prog.elf_image, MARS_TASK_CONTEXT_SAVE_SIZE_MAX);
- 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);
+ ret = mars_task_create(mars_ctx, &task1_id, NULL,
+ mpu1_prog.elf_image, MARS_TASK_CONTEXT_SAVE_SIZE_MAX);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+ ret = mars_task_create(mars_ctx, &task2_id, NULL,
+ mpu2_prog.elf_image, MARS_TASK_CONTEXT_SAVE_SIZE_MAX);
+ 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);
+ for (i = 0; i < NUM_PATTERNS; i++) {
+ ret = mars_task_event_flag_create(mars_ctx, &eventflag,
+ MARS_TASK_EVENT_FLAG_MPU_TO_MPU,
+ MARS_TASK_EVENT_FLAG_CLEAR_AUTO);
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_SIZE_MAX);
- MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+ /* AND */
+ task_args.type.u32[0] = pattern[i];
+ task_args.type.u32[1] = MARS_TASK_EVENT_FLAG_MASK_AND;
+ task_args.type.u64[1] = eventflag;
- 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);
+ ret = mars_task_schedule(&task2_id, &task_args, 0);
MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
- ret = mars_task_wait(&task3_id, &exit_code);
- MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+ ret = mars_task_wait(&task2_id, &exit_code);
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_SIZE_MAX);
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);
+ ret = mars_task_schedule(&task1_id, &task_args, 0);
MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
- ret = mars_task_wait(&task3_id, &exit_code);
- MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+ ret = mars_task_wait(&task1_id, &exit_code);
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);
+ /* OR */
+ ret = mars_task_schedule(&task2_id, &task_args, 0);
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);
+ task_args.type.u32[1] = MARS_TASK_EVENT_FLAG_MASK_OR;
+ ret = mars_task_schedule(&task1_id, &task_args, 0);
MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
- ret = mars_task_event_flag_destroy(mpu_to_mpu_and[i]);
+ ret = mars_task_wait(&task1_id, &exit_code);
+ MARS_TEST_ASSERT_ERROR(exit_code, MARS_SUCCESS);
MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
- ret = mars_task_event_flag_destroy(mpu_to_mpu_or[i]);
+ ret = mars_task_event_flag_destroy(eventflag);
MARS_TEST_ASSERT_ERROR(ret, 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);
diff --git a/tests/TFP/TFP_36_009/mpu1.c b/tests/TFP/TFP_36_009/mpu1.c
index 980a243..0e829bd 100644
--- a/tests/TFP/TFP_36_009/mpu1.c
+++ b/tests/TFP/TFP_36_009/mpu1.c
@@ -23,41 +23,26 @@
#include <mars/task.h>
#include <mars_task_test.h>
+#define EVENT_FLAG_LENGTH (sizeof(uint32_t) * 8)
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;
+ int ret, i;
+ uint32_t flags = task_args->type.u32[0];
+ uint32_t mode = task_args->type.u32[1];
+ uint64_t eventflag = task_args->type.u64[1];
- /* 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);
- }
+ ret = mars_task_event_flag_try_wait(eventflag, flags, mode, 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;
+ for (i = 0; i < EVENT_FLAG_LENGTH; i++) {
+ if (!(flags & (1 << i)))
+ continue;
+ ret = mars_task_event_flag_try_wait(eventflag, 1 << i,
+ MARS_TASK_EVENT_FLAG_MASK_OR, NULL);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_ERROR_BUSY);
}
+
return 0;
}
diff --git a/tests/TFP/TFP_36_009/mpu2.c b/tests/TFP/TFP_36_009/mpu2.c
index 3cf3c4b..0928092 100644
--- a/tests/TFP/TFP_36_009/mpu2.c
+++ b/tests/TFP/TFP_36_009/mpu2.c
@@ -27,37 +27,11 @@
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;
+ uint32_t flags = task_args->type.u32[0];
+ uint64_t eventflag = task_args->type.u64[1];
- /* 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);
- }
+ ret = mars_task_event_flag_set(eventflag, flags);
+ 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_36_010/Makefile b/tests/TFP/TFP_36_010/Makefile
index ecbce33..432135a 100644
--- a/tests/TFP/TFP_36_010/Makefile
+++ b/tests/TFP/TFP_36_010/Makefile
@@ -22,7 +22,7 @@
#
top_srcdir = ../..
-test_objs = host.o mpu1.task_eo mpu2.task_eo
+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_010/host.c b/tests/TFP/TFP_36_010/host.c
index bcbc8e0..1f44616 100644
--- a/tests/TFP/TFP_36_010/host.c
+++ b/tests/TFP/TFP_36_010/host.c
@@ -26,20 +26,21 @@
#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 }
+extern spe_program_handle_t mpu_prog;
+
+static uint32_t pattern[] = {
+ 0x00000001,
+ 0x0000CAFE,
+ 0x10203040,
+ 0xffffffff,
};
+#define NUM_PATTERNS (sizeof(pattern)/sizeof(pattern[0]))
+#define EVENT_FLAG_LENGTH (sizeof(uint32_t) * 8)
+
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];
+static struct mars_task_id task_id;
+static struct mars_task_args task_args;
+static uint64_t eventflag;
int main(void)
{
@@ -49,72 +50,51 @@ int main(void)
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, &task_id, NULL,
+ mpu_prog.elf_image, MARS_TASK_CONTEXT_SAVE_SIZE_MAX);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
- ret = mars_task_create(mars_ctx, &task1_id, NULL,
- mpu1_prog.elf_image, MARS_TASK_CONTEXT_SAVE_SIZE_MAX);
+ for (i = 0; i < NUM_PATTERNS; i++) {
+ ret = mars_task_event_flag_create(mars_ctx, &eventflag,
+ 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, &task2_id, NULL,
- mpu2_prog.elf_image, MARS_TASK_CONTEXT_SAVE_SIZE_MAX);
+ /* AND */
+ ret = mars_task_event_flag_set(eventflag, pattern[i]);
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);
+ task_args.type.u32[0] = pattern[i];
+ task_args.type.u32[1] = MARS_TASK_EVENT_FLAG_MASK_AND;
+ task_args.type.u64[1] = eventflag;
+ ret = mars_task_schedule(&task_id, &task_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);
+ ret = mars_task_wait(&task_id, &exit_code);
+ MARS_TEST_ASSERT_ERROR(exit_code, MARS_SUCCESS);
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]);
+ /* OR */
+ ret = mars_task_event_flag_set(eventflag, pattern[i]);
MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
- ret = mars_task_wait(&task1_id, &exit_code);
+ task_args.type.u32[1] = MARS_TASK_EVENT_FLAG_MASK_OR;
+ ret = mars_task_schedule(&task_id, &task_args, 0);
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);
+ ret = mars_task_wait(&task_id, &exit_code);
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);
+ MARS_TEST_ASSERT_ERROR(exit_code, MARS_SUCCESS);
- ret = mars_task_event_flag_destroy(host_to_mpu_or[i]);
+ ret = mars_task_event_flag_destroy(eventflag);
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_ctx);
MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
diff --git a/tests/TFP/TFP_36_010/mpu.c b/tests/TFP/TFP_36_010/mpu.c
new file mode 100644
index 0000000..1c54896
--- /dev/null
+++ b/tests/TFP/TFP_36_010/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/task.h>
+#include <mars_task_test.h>
+#define EVENT_FLAG_LENGTH (sizeof(uint32_t) * 8)
+
+int mars_task_main(const struct mars_task_args *task_args)
+{
+ int ret, i;
+ uint32_t flags = task_args->type.u32[0];
+ uint32_t mode = task_args->type.u32[1];
+ uint64_t eventflag = task_args->type.u64[1];
+
+ ret = mars_task_event_flag_try_wait(eventflag, flags, mode, NULL);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+
+ /* check if all bits are still set */
+ for (i = 0; i < EVENT_FLAG_LENGTH; i++) {
+ if (!(flags & (1 << i)))
+ continue;
+ ret = mars_task_event_flag_try_wait(eventflag, 1 << i,
+ MARS_TASK_EVENT_FLAG_MASK_OR, NULL);
+ 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
deleted file mode 100644
index 995ffdd..0000000
--- a/tests/TFP/TFP_36_010/mpu1.c
+++ /dev/null
@@ -1,63 +0,0 @@
-/*
- * Copyright 2008 Sony Corporation
- *
- *
- * Permission is hereby granted, free of charge, to any person obtaining a copy
- * of this software and associated documentation files (the "Software"), to deal
- * in the Software without restriction, including without limitation the rights
- * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
- * copies of the Software, and to permit persons to whom the Software is
- * furnished to do so, subject to the following conditions:
- *
- * The above copyright notice and this permission notice shall be included in
- * all copies or substantial portions of the Software.
- *
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
- * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
- * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
- * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
- * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, 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.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
deleted file mode 100644
index b627cca..0000000
--- a/tests/TFP/TFP_36_010/mpu2.c
+++ /dev/null
@@ -1,64 +0,0 @@
-/*
- * Copyright 2008 Sony Corporation
- *
- *
- * Permission is hereby granted, free of charge, to any person obtaining a copy
- * of this software and associated documentation files (the "Software"), to deal
- * in the Software without restriction, including without limitation the rights
- * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
- * copies of the Software, and to permit persons to whom the Software is
- * furnished to do so, subject to the following conditions:
- *
- * The above copyright notice and this permission notice shall be included in
- * all copies or substantial portions of the Software.
- *
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
- * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
- * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
- * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
- * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, 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.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_012/Makefile b/tests/TFP/TFP_36_012/Makefile
index 72cf999..ecbce33 100644
--- a/tests/TFP/TFP_36_012/Makefile
+++ b/tests/TFP/TFP_36_012/Makefile
@@ -22,7 +22,7 @@
#
top_srcdir = ../..
-test_objs = host.o mpu1.task_eo mpu2.task_eo mpu3.task_eo
+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_012/host.c b/tests/TFP/TFP_36_012/host.c
index 32e8fa7..a2f5489 100644
--- a/tests/TFP/TFP_36_012/host.c
+++ b/tests/TFP/TFP_36_012/host.c
@@ -28,19 +28,20 @@
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 uint32_t pattern[] = {
+ 0x00000001,
+ 0x0000CAFE,
+ 0x10203040,
+ 0xffffffff,
};
+#define NUM_PATTERNS (sizeof(pattern)/sizeof(pattern[0]))
+#define EVENT_FLAG_LENGTH (sizeof(uint32_t) * 8)
+
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];
+static struct mars_task_id task1_id, task2_id;
+static struct mars_task_args task_args;
+static uint64_t eventflag;
int main(void)
{
@@ -50,98 +51,61 @@ int main(void)
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_SIZE_MAX);
- MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
-
- ret = mars_task_create(mars_ctx, &task2_id, NULL,
- mpu2_prog.elf_image, MARS_TASK_CONTEXT_SAVE_SIZE_MAX);
- 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);
+ ret = mars_task_create(mars_ctx, &task1_id, NULL,
+ mpu1_prog.elf_image, MARS_TASK_CONTEXT_SAVE_SIZE_MAX);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+ ret = mars_task_create(mars_ctx, &task2_id, NULL,
+ mpu2_prog.elf_image, MARS_TASK_CONTEXT_SAVE_SIZE_MAX);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
- /* set bits for AND wait condition */
- ret = mars_task_create(mars_ctx, &task3_id, NULL,
- mpu3_prog.elf_image, MARS_TASK_CONTEXT_SAVE_SIZE_MAX);
+ for (i = 0; i < NUM_PATTERNS; i++) {
+ ret = mars_task_event_flag_create(mars_ctx, &eventflag,
+ MARS_TASK_EVENT_FLAG_MPU_TO_MPU,
+ MARS_TASK_EVENT_FLAG_CLEAR_MANUAL);
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);
+ task_args.type.u32[0] = pattern[i];
+ task_args.type.u32[1] = MARS_TASK_EVENT_FLAG_MASK_AND;
+ task_args.type.u64[1] = eventflag;
- ret = mars_task_wait(&task3_id, &exit_code);
+ /* AND */
+ ret = mars_task_schedule(&task2_id, &task_args, 0);
MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+ ret = mars_task_wait(&task2_id, &exit_code);
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_SIZE_MAX);
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);
+ ret = mars_task_schedule(&task1_id, &task_args, 0);
MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
- ret = mars_task_wait(&task3_id, &exit_code);
- MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+ ret = mars_task_wait(&task1_id, &exit_code);
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);
+ /* OR */
+ ret = mars_task_schedule(&task2_id, &task_args, 0);
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);
+ task_args.type.u32[1] = MARS_TASK_EVENT_FLAG_MASK_OR;
+ ret = mars_task_schedule(&task1_id, &task_args, 0);
MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
- ret = mars_task_event_flag_destroy(mpu_to_mpu_and[i]);
+ ret = mars_task_wait(&task1_id, &exit_code);
+ MARS_TEST_ASSERT_ERROR(exit_code, MARS_SUCCESS);
MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
- ret = mars_task_event_flag_destroy(mpu_to_mpu_or[i]);
+ ret = mars_task_event_flag_destroy(eventflag);
MARS_TEST_ASSERT_ERROR(ret, 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);
diff --git a/tests/TFP/TFP_36_012/mpu1.c b/tests/TFP/TFP_36_012/mpu1.c
index 037c7b1..18828eb 100644
--- a/tests/TFP/TFP_36_012/mpu1.c
+++ b/tests/TFP/TFP_36_012/mpu1.c
@@ -24,40 +24,26 @@
#include <mars/task.h>
#include <mars_task_test.h>
+#define EVENT_FLAG_LENGTH (sizeof(uint32_t) * 8)
+
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;
+ int ret, i;
+ uint32_t flags = task_args->type.u32[0];
+ uint32_t mode = task_args->type.u32[1];
+ uint64_t eventflag = task_args->type.u64[1];
+
+ ret = mars_task_event_flag_try_wait(eventflag, flags, mode, NULL);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
- /* 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)
+ /* check if all bits are still set */
+ for (i = 0; i < EVENT_FLAG_LENGTH; i++) {
+ if (!(flags & (1 << i)))
continue;
- else
- MARS_TEST_ASSERT_ERROR(ret, 0);
+ ret = mars_task_event_flag_try_wait(eventflag, 1 << i,
+ 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_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
index 0b9e208..4ead8e3 100644
--- a/tests/TFP/TFP_36_012/mpu2.c
+++ b/tests/TFP/TFP_36_012/mpu2.c
@@ -27,38 +27,12 @@
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;
+ uint32_t flags = task_args->type.u32[0];
+ uint64_t eventflag = task_args->type.u64[1];
/* 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);
- }
+ ret = mars_task_event_flag_set(eventflag, flags);
+ 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_43_004/host.c b/tests/TFP/TFP_43_004/host.c
index d3feb8c..790fe7f 100644
--- a/tests/TFP/TFP_43_004/host.c
+++ b/tests/TFP/TFP_43_004/host.c
@@ -37,7 +37,7 @@ static uint64_t queue;
int main(void)
{
- int exit_code, ret;
+ int exit_code, ret, role;
uint32_t count;
ret = mars_context_create(&mars, 0, 0);
@@ -51,37 +51,38 @@ int main(void)
MARS_TASK_CONTEXT_SAVE_SIZE_MAX);
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);
+ for (role = 0; role < 1; role ++) {
+ ret = mars_task_queue_create(
+ mars,
+ &queue,
+ 16,
+ QUEUE_DEPTH,
+ MARS_TASK_QUEUE_MPU_TO_HOST);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
- MARS_TEST_ASSERT(count == 0);
+ ret = mars_task_queue_count(queue, &count);
+ 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);
+ MARS_TEST_ASSERT(count == 0);
- usleep(100000);
+ task_args.type.u64[0] = queue;
+ task_args.type.u64[1] = role;
- mars_task_queue_count(queue, &count);
- MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+ ret = mars_task_schedule(&task_id, &task_args, 0);
+ 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_wait(&task_id, &exit_code);
- MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
- MARS_TEST_ASSERT_EQUAL(exit_code, 0);
+ mars_task_queue_count(queue, &count);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
- ret = mars_task_queue_destroy(queue);
- MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+ MARS_TEST_ASSERT(count == 1);
+ 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);
diff --git a/tests/TFP/TFP_43_004/mpu.c b/tests/TFP/TFP_43_004/mpu.c
index 4dd2158..3d35313 100644
--- a/tests/TFP/TFP_43_004/mpu.c
+++ b/tests/TFP/TFP_43_004/mpu.c
@@ -31,11 +31,13 @@ int mars_task_main(const struct mars_task_args *task_args)
{
int ret;
uint64_t queue_ea = task_args->type.u64[0];
+ uint64_t role = task_args->type.u64[1];
- ret = mars_task_queue_try_push(queue_ea, queue_item);
+ if (role)
+ ret = mars_task_queue_try_push(queue_ea, queue_item);
+ else
+ 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_012/host.c b/tests/TFP/TFP_43_012/host.c
index 2998669..fc125b7 100644
--- a/tests/TFP/TFP_43_012/host.c
+++ b/tests/TFP/TFP_43_012/host.c
@@ -63,7 +63,9 @@ int main(void)
ret = mars_task_schedule(&task_id, &task_args, 0);
MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
- usleep(100000);
+ 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);
@@ -78,10 +80,6 @@ int main(void)
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);
diff --git a/tests/TFP/TFP_43_012/mpu.c b/tests/TFP/TFP_43_012/mpu.c
index a38de4f..1e03969 100644
--- a/tests/TFP/TFP_43_012/mpu.c
+++ b/tests/TFP/TFP_43_012/mpu.c
@@ -37,8 +37,5 @@ int mars_task_main(const struct mars_task_args *task_args)
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_001/host.c b/tests/TFP/TFP_45_001/host.c
index 2d5c015..89d3b39 100644
--- a/tests/TFP/TFP_45_001/host.c
+++ b/tests/TFP/TFP_45_001/host.c
@@ -21,6 +21,10 @@
* THE SOFTWARE.
*/
+#include <sys/types.h>
+#include <linux/unistd.h>
+#include <errno.h>
+#include <pthread.h>
#include <libspe2.h>
#include <mars/task.h>
#include <mars_test.h>
@@ -32,25 +36,78 @@ 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)));
+static uint64_t queue_item[2] __attribute__((aligned(16)));
-int main(void)
+static pid_t thread_pid;
+static uint32_t thread_start;
+
+/*
+ * N O T E:
+ * This test uses Linux specific feature, in other world, you can not
+ * run this test program on the system other than Linux.
+ */
+
+int is_thread_blocked(pid_t tid)
{
- int i, exit_code, ret;
- uint32_t tb_freq;
+ FILE *tstat;
+ char path[128];
+ char buf[1024];
+ int n;
+
+ snprintf(path, sizeof(path) - 1, "/proc/%d/status", tid);
+ tstat = fopen(path, "r");
+ MARS_TEST_ASSERT(tstat != NULL);
+
+ while ((n = fscanf(tstat, "State:\t%s\n", buf)) != EOF) {
+ if (n == 1)
+ break;
+ else
+ fgetc(tstat);
+ }
+ fclose(tstat);
+
+ switch (buf[0]) {
+ case 'R': /* running */
+ case 'D': /* disk sleep */
+ return 0;
+ break;
+ case 'S': /* sleep */
+ return 1;
+ break;
+ case 'T': /* trace stopped / stopped */
+ case 'Z': /* zonbie */
+ case 'X': /* dead */
+ default:
+ MARS_TEST_ASSERT(0);
+ return 0;
+ break;
+ };
+}
- ret = mars_test_get_timebase_freq(&tb_freq);
- MARS_TEST_ASSERT_EQUAL(ret, 0);
+pid_t linux_get_thread_id(void)
+{
+ return syscall(__NR_gettid);
+};
- ret = mars_context_create(&mars, 0, 0);
+void * last_pusher(void *arg)
+{
+ int ret;
+
+ thread_pid = linux_get_thread_id(); /* Linux specific */
+ mars_test_counter_set(&thread_start, 1);
+
+ ret = mars_task_queue_push(queue, queue_item);
MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
- ret = mars_task_create(
- mars,
- &task_id,
- "45001",
- mpu_prog.elf_image,
- MARS_TASK_CONTEXT_SAVE_SIZE_MAX);
+ return 0;
+}
+
+int main(void)
+{
+ int i, exit_code, ret;
+ pthread_t pusher;
+
+ ret = mars_context_create(&mars, 0, 0);
MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
ret = mars_task_queue_create(
@@ -61,22 +118,42 @@ int main(void)
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++) {
+ /*
+ * push QUEUE_DEPTH of data to queue
+ */
+ for (i = 0; i < QUEUE_DEPTH; 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);
+ queue_item[0] = queue_item[1] = QUEUE_DEPTH;
+ ret = pthread_create(&pusher, NULL, last_pusher, NULL);
+ MARS_TEST_ASSERT_EQUAL(ret, 0);
+
+ mars_test_counter_wait(&thread_start, 1);
+ /*
+ * Do busy waiting for the thread state being S (sleeping).
+ * The thread should be going to be blocked in mars_task_queue_push()
+ * so the loop should exit;
+ */
+ while (!is_thread_blocked(thread_pid))
+ ;
+ /*
+ * Invoke the popper
+ */
+ ret = mars_task_create(
+ mars,
+ &task_id,
+ "45001",
+ mpu_prog.elf_image,
+ MARS_TASK_CONTEXT_SAVE_SIZE_MAX);
+ 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);
@@ -88,6 +165,9 @@ int main(void)
ret = mars_task_destroy(&task_id);
MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+ ret = pthread_join(pusher, NULL);
+ MARS_TEST_ASSERT(ret == 0);
+
ret = mars_context_destroy(mars);
MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
diff --git a/tests/TFP/TFP_45_001/mpu.c b/tests/TFP/TFP_45_001/mpu.c
index b58deac..97a3c3a 100644
--- a/tests/TFP/TFP_45_001/mpu.c
+++ b/tests/TFP/TFP_45_001/mpu.c
@@ -32,18 +32,11 @@ 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++) {
+ 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);
}
diff --git a/tests/TFP/TFP_45_002/Makefile b/tests/TFP/TFP_45_002/Makefile
index 432135a..ecbce33 100644
--- a/tests/TFP/TFP_45_002/Makefile
+++ b/tests/TFP/TFP_45_002/Makefile
@@ -22,7 +22,7 @@
#
top_srcdir = ../..
-test_objs = host.o mpu.task_eo
+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_002/host.c b/tests/TFP/TFP_45_002/host.c
index 8a5bc6b..60bb77d 100644
--- a/tests/TFP/TFP_45_002/host.c
+++ b/tests/TFP/TFP_45_002/host.c
@@ -27,27 +27,23 @@
#include <mars_test.h>
#include "host_and_mpu.h"
-extern spe_program_handle_t mpu_prog;
+extern spe_program_handle_t mpu1_prog, mpu2_prog;
static struct mars_context *mars;
-static struct mars_task_id task_id;
+static struct mars_task_id task1_id, task2_id;
static struct mars_task_args task_args;
static uint64_t queue;
-static uint64_t queue_item[2], mpu_answer __attribute__((aligned(16)));
+static uint64_t queue_item[2] __attribute__((aligned(16)));
+static uint32_t counter __attribute__((aligned(128)));
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_SIZE_MAX);
+ /*
+ * Make mars context with one usable mpu
+ */
+ ret = mars_context_create(&mars, 1, 0);
MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
ret = mars_task_queue_create(
@@ -58,17 +54,56 @@ int main(void)
MARS_TASK_QUEUE_MPU_TO_HOST);
MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
- mpu_answer = 0;
+ /*
+ * Create pushing task
+ */
+ ret = mars_task_create(
+ mars,
+ &task1_id,
+ "45002",
+ mpu1_prog.elf_image,
+ MARS_TASK_CONTEXT_SAVE_SIZE_MAX);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
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);
+ task_args.type.u64[1] = mars_ptr_to_ea(&counter);
+ ret = mars_task_schedule(&task1_id, &task_args, 0);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+
+ /*
+ * Wait for QUEUE_DEPTH items of data pushed
+ */
+ mars_test_counter_wait(&counter, 1);
+
+ /*
+ * Tell the task to push the last item
+ */
+ mars_test_counter_add(&counter, 1);
+
+ /*
+ * Schedule another task and see if it will be done
+ */
+ ret = mars_task_create(
+ mars,
+ &task2_id,
+ "45002",
+ mpu2_prog.elf_image,
+ MARS_TASK_CONTEXT_SAVE_SIZE_MAX);
MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
- usleep(100000);
+ ret = mars_task_schedule(&task2_id, &task_args, 0);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
- mpu_answer = 1;
+ ret = mars_task_wait(&task2_id, &exit_code);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+ MARS_TEST_ASSERT_EQUAL(exit_code, 0);
+
+ ret = mars_task_destroy(&task2_id);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+ /*
+ * Start pop
+ */
for (i = 0; i < QUEUE_DEPTH+1; i++) {
ret = mars_task_queue_pop(queue, queue_item);
MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
@@ -76,14 +111,17 @@ int main(void)
MARS_TEST_ASSERT(queue_item[0] == i && queue_item[1] == i);
}
- ret = mars_task_wait(&task_id, &exit_code);
+ /*
+ * Wait for the pusher's exit
+ */
+ ret = mars_task_wait(&task1_id, &exit_code);
MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
MARS_TEST_ASSERT_EQUAL(exit_code, 0);
- ret = mars_task_queue_destroy(queue);
+ ret = mars_task_destroy(&task1_id);
MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
- ret = mars_task_destroy(&task_id);
+ ret = mars_task_queue_destroy(queue);
MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
ret = mars_context_destroy(mars);
diff --git a/tests/TFP/TFP_45_002/mpu.c b/tests/TFP/TFP_45_002/mpu1.c
index 6eb2041..1928d18 100644
--- a/tests/TFP/TFP_45_002/mpu.c
+++ b/tests/TFP/TFP_45_002/mpu1.c
@@ -32,19 +32,22 @@ 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;
+ uint64_t counter = task_args->type.u64[1];
int i, ret;
- for (i = 0; i < QUEUE_DEPTH+1; i++) {
+ for (i = 0; i < QUEUE_DEPTH; 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_test_counter_add(counter, 1);
+ mars_test_counter_wait(counter, 2);
+
+ queue_item[0] = queue_item[1] = QUEUE_DEPTH;
+ ret = mars_task_queue_push(queue_ea, queue_item);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
mars_task_exit(0);
diff --git a/tests/TFP/TFP_34_007/mpu3.c b/tests/TFP/TFP_45_002/mpu2.c
index e8f587f..d7a69ec 100644
--- a/tests/TFP/TFP_34_007/mpu3.c
+++ b/tests/TFP/TFP_45_002/mpu2.c
@@ -21,18 +21,13 @@
* THE SOFTWARE.
*/
-#include <mars/task.h>
-#include <mars_task_test.h>
+#include <string.h>
#include <spu_mfcio.h>
+#include <mars/task.h>
+#include "mars_task_test.h"
+#include "host_and_mpu.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_45_003/Makefile b/tests/TFP/TFP_45_003/Makefile
index ecbce33..72cf999 100644
--- a/tests/TFP/TFP_45_003/Makefile
+++ b/tests/TFP/TFP_45_003/Makefile
@@ -22,7 +22,7 @@
#
top_srcdir = ../..
-test_objs = host.o mpu1.task_eo mpu2.task_eo
+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_45_003/host.c b/tests/TFP/TFP_45_003/host.c
index 72d7ac2..c29194a 100644
--- a/tests/TFP/TFP_45_003/host.c
+++ b/tests/TFP/TFP_45_003/host.c
@@ -26,23 +26,19 @@
#include <mars_test.h>
#include "host_and_mpu.h"
-extern spe_program_handle_t mpu1_prog, mpu2_prog;
+extern spe_program_handle_t mpu1_prog, mpu2_prog, mpu3_prog;
static struct mars_context *mars;
-static struct mars_task_id pusher_task_id, poper_task_id;
+static struct mars_task_id pusher_task_id, poper_task_id, id;
static struct mars_task_args task_args;
static uint64_t queue;
-static uint64_t mpu_answer __attribute__((aligned(16)));
+static uint32_t counter __attribute__((aligned(128)));
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);
+ ret = mars_context_create(&mars, 1, 0);
MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
ret = mars_task_create(
@@ -61,6 +57,14 @@ int main(void)
MARS_TASK_CONTEXT_SAVE_SIZE_MAX);
MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+ ret = mars_task_create(
+ mars,
+ &id,
+ "45003",
+ mpu3_prog.elf_image,
+ MARS_TASK_CONTEXT_SAVE_SIZE_MAX);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+
ret = mars_task_queue_create(
mars,
&queue,
@@ -69,14 +73,22 @@ int main(void)
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;
+ task_args.type.u64[1] = mars_ptr_to_ea(&counter);
ret = mars_task_schedule(&pusher_task_id, &task_args, 0);
MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+ mars_test_counter_wait(&counter, 1);
+
+ ret = mars_task_schedule(&id, &task_args, 0);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+
+ ret = mars_task_wait(&id, &exit_code);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+ MARS_TEST_ASSERT_EQUAL(exit_code, 0);
+ /*
+ * Start poper
+ */
ret = mars_task_schedule(&poper_task_id, &task_args, 0);
MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
@@ -91,6 +103,9 @@ int main(void)
ret = mars_task_queue_destroy(queue);
MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+ ret = mars_task_destroy(&id);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+
ret = mars_task_destroy(&pusher_task_id);
MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
diff --git a/tests/TFP/TFP_45_003/mpu1.c b/tests/TFP/TFP_45_003/mpu1.c
index 8a50c68..d77629b 100644
--- a/tests/TFP/TFP_45_003/mpu1.c
+++ b/tests/TFP/TFP_45_003/mpu1.c
@@ -32,22 +32,20 @@ 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 counter = task_args->type.u64[1];
int i, ret;
- uint64_t mpu_answer;
-
- for (i = 0; i < QUEUE_DEPTH+1; i++) {
+ for (i = 0; i < QUEUE_DEPTH; 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_test_counter_add(counter, 1);
- mars_task_exit(0);
+ queue_item[0] = queue_item[1] = QUEUE_DEPTH;
+ ret = mars_task_queue_push(queue_ea, queue_item);
return 0;
}
diff --git a/tests/TFP/TFP_45_003/mpu2.c b/tests/TFP/TFP_45_003/mpu2.c
index b58deac..7bbfbfc 100644
--- a/tests/TFP/TFP_45_003/mpu2.c
+++ b/tests/TFP/TFP_45_003/mpu2.c
@@ -32,22 +32,14 @@ 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++) {
+ 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_003/mpu3.c b/tests/TFP/TFP_45_003/mpu3.c
new file mode 100644
index 0000000..2aac5df
--- /dev/null
+++ b/tests/TFP/TFP_45_003/mpu3.c
@@ -0,0 +1,33 @@
+/*
+ * Copyright 2009 Sony Corporation
+ *
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a copy
+ * of this software and associated documentation files (the "Software"), to deal
+ * in the Software without restriction, including without limitation the rights
+ * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+ * copies of the Software, and to permit persons to whom the Software is
+ * furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included in
+ * all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+ * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ * LIABILITY, WHETHER IN AN ACTION OF 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/task.h>
+#include "mars_task_test.h"
+#include "host_and_mpu.h"
+
+int mars_task_main(const struct mars_task_args *task_args)
+{
+ return 0;
+}
diff --git a/tests/TFP/TFP_45_004/host.c b/tests/TFP/TFP_45_004/host.c
index b4c2969..5070c41 100644
--- a/tests/TFP/TFP_45_004/host.c
+++ b/tests/TFP/TFP_45_004/host.c
@@ -49,11 +49,12 @@ 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 pthread_barrier_t barrier;
+
static void *thread_proc(void *ptr)
{
int ret;
@@ -62,8 +63,7 @@ static void *thread_proc(void *ptr)
uint32_t count = (uint32_t)task_args->type.u32[1];
/* wait for start */
- while (!shared_resource)
- usleep(100);
+ pthread_barrier_wait(&barrier);
data[count].val1 = (uint64_t)id;
data[count].val2 = (uint64_t)count;
@@ -83,7 +83,8 @@ int main(void)
MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
for (i = 0; i < NUM_LOOP; i++) {
- shared_resource = 0;
+ ret = pthread_barrier_init(&barrier, NULL, depth_size[i]);
+ MARS_TEST_ASSERT(ret == 0);
ret = mars_task_queue_create(
mars_ctx,
@@ -97,18 +98,15 @@ int main(void)
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]);
+ ret = pthread_create(&thread[num], NULL,
+ thread_proc, &thread_args[num]);
+ MARS_TEST_ASSERT(ret == 0);
}
/* create pop task */
ret = mars_task_create(mars_ctx, &task_id, NULL,
mpu_prog.elf_image, MARS_TASK_CONTEXT_SAVE_SIZE_MAX);
- /* 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);
@@ -129,6 +127,9 @@ int main(void)
ret = mars_task_queue_destroy(host_to_mpu[i]);
MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+
+ ret = pthread_barrier_destroy(&barrier);
+ MARS_TEST_ASSERT(ret == MARS_SUCCESS);
}
ret = mars_context_destroy(mars_ctx);
diff --git a/tests/TFP/TFP_45_005/host.c b/tests/TFP/TFP_45_005/host.c
index b8aae29..9d13504 100644
--- a/tests/TFP/TFP_45_005/host.c
+++ b/tests/TFP/TFP_45_005/host.c
@@ -48,7 +48,8 @@ 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 uint32_t notify __attribute((aligned(128)));
+static uint32_t counter __attribute((aligned(128)));
static struct queue_entry data;
static void check_queue(uint64_t id, uint64_t num)
@@ -80,12 +81,16 @@ int main(void)
int ret, i;
int32_t exit_code;
uint32_t num;
+ int num_mpu;
+
+ num_mpu = 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++) {
- notify[0] = 0;
+ mars_test_counter_set(&notify, 0);
+ mars_test_counter_set(&counter, 0);
ret = mars_task_queue_create(
mars_ctx,
@@ -102,17 +107,21 @@ int main(void)
MARS_TASK_CONTEXT_SAVE_SIZE_MAX);
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.u32[0] = i;
+ task_args.type.u32[1] = num;
+ task_args.type.u64[1] = mpu_to_host[i];
+ task_args.type.u64[2] = mars_ptr_to_ea(&counter);
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);
+ if (num_mpu < depth_size[i])
+ mars_test_counter_wait(&counter, num_mpu);
+ else
+ mars_test_counter_wait(&counter, depth_size[i]);
+ mars_test_counter_set(&notify, 1);
for (num = 0; num < depth_size[i]; num++) {
ret = mars_task_wait(&task_id[num], &exit_code);
diff --git a/tests/TFP/TFP_45_005/mpu.c b/tests/TFP/TFP_45_005/mpu.c
index 5270cfc..322b588 100644
--- a/tests/TFP/TFP_45_005/mpu.c
+++ b/tests/TFP/TFP_45_005/mpu.c
@@ -34,14 +34,14 @@ 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 mpu_to_host_ea = task_args->type.u64[1];
+ uint64_t counter_ea = task_args->type.u64[2];
uint64_t notify_ea = task_args->type.u64[3];
- data.val1 = id;
- data.val2 = num;
+ data.val1 = task_args->type.u32[0];
+ data.val2 = task_args->type.u32[1];
+ mars_test_counter_add(counter_ea, 1);
mars_test_counter_wait(notify_ea, 1);
ret = mars_task_queue_push(mpu_to_host_ea, &data);
diff --git a/tests/TFP/TFP_45_006/host.c b/tests/TFP/TFP_45_006/host.c
index 9a82922..1b71850 100644
--- a/tests/TFP/TFP_45_006/host.c
+++ b/tests/TFP/TFP_45_006/host.c
@@ -49,19 +49,24 @@ 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 uint32_t notify __attribute((aligned(128)));
+static uint32_t counter __attribute((aligned(128)));
int main(void)
{
int ret, i;
int32_t exit_code;
uint32_t num;
+ int num_mpu;
+
+ num_mpu = 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++) {
- notify[0] = 0;
+ mars_test_counter_set(&notify, 0);
+ mars_test_counter_set(&counter, 0);
ret = mars_task_queue_create(
mars_ctx,
@@ -78,9 +83,10 @@ int main(void)
MARS_TASK_CONTEXT_SAVE_SIZE_MAX);
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.u32[0] = i;
+ task1_args.type.u32[1] = num;
+ task1_args.type.u64[1] = mpu_to_mpu[i];
+ task1_args.type.u64[2] = mars_ptr_to_ea(&counter);
task1_args.type.u64[3] = mars_ptr_to_ea(&notify);
ret = mars_task_schedule(&task1_id[num],
&task1_args, 0);
@@ -92,8 +98,11 @@ int main(void)
mpu2_prog.elf_image, MARS_TASK_CONTEXT_SAVE_SIZE_MAX);
/* start push task at the same time */
- sleep(1);
- mars_test_counter_set(&notify[0], 1);
+ if (num_mpu < depth_size[i])
+ mars_test_counter_wait(&counter, num_mpu);
+ else
+ mars_test_counter_wait(&counter, depth_size[i]);
+ mars_test_counter_set(&notify, 1);
for (num = 0; num < depth_size[i]; num++) {
ret = mars_task_wait(&task1_id[num], &exit_code);
@@ -102,9 +111,9 @@ int main(void)
}
/* 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];
+ task2_args.type.u64[1] = mpu_to_mpu[i];
+ task2_args.type.u32[0] = i;
+ task2_args.type.u32[1] = depth_size[i];
ret = mars_task_schedule(&task2_id, &task2_args, 0);
MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
diff --git a/tests/TFP/TFP_45_006/mpu1.c b/tests/TFP/TFP_45_006/mpu1.c
index 38d1b95..21f52b1 100644
--- a/tests/TFP/TFP_45_006/mpu1.c
+++ b/tests/TFP/TFP_45_006/mpu1.c
@@ -34,14 +34,14 @@ 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 mpu_to_mpu_ea = task_args->type.u64[1];
+ uint64_t counter_ea = task_args->type.u64[2];
uint64_t notify_ea = task_args->type.u64[3];
- data.val1 = id;
- data.val2 = num;
+ data.val1 = task_args->type.u32[0];
+ data.val2 = task_args->type.u32[1];
+ mars_test_counter_add(counter_ea, 1);
mars_test_counter_wait(notify_ea, 1);
ret = mars_task_queue_push(mpu_to_mpu_ea, &data);
diff --git a/tests/TFP/TFP_45_006/mpu2.c b/tests/TFP/TFP_45_006/mpu2.c
index 7bc93fd..308f54d 100644
--- a/tests/TFP/TFP_45_006/mpu2.c
+++ b/tests/TFP/TFP_45_006/mpu2.c
@@ -33,9 +33,9 @@ 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 id = task_args->type.u32[0];
+ uint64_t num = task_args->type.u32[1];
+ uint64_t mpu_to_mpu_ea = task_args->type.u64[1];
uint64_t sum, sum_q;
uint32_t count;
diff --git a/tests/TFP/TFP_45_007/host.c b/tests/TFP/TFP_45_007/host.c
index c03c468..2e86380 100644
--- a/tests/TFP/TFP_45_007/host.c
+++ b/tests/TFP/TFP_45_007/host.c
@@ -49,8 +49,10 @@ 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 uint32_t counter __attribute((aligned(16)));
+static uint32_t notify __attribute((aligned(16)));
static struct queue_entry data[Q_DEPTH];
+static pthread_barrier_t barrier;
static pthread_t thread[Q_DEPTH];
static void *thread_proc(void *ptr)
@@ -60,9 +62,11 @@ static void *thread_proc(void *ptr)
uint32_t id = (uint32_t)task_args->type.u32[0];
uint32_t count = (uint32_t)task_args->type.u32[1];
+ /* sync threads */
+ pthread_barrier_wait(&barrier);
+
/* wait for start */
- while (!shared_resource)
- usleep(100);
+ mars_test_counter_wait(&notify, 1);
data[count].val1 = id;
ret = mars_task_queue_push(host_to_mpu[id], &data[count]);
@@ -76,12 +80,16 @@ int main(void)
int ret, i;
int32_t exit_code;
uint32_t num, count;
+ int num_mpu;
+
+ num_mpu = 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++) {
- shared_resource = 0;
+ mars_test_counter_set(&notify, 0);
+ mars_test_counter_set(&counter, 0);
ret = mars_task_queue_create(
mars_ctx,
@@ -91,6 +99,9 @@ int main(void)
MARS_TASK_QUEUE_HOST_TO_MPU);
MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+ ret = pthread_barrier_init(&barrier, NULL, depth_size[i]);
+ MARS_TEST_ASSERT(ret == 0);
+
for (num = 0; num < depth_size[i]; num++) {
/* create push thread */
thread_args[num].type.u32[0] = (uint32_t)i;
@@ -104,16 +115,22 @@ int main(void)
mpu_prog.elf_image, MARS_TASK_CONTEXT_SAVE_SIZE_MAX);
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;
+ task_args[num].type.u32[0] = i;
+ task_args[num].type.u64[1] = host_to_mpu[i];
+ task_args[num].type.u64[2] = mars_ptr_to_ea(&counter);
+ task_args[num].type.u64[3] = 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 the same time */
- sleep(1);
- shared_resource = 1;
+ if (num_mpu < depth_size[i])
+ mars_test_counter_wait(&counter, num_mpu);
+ else
+ mars_test_counter_wait(&counter, depth_size[i]);
+ mars_test_counter_set(&notify, 1);
for (num = 0; num < depth_size[i]; num++) {
ret = mars_task_wait(&task_id[num], &exit_code);
@@ -131,6 +148,9 @@ int main(void)
ret = mars_task_queue_destroy(host_to_mpu[i]);
MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+
+ ret = pthread_barrier_destroy(&barrier);
+ MARS_TEST_ASSERT(ret == 0);
}
ret = mars_context_destroy(mars_ctx);
diff --git a/tests/TFP/TFP_45_007/mpu.c b/tests/TFP/TFP_45_007/mpu.c
index 7bb1bd8..07416c4 100644
--- a/tests/TFP/TFP_45_007/mpu.c
+++ b/tests/TFP/TFP_45_007/mpu.c
@@ -34,8 +34,13 @@ 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];
+ uint32_t id = task_args->type.u32[0];
+ uint64_t host_to_mpu_ea = task_args->type.u64[1];
+ uint64_t counter_ea = task_args->type.u64[2];
+ uint64_t notify_ea = task_args->type.u64[3];
+
+ mars_test_counter_add(counter_ea, 1);
+ mars_test_counter_wait(notify_ea, 1);
ret = mars_task_queue_peek(host_to_mpu_ea, &data);
MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
diff --git a/tests/TFP/TFP_45_008/host.c b/tests/TFP/TFP_45_008/host.c
index 7c44cfa..cb8da70 100644
--- a/tests/TFP/TFP_45_008/host.c
+++ b/tests/TFP/TFP_45_008/host.c
@@ -45,11 +45,13 @@ static uint32_t depth_size[] =
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_args task_args[Q_DEPTH], 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 uint32_t notify __attribute((aligned(128)));
+static uint32_t counter __attribute((aligned(128)));
+static pthread_barrier_t barrier;
static struct queue_entry data[Q_DEPTH];
static pthread_t thread[Q_DEPTH];
@@ -57,8 +59,11 @@ 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];
+ uint32_t id = task_args->type.u32[0];
+ uint32_t num = task_args->type.u32[1];
+
+ pthread_barrier_wait(&barrier);
+ mars_test_counter_wait(&notify, 1);
ret = mars_task_queue_peek(mpu_to_host[id], &data[num]);
MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
@@ -74,12 +79,19 @@ int main(void)
int ret, i;
int32_t exit_code;
uint32_t num, count;
+ int num_mpu;
+
+ num_mpu = 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++) {
- notify[0] = 0;
+ mars_test_counter_set(&notify, 0);
+ mars_test_counter_set(&counter, 0);
+
+ ret = pthread_barrier_init(&barrier, NULL, depth_size[i]);
+ MARS_TEST_ASSERT(ret == 0);
ret = mars_task_queue_create(
mars_ctx,
@@ -97,22 +109,27 @@ int main(void)
MARS_TASK_CONTEXT_SAVE_SIZE_MAX);
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);
+ task_args[num].type.u32[0] = i;
+ task_args[num].type.u64[1] = mpu_to_host[i];
+ task_args[num].type.u64[2] = mars_ptr_to_ea(&counter);
+ task_args[num].type.u64[3] = mars_ptr_to_ea(&notify);
+ ret = mars_task_schedule(&task_id[num], &task_args[num], 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;
+ thread_args[num].type.u32[0] = i;
+ thread_args[num].type.u32[1] = num;
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);
+ if (num_mpu < depth_size[i])
+ mars_test_counter_wait(&counter, num_mpu);
+ else
+ mars_test_counter_wait(&counter, depth_size[i]);
+ mars_test_counter_set(&notify, 1);
for (num = 0; num < depth_size[i]; num++) {
ret = mars_task_wait(&task_id[num], &exit_code);
@@ -130,6 +147,9 @@ int main(void)
ret = mars_task_queue_destroy(mpu_to_host[i]);
MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+
+ ret = pthread_barrier_destroy(&barrier);
+ MARS_TEST_ASSERT(ret == 0);
}
ret = mars_context_destroy(mars_ctx);
diff --git a/tests/TFP/TFP_45_008/mpu.c b/tests/TFP/TFP_45_008/mpu.c
index 53c59b2..7397b98 100644
--- a/tests/TFP/TFP_45_008/mpu.c
+++ b/tests/TFP/TFP_45_008/mpu.c
@@ -34,10 +34,12 @@ 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];
+ uint32_t id = task_args->type.u32[0];
+ uint64_t mpu_to_host_ea = task_args->type.u64[1];
+ uint64_t counter_ea = task_args->type.u64[2];
+ uint64_t notify_ea = task_args->type.u64[3];
+ mars_test_counter_add(counter_ea, 1);
mars_test_counter_wait(notify_ea, 1);
data.val1 = id;
diff --git a/tests/TFP/TFP_45_010/host.c b/tests/TFP/TFP_45_010/host.c
index 3f442b2..37bccbb 100644
--- a/tests/TFP/TFP_45_010/host.c
+++ b/tests/TFP/TFP_45_010/host.c
@@ -21,6 +21,9 @@
* THE SOFTWARE.
*/
+#include <sys/types.h>
+#include <linux/unistd.h>
+#include <errno.h>
#include <pthread.h>
#include <unistd.h>
#include <mars/task.h>
@@ -47,9 +50,59 @@ 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 uint32_t notify __attribute((aligned(16)));
static pthread_t thread;
+static pid_t thread_pid;
+
+/*
+ * N O T E:
+ * This test uses Linux specific feature, in other word, you can not
+ * run this test program on the system other than Linux.
+ */
+
+int is_thread_blocked(pid_t tid)
+{
+ FILE *tstat;
+ char path[128];
+ char buf[1024];
+ int n;
+
+ snprintf(path, sizeof(path) - 1, "/proc/%d/status", tid);
+ tstat = fopen(path, "r");
+ MARS_TEST_ASSERT(tstat != NULL);
+
+ while ((n = fscanf(tstat, "State:\t%s\n", buf)) != EOF) {
+ if (n == 1)
+ break;
+ else
+ fgetc(tstat);
+ }
+ fclose(tstat);
+
+ switch (buf[0]) {
+ case 'R': /* running */
+ case 'D': /* disk sleep */
+ return 0;
+ break;
+ case 'S': /* sleep */
+ return 1;
+ break;
+ case 'T': /* trace stopped / stopped */
+ case 'Z': /* zonbie */
+ case 'X': /* dead */
+ default:
+ MARS_TEST_ASSERT(0);
+ return 0;
+ break;
+ };
+}
+
+pid_t linux_get_thread_id(void)
+{
+ return syscall(__NR_gettid);
+};
+
static void *thread_proc(void *ptr)
{
int ret, i;
@@ -57,13 +110,14 @@ static void *thread_proc(void *ptr)
uint32_t id = task_args->type.u32[0];
uint32_t num = task_args->type.u32[1];
+ thread_pid = linux_get_thread_id();
+ mars_test_counter_set(&notify, 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;
}
@@ -76,7 +130,7 @@ int main(void)
MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
for (i = 0; i < NUM_LOOP; i++) {
- shared_resource = 0;
+ mars_test_counter_set(&notify, 0);
ret = mars_task_queue_create(
mars_ctx,
@@ -92,9 +146,10 @@ int main(void)
pthread_create(&thread, NULL,
thread_proc, &thread_args);
- /* check if queue_push is blocked */
- sleep(1);
- MARS_TEST_ASSERT_EQUAL(shared_resource, 0);
+ /* wait for the thread being blocked */
+ mars_test_counter_wait(&notify, 1);
+ while (!is_thread_blocked(thread_pid))
+ ;
/* create pop task */
ret = mars_task_create(mars_ctx, &task_id, NULL,
diff --git a/tests/TFP/TFP_45_011/Makefile b/tests/TFP/TFP_45_011/Makefile
index 432135a..ecbce33 100644
--- a/tests/TFP/TFP_45_011/Makefile
+++ b/tests/TFP/TFP_45_011/Makefile
@@ -22,7 +22,7 @@
#
top_srcdir = ../..
-test_objs = host.o mpu.task_eo
+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_011/host.c b/tests/TFP/TFP_45_011/host.c
index 2005fcd..ed712ff 100644
--- a/tests/TFP/TFP_45_011/host.c
+++ b/tests/TFP/TFP_45_011/host.c
@@ -38,64 +38,82 @@ static uint32_t depth_size[] =
1,
Q_DEPTH
};
-extern spe_program_handle_t mpu_prog;
+extern spe_program_handle_t mpu1_prog, mpu2_prog;
static struct mars_context *mars_ctx;
static struct mars_task_args task_args;
-static struct mars_task_id task_id;
+static struct mars_task_id task1_id, task2_id;
-static uint64_t mpu_to_host[NUM_LOOP];
+static uint64_t mpu_to_host;
static struct queue_entry data;
-static uint32_t shared_resource __attribute((aligned(16)));
+static uint32_t counter __attribute((aligned(16)));
int main(void)
{
int ret, i;
int32_t exit_code;
- ret = mars_context_create(&mars_ctx, 0, 0);
+ ret = mars_context_create(&mars_ctx, 1, 0);
MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
for (i = 0; i < NUM_LOOP; i++) {
- shared_resource = 0;
+ mars_test_counter_set(&counter, 0);
ret = mars_task_queue_create(
mars_ctx,
- &mpu_to_host[i],
+ &mpu_to_host,
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_SIZE_MAX);
+ ret = mars_task_create(mars_ctx, &task1_id, NULL,
+ mpu1_prog.elf_image, MARS_TASK_CONTEXT_SAVE_SIZE_MAX);
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);
+ task_args.type.u32[0] = depth_size[i];
+ task_args.type.u64[1] = mpu_to_host;
+ task_args.type.u64[2] = mars_ptr_to_ea(&counter);
+ ret = mars_task_schedule(&task1_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);
+ /*
+ * check the task is already scheduled
+ */
+ mars_test_counter_wait(&counter, 1);
+
+ ret = mars_task_create(mars_ctx, &task2_id, NULL,
+ mpu2_prog.elf_image,
+ MARS_TASK_CONTEXT_SAVE_SIZE_MAX);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+
+ ret = mars_task_schedule(&task2_id, NULL, 0);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+
+ ret = mars_task_wait(&task2_id, &exit_code);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+
+ ret = mars_task_try_wait(&task1_id, &exit_code);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_ERROR_BUSY);
/* pop one */
- ret = mars_task_queue_pop(mpu_to_host[i], &data);
+ ret = mars_task_queue_pop(mpu_to_host, &data);
MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
/* check if mpu task is successfly finished */
- ret = mars_task_wait(&task_id, &exit_code);
+ 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(&task_id);
+ 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_host[i]);
+ ret = mars_task_queue_destroy(mpu_to_host);
MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
}
diff --git a/tests/TFP/TFP_45_011/mpu.c b/tests/TFP/TFP_45_011/mpu1.c
index 9218955..a11e2a2 100644
--- a/tests/TFP/TFP_45_011/mpu.c
+++ b/tests/TFP/TFP_45_011/mpu1.c
@@ -23,34 +23,30 @@
#include <mars/task.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];
+ uint32_t num_push = task_args->type.u32[0];
+ uint64_t mpu_to_host_ea = task_args->type.u64[1];
+ uint64_t counter_ea = task_args->type.u64[2];
/* last one push should be blocked */
- for (i = 0; i < num_push + 1; i++) {
+ for (i = 0; i < num_push; 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();
+ mars_test_counter_add(counter_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_011/mpu2.c b/tests/TFP/TFP_45_011/mpu2.c
new file mode 100644
index 0000000..bdc8e78
--- /dev/null
+++ b/tests/TFP/TFP_45_011/mpu2.c
@@ -0,0 +1,30 @@
+/*
+ * Copyright 2009 Sony Corporation
+ *
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a copy
+ * of this software and associated documentation files (the "Software"), to deal
+ * in the Software without restriction, including without limitation the rights
+ * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+ * copies of the Software, and to permit persons to whom the Software is
+ * furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included in
+ * all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+ * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, 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.h>
+#include <mars_task_test.h>
+
+int mars_task_main(const struct mars_task_args *task_args)
+{
+ return 0;
+}
diff --git a/tests/TFP/TFP_45_012/Makefile b/tests/TFP/TFP_45_012/Makefile
index ecbce33..72cf999 100644
--- a/tests/TFP/TFP_45_012/Makefile
+++ b/tests/TFP/TFP_45_012/Makefile
@@ -22,7 +22,7 @@
#
top_srcdir = ../..
-test_objs = host.o mpu1.task_eo mpu2.task_eo
+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_45_012/host.c b/tests/TFP/TFP_45_012/host.c
index ca28820..cd1ebc9 100644
--- a/tests/TFP/TFP_45_012/host.c
+++ b/tests/TFP/TFP_45_012/host.c
@@ -40,28 +40,29 @@ static uint32_t depth_size[] =
};
extern spe_program_handle_t mpu1_prog;
extern spe_program_handle_t mpu2_prog;
+extern spe_program_handle_t mpu3_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 struct mars_task_args task_args;
+static struct mars_task_id task1_id, task2_id, task3_id;
-static uint64_t mpu_to_mpu[NUM_LOOP];
-static uint32_t shared_resource __attribute((aligned(16)));
+static uint64_t mpu_to_mpu;
+static uint32_t counter __attribute((aligned(16)));
int main(void)
{
int ret, i;
int32_t exit_code;
- ret = mars_context_create(&mars_ctx, 0, 0);
+ ret = mars_context_create(&mars_ctx, 1, 0);
MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
for (i = 0; i < NUM_LOOP; i++) {
- shared_resource = 0;
+ mars_test_counter_set(&counter, 0);
ret = mars_task_queue_create(
mars_ctx,
- &mpu_to_mpu[i],
+ &mpu_to_mpu,
sizeof(struct queue_entry),
depth_size[i],
MARS_TASK_QUEUE_MPU_TO_MPU);
@@ -69,26 +70,38 @@ int main(void)
/* create push task */
ret = mars_task_create(mars_ctx, &task1_id, NULL,
- mpu1_prog.elf_image, MARS_TASK_CONTEXT_SAVE_SIZE_MAX);
+ mpu1_prog.elf_image,
+ MARS_TASK_CONTEXT_SAVE_SIZE_MAX);
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);
+ task_args.type.u32[0] = depth_size[i];
+ task_args.type.u64[1] = mpu_to_mpu;
+ task_args.type.u64[2] = mars_ptr_to_ea(&counter);
+ ret = mars_task_schedule(&task1_id, &task_args, 0);
MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
- /* check if queue_push is blocked */
- sleep(1);
- MARS_TEST_ASSERT_EQUAL(shared_resource, 0);
+ mars_test_counter_wait(&counter, 1);
+
+ ret = mars_task_create(mars_ctx, &task3_id, NULL,
+ mpu3_prog.elf_image,
+ MARS_TASK_CONTEXT_SAVE_SIZE_MAX);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+ ret = mars_task_schedule(&task3_id, NULL, 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_try_wait(&task1_id, &exit_code);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_ERROR_BUSY);
/* create and run pop task */
ret = mars_task_create(mars_ctx, &task2_id, NULL,
- mpu2_prog.elf_image, MARS_TASK_CONTEXT_SAVE_SIZE_MAX);
+ mpu2_prog.elf_image,
+ MARS_TASK_CONTEXT_SAVE_SIZE_MAX);
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);
+ ret = mars_task_schedule(&task2_id, &task_args, 0);
MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
ret = mars_task_wait(&task2_id, &exit_code);
@@ -106,7 +119,10 @@ int main(void)
ret = mars_task_destroy(&task2_id);
MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
- ret = mars_task_queue_destroy(mpu_to_mpu[i]);
+ ret = mars_task_destroy(&task3_id);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+
+ ret = mars_task_queue_destroy(mpu_to_mpu);
MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
}
diff --git a/tests/TFP/TFP_45_012/mpu1.c b/tests/TFP/TFP_45_012/mpu1.c
index 85642a2..d4198bf 100644
--- a/tests/TFP/TFP_45_012/mpu1.c
+++ b/tests/TFP/TFP_45_012/mpu1.c
@@ -23,34 +23,30 @@
#include <mars/task.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];
+ uint32_t num_push = task_args->type.u32[0];
+ uint64_t mpu_to_mpu_ea = task_args->type.u64[1];
+ uint64_t counter_ea = task_args->type.u64[2];
- /* last one push should be blocked */
- for (i = 0; i < num_push + 1; i++) {
+ for (i = 0; i < num_push; 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();
+ mars_test_counter_add(counter_ea, 1);
+
+ /* last one push should be blocked */
+ 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_012/mpu2.c b/tests/TFP/TFP_45_012/mpu2.c
index d2cb953..c2546c3 100644
--- a/tests/TFP/TFP_45_012/mpu2.c
+++ b/tests/TFP/TFP_45_012/mpu2.c
@@ -33,7 +33,7 @@ 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 mpu_to_mpu_ea = task_args->type.u64[1];
ret = mars_task_queue_pop(mpu_to_mpu_ea, &data);
MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
diff --git a/tests/TFP/TFP_45_012/mpu3.c b/tests/TFP/TFP_45_012/mpu3.c
new file mode 100644
index 0000000..bdc8e78
--- /dev/null
+++ b/tests/TFP/TFP_45_012/mpu3.c
@@ -0,0 +1,30 @@
+/*
+ * Copyright 2009 Sony Corporation
+ *
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a copy
+ * of this software and associated documentation files (the "Software"), to deal
+ * in the Software without restriction, including without limitation the rights
+ * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+ * copies of the Software, and to permit persons to whom the Software is
+ * furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included in
+ * all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+ * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, 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.h>
+#include <mars_task_test.h>
+
+int mars_task_main(const struct mars_task_args *task_args)
+{
+ return 0;
+}
diff --git a/tests/TFP/TFP_45_013/host.c b/tests/TFP/TFP_45_013/host.c
index 61005f7..9a6b1ad 100644
--- a/tests/TFP/TFP_45_013/host.c
+++ b/tests/TFP/TFP_45_013/host.c
@@ -50,8 +50,11 @@ 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 uint64_t host_to_mpu;
+static uint32_t notify __attribute((aligned(128)));
+static uint32_t threads __attribute((aligned(128)));
+static uint32_t tasks __attribute((aligned(128)));
+
static struct queue_entry data[Q_DEPTH];
static pthread_t thread[Q_DEPTH];
@@ -59,16 +62,15 @@ 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];
+ uint32_t count = (uint32_t)task_args->type.u32[0];
+ mars_test_counter_add(&threads, 1);
/* wait for start */
- while (!notify[0])
- usleep(100);
+ mars_test_counter_wait(&notify, 1);
data[count].val1 = count;
data[count].val2 = count + TEST_DIFF;
- ret = mars_task_queue_push(host_to_mpu[id], &data[count]);
+ ret = mars_task_queue_push(host_to_mpu, &data[count]);
MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
return NULL;
@@ -80,17 +82,21 @@ int main(void)
int32_t exit_code, chk_exit;
uint32_t num;
uint32_t chk_bit;
+ int num_mpu;
+ num_mpu = 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++) {
- notify[0] = 0;
+ mars_test_counter_set(&notify, 0);
+ mars_test_counter_set(&threads, 0);
+ mars_test_counter_set(&tasks, 0);
chk_bit = 0;
ret = mars_task_queue_create(
mars_ctx,
- &host_to_mpu[i],
+ &host_to_mpu,
sizeof(struct queue_entry),
depth_size[i],
MARS_TASK_QUEUE_HOST_TO_MPU);
@@ -100,8 +106,7 @@ int main(void)
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;
+ thread_args[num].type.u32[0] = (uint32_t)num;
pthread_create(&thread[num], NULL,
thread_proc, &thread_args[num]);
@@ -110,17 +115,23 @@ int main(void)
mpu_prog.elf_image, MARS_TASK_CONTEXT_SAVE_SIZE_MAX);
MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
- task_args[num].type.u64[0] = host_to_mpu[i];
+ task_args[num].type.u64[0] = host_to_mpu;
task_args[num].type.u64[1] =
mars_ptr_to_ea(&notify);
+ task_args[num].type.u64[2] =
+ mars_ptr_to_ea(&tasks);
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);
+ mars_test_counter_wait(&threads, depth_size[i]);
+ if (num_mpu < depth_size[i])
+ mars_test_counter_wait(&tasks, num_mpu);
+ else
+ mars_test_counter_wait(&tasks, depth_size[i]);
+ mars_test_counter_set(&notify, 1);
chk_exit = 0;
for (num = 0; num < depth_size[i]; num++) {
@@ -135,7 +146,7 @@ int main(void)
}
MARS_TEST_ASSERT_EQUAL((uint32_t)chk_exit, chk_bit);
- ret = mars_task_queue_destroy(host_to_mpu[i]);
+ ret = mars_task_queue_destroy(host_to_mpu);
MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
}
diff --git a/tests/TFP/TFP_45_013/mpu.c b/tests/TFP/TFP_45_013/mpu.c
index ac933b5..d561e36 100644
--- a/tests/TFP/TFP_45_013/mpu.c
+++ b/tests/TFP/TFP_45_013/mpu.c
@@ -37,8 +37,10 @@ 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 tasks_ea = task_args->type.u64[2];
uint64_t val;
+ mars_test_counter_add(tasks_ea, 1);
mars_test_counter_wait(notify_ea, 1);
ret = mars_task_queue_pop(host_to_mpu_ea, &data);
diff --git a/tests/TFP/TFP_45_014/host.c b/tests/TFP/TFP_45_014/host.c
index 1ccc0d3..5a1cb77 100644
--- a/tests/TFP/TFP_45_014/host.c
+++ b/tests/TFP/TFP_45_014/host.c
@@ -51,8 +51,10 @@ 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 uint64_t mpu_to_host;
+static uint32_t notify __attribute((aligned(128)));
+static uint32_t threads __attribute((aligned(128)));
+static uint32_t tasks __attribute((aligned(128)));
static struct queue_entry data[Q_DEPTH];
static pthread_t thread[Q_DEPTH];
@@ -60,15 +62,14 @@ 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];
+ uint32_t num = (uint32_t)task_args->type.u32[0];
uint64_t val;
+ mars_test_counter_add(&threads, 1);
/* wait for start */
- while (!notify[0])
- usleep(100);
+ mars_test_counter_wait(&notify, 1);
- ret = mars_task_queue_pop(mpu_to_host[id], &data[num]);
+ ret = mars_task_queue_pop(mpu_to_host, &data[num]);
MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
/* check queue data */
@@ -85,17 +86,21 @@ int main(void)
uint32_t num;
uint32_t chk_bit, chk_exit;
void *p_ret;
+ int num_mpu;
+ num_mpu = 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++) {
- notify[0] = 0;
+ mars_test_counter_set(&notify, 0);
+ mars_test_counter_set(&threads, 0);
+ mars_test_counter_set(&tasks, 0);
chk_bit = 0;
ret = mars_task_queue_create(
mars_ctx,
- &mpu_to_host[i],
+ &mpu_to_host,
sizeof(struct queue_entry),
depth_size[i],
MARS_TASK_QUEUE_MPU_TO_HOST);
@@ -105,8 +110,7 @@ int main(void)
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;
+ thread_args[num].type.u32[0] = (uint32_t)num;
pthread_create(&thread[num], NULL,
thread_proc, &thread_args[num]);
@@ -116,18 +120,24 @@ int main(void)
MARS_TASK_CONTEXT_SAVE_SIZE_MAX);
MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
- task_args[num].type.u64[0] = mpu_to_host[i];
- task_args[num].type.u64[1] =
+ task_args[num].type.u32[0] = num;
+ task_args[num].type.u64[1] = mpu_to_host;
+ task_args[num].type.u64[2] =
mars_ptr_to_ea(&notify);
- task_args[num].type.u64[2] = (uint64_t) num;
+ task_args[num].type.u64[3] =
+ mars_ptr_to_ea(&tasks);
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);
+ mars_test_counter_wait(&threads, depth_size[i]);
+ if (num_mpu < depth_size[i])
+ mars_test_counter_wait(&tasks, num_mpu);
+ else
+ mars_test_counter_wait(&tasks, depth_size[i]);
+ mars_test_counter_set(&notify, 1);
chk_exit = 0;
for (num = 0; num < depth_size[i]; num++) {
@@ -143,7 +153,7 @@ int main(void)
}
MARS_TEST_ASSERT_EQUAL(chk_exit, chk_bit);
- ret = mars_task_queue_destroy(mpu_to_host[i]);
+ ret = mars_task_queue_destroy(mpu_to_host);
MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
}
diff --git a/tests/TFP/TFP_45_014/mpu.c b/tests/TFP/TFP_45_014/mpu.c
index 6b04574..62e858f 100644
--- a/tests/TFP/TFP_45_014/mpu.c
+++ b/tests/TFP/TFP_45_014/mpu.c
@@ -35,13 +35,16 @@ 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];
+ uint32_t val = task_args->type.u32[0];
+ uint64_t mpu_to_host_ea = task_args->type.u64[1];
+ uint64_t notify_ea = task_args->type.u64[2];
+ uint64_t tasks_ea = task_args->type.u64[3];
+
data.val1 = val;
data.val2 = val + TEST_DIFF;
+ mars_test_counter_add(tasks_ea, 1);
mars_test_counter_wait(notify_ea, 1);
ret = mars_task_queue_push(mpu_to_host_ea, &data);
diff --git a/tests/TFP/TFP_45_016/host.c b/tests/TFP/TFP_45_016/host.c
index 3f442b2..7e0aff2 100644
--- a/tests/TFP/TFP_45_016/host.c
+++ b/tests/TFP/TFP_45_016/host.c
@@ -21,6 +21,9 @@
* THE SOFTWARE.
*/
+#include <sys/types.h>
+#include <linux/unistd.h>
+#include <errno.h>
#include <pthread.h>
#include <unistd.h>
#include <mars/task.h>
@@ -45,25 +48,74 @@ 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 uint64_t host_to_mpu;
static struct queue_entry data;
-static uint32_t shared_resource __attribute((aligned(16)));
+static uint32_t notify __attribute((aligned(16)));
static pthread_t thread;
+static pid_t thread_pid;
+/*
+ * N O T E:
+ * This test uses Linux specific feature, in other word, you can not
+ * run this test program on the system other than Linux.
+ */
+
+int is_thread_blocked(pid_t tid)
+{
+ FILE *tstat;
+ char path[128];
+ char buf[1024];
+ int n;
+
+ snprintf(path, sizeof(path) - 1, "/proc/%d/status", tid);
+ tstat = fopen(path, "r");
+ MARS_TEST_ASSERT(tstat != NULL);
+
+ while ((n = fscanf(tstat, "State:\t%s\n", buf)) != EOF) {
+ if (n == 1)
+ break;
+ else
+ fgetc(tstat);
+ }
+ fclose(tstat);
+
+ switch (buf[0]) {
+ case 'R': /* running */
+ case 'D': /* disk sleep */
+ return 0;
+ break;
+ case 'S': /* sleep */
+ return 1;
+ break;
+ case 'T': /* trace stopped / stopped */
+ case 'Z': /* zonbie */
+ case 'X': /* dead */
+ default:
+ MARS_TEST_ASSERT(0);
+ return 0;
+ break;
+ };
+}
+
+pid_t linux_get_thread_id(void)
+{
+ return syscall(__NR_gettid);
+};
+
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];
+ uint32_t num = task_args->type.u32[0];
+
+ thread_pid = linux_get_thread_id();
+ mars_test_counter_set(&notify, 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);
+ ret = mars_task_queue_push(host_to_mpu, &data);
MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
}
-
- shared_resource = 1;
return NULL;
}
@@ -76,32 +128,32 @@ int main(void)
MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
for (i = 0; i < NUM_LOOP; i++) {
- shared_resource = 0;
+ mars_test_counter_set(&notify, 0);
ret = mars_task_queue_create(
mars_ctx,
- &host_to_mpu[i],
+ &host_to_mpu,
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];
+ thread_args.type.u32[0] = 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);
+ /* wait for the thread being blocked */
+ mars_test_counter_wait(&notify, 1);
+ while (!is_thread_blocked(thread_pid))
+ ;
/* create pop task */
ret = mars_task_create(mars_ctx, &task_id, NULL,
mpu_prog.elf_image, MARS_TASK_CONTEXT_SAVE_SIZE_MAX);
MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
- task_args.type.u64[0] = host_to_mpu[i];
+ task_args.type.u64[0] = host_to_mpu;
ret = mars_task_schedule(&task_id, &task_args, 0);
MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
@@ -110,12 +162,12 @@ int main(void)
MARS_TEST_ASSERT_ERROR(exit_code, MARS_SUCCESS);
/* check if thread is finished for queue_push */
- pthread_join(thread, NULL);
+ ret = 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]);
+ ret = mars_task_queue_destroy(host_to_mpu);
MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
}
diff --git a/tests/TFP/TFP_45_017/Makefile b/tests/TFP/TFP_45_017/Makefile
index ecbce33..72cf999 100644
--- a/tests/TFP/TFP_45_017/Makefile
+++ b/tests/TFP/TFP_45_017/Makefile
@@ -22,7 +22,7 @@
#
top_srcdir = ../..
-test_objs = host.o mpu1.task_eo mpu2.task_eo
+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_45_017/host.c b/tests/TFP/TFP_45_017/host.c
index ddb4379..aed42db 100644
--- a/tests/TFP/TFP_45_017/host.c
+++ b/tests/TFP/TFP_45_017/host.c
@@ -41,28 +41,29 @@ static uint32_t depth_size[] =
};
extern spe_program_handle_t mpu1_prog;
extern spe_program_handle_t mpu2_prog;
+extern spe_program_handle_t mpu3_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 struct mars_task_args task_args;
+static struct mars_task_id task1_id, task2_id, task3_id;
-static uint64_t mpu_to_mpu[NUM_LOOP];
-static uint32_t shared_resource __attribute((aligned(16)));
+static uint64_t mpu_to_mpu;
+static uint32_t notify __attribute((aligned(16)));
int main(void)
{
int ret, i;
int32_t exit_code;
- ret = mars_context_create(&mars_ctx, 0, 0);
+ ret = mars_context_create(&mars_ctx, 1, 0);
MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
for (i = 0; i < NUM_LOOP; i++) {
- shared_resource = 0;
+ mars_test_counter_set(&notify, 0);
ret = mars_task_queue_create(
mars_ctx,
- &mpu_to_mpu[i],
+ &mpu_to_mpu,
sizeof(struct queue_entry),
depth_size[i],
MARS_TASK_QUEUE_MPU_TO_MPU);
@@ -73,23 +74,34 @@ int main(void)
mpu1_prog.elf_image, MARS_TASK_CONTEXT_SAVE_SIZE_MAX);
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);
+ task_args.type.u64[0] = mpu_to_mpu;
+ task_args.type.u64[1] = (uint64_t)depth_size[i];
+ task_args.type.u64[2] = mars_ptr_to_ea(&notify);
+ ret = mars_task_schedule(&task1_id, &task_args, 0);
MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
/* check if queue_push is blocked */
- sleep(1);
- MARS_TEST_ASSERT_EQUAL(shared_resource, 0);
+ mars_test_counter_wait(&notify, 1);
+
+ ret = mars_task_create(mars_ctx, &task3_id, NULL,
+ mpu3_prog.elf_image,
+ MARS_TASK_CONTEXT_SAVE_SIZE_MAX);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+ ret = mars_task_schedule(&task3_id, NULL, 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_try_wait(&task1_id, &exit_code);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_ERROR_BUSY);
/* create and run pop task */
ret = mars_task_create(mars_ctx, &task2_id, NULL,
mpu2_prog.elf_image, MARS_TASK_CONTEXT_SAVE_SIZE_MAX);
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);
+ ret = mars_task_schedule(&task2_id, &task_args, 0);
MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
ret = mars_task_wait(&task2_id, &exit_code);
@@ -107,7 +119,10 @@ int main(void)
ret = mars_task_destroy(&task2_id);
MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
- ret = mars_task_queue_destroy(mpu_to_mpu[i]);
+ ret = mars_task_destroy(&task3_id);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+
+ ret = mars_task_queue_destroy(mpu_to_mpu);
MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
}
diff --git a/tests/TFP/TFP_45_017/mpu1.c b/tests/TFP/TFP_45_017/mpu1.c
index 85642a2..39f5be0 100644
--- a/tests/TFP/TFP_45_017/mpu1.c
+++ b/tests/TFP/TFP_45_017/mpu1.c
@@ -30,27 +30,25 @@ struct queue_entry {
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];
+ uint64_t notify = task_args->type.u64[2];
- /* last one push should be blocked */
- for (i = 0; i < num_push + 1; i++) {
+
+ for (i = 0; i < num_push; 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();
+ mars_test_counter_add(notify, 1);
+
+ /* last one push should be blocked */
+ 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_017/mpu3.c b/tests/TFP/TFP_45_017/mpu3.c
new file mode 100644
index 0000000..bdc8e78
--- /dev/null
+++ b/tests/TFP/TFP_45_017/mpu3.c
@@ -0,0 +1,30 @@
+/*
+ * Copyright 2009 Sony Corporation
+ *
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a copy
+ * of this software and associated documentation files (the "Software"), to deal
+ * in the Software without restriction, including without limitation the rights
+ * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+ * copies of the Software, and to permit persons to whom the Software is
+ * furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included in
+ * all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+ * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, 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.h>
+#include <mars_task_test.h>
+
+int mars_task_main(const struct mars_task_args *task_args)
+{
+ return 0;
+}
diff --git a/tests/TFP/TFP_45_018/host.c b/tests/TFP/TFP_45_018/host.c
index 3f442b2..d8b8dde 100644
--- a/tests/TFP/TFP_45_018/host.c
+++ b/tests/TFP/TFP_45_018/host.c
@@ -21,6 +21,9 @@
* THE SOFTWARE.
*/
+#include <sys/types.h>
+#include <linux/unistd.h>
+#include <errno.h>
#include <pthread.h>
#include <unistd.h>
#include <mars/task.h>
@@ -45,25 +48,76 @@ 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 uint64_t host_to_mpu;
static struct queue_entry data;
-static uint32_t shared_resource __attribute((aligned(16)));
+static uint32_t notify __attribute((aligned(16)));
static pthread_t thread;
+static pid_t thread_pid;
+/*
+ * N O T E:
+ * This test uses Linux specific feature, in other word, you can not
+ * run this test program on the system other than Linux.
+ */
+
+int is_thread_blocked(pid_t tid)
+{
+ FILE *tstat;
+ char path[128];
+ char buf[1024];
+ int n;
+
+ snprintf(path, sizeof(path) - 1, "/proc/%d/status", tid);
+ tstat = fopen(path, "r");
+ MARS_TEST_ASSERT(tstat != NULL);
+
+ while ((n = fscanf(tstat, "State:\t%s\n", buf)) != EOF) {
+ if (n == 1)
+ break;
+ else
+ fgetc(tstat);
+ }
+ fclose(tstat);
+
+ switch (buf[0]) {
+ case 'R': /* running */
+ case 'D': /* disk sleep */
+ return 0;
+ break;
+ case 'S': /* sleep */
+ return 1;
+ break;
+ case 'T': /* trace stopped / stopped */
+ case 'Z': /* zonbie */
+ case 'X': /* dead */
+ default:
+ MARS_TEST_ASSERT(0);
+ return 0;
+ break;
+ };
+}
+
+pid_t linux_get_thread_id(void)
+{
+ return syscall(__NR_gettid);
+};
+
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];
+ uint32_t num = task_args->type.u32[0];
+ thread_pid = linux_get_thread_id();
/* the last one push should be blocked */
- for (i = 0; i < num + 1; i++) {
- ret = mars_task_queue_push(host_to_mpu[id], &data);
+ for (i = 0; i < num; i++) {
+ ret = mars_task_queue_push(host_to_mpu, &data);
MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
}
+ mars_test_counter_set(&notify, 1);
- shared_resource = 1;
+ ret = mars_task_queue_push(host_to_mpu, &data);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
return NULL;
}
@@ -76,32 +130,32 @@ int main(void)
MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
for (i = 0; i < NUM_LOOP; i++) {
- shared_resource = 0;
+ mars_test_counter_set(&notify, 0);
ret = mars_task_queue_create(
mars_ctx,
- &host_to_mpu[i],
+ &host_to_mpu,
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];
+ thread_args.type.u32[0] = 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);
+ /* wait for the thread being blocked */
+ mars_test_counter_wait(&notify, 1);
+ while (!is_thread_blocked(thread_pid))
+ ;
/* create pop task */
ret = mars_task_create(mars_ctx, &task_id, NULL,
mpu_prog.elf_image, MARS_TASK_CONTEXT_SAVE_SIZE_MAX);
MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
- task_args.type.u64[0] = host_to_mpu[i];
+ task_args.type.u64[0] = host_to_mpu;
ret = mars_task_schedule(&task_id, &task_args, 0);
MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
@@ -115,7 +169,7 @@ int main(void)
ret = mars_task_destroy(&task_id);
MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
- ret = mars_task_queue_destroy(host_to_mpu[i]);
+ ret = mars_task_queue_destroy(host_to_mpu);
MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
}
diff --git a/tests/TFP/TFP_45_019/Makefile b/tests/TFP/TFP_45_019/Makefile
index 432135a..ecbce33 100644
--- a/tests/TFP/TFP_45_019/Makefile
+++ b/tests/TFP/TFP_45_019/Makefile
@@ -22,7 +22,7 @@
#
top_srcdir = ../..
-test_objs = host.o mpu.task_eo
+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_019/host.c b/tests/TFP/TFP_45_019/host.c
index efed7a5..9646cfa 100644
--- a/tests/TFP/TFP_45_019/host.c
+++ b/tests/TFP/TFP_45_019/host.c
@@ -38,64 +38,82 @@ static uint32_t depth_size[] =
1,
Q_DEPTH
};
-extern spe_program_handle_t mpu_prog;
+extern spe_program_handle_t mpu1_prog, mpu2_prog;
static struct mars_context *mars_ctx;
static struct mars_task_args task_args;
-static struct mars_task_id task_id;
+static struct mars_task_id task1_id, task2_id;
-static uint64_t mpu_to_host[NUM_LOOP];
+static uint64_t mpu_to_host;
static struct queue_entry data;
-static uint32_t shared_resource __attribute((aligned(16)));
+static uint32_t counter __attribute((aligned(16)));
int main(void)
{
int ret, i;
int32_t exit_code;
- ret = mars_context_create(&mars_ctx, 0, 0);
+ ret = mars_context_create(&mars_ctx, 1, 0);
MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
for (i = 0; i < NUM_LOOP; i++) {
- shared_resource = 0;
+ mars_test_counter_set(&counter, 0);
ret = mars_task_queue_create(
mars_ctx,
- &mpu_to_host[i],
+ &mpu_to_host,
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_SIZE_MAX);
+ ret = mars_task_create(mars_ctx, &task1_id, NULL,
+ mpu1_prog.elf_image, MARS_TASK_CONTEXT_SAVE_SIZE_MAX);
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);
+ task_args.type.u32[0] = depth_size[i];
+ task_args.type.u64[1] = mpu_to_host;
+ task_args.type.u64[2] = mars_ptr_to_ea(&counter);
+ ret = mars_task_schedule(&task1_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);
+ /*
+ * check the task is already scheduled
+ */
+ mars_test_counter_wait(&counter, 1);
- /* try_pop one */
- ret = mars_task_queue_try_pop(mpu_to_host[i], &data);
+ ret = mars_task_create(mars_ctx, &task2_id, NULL,
+ mpu2_prog.elf_image,
+ MARS_TASK_CONTEXT_SAVE_SIZE_MAX);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+
+ ret = mars_task_schedule(&task2_id, NULL, 0);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+
+ ret = mars_task_wait(&task2_id, &exit_code);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+
+ ret = mars_task_try_wait(&task1_id, &exit_code);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_ERROR_BUSY);
+
+ /* pop one */
+ ret = mars_task_queue_try_pop(mpu_to_host, &data);
MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
/* check if mpu task is successfly finished */
- ret = mars_task_wait(&task_id, &exit_code);
+ 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(&task_id);
+ 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_host[i]);
+ ret = mars_task_queue_destroy(mpu_to_host);
MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
}
diff --git a/tests/TFP/TFP_45_019/mpu.c b/tests/TFP/TFP_45_019/mpu1.c
index 9218955..a11e2a2 100644
--- a/tests/TFP/TFP_45_019/mpu.c
+++ b/tests/TFP/TFP_45_019/mpu1.c
@@ -23,34 +23,30 @@
#include <mars/task.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];
+ uint32_t num_push = task_args->type.u32[0];
+ uint64_t mpu_to_host_ea = task_args->type.u64[1];
+ uint64_t counter_ea = task_args->type.u64[2];
/* last one push should be blocked */
- for (i = 0; i < num_push + 1; i++) {
+ for (i = 0; i < num_push; 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();
+ mars_test_counter_add(counter_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_019/mpu2.c b/tests/TFP/TFP_45_019/mpu2.c
new file mode 100644
index 0000000..bdc8e78
--- /dev/null
+++ b/tests/TFP/TFP_45_019/mpu2.c
@@ -0,0 +1,30 @@
+/*
+ * Copyright 2009 Sony Corporation
+ *
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a copy
+ * of this software and associated documentation files (the "Software"), to deal
+ * in the Software without restriction, including without limitation the rights
+ * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+ * copies of the Software, and to permit persons to whom the Software is
+ * furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included in
+ * all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+ * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, 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.h>
+#include <mars_task_test.h>
+
+int mars_task_main(const struct mars_task_args *task_args)
+{
+ return 0;
+}
diff --git a/tests/TFP/TFP_45_020/Makefile b/tests/TFP/TFP_45_020/Makefile
index ecbce33..72cf999 100644
--- a/tests/TFP/TFP_45_020/Makefile
+++ b/tests/TFP/TFP_45_020/Makefile
@@ -22,7 +22,7 @@
#
top_srcdir = ../..
-test_objs = host.o mpu1.task_eo mpu2.task_eo
+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_45_020/host.c b/tests/TFP/TFP_45_020/host.c
index ca28820..cd1ebc9 100644
--- a/tests/TFP/TFP_45_020/host.c
+++ b/tests/TFP/TFP_45_020/host.c
@@ -40,28 +40,29 @@ static uint32_t depth_size[] =
};
extern spe_program_handle_t mpu1_prog;
extern spe_program_handle_t mpu2_prog;
+extern spe_program_handle_t mpu3_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 struct mars_task_args task_args;
+static struct mars_task_id task1_id, task2_id, task3_id;
-static uint64_t mpu_to_mpu[NUM_LOOP];
-static uint32_t shared_resource __attribute((aligned(16)));
+static uint64_t mpu_to_mpu;
+static uint32_t counter __attribute((aligned(16)));
int main(void)
{
int ret, i;
int32_t exit_code;
- ret = mars_context_create(&mars_ctx, 0, 0);
+ ret = mars_context_create(&mars_ctx, 1, 0);
MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
for (i = 0; i < NUM_LOOP; i++) {
- shared_resource = 0;
+ mars_test_counter_set(&counter, 0);
ret = mars_task_queue_create(
mars_ctx,
- &mpu_to_mpu[i],
+ &mpu_to_mpu,
sizeof(struct queue_entry),
depth_size[i],
MARS_TASK_QUEUE_MPU_TO_MPU);
@@ -69,26 +70,38 @@ int main(void)
/* create push task */
ret = mars_task_create(mars_ctx, &task1_id, NULL,
- mpu1_prog.elf_image, MARS_TASK_CONTEXT_SAVE_SIZE_MAX);
+ mpu1_prog.elf_image,
+ MARS_TASK_CONTEXT_SAVE_SIZE_MAX);
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);
+ task_args.type.u32[0] = depth_size[i];
+ task_args.type.u64[1] = mpu_to_mpu;
+ task_args.type.u64[2] = mars_ptr_to_ea(&counter);
+ ret = mars_task_schedule(&task1_id, &task_args, 0);
MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
- /* check if queue_push is blocked */
- sleep(1);
- MARS_TEST_ASSERT_EQUAL(shared_resource, 0);
+ mars_test_counter_wait(&counter, 1);
+
+ ret = mars_task_create(mars_ctx, &task3_id, NULL,
+ mpu3_prog.elf_image,
+ MARS_TASK_CONTEXT_SAVE_SIZE_MAX);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+ ret = mars_task_schedule(&task3_id, NULL, 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_try_wait(&task1_id, &exit_code);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_ERROR_BUSY);
/* create and run pop task */
ret = mars_task_create(mars_ctx, &task2_id, NULL,
- mpu2_prog.elf_image, MARS_TASK_CONTEXT_SAVE_SIZE_MAX);
+ mpu2_prog.elf_image,
+ MARS_TASK_CONTEXT_SAVE_SIZE_MAX);
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);
+ ret = mars_task_schedule(&task2_id, &task_args, 0);
MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
ret = mars_task_wait(&task2_id, &exit_code);
@@ -106,7 +119,10 @@ int main(void)
ret = mars_task_destroy(&task2_id);
MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
- ret = mars_task_queue_destroy(mpu_to_mpu[i]);
+ ret = mars_task_destroy(&task3_id);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+
+ ret = mars_task_queue_destroy(mpu_to_mpu);
MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
}
diff --git a/tests/TFP/TFP_45_020/mpu1.c b/tests/TFP/TFP_45_020/mpu1.c
index 85642a2..d4198bf 100644
--- a/tests/TFP/TFP_45_020/mpu1.c
+++ b/tests/TFP/TFP_45_020/mpu1.c
@@ -23,34 +23,30 @@
#include <mars/task.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];
+ uint32_t num_push = task_args->type.u32[0];
+ uint64_t mpu_to_mpu_ea = task_args->type.u64[1];
+ uint64_t counter_ea = task_args->type.u64[2];
- /* last one push should be blocked */
- for (i = 0; i < num_push + 1; i++) {
+ for (i = 0; i < num_push; 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();
+ mars_test_counter_add(counter_ea, 1);
+
+ /* last one push should be blocked */
+ 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_020/mpu2.c b/tests/TFP/TFP_45_020/mpu2.c
index a9a7a6e..5f4f5e6 100644
--- a/tests/TFP/TFP_45_020/mpu2.c
+++ b/tests/TFP/TFP_45_020/mpu2.c
@@ -33,7 +33,7 @@ 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 mpu_to_mpu_ea = task_args->type.u64[1];
ret = mars_task_queue_try_pop(mpu_to_mpu_ea, &data);
MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
diff --git a/tests/TFP/TFP_45_020/mpu3.c b/tests/TFP/TFP_45_020/mpu3.c
new file mode 100644
index 0000000..bdc8e78
--- /dev/null
+++ b/tests/TFP/TFP_45_020/mpu3.c
@@ -0,0 +1,30 @@
+/*
+ * Copyright 2009 Sony Corporation
+ *
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a copy
+ * of this software and associated documentation files (the "Software"), to deal
+ * in the Software without restriction, including without limitation the rights
+ * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+ * copies of the Software, and to permit persons to whom the Software is
+ * furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included in
+ * all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+ * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, 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.h>
+#include <mars_task_test.h>
+
+int mars_task_main(const struct mars_task_args *task_args)
+{
+ return 0;
+}
diff --git a/tests/TFP/TFP_45_021/host.c b/tests/TFP/TFP_45_021/host.c
index 3f442b2..f8c964c 100644
--- a/tests/TFP/TFP_45_021/host.c
+++ b/tests/TFP/TFP_45_021/host.c
@@ -21,6 +21,9 @@
* THE SOFTWARE.
*/
+#include <sys/types.h>
+#include <linux/unistd.h>
+#include <errno.h>
#include <pthread.h>
#include <unistd.h>
#include <mars/task.h>
@@ -45,25 +48,74 @@ 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 uint64_t host_to_mpu;
static struct queue_entry data;
-static uint32_t shared_resource __attribute((aligned(16)));
+static uint32_t notify __attribute((aligned(16)));
static pthread_t thread;
+static pid_t thread_pid;
+/*
+ * N O T E:
+ * This test uses Linux specific feature, in other word, you can not
+ * run this test program on the system other than Linux.
+ */
+
+int is_thread_blocked(pid_t tid)
+{
+ FILE *tstat;
+ char path[128];
+ char buf[1024];
+ int n;
+
+ snprintf(path, sizeof(path) - 1, "/proc/%d/status", tid);
+ tstat = fopen(path, "r");
+ MARS_TEST_ASSERT(tstat != NULL);
+
+ while ((n = fscanf(tstat, "State:\t%s\n", buf)) != EOF) {
+ if (n == 1)
+ break;
+ else
+ fgetc(tstat);
+ }
+ fclose(tstat);
+
+ switch (buf[0]) {
+ case 'R': /* running */
+ case 'D': /* disk sleep */
+ return 0;
+ break;
+ case 'S': /* sleep */
+ return 1;
+ break;
+ case 'T': /* trace stopped / stopped */
+ case 'Z': /* zonbie */
+ case 'X': /* dead */
+ default:
+ MARS_TEST_ASSERT(0);
+ return 0;
+ break;
+ };
+}
+
+pid_t linux_get_thread_id(void)
+{
+ return syscall(__NR_gettid);
+};
+
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];
+ uint32_t num = task_args->type.u32[0];
+
+ thread_pid = linux_get_thread_id();
+ mars_test_counter_set(&notify, 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);
+ ret = mars_task_queue_push(host_to_mpu, &data);
MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
}
-
- shared_resource = 1;
return NULL;
}
@@ -76,32 +128,32 @@ int main(void)
MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
for (i = 0; i < NUM_LOOP; i++) {
- shared_resource = 0;
+ mars_test_counter_set(&notify, 0);
ret = mars_task_queue_create(
mars_ctx,
- &host_to_mpu[i],
+ &host_to_mpu,
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];
+ thread_args.type.u32[0] = 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);
+ /* wait for the thread being blocked */
+ mars_test_counter_wait(&notify, 1);
+ while (!is_thread_blocked(thread_pid))
+ ;
/* create pop task */
ret = mars_task_create(mars_ctx, &task_id, NULL,
mpu_prog.elf_image, MARS_TASK_CONTEXT_SAVE_SIZE_MAX);
MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
- task_args.type.u64[0] = host_to_mpu[i];
+ task_args.type.u64[0] = host_to_mpu;
ret = mars_task_schedule(&task_id, &task_args, 0);
MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
@@ -115,7 +167,7 @@ int main(void)
ret = mars_task_destroy(&task_id);
MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
- ret = mars_task_queue_destroy(host_to_mpu[i]);
+ ret = mars_task_queue_destroy(host_to_mpu);
MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
}
diff --git a/tests/TFP/TFP_45_022/Makefile b/tests/TFP/TFP_45_022/Makefile
index ecbce33..72cf999 100644
--- a/tests/TFP/TFP_45_022/Makefile
+++ b/tests/TFP/TFP_45_022/Makefile
@@ -22,7 +22,7 @@
#
top_srcdir = ../..
-test_objs = host.o mpu1.task_eo mpu2.task_eo
+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_45_022/host.c b/tests/TFP/TFP_45_022/host.c
index ca28820..aed42db 100644
--- a/tests/TFP/TFP_45_022/host.c
+++ b/tests/TFP/TFP_45_022/host.c
@@ -21,6 +21,7 @@
* THE SOFTWARE.
*/
+#include <pthread.h>
#include <unistd.h>
#include <mars/task.h>
#include <libspe2.h>
@@ -40,28 +41,29 @@ static uint32_t depth_size[] =
};
extern spe_program_handle_t mpu1_prog;
extern spe_program_handle_t mpu2_prog;
+extern spe_program_handle_t mpu3_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 struct mars_task_args task_args;
+static struct mars_task_id task1_id, task2_id, task3_id;
-static uint64_t mpu_to_mpu[NUM_LOOP];
-static uint32_t shared_resource __attribute((aligned(16)));
+static uint64_t mpu_to_mpu;
+static uint32_t notify __attribute((aligned(16)));
int main(void)
{
int ret, i;
int32_t exit_code;
- ret = mars_context_create(&mars_ctx, 0, 0);
+ ret = mars_context_create(&mars_ctx, 1, 0);
MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
for (i = 0; i < NUM_LOOP; i++) {
- shared_resource = 0;
+ mars_test_counter_set(&notify, 0);
ret = mars_task_queue_create(
mars_ctx,
- &mpu_to_mpu[i],
+ &mpu_to_mpu,
sizeof(struct queue_entry),
depth_size[i],
MARS_TASK_QUEUE_MPU_TO_MPU);
@@ -72,23 +74,34 @@ int main(void)
mpu1_prog.elf_image, MARS_TASK_CONTEXT_SAVE_SIZE_MAX);
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);
+ task_args.type.u64[0] = mpu_to_mpu;
+ task_args.type.u64[1] = (uint64_t)depth_size[i];
+ task_args.type.u64[2] = mars_ptr_to_ea(&notify);
+ ret = mars_task_schedule(&task1_id, &task_args, 0);
MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
/* check if queue_push is blocked */
- sleep(1);
- MARS_TEST_ASSERT_EQUAL(shared_resource, 0);
+ mars_test_counter_wait(&notify, 1);
+
+ ret = mars_task_create(mars_ctx, &task3_id, NULL,
+ mpu3_prog.elf_image,
+ MARS_TASK_CONTEXT_SAVE_SIZE_MAX);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+ ret = mars_task_schedule(&task3_id, NULL, 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_try_wait(&task1_id, &exit_code);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_ERROR_BUSY);
/* create and run pop task */
ret = mars_task_create(mars_ctx, &task2_id, NULL,
mpu2_prog.elf_image, MARS_TASK_CONTEXT_SAVE_SIZE_MAX);
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);
+ ret = mars_task_schedule(&task2_id, &task_args, 0);
MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
ret = mars_task_wait(&task2_id, &exit_code);
@@ -106,7 +119,10 @@ int main(void)
ret = mars_task_destroy(&task2_id);
MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
- ret = mars_task_queue_destroy(mpu_to_mpu[i]);
+ ret = mars_task_destroy(&task3_id);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+
+ ret = mars_task_queue_destroy(mpu_to_mpu);
MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
}
diff --git a/tests/TFP/TFP_45_022/mpu1.c b/tests/TFP/TFP_45_022/mpu1.c
index 85642a2..39f5be0 100644
--- a/tests/TFP/TFP_45_022/mpu1.c
+++ b/tests/TFP/TFP_45_022/mpu1.c
@@ -30,27 +30,25 @@ struct queue_entry {
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];
+ uint64_t notify = task_args->type.u64[2];
- /* last one push should be blocked */
- for (i = 0; i < num_push + 1; i++) {
+
+ for (i = 0; i < num_push; 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();
+ mars_test_counter_add(notify, 1);
+
+ /* last one push should be blocked */
+ 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_022/mpu3.c b/tests/TFP/TFP_45_022/mpu3.c
new file mode 100644
index 0000000..bdc8e78
--- /dev/null
+++ b/tests/TFP/TFP_45_022/mpu3.c
@@ -0,0 +1,30 @@
+/*
+ * Copyright 2009 Sony Corporation
+ *
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a copy
+ * of this software and associated documentation files (the "Software"), to deal
+ * in the Software without restriction, including without limitation the rights
+ * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+ * copies of the Software, and to permit persons to whom the Software is
+ * furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included in
+ * all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+ * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, 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.h>
+#include <mars_task_test.h>
+
+int mars_task_main(const struct mars_task_args *task_args)
+{
+ return 0;
+}
diff --git a/tests/TFP/TFP_46_001/host.c b/tests/TFP/TFP_46_001/host.c
index 9161c37..3f42b2d 100644
--- a/tests/TFP/TFP_46_001/host.c
+++ b/tests/TFP/TFP_46_001/host.c
@@ -33,55 +33,116 @@ 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)));
+static uint64_t queue_item[2] __attribute__((aligned(16)));
+static uint32_t mpu_queue_counter __attribute__((aligned(16)));
+static uint32_t mpu_state __attribute__((aligned(16)));
int main(void)
{
- int i, exit_code, ret;
+ int exit_code, ret, i;
+ /* assure queue item size */
+ MARS_TEST_ASSERT_EQUAL(sizeof(queue_item), QUEUE_ITEM_SIZE);
+
+ /*
+ * Create context
+ */
ret = mars_context_create(&mars, 0, 0);
MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+ /*
+ * Create task
+ */
ret = mars_task_create(
mars,
&task_id,
"46001",
mpu_prog.elf_image,
MARS_TASK_CONTEXT_SAVE_SIZE_MAX);
+ /* if this fails, we can not continue no more */
MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+ /*
+ * Create a queue
+ */
ret = mars_task_queue_create(
mars,
&queue,
- 16,
+ QUEUE_ITEM_SIZE,
QUEUE_DEPTH,
MARS_TASK_QUEUE_MPU_TO_HOST);
+ /* if this fails, we can not continue no more */
MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
- mpu_answer = 0;
-
+ /*
+ * Setup arguments to MPU
+ */
task_args.type.u64[0] = queue;
- task_args.type.u64[1] = mars_ptr_to_ea(&mpu_answer);
+ task_args.type.u64[1] = mars_ptr_to_ea(&mpu_queue_counter);
+ task_args.type.u64[2] = mars_ptr_to_ea(&mpu_state);
+ mars_test_counter_set(&mpu_queue_counter, 0);
+ mars_test_counter_set(&mpu_state, STATE_NONE);
+
+ /*
+ * Start the task. The task will repeat QUEUE_DEPTH+1 times of:
+ * o Set mpu_state to STATE_START_PUSH before every calling
+ * mars_task_queue_push_begin
+ * o Set mpu_state to STATE_PUSH_DONE after every return of
+ * mars_task_queue_push_end
+ * o Increment mpu_queue_counter one by one
+ * So, MPU program should blocks after the mpu_queue_counter reaches
+ * to QUEUE_DEPTH.
+ */
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++) {
+ /*
+ * As we described above, the MPU program will be in sleep state after
+ * the counter reaches QUEUE_DEPTH
+ */
+ mars_test_counter_wait(&mpu_queue_counter, QUEUE_DEPTH);
+ /*
+ * Then the pusher should be blocked soon after state goes
+ * STATE_START_PUSH. If something wrong, the following will
+ * not be satisfied forever. Then timeout detected.
+ */
+ mars_test_counter_wait(&mpu_state, STATE_START_PUSH);
+
+ /*
+ * If the last push of the pusher is not blocked, the state
+ * or counter is in wrong value.
+ * DISCLAIMER: If the last push operation takes too long time and is not
+ * blocked, the following ASSERT may be satisfied. If you want to
+ * detect that, insert sleep() here.
+ */
+ MARS_TEST_ASSERT_EQUAL(mpu_state, STATE_START_PUSH);
+ MARS_TEST_ASSERT_EQUAL(mpu_queue_counter, QUEUE_DEPTH);
+
+ /*
+ * check the queue contents including the last item
+ */
+ 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);
+ /*
+ * Now queue shoud be empty. Check it
+ */
+ ret = mars_task_queue_try_pop(queue, queue_item);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_ERROR_BUSY);
+ /*
+ * Wait for the task exit
+ */
ret = mars_task_wait(&task_id, &exit_code);
MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
MARS_TEST_ASSERT_EQUAL(exit_code, 0);
+ /*
+ * cleanup
+ */
ret = mars_task_queue_destroy(queue);
MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
diff --git a/tests/TFP/TFP_46_001/host_and_mpu.h b/tests/TFP/TFP_46_001/host_and_mpu.h
index e565e93..3ac9ce2 100644
--- a/tests/TFP/TFP_46_001/host_and_mpu.h
+++ b/tests/TFP/TFP_46_001/host_and_mpu.h
@@ -22,3 +22,10 @@
*/
#define QUEUE_DEPTH 16
+#define QUEUE_ITEM_SIZE 16
+enum {
+ STATE_NONE,
+ STATE_START_PUSH,
+ STATE_PUSH_DONE,
+};
+#define MFC_TAG 0
diff --git a/tests/TFP/TFP_46_001/mpu.c b/tests/TFP/TFP_46_001/mpu.c
index 8ffc151..4c733e4 100644
--- a/tests/TFP/TFP_46_001/mpu.c
+++ b/tests/TFP/TFP_46_001/mpu.c
@@ -32,22 +32,30 @@ 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 counter_ea = task_args->type.u64[1];
+ uint64_t state_ea = task_args->type.u64[2];
int i, ret;
- for (i = 0; i < QUEUE_DEPTH+1; i++) {
+ /* assure queue item size */
+ MARS_TEST_ASSERT_EQUAL(sizeof(queue_item), QUEUE_ITEM_SIZE);
+
+ 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_counter_set(state_ea, STATE_START_PUSH);
+ ret = mars_task_queue_push_begin(queue_ea, &queue_item, MFC_TAG);
MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
- ret = mars_task_queue_push_end(queue_ea, 0);
+ ret = mars_task_queue_push_end(queue_ea, MFC_TAG);
MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
- }
- mars_test_int64_put(mpu_answer_ea, 1);
+ mars_test_counter_set(state_ea, STATE_PUSH_DONE);
+ /*
+ * Tell the HOST how many items we've put
+ */
+ mars_test_counter_add(counter_ea, 1);
+ }
mars_task_exit(0);
-
return 0;
}
diff --git a/tests/TFP/TFP_46_002/host.c b/tests/TFP/TFP_46_002/host.c
index 1663968..e951ea6 100644
--- a/tests/TFP/TFP_46_002/host.c
+++ b/tests/TFP/TFP_46_002/host.c
@@ -32,23 +32,26 @@ 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)));
+
+static uint32_t state __attribute__((aligned(16)));
+static uint32_t depth_counter __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);
+ /*
+ * Create two tasks
+ * mpu1: pusher
+ * mpu2: popper
+ */
ret = mars_task_create(
mars,
&pusher_task_id,
- "46002",
+ "pusher",
mpu1_prog.elf_image,
MARS_TASK_CONTEXT_SAVE_SIZE_MAX);
MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
@@ -56,30 +59,38 @@ int main(void)
ret = mars_task_create(
mars,
&poper_task_id,
- "46002",
+ "popper",
mpu2_prog.elf_image,
MARS_TASK_CONTEXT_SAVE_SIZE_MAX);
MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+ /*
+ * Create queue
+ */
ret = mars_task_queue_create(
mars,
&queue,
- 16,
+ QUEUE_ITEM_SIZE,
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;
+ task_args.type.u64[1] = mars_ptr_to_ea(&state);
+ task_args.type.u64[2] = mars_ptr_to_ea(&depth_counter);
+
+ /*
+ * Start tasks
+ */
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);
+ /*
+ * Wait for comletion
+ */
ret = mars_task_wait(&pusher_task_id, &exit_code);
MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
MARS_TEST_ASSERT_EQUAL(exit_code, 0);
@@ -88,12 +99,16 @@ int main(void)
MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
MARS_TEST_ASSERT_EQUAL(exit_code, 0);
+ /*
+ * Clean up
+ */
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_task_destroy(&poper_task_id);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
ret = mars_context_destroy(mars);
MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
diff --git a/tests/TFP/TFP_46_002/host_and_mpu.h b/tests/TFP/TFP_46_002/host_and_mpu.h
index e565e93..ed6bcf5 100644
--- a/tests/TFP/TFP_46_002/host_and_mpu.h
+++ b/tests/TFP/TFP_46_002/host_and_mpu.h
@@ -22,3 +22,10 @@
*/
#define QUEUE_DEPTH 16
+#define QUEUE_ITEM_SIZE 16
+
+enum {
+ STATE_NONE,
+ STATE_START_PUSH,
+ STATE_PUSH_DONE,
+};
diff --git a/tests/TFP/TFP_46_002/mpu1.c b/tests/TFP/TFP_46_002/mpu1.c
index acab073..3921f72 100644
--- a/tests/TFP/TFP_46_002/mpu1.c
+++ b/tests/TFP/TFP_46_002/mpu1.c
@@ -32,12 +32,17 @@ 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 state_ea = task_args->type.u64[1];
+ uint64_t counter_ea = task_args->type.u64[2];
int i, ret;
- for (i = 0; i < QUEUE_DEPTH+1; i++) {
+ /*
+ *
+ */
+ for (i = 0; i < QUEUE_DEPTH + 1; i++) {
queue_item[0] = queue_item[1] = i;
+ mars_test_counter_set(state_ea, STATE_START_PUSH);
ret = mars_task_queue_push_begin(
queue_ea,
queue_item,
@@ -46,10 +51,13 @@ int mars_task_main(const struct mars_task_args *task_args)
ret = mars_task_queue_push_end(queue_ea, 0);
MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+ mars_test_counter_set(state_ea, STATE_PUSH_DONE);
+ /*
+ * Tell the peer how many items we've put
+ */
+ mars_test_counter_add(counter_ea, 1);
}
- 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
index c9509b6..5ee4f14 100644
--- a/tests/TFP/TFP_46_002/mpu2.c
+++ b/tests/TFP/TFP_46_002/mpu2.c
@@ -32,25 +32,47 @@ 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];
+ uint64_t state_ea = task_args->type.u64[1];
+ uint64_t counter_ea = task_args->type.u64[2];
int i, ret;
- uint64_t mpu_answer;
+ uint64_t tmp;
+ /*
+ * Wait for queue being filled
+ */
+ mars_test_counter_wait(counter_ea, QUEUE_DEPTH);
+ /*
+ * Then the pusher should be blocked just after state goes
+ * STATE_START_PUSH. If something wrong, the following will
+ * not be satisfied forever. Then timeout detected.
+ */
+ mars_test_counter_wait(state_ea, STATE_START_PUSH);
+ /*
+ * If the last push of the pusher is not blocked, the state
+ * or counter is in wrong value.
+ * DISCLAIMER: If the last push operation takes too long time and is not
+ * blocked, the following ASSERT may be satisfied. If you want to
+ * detect that, insert sleep() here.
+ */
+ tmp = mars_test_int32_get(state_ea);
+ MARS_TEST_ASSERT_EQUAL(tmp, STATE_START_PUSH);
+ tmp = mars_test_int32_get(counter_ea);
+ MARS_TEST_ASSERT_EQUAL(tmp, QUEUE_DEPTH);
- 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++) {
+ /*
+ * check the queue contents including the last item
+ */
+ 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);
+ /*
+ * Now queue shoud be empty. Check it
+ */
+ ret = mars_task_queue_try_pop(queue_ea, queue_item);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_ERROR_BUSY);
mars_task_exit(0);
diff --git a/tests/TFP/TFP_46_003/Makefile b/tests/TFP/TFP_46_003/Makefile
index 432135a..ecbce33 100644
--- a/tests/TFP/TFP_46_003/Makefile
+++ b/tests/TFP/TFP_46_003/Makefile
@@ -22,7 +22,7 @@
#
top_srcdir = ../..
-test_objs = host.o mpu.task_eo
+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_003/host.c b/tests/TFP/TFP_46_003/host.c
index 828c947..ed712ff 100644
--- a/tests/TFP/TFP_46_003/host.c
+++ b/tests/TFP/TFP_46_003/host.c
@@ -32,71 +32,88 @@ struct queue_entry {
};
#define Q_DEPTH (256 * 1024)
-#define NUM_LOOP 3
+#define NUM_LOOP 2
static uint32_t depth_size[] =
{
1,
- Q_DEPTH / 2,
Q_DEPTH
};
-extern spe_program_handle_t mpu_prog;
+extern spe_program_handle_t mpu1_prog, mpu2_prog;
static struct mars_context *mars_ctx;
static struct mars_task_args task_args;
-static struct mars_task_id task_id;
+static struct mars_task_id task1_id, task2_id;
-static uint64_t mpu_to_host[NUM_LOOP];
+static uint64_t mpu_to_host;
static struct queue_entry data;
-static uint32_t shared_resource __attribute((aligned(16)));
+static uint32_t counter __attribute((aligned(16)));
int main(void)
{
int ret, i;
int32_t exit_code;
- ret = mars_context_create(&mars_ctx, 0, 0);
+ ret = mars_context_create(&mars_ctx, 1, 0);
MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
for (i = 0; i < NUM_LOOP; i++) {
- shared_resource = 0;
+ mars_test_counter_set(&counter, 0);
ret = mars_task_queue_create(
mars_ctx,
- &mpu_to_host[i],
+ &mpu_to_host,
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_SIZE_MAX);
+ ret = mars_task_create(mars_ctx, &task1_id, NULL,
+ mpu1_prog.elf_image, MARS_TASK_CONTEXT_SAVE_SIZE_MAX);
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);
+ task_args.type.u32[0] = depth_size[i];
+ task_args.type.u64[1] = mpu_to_host;
+ task_args.type.u64[2] = mars_ptr_to_ea(&counter);
+ ret = mars_task_schedule(&task1_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);
+ /*
+ * check the task is already scheduled
+ */
+ mars_test_counter_wait(&counter, 1);
+
+ ret = mars_task_create(mars_ctx, &task2_id, NULL,
+ mpu2_prog.elf_image,
+ MARS_TASK_CONTEXT_SAVE_SIZE_MAX);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+
+ ret = mars_task_schedule(&task2_id, NULL, 0);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+
+ ret = mars_task_wait(&task2_id, &exit_code);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+
+ ret = mars_task_try_wait(&task1_id, &exit_code);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_ERROR_BUSY);
/* pop one */
- ret = mars_task_queue_pop(mpu_to_host[i], &data);
+ ret = mars_task_queue_pop(mpu_to_host, &data);
MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
/* check if mpu task is successfly finished */
- ret = mars_task_wait(&task_id, &exit_code);
+ 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(&task_id);
+ 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_host[i]);
+ ret = mars_task_queue_destroy(mpu_to_host);
MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
}
diff --git a/tests/TFP/TFP_46_008/mpu.c b/tests/TFP/TFP_46_003/mpu1.c
index 3c44d1f..4afcc66 100644
--- a/tests/TFP/TFP_46_008/mpu.c
+++ b/tests/TFP/TFP_46_003/mpu1.c
@@ -23,37 +23,34 @@
#include <mars/task.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];
+ uint32_t num_push = task_args->type.u32[0];
+ uint64_t mpu_to_host_ea = task_args->type.u64[1];
+ uint64_t counter_ea = task_args->type.u64[2];
/* last one push should be blocked */
- for (i = 0; i < num_push + 1; i++) {
+ for (i = 0; i < num_push; 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();
+ mars_test_counter_add(counter_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_003/mpu2.c b/tests/TFP/TFP_46_003/mpu2.c
new file mode 100644
index 0000000..bdc8e78
--- /dev/null
+++ b/tests/TFP/TFP_46_003/mpu2.c
@@ -0,0 +1,30 @@
+/*
+ * Copyright 2009 Sony Corporation
+ *
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a copy
+ * of this software and associated documentation files (the "Software"), to deal
+ * in the Software without restriction, including without limitation the rights
+ * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+ * copies of the Software, and to permit persons to whom the Software is
+ * furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included in
+ * all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+ * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, 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.h>
+#include <mars_task_test.h>
+
+int mars_task_main(const struct mars_task_args *task_args)
+{
+ return 0;
+}
diff --git a/tests/TFP/TFP_46_004/Makefile b/tests/TFP/TFP_46_004/Makefile
index ecbce33..72cf999 100644
--- a/tests/TFP/TFP_46_004/Makefile
+++ b/tests/TFP/TFP_46_004/Makefile
@@ -22,7 +22,7 @@
#
top_srcdir = ../..
-test_objs = host.o mpu1.task_eo mpu2.task_eo
+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_46_004/host.c b/tests/TFP/TFP_46_004/host.c
index ca28820..cd1ebc9 100644
--- a/tests/TFP/TFP_46_004/host.c
+++ b/tests/TFP/TFP_46_004/host.c
@@ -40,28 +40,29 @@ static uint32_t depth_size[] =
};
extern spe_program_handle_t mpu1_prog;
extern spe_program_handle_t mpu2_prog;
+extern spe_program_handle_t mpu3_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 struct mars_task_args task_args;
+static struct mars_task_id task1_id, task2_id, task3_id;
-static uint64_t mpu_to_mpu[NUM_LOOP];
-static uint32_t shared_resource __attribute((aligned(16)));
+static uint64_t mpu_to_mpu;
+static uint32_t counter __attribute((aligned(16)));
int main(void)
{
int ret, i;
int32_t exit_code;
- ret = mars_context_create(&mars_ctx, 0, 0);
+ ret = mars_context_create(&mars_ctx, 1, 0);
MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
for (i = 0; i < NUM_LOOP; i++) {
- shared_resource = 0;
+ mars_test_counter_set(&counter, 0);
ret = mars_task_queue_create(
mars_ctx,
- &mpu_to_mpu[i],
+ &mpu_to_mpu,
sizeof(struct queue_entry),
depth_size[i],
MARS_TASK_QUEUE_MPU_TO_MPU);
@@ -69,26 +70,38 @@ int main(void)
/* create push task */
ret = mars_task_create(mars_ctx, &task1_id, NULL,
- mpu1_prog.elf_image, MARS_TASK_CONTEXT_SAVE_SIZE_MAX);
+ mpu1_prog.elf_image,
+ MARS_TASK_CONTEXT_SAVE_SIZE_MAX);
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);
+ task_args.type.u32[0] = depth_size[i];
+ task_args.type.u64[1] = mpu_to_mpu;
+ task_args.type.u64[2] = mars_ptr_to_ea(&counter);
+ ret = mars_task_schedule(&task1_id, &task_args, 0);
MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
- /* check if queue_push is blocked */
- sleep(1);
- MARS_TEST_ASSERT_EQUAL(shared_resource, 0);
+ mars_test_counter_wait(&counter, 1);
+
+ ret = mars_task_create(mars_ctx, &task3_id, NULL,
+ mpu3_prog.elf_image,
+ MARS_TASK_CONTEXT_SAVE_SIZE_MAX);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+ ret = mars_task_schedule(&task3_id, NULL, 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_try_wait(&task1_id, &exit_code);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_ERROR_BUSY);
/* create and run pop task */
ret = mars_task_create(mars_ctx, &task2_id, NULL,
- mpu2_prog.elf_image, MARS_TASK_CONTEXT_SAVE_SIZE_MAX);
+ mpu2_prog.elf_image,
+ MARS_TASK_CONTEXT_SAVE_SIZE_MAX);
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);
+ ret = mars_task_schedule(&task2_id, &task_args, 0);
MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
ret = mars_task_wait(&task2_id, &exit_code);
@@ -106,7 +119,10 @@ int main(void)
ret = mars_task_destroy(&task2_id);
MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
- ret = mars_task_queue_destroy(mpu_to_mpu[i]);
+ ret = mars_task_destroy(&task3_id);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+
+ ret = mars_task_queue_destroy(mpu_to_mpu);
MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
}
diff --git a/tests/TFP/TFP_46_004/mpu1.c b/tests/TFP/TFP_46_004/mpu1.c
index 8b9f4fb..42c1adf 100644
--- a/tests/TFP/TFP_46_004/mpu1.c
+++ b/tests/TFP/TFP_46_004/mpu1.c
@@ -23,37 +23,34 @@
#include <mars/task.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];
+ uint32_t num_push = task_args->type.u32[0];
+ uint64_t mpu_to_mpu_ea = task_args->type.u64[1];
+ uint64_t counter_ea = task_args->type.u64[2];
- /* last one push should be blocked */
- for (i = 0; i < num_push + 1; i++) {
+ for (i = 0; i < num_push; 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();
+ mars_test_counter_add(counter_ea, 1);
+
+ /* last one push should be blocked */
+ 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_46_004/mpu2.c b/tests/TFP/TFP_46_004/mpu2.c
index d2cb953..c2546c3 100644
--- a/tests/TFP/TFP_46_004/mpu2.c
+++ b/tests/TFP/TFP_46_004/mpu2.c
@@ -33,7 +33,7 @@ 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 mpu_to_mpu_ea = task_args->type.u64[1];
ret = mars_task_queue_pop(mpu_to_mpu_ea, &data);
MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
diff --git a/tests/TFP/TFP_46_004/mpu3.c b/tests/TFP/TFP_46_004/mpu3.c
new file mode 100644
index 0000000..bdc8e78
--- /dev/null
+++ b/tests/TFP/TFP_46_004/mpu3.c
@@ -0,0 +1,30 @@
+/*
+ * Copyright 2009 Sony Corporation
+ *
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a copy
+ * of this software and associated documentation files (the "Software"), to deal
+ * in the Software without restriction, including without limitation the rights
+ * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+ * copies of the Software, and to permit persons to whom the Software is
+ * furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included in
+ * all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+ * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, 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.h>
+#include <mars_task_test.h>
+
+int mars_task_main(const struct mars_task_args *task_args)
+{
+ return 0;
+}
diff --git a/tests/TFP/TFP_46_005/Makefile b/tests/TFP/TFP_46_005/Makefile
index ecbce33..72cf999 100644
--- a/tests/TFP/TFP_46_005/Makefile
+++ b/tests/TFP/TFP_46_005/Makefile
@@ -22,7 +22,7 @@
#
top_srcdir = ../..
-test_objs = host.o mpu1.task_eo mpu2.task_eo
+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_46_005/host.c b/tests/TFP/TFP_46_005/host.c
index ca28820..cd1ebc9 100644
--- a/tests/TFP/TFP_46_005/host.c
+++ b/tests/TFP/TFP_46_005/host.c
@@ -40,28 +40,29 @@ static uint32_t depth_size[] =
};
extern spe_program_handle_t mpu1_prog;
extern spe_program_handle_t mpu2_prog;
+extern spe_program_handle_t mpu3_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 struct mars_task_args task_args;
+static struct mars_task_id task1_id, task2_id, task3_id;
-static uint64_t mpu_to_mpu[NUM_LOOP];
-static uint32_t shared_resource __attribute((aligned(16)));
+static uint64_t mpu_to_mpu;
+static uint32_t counter __attribute((aligned(16)));
int main(void)
{
int ret, i;
int32_t exit_code;
- ret = mars_context_create(&mars_ctx, 0, 0);
+ ret = mars_context_create(&mars_ctx, 1, 0);
MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
for (i = 0; i < NUM_LOOP; i++) {
- shared_resource = 0;
+ mars_test_counter_set(&counter, 0);
ret = mars_task_queue_create(
mars_ctx,
- &mpu_to_mpu[i],
+ &mpu_to_mpu,
sizeof(struct queue_entry),
depth_size[i],
MARS_TASK_QUEUE_MPU_TO_MPU);
@@ -69,26 +70,38 @@ int main(void)
/* create push task */
ret = mars_task_create(mars_ctx, &task1_id, NULL,
- mpu1_prog.elf_image, MARS_TASK_CONTEXT_SAVE_SIZE_MAX);
+ mpu1_prog.elf_image,
+ MARS_TASK_CONTEXT_SAVE_SIZE_MAX);
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);
+ task_args.type.u32[0] = depth_size[i];
+ task_args.type.u64[1] = mpu_to_mpu;
+ task_args.type.u64[2] = mars_ptr_to_ea(&counter);
+ ret = mars_task_schedule(&task1_id, &task_args, 0);
MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
- /* check if queue_push is blocked */
- sleep(1);
- MARS_TEST_ASSERT_EQUAL(shared_resource, 0);
+ mars_test_counter_wait(&counter, 1);
+
+ ret = mars_task_create(mars_ctx, &task3_id, NULL,
+ mpu3_prog.elf_image,
+ MARS_TASK_CONTEXT_SAVE_SIZE_MAX);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+ ret = mars_task_schedule(&task3_id, NULL, 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_try_wait(&task1_id, &exit_code);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_ERROR_BUSY);
/* create and run pop task */
ret = mars_task_create(mars_ctx, &task2_id, NULL,
- mpu2_prog.elf_image, MARS_TASK_CONTEXT_SAVE_SIZE_MAX);
+ mpu2_prog.elf_image,
+ MARS_TASK_CONTEXT_SAVE_SIZE_MAX);
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);
+ ret = mars_task_schedule(&task2_id, &task_args, 0);
MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
ret = mars_task_wait(&task2_id, &exit_code);
@@ -106,7 +119,10 @@ int main(void)
ret = mars_task_destroy(&task2_id);
MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
- ret = mars_task_queue_destroy(mpu_to_mpu[i]);
+ ret = mars_task_destroy(&task3_id);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+
+ ret = mars_task_queue_destroy(mpu_to_mpu);
MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
}
diff --git a/tests/TFP/TFP_46_005/mpu1.c b/tests/TFP/TFP_46_005/mpu1.c
index 8b9f4fb..42c1adf 100644
--- a/tests/TFP/TFP_46_005/mpu1.c
+++ b/tests/TFP/TFP_46_005/mpu1.c
@@ -23,37 +23,34 @@
#include <mars/task.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];
+ uint32_t num_push = task_args->type.u32[0];
+ uint64_t mpu_to_mpu_ea = task_args->type.u64[1];
+ uint64_t counter_ea = task_args->type.u64[2];
- /* last one push should be blocked */
- for (i = 0; i < num_push + 1; i++) {
+ for (i = 0; i < num_push; 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();
+ mars_test_counter_add(counter_ea, 1);
+
+ /* last one push should be blocked */
+ 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_46_005/mpu2.c b/tests/TFP/TFP_46_005/mpu2.c
index 9364c56..ab7442b 100644
--- a/tests/TFP/TFP_46_005/mpu2.c
+++ b/tests/TFP/TFP_46_005/mpu2.c
@@ -33,11 +33,10 @@ 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 mpu_to_mpu_ea = task_args->type.u64[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);
diff --git a/tests/TFP/TFP_46_005/mpu3.c b/tests/TFP/TFP_46_005/mpu3.c
new file mode 100644
index 0000000..bdc8e78
--- /dev/null
+++ b/tests/TFP/TFP_46_005/mpu3.c
@@ -0,0 +1,30 @@
+/*
+ * Copyright 2009 Sony Corporation
+ *
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a copy
+ * of this software and associated documentation files (the "Software"), to deal
+ * in the Software without restriction, including without limitation the rights
+ * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+ * copies of the Software, and to permit persons to whom the Software is
+ * furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included in
+ * all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+ * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, 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.h>
+#include <mars_task_test.h>
+
+int mars_task_main(const struct mars_task_args *task_args)
+{
+ return 0;
+}
diff --git a/tests/TFP/TFP_46_007/host.c b/tests/TFP/TFP_46_007/host.c
index c98b6b4..9d13504 100644
--- a/tests/TFP/TFP_46_007/host.c
+++ b/tests/TFP/TFP_46_007/host.c
@@ -30,7 +30,7 @@ struct queue_entry {
uint64_t val1;
uint64_t val2;
};
-#define Q_DEPTH (512)
+#define Q_DEPTH (256)
#define NUM_LOOP 5
static uint32_t depth_size[] =
@@ -48,7 +48,8 @@ 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 uint32_t notify __attribute((aligned(128)));
+static uint32_t counter __attribute((aligned(128)));
static struct queue_entry data;
static void check_queue(uint64_t id, uint64_t num)
@@ -80,12 +81,16 @@ int main(void)
int ret, i;
int32_t exit_code;
uint32_t num;
+ int num_mpu;
+
+ num_mpu = 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++) {
- notify[0] = 0;
+ mars_test_counter_set(&notify, 0);
+ mars_test_counter_set(&counter, 0);
ret = mars_task_queue_create(
mars_ctx,
@@ -102,17 +107,21 @@ int main(void)
MARS_TASK_CONTEXT_SAVE_SIZE_MAX);
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.u32[0] = i;
+ task_args.type.u32[1] = num;
+ task_args.type.u64[1] = mpu_to_host[i];
+ task_args.type.u64[2] = mars_ptr_to_ea(&counter);
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);
+ if (num_mpu < depth_size[i])
+ mars_test_counter_wait(&counter, num_mpu);
+ else
+ mars_test_counter_wait(&counter, depth_size[i]);
+ mars_test_counter_set(&notify, 1);
for (num = 0; num < depth_size[i]; num++) {
ret = mars_task_wait(&task_id[num], &exit_code);
diff --git a/tests/TFP/TFP_46_007/mpu.c b/tests/TFP/TFP_46_007/mpu.c
index db61959..1c9f3e7 100644
--- a/tests/TFP/TFP_46_007/mpu.c
+++ b/tests/TFP/TFP_46_007/mpu.c
@@ -34,19 +34,18 @@ 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 mpu_to_host_ea = task_args->type.u64[1];
+ uint64_t counter_ea = task_args->type.u64[2];
uint64_t notify_ea = task_args->type.u64[3];
- data.val1 = id;
- data.val2 = num;
+ data.val1 = task_args->type.u32[0];
+ data.val2 = task_args->type.u32[1];
+ mars_test_counter_add(counter_ea, 1);
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);
diff --git a/tests/TFP/TFP_46_008/Makefile b/tests/TFP/TFP_46_008/Makefile
index 432135a..ecbce33 100644
--- a/tests/TFP/TFP_46_008/Makefile
+++ b/tests/TFP/TFP_46_008/Makefile
@@ -22,7 +22,7 @@
#
top_srcdir = ../..
-test_objs = host.o mpu.task_eo
+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_008/host.c b/tests/TFP/TFP_46_008/host.c
index e2922bc..9646cfa 100644
--- a/tests/TFP/TFP_46_008/host.c
+++ b/tests/TFP/TFP_46_008/host.c
@@ -32,71 +32,88 @@ struct queue_entry {
};
#define Q_DEPTH (256 * 1024)
-#define NUM_LOOP 3
+#define NUM_LOOP 2
static uint32_t depth_size[] =
{
1,
- Q_DEPTH / 2,
Q_DEPTH
};
-extern spe_program_handle_t mpu_prog;
+extern spe_program_handle_t mpu1_prog, mpu2_prog;
static struct mars_context *mars_ctx;
static struct mars_task_args task_args;
-static struct mars_task_id task_id;
+static struct mars_task_id task1_id, task2_id;
-static uint64_t mpu_to_host[NUM_LOOP];
+static uint64_t mpu_to_host;
static struct queue_entry data;
-static uint32_t shared_resource __attribute((aligned(16)));
+static uint32_t counter __attribute((aligned(16)));
int main(void)
{
int ret, i;
int32_t exit_code;
- ret = mars_context_create(&mars_ctx, 0, 0);
+ ret = mars_context_create(&mars_ctx, 1, 0);
MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
for (i = 0; i < NUM_LOOP; i++) {
- shared_resource = 0;
+ mars_test_counter_set(&counter, 0);
ret = mars_task_queue_create(
mars_ctx,
- &mpu_to_host[i],
+ &mpu_to_host,
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_SIZE_MAX);
+ ret = mars_task_create(mars_ctx, &task1_id, NULL,
+ mpu1_prog.elf_image, MARS_TASK_CONTEXT_SAVE_SIZE_MAX);
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);
+ task_args.type.u32[0] = depth_size[i];
+ task_args.type.u64[1] = mpu_to_host;
+ task_args.type.u64[2] = mars_ptr_to_ea(&counter);
+ ret = mars_task_schedule(&task1_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);
+ /*
+ * check the task is already scheduled
+ */
+ mars_test_counter_wait(&counter, 1);
- /* try pop one */
- ret = mars_task_queue_try_pop(mpu_to_host[i], &data);
+ ret = mars_task_create(mars_ctx, &task2_id, NULL,
+ mpu2_prog.elf_image,
+ MARS_TASK_CONTEXT_SAVE_SIZE_MAX);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+
+ ret = mars_task_schedule(&task2_id, NULL, 0);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+
+ ret = mars_task_wait(&task2_id, &exit_code);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+
+ ret = mars_task_try_wait(&task1_id, &exit_code);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_ERROR_BUSY);
+
+ /* pop one */
+ ret = mars_task_queue_try_pop(mpu_to_host, &data);
MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
/* check if mpu task is successfly finished */
- ret = mars_task_wait(&task_id, &exit_code);
+ 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(&task_id);
+ 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_host[i]);
+ ret = mars_task_queue_destroy(mpu_to_host);
MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
}
diff --git a/tests/TFP/TFP_46_003/mpu.c b/tests/TFP/TFP_46_008/mpu1.c
index 3c44d1f..4afcc66 100644
--- a/tests/TFP/TFP_46_003/mpu.c
+++ b/tests/TFP/TFP_46_008/mpu1.c
@@ -23,37 +23,34 @@
#include <mars/task.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];
+ uint32_t num_push = task_args->type.u32[0];
+ uint64_t mpu_to_host_ea = task_args->type.u64[1];
+ uint64_t counter_ea = task_args->type.u64[2];
/* last one push should be blocked */
- for (i = 0; i < num_push + 1; i++) {
+ for (i = 0; i < num_push; 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();
+ mars_test_counter_add(counter_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/mpu2.c b/tests/TFP/TFP_46_008/mpu2.c
new file mode 100644
index 0000000..bdc8e78
--- /dev/null
+++ b/tests/TFP/TFP_46_008/mpu2.c
@@ -0,0 +1,30 @@
+/*
+ * Copyright 2009 Sony Corporation
+ *
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a copy
+ * of this software and associated documentation files (the "Software"), to deal
+ * in the Software without restriction, including without limitation the rights
+ * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+ * copies of the Software, and to permit persons to whom the Software is
+ * furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included in
+ * all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+ * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, 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.h>
+#include <mars_task_test.h>
+
+int mars_task_main(const struct mars_task_args *task_args)
+{
+ return 0;
+}
diff --git a/tests/TFP/TFP_46_009/Makefile b/tests/TFP/TFP_46_009/Makefile
index ecbce33..72cf999 100644
--- a/tests/TFP/TFP_46_009/Makefile
+++ b/tests/TFP/TFP_46_009/Makefile
@@ -22,7 +22,7 @@
#
top_srcdir = ../..
-test_objs = host.o mpu1.task_eo mpu2.task_eo
+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_46_009/host.c b/tests/TFP/TFP_46_009/host.c
index ca28820..cd1ebc9 100644
--- a/tests/TFP/TFP_46_009/host.c
+++ b/tests/TFP/TFP_46_009/host.c
@@ -40,28 +40,29 @@ static uint32_t depth_size[] =
};
extern spe_program_handle_t mpu1_prog;
extern spe_program_handle_t mpu2_prog;
+extern spe_program_handle_t mpu3_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 struct mars_task_args task_args;
+static struct mars_task_id task1_id, task2_id, task3_id;
-static uint64_t mpu_to_mpu[NUM_LOOP];
-static uint32_t shared_resource __attribute((aligned(16)));
+static uint64_t mpu_to_mpu;
+static uint32_t counter __attribute((aligned(16)));
int main(void)
{
int ret, i;
int32_t exit_code;
- ret = mars_context_create(&mars_ctx, 0, 0);
+ ret = mars_context_create(&mars_ctx, 1, 0);
MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
for (i = 0; i < NUM_LOOP; i++) {
- shared_resource = 0;
+ mars_test_counter_set(&counter, 0);
ret = mars_task_queue_create(
mars_ctx,
- &mpu_to_mpu[i],
+ &mpu_to_mpu,
sizeof(struct queue_entry),
depth_size[i],
MARS_TASK_QUEUE_MPU_TO_MPU);
@@ -69,26 +70,38 @@ int main(void)
/* create push task */
ret = mars_task_create(mars_ctx, &task1_id, NULL,
- mpu1_prog.elf_image, MARS_TASK_CONTEXT_SAVE_SIZE_MAX);
+ mpu1_prog.elf_image,
+ MARS_TASK_CONTEXT_SAVE_SIZE_MAX);
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);
+ task_args.type.u32[0] = depth_size[i];
+ task_args.type.u64[1] = mpu_to_mpu;
+ task_args.type.u64[2] = mars_ptr_to_ea(&counter);
+ ret = mars_task_schedule(&task1_id, &task_args, 0);
MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
- /* check if queue_push is blocked */
- sleep(1);
- MARS_TEST_ASSERT_EQUAL(shared_resource, 0);
+ mars_test_counter_wait(&counter, 1);
+
+ ret = mars_task_create(mars_ctx, &task3_id, NULL,
+ mpu3_prog.elf_image,
+ MARS_TASK_CONTEXT_SAVE_SIZE_MAX);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+ ret = mars_task_schedule(&task3_id, NULL, 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_try_wait(&task1_id, &exit_code);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_ERROR_BUSY);
/* create and run pop task */
ret = mars_task_create(mars_ctx, &task2_id, NULL,
- mpu2_prog.elf_image, MARS_TASK_CONTEXT_SAVE_SIZE_MAX);
+ mpu2_prog.elf_image,
+ MARS_TASK_CONTEXT_SAVE_SIZE_MAX);
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);
+ ret = mars_task_schedule(&task2_id, &task_args, 0);
MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
ret = mars_task_wait(&task2_id, &exit_code);
@@ -106,7 +119,10 @@ int main(void)
ret = mars_task_destroy(&task2_id);
MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
- ret = mars_task_queue_destroy(mpu_to_mpu[i]);
+ ret = mars_task_destroy(&task3_id);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+
+ ret = mars_task_queue_destroy(mpu_to_mpu);
MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
}
diff --git a/tests/TFP/TFP_46_009/mpu1.c b/tests/TFP/TFP_46_009/mpu1.c
index 8b9f4fb..42c1adf 100644
--- a/tests/TFP/TFP_46_009/mpu1.c
+++ b/tests/TFP/TFP_46_009/mpu1.c
@@ -23,37 +23,34 @@
#include <mars/task.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];
+ uint32_t num_push = task_args->type.u32[0];
+ uint64_t mpu_to_mpu_ea = task_args->type.u64[1];
+ uint64_t counter_ea = task_args->type.u64[2];
- /* last one push should be blocked */
- for (i = 0; i < num_push + 1; i++) {
+ for (i = 0; i < num_push; 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();
+ mars_test_counter_add(counter_ea, 1);
+
+ /* last one push should be blocked */
+ 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_46_009/mpu2.c b/tests/TFP/TFP_46_009/mpu2.c
index a9a7a6e..5f4f5e6 100644
--- a/tests/TFP/TFP_46_009/mpu2.c
+++ b/tests/TFP/TFP_46_009/mpu2.c
@@ -33,7 +33,7 @@ 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 mpu_to_mpu_ea = task_args->type.u64[1];
ret = mars_task_queue_try_pop(mpu_to_mpu_ea, &data);
MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
diff --git a/tests/TFP/TFP_46_009/mpu3.c b/tests/TFP/TFP_46_009/mpu3.c
new file mode 100644
index 0000000..bdc8e78
--- /dev/null
+++ b/tests/TFP/TFP_46_009/mpu3.c
@@ -0,0 +1,30 @@
+/*
+ * Copyright 2009 Sony Corporation
+ *
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a copy
+ * of this software and associated documentation files (the "Software"), to deal
+ * in the Software without restriction, including without limitation the rights
+ * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+ * copies of the Software, and to permit persons to whom the Software is
+ * furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included in
+ * all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+ * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, 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.h>
+#include <mars_task_test.h>
+
+int mars_task_main(const struct mars_task_args *task_args)
+{
+ return 0;
+}
diff --git a/tests/TFP/TFP_46_010/Makefile b/tests/TFP/TFP_46_010/Makefile
index ecbce33..72cf999 100644
--- a/tests/TFP/TFP_46_010/Makefile
+++ b/tests/TFP/TFP_46_010/Makefile
@@ -22,7 +22,7 @@
#
top_srcdir = ../..
-test_objs = host.o mpu1.task_eo mpu2.task_eo
+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_46_010/host.c b/tests/TFP/TFP_46_010/host.c
index ca28820..cd1ebc9 100644
--- a/tests/TFP/TFP_46_010/host.c
+++ b/tests/TFP/TFP_46_010/host.c
@@ -40,28 +40,29 @@ static uint32_t depth_size[] =
};
extern spe_program_handle_t mpu1_prog;
extern spe_program_handle_t mpu2_prog;
+extern spe_program_handle_t mpu3_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 struct mars_task_args task_args;
+static struct mars_task_id task1_id, task2_id, task3_id;
-static uint64_t mpu_to_mpu[NUM_LOOP];
-static uint32_t shared_resource __attribute((aligned(16)));
+static uint64_t mpu_to_mpu;
+static uint32_t counter __attribute((aligned(16)));
int main(void)
{
int ret, i;
int32_t exit_code;
- ret = mars_context_create(&mars_ctx, 0, 0);
+ ret = mars_context_create(&mars_ctx, 1, 0);
MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
for (i = 0; i < NUM_LOOP; i++) {
- shared_resource = 0;
+ mars_test_counter_set(&counter, 0);
ret = mars_task_queue_create(
mars_ctx,
- &mpu_to_mpu[i],
+ &mpu_to_mpu,
sizeof(struct queue_entry),
depth_size[i],
MARS_TASK_QUEUE_MPU_TO_MPU);
@@ -69,26 +70,38 @@ int main(void)
/* create push task */
ret = mars_task_create(mars_ctx, &task1_id, NULL,
- mpu1_prog.elf_image, MARS_TASK_CONTEXT_SAVE_SIZE_MAX);
+ mpu1_prog.elf_image,
+ MARS_TASK_CONTEXT_SAVE_SIZE_MAX);
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);
+ task_args.type.u32[0] = depth_size[i];
+ task_args.type.u64[1] = mpu_to_mpu;
+ task_args.type.u64[2] = mars_ptr_to_ea(&counter);
+ ret = mars_task_schedule(&task1_id, &task_args, 0);
MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
- /* check if queue_push is blocked */
- sleep(1);
- MARS_TEST_ASSERT_EQUAL(shared_resource, 0);
+ mars_test_counter_wait(&counter, 1);
+
+ ret = mars_task_create(mars_ctx, &task3_id, NULL,
+ mpu3_prog.elf_image,
+ MARS_TASK_CONTEXT_SAVE_SIZE_MAX);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+ ret = mars_task_schedule(&task3_id, NULL, 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_try_wait(&task1_id, &exit_code);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_ERROR_BUSY);
/* create and run pop task */
ret = mars_task_create(mars_ctx, &task2_id, NULL,
- mpu2_prog.elf_image, MARS_TASK_CONTEXT_SAVE_SIZE_MAX);
+ mpu2_prog.elf_image,
+ MARS_TASK_CONTEXT_SAVE_SIZE_MAX);
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);
+ ret = mars_task_schedule(&task2_id, &task_args, 0);
MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
ret = mars_task_wait(&task2_id, &exit_code);
@@ -106,7 +119,10 @@ int main(void)
ret = mars_task_destroy(&task2_id);
MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
- ret = mars_task_queue_destroy(mpu_to_mpu[i]);
+ ret = mars_task_destroy(&task3_id);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+
+ ret = mars_task_queue_destroy(mpu_to_mpu);
MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
}
diff --git a/tests/TFP/TFP_46_010/mpu1.c b/tests/TFP/TFP_46_010/mpu1.c
index 8b9f4fb..42c1adf 100644
--- a/tests/TFP/TFP_46_010/mpu1.c
+++ b/tests/TFP/TFP_46_010/mpu1.c
@@ -23,37 +23,34 @@
#include <mars/task.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];
+ uint32_t num_push = task_args->type.u32[0];
+ uint64_t mpu_to_mpu_ea = task_args->type.u64[1];
+ uint64_t counter_ea = task_args->type.u64[2];
- /* last one push should be blocked */
- for (i = 0; i < num_push + 1; i++) {
+ for (i = 0; i < num_push; 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();
+ mars_test_counter_add(counter_ea, 1);
+
+ /* last one push should be blocked */
+ 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_46_010/mpu2.c b/tests/TFP/TFP_46_010/mpu2.c
index f536e15..1e3f57e 100644
--- a/tests/TFP/TFP_46_010/mpu2.c
+++ b/tests/TFP/TFP_46_010/mpu2.c
@@ -33,11 +33,10 @@ 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 mpu_to_mpu_ea = task_args->type.u64[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);
diff --git a/tests/TFP/TFP_46_010/mpu3.c b/tests/TFP/TFP_46_010/mpu3.c
new file mode 100644
index 0000000..bdc8e78
--- /dev/null
+++ b/tests/TFP/TFP_46_010/mpu3.c
@@ -0,0 +1,30 @@
+/*
+ * Copyright 2009 Sony Corporation
+ *
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a copy
+ * of this software and associated documentation files (the "Software"), to deal
+ * in the Software without restriction, including without limitation the rights
+ * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+ * copies of the Software, and to permit persons to whom the Software is
+ * furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included in
+ * all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+ * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, 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.h>
+#include <mars_task_test.h>
+
+int mars_task_main(const struct mars_task_args *task_args)
+{
+ return 0;
+}
diff --git a/tests/TFP/TFP_47_001/host.c b/tests/TFP/TFP_47_001/host.c
index 4834c53..1b71850 100644
--- a/tests/TFP/TFP_47_001/host.c
+++ b/tests/TFP/TFP_47_001/host.c
@@ -49,19 +49,24 @@ 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 uint32_t notify __attribute((aligned(128)));
+static uint32_t counter __attribute((aligned(128)));
int main(void)
{
int ret, i;
int32_t exit_code;
uint32_t num;
+ int num_mpu;
+
+ num_mpu = 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++) {
- notify[0] = 0;
+ mars_test_counter_set(&notify, 0);
+ mars_test_counter_set(&counter, 0);
ret = mars_task_queue_create(
mars_ctx,
@@ -78,9 +83,10 @@ int main(void)
MARS_TASK_CONTEXT_SAVE_SIZE_MAX);
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.u32[0] = i;
+ task1_args.type.u32[1] = num;
+ task1_args.type.u64[1] = mpu_to_mpu[i];
+ task1_args.type.u64[2] = mars_ptr_to_ea(&counter);
task1_args.type.u64[3] = mars_ptr_to_ea(&notify);
ret = mars_task_schedule(&task1_id[num],
&task1_args, 0);
@@ -92,8 +98,11 @@ int main(void)
mpu2_prog.elf_image, MARS_TASK_CONTEXT_SAVE_SIZE_MAX);
/* start push task at the same time */
- sleep(1);
- mars_test_counter_set(&notify[0], 1);
+ if (num_mpu < depth_size[i])
+ mars_test_counter_wait(&counter, num_mpu);
+ else
+ mars_test_counter_wait(&counter, depth_size[i]);
+ mars_test_counter_set(&notify, 1);
for (num = 0; num < depth_size[i]; num++) {
ret = mars_task_wait(&task1_id[num], &exit_code);
@@ -102,9 +111,9 @@ int main(void)
}
/* 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];
+ task2_args.type.u64[1] = mpu_to_mpu[i];
+ task2_args.type.u32[0] = i;
+ task2_args.type.u32[1] = depth_size[i];
ret = mars_task_schedule(&task2_id, &task2_args, 0);
MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
@@ -119,6 +128,7 @@ int main(void)
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);
}
diff --git a/tests/TFP/TFP_47_001/mpu1.c b/tests/TFP/TFP_47_001/mpu1.c
index 2b33a1c..d18c883 100644
--- a/tests/TFP/TFP_47_001/mpu1.c
+++ b/tests/TFP/TFP_47_001/mpu1.c
@@ -34,19 +34,18 @@ 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 mpu_to_mpu_ea = task_args->type.u64[1];
+ uint64_t counter_ea = task_args->type.u64[2];
uint64_t notify_ea = task_args->type.u64[3];
- data.val1 = id;
- data.val2 = num;
+ data.val1 = task_args->type.u32[0];
+ data.val2 = task_args->type.u32[1];
+ mars_test_counter_add(counter_ea, 1);
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);
diff --git a/tests/TFP/TFP_47_001/mpu2.c b/tests/TFP/TFP_47_001/mpu2.c
index 7bc93fd..308f54d 100644
--- a/tests/TFP/TFP_47_001/mpu2.c
+++ b/tests/TFP/TFP_47_001/mpu2.c
@@ -33,9 +33,9 @@ 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 id = task_args->type.u32[0];
+ uint64_t num = task_args->type.u32[1];
+ uint64_t mpu_to_mpu_ea = task_args->type.u64[1];
uint64_t sum, sum_q;
uint32_t count;
diff --git a/tests/TFP/TFP_48_004/host.c b/tests/TFP/TFP_48_004/host.c
index 8a0a63c..f5fbcd8 100644
--- a/tests/TFP/TFP_48_004/host.c
+++ b/tests/TFP/TFP_48_004/host.c
@@ -49,11 +49,12 @@ 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 queue_entry data[Q_DEPTH];
static struct mars_task_args thread_args[Q_DEPTH];
static pthread_t thread[Q_DEPTH];
+static pthread_barrier_t barrier;
+
static void *thread_proc(void *ptr)
{
int ret;
@@ -62,8 +63,7 @@ static void *thread_proc(void *ptr)
uint32_t count = (uint32_t)task_args->type.u32[1];
/* wait for start */
- while (!shared_resource)
- usleep(100);
+ pthread_barrier_wait(&barrier);
data[count].val1 = (uint64_t)id;
data[count].val2 = (uint64_t)count;
@@ -83,7 +83,8 @@ int main(void)
MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
for (i = 0; i < NUM_LOOP; i++) {
- shared_resource = 0;
+ ret = pthread_barrier_init(&barrier, NULL, depth_size[i]);
+ MARS_TEST_ASSERT(ret == 0);
ret = mars_task_queue_create(
mars_ctx,
@@ -97,18 +98,15 @@ int main(void)
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]);
+ ret = pthread_create(&thread[num], NULL,
+ thread_proc, &thread_args[num]);
+ MARS_TEST_ASSERT(ret == 0);
}
/* create pop task */
ret = mars_task_create(mars_ctx, &task_id, NULL,
mpu_prog.elf_image, MARS_TASK_CONTEXT_SAVE_SIZE_MAX);
- /* 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);
@@ -129,6 +127,9 @@ int main(void)
ret = mars_task_queue_destroy(host_to_mpu[i]);
MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+
+ ret = pthread_barrier_destroy(&barrier);
+ MARS_TEST_ASSERT(ret == MARS_SUCCESS);
}
ret = mars_context_destroy(mars_ctx);
diff --git a/tests/TFP/TFP_48_005/host.c b/tests/TFP/TFP_48_005/host.c
index b8aae29..9d13504 100644
--- a/tests/TFP/TFP_48_005/host.c
+++ b/tests/TFP/TFP_48_005/host.c
@@ -48,7 +48,8 @@ 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 uint32_t notify __attribute((aligned(128)));
+static uint32_t counter __attribute((aligned(128)));
static struct queue_entry data;
static void check_queue(uint64_t id, uint64_t num)
@@ -80,12 +81,16 @@ int main(void)
int ret, i;
int32_t exit_code;
uint32_t num;
+ int num_mpu;
+
+ num_mpu = 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++) {
- notify[0] = 0;
+ mars_test_counter_set(&notify, 0);
+ mars_test_counter_set(&counter, 0);
ret = mars_task_queue_create(
mars_ctx,
@@ -102,17 +107,21 @@ int main(void)
MARS_TASK_CONTEXT_SAVE_SIZE_MAX);
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.u32[0] = i;
+ task_args.type.u32[1] = num;
+ task_args.type.u64[1] = mpu_to_host[i];
+ task_args.type.u64[2] = mars_ptr_to_ea(&counter);
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);
+ if (num_mpu < depth_size[i])
+ mars_test_counter_wait(&counter, num_mpu);
+ else
+ mars_test_counter_wait(&counter, depth_size[i]);
+ mars_test_counter_set(&notify, 1);
for (num = 0; num < depth_size[i]; num++) {
ret = mars_task_wait(&task_id[num], &exit_code);
diff --git a/tests/TFP/TFP_48_005/mpu.c b/tests/TFP/TFP_48_005/mpu.c
index 3279c62..42bc8f3 100644
--- a/tests/TFP/TFP_48_005/mpu.c
+++ b/tests/TFP/TFP_48_005/mpu.c
@@ -34,14 +34,14 @@ 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 mpu_to_host_ea = task_args->type.u64[1];
+ uint64_t counter_ea = task_args->type.u64[2];
uint64_t notify_ea = task_args->type.u64[3];
- data.val1 = id;
- data.val2 = num;
+ data.val1 = task_args->type.u32[0];
+ data.val2 = task_args->type.u32[1];
+ mars_test_counter_add(counter_ea, 1);
mars_test_counter_wait(notify_ea, 1);
ret = mars_task_queue_try_push(mpu_to_host_ea, &data);
diff --git a/tests/TFP/TFP_48_006/host.c b/tests/TFP/TFP_48_006/host.c
index 4834c53..1b71850 100644
--- a/tests/TFP/TFP_48_006/host.c
+++ b/tests/TFP/TFP_48_006/host.c
@@ -49,19 +49,24 @@ 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 uint32_t notify __attribute((aligned(128)));
+static uint32_t counter __attribute((aligned(128)));
int main(void)
{
int ret, i;
int32_t exit_code;
uint32_t num;
+ int num_mpu;
+
+ num_mpu = 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++) {
- notify[0] = 0;
+ mars_test_counter_set(&notify, 0);
+ mars_test_counter_set(&counter, 0);
ret = mars_task_queue_create(
mars_ctx,
@@ -78,9 +83,10 @@ int main(void)
MARS_TASK_CONTEXT_SAVE_SIZE_MAX);
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.u32[0] = i;
+ task1_args.type.u32[1] = num;
+ task1_args.type.u64[1] = mpu_to_mpu[i];
+ task1_args.type.u64[2] = mars_ptr_to_ea(&counter);
task1_args.type.u64[3] = mars_ptr_to_ea(&notify);
ret = mars_task_schedule(&task1_id[num],
&task1_args, 0);
@@ -92,8 +98,11 @@ int main(void)
mpu2_prog.elf_image, MARS_TASK_CONTEXT_SAVE_SIZE_MAX);
/* start push task at the same time */
- sleep(1);
- mars_test_counter_set(&notify[0], 1);
+ if (num_mpu < depth_size[i])
+ mars_test_counter_wait(&counter, num_mpu);
+ else
+ mars_test_counter_wait(&counter, depth_size[i]);
+ mars_test_counter_set(&notify, 1);
for (num = 0; num < depth_size[i]; num++) {
ret = mars_task_wait(&task1_id[num], &exit_code);
@@ -102,9 +111,9 @@ int main(void)
}
/* 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];
+ task2_args.type.u64[1] = mpu_to_mpu[i];
+ task2_args.type.u32[0] = i;
+ task2_args.type.u32[1] = depth_size[i];
ret = mars_task_schedule(&task2_id, &task2_args, 0);
MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
@@ -119,6 +128,7 @@ int main(void)
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);
}
diff --git a/tests/TFP/TFP_48_006/mpu1.c b/tests/TFP/TFP_48_006/mpu1.c
index 99f7f0c..15faa06 100644
--- a/tests/TFP/TFP_48_006/mpu1.c
+++ b/tests/TFP/TFP_48_006/mpu1.c
@@ -34,14 +34,14 @@ 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 mpu_to_mpu_ea = task_args->type.u64[1];
+ uint64_t counter_ea = task_args->type.u64[2];
uint64_t notify_ea = task_args->type.u64[3];
- data.val1 = id;
- data.val2 = num;
+ data.val1 = task_args->type.u32[0];
+ data.val2 = task_args->type.u32[1];
+ mars_test_counter_add(counter_ea, 1);
mars_test_counter_wait(notify_ea, 1);
ret = mars_task_queue_try_push(mpu_to_mpu_ea, &data);
diff --git a/tests/TFP/TFP_48_006/mpu2.c b/tests/TFP/TFP_48_006/mpu2.c
index 7bc93fd..308f54d 100644
--- a/tests/TFP/TFP_48_006/mpu2.c
+++ b/tests/TFP/TFP_48_006/mpu2.c
@@ -33,9 +33,9 @@ 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 id = task_args->type.u32[0];
+ uint64_t num = task_args->type.u32[1];
+ uint64_t mpu_to_mpu_ea = task_args->type.u64[1];
uint64_t sum, sum_q;
uint32_t count;
diff --git a/tests/TFP/TFP_49_001/host.c b/tests/TFP/TFP_49_001/host.c
index 48e8dc8..1354d09 100644
--- a/tests/TFP/TFP_49_001/host.c
+++ b/tests/TFP/TFP_49_001/host.c
@@ -21,68 +21,86 @@
* THE SOFTWARE.
*/
-#include <unistd.h>
-#include <libspe2.h>
#include <mars/task.h>
+#include <libspe2.h>
#include <mars_test.h>
-#include "host_and_mpu.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;
-static struct mars_task_id task_id;
+static struct mars_context *mars_ctx;
static struct mars_task_args task_args;
-static uint64_t queue;
-static uint64_t queue_item[2];
+static struct mars_task_id task_id;
+
+static uint64_t mpu_to_host[NUM_LOOP];
+static struct queue_entry data;
int main(void)
{
- int i, exit_code, ret;
+ int ret, i;
+ int32_t exit_code;
+ uint32_t count;
+ uint64_t num, sum;
- ret = mars_context_create(&mars, 0, 0);
+ ret = mars_context_create(&mars_ctx, 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_SIZE_MAX);
- 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_create(
- mars,
- &queue,
- 16,
- QUEUE_DEPTH,
- 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_SIZE_MAX);
+ 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);
+ 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);
- usleep(100000);
+ 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);
- for (i = 0; i < QUEUE_DEPTH; i++) {
- ret = mars_task_queue_pop(queue, queue_item);
+ ret = mars_task_destroy(&task_id);
MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
- MARS_TEST_ASSERT(queue_item[0] == i && queue_item[1] == i);
+ ret = mars_task_queue_destroy(mpu_to_host[i]);
+ 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);
+ ret = mars_context_destroy(mars_ctx);
MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
return 0;
}
+
diff --git a/tests/TFP/TFP_49_001/mpu.c b/tests/TFP/TFP_49_001/mpu.c
index ea17786..efc4f0c 100644
--- a/tests/TFP/TFP_49_001/mpu.c
+++ b/tests/TFP/TFP_49_001/mpu.c
@@ -21,40 +21,31 @@
* THE SOFTWARE.
*/
-#include <string.h>
#include <mars/task.h>
-#include "mars_task_test.h"
-#include "host_and_mpu.h"
+#include <mars_task_test.h>
-static uint64_t queue_item[2] __attribute__((aligned(16)));
+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)
{
- 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);
+ 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);
}
- mars_task_exit(0);
+ /* try_push depth + 1 should be BUSY */
+ ret = mars_task_queue_try_push_begin(mpu_to_host_ea, &data, 1);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_ERROR_BUSY);
return 0;
}
diff --git a/tests/TFP/TFP_49_003/host.c b/tests/TFP/TFP_49_003/host.c
index 81b7253..9d13504 100644
--- a/tests/TFP/TFP_49_003/host.c
+++ b/tests/TFP/TFP_49_003/host.c
@@ -30,7 +30,7 @@ struct queue_entry {
uint64_t val1;
uint64_t val2;
};
-#define Q_DEPTH (512)
+#define Q_DEPTH (256)
#define NUM_LOOP 5
static uint32_t depth_size[] =
@@ -48,7 +48,8 @@ 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 uint32_t notify __attribute((aligned(128)));
+static uint32_t counter __attribute((aligned(128)));
static struct queue_entry data;
static void check_queue(uint64_t id, uint64_t num)
@@ -80,12 +81,16 @@ int main(void)
int ret, i;
int32_t exit_code;
uint32_t num;
+ int num_mpu;
+
+ num_mpu = 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++) {
- notify[0] = 0;
+ mars_test_counter_set(&notify, 0);
+ mars_test_counter_set(&counter, 0);
ret = mars_task_queue_create(
mars_ctx,
@@ -102,17 +107,21 @@ int main(void)
MARS_TASK_CONTEXT_SAVE_SIZE_MAX);
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.u32[0] = i;
+ task_args.type.u32[1] = num;
+ task_args.type.u64[1] = mpu_to_host[i];
+ task_args.type.u64[2] = mars_ptr_to_ea(&counter);
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);
+ if (num_mpu < depth_size[i])
+ mars_test_counter_wait(&counter, num_mpu);
+ else
+ mars_test_counter_wait(&counter, depth_size[i]);
+ mars_test_counter_set(&notify, 1);
for (num = 0; num < depth_size[i]; num++) {
ret = mars_task_wait(&task_id[num], &exit_code);
@@ -127,6 +136,7 @@ int main(void)
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);
}
diff --git a/tests/TFP/TFP_49_003/mpu.c b/tests/TFP/TFP_49_003/mpu.c
index f9a4a37..baba510 100644
--- a/tests/TFP/TFP_49_003/mpu.c
+++ b/tests/TFP/TFP_49_003/mpu.c
@@ -34,19 +34,18 @@ 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 mpu_to_host_ea = task_args->type.u64[1];
+ uint64_t counter_ea = task_args->type.u64[2];
uint64_t notify_ea = task_args->type.u64[3];
- data.val1 = id;
- data.val2 = num;
+ data.val1 = task_args->type.u32[0];
+ data.val2 = task_args->type.u32[1];
+ mars_test_counter_add(counter_ea, 1);
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);
diff --git a/tests/TFP/TFP_49_004/host.c b/tests/TFP/TFP_49_004/host.c
index 4834c53..1b71850 100644
--- a/tests/TFP/TFP_49_004/host.c
+++ b/tests/TFP/TFP_49_004/host.c
@@ -49,19 +49,24 @@ 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 uint32_t notify __attribute((aligned(128)));
+static uint32_t counter __attribute((aligned(128)));
int main(void)
{
int ret, i;
int32_t exit_code;
uint32_t num;
+ int num_mpu;
+
+ num_mpu = 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++) {
- notify[0] = 0;
+ mars_test_counter_set(&notify, 0);
+ mars_test_counter_set(&counter, 0);
ret = mars_task_queue_create(
mars_ctx,
@@ -78,9 +83,10 @@ int main(void)
MARS_TASK_CONTEXT_SAVE_SIZE_MAX);
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.u32[0] = i;
+ task1_args.type.u32[1] = num;
+ task1_args.type.u64[1] = mpu_to_mpu[i];
+ task1_args.type.u64[2] = mars_ptr_to_ea(&counter);
task1_args.type.u64[3] = mars_ptr_to_ea(&notify);
ret = mars_task_schedule(&task1_id[num],
&task1_args, 0);
@@ -92,8 +98,11 @@ int main(void)
mpu2_prog.elf_image, MARS_TASK_CONTEXT_SAVE_SIZE_MAX);
/* start push task at the same time */
- sleep(1);
- mars_test_counter_set(&notify[0], 1);
+ if (num_mpu < depth_size[i])
+ mars_test_counter_wait(&counter, num_mpu);
+ else
+ mars_test_counter_wait(&counter, depth_size[i]);
+ mars_test_counter_set(&notify, 1);
for (num = 0; num < depth_size[i]; num++) {
ret = mars_task_wait(&task1_id[num], &exit_code);
@@ -102,9 +111,9 @@ int main(void)
}
/* 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];
+ task2_args.type.u64[1] = mpu_to_mpu[i];
+ task2_args.type.u32[0] = i;
+ task2_args.type.u32[1] = depth_size[i];
ret = mars_task_schedule(&task2_id, &task2_args, 0);
MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
@@ -119,6 +128,7 @@ int main(void)
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);
}
diff --git a/tests/TFP/TFP_49_004/mpu1.c b/tests/TFP/TFP_49_004/mpu1.c
index 951c876..b5e0442 100644
--- a/tests/TFP/TFP_49_004/mpu1.c
+++ b/tests/TFP/TFP_49_004/mpu1.c
@@ -34,19 +34,18 @@ 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 mpu_to_mpu_ea = task_args->type.u64[1];
+ uint64_t counter_ea = task_args->type.u64[2];
uint64_t notify_ea = task_args->type.u64[3];
- data.val1 = id;
- data.val2 = num;
+ data.val1 = task_args->type.u32[0];
+ data.val2 = task_args->type.u32[1];
+ mars_test_counter_add(counter_ea, 1);
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);
diff --git a/tests/TFP/TFP_49_004/mpu2.c b/tests/TFP/TFP_49_004/mpu2.c
index 7bc93fd..308f54d 100644
--- a/tests/TFP/TFP_49_004/mpu2.c
+++ b/tests/TFP/TFP_49_004/mpu2.c
@@ -33,9 +33,9 @@ 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 id = task_args->type.u32[0];
+ uint64_t num = task_args->type.u32[1];
+ uint64_t mpu_to_mpu_ea = task_args->type.u64[1];
uint64_t sum, sum_q;
uint32_t count;
diff --git a/tests/TFP/TFP_4A_001/Makefile b/tests/TFP/TFP_4A_001/Makefile
index 432135a..ecbce33 100644
--- a/tests/TFP/TFP_4A_001/Makefile
+++ b/tests/TFP/TFP_4A_001/Makefile
@@ -22,7 +22,7 @@
#
top_srcdir = ../..
-test_objs = host.o mpu.task_eo
+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_001/host.c b/tests/TFP/TFP_4A_001/host.c
index 5273695..65c1987 100644
--- a/tests/TFP/TFP_4A_001/host.c
+++ b/tests/TFP/TFP_4A_001/host.c
@@ -28,26 +28,27 @@
#define QUEUE_DEPTH 16
-extern spe_program_handle_t mpu_prog;
+extern spe_program_handle_t mpu1_prog, mpu2_prog;
static struct mars_context *mars;
-static struct mars_task_id task_id;
+static struct mars_task_id task1_id, task2_id;
static struct mars_task_args task_args;
static uint64_t queue;
-static uint64_t queue_item[2], mpu_answer __attribute__((aligned(16)));
+static uint64_t queue_item[2] __attribute__((aligned(16)));
+static uint32_t notify __attribute__((aligned(16)));
int main(void)
{
int exit_code, ret;
- ret = mars_context_create(&mars, 0, 0);
+ ret = mars_context_create(&mars, 1, 0);
MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
ret = mars_task_create(
mars,
- &task_id,
+ &task1_id,
"4A001",
- mpu_prog.elf_image,
+ mpu1_prog.elf_image,
MARS_TASK_CONTEXT_SAVE_SIZE_MAX);
MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
@@ -59,28 +60,41 @@ int main(void)
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);
+ task_args.type.u64[1] = mars_ptr_to_ea(&notify);
+ ret = mars_task_schedule(&task1_id, &task_args, 0);
MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
- usleep(200000);
+ ret = mars_task_create(
+ mars,
+ &task2_id,
+ "4A001",
+ mpu2_prog.elf_image,
+ MARS_TASK_CONTEXT_SAVE_SIZE_MAX);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+ ret = mars_task_schedule(&task2_id, NULL, 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_EQUAL(exit_code, 0);
+ ret = mars_task_destroy(&task2_id);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
- mpu_answer = 1;
+ MARS_TEST_ASSERT_EQUAL_INT(mars_test_counter_get(&notify), 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_counter_add(&notify, 1);
+
+ ret = mars_task_wait(&task1_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);
+ ret = mars_task_destroy(&task1_id);
MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
ret = mars_context_destroy(mars);
diff --git a/tests/TFP/TFP_4A_001/mpu.c b/tests/TFP/TFP_4A_001/mpu1.c
index 6413107..9532152 100644
--- a/tests/TFP/TFP_4A_001/mpu.c
+++ b/tests/TFP/TFP_4A_001/mpu1.c
@@ -21,8 +21,6 @@
* THE SOFTWARE.
*/
-#include <string.h>
-#include <spu_mfcio.h>
#include <mars/task.h>
#include "mars_task_test.h"
@@ -31,17 +29,15 @@ 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;
+ uint64_t notify_ea = task_args->type.u64[1];
int ret;
+ mars_test_counter_add(notify_ea, 1);
+
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);
-
+ mars_test_counter_add(notify_ea, 1);
+ mars_test_counter_wait(notify_ea, 3);
return 0;
}
diff --git a/tests/TFP/TFP_4A_001/mpu2.c b/tests/TFP/TFP_4A_001/mpu2.c
new file mode 100644
index 0000000..7c653c4
--- /dev/null
+++ b/tests/TFP/TFP_4A_001/mpu2.c
@@ -0,0 +1,29 @@
+/*
+ * Copyright 2009 Sony Corporation
+ *
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a copy
+ * of this software and associated documentation files (the "Software"), to deal
+ * in the Software without restriction, including without limitation the rights
+ * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+ * copies of the Software, and to permit persons to whom the Software is
+ * furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included in
+ * all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+ * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, 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.h>
+
+int mars_task_main(const struct mars_task_args *task_args)
+{
+ return 0;
+}
diff --git a/tests/TFP/TFP_4A_002/host.c b/tests/TFP/TFP_4A_002/host.c
index aa30c26..fb0660d 100644
--- a/tests/TFP/TFP_4A_002/host.c
+++ b/tests/TFP/TFP_4A_002/host.c
@@ -21,6 +21,10 @@
* THE SOFTWARE.
*/
+#include <sys/types.h>
+#include <linux/unistd.h>
+#include <errno.h>
+#include <pthread.h>
#include <libspe2.h>
#include <mars/task.h>
#include <mars_test.h>
@@ -33,7 +37,72 @@ 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)));
+static uint64_t queue_item[2] __attribute__((aligned(16)));
+static uint32_t notify __attribute__((aligned(16)));
+
+static pthread_t thread;
+static pid_t thread_pid;
+/*
+ * N O T E:
+ * This test uses Linux specific feature, in other word, you can not
+ * run this test program on the system other than Linux.
+ */
+
+int is_thread_blocked(pid_t tid)
+{
+ FILE *tstat;
+ char path[128];
+ char buf[1024];
+ int n;
+
+ snprintf(path, sizeof(path) - 1, "/proc/%d/status", tid);
+ tstat = fopen(path, "r");
+ MARS_TEST_ASSERT(tstat != NULL);
+
+ while ((n = fscanf(tstat, "State:\t%s\n", buf)) != EOF) {
+ if (n == 1)
+ break;
+ else
+ fgetc(tstat);
+ }
+ fclose(tstat);
+
+ switch (buf[0]) {
+ case 'R': /* running */
+ case 'D': /* disk sleep */
+ return 0;
+ break;
+ case 'S': /* sleep */
+ return 1;
+ break;
+ case 'T': /* trace stopped / stopped */
+ case 'Z': /* zonbie */
+ case 'X': /* dead */
+ default:
+ MARS_TEST_ASSERT(0);
+ return 0;
+ break;
+ };
+}
+
+pid_t linux_get_thread_id(void)
+{
+ return syscall(__NR_gettid);
+};
+
+static void *thread_proc(void *ptr)
+{
+ int ret;
+
+ thread_pid = linux_get_thread_id();
+ mars_test_counter_set(&notify, 1);
+
+ /* the last one push should be blocked */
+ ret = mars_task_queue_pop(queue, queue_item);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+
+ return NULL;
+}
int main(void)
{
@@ -46,14 +115,6 @@ int main(void)
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_SIZE_MAX);
- MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
-
ret = mars_task_queue_create(
mars,
&queue,
@@ -62,23 +123,33 @@ int main(void)
MARS_TASK_QUEUE_MPU_TO_HOST);
MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
- mpu_answer = 0;
+ pthread_create(&thread, NULL,
+ thread_proc, NULL);
- 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);
+ /* wait for the thread being blocked */
+ mars_test_counter_wait(&notify, 1);
+ while (!is_thread_blocked(thread_pid))
+ ;
- ret = mars_task_queue_pop(queue, queue_item);
+ ret = mars_task_create(
+ mars,
+ &task_id,
+ "4A002",
+ mpu_prog.elf_image,
+ MARS_TASK_CONTEXT_SAVE_SIZE_MAX);
MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
- MARS_TEST_ASSERT(mpu_answer);
+ 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);
+ /* check if thread is finished for queue_push */
+ pthread_join(thread, NULL);
+
ret = mars_task_queue_destroy(queue);
MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
diff --git a/tests/TFP/TFP_4A_002/mpu.c b/tests/TFP/TFP_4A_002/mpu.c
index b17a831..a5fce0e 100644
--- a/tests/TFP/TFP_4A_002/mpu.c
+++ b/tests/TFP/TFP_4A_002/mpu.c
@@ -31,18 +31,10 @@ 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
index ecbce33..72cf999 100644
--- a/tests/TFP/TFP_4A_003/Makefile
+++ b/tests/TFP/TFP_4A_003/Makefile
@@ -22,7 +22,7 @@
#
top_srcdir = ../..
-test_objs = host.o mpu1.task_eo mpu2.task_eo
+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_4A_003/host.c b/tests/TFP/TFP_4A_003/host.c
index 51db720..32c77bd 100644
--- a/tests/TFP/TFP_4A_003/host.c
+++ b/tests/TFP/TFP_4A_003/host.c
@@ -27,23 +27,19 @@
#define QUEUE_DEPTH 16
-extern spe_program_handle_t mpu1_prog, mpu2_prog;
+extern spe_program_handle_t mpu1_prog, mpu2_prog, mpu3_prog;
static struct mars_context *mars;
-static struct mars_task_id pusher_task_id, poper_task_id;
+static struct mars_task_id pusher_task_id, poper_task_id, dummy_task_id;
static struct mars_task_args task_args;
static uint64_t queue;
-static uint64_t mpu_answer __attribute__((aligned(16)));
+static uint32_t notify __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);
+ ret = mars_context_create(&mars, 1, 0);
MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
ret = mars_task_create(
@@ -62,6 +58,14 @@ int main(void)
MARS_TASK_CONTEXT_SAVE_SIZE_MAX);
MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+ ret = mars_task_create(
+ mars,
+ &dummy_task_id,
+ "4A003",
+ mpu3_prog.elf_image,
+ MARS_TASK_CONTEXT_SAVE_SIZE_MAX);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+
ret = mars_task_queue_create(
mars,
&queue,
@@ -70,21 +74,31 @@ int main(void)
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);
+ 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(&poper_task_id, &task_args, 0);
+ mars_test_counter_wait(&notify, 1);
+
+ /* dummy task can be scheduled? */
+ ret = mars_task_schedule(&dummy_task_id, NULL, 0);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+ ret = mars_task_wait(&dummy_task_id, &exit_code);
MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+ MARS_TEST_ASSERT_EQUAL(exit_code, 0);
+ MARS_TEST_ASSERT_EQUAL_INT(mars_test_counter_get(&notify), 1);
+
+ /* push data */
+ 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);
+ mars_test_counter_add(&notify, 1);
+
ret = mars_task_wait(&poper_task_id, &exit_code);
MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
MARS_TEST_ASSERT_EQUAL(exit_code, 0);
@@ -98,8 +112,12 @@ int main(void)
ret = mars_task_destroy(&poper_task_id);
MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+ ret = mars_task_destroy(&dummy_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
index 6cc30c7..a5fce0e 100644
--- a/tests/TFP/TFP_4A_003/mpu1.c
+++ b/tests/TFP/TFP_4A_003/mpu1.c
@@ -31,18 +31,10 @@ 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
index 4266150..8f7a99b 100644
--- a/tests/TFP/TFP_4A_003/mpu2.c
+++ b/tests/TFP/TFP_4A_003/mpu2.c
@@ -22,7 +22,6 @@
*/
#include <string.h>
-#include <spu_mfcio.h>
#include <mars/task.h>
#include "mars_task_test.h"
@@ -31,17 +30,14 @@ 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 notify = task_args->type.u64[1];
int ret;
- uint64_t mpu_answer;
+ mars_test_counter_add(notify, 1);
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);
-
+ mars_test_counter_add(notify, 1);
+ mars_test_counter_wait(notify, 3);
return 0;
}
diff --git a/tests/TFP/TFP_4A_003/mpu3.c b/tests/TFP/TFP_4A_003/mpu3.c
new file mode 100644
index 0000000..50dca43
--- /dev/null
+++ b/tests/TFP/TFP_4A_003/mpu3.c
@@ -0,0 +1,30 @@
+/*
+ * Copyright 2009 Sony Corporation
+ *
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a copy
+ * of this software and associated documentation files (the "Software"), to deal
+ * in the Software without restriction, including without limitation the rights
+ * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+ * copies of the Software, and to permit persons to whom the Software is
+ * furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included in
+ * all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+ * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ * LIABILITY, WHETHER IN AN ACTION OF 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/task.h>
+
+int mars_task_main(const struct mars_task_args *task_args)
+{
+ return 0;
+}
diff --git a/tests/TFP/TFP_4A_004/host.c b/tests/TFP/TFP_4A_004/host.c
index 91d577a..923f421 100644
--- a/tests/TFP/TFP_4A_004/host.c
+++ b/tests/TFP/TFP_4A_004/host.c
@@ -39,7 +39,7 @@ static uint32_t depth_size[] =
{
1,
Q_DEPTH / 2,
- Q_DEPTH,
+ Q_DEPTH -1 ,
Q_DEPTH,
Q_DEPTH
};
@@ -49,8 +49,9 @@ 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 uint64_t host_to_mpu;
+static uint32_t notify __attribute((aligned(128)));
+static uint32_t go __attribute((aligned(128)));
static struct queue_entry data;
static void queue_push(uint64_t id, uint64_t count)
@@ -60,7 +61,7 @@ static void queue_push(uint64_t id, uint64_t count)
for (i = 0; i < count; i++) {
data.val1 = i;
data.val2 = i + TEST_DIFF;
- ret = mars_task_queue_push(host_to_mpu[id], &data);
+ ret = mars_task_queue_push(host_to_mpu, &data);
MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
}
}
@@ -71,17 +72,22 @@ int main(void)
int32_t exit_code, chk_exit;
uint32_t num;
uint32_t chk_bit, count;
+ int num_mpu;
+
+ num_mpu = 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++) {
- notify[0] = 0;
+ mars_test_counter_set(&notify, 0);
+ mars_test_counter_set(&go, 0);
chk_bit = 0;
ret = mars_task_queue_create(
mars_ctx,
- &host_to_mpu[i],
+ &host_to_mpu,
sizeof(struct queue_entry),
depth_size[i],
MARS_TASK_QUEUE_HOST_TO_MPU);
@@ -95,20 +101,23 @@ int main(void)
/* create pop task */
ret = mars_task_create(mars_ctx, &task_id[num], NULL,
- mpu_prog.elf_image, MARS_TASK_CONTEXT_SAVE_SIZE_MAX);
+ mpu_prog.elf_image,
+ MARS_TASK_CONTEXT_SAVE_SIZE_MAX);
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);
+ task_args.type.u64[0] = host_to_mpu;
+ task_args.type.u64[1] = mars_ptr_to_ea(&notify);
+ task_args.type.u64[2] = mars_ptr_to_ea(&go);
+ 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);
+ if (num_mpu < depth_size[i])
+ mars_test_counter_wait(&notify, num_mpu);
+ else
+ mars_test_counter_wait(&notify, depth_size[i]);
+ mars_test_counter_set(&go, 1);
chk_exit = 0;
for (num = 0; num < depth_size[i]; num++) {
@@ -122,11 +131,11 @@ int main(void)
MARS_TEST_ASSERT_EQUAL((uint32_t)chk_exit, chk_bit);
/* check queue count */
- ret = mars_task_queue_count(host_to_mpu[i], &count);
+ ret = mars_task_queue_count(host_to_mpu, &count);
MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
MARS_TEST_ASSERT_EQUAL(count, 0);
- ret = mars_task_queue_destroy(host_to_mpu[i]);
+ ret = mars_task_queue_destroy(host_to_mpu);
MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
}
diff --git a/tests/TFP/TFP_4A_004/mpu.c b/tests/TFP/TFP_4A_004/mpu.c
index 2f2c0a9..727a318 100644
--- a/tests/TFP/TFP_4A_004/mpu.c
+++ b/tests/TFP/TFP_4A_004/mpu.c
@@ -37,9 +37,11 @@ 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 go_ea = task_args->type.u64[2];
uint64_t val;
- mars_test_counter_set(notify_ea, 1);
+ mars_test_counter_add(notify_ea, 1);
+ mars_test_counter_wait(go_ea, 1);
ret = mars_task_queue_pop(host_to_mpu_ea, &data);
MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
diff --git a/tests/TFP/TFP_4A_005/host.c b/tests/TFP/TFP_4A_005/host.c
index e97a2df..3185622 100644
--- a/tests/TFP/TFP_4A_005/host.c
+++ b/tests/TFP/TFP_4A_005/host.c
@@ -52,8 +52,8 @@ 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_barrier_t barrier;
static pthread_t thread[Q_DEPTH];
static void *thread_proc(void *ptr)
@@ -65,8 +65,7 @@ static void *thread_proc(void *ptr)
uint64_t val;
/* wait for start */
- while (!shared_resource)
- usleep(100);
+ pthread_barrier_wait(&barrier);
ret = mars_task_queue_pop(mpu_to_host[id], &data[num]);
MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
@@ -90,7 +89,6 @@ int main(void)
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(
@@ -119,6 +117,8 @@ int main(void)
ret = mars_task_destroy(&task1_id);
MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+ ret = pthread_barrier_init(&barrier, NULL, depth_size[i]);
+ MARS_TEST_ASSERT(ret == 0);
for (num = 0; num < depth_size[i]; num++) {
chk_bit += (1 << num);
@@ -128,17 +128,15 @@ int main(void)
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);
+ MARS_TEST_ASSERT(ret == 0);
+ ret = pthread_barrier_destroy(&barrier);
ret = mars_task_queue_count(mpu_to_host[i], &count);
MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
MARS_TEST_ASSERT_EQUAL(count, 0);
diff --git a/tests/TFP/TFP_4A_006/host.c b/tests/TFP/TFP_4A_006/host.c
index 360225a..96f7ffe 100644
--- a/tests/TFP/TFP_4A_006/host.c
+++ b/tests/TFP/TFP_4A_006/host.c
@@ -50,8 +50,9 @@ 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 uint64_t mpu_to_mpu;
+static uint32_t notify __attribute((aligned(128)));
+static uint32_t counter __attribute((aligned(128)));
static void queue_push(uint64_t id)
{
@@ -64,7 +65,7 @@ static void queue_push(uint64_t id)
MARS_TASK_CONTEXT_SAVE_SIZE_MAX);
MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
- task2_args.type.u64[0] = mpu_to_mpu[id];
+ task2_args.type.u64[0] = mpu_to_mpu;
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);
@@ -83,17 +84,20 @@ int main(void)
int32_t exit_code, chk_exit;
uint32_t num;
uint32_t chk_bit, count;
+ int num_mpu;
+ num_mpu = 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++) {
- notify[0] = 0;
+ mars_test_counter_set(&notify, 0);
+ mars_test_counter_set(&counter, 0);
chk_bit = 0;
ret = mars_task_queue_create(
mars_ctx,
- &mpu_to_mpu[i],
+ &mpu_to_mpu,
sizeof(struct queue_entry),
depth_size[i],
MARS_TASK_QUEUE_MPU_TO_MPU);
@@ -110,17 +114,20 @@ int main(void)
mpu1_prog.elf_image, MARS_TASK_CONTEXT_SAVE_SIZE_MAX);
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[0] = mpu_to_mpu;
+ task1_args.type.u64[1] = mars_ptr_to_ea(&notify);
+ task1_args.type.u64[2] = mars_ptr_to_ea(&counter);
ret = mars_task_schedule(&task1_id[num],
- &task1_args, 0);
+ &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);
+ if (num_mpu < depth_size[i])
+ mars_test_counter_wait(&counter, num_mpu);
+ else
+ mars_test_counter_wait(&counter, depth_size[i]);
+ mars_test_counter_set(&notify, 1);
chk_exit = 0;
for (num = 0; num < depth_size[i]; num++) {
@@ -134,11 +141,11 @@ int main(void)
MARS_TEST_ASSERT_EQUAL((uint32_t)chk_exit, chk_bit);
/* check queue count */
- ret = mars_task_queue_count(mpu_to_mpu[i], &count);
+ ret = mars_task_queue_count(mpu_to_mpu, &count);
MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
MARS_TEST_ASSERT_EQUAL(count, 0);
- ret = mars_task_queue_destroy(mpu_to_mpu[i]);
+ ret = mars_task_queue_destroy(mpu_to_mpu);
MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
}
diff --git a/tests/TFP/TFP_4A_006/mpu1.c b/tests/TFP/TFP_4A_006/mpu1.c
index ce4d8bf..26baef3 100644
--- a/tests/TFP/TFP_4A_006/mpu1.c
+++ b/tests/TFP/TFP_4A_006/mpu1.c
@@ -37,8 +37,10 @@ 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 counter_ea = task_args->type.u64[2];
uint64_t val;
+ mars_test_counter_add(counter_ea, 1);
mars_test_counter_wait(notify_ea, 1);
ret = mars_task_queue_pop(mpu_to_mpu_ea, &data);
diff --git a/tests/TFP/TFP_4A_010/Makefile b/tests/TFP/TFP_4A_010/Makefile
index 432135a..ecbce33 100644
--- a/tests/TFP/TFP_4A_010/Makefile
+++ b/tests/TFP/TFP_4A_010/Makefile
@@ -22,7 +22,7 @@
#
top_srcdir = ../..
-test_objs = host.o mpu.task_eo
+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_010/host.c b/tests/TFP/TFP_4A_010/host.c
index fd03686..8c1b700 100644
--- a/tests/TFP/TFP_4A_010/host.c
+++ b/tests/TFP/TFP_4A_010/host.c
@@ -38,65 +38,84 @@ static uint32_t depth_size[] =
1,
Q_DEPTH
};
-extern spe_program_handle_t mpu_prog;
+extern spe_program_handle_t mpu1_prog, mpu2_prog;
static struct mars_context *mars_ctx;
static struct mars_task_args task_args;
-static struct mars_task_id task_id;
+static struct mars_task_id task1_id, task2_id;
-static uint64_t host_to_mpu[NUM_LOOP];
+static uint64_t host_to_mpu;
static struct queue_entry data;
-static uint32_t shared_resource __attribute((aligned(16)));
+static uint32_t notify __attribute((aligned(16)));
int main(void)
{
int ret, i;
int32_t exit_code;
- ret = mars_context_create(&mars_ctx, 0, 0);
+ ret = mars_context_create(&mars_ctx, 1, 0);
MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
for (i = 0; i < NUM_LOOP; i++) {
- shared_resource = 0;
+ mars_test_counter_set(&notify, 0);
ret = mars_task_queue_create(
mars_ctx,
- &host_to_mpu[i],
+ &host_to_mpu,
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_SIZE_MAX);
+ ret = mars_task_create(mars_ctx, &task1_id, NULL,
+ mpu1_prog.elf_image,
+ MARS_TASK_CONTEXT_SAVE_SIZE_MAX);
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[0] = host_to_mpu;
+ task_args.type.u64[1] = mars_ptr_to_ea(&notify);
task_args.type.u64[2] = (uint64_t)i;
- ret = mars_task_schedule(&task_id, &task_args, 0);
+ ret = mars_task_schedule(&task1_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);
+ mars_test_counter_wait(&notify, 1);
+ ret = mars_task_create(mars_ctx, &task2_id, NULL,
+ mpu2_prog.elf_image,
+ MARS_TASK_CONTEXT_SAVE_SIZE_MAX);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+
+ ret = mars_task_schedule(&task2_id, &task_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);
+
+ MARS_TEST_ASSERT_EQUAL_INT(mars_test_counter_get(&notify), 1);
/* push one */
data.val = i;
- ret = mars_task_queue_push(host_to_mpu[i], &data);
+ ret = mars_task_queue_push(host_to_mpu, &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_counter_wait(&notify, 2);
+ mars_test_counter_add(&notify, 1);
+
+ 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(&task_id);
+ ret = mars_task_destroy(&task1_id);
MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
- ret = mars_task_queue_destroy(host_to_mpu[i]);
+ ret = mars_task_queue_destroy(host_to_mpu);
MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
}
diff --git a/tests/TFP/TFP_4A_015/mpu.c b/tests/TFP/TFP_4A_010/mpu1.c
index fd1f6d5..7273ced 100644
--- a/tests/TFP/TFP_4A_015/mpu.c
+++ b/tests/TFP/TFP_4A_010/mpu1.c
@@ -23,32 +23,27 @@
#include <mars/task.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 notify_ea = task_args->type.u64[1];
uint64_t val = task_args->type.u64[2];
+ mars_test_counter_add(notify_ea, 1);
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();
+ mars_test_counter_add(notify_ea, 1);
+ mars_test_counter_wait(notify_ea, 3);
return 0;
}
diff --git a/tests/TFP/TFP_4A_010/mpu2.c b/tests/TFP/TFP_4A_010/mpu2.c
new file mode 100644
index 0000000..f4b8996
--- /dev/null
+++ b/tests/TFP/TFP_4A_010/mpu2.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/task.h>
+
+int mars_task_main(const struct mars_task_args *task_args)
+{
+ return 0;
+}
diff --git a/tests/TFP/TFP_4A_011/host.c b/tests/TFP/TFP_4A_011/host.c
index fd2ee38..7a4b6fc 100644
--- a/tests/TFP/TFP_4A_011/host.c
+++ b/tests/TFP/TFP_4A_011/host.c
@@ -21,6 +21,9 @@
* THE SOFTWARE.
*/
+#include <sys/types.h>
+#include <linux/unistd.h>
+#include <errno.h>
#include <pthread.h>
#include <unistd.h>
#include <mars/task.h>
@@ -45,26 +48,75 @@ 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 uint64_t mpu_to_host;
-static uint32_t shared_resource __attribute((aligned(16)));
+static uint32_t notify __attribute((aligned(16)));
static struct queue_entry data;
static pthread_t thread;
+static pid_t thread_pid;
+/*
+ * N O T E:
+ * This test uses Linux specific feature, in other word, you can not
+ * run this test program on the system other than Linux.
+ */
+
+int is_thread_blocked(pid_t tid)
+{
+ FILE *tstat;
+ char path[128];
+ char buf[1024];
+ int n;
+
+ snprintf(path, sizeof(path) - 1, "/proc/%d/status", tid);
+ tstat = fopen(path, "r");
+ MARS_TEST_ASSERT(tstat != NULL);
+
+ while ((n = fscanf(tstat, "State:\t%s\n", buf)) != EOF) {
+ if (n == 1)
+ break;
+ else
+ fgetc(tstat);
+ }
+ fclose(tstat);
+
+ switch (buf[0]) {
+ case 'R': /* running */
+ case 'D': /* disk sleep */
+ return 0;
+ break;
+ case 'S': /* sleep */
+ return 1;
+ break;
+ case 'T': /* trace stopped / stopped */
+ case 'Z': /* zonbie */
+ case 'X': /* dead */
+ default:
+ MARS_TEST_ASSERT(0);
+ return 0;
+ break;
+ };
+}
+
+pid_t linux_get_thread_id(void)
+{
+ return syscall(__NR_gettid);
+};
+
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);
+ thread_pid = linux_get_thread_id();
+ mars_test_counter_set(&notify, 1);
- /* if the program reaches here, shared_resource'll be updated */
- shared_resource = 1;
+ ret = mars_task_queue_pop(mpu_to_host, &data);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+ MARS_TEST_ASSERT_EQUAL(data.val1, id);
return NULL;
}
@@ -77,11 +129,11 @@ int main(void)
MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
for (i = 0; i < NUM_LOOP; i++) {
- shared_resource = 0;
+ mars_test_counter_set(&notify, 0);
ret = mars_task_queue_create(
mars_ctx,
- &mpu_to_host[i],
+ &mpu_to_host,
sizeof(struct queue_entry),
depth_size[i],
MARS_TASK_QUEUE_MPU_TO_HOST);
@@ -97,11 +149,12 @@ int main(void)
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);
+ mars_test_counter_wait(&notify, 1);
+ while (!is_thread_blocked(thread_pid))
+ ;
/* push one by mpu */
- task_args.type.u64[0] = mpu_to_host[i];
+ task_args.type.u64[0] = mpu_to_host;
task_args.type.u64[1] = (uint64_t)i;
ret = mars_task_schedule(&task_id, &task_args, 0);
MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
@@ -116,7 +169,7 @@ int main(void)
ret = mars_task_destroy(&task_id);
MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
- ret = mars_task_queue_destroy(mpu_to_host[i]);
+ ret = mars_task_queue_destroy(mpu_to_host);
MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
}
diff --git a/tests/TFP/TFP_4A_012/Makefile b/tests/TFP/TFP_4A_012/Makefile
index ecbce33..72cf999 100644
--- a/tests/TFP/TFP_4A_012/Makefile
+++ b/tests/TFP/TFP_4A_012/Makefile
@@ -22,7 +22,7 @@
#
top_srcdir = ../..
-test_objs = host.o mpu1.task_eo mpu2.task_eo
+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_4A_012/host.c b/tests/TFP/TFP_4A_012/host.c
index 5edf747..a9b6aab 100644
--- a/tests/TFP/TFP_4A_012/host.c
+++ b/tests/TFP/TFP_4A_012/host.c
@@ -40,29 +40,30 @@ static uint32_t depth_size[] =
};
extern spe_program_handle_t mpu1_prog;
extern spe_program_handle_t mpu2_prog;
+extern spe_program_handle_t mpu3_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 struct mars_task_id task1_id, task2_id, task3_id;
-static uint64_t mpu_to_mpu[NUM_LOOP];
+static uint64_t mpu_to_mpu;
-static uint32_t shared_resource __attribute((aligned(16)));
+static uint32_t notify __attribute((aligned(16)));
int main(void)
{
int ret, i;
int32_t exit_code;
- ret = mars_context_create(&mars_ctx, 0, 0);
+ ret = mars_context_create(&mars_ctx, 1, 0);
MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
for (i = 0; i < NUM_LOOP; i++) {
- shared_resource = 0;
+ mars_test_counter_set(&notify, 0);
ret = mars_task_queue_create(
mars_ctx,
- &mpu_to_mpu[i],
+ &mpu_to_mpu,
sizeof(struct queue_entry),
depth_size[i],
MARS_TASK_QUEUE_MPU_TO_MPU);
@@ -73,23 +74,34 @@ int main(void)
mpu1_prog.elf_image, MARS_TASK_CONTEXT_SAVE_SIZE_MAX);
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[0] = mpu_to_mpu;
+ task1_args.type.u64[1] = mars_ptr_to_ea(&notify);
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_SIZE_MAX);
- 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);
+ ret = mars_task_create(mars_ctx, &task3_id, NULL,
+ mpu3_prog.elf_image, MARS_TASK_CONTEXT_SAVE_SIZE_MAX);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+ ret = mars_task_schedule(&task3_id, NULL, 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);
+
+ MARS_TEST_ASSERT_EQUAL_INT(mars_test_counter_get(&notify), 1);
/* push one by mpu */
- task2_args.type.u64[0] = mpu_to_mpu[i];
+ ret = mars_task_create(mars_ctx, &task2_id, NULL,
+ mpu2_prog.elf_image, MARS_TASK_CONTEXT_SAVE_SIZE_MAX);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+ task2_args.type.u64[0] = mpu_to_mpu;
task2_args.type.u64[1] = (uint64_t)i;
ret = mars_task_schedule(&task2_id, &task2_args, 0);
MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
@@ -99,6 +111,7 @@ int main(void)
MARS_TEST_ASSERT_ERROR(exit_code, MARS_SUCCESS);
/* check if pop task is successfly finished */
+ mars_test_counter_add(&notify, 1);
ret = mars_task_wait(&task1_id, &exit_code);
MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
MARS_TEST_ASSERT_ERROR(exit_code, MARS_SUCCESS);
@@ -109,7 +122,7 @@ int main(void)
ret = mars_task_destroy(&task2_id);
MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
- ret = mars_task_queue_destroy(mpu_to_mpu[i]);
+ ret = mars_task_queue_destroy(mpu_to_mpu);
MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
}
diff --git a/tests/TFP/TFP_4A_012/mpu1.c b/tests/TFP/TFP_4A_012/mpu1.c
index ae7f2b2..63f53ea 100644
--- a/tests/TFP/TFP_4A_012/mpu1.c
+++ b/tests/TFP/TFP_4A_012/mpu1.c
@@ -23,32 +23,28 @@
#include <mars/task.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 notify = task_args->type.u64[1];
uint64_t val = task_args->type.u64[2];
+ mars_test_counter_add(notify, 1);
+
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();
+ mars_test_counter_add(notify, 1);
+ mars_test_counter_wait(notify, 3);
return 0;
}
diff --git a/tests/TFP/TFP_36_012/mpu3.c b/tests/TFP/TFP_4A_012/mpu3.c
index 69cca3e..041ba1f 100644
--- a/tests/TFP/TFP_36_012/mpu3.c
+++ b/tests/TFP/TFP_4A_012/mpu3.c
@@ -26,12 +26,5 @@
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_4A_013/host.c b/tests/TFP/TFP_4A_013/host.c
index be7c462..4f56af2 100644
--- a/tests/TFP/TFP_4A_013/host.c
+++ b/tests/TFP/TFP_4A_013/host.c
@@ -21,6 +21,9 @@
* THE SOFTWARE.
*/
+#include <sys/types.h>
+#include <linux/unistd.h>
+#include <errno.h>
#include <pthread.h>
#include <unistd.h>
#include <mars/task.h>
@@ -45,26 +48,74 @@ 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 uint64_t mpu_to_host;
-static uint32_t shared_resource __attribute((aligned(16)));
+static uint32_t notify __attribute((aligned(16)));
static struct queue_entry data;
static pthread_t thread;
+static pid_t thread_pid;
+/*
+ * N O T E:
+ * This test uses Linux specific feature, in other word, you can not
+ * run this test program on the system other than Linux.
+ */
+
+int is_thread_blocked(pid_t tid)
+{
+ FILE *tstat;
+ char path[128];
+ char buf[1024];
+ int n;
+
+ snprintf(path, sizeof(path) - 1, "/proc/%d/status", tid);
+ tstat = fopen(path, "r");
+ MARS_TEST_ASSERT(tstat != NULL);
+
+ while ((n = fscanf(tstat, "State:\t%s\n", buf)) != EOF) {
+ if (n == 1)
+ break;
+ else
+ fgetc(tstat);
+ }
+ fclose(tstat);
+
+ switch (buf[0]) {
+ case 'R': /* running */
+ case 'D': /* disk sleep */
+ return 0;
+ break;
+ case 'S': /* sleep */
+ return 1;
+ break;
+ case 'T': /* trace stopped / stopped */
+ case 'Z': /* zonbie */
+ case 'X': /* dead */
+ default:
+ MARS_TEST_ASSERT(0);
+ return 0;
+ break;
+ };
+}
+
+pid_t linux_get_thread_id(void)
+{
+ return syscall(__NR_gettid);
+};
+
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 id = ((struct mars_task_args *)ptr)->type.u32[0];
- ret = mars_task_queue_pop(mpu_to_host[id], &data);
+ thread_pid = linux_get_thread_id();
+ mars_test_counter_set(&notify, 1);
+
+ ret = mars_task_queue_pop(mpu_to_host, &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;
}
@@ -77,14 +128,12 @@ int main(void)
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_counter_set(&notify, 0);
+
+ ret = mars_task_queue_create(mars_ctx, &mpu_to_host,
+ sizeof(struct queue_entry),
+ depth_size[i],
+ MARS_TASK_QUEUE_MPU_TO_HOST);
MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
/* create pop thread */
@@ -93,15 +142,17 @@ int main(void)
/* create push task */
ret = mars_task_create(mars_ctx, &task_id, NULL,
- mpu_prog.elf_image, MARS_TASK_CONTEXT_SAVE_SIZE_MAX);
+ mpu_prog.elf_image,
+ MARS_TASK_CONTEXT_SAVE_SIZE_MAX);
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);
+ mars_test_counter_wait(&notify, 1);
+ while (!is_thread_blocked(thread_pid))
+ ;
/* push_begin one by mpu */
- task_args.type.u64[0] = mpu_to_host[i];
+ task_args.type.u64[0] = mpu_to_host;
task_args.type.u64[1] = (uint64_t)i;
ret = mars_task_schedule(&task_id, &task_args, 0);
MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
@@ -116,7 +167,7 @@ int main(void)
ret = mars_task_destroy(&task_id);
MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
- ret = mars_task_queue_destroy(mpu_to_host[i]);
+ ret = mars_task_queue_destroy(mpu_to_host);
MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
}
diff --git a/tests/TFP/TFP_4A_014/Makefile b/tests/TFP/TFP_4A_014/Makefile
index ecbce33..72cf999 100644
--- a/tests/TFP/TFP_4A_014/Makefile
+++ b/tests/TFP/TFP_4A_014/Makefile
@@ -22,7 +22,7 @@
#
top_srcdir = ../..
-test_objs = host.o mpu1.task_eo mpu2.task_eo
+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_4A_014/host.c b/tests/TFP/TFP_4A_014/host.c
index 5edf747..9feeb60 100644
--- a/tests/TFP/TFP_4A_014/host.c
+++ b/tests/TFP/TFP_4A_014/host.c
@@ -40,29 +40,30 @@ static uint32_t depth_size[] =
};
extern spe_program_handle_t mpu1_prog;
extern spe_program_handle_t mpu2_prog;
+extern spe_program_handle_t mpu3_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 struct mars_task_id task1_id, task2_id, task3_id;
-static uint64_t mpu_to_mpu[NUM_LOOP];
+static uint64_t mpu_to_mpu;
-static uint32_t shared_resource __attribute((aligned(16)));
+static uint32_t notify __attribute((aligned(16)));
int main(void)
{
int ret, i;
int32_t exit_code;
- ret = mars_context_create(&mars_ctx, 0, 0);
+ ret = mars_context_create(&mars_ctx, 1, 0);
MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
for (i = 0; i < NUM_LOOP; i++) {
- shared_resource = 0;
+ mars_test_counter_set(&notify, 0);
ret = mars_task_queue_create(
mars_ctx,
- &mpu_to_mpu[i],
+ &mpu_to_mpu,
sizeof(struct queue_entry),
depth_size[i],
MARS_TASK_QUEUE_MPU_TO_MPU);
@@ -73,23 +74,33 @@ int main(void)
mpu1_prog.elf_image, MARS_TASK_CONTEXT_SAVE_SIZE_MAX);
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[0] = mpu_to_mpu;
+ task1_args.type.u64[1] = mars_ptr_to_ea(&notify);
task1_args.type.u64[2] = (uint64_t)i;
ret = mars_task_schedule(&task1_id, &task1_args, 0);
MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+ /* check if queue pop is blocked in mpu task */
+ mars_test_counter_wait(&notify, 1);
+ ret = mars_task_create(mars_ctx, &task3_id, NULL,
+ mpu3_prog.elf_image,
+ MARS_TASK_CONTEXT_SAVE_SIZE_MAX);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+ ret = mars_task_schedule(&task3_id, &task1_args, 0);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+ ret = mars_task_wait(&task3_id, &exit_code);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+ ret = mars_task_destroy(&task3_id);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+
+ MARS_TEST_ASSERT(mars_test_counter_get(&notify) == 1);
+
/* create push task */
ret = mars_task_create(mars_ctx, &task2_id, NULL,
mpu2_prog.elf_image, MARS_TASK_CONTEXT_SAVE_SIZE_MAX);
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[0] = mpu_to_mpu;
task2_args.type.u64[1] = (uint64_t)i;
ret = mars_task_schedule(&task2_id, &task2_args, 0);
MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
@@ -98,6 +109,9 @@ int main(void)
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 pop task is successfly finished */
ret = mars_task_wait(&task1_id, &exit_code);
MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
@@ -106,10 +120,7 @@ int main(void)
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]);
+ ret = mars_task_queue_destroy(mpu_to_mpu);
MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
}
diff --git a/tests/TFP/TFP_4A_014/mpu1.c b/tests/TFP/TFP_4A_014/mpu1.c
index ae7f2b2..97aaa04 100644
--- a/tests/TFP/TFP_4A_014/mpu1.c
+++ b/tests/TFP/TFP_4A_014/mpu1.c
@@ -23,32 +23,26 @@
#include <mars/task.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 notify = task_args->type.u64[1];
uint64_t val = task_args->type.u64[2];
+ mars_test_counter_add(notify, 1);
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();
+ mars_test_counter_add(notify, 1);
return 0;
}
diff --git a/tests/TFP/TFP_4A_014/mpu2.c b/tests/TFP/TFP_4A_014/mpu2.c
index f4469dd..1adcbb5 100644
--- a/tests/TFP/TFP_4A_014/mpu2.c
+++ b/tests/TFP/TFP_4A_014/mpu2.c
@@ -23,7 +23,6 @@
#include <mars/task.h>
#include <mars_task_test.h>
-#include <spu_mfcio.h>
struct queue_entry {
uint64_t val1;
diff --git a/tests/TFP/TFP_4A_014/mpu3.c b/tests/TFP/TFP_4A_014/mpu3.c
new file mode 100644
index 0000000..041ba1f
--- /dev/null
+++ b/tests/TFP/TFP_4A_014/mpu3.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.
+ */
+
+#include <mars/task.h>
+#include <mars_task_test.h>
+
+int mars_task_main(const struct mars_task_args *task_args)
+{
+ return 0;
+}
diff --git a/tests/TFP/TFP_4A_015/Makefile b/tests/TFP/TFP_4A_015/Makefile
index 432135a..ecbce33 100644
--- a/tests/TFP/TFP_4A_015/Makefile
+++ b/tests/TFP/TFP_4A_015/Makefile
@@ -22,7 +22,7 @@
#
top_srcdir = ../..
-test_objs = host.o mpu.task_eo
+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_015/host.c b/tests/TFP/TFP_4A_015/host.c
index 7ffab3b..53be7a2 100644
--- a/tests/TFP/TFP_4A_015/host.c
+++ b/tests/TFP/TFP_4A_015/host.c
@@ -38,65 +38,76 @@ static uint32_t depth_size[] =
1,
Q_DEPTH
};
-extern spe_program_handle_t mpu_prog;
+extern spe_program_handle_t mpu1_prog, mpu2_prog;
static struct mars_context *mars_ctx;
static struct mars_task_args task_args;
-static struct mars_task_id task_id;
+static struct mars_task_id task1_id, task2_id;
-static uint64_t host_to_mpu[NUM_LOOP];
+static uint64_t host_to_mpu;
static struct queue_entry data;
-static uint32_t shared_resource __attribute((aligned(16)));
+static uint32_t notify __attribute((aligned(16)));
int main(void)
{
int ret, i;
int32_t exit_code;
- ret = mars_context_create(&mars_ctx, 0, 0);
+ ret = mars_context_create(&mars_ctx, 1, 0);
MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
for (i = 0; i < NUM_LOOP; i++) {
- shared_resource = 0;
+ mars_test_counter_set(&notify, 0);
ret = mars_task_queue_create(
mars_ctx,
- &host_to_mpu[i],
+ &host_to_mpu,
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_SIZE_MAX);
+ ret = mars_task_create(mars_ctx, &task1_id, NULL,
+ mpu1_prog.elf_image, MARS_TASK_CONTEXT_SAVE_SIZE_MAX);
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[0] = host_to_mpu;
+ task_args.type.u64[1] = mars_ptr_to_ea(&notify);
task_args.type.u64[2] = (uint64_t)i;
- ret = mars_task_schedule(&task_id, &task_args, 0);
+ ret = mars_task_schedule(&task1_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);
+ mars_test_counter_wait(&notify, 1);
+ ret = mars_task_create(mars_ctx, &task2_id, NULL,
+ mpu2_prog.elf_image, MARS_TASK_CONTEXT_SAVE_SIZE_MAX);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+
+ ret = mars_task_schedule(&task2_id, &task_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);
+ MARS_TEST_ASSERT(mars_test_counter_get(&notify) == 1);
/* try push one */
data.val = i;
- ret = mars_task_queue_try_push(host_to_mpu[i], &data);
+ ret = mars_task_queue_try_push(host_to_mpu, &data);
MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
/* check if mpu task is successfly finished */
- ret = mars_task_wait(&task_id, &exit_code);
+ 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(&task_id);
+ ret = mars_task_destroy(&task1_id);
MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
- ret = mars_task_queue_destroy(host_to_mpu[i]);
+ ret = mars_task_queue_destroy(host_to_mpu);
MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
}
diff --git a/tests/TFP/TFP_4A_010/mpu.c b/tests/TFP/TFP_4A_015/mpu1.c
index fd1f6d5..0262aa4 100644
--- a/tests/TFP/TFP_4A_010/mpu.c
+++ b/tests/TFP/TFP_4A_015/mpu1.c
@@ -23,32 +23,27 @@
#include <mars/task.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 notify = task_args->type.u64[1];
uint64_t val = task_args->type.u64[2];
+ mars_test_counter_add(notify, 1);
+
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();
+ mars_test_counter_add(notify, 1);
return 0;
}
diff --git a/tests/TFP/TFP_4A_015/mpu2.c b/tests/TFP/TFP_4A_015/mpu2.c
new file mode 100644
index 0000000..041ba1f
--- /dev/null
+++ b/tests/TFP/TFP_4A_015/mpu2.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.
+ */
+
+#include <mars/task.h>
+#include <mars_task_test.h>
+
+int mars_task_main(const struct mars_task_args *task_args)
+{
+ return 0;
+}
diff --git a/tests/TFP/TFP_4A_016/host.c b/tests/TFP/TFP_4A_016/host.c
index 1102f3a..4938d03 100644
--- a/tests/TFP/TFP_4A_016/host.c
+++ b/tests/TFP/TFP_4A_016/host.c
@@ -21,6 +21,9 @@
* THE SOFTWARE.
*/
+#include <sys/types.h>
+#include <linux/unistd.h>
+#include <errno.h>
#include <pthread.h>
#include <unistd.h>
#include <mars/task.h>
@@ -45,26 +48,74 @@ 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 uint64_t mpu_to_host;
-static uint32_t shared_resource __attribute((aligned(16)));
+static uint32_t notify __attribute((aligned(16)));
static struct queue_entry data;
static pthread_t thread;
+static pid_t thread_pid;
+/*
+ * N O T E:
+ * This test uses Linux specific feature, in other word, you can not
+ * run this test program on the system other than Linux.
+ */
+
+int is_thread_blocked(pid_t tid)
+{
+ FILE *tstat;
+ char path[128];
+ char buf[1024];
+ int n;
+
+ snprintf(path, sizeof(path) - 1, "/proc/%d/status", tid);
+ tstat = fopen(path, "r");
+ MARS_TEST_ASSERT(tstat != NULL);
+
+ while ((n = fscanf(tstat, "State:\t%s\n", buf)) != EOF) {
+ if (n == 1)
+ break;
+ else
+ fgetc(tstat);
+ }
+ fclose(tstat);
+
+ switch (buf[0]) {
+ case 'R': /* running */
+ case 'D': /* disk sleep */
+ return 0;
+ break;
+ case 'S': /* sleep */
+ return 1;
+ break;
+ case 'T': /* trace stopped / stopped */
+ case 'Z': /* zonbie */
+ case 'X': /* dead */
+ default:
+ MARS_TEST_ASSERT(0);
+ return 0;
+ break;
+ };
+}
+
+pid_t linux_get_thread_id(void)
+{
+ return syscall(__NR_gettid);
+};
+
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 id = ((struct mars_task_args *)ptr)->type.u32[0];
+
+ thread_pid = linux_get_thread_id();
+ mars_test_counter_set(&notify, 1);
- ret = mars_task_queue_pop(mpu_to_host[id], &data);
+ ret = mars_task_queue_pop(mpu_to_host, &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;
}
@@ -77,31 +128,30 @@ int main(void)
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_counter_set(&notify, 0);
+
+ ret = mars_task_queue_create(mars_ctx,
+ &mpu_to_host,
+ 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);
+ /* check if queue pop is blocked in ppe thread */
+ mars_test_counter_wait(&notify, 1);
+ while (!is_thread_blocked(thread_pid))
+ ;
+
/* create try_push task */
ret = mars_task_create(mars_ctx, &task_id, NULL,
- mpu_prog.elf_image, MARS_TASK_CONTEXT_SAVE_SIZE_MAX);
+ mpu_prog.elf_image,
+ MARS_TASK_CONTEXT_SAVE_SIZE_MAX);
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[0] = mpu_to_host;
task_args.type.u64[1] = (uint64_t)i;
ret = mars_task_schedule(&task_id, &task_args, 0);
MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
@@ -116,7 +166,7 @@ int main(void)
ret = mars_task_destroy(&task_id);
MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
- ret = mars_task_queue_destroy(mpu_to_host[i]);
+ ret = mars_task_queue_destroy(mpu_to_host);
MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
}
diff --git a/tests/TFP/TFP_4A_016/mpu.c b/tests/TFP/TFP_4A_016/mpu.c
index 3103168..ee2d5d5 100644
--- a/tests/TFP/TFP_4A_016/mpu.c
+++ b/tests/TFP/TFP_4A_016/mpu.c
@@ -23,7 +23,6 @@
#include <mars/task.h>
#include <mars_task_test.h>
-#include <spu_mfcio.h>
struct queue_entry {
uint64_t val1;
diff --git a/tests/TFP/TFP_4A_017/Makefile b/tests/TFP/TFP_4A_017/Makefile
index ecbce33..72cf999 100644
--- a/tests/TFP/TFP_4A_017/Makefile
+++ b/tests/TFP/TFP_4A_017/Makefile
@@ -22,7 +22,7 @@
#
top_srcdir = ../..
-test_objs = host.o mpu1.task_eo mpu2.task_eo
+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_4A_017/host.c b/tests/TFP/TFP_4A_017/host.c
index 5edf747..a1d7439 100644
--- a/tests/TFP/TFP_4A_017/host.c
+++ b/tests/TFP/TFP_4A_017/host.c
@@ -40,29 +40,30 @@ static uint32_t depth_size[] =
};
extern spe_program_handle_t mpu1_prog;
extern spe_program_handle_t mpu2_prog;
+extern spe_program_handle_t mpu3_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 struct mars_task_id task1_id, task2_id, task3_id;
-static uint64_t mpu_to_mpu[NUM_LOOP];
+static uint64_t mpu_to_mpu;
-static uint32_t shared_resource __attribute((aligned(16)));
+static uint32_t notify __attribute((aligned(16)));
int main(void)
{
int ret, i;
int32_t exit_code;
- ret = mars_context_create(&mars_ctx, 0, 0);
+ ret = mars_context_create(&mars_ctx, 1, 0);
MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
for (i = 0; i < NUM_LOOP; i++) {
- shared_resource = 0;
+ mars_test_counter_set(&notify, 0);
ret = mars_task_queue_create(
mars_ctx,
- &mpu_to_mpu[i],
+ &mpu_to_mpu,
sizeof(struct queue_entry),
depth_size[i],
MARS_TASK_QUEUE_MPU_TO_MPU);
@@ -73,23 +74,31 @@ int main(void)
mpu1_prog.elf_image, MARS_TASK_CONTEXT_SAVE_SIZE_MAX);
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[0] = mpu_to_mpu;
+ task1_args.type.u64[1] = mars_ptr_to_ea(&notify);
task1_args.type.u64[2] = (uint64_t)i;
ret = mars_task_schedule(&task1_id, &task1_args, 0);
MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+ /* check if queue pop is blocked in mpu task */
+ ret = mars_task_create(mars_ctx, &task3_id, NULL,
+ mpu3_prog.elf_image, MARS_TASK_CONTEXT_SAVE_SIZE_MAX);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+ ret = mars_task_schedule(&task3_id, NULL, 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 push task */
ret = mars_task_create(mars_ctx, &task2_id, NULL,
- mpu2_prog.elf_image, MARS_TASK_CONTEXT_SAVE_SIZE_MAX);
+ mpu2_prog.elf_image, MARS_TASK_CONTEXT_SAVE_SIZE_MAX);
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[0] = mpu_to_mpu;
task2_args.type.u64[1] = (uint64_t)i;
ret = mars_task_schedule(&task2_id, &task2_args, 0);
MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
@@ -109,7 +118,7 @@ int main(void)
ret = mars_task_destroy(&task2_id);
MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
- ret = mars_task_queue_destroy(mpu_to_mpu[i]);
+ ret = mars_task_queue_destroy(mpu_to_mpu);
MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
}
diff --git a/tests/TFP/TFP_4A_017/mpu1.c b/tests/TFP/TFP_4A_017/mpu1.c
index ae7f2b2..643472a 100644
--- a/tests/TFP/TFP_4A_017/mpu1.c
+++ b/tests/TFP/TFP_4A_017/mpu1.c
@@ -23,32 +23,24 @@
#include <mars/task.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 notify = task_args->type.u64[1];
uint64_t val = task_args->type.u64[2];
+ mars_test_counter_add(notify, 1);
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
index 5f86497..8c0f6a7 100644
--- a/tests/TFP/TFP_4A_017/mpu2.c
+++ b/tests/TFP/TFP_4A_017/mpu2.c
@@ -23,7 +23,6 @@
#include <mars/task.h>
#include <mars_task_test.h>
-#include <spu_mfcio.h>
struct queue_entry {
uint64_t val1;
diff --git a/tests/TFP/TFP_4A_017/mpu3.c b/tests/TFP/TFP_4A_017/mpu3.c
new file mode 100644
index 0000000..041ba1f
--- /dev/null
+++ b/tests/TFP/TFP_4A_017/mpu3.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.
+ */
+
+#include <mars/task.h>
+#include <mars_task_test.h>
+
+int mars_task_main(const struct mars_task_args *task_args)
+{
+ return 0;
+}
diff --git a/tests/TFP/TFP_4A_018/host.c b/tests/TFP/TFP_4A_018/host.c
index 3a9ca8e..8d9cfe4 100644
--- a/tests/TFP/TFP_4A_018/host.c
+++ b/tests/TFP/TFP_4A_018/host.c
@@ -21,6 +21,9 @@
* THE SOFTWARE.
*/
+#include <sys/types.h>
+#include <linux/unistd.h>
+#include <errno.h>
#include <pthread.h>
#include <unistd.h>
#include <libspe2.h>
@@ -36,25 +39,77 @@ static struct mars_task_id task_id;
static struct mars_task_args task_args;
static uint64_t queue;
+static uint32_t notify __attribute__((aligned(16)));
+
static uint64_t queue_item[2];
+static pthread_t thread;
+static pid_t thread_pid;
+/*
+ * N O T E:
+ * This test uses Linux specific feature, in other word, you can not
+ * run this test program on the system other than Linux.
+ */
-int main(void)
+int is_thread_blocked(pid_t tid)
{
- int exit_code, ret;
- uint32_t tb_freq;
+ FILE *tstat;
+ char path[128];
+ char buf[1024];
+ int n;
+
+ snprintf(path, sizeof(path) - 1, "/proc/%d/status", tid);
+ tstat = fopen(path, "r");
+ MARS_TEST_ASSERT(tstat != NULL);
+
+ while ((n = fscanf(tstat, "State:\t%s\n", buf)) != EOF) {
+ if (n == 1)
+ break;
+ else
+ fgetc(tstat);
+ }
+ fclose(tstat);
+
+ switch (buf[0]) {
+ case 'R': /* running */
+ case 'D': /* disk sleep */
+ return 0;
+ break;
+ case 'S': /* sleep */
+ return 1;
+ break;
+ case 'T': /* trace stopped / stopped */
+ case 'Z': /* zonbie */
+ case 'X': /* dead */
+ default:
+ MARS_TEST_ASSERT(0);
+ return 0;
+ break;
+ };
+}
- ret = mars_test_get_timebase_freq(&tb_freq);
- MARS_TEST_ASSERT_EQUAL(ret, 0);
+pid_t linux_get_thread_id(void)
+{
+ return syscall(__NR_gettid);
+};
- ret = mars_context_create(&mars, 0, 0);
+static void *thread_proc(void *ptr)
+{
+ int ret;
+
+ thread_pid = linux_get_thread_id();
+ mars_test_counter_add(&notify, 1);
+
+ ret = mars_task_queue_pop(queue, &queue_item);
MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
- ret = mars_task_create(
- mars,
- &task_id,
- NULL,
- mpu_prog.elf_image,
- 0);
+ return NULL;
+}
+
+int main(void)
+{
+ int exit_code, ret;
+
+ ret = mars_context_create(&mars, 0, 0);
MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
ret = mars_task_queue_create(
@@ -65,19 +120,31 @@ int main(void)
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 = pthread_create(&thread, NULL, thread_proc, NULL);
+ MARS_TEST_ASSERT(ret == 0);
- ret = mars_task_schedule(&task_id, &task_args, 0);
- MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+ mars_test_counter_wait(&notify, 1);
+ while (!is_thread_blocked(thread_pid))
+ ;
- ret = mars_task_queue_pop(queue, queue_item);
+ ret = mars_task_create(
+ mars,
+ &task_id,
+ NULL,
+ mpu_prog.elf_image,
+ 0);
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 = pthread_join(thread, NULL);
+ MARS_TEST_ASSERT(ret == 0);
+
ret = mars_task_queue_destroy(queue);
MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
diff --git a/tests/TFP/TFP_4A_018/mpu.c b/tests/TFP/TFP_4A_018/mpu.c
index 8037552..11d5e24 100644
--- a/tests/TFP/TFP_4A_018/mpu.c
+++ b/tests/TFP/TFP_4A_018/mpu.c
@@ -30,9 +30,6 @@ 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);
@@ -40,7 +37,5 @@ int mars_task_main(const struct mars_task_args *task_args)
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
index ecbce33..72cf999 100644
--- a/tests/TFP/TFP_4A_019/Makefile
+++ b/tests/TFP/TFP_4A_019/Makefile
@@ -22,7 +22,7 @@
#
top_srcdir = ../..
-test_objs = host.o mpu1.task_eo mpu2.task_eo
+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_4A_019/host.c b/tests/TFP/TFP_4A_019/host.c
index 5edf747..1b0b8c5 100644
--- a/tests/TFP/TFP_4A_019/host.c
+++ b/tests/TFP/TFP_4A_019/host.c
@@ -40,29 +40,30 @@ static uint32_t depth_size[] =
};
extern spe_program_handle_t mpu1_prog;
extern spe_program_handle_t mpu2_prog;
+extern spe_program_handle_t mpu3_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 struct mars_task_id task1_id, task2_id, task3_id;
-static uint64_t mpu_to_mpu[NUM_LOOP];
+static uint64_t mpu_to_mpu;
-static uint32_t shared_resource __attribute((aligned(16)));
+static uint32_t notify __attribute((aligned(16)));
int main(void)
{
int ret, i;
int32_t exit_code;
- ret = mars_context_create(&mars_ctx, 0, 0);
+ ret = mars_context_create(&mars_ctx, 1, 0);
MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
for (i = 0; i < NUM_LOOP; i++) {
- shared_resource = 0;
+ mars_test_counter_set(&notify, 0);
ret = mars_task_queue_create(
mars_ctx,
- &mpu_to_mpu[i],
+ &mpu_to_mpu,
sizeof(struct queue_entry),
depth_size[i],
MARS_TASK_QUEUE_MPU_TO_MPU);
@@ -70,26 +71,33 @@ int main(void)
/* create pop task */
ret = mars_task_create(mars_ctx, &task1_id, NULL,
- mpu1_prog.elf_image, MARS_TASK_CONTEXT_SAVE_SIZE_MAX);
+ mpu1_prog.elf_image, MARS_TASK_CONTEXT_SAVE_SIZE_MAX);
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[0] = mpu_to_mpu;
+ task1_args.type.u64[1] = mars_ptr_to_ea(&notify);
task1_args.type.u64[2] = (uint64_t)i;
ret = mars_task_schedule(&task1_id, &task1_args, 0);
MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+ /* check if queue pop is blocked in mpu task */
+ ret = mars_task_create(mars_ctx, &task3_id, NULL,
+ mpu3_prog.elf_image, MARS_TASK_CONTEXT_SAVE_SIZE_MAX);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+ ret = mars_task_schedule(&task3_id, NULL, 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 push task */
ret = mars_task_create(mars_ctx, &task2_id, NULL,
mpu2_prog.elf_image, MARS_TASK_CONTEXT_SAVE_SIZE_MAX);
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[0] = mpu_to_mpu;
task2_args.type.u64[1] = (uint64_t)i;
ret = mars_task_schedule(&task2_id, &task2_args, 0);
MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
@@ -98,6 +106,9 @@ int main(void)
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 pop task is successfly finished */
ret = mars_task_wait(&task1_id, &exit_code);
MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
@@ -106,10 +117,8 @@ int main(void)
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]);
+ ret = mars_task_queue_destroy(mpu_to_mpu);
MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
}
diff --git a/tests/TFP/TFP_4A_019/mpu1.c b/tests/TFP/TFP_4A_019/mpu1.c
index ae7f2b2..57da5bd 100644
--- a/tests/TFP/TFP_4A_019/mpu1.c
+++ b/tests/TFP/TFP_4A_019/mpu1.c
@@ -30,25 +30,20 @@ struct queue_entry {
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 notify = task_args->type.u64[1];
uint64_t val = task_args->type.u64[2];
+ mars_test_counter_add(notify, 1);
+
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();
-
+ mars_test_counter_add(notify, 1);
return 0;
}
diff --git a/tests/TFP/TFP_4A_019/mpu3.c b/tests/TFP/TFP_4A_019/mpu3.c
new file mode 100644
index 0000000..041ba1f
--- /dev/null
+++ b/tests/TFP/TFP_4A_019/mpu3.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.
+ */
+
+#include <mars/task.h>
+#include <mars_task_test.h>
+
+int mars_task_main(const struct mars_task_args *task_args)
+{
+ return 0;
+}
diff --git a/tests/TFP/TFP_4B_001/Makefile b/tests/TFP/TFP_4B_001/Makefile
index 432135a..ecbce33 100644
--- a/tests/TFP/TFP_4B_001/Makefile
+++ b/tests/TFP/TFP_4B_001/Makefile
@@ -22,7 +22,7 @@
#
top_srcdir = ../..
-test_objs = host.o mpu.task_eo
+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_001/host.c b/tests/TFP/TFP_4B_001/host.c
index 9b63d78..4752c22 100644
--- a/tests/TFP/TFP_4B_001/host.c
+++ b/tests/TFP/TFP_4B_001/host.c
@@ -28,26 +28,28 @@
#define QUEUE_DEPTH 16
-extern spe_program_handle_t mpu_prog;
+extern spe_program_handle_t mpu1_prog;
+extern spe_program_handle_t mpu2_prog;
static struct mars_context *mars;
-static struct mars_task_id task_id;
+static struct mars_task_id task1_id, task2_id;
static struct mars_task_args task_args;
static uint64_t queue;
-static uint64_t queue_item[2], mpu_answer __attribute__((aligned(16)));
+static uint64_t queue_item[2] __attribute__((aligned(16)));
+static uint32_t notify __attribute__((aligned(16)));
int main(void)
{
int exit_code, ret;
- ret = mars_context_create(&mars, 0, 0);
+ ret = mars_context_create(&mars, 1, 0);
MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
ret = mars_task_create(
mars,
- &task_id,
+ &task1_id,
"4B001",
- mpu_prog.elf_image,
+ mpu1_prog.elf_image,
MARS_TASK_CONTEXT_SAVE_SIZE_MAX);
MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
@@ -59,28 +61,44 @@ int main(void)
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);
+ task_args.type.u64[1] = mars_ptr_to_ea(&notify);
+ ret = mars_task_schedule(&task1_id, &task_args, 0);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+
+ mars_test_counter_wait(&notify, 1);
+
+ /* see if the previous task is in sleep state */
+ ret = mars_task_create(
+ mars,
+ &task2_id,
+ "4B001",
+ mpu2_prog.elf_image,
+ MARS_TASK_CONTEXT_SAVE_SIZE_MAX);
MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
- usleep(200000);
+ ret = mars_task_schedule(&task2_id, &task_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_EQUAL(exit_code, 0);
+ ret = mars_task_destroy(&task2_id);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
- mpu_answer = 1;
+ MARS_TEST_ASSERT(mars_test_counter_get(&notify) == 1);
+ /* push a data */
ret = mars_task_queue_push(queue, queue_item);
MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
- ret = mars_task_wait(&task_id, &exit_code);
+ ret = mars_task_wait(&task1_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);
+ ret = mars_task_destroy(&task1_id);
MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
ret = mars_context_destroy(mars);
diff --git a/tests/TFP/TFP_4B_001/mpu.c b/tests/TFP/TFP_4B_001/mpu1.c
index 709f215..c60fa10 100644
--- a/tests/TFP/TFP_4B_001/mpu.c
+++ b/tests/TFP/TFP_4B_001/mpu1.c
@@ -31,20 +31,18 @@ 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;
+ uint64_t notify = task_args->type.u64[1];
int ret;
+ mars_test_counter_add(notify, 1);
+
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);
+ mars_test_counter_add(notify, 1);
return 0;
}
diff --git a/tests/TFP/TFP_4B_001/mpu2.c b/tests/TFP/TFP_4B_001/mpu2.c
new file mode 100644
index 0000000..bd1b367
--- /dev/null
+++ b/tests/TFP/TFP_4B_001/mpu2.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.
+ */
+
+#include <string.h>
+#include <mars/task.h>
+
+int mars_task_main(const struct mars_task_args *task_args)
+{
+ return 0;
+}
diff --git a/tests/TFP/TFP_4B_002/Makefile b/tests/TFP/TFP_4B_002/Makefile
index ecbce33..72cf999 100644
--- a/tests/TFP/TFP_4B_002/Makefile
+++ b/tests/TFP/TFP_4B_002/Makefile
@@ -22,7 +22,7 @@
#
top_srcdir = ../..
-test_objs = host.o mpu1.task_eo mpu2.task_eo
+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_4B_002/host.c b/tests/TFP/TFP_4B_002/host.c
index f9e7fd2..7c256f7 100644
--- a/tests/TFP/TFP_4B_002/host.c
+++ b/tests/TFP/TFP_4B_002/host.c
@@ -27,23 +27,19 @@
#define QUEUE_DEPTH 16
-extern spe_program_handle_t mpu1_prog, mpu2_prog;
+extern spe_program_handle_t mpu1_prog, mpu2_prog, mpu3_prog;
static struct mars_context *mars;
-static struct mars_task_id pusher_task_id, poper_task_id;
+static struct mars_task_id pusher_task_id, poper_task_id, dummy_task_id;
static struct mars_task_args task_args;
static uint64_t queue;
-static uint64_t mpu_answer __attribute__((aligned(16)));
+static uint32_t notify __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);
+ ret = mars_context_create(&mars, 1, 0);
MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
ret = mars_task_create(
@@ -70,15 +66,34 @@ int main(void)
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);
+ 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(&poper_task_id, &task_args, 0);
+ /* see if the previous task is in sleep state */
+ mars_test_counter_wait(&notify, 1);
+ ret = mars_task_create(
+ mars,
+ &dummy_task_id,
+ "4B002",
+ mpu3_prog.elf_image,
+ MARS_TASK_CONTEXT_SAVE_SIZE_MAX);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+ ret = mars_task_schedule(&dummy_task_id, NULL, 0);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+ ret = mars_task_wait(&dummy_task_id, &exit_code);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+ MARS_TEST_ASSERT_EQUAL(exit_code, 0);
+ ret = mars_task_destroy(&dummy_task_id);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+
+ MARS_TEST_ASSERT(mars_test_counter_get(&notify) == 1);
+
+ /* invoke pusher */
+ 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_wait(&pusher_task_id, &exit_code);
diff --git a/tests/TFP/TFP_4B_002/mpu1.c b/tests/TFP/TFP_4B_002/mpu1.c
index b17a831..a5fce0e 100644
--- a/tests/TFP/TFP_4B_002/mpu1.c
+++ b/tests/TFP/TFP_4B_002/mpu1.c
@@ -31,18 +31,10 @@ 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
index 126fc20..c60fa10 100644
--- a/tests/TFP/TFP_4B_002/mpu2.c
+++ b/tests/TFP/TFP_4B_002/mpu2.c
@@ -31,10 +31,10 @@ 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 notify = task_args->type.u64[1];
int ret;
- uint64_t mpu_answer;
+ mars_test_counter_add(notify, 1);
ret = mars_task_queue_pop_begin(queue_ea, queue_item, 0);
MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
@@ -42,10 +42,7 @@ int mars_task_main(const struct mars_task_args *task_args)
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);
+ mars_test_counter_add(notify, 1);
return 0;
}
diff --git a/tests/TFP/TFP_4B_002/mpu3.c b/tests/TFP/TFP_4B_002/mpu3.c
new file mode 100644
index 0000000..50dca43
--- /dev/null
+++ b/tests/TFP/TFP_4B_002/mpu3.c
@@ -0,0 +1,30 @@
+/*
+ * Copyright 2009 Sony Corporation
+ *
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a copy
+ * of this software and associated documentation files (the "Software"), to deal
+ * in the Software without restriction, including without limitation the rights
+ * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+ * copies of the Software, and to permit persons to whom the Software is
+ * furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included in
+ * all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+ * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ * LIABILITY, WHETHER IN AN ACTION OF 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/task.h>
+
+int mars_task_main(const struct mars_task_args *task_args)
+{
+ return 0;
+}
diff --git a/tests/TFP/TFP_4B_003/host.c b/tests/TFP/TFP_4B_003/host.c
index 91d577a..6814700 100644
--- a/tests/TFP/TFP_4B_003/host.c
+++ b/tests/TFP/TFP_4B_003/host.c
@@ -49,8 +49,9 @@ 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 uint64_t host_to_mpu;
+static uint32_t counter __attribute((aligned(128)));
+static uint32_t notify __attribute((aligned(128)));
static struct queue_entry data;
static void queue_push(uint64_t id, uint64_t count)
@@ -60,7 +61,7 @@ static void queue_push(uint64_t id, uint64_t count)
for (i = 0; i < count; i++) {
data.val1 = i;
data.val2 = i + TEST_DIFF;
- ret = mars_task_queue_push(host_to_mpu[id], &data);
+ ret = mars_task_queue_push(host_to_mpu, &data);
MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
}
}
@@ -71,17 +72,21 @@ int main(void)
int32_t exit_code, chk_exit;
uint32_t num;
uint32_t chk_bit, count;
+ int num_mpu;
+
+ num_mpu = 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++) {
- notify[0] = 0;
+ mars_test_counter_set(&counter, 0);
+ mars_test_counter_set(&notify, 0);
chk_bit = 0;
ret = mars_task_queue_create(
mars_ctx,
- &host_to_mpu[i],
+ &host_to_mpu,
sizeof(struct queue_entry),
depth_size[i],
MARS_TASK_QUEUE_HOST_TO_MPU);
@@ -98,17 +103,21 @@ int main(void)
mpu_prog.elf_image, MARS_TASK_CONTEXT_SAVE_SIZE_MAX);
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[0] = host_to_mpu;
+ task_args.type.u64[1] = mars_ptr_to_ea(&notify);
+ task_args.type.u64[2] = mars_ptr_to_ea(&counter);
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);
+ if (num_mpu < depth_size[i])
+ mars_test_counter_wait(&counter, num_mpu);
+ else
+ mars_test_counter_wait(&counter, depth_size[i]);
+
+ mars_test_counter_set(&notify, 1);
chk_exit = 0;
for (num = 0; num < depth_size[i]; num++) {
@@ -122,11 +131,11 @@ int main(void)
MARS_TEST_ASSERT_EQUAL((uint32_t)chk_exit, chk_bit);
/* check queue count */
- ret = mars_task_queue_count(host_to_mpu[i], &count);
+ ret = mars_task_queue_count(host_to_mpu, &count);
MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
MARS_TEST_ASSERT_EQUAL(count, 0);
- ret = mars_task_queue_destroy(host_to_mpu[i]);
+ ret = mars_task_queue_destroy(host_to_mpu);
MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
}
diff --git a/tests/TFP/TFP_4B_003/mpu.c b/tests/TFP/TFP_4B_003/mpu.c
index 85a89a8..07f8397 100644
--- a/tests/TFP/TFP_4B_003/mpu.c
+++ b/tests/TFP/TFP_4B_003/mpu.c
@@ -23,13 +23,13 @@
#include <mars/task.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)
@@ -37,8 +37,10 @@ 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 counter_ea = task_args->type.u64[2];
uint64_t val;
+ mars_test_counter_add(counter_ea, 1);
mars_test_counter_wait(notify_ea, 1);
ret = mars_task_queue_pop_begin(host_to_mpu_ea, &data, 1);
diff --git a/tests/TFP/TFP_4B_004/Makefile b/tests/TFP/TFP_4B_004/Makefile
index 432135a..ecbce33 100644
--- a/tests/TFP/TFP_4B_004/Makefile
+++ b/tests/TFP/TFP_4B_004/Makefile
@@ -22,7 +22,7 @@
#
top_srcdir = ../..
-test_objs = host.o mpu.task_eo
+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_004/host.c b/tests/TFP/TFP_4B_004/host.c
index 718e128..a18afb2 100644
--- a/tests/TFP/TFP_4B_004/host.c
+++ b/tests/TFP/TFP_4B_004/host.c
@@ -29,28 +29,20 @@
#define QUEUE_DEPTH 16
-extern spe_program_handle_t mpu_prog;
+extern spe_program_handle_t mpu1_prog, mpu2_prog;
static struct mars_context *mars;
-static struct mars_task_id task_id;
+static struct mars_task_id task_id, task2_id;
static struct mars_task_args task_args;
static uint64_t queue;
-
+static uint32_t notify __attribute__((aligned(128)));
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_SIZE_MAX);
+ ret = mars_context_create(&mars, 1, 0);
MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
ret = mars_task_queue_create(
@@ -61,12 +53,35 @@ int main(void)
MARS_TASK_QUEUE_HOST_TO_MPU);
MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
- task_args.type.u64[0] = queue;
+ ret = mars_task_create(
+ mars,
+ &task_id,
+ NULL,
+ mpu1_prog.elf_image,
+ MARS_TASK_CONTEXT_SAVE_SIZE_MAX);
+ 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);
- usleep(200000);
+ /* see if the task is in sleep state */
+ mars_test_counter_wait(&notify, 1);
+ ret = mars_task_create(
+ mars,
+ &task2_id,
+ NULL,
+ mpu2_prog.elf_image,
+ MARS_TASK_CONTEXT_SAVE_SIZE_MAX);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+ ret = mars_task_schedule(&task2_id, NULL, 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_EQUAL(exit_code, 0);
+
+ MARS_TEST_ASSERT(mars_test_counter_get(&notify) == 1);
ret = mars_task_queue_push(queue, queue_item);
MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
@@ -80,6 +95,8 @@ int main(void)
ret = mars_task_destroy(&task_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);
MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
diff --git a/tests/TFP/TFP_4B_004/mpu.c b/tests/TFP/TFP_4B_004/mpu1.c
index a8f150e..7dee745 100644
--- a/tests/TFP/TFP_4B_004/mpu.c
+++ b/tests/TFP/TFP_4B_004/mpu1.c
@@ -30,6 +30,9 @@ int mars_task_main(const struct mars_task_args *task_args)
{
int ret;
uint64_t queue_ea = task_args->type.u64[0];
+ uint64_t notify_ea = task_args->type.u64[1];
+
+ mars_test_counter_add(notify_ea, 1);
ret = mars_task_queue_pop_begin(queue_ea, queue_item, 0);
MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
@@ -37,7 +40,5 @@ int mars_task_main(const struct mars_task_args *task_args)
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_004/mpu2.c b/tests/TFP/TFP_4B_004/mpu2.c
new file mode 100644
index 0000000..bdc8e78
--- /dev/null
+++ b/tests/TFP/TFP_4B_004/mpu2.c
@@ -0,0 +1,30 @@
+/*
+ * Copyright 2009 Sony Corporation
+ *
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a copy
+ * of this software and associated documentation files (the "Software"), to deal
+ * in the Software without restriction, including without limitation the rights
+ * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+ * copies of the Software, and to permit persons to whom the Software is
+ * furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included in
+ * all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+ * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, 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.h>
+#include <mars_task_test.h>
+
+int mars_task_main(const struct mars_task_args *task_args)
+{
+ return 0;
+}
diff --git a/tests/TFP/TFP_4B_005/Makefile b/tests/TFP/TFP_4B_005/Makefile
index ecbce33..72cf999 100644
--- a/tests/TFP/TFP_4B_005/Makefile
+++ b/tests/TFP/TFP_4B_005/Makefile
@@ -22,7 +22,7 @@
#
top_srcdir = ../..
-test_objs = host.o mpu1.task_eo mpu2.task_eo
+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_4B_005/host.c b/tests/TFP/TFP_4B_005/host.c
index 5edf747..01d749a 100644
--- a/tests/TFP/TFP_4B_005/host.c
+++ b/tests/TFP/TFP_4B_005/host.c
@@ -40,29 +40,30 @@ static uint32_t depth_size[] =
};
extern spe_program_handle_t mpu1_prog;
extern spe_program_handle_t mpu2_prog;
+extern spe_program_handle_t mpu3_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 struct mars_task_id task1_id, task2_id, task3_id;
-static uint64_t mpu_to_mpu[NUM_LOOP];
+static uint64_t mpu_to_mpu;
-static uint32_t shared_resource __attribute((aligned(16)));
+static uint32_t counter __attribute((aligned(16)));
int main(void)
{
int ret, i;
int32_t exit_code;
- ret = mars_context_create(&mars_ctx, 0, 0);
+ ret = mars_context_create(&mars_ctx, 1, 0);
MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
for (i = 0; i < NUM_LOOP; i++) {
- shared_resource = 0;
+ mars_test_counter_set(&counter, 0);
ret = mars_task_queue_create(
mars_ctx,
- &mpu_to_mpu[i],
+ &mpu_to_mpu,
sizeof(struct queue_entry),
depth_size[i],
MARS_TASK_QUEUE_MPU_TO_MPU);
@@ -73,23 +74,34 @@ int main(void)
mpu1_prog.elf_image, MARS_TASK_CONTEXT_SAVE_SIZE_MAX);
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[0] = mpu_to_mpu;
+ task1_args.type.u64[1] = mars_ptr_to_ea(&counter);
task1_args.type.u64[2] = (uint64_t)i;
ret = mars_task_schedule(&task1_id, &task1_args, 0);
MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+ /* check if queue pop is blocked in mpu task */
+ mars_test_counter_wait(&counter, 1);
+ ret = mars_task_create(mars_ctx, &task3_id, NULL,
+ mpu3_prog.elf_image,
+ MARS_TASK_CONTEXT_SAVE_SIZE_MAX);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+ ret = mars_task_schedule(&task3_id, &task2_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);
+
+ MARS_TEST_ASSERT(mars_test_counter_get(&counter) == 1);
/* create push task */
ret = mars_task_create(mars_ctx, &task2_id, NULL,
mpu2_prog.elf_image, MARS_TASK_CONTEXT_SAVE_SIZE_MAX);
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[0] = mpu_to_mpu;
task2_args.type.u64[1] = (uint64_t)i;
ret = mars_task_schedule(&task2_id, &task2_args, 0);
MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
@@ -109,7 +121,7 @@ int main(void)
ret = mars_task_destroy(&task2_id);
MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
- ret = mars_task_queue_destroy(mpu_to_mpu[i]);
+ ret = mars_task_queue_destroy(mpu_to_mpu);
MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
}
diff --git a/tests/TFP/TFP_4B_005/mpu1.c b/tests/TFP/TFP_4B_005/mpu1.c
index d9fb8d7..a2f03e6 100644
--- a/tests/TFP/TFP_4B_005/mpu1.c
+++ b/tests/TFP/TFP_4B_005/mpu1.c
@@ -23,36 +23,31 @@
#include <mars/task.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 counter_ea = task_args->type.u64[1];
uint64_t val = task_args->type.u64[2];
+ mars_test_counter_add(counter_ea, 1);
+
ret = mars_task_queue_pop_begin(mpu_to_mpu_ea, &data, 1);
MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+ mars_test_counter_add(counter_ea, 1);
+
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/mpu3.c b/tests/TFP/TFP_4B_005/mpu3.c
new file mode 100644
index 0000000..bdc8e78
--- /dev/null
+++ b/tests/TFP/TFP_4B_005/mpu3.c
@@ -0,0 +1,30 @@
+/*
+ * Copyright 2009 Sony Corporation
+ *
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a copy
+ * of this software and associated documentation files (the "Software"), to deal
+ * in the Software without restriction, including without limitation the rights
+ * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+ * copies of the Software, and to permit persons to whom the Software is
+ * furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included in
+ * all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+ * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, 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.h>
+#include <mars_task_test.h>
+
+int mars_task_main(const struct mars_task_args *task_args)
+{
+ return 0;
+}
diff --git a/tests/TFP/TFP_4B_006/Makefile b/tests/TFP/TFP_4B_006/Makefile
index ecbce33..72cf999 100644
--- a/tests/TFP/TFP_4B_006/Makefile
+++ b/tests/TFP/TFP_4B_006/Makefile
@@ -22,7 +22,7 @@
#
top_srcdir = ../..
-test_objs = host.o mpu1.task_eo mpu2.task_eo
+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_4B_006/host.c b/tests/TFP/TFP_4B_006/host.c
index 5edf747..7bd47cc 100644
--- a/tests/TFP/TFP_4B_006/host.c
+++ b/tests/TFP/TFP_4B_006/host.c
@@ -40,29 +40,30 @@ static uint32_t depth_size[] =
};
extern spe_program_handle_t mpu1_prog;
extern spe_program_handle_t mpu2_prog;
+extern spe_program_handle_t mpu3_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 struct mars_task_id task1_id, task2_id, task3_id;
-static uint64_t mpu_to_mpu[NUM_LOOP];
+static uint64_t mpu_to_mpu;
-static uint32_t shared_resource __attribute((aligned(16)));
+static uint32_t counter __attribute((aligned(16)));
int main(void)
{
int ret, i;
int32_t exit_code;
- ret = mars_context_create(&mars_ctx, 0, 0);
+ ret = mars_context_create(&mars_ctx, 1, 0);
MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
for (i = 0; i < NUM_LOOP; i++) {
- shared_resource = 0;
+ mars_test_counter_set(&counter, 0);
ret = mars_task_queue_create(
mars_ctx,
- &mpu_to_mpu[i],
+ &mpu_to_mpu,
sizeof(struct queue_entry),
depth_size[i],
MARS_TASK_QUEUE_MPU_TO_MPU);
@@ -73,23 +74,32 @@ int main(void)
mpu1_prog.elf_image, MARS_TASK_CONTEXT_SAVE_SIZE_MAX);
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[0] = mpu_to_mpu;
+ task1_args.type.u64[1] = mars_ptr_to_ea(&counter);
task1_args.type.u64[2] = (uint64_t)i;
ret = mars_task_schedule(&task1_id, &task1_args, 0);
MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+ /* check if queue pop is blocked in mpu task */
+ mars_test_counter_wait(&counter, 1);
+ ret = mars_task_create(mars_ctx, &task3_id, NULL,
+ mpu3_prog.elf_image, MARS_TASK_CONTEXT_SAVE_SIZE_MAX);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+ ret = mars_task_schedule(&task3_id, NULL, 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);
+
+ MARS_TEST_ASSERT_EQUAL(mars_test_counter_get(&counter), 1);
/* create push task */
ret = mars_task_create(mars_ctx, &task2_id, NULL,
mpu2_prog.elf_image, MARS_TASK_CONTEXT_SAVE_SIZE_MAX);
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[0] = mpu_to_mpu;
task2_args.type.u64[1] = (uint64_t)i;
ret = mars_task_schedule(&task2_id, &task2_args, 0);
MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
@@ -109,7 +119,7 @@ int main(void)
ret = mars_task_destroy(&task2_id);
MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
- ret = mars_task_queue_destroy(mpu_to_mpu[i]);
+ ret = mars_task_queue_destroy(mpu_to_mpu);
MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
}
diff --git a/tests/TFP/TFP_4B_006/mpu1.c b/tests/TFP/TFP_4B_006/mpu1.c
index d9fb8d7..6e60b98 100644
--- a/tests/TFP/TFP_4B_006/mpu1.c
+++ b/tests/TFP/TFP_4B_006/mpu1.c
@@ -23,36 +23,30 @@
#include <mars/task.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 counter = task_args->type.u64[1];
uint64_t val = task_args->type.u64[2];
+ mars_test_counter_add(counter, 1);
+
ret = mars_task_queue_pop_begin(mpu_to_mpu_ea, &data, 1);
MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+ mars_test_counter_add(counter, 1);
+
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/mpu3.c b/tests/TFP/TFP_4B_006/mpu3.c
new file mode 100644
index 0000000..bdc8e78
--- /dev/null
+++ b/tests/TFP/TFP_4B_006/mpu3.c
@@ -0,0 +1,30 @@
+/*
+ * Copyright 2009 Sony Corporation
+ *
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a copy
+ * of this software and associated documentation files (the "Software"), to deal
+ * in the Software without restriction, including without limitation the rights
+ * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+ * copies of the Software, and to permit persons to whom the Software is
+ * furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included in
+ * all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+ * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, 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.h>
+#include <mars_task_test.h>
+
+int mars_task_main(const struct mars_task_args *task_args)
+{
+ return 0;
+}
diff --git a/tests/TFP/TFP_4B_007/Makefile b/tests/TFP/TFP_4B_007/Makefile
index 432135a..ecbce33 100644
--- a/tests/TFP/TFP_4B_007/Makefile
+++ b/tests/TFP/TFP_4B_007/Makefile
@@ -22,7 +22,7 @@
#
top_srcdir = ../..
-test_objs = host.o mpu.task_eo
+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_007/host.c b/tests/TFP/TFP_4B_007/host.c
index 7ffab3b..dc3b8bf 100644
--- a/tests/TFP/TFP_4B_007/host.c
+++ b/tests/TFP/TFP_4B_007/host.c
@@ -38,31 +38,32 @@ static uint32_t depth_size[] =
1,
Q_DEPTH
};
-extern spe_program_handle_t mpu_prog;
+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 task_args;
-static struct mars_task_id task_id;
+static struct mars_task_id task_id, task2_id;
-static uint64_t host_to_mpu[NUM_LOOP];
+static uint64_t host_to_mpu;
static struct queue_entry data;
-static uint32_t shared_resource __attribute((aligned(16)));
+static uint32_t notify __attribute((aligned(16)));
int main(void)
{
int ret, i;
int32_t exit_code;
- ret = mars_context_create(&mars_ctx, 0, 0);
+ ret = mars_context_create(&mars_ctx, 1, 0);
MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
for (i = 0; i < NUM_LOOP; i++) {
- shared_resource = 0;
+ mars_test_counter_set(&notify, 0);
ret = mars_task_queue_create(
mars_ctx,
- &host_to_mpu[i],
+ &host_to_mpu,
sizeof(struct queue_entry),
depth_size[i],
MARS_TASK_QUEUE_HOST_TO_MPU);
@@ -70,22 +71,32 @@ int main(void)
/* create pop task */
ret = mars_task_create(mars_ctx, &task_id, NULL,
- mpu_prog.elf_image, MARS_TASK_CONTEXT_SAVE_SIZE_MAX);
+ mpu1_prog.elf_image, MARS_TASK_CONTEXT_SAVE_SIZE_MAX);
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[0] = host_to_mpu;
+ task_args.type.u64[1] = mars_ptr_to_ea(&notify);
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);
+ mars_test_counter_wait(&notify, 1);
+ ret = mars_task_create(mars_ctx, &task2_id, NULL,
+ mpu2_prog.elf_image,
+ MARS_TASK_CONTEXT_SAVE_SIZE_MAX);
+ ret = mars_task_schedule(&task2_id, NULL, 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);
+ MARS_TEST_ASSERT_EQUAL(mars_test_counter_get(&notify), 1);
/* try push one */
data.val = i;
- ret = mars_task_queue_try_push(host_to_mpu[i], &data);
+ ret = mars_task_queue_try_push(host_to_mpu, &data);
MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
/* check if mpu task is successfly finished */
@@ -96,7 +107,7 @@ int main(void)
ret = mars_task_destroy(&task_id);
MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
- ret = mars_task_queue_destroy(host_to_mpu[i]);
+ ret = mars_task_queue_destroy(host_to_mpu);
MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
}
diff --git a/tests/TFP/TFP_4B_007/mpu.c b/tests/TFP/TFP_4B_007/mpu1.c
index 509579f..70e87ad 100644
--- a/tests/TFP/TFP_4B_007/mpu.c
+++ b/tests/TFP/TFP_4B_007/mpu1.c
@@ -23,36 +23,30 @@
#include <mars/task.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 notify_ea = task_args->type.u64[1];
uint64_t val = task_args->type.u64[2];
+ mars_test_counter_add(notify_ea, 1);
+
ret = mars_task_queue_pop_begin(host_to_mpu_ea, &data, 1);
MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+ mars_test_counter_add(notify_ea, 1);
+
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_007/mpu2.c b/tests/TFP/TFP_4B_007/mpu2.c
new file mode 100644
index 0000000..041ba1f
--- /dev/null
+++ b/tests/TFP/TFP_4B_007/mpu2.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.
+ */
+
+#include <mars/task.h>
+#include <mars_task_test.h>
+
+int mars_task_main(const struct mars_task_args *task_args)
+{
+ return 0;
+}
diff --git a/tests/TFP/TFP_4B_008/Makefile b/tests/TFP/TFP_4B_008/Makefile
index ecbce33..72cf999 100644
--- a/tests/TFP/TFP_4B_008/Makefile
+++ b/tests/TFP/TFP_4B_008/Makefile
@@ -22,7 +22,7 @@
#
top_srcdir = ../..
-test_objs = host.o mpu1.task_eo mpu2.task_eo
+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_4B_008/host.c b/tests/TFP/TFP_4B_008/host.c
index 5edf747..ed63291 100644
--- a/tests/TFP/TFP_4B_008/host.c
+++ b/tests/TFP/TFP_4B_008/host.c
@@ -40,29 +40,30 @@ static uint32_t depth_size[] =
};
extern spe_program_handle_t mpu1_prog;
extern spe_program_handle_t mpu2_prog;
+extern spe_program_handle_t mpu3_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 struct mars_task_id task1_id, task2_id, task3_id;
-static uint64_t mpu_to_mpu[NUM_LOOP];
+static uint64_t mpu_to_mpu;
-static uint32_t shared_resource __attribute((aligned(16)));
+static uint32_t counter __attribute((aligned(16)));
int main(void)
{
int ret, i;
int32_t exit_code;
- ret = mars_context_create(&mars_ctx, 0, 0);
+ ret = mars_context_create(&mars_ctx, 1, 0);
MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
for (i = 0; i < NUM_LOOP; i++) {
- shared_resource = 0;
+ mars_test_counter_set(&counter, 0);
ret = mars_task_queue_create(
mars_ctx,
- &mpu_to_mpu[i],
+ &mpu_to_mpu,
sizeof(struct queue_entry),
depth_size[i],
MARS_TASK_QUEUE_MPU_TO_MPU);
@@ -73,23 +74,33 @@ int main(void)
mpu1_prog.elf_image, MARS_TASK_CONTEXT_SAVE_SIZE_MAX);
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[0] = mpu_to_mpu;
+ task1_args.type.u64[1] = mars_ptr_to_ea(&counter);
task1_args.type.u64[2] = (uint64_t)i;
ret = mars_task_schedule(&task1_id, &task1_args, 0);
MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+ /* check if queue pop is blocked in mpu task */
+ mars_test_counter_wait(&counter, 1);
+ ret = mars_task_create(mars_ctx, &task3_id, NULL,
+ mpu3_prog.elf_image, MARS_TASK_CONTEXT_SAVE_SIZE_MAX);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+ ret = mars_task_schedule(&task3_id, NULL, 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);
+
+ MARS_TEST_ASSERT_EQUAL(mars_test_counter_get(&counter), 1);
+
/* create push task */
ret = mars_task_create(mars_ctx, &task2_id, NULL,
mpu2_prog.elf_image, MARS_TASK_CONTEXT_SAVE_SIZE_MAX);
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[0] = mpu_to_mpu;
task2_args.type.u64[1] = (uint64_t)i;
ret = mars_task_schedule(&task2_id, &task2_args, 0);
MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
@@ -109,7 +120,7 @@ int main(void)
ret = mars_task_destroy(&task2_id);
MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
- ret = mars_task_queue_destroy(mpu_to_mpu[i]);
+ ret = mars_task_queue_destroy(mpu_to_mpu);
MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
}
diff --git a/tests/TFP/TFP_4B_008/mpu1.c b/tests/TFP/TFP_4B_008/mpu1.c
index d9fb8d7..3051286 100644
--- a/tests/TFP/TFP_4B_008/mpu1.c
+++ b/tests/TFP/TFP_4B_008/mpu1.c
@@ -30,29 +30,24 @@ struct queue_entry {
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 counter_ea = task_args->type.u64[1];
uint64_t val = task_args->type.u64[2];
+ mars_test_counter_add(counter_ea, 1);
+
ret = mars_task_queue_pop_begin(mpu_to_mpu_ea, &data, 1);
MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+ mars_test_counter_add(counter_ea, 1);
+
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/mpu3.c b/tests/TFP/TFP_4B_008/mpu3.c
new file mode 100644
index 0000000..bdc8e78
--- /dev/null
+++ b/tests/TFP/TFP_4B_008/mpu3.c
@@ -0,0 +1,30 @@
+/*
+ * Copyright 2009 Sony Corporation
+ *
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a copy
+ * of this software and associated documentation files (the "Software"), to deal
+ * in the Software without restriction, including without limitation the rights
+ * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+ * copies of the Software, and to permit persons to whom the Software is
+ * furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included in
+ * all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+ * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, 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.h>
+#include <mars_task_test.h>
+
+int mars_task_main(const struct mars_task_args *task_args)
+{
+ return 0;
+}
diff --git a/tests/TFP/TFP_4B_009/Makefile b/tests/TFP/TFP_4B_009/Makefile
index ecbce33..72cf999 100644
--- a/tests/TFP/TFP_4B_009/Makefile
+++ b/tests/TFP/TFP_4B_009/Makefile
@@ -22,7 +22,7 @@
#
top_srcdir = ../..
-test_objs = host.o mpu1.task_eo mpu2.task_eo
+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_4B_009/host.c b/tests/TFP/TFP_4B_009/host.c
index 5edf747..1f036a3 100644
--- a/tests/TFP/TFP_4B_009/host.c
+++ b/tests/TFP/TFP_4B_009/host.c
@@ -40,29 +40,30 @@ static uint32_t depth_size[] =
};
extern spe_program_handle_t mpu1_prog;
extern spe_program_handle_t mpu2_prog;
+extern spe_program_handle_t mpu3_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 struct mars_task_id task1_id, task2_id, task3_id;
-static uint64_t mpu_to_mpu[NUM_LOOP];
+static uint64_t mpu_to_mpu;
-static uint32_t shared_resource __attribute((aligned(16)));
+static uint32_t counter __attribute((aligned(16)));
int main(void)
{
int ret, i;
int32_t exit_code;
- ret = mars_context_create(&mars_ctx, 0, 0);
+ ret = mars_context_create(&mars_ctx, 1, 0);
MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
for (i = 0; i < NUM_LOOP; i++) {
- shared_resource = 0;
+ mars_test_counter_set(&counter, 0);
ret = mars_task_queue_create(
mars_ctx,
- &mpu_to_mpu[i],
+ &mpu_to_mpu,
sizeof(struct queue_entry),
depth_size[i],
MARS_TASK_QUEUE_MPU_TO_MPU);
@@ -73,23 +74,38 @@ int main(void)
mpu1_prog.elf_image, MARS_TASK_CONTEXT_SAVE_SIZE_MAX);
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[0] = mpu_to_mpu;
+ task1_args.type.u64[1] = mars_ptr_to_ea(&counter);
task1_args.type.u64[2] = (uint64_t)i;
ret = mars_task_schedule(&task1_id, &task1_args, 0);
MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+ /* check if queue pop is blocked in mpu task */
+ mars_test_counter_wait(&counter, 1);
+
+ ret = mars_task_create(mars_ctx, &task3_id, NULL,
+ mpu3_prog.elf_image,
+ MARS_TASK_CONTEXT_SAVE_SIZE_MAX);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+
+ ret = mars_task_schedule(&task3_id, NULL, 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);
+
+ MARS_TEST_ASSERT_EQUAL(mars_test_counter_get(&counter), 1);
+
/* create push task */
ret = mars_task_create(mars_ctx, &task2_id, NULL,
mpu2_prog.elf_image, MARS_TASK_CONTEXT_SAVE_SIZE_MAX);
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[0] = mpu_to_mpu;
task2_args.type.u64[1] = (uint64_t)i;
ret = mars_task_schedule(&task2_id, &task2_args, 0);
MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
@@ -109,7 +125,7 @@ int main(void)
ret = mars_task_destroy(&task2_id);
MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
- ret = mars_task_queue_destroy(mpu_to_mpu[i]);
+ ret = mars_task_queue_destroy(mpu_to_mpu);
MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
}
diff --git a/tests/TFP/TFP_4B_009/mpu1.c b/tests/TFP/TFP_4B_009/mpu1.c
index d9fb8d7..07fd3bb 100644
--- a/tests/TFP/TFP_4B_009/mpu1.c
+++ b/tests/TFP/TFP_4B_009/mpu1.c
@@ -23,36 +23,29 @@
#include <mars/task.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 counter_ea = task_args->type.u64[1];
uint64_t val = task_args->type.u64[2];
+ mars_test_counter_add(counter_ea, 1);
ret = mars_task_queue_pop_begin(mpu_to_mpu_ea, &data, 1);
MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+ mars_test_counter_add(counter_ea, 1);
+
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/mpu3.c b/tests/TFP/TFP_4B_009/mpu3.c
new file mode 100644
index 0000000..bdc8e78
--- /dev/null
+++ b/tests/TFP/TFP_4B_009/mpu3.c
@@ -0,0 +1,30 @@
+/*
+ * Copyright 2009 Sony Corporation
+ *
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a copy
+ * of this software and associated documentation files (the "Software"), to deal
+ * in the Software without restriction, including without limitation the rights
+ * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+ * copies of the Software, and to permit persons to whom the Software is
+ * furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included in
+ * all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+ * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, 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.h>
+#include <mars_task_test.h>
+
+int mars_task_main(const struct mars_task_args *task_args)
+{
+ return 0;
+}
diff --git a/tests/TFP/TFP_4C_001/host.c b/tests/TFP/TFP_4C_001/host.c
index 58ce715..ca6b2c1 100644
--- a/tests/TFP/TFP_4C_001/host.c
+++ b/tests/TFP/TFP_4C_001/host.c
@@ -50,8 +50,9 @@ 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 uint64_t mpu_to_mpu;
+static uint32_t notify __attribute__((aligned(128)));
+static uint32_t counter __attribute__((aligned(128)));
static void queue_push(uint64_t id)
@@ -65,7 +66,7 @@ static void queue_push(uint64_t id)
MARS_TASK_CONTEXT_SAVE_SIZE_MAX);
MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
- task2_args.type.u64[0] = mpu_to_mpu[id];
+ task2_args.type.u64[0] = mpu_to_mpu;
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);
@@ -84,17 +85,20 @@ int main(void)
int32_t exit_code, chk_exit;
uint32_t num;
uint32_t chk_bit, count;
+ int num_mpu;
+ num_mpu = 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++) {
- notify[0] = 0;
+ mars_test_counter_set(&notify, 0);
+ mars_test_counter_set(&counter, 0);
chk_bit = 0;
ret = mars_task_queue_create(
mars_ctx,
- &mpu_to_mpu[i],
+ &mpu_to_mpu,
sizeof(struct queue_entry),
depth_size[i],
MARS_TASK_QUEUE_MPU_TO_MPU);
@@ -111,17 +115,20 @@ int main(void)
mpu1_prog.elf_image, MARS_TASK_CONTEXT_SAVE_SIZE_MAX);
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[0] = mpu_to_mpu;
+ task1_args.type.u64[1] = mars_ptr_to_ea(&notify);
+ task1_args.type.u64[2] = mars_ptr_to_ea(&counter);
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);
+ if (num_mpu < depth_size[i])
+ mars_test_counter_wait(&counter, num_mpu);
+ else
+ mars_test_counter_wait(&counter, depth_size[i]);
+ mars_test_counter_set(&notify, 1);
chk_exit = 0;
for (num = 0; num < depth_size[i]; num++) {
@@ -135,11 +142,11 @@ int main(void)
MARS_TEST_ASSERT_EQUAL((uint32_t)chk_exit, chk_bit);
/* check queue count */
- ret = mars_task_queue_count(mpu_to_mpu[i], &count);
+ ret = mars_task_queue_count(mpu_to_mpu, &count);
MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
MARS_TEST_ASSERT_EQUAL(count, 0);
- ret = mars_task_queue_destroy(mpu_to_mpu[i]);
+ ret = mars_task_queue_destroy(mpu_to_mpu);
MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
}
diff --git a/tests/TFP/TFP_4C_001/mpu1.c b/tests/TFP/TFP_4C_001/mpu1.c
index 2d2ce58..7ea6cea 100644
--- a/tests/TFP/TFP_4C_001/mpu1.c
+++ b/tests/TFP/TFP_4C_001/mpu1.c
@@ -37,8 +37,10 @@ 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 counter_ea = task_args->type.u64[2];
uint64_t val;
+ mars_test_counter_add(counter_ea, 1);
mars_test_counter_wait(notify_ea, 1);
ret = mars_task_queue_pop_begin(mpu_to_mpu_ea, &data, 1);
diff --git a/tests/TFP/TFP_4D_004/host.c b/tests/TFP/TFP_4D_004/host.c
index 91d577a..475d6ca 100644
--- a/tests/TFP/TFP_4D_004/host.c
+++ b/tests/TFP/TFP_4D_004/host.c
@@ -49,8 +49,9 @@ 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 uint64_t host_to_mpu;
+static uint32_t notify __attribute((aligned(128)));
+static uint32_t counter __attribute((aligned(128)));
static struct queue_entry data;
static void queue_push(uint64_t id, uint64_t count)
@@ -60,7 +61,7 @@ static void queue_push(uint64_t id, uint64_t count)
for (i = 0; i < count; i++) {
data.val1 = i;
data.val2 = i + TEST_DIFF;
- ret = mars_task_queue_push(host_to_mpu[id], &data);
+ ret = mars_task_queue_push(host_to_mpu, &data);
MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
}
}
@@ -71,17 +72,21 @@ int main(void)
int32_t exit_code, chk_exit;
uint32_t num;
uint32_t chk_bit, count;
+ int num_mpu;
+
+ num_mpu = 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++) {
- notify[0] = 0;
+ mars_test_counter_set(&notify, 0);
+ mars_test_counter_set(&counter, 0);
chk_bit = 0;
ret = mars_task_queue_create(
mars_ctx,
- &host_to_mpu[i],
+ &host_to_mpu,
sizeof(struct queue_entry),
depth_size[i],
MARS_TASK_QUEUE_HOST_TO_MPU);
@@ -98,17 +103,20 @@ int main(void)
mpu_prog.elf_image, MARS_TASK_CONTEXT_SAVE_SIZE_MAX);
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[0] = host_to_mpu;
+ task_args.type.u64[1] = mars_ptr_to_ea(&notify);
+ task_args.type.u64[2] = mars_ptr_to_ea(&counter);
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);
+ if (num_mpu < depth_size[i])
+ mars_test_counter_wait(&counter, num_mpu);
+ else
+ mars_test_counter_wait(&counter, depth_size[i]);
+ mars_test_counter_set(&notify, 1);
chk_exit = 0;
for (num = 0; num < depth_size[i]; num++) {
@@ -122,11 +130,11 @@ int main(void)
MARS_TEST_ASSERT_EQUAL((uint32_t)chk_exit, chk_bit);
/* check queue count */
- ret = mars_task_queue_count(host_to_mpu[i], &count);
+ ret = mars_task_queue_count(host_to_mpu, &count);
MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
MARS_TEST_ASSERT_EQUAL(count, 0);
- ret = mars_task_queue_destroy(host_to_mpu[i]);
+ ret = mars_task_queue_destroy(host_to_mpu);
MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
}
diff --git a/tests/TFP/TFP_4D_004/mpu.c b/tests/TFP/TFP_4D_004/mpu.c
index 5c5e26d..82d3150 100644
--- a/tests/TFP/TFP_4D_004/mpu.c
+++ b/tests/TFP/TFP_4D_004/mpu.c
@@ -23,7 +23,6 @@
#include <mars/task.h>
#include <mars_task_test.h>
-#include <spu_mfcio.h>
#define TEST_DIFF 1
struct queue_entry {
@@ -37,8 +36,10 @@ 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 counter_ea = task_args->type.u64[2];
uint64_t val;
+ mars_test_counter_add(counter_ea, 1);
mars_test_counter_wait(notify_ea, 1);
ret = mars_task_queue_try_pop(host_to_mpu_ea, &data);
diff --git a/tests/TFP/TFP_4D_005/host.c b/tests/TFP/TFP_4D_005/host.c
index d89f32a..fcbf067 100644
--- a/tests/TFP/TFP_4D_005/host.c
+++ b/tests/TFP/TFP_4D_005/host.c
@@ -51,24 +51,22 @@ 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 uint64_t mpu_to_host;
static struct queue_entry data[Q_DEPTH];
static pthread_t thread[Q_DEPTH];
+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 id = (uint32_t)task_args->type.u32[0];
- uint32_t num = (uint32_t)task_args->type.u32[1];
+ uint32_t num = ((struct mars_task_args *)ptr)->type.u32[0];
uint64_t val;
/* wait for start */
- while (!shared_resource)
- usleep(100);
+ ret = pthread_barrier_wait(&barrier);
- ret = mars_task_queue_try_pop(mpu_to_host[id], &data[num]);
+ ret = mars_task_queue_try_pop(mpu_to_host, &data[num]);
MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
/* check queue data */
@@ -90,12 +88,11 @@ int main(void)
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],
+ &mpu_to_host,
sizeof(struct queue_entry),
depth_size[i],
MARS_TASK_QUEUE_MPU_TO_HOST);
@@ -107,7 +104,7 @@ int main(void)
MARS_TASK_CONTEXT_SAVE_SIZE_MAX);
MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
- task1_args.type.u64[0] = mpu_to_host[i];
+ task1_args.type.u64[0] = mpu_to_host;
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);
@@ -119,19 +116,18 @@ int main(void)
ret = mars_task_destroy(&task1_id);
MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+ ret = pthread_barrier_init(&barrier, NULL, depth_size[i]);
+ MARS_TEST_ASSERT(ret == 0);
+
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;
+ thread_args[num].type.u32[0] = (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++) {
@@ -140,11 +136,14 @@ int main(void)
}
MARS_TEST_ASSERT_EQUAL(chk_exit, chk_bit);
- ret = mars_task_queue_count(mpu_to_host[i], &count);
+ ret = pthread_barrier_destroy(&barrier);
+ MARS_TEST_ASSERT(ret == 0);
+
+ ret = mars_task_queue_count(mpu_to_host, &count);
MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
MARS_TEST_ASSERT_EQUAL(count, 0);
- ret = mars_task_queue_destroy(mpu_to_host[i]);
+ ret = mars_task_queue_destroy(mpu_to_host);
MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
}
diff --git a/tests/TFP/TFP_4D_006/host.c b/tests/TFP/TFP_4D_006/host.c
index 360225a..cdb6c21 100644
--- a/tests/TFP/TFP_4D_006/host.c
+++ b/tests/TFP/TFP_4D_006/host.c
@@ -50,8 +50,9 @@ 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 uint64_t mpu_to_mpu;
+static uint32_t notify __attribute((aligned(128)));
+static uint32_t counter __attribute((aligned(128)));
static void queue_push(uint64_t id)
{
@@ -64,7 +65,7 @@ static void queue_push(uint64_t id)
MARS_TASK_CONTEXT_SAVE_SIZE_MAX);
MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
- task2_args.type.u64[0] = mpu_to_mpu[id];
+ task2_args.type.u64[0] = mpu_to_mpu;
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);
@@ -83,17 +84,21 @@ int main(void)
int32_t exit_code, chk_exit;
uint32_t num;
uint32_t chk_bit, count;
+ int num_mpu;
+ num_mpu = 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++) {
- notify[0] = 0;
+ mars_test_counter_set(&notify, 0);
+ mars_test_counter_set(&counter, 0);
+
chk_bit = 0;
ret = mars_task_queue_create(
mars_ctx,
- &mpu_to_mpu[i],
+ &mpu_to_mpu,
sizeof(struct queue_entry),
depth_size[i],
MARS_TASK_QUEUE_MPU_TO_MPU);
@@ -110,17 +115,20 @@ int main(void)
mpu1_prog.elf_image, MARS_TASK_CONTEXT_SAVE_SIZE_MAX);
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[0] = mpu_to_mpu;
+ task1_args.type.u64[1] = mars_ptr_to_ea(&notify);
+ task1_args.type.u64[2] = mars_ptr_to_ea(&counter);
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);
+ if (num_mpu < depth_size[i])
+ mars_test_counter_wait(&counter, num_mpu);
+ else
+ mars_test_counter_wait(&counter, depth_size[i]);
+ mars_test_counter_set(&notify, 1);
chk_exit = 0;
for (num = 0; num < depth_size[i]; num++) {
@@ -134,11 +142,11 @@ int main(void)
MARS_TEST_ASSERT_EQUAL((uint32_t)chk_exit, chk_bit);
/* check queue count */
- ret = mars_task_queue_count(mpu_to_mpu[i], &count);
+ ret = mars_task_queue_count(mpu_to_mpu, &count);
MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
MARS_TEST_ASSERT_EQUAL(count, 0);
- ret = mars_task_queue_destroy(mpu_to_mpu[i]);
+ ret = mars_task_queue_destroy(mpu_to_mpu);
MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
}
diff --git a/tests/TFP/TFP_4D_006/mpu1.c b/tests/TFP/TFP_4D_006/mpu1.c
index 2b86d14..f3e15f9 100644
--- a/tests/TFP/TFP_4D_006/mpu1.c
+++ b/tests/TFP/TFP_4D_006/mpu1.c
@@ -23,7 +23,6 @@
#include <mars/task.h>
#include <mars_task_test.h>
-#include <spu_mfcio.h>
#define TEST_DIFF 1
struct queue_entry {
@@ -37,8 +36,10 @@ 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 counter_ea = task_args->type.u64[2];
uint64_t val;
+ mars_test_counter_add(counter_ea, 1);
mars_test_counter_wait(notify_ea, 1);
ret = mars_task_queue_try_pop(mpu_to_mpu_ea, &data);
diff --git a/tests/TFP/TFP_4E_003/Makefile b/tests/TFP/TFP_4E_003/Makefile
index ecbce33..72cf999 100644
--- a/tests/TFP/TFP_4E_003/Makefile
+++ b/tests/TFP/TFP_4E_003/Makefile
@@ -22,7 +22,7 @@
#
top_srcdir = ../..
-test_objs = host.o mpu1.task_eo mpu2.task_eo
+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_4E_003/host.c b/tests/TFP/TFP_4E_003/host.c
index 5edf747..6229669 100644
--- a/tests/TFP/TFP_4E_003/host.c
+++ b/tests/TFP/TFP_4E_003/host.c
@@ -40,29 +40,30 @@ static uint32_t depth_size[] =
};
extern spe_program_handle_t mpu1_prog;
extern spe_program_handle_t mpu2_prog;
+extern spe_program_handle_t mpu3_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 struct mars_task_id task1_id, task2_id, task3_id;
-static uint64_t mpu_to_mpu[NUM_LOOP];
+static uint64_t mpu_to_mpu;
-static uint32_t shared_resource __attribute((aligned(16)));
+static uint32_t notify __attribute((aligned(16)));
int main(void)
{
int ret, i;
int32_t exit_code;
- ret = mars_context_create(&mars_ctx, 0, 0);
+ ret = mars_context_create(&mars_ctx, 1, 0);
MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
for (i = 0; i < NUM_LOOP; i++) {
- shared_resource = 0;
+ mars_test_counter_set(&notify, 0);
ret = mars_task_queue_create(
mars_ctx,
- &mpu_to_mpu[i],
+ &mpu_to_mpu,
sizeof(struct queue_entry),
depth_size[i],
MARS_TASK_QUEUE_MPU_TO_MPU);
@@ -70,26 +71,42 @@ int main(void)
/* create pop task */
ret = mars_task_create(mars_ctx, &task1_id, NULL,
- mpu1_prog.elf_image, MARS_TASK_CONTEXT_SAVE_SIZE_MAX);
+ mpu1_prog.elf_image,
+ MARS_TASK_CONTEXT_SAVE_SIZE_MAX);
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[0] = mpu_to_mpu;
+ task1_args.type.u64[1] = mars_ptr_to_ea(&notify);
task1_args.type.u64[2] = (uint64_t)i;
ret = mars_task_schedule(&task1_id, &task1_args, 0);
MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+
+ /* check if queue pop is blocked in mpu task */
+ mars_test_counter_wait(&notify, 1);
+
+ ret = mars_task_create(mars_ctx, &task3_id, NULL,
+ mpu3_prog.elf_image,
+ MARS_TASK_CONTEXT_SAVE_SIZE_MAX);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+
+ ret = mars_task_schedule(&task3_id, NULL, 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);
+
+ MARS_TEST_ASSERT_EQUAL_INT(mars_test_counter_get(&notify), 1);
+
/* create push task */
ret = mars_task_create(mars_ctx, &task2_id, NULL,
mpu2_prog.elf_image, MARS_TASK_CONTEXT_SAVE_SIZE_MAX);
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[0] = mpu_to_mpu;
task2_args.type.u64[1] = (uint64_t)i;
ret = mars_task_schedule(&task2_id, &task2_args, 0);
MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
@@ -109,7 +126,7 @@ int main(void)
ret = mars_task_destroy(&task2_id);
MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
- ret = mars_task_queue_destroy(mpu_to_mpu[i]);
+ ret = mars_task_queue_destroy(mpu_to_mpu);
MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
}
diff --git a/tests/TFP/TFP_4E_003/mpu1.c b/tests/TFP/TFP_4E_003/mpu1.c
index 6952f5b..257c924 100644
--- a/tests/TFP/TFP_4E_003/mpu1.c
+++ b/tests/TFP/TFP_4E_003/mpu1.c
@@ -30,35 +30,25 @@ struct queue_entry {
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 notify_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);
- }
+ mars_test_counter_add(notify_ea, 1);
+
+ ret = mars_task_queue_pop_begin(mpu_to_mpu_ea, &data, 1);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+
+ mars_test_counter_add(notify_ea, 1);
+
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/mpu3.c b/tests/TFP/TFP_4E_003/mpu3.c
new file mode 100644
index 0000000..bdc8e78
--- /dev/null
+++ b/tests/TFP/TFP_4E_003/mpu3.c
@@ -0,0 +1,30 @@
+/*
+ * Copyright 2009 Sony Corporation
+ *
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a copy
+ * of this software and associated documentation files (the "Software"), to deal
+ * in the Software without restriction, including without limitation the rights
+ * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+ * copies of the Software, and to permit persons to whom the Software is
+ * furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included in
+ * all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+ * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, 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.h>
+#include <mars_task_test.h>
+
+int mars_task_main(const struct mars_task_args *task_args)
+{
+ return 0;
+}
diff --git a/tests/TFP/TFP_4E_004/host.c b/tests/TFP/TFP_4E_004/host.c
index 91d577a..1643c98 100644
--- a/tests/TFP/TFP_4E_004/host.c
+++ b/tests/TFP/TFP_4E_004/host.c
@@ -49,18 +49,19 @@ 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 uint64_t host_to_mpu;
+static uint32_t notify __attribute__((aligned(128)));
+static uint32_t counter __attribute__((aligned(128)));
static struct queue_entry data;
-static void queue_push(uint64_t id, uint64_t count)
+static void queue_push(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);
+ ret = mars_task_queue_push(host_to_mpu, &data);
MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
}
}
@@ -71,23 +72,26 @@ int main(void)
int32_t exit_code, chk_exit;
uint32_t num;
uint32_t chk_bit, count;
+ int num_mpu;
+ num_mpu = 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++) {
- notify[0] = 0;
+ mars_test_counter_set(&notify, 0);
+ mars_test_counter_set(&counter, 0);
chk_bit = 0;
ret = mars_task_queue_create(
mars_ctx,
- &host_to_mpu[i],
+ &host_to_mpu,
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]);
+ queue_push(depth_size[i]);
/* create pop task */
for (num = 0; num < depth_size[i]; num++) {
@@ -95,20 +99,24 @@ int main(void)
/* create pop task */
ret = mars_task_create(mars_ctx, &task_id[num], NULL,
- mpu_prog.elf_image, MARS_TASK_CONTEXT_SAVE_SIZE_MAX);
+ mpu_prog.elf_image,
+ MARS_TASK_CONTEXT_SAVE_SIZE_MAX);
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[0] = host_to_mpu;
+ task_args.type.u64[1] = mars_ptr_to_ea(&notify);
+ task_args.type.u64[2] = mars_ptr_to_ea(&counter);
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);
+ if (num_mpu < depth_size[i])
+ mars_test_counter_wait(&counter, num_mpu);
+ else
+ mars_test_counter_wait(&counter, depth_size[i]);
+ mars_test_counter_set(&notify, 1);
chk_exit = 0;
for (num = 0; num < depth_size[i]; num++) {
@@ -122,11 +130,11 @@ int main(void)
MARS_TEST_ASSERT_EQUAL((uint32_t)chk_exit, chk_bit);
/* check queue count */
- ret = mars_task_queue_count(host_to_mpu[i], &count);
+ ret = mars_task_queue_count(host_to_mpu, &count);
MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
MARS_TEST_ASSERT_EQUAL(count, 0);
- ret = mars_task_queue_destroy(host_to_mpu[i]);
+ ret = mars_task_queue_destroy(host_to_mpu);
MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
}
diff --git a/tests/TFP/TFP_4E_004/mpu.c b/tests/TFP/TFP_4E_004/mpu.c
index bf58265..0b7ed9d 100644
--- a/tests/TFP/TFP_4E_004/mpu.c
+++ b/tests/TFP/TFP_4E_004/mpu.c
@@ -37,8 +37,10 @@ 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 counter_ea = task_args->type.u64[2];
uint64_t val;
+ mars_test_counter_add(counter_ea, 1);
mars_test_counter_wait(notify_ea, 1);
ret = mars_task_queue_try_pop_begin(host_to_mpu_ea, &data, 1);
diff --git a/tests/TFP/TFP_4E_005/host.c b/tests/TFP/TFP_4E_005/host.c
index 360225a..16a1483 100644
--- a/tests/TFP/TFP_4E_005/host.c
+++ b/tests/TFP/TFP_4E_005/host.c
@@ -50,8 +50,9 @@ 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 uint64_t mpu_to_mpu;
+static uint32_t notify __attribute__((aligned(128)));
+static uint32_t counter __attribute__((aligned(128)));
static void queue_push(uint64_t id)
{
@@ -64,7 +65,7 @@ static void queue_push(uint64_t id)
MARS_TASK_CONTEXT_SAVE_SIZE_MAX);
MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
- task2_args.type.u64[0] = mpu_to_mpu[id];
+ task2_args.type.u64[0] = mpu_to_mpu;
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);
@@ -83,17 +84,20 @@ int main(void)
int32_t exit_code, chk_exit;
uint32_t num;
uint32_t chk_bit, count;
+ int num_mpu;
+ num_mpu = 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++) {
- notify[0] = 0;
+ mars_test_counter_set(&notify, 0);
+ mars_test_counter_set(&counter, 0);
chk_bit = 0;
ret = mars_task_queue_create(
mars_ctx,
- &mpu_to_mpu[i],
+ &mpu_to_mpu,
sizeof(struct queue_entry),
depth_size[i],
MARS_TASK_QUEUE_MPU_TO_MPU);
@@ -110,17 +114,20 @@ int main(void)
mpu1_prog.elf_image, MARS_TASK_CONTEXT_SAVE_SIZE_MAX);
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[0] = mpu_to_mpu;
+ task1_args.type.u64[1] = mars_ptr_to_ea(&notify);
+ task1_args.type.u64[2] = mars_ptr_to_ea(&counter);
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);
+ if (num_mpu < depth_size[i])
+ mars_test_counter_wait(&counter, num_mpu);
+ else
+ mars_test_counter_wait(&counter, depth_size[i]);
+ mars_test_counter_set(&notify, 1);
chk_exit = 0;
for (num = 0; num < depth_size[i]; num++) {
@@ -134,11 +141,11 @@ int main(void)
MARS_TEST_ASSERT_EQUAL((uint32_t)chk_exit, chk_bit);
/* check queue count */
- ret = mars_task_queue_count(mpu_to_mpu[i], &count);
+ ret = mars_task_queue_count(mpu_to_mpu, &count);
MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
MARS_TEST_ASSERT_EQUAL(count, 0);
- ret = mars_task_queue_destroy(mpu_to_mpu[i]);
+ ret = mars_task_queue_destroy(mpu_to_mpu);
MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
}
diff --git a/tests/TFP/TFP_4E_005/mpu1.c b/tests/TFP/TFP_4E_005/mpu1.c
index e2ec476..4e238f4 100644
--- a/tests/TFP/TFP_4E_005/mpu1.c
+++ b/tests/TFP/TFP_4E_005/mpu1.c
@@ -37,8 +37,10 @@ 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 counter_ea = task_args->type.u64[2];
uint64_t val;
+ mars_test_counter_add(counter_ea, 1);
mars_test_counter_wait(notify_ea, 1);
ret = mars_task_queue_try_pop_begin(mpu_to_mpu_ea, &data, 1);
diff --git a/tests/TFP/TFP_4E_006/Makefile b/tests/TFP/TFP_4E_006/Makefile
index ecbce33..72cf999 100644
--- a/tests/TFP/TFP_4E_006/Makefile
+++ b/tests/TFP/TFP_4E_006/Makefile
@@ -22,7 +22,7 @@
#
top_srcdir = ../..
-test_objs = host.o mpu1.task_eo mpu2.task_eo
+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_4E_006/host.c b/tests/TFP/TFP_4E_006/host.c
index 5edf747..5a15020 100644
--- a/tests/TFP/TFP_4E_006/host.c
+++ b/tests/TFP/TFP_4E_006/host.c
@@ -40,29 +40,30 @@ static uint32_t depth_size[] =
};
extern spe_program_handle_t mpu1_prog;
extern spe_program_handle_t mpu2_prog;
+extern spe_program_handle_t mpu3_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 struct mars_task_id task1_id, task2_id, task3_id;
-static uint64_t mpu_to_mpu[NUM_LOOP];
+static uint64_t mpu_to_mpu;
-static uint32_t shared_resource __attribute((aligned(16)));
+static uint32_t notify __attribute__((aligned(16)));
int main(void)
{
int ret, i;
int32_t exit_code;
- ret = mars_context_create(&mars_ctx, 0, 0);
+ ret = mars_context_create(&mars_ctx, 1, 0);
MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
for (i = 0; i < NUM_LOOP; i++) {
- shared_resource = 0;
+ mars_test_counter_set(&notify, 0);
ret = mars_task_queue_create(
mars_ctx,
- &mpu_to_mpu[i],
+ &mpu_to_mpu,
sizeof(struct queue_entry),
depth_size[i],
MARS_TASK_QUEUE_MPU_TO_MPU);
@@ -73,23 +74,38 @@ int main(void)
mpu1_prog.elf_image, MARS_TASK_CONTEXT_SAVE_SIZE_MAX);
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[0] = mpu_to_mpu;
+ task1_args.type.u64[1] = mars_ptr_to_ea(&notify);
task1_args.type.u64[2] = (uint64_t)i;
ret = mars_task_schedule(&task1_id, &task1_args, 0);
MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+ /* check if queue pop is blocked in mpu task */
+ mars_test_counter_wait(&notify, 1);
+
+ ret = mars_task_create(mars_ctx, &task3_id, NULL,
+ mpu3_prog.elf_image,
+ MARS_TASK_CONTEXT_SAVE_SIZE_MAX);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+
+ ret = mars_task_schedule(&task3_id, NULL, 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);
+
+ MARS_TEST_ASSERT_EQUAL_INT(mars_test_counter_get(&notify), 1);
+
/* create push task */
ret = mars_task_create(mars_ctx, &task2_id, NULL,
mpu2_prog.elf_image, MARS_TASK_CONTEXT_SAVE_SIZE_MAX);
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[0] = mpu_to_mpu;
task2_args.type.u64[1] = (uint64_t)i;
ret = mars_task_schedule(&task2_id, &task2_args, 0);
MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
@@ -109,7 +125,7 @@ int main(void)
ret = mars_task_destroy(&task2_id);
MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
- ret = mars_task_queue_destroy(mpu_to_mpu[i]);
+ ret = mars_task_queue_destroy(mpu_to_mpu);
MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
}
diff --git a/tests/TFP/TFP_4E_006/mpu1.c b/tests/TFP/TFP_4E_006/mpu1.c
index 6952f5b..16de126 100644
--- a/tests/TFP/TFP_4E_006/mpu1.c
+++ b/tests/TFP/TFP_4E_006/mpu1.c
@@ -23,42 +23,30 @@
#include <mars/task.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 notify = 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_counter_add(notify, 1);
+ ret = mars_task_queue_pop_begin(mpu_to_mpu_ea, &data, 1);
MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
- MARS_TEST_ASSERT_EQUAL(data.val, val);
+ mars_test_counter_add(notify, 1);
+ ret = mars_task_queue_pop_end(mpu_to_mpu_ea, 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();
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+ MARS_TEST_ASSERT_EQUAL(data.val, val);
return 0;
}
diff --git a/tests/TFP/TFP_4E_006/mpu3.c b/tests/TFP/TFP_4E_006/mpu3.c
new file mode 100644
index 0000000..bdc8e78
--- /dev/null
+++ b/tests/TFP/TFP_4E_006/mpu3.c
@@ -0,0 +1,30 @@
+/*
+ * Copyright 2009 Sony Corporation
+ *
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a copy
+ * of this software and associated documentation files (the "Software"), to deal
+ * in the Software without restriction, including without limitation the rights
+ * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+ * copies of the Software, and to permit persons to whom the Software is
+ * furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included in
+ * all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+ * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, 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.h>
+#include <mars_task_test.h>
+
+int mars_task_main(const struct mars_task_args *task_args)
+{
+ return 0;
+}
diff --git a/tests/TFP/TFP_4F_004/Makefile b/tests/TFP/TFP_4F_004/Makefile
index 432135a..ecbce33 100644
--- a/tests/TFP/TFP_4F_004/Makefile
+++ b/tests/TFP/TFP_4F_004/Makefile
@@ -22,7 +22,7 @@
#
top_srcdir = ../..
-test_objs = host.o mpu.task_eo
+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_004/host.c b/tests/TFP/TFP_4F_004/host.c
index 6721c48..9b3cca2 100644
--- a/tests/TFP/TFP_4F_004/host.c
+++ b/tests/TFP/TFP_4F_004/host.c
@@ -28,26 +28,28 @@
#define QUEUE_DEPTH 16
-extern spe_program_handle_t mpu_prog;
+extern spe_program_handle_t mpu1_prog;
+extern spe_program_handle_t mpu2_prog;
static struct mars_context *mars;
-static struct mars_task_id task_id;
+static struct mars_task_id task_id, task2_id;
static struct mars_task_args task_args;
static uint64_t queue;
-static uint64_t queue_item[2], mpu_answer __attribute__((aligned(16)));
+static uint64_t queue_item[2] __attribute__((aligned(16)));
+static uint32_t notify __attribute__((aligned(16)));
int main(void)
{
int exit_code, ret;
- ret = mars_context_create(&mars, 0, 0);
+ ret = mars_context_create(&mars, 1, 0);
MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
ret = mars_task_create(
mars,
&task_id,
"4F004",
- mpu_prog.elf_image,
+ mpu1_prog.elf_image,
MARS_TASK_CONTEXT_SAVE_SIZE_MAX);
MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
@@ -59,16 +61,29 @@ int main(void)
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[1] = mars_ptr_to_ea(&notify);
ret = mars_task_schedule(&task_id, &task_args, 0);
MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
- usleep(200000);
+ mars_test_counter_wait(&notify, 1);
+
+ ret = mars_task_create(
+ mars,
+ &task2_id,
+ "4F004",
+ mpu2_prog.elf_image,
+ MARS_TASK_CONTEXT_SAVE_SIZE_MAX);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+ ret = mars_task_schedule(&task2_id, NULL, 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_EQUAL(exit_code, 0);
+ ret = mars_task_destroy(&task2_id);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
- mpu_answer = 1;
+ MARS_TEST_ASSERT_EQUAL_INT(mars_test_counter_get(&notify), 1);
ret = mars_task_queue_push(queue, queue_item);
MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
diff --git a/tests/TFP/TFP_4F_004/mpu.c b/tests/TFP/TFP_4F_004/mpu1.c
index 4a7096a..ec277dc 100644
--- a/tests/TFP/TFP_4F_004/mpu.c
+++ b/tests/TFP/TFP_4F_004/mpu1.c
@@ -31,17 +31,14 @@ 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;
+ uint64_t notify = task_args->type.u64[1];
int ret;
+ mars_test_counter_add(notify, 1);
+
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);
-
+ mars_test_counter_add(notify, 1);
return 0;
}
diff --git a/tests/TFP/TFP_4F_004/mpu2.c b/tests/TFP/TFP_4F_004/mpu2.c
new file mode 100644
index 0000000..e546d01
--- /dev/null
+++ b/tests/TFP/TFP_4F_004/mpu2.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 <string.h>
+#include <mars/task.h>
+#include "mars_task_test.h"
+
+int mars_task_main(const struct mars_task_args *task_args)
+{
+ return 0;
+}
diff --git a/tests/TFP/TFP_4F_005/host.c b/tests/TFP/TFP_4F_005/host.c
index 04fdf2c..fa96ad3 100644
--- a/tests/TFP/TFP_4F_005/host.c
+++ b/tests/TFP/TFP_4F_005/host.c
@@ -21,6 +21,10 @@
* THE SOFTWARE.
*/
+#include <sys/types.h>
+#include <linux/unistd.h>
+#include <errno.h>
+#include <pthread.h>
#include <libspe2.h>
#include <mars/task.h>
#include <mars_test.h>
@@ -33,25 +37,76 @@ 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)));
+static uint64_t queue_item[2] __attribute__((aligned(16)));
+static uint32_t notify __attribute__((aligned(16)));
+static pthread_t thread;
+static pid_t thread_pid;
+/*
+ * N O T E:
+ * This test uses Linux specific feature, in other word, you can not
+ * run this test program on the system other than Linux.
+ */
-int main(void)
+int is_thread_blocked(pid_t tid)
{
- int exit_code, ret;
- uint32_t tb_freq;
+ FILE *tstat;
+ char path[128];
+ char buf[1024];
+ int n;
+
+ snprintf(path, sizeof(path) - 1, "/proc/%d/status", tid);
+ tstat = fopen(path, "r");
+ MARS_TEST_ASSERT(tstat != NULL);
+
+ while ((n = fscanf(tstat, "State:\t%s\n", buf)) != EOF) {
+ if (n == 1)
+ break;
+ else
+ fgetc(tstat);
+ }
+ fclose(tstat);
+
+ switch (buf[0]) {
+ case 'R': /* running */
+ case 'D': /* disk sleep */
+ return 0;
+ break;
+ case 'S': /* sleep */
+ return 1;
+ break;
+ case 'T': /* trace stopped / stopped */
+ case 'Z': /* zonbie */
+ case 'X': /* dead */
+ default:
+ MARS_TEST_ASSERT(0);
+ return 0;
+ break;
+ };
+}
- ret = mars_test_get_timebase_freq(&tb_freq);
- MARS_TEST_ASSERT_EQUAL(ret, 0);
+pid_t linux_get_thread_id(void)
+{
+ return syscall(__NR_gettid);
+};
- ret = mars_context_create(&mars, 0, 0);
+static void *thread_proc(void *ptr)
+{
+ int ret;
+
+ thread_pid = linux_get_thread_id();
+ mars_test_counter_add(&notify, 1);
+
+ ret = mars_task_queue_peek(queue, queue_item);
MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
- ret = mars_task_create(
- mars,
- &task_id,
- "4F005",
- mpu_prog.elf_image,
- MARS_TASK_CONTEXT_SAVE_SIZE_MAX);
+ return NULL;
+}
+
+int main(void)
+{
+ int exit_code, ret;
+
+ ret = mars_context_create(&mars, 0, 0);
MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
ret = mars_task_queue_create(
@@ -62,23 +117,35 @@ int main(void)
MARS_TASK_QUEUE_MPU_TO_HOST);
MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
- mpu_answer = 0;
+ ret = pthread_create(&thread, NULL, thread_proc, NULL);
+ MARS_TEST_ASSERT_EQUAL_INT(ret, 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);
+ /* wait for the thread being blocked */
+ mars_test_counter_wait(&notify, 1);
+ while (!is_thread_blocked(thread_pid))
+ ;
- ret = mars_task_queue_peek(queue, queue_item);
+ /* create push task */
+ ret = mars_task_create(
+ mars,
+ &task_id,
+ "4F005",
+ mpu_prog.elf_image,
+ MARS_TASK_CONTEXT_SAVE_SIZE_MAX);
MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
- MARS_TEST_ASSERT(mpu_answer);
+ 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);
+ /* check if thread is finished */
+ ret = pthread_join(thread, NULL);
+ MARS_TEST_ASSERT_EQUAL_INT(ret, 0);
+
ret = mars_task_queue_destroy(queue);
MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
diff --git a/tests/TFP/TFP_4F_005/mpu.c b/tests/TFP/TFP_4F_005/mpu.c
index ed7be18..888f688 100644
--- a/tests/TFP/TFP_4F_005/mpu.c
+++ b/tests/TFP/TFP_4F_005/mpu.c
@@ -22,7 +22,6 @@
*/
#include <string.h>
-#include <spu_mfcio.h>
#include <mars/task.h>
#include "mars_task_test.h"
@@ -32,17 +31,9 @@ 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
index ecbce33..72cf999 100644
--- a/tests/TFP/TFP_4F_006/Makefile
+++ b/tests/TFP/TFP_4F_006/Makefile
@@ -22,7 +22,7 @@
#
top_srcdir = ../..
-test_objs = host.o mpu1.task_eo mpu2.task_eo
+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_4F_006/host.c b/tests/TFP/TFP_4F_006/host.c
index 5173453..99bfda9 100644
--- a/tests/TFP/TFP_4F_006/host.c
+++ b/tests/TFP/TFP_4F_006/host.c
@@ -27,75 +27,92 @@
#define QUEUE_DEPTH 16
-extern spe_program_handle_t mpu1_prog, mpu2_prog;
+extern spe_program_handle_t mpu1_prog, mpu2_prog, mpu3_prog;
static struct mars_context *mars;
-static struct mars_task_id pusher_task_id, poper_task_id;
+static struct mars_task_id pusher_task_id, peeker_task_id, dummy_task_id;
static struct mars_task_args task_args;
static uint64_t queue;
-static uint64_t mpu_answer __attribute__((aligned(16)));
+static uint32_t counter __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, 1, 0);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
- ret = mars_context_create(&mars, 0, 0);
+ ret = mars_task_queue_create(
+ mars,
+ &queue,
+ 16,
+ QUEUE_DEPTH,
+ MARS_TASK_QUEUE_MPU_TO_MPU);
MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+ /* create and run peek task */
ret = mars_task_create(
mars,
- &pusher_task_id,
+ &peeker_task_id,
"4F006",
- mpu1_prog.elf_image,
+ mpu2_prog.elf_image,
MARS_TASK_CONTEXT_SAVE_SIZE_MAX);
MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+ task_args.type.u64[0] = queue;
+ task_args.type.u64[1] = mars_ptr_to_ea(&counter);
+ ret = mars_task_schedule(&peeker_task_id, &task_args, 0);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+
+ mars_test_counter_wait(&counter, 1);
+
+ /* create and run dummy task */
ret = mars_task_create(
mars,
- &poper_task_id,
+ &dummy_task_id,
"4F006",
- mpu2_prog.elf_image,
+ mpu3_prog.elf_image,
MARS_TASK_CONTEXT_SAVE_SIZE_MAX);
MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
- ret = mars_task_queue_create(
- mars,
- &queue,
- 16,
- QUEUE_DEPTH,
- MARS_TASK_QUEUE_MPU_TO_MPU);
+ ret = mars_task_schedule(&dummy_task_id, NULL, 0);
MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
- mpu_answer = 0;
+ ret = mars_task_wait(&dummy_task_id, &exit_code);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+ MARS_TEST_ASSERT_EQUAL(exit_code, 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);
+ /* create and run pusher task */
+ ret = mars_task_create(
+ mars,
+ &pusher_task_id,
+ "4F006",
+ mpu1_prog.elf_image,
+ MARS_TASK_CONTEXT_SAVE_SIZE_MAX);
MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
- ret = mars_task_schedule(&poper_task_id, &task_args, 0);
+ 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_wait(&poper_task_id, &exit_code);
+ 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(&poper_task_id);
+ ret = mars_task_destroy(&peeker_task_id);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+
+ ret = mars_task_destroy(&dummy_task_id);
MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
ret = mars_context_destroy(mars);
diff --git a/tests/TFP/TFP_4F_006/mpu1.c b/tests/TFP/TFP_4F_006/mpu1.c
index ed7be18..f9ba449 100644
--- a/tests/TFP/TFP_4F_006/mpu1.c
+++ b/tests/TFP/TFP_4F_006/mpu1.c
@@ -20,9 +20,6 @@
* 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/task.h>
#include "mars_task_test.h"
@@ -32,17 +29,9 @@ 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
index e336d75..3961224 100644
--- a/tests/TFP/TFP_4F_006/mpu2.c
+++ b/tests/TFP/TFP_4F_006/mpu2.c
@@ -21,8 +21,6 @@
* THE SOFTWARE.
*/
-#include <string.h>
-#include <spu_mfcio.h>
#include <mars/task.h>
#include "mars_task_test.h"
@@ -32,17 +30,12 @@ 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 counter_ea = task_args->type.u64[1];
- uint64_t mpu_answer;
+ mars_test_counter_add(counter_ea, 1);
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_006/mpu3.c b/tests/TFP/TFP_4F_006/mpu3.c
new file mode 100644
index 0000000..6c0e351
--- /dev/null
+++ b/tests/TFP/TFP_4F_006/mpu3.c
@@ -0,0 +1,30 @@
+/*
+ * Copyright 2009 Sony Corporation
+ *
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a copy
+ * of this software and associated documentation files (the "Software"), to deal
+ * in the Software without restriction, including without limitation the rights
+ * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+ * copies of the Software, and to permit persons to whom the Software is
+ * furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included in
+ * all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+ * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, 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.h>
+#include "mars_task_test.h"
+
+int mars_task_main(const struct mars_task_args *task_args)
+{
+ return 0;
+}
diff --git a/tests/TFP/TFP_4F_007/host.c b/tests/TFP/TFP_4F_007/host.c
index 1afd798..91d9e56 100644
--- a/tests/TFP/TFP_4F_007/host.c
+++ b/tests/TFP/TFP_4F_007/host.c
@@ -47,8 +47,9 @@ 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 uint64_t host_to_mpu;
+static uint32_t notify __attribute((aligned(128)));
+static uint32_t counter __attribute((aligned(128)));
static struct queue_entry data;
int main(void)
@@ -56,16 +57,19 @@ int main(void)
int ret, i;
int32_t exit_code;
uint32_t num, count;
+ int num_mpu;
+ num_mpu = 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++) {
- notify[0] = 0;
+ mars_test_counter_set(&notify, 0);
+ mars_test_counter_set(&counter, 0);
ret = mars_task_queue_create(
mars_ctx,
- &host_to_mpu[i],
+ &host_to_mpu,
sizeof(struct queue_entry),
depth_size[i],
MARS_TASK_QUEUE_HOST_TO_MPU);
@@ -73,9 +77,12 @@ int main(void)
/* push queue */
data.val1 = i;
- ret = mars_task_queue_push(host_to_mpu[i], &data);
+ ret = mars_task_queue_push(host_to_mpu, &data);
MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+ task_args.type.u64[0] = host_to_mpu;
+ task_args.type.u64[1] = mars_ptr_to_ea(&notify);
+ task_args.type.u64[3] = mars_ptr_to_ea(&counter);
for (num = 0; num < depth_size[i]; num++) {
/* create peek tasks */
/* all tasks will peek the same data */
@@ -83,17 +90,17 @@ int main(void)
mpu_prog.elf_image, MARS_TASK_CONTEXT_SAVE_SIZE_MAX);
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);
+ if (num_mpu < depth_size[i])
+ mars_test_counter_wait(&counter, num_mpu);
+ else
+ mars_test_counter_wait(&counter, depth_size[i]);
+ mars_test_counter_set(&notify, 1);
for (num = 0; num < depth_size[i]; num++) {
ret = mars_task_wait(&task_id[num], &exit_code);
@@ -104,11 +111,11 @@ int main(void)
MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
}
- ret = mars_task_queue_count(host_to_mpu[i], &count);
+ ret = mars_task_queue_count(host_to_mpu, &count);
MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
MARS_TEST_ASSERT_EQUAL(count, 1);
- ret = mars_task_queue_destroy(host_to_mpu[i]);
+ ret = mars_task_queue_destroy(host_to_mpu);
MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
}
diff --git a/tests/TFP/TFP_4F_007/mpu.c b/tests/TFP/TFP_4F_007/mpu.c
index dcc8b9c..6b8ca3a 100644
--- a/tests/TFP/TFP_4F_007/mpu.c
+++ b/tests/TFP/TFP_4F_007/mpu.c
@@ -23,7 +23,6 @@
#include <mars/task.h>
#include <mars_task_test.h>
-#include <spu_mfcio.h>
struct queue_entry {
uint64_t val1;
@@ -36,8 +35,10 @@ 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 counter_ea = task_args->type.u64[3];
uint32_t id = (uint32_t)task_args->type.u64[2];
+ mars_test_counter_add(counter_ea, 1);
mars_test_counter_wait(notify_ea, 1);
ret = mars_task_queue_peek(host_to_mpu_ea, &data);
diff --git a/tests/TFP/TFP_4F_008/host.c b/tests/TFP/TFP_4F_008/host.c
index 203200e..812c543 100644
--- a/tests/TFP/TFP_4F_008/host.c
+++ b/tests/TFP/TFP_4F_008/host.c
@@ -53,6 +53,8 @@ static uint32_t shared_resource __attribute((aligned(16)));
static struct queue_entry data[Q_DEPTH];
static pthread_t thread[Q_DEPTH];
+static pthread_barrier_t barrier;
+
static void *thread_proc(void *ptr)
{
int ret;
@@ -61,8 +63,7 @@ static void *thread_proc(void *ptr)
uint32_t num = (uint32_t)task_args->type.u32[1];
/* wait for start */
- while (!shared_resource)
- usleep(100);
+ pthread_barrier_wait(&barrier);
ret = mars_task_queue_peek(mpu_to_host[id], &data[num]);
MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
@@ -93,6 +94,9 @@ int main(void)
MARS_TASK_QUEUE_MPU_TO_HOST);
MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+ ret = pthread_barrier_init(&barrier, NULL, depth_size[i]);
+ MARS_TEST_ASSERT_EQUAL_INT(ret, 0);
+
/* create push task */
ret = mars_task_create(mars_ctx, &task_id, NULL,
mpu_prog.elf_image, MARS_TASK_CONTEXT_SAVE_SIZE_MAX);
@@ -116,8 +120,6 @@ int main(void)
thread_proc, &thread_args[num]);
}
- /* start ppe threads at the same time */
- sleep(1);
shared_resource = 1;
ret = mars_task_destroy(&task_id);
@@ -126,6 +128,9 @@ int main(void)
for (num = 0; num < depth_size[i]; num++)
pthread_join(thread[num], NULL);
+ ret = pthread_barrier_destroy(&barrier);
+ MARS_TEST_ASSERT_EQUAL_INT(ret, 0);
+
ret = mars_task_queue_count(mpu_to_host[i], &count);
MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
MARS_TEST_ASSERT_EQUAL(count, 1);
diff --git a/tests/TFP/TFP_4F_009/host.c b/tests/TFP/TFP_4F_009/host.c
index b821e38..cdbf9d0 100644
--- a/tests/TFP/TFP_4F_009/host.c
+++ b/tests/TFP/TFP_4F_009/host.c
@@ -48,24 +48,29 @@ 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 uint64_t mpu_to_mpu;
+static uint32_t notify __attribute__((aligned(128)));
+static uint32_t counter __attribute__((aligned(128)));
int main(void)
{
int ret, i;
int32_t exit_code;
uint32_t num, count;
+ int num_mpu;
+
+ num_mpu = 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++) {
- notify[0] = 0;
+ mars_test_counter_set(&notify, 0);
+ mars_test_counter_set(&counter, 0);
ret = mars_task_queue_create(
mars_ctx,
- &mpu_to_mpu[i],
+ &mpu_to_mpu,
sizeof(struct queue_entry),
depth_size[i],
MARS_TASK_QUEUE_MPU_TO_MPU);
@@ -76,7 +81,7 @@ int main(void)
mpu2_prog.elf_image, MARS_TASK_CONTEXT_SAVE_SIZE_MAX);
MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
- task2_args.type.u64[0] = mpu_to_mpu[i];
+ task2_args.type.u64[0] = mpu_to_mpu;
task2_args.type.u64[1] = (uint64_t)i;
ret = mars_task_schedule(&task2_id, &task2_args, 0);
MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
@@ -85,6 +90,9 @@ int main(void)
MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
MARS_TEST_ASSERT_ERROR(exit_code, MARS_SUCCESS);
+ task1_args.type.u64[0] = mpu_to_mpu;
+ task1_args.type.u64[1] = mars_ptr_to_ea(&notify);
+ task1_args.type.u64[3] = mars_ptr_to_ea(&counter);
for (num = 0; num < depth_size[i]; num++) {
/* create peek tasks */
/* all tasks will peek the same data */
@@ -92,9 +100,6 @@ int main(void)
mpu1_prog.elf_image, MARS_TASK_CONTEXT_SAVE_SIZE_MAX);
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);
@@ -102,8 +107,11 @@ int main(void)
}
/* start peek tasks at the same time */
- sleep(1);
- mars_test_counter_set(&notify[0], 1);
+ if (num_mpu < depth_size[i])
+ mars_test_counter_wait(&counter, num_mpu);
+ else
+ mars_test_counter_wait(&counter, depth_size[i]);
+ mars_test_counter_set(&notify, 1);
for (num = 0; num < depth_size[i]; num++) {
ret = mars_task_wait(&task1_id[num], &exit_code);
@@ -117,11 +125,11 @@ int main(void)
ret = mars_task_destroy(&task2_id);
MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
- ret = mars_task_queue_count(mpu_to_mpu[i], &count);
+ ret = mars_task_queue_count(mpu_to_mpu, &count);
MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
MARS_TEST_ASSERT_EQUAL(count, 1);
- ret = mars_task_queue_destroy(mpu_to_mpu[i]);
+ ret = mars_task_queue_destroy(mpu_to_mpu);
MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
}
diff --git a/tests/TFP/TFP_4F_009/mpu1.c b/tests/TFP/TFP_4F_009/mpu1.c
index 9903a99..a2c7bb6 100644
--- a/tests/TFP/TFP_4F_009/mpu1.c
+++ b/tests/TFP/TFP_4F_009/mpu1.c
@@ -23,7 +23,6 @@
#include <mars/task.h>
#include <mars_task_test.h>
-#include <spu_mfcio.h>
struct queue_entry {
uint64_t val1;
@@ -37,7 +36,9 @@ int mars_task_main(const struct mars_task_args *task_args)
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];
+ uint64_t counter_ea = task_args->type.u64[3];
+ mars_test_counter_add(counter_ea, 1);
mars_test_counter_wait(notify_ea, 1);
ret = mars_task_queue_peek(mpu_to_mpu_ea, &data);
diff --git a/tests/TFP/TFP_4F_009/mpu2.c b/tests/TFP/TFP_4F_009/mpu2.c
index af93e41..d5af4f4 100644
--- a/tests/TFP/TFP_4F_009/mpu2.c
+++ b/tests/TFP/TFP_4F_009/mpu2.c
@@ -23,7 +23,6 @@
#include <mars/task.h>
#include <mars_task_test.h>
-#include <spu_mfcio.h>
struct queue_entry {
uint64_t val1;
diff --git a/tests/TFP/TFP_4F_010/Makefile b/tests/TFP/TFP_4F_010/Makefile
index 432135a..ecbce33 100644
--- a/tests/TFP/TFP_4F_010/Makefile
+++ b/tests/TFP/TFP_4F_010/Makefile
@@ -22,7 +22,7 @@
#
top_srcdir = ../..
-test_objs = host.o mpu.task_eo
+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_010/host.c b/tests/TFP/TFP_4F_010/host.c
index 4ac9df9..83f29d3 100644
--- a/tests/TFP/TFP_4F_010/host.c
+++ b/tests/TFP/TFP_4F_010/host.c
@@ -38,65 +38,82 @@ static uint32_t depth_size[] =
1,
Q_DEPTH
};
-extern spe_program_handle_t mpu_prog;
+extern spe_program_handle_t mpu1_prog, mpu2_prog;
static struct mars_context *mars_ctx;
static struct mars_task_args task_args;
-static struct mars_task_id task_id;
+static struct mars_task_id task1_id, task2_id;
-static uint64_t host_to_mpu[NUM_LOOP];
+static uint64_t host_to_mpu;
static struct queue_entry data;
-static uint32_t shared_resource __attribute((aligned(16)));
+static uint32_t notify __attribute__((aligned(16)));
int main(void)
{
int ret, i;
int32_t exit_code;
- ret = mars_context_create(&mars_ctx, 0, 0);
+ ret = mars_context_create(&mars_ctx, 1, 0);
MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
for (i = 0; i < NUM_LOOP; i++) {
- shared_resource = 0;
+ mars_test_counter_set(&notify, 0);
ret = mars_task_queue_create(
mars_ctx,
- &host_to_mpu[i],
+ &host_to_mpu,
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_SIZE_MAX);
+ ret = mars_task_create(mars_ctx, &task2_id, NULL,
+ mpu2_prog.elf_image,
+ MARS_TASK_CONTEXT_SAVE_SIZE_MAX);
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[0] = host_to_mpu;
+ task_args.type.u64[1] = mars_ptr_to_ea(&notify);
task_args.type.u64[2] = (uint64_t)i;
- ret = mars_task_schedule(&task_id, &task_args, 0);
+ ret = mars_task_schedule(&task2_id, &task_args, 0);
MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+ mars_test_counter_wait(&notify, 1);
+
/* check if queue peek is blocked in mpu task */
- sleep(1);
- MARS_TEST_ASSERT_EQUAL(shared_resource, 0);
+ ret = mars_task_create(mars_ctx, &task1_id, NULL,
+ mpu1_prog.elf_image,
+ MARS_TASK_CONTEXT_SAVE_SIZE_MAX);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+
+ ret = mars_task_schedule(&task1_id, NULL, 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);
+
+ MARS_TEST_ASSERT_EQUAL_INT(mars_test_counter_get(&notify),
+ 1);
/* push one */
data.val = i;
- ret = mars_task_queue_push(host_to_mpu[i], &data);
+ ret = mars_task_queue_push(host_to_mpu, &data);
MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
/* check if mpu task is successfly finished */
- ret = mars_task_wait(&task_id, &exit_code);
+ 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(&task_id);
+ 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(host_to_mpu[i]);
+ ret = mars_task_queue_destroy(host_to_mpu);
MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
}
diff --git a/tests/TFP/TFP_18_002/mpu1.c b/tests/TFP/TFP_4F_010/mpu1.c
index 2d74c3d..041ba1f 100644
--- a/tests/TFP/TFP_18_002/mpu1.c
+++ b/tests/TFP/TFP_4F_010/mpu1.c
@@ -21,16 +21,10 @@
* THE SOFTWARE.
*/
-#include <mars_task_test.h>
#include <mars/task.h>
+#include <mars_task_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, 2);
-
- mars_task_exit(0);
-
return 0;
}
diff --git a/tests/TFP/TFP_4F_015/mpu.c b/tests/TFP/TFP_4F_010/mpu2.c
index 6c94c61..ef08cbf 100644
--- a/tests/TFP/TFP_4F_015/mpu.c
+++ b/tests/TFP/TFP_4F_010/mpu2.c
@@ -30,31 +30,27 @@ struct queue_entry {
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 notify = task_args->type.u64[1];
uint64_t val = task_args->type.u64[2];
uint32_t count;
+ mars_test_counter_add(notify, 1);
+
ret = mars_task_queue_peek(host_to_mpu_ea, &data);
MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
MARS_TEST_ASSERT_EQUAL(data.val, val);
+ mars_test_counter_add(notify, 1);
+
/* 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/host.c b/tests/TFP/TFP_4F_011/host.c
index 8c4c828..242fb55 100644
--- a/tests/TFP/TFP_4F_011/host.c
+++ b/tests/TFP/TFP_4F_011/host.c
@@ -21,6 +21,9 @@
* THE SOFTWARE.
*/
+#include <sys/types.h>
+#include <linux/unistd.h>
+#include <errno.h>
#include <pthread.h>
#include <unistd.h>
#include <mars/task.h>
@@ -45,31 +48,78 @@ 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 uint64_t mpu_to_host;
-static uint32_t shared_resource __attribute((aligned(16)));
+static uint32_t notify __attribute__((aligned(16)));
static struct queue_entry data;
static pthread_t thread;
+static pid_t thread_pid;
+/*
+ * N O T E:
+ * This test uses Linux specific feature, in other word, you can not
+ * run this test program on the system other than Linux.
+ */
+
+int is_thread_blocked(pid_t tid)
+{
+ FILE *tstat;
+ char path[128];
+ char buf[1024];
+ int n;
+
+ snprintf(path, sizeof(path) - 1, "/proc/%d/status", tid);
+ tstat = fopen(path, "r");
+ MARS_TEST_ASSERT(tstat != NULL);
+
+ while ((n = fscanf(tstat, "State:\t%s\n", buf)) != EOF) {
+ if (n == 1)
+ break;
+ else
+ fgetc(tstat);
+ }
+ fclose(tstat);
+
+ switch (buf[0]) {
+ case 'R': /* running */
+ case 'D': /* disk sleep */
+ return 0;
+ break;
+ case 'S': /* sleep */
+ return 1;
+ break;
+ case 'T': /* trace stopped / stopped */
+ case 'Z': /* zonbie */
+ case 'X': /* dead */
+ default:
+ MARS_TEST_ASSERT(0);
+ return 0;
+ break;
+ };
+}
+
+pid_t linux_get_thread_id(void)
+{
+ return syscall(__NR_gettid);
+};
+
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);
+ thread_pid = linux_get_thread_id();
+ mars_test_counter_set(&notify, 1);
+
+ ret = mars_task_queue_peek(mpu_to_host, &data);
MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
- MARS_TEST_ASSERT_EQUAL(data.val1, id);
+ MARS_TEST_ASSERT_EQUAL(data.val1, thread_args.type.u32[0]);
/* check queue_count */
- ret = mars_task_queue_count(mpu_to_host[id], &count);
+ ret = mars_task_queue_count(mpu_to_host, &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;
}
@@ -82,11 +132,11 @@ int main(void)
MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
for (i = 0; i < NUM_LOOP; i++) {
- shared_resource = 0;
+ mars_test_counter_set(&notify, 0);
ret = mars_task_queue_create(
mars_ctx,
- &mpu_to_host[i],
+ &mpu_to_host,
sizeof(struct queue_entry),
depth_size[i],
MARS_TASK_QUEUE_MPU_TO_HOST);
@@ -94,7 +144,7 @@ int main(void)
/* create peek thread */
thread_args.type.u32[0] = (uint32_t)i;
- pthread_create(&thread, NULL, thread_proc, &thread_args);
+ pthread_create(&thread, NULL, thread_proc, NULL);
/* create push task */
ret = mars_task_create(mars_ctx, &task_id, NULL,
@@ -102,11 +152,12 @@ int main(void)
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);
+ mars_test_counter_wait(&notify, 1);
+ while (!is_thread_blocked(thread_pid))
+ ;
/* push one by mpu */
- task_args.type.u64[0] = mpu_to_host[i];
+ task_args.type.u64[0] = mpu_to_host;
task_args.type.u64[1] = (uint64_t)i;
ret = mars_task_schedule(&task_id, &task_args, 0);
MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
@@ -121,7 +172,7 @@ int main(void)
ret = mars_task_destroy(&task_id);
MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
- ret = mars_task_queue_destroy(mpu_to_host[i]);
+ ret = mars_task_queue_destroy(mpu_to_host);
MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
}
diff --git a/tests/TFP/TFP_4F_011/mpu.c b/tests/TFP/TFP_4F_011/mpu.c
index 5880856..819812d 100644
--- a/tests/TFP/TFP_4F_011/mpu.c
+++ b/tests/TFP/TFP_4F_011/mpu.c
@@ -23,7 +23,6 @@
#include <mars/task.h>
#include <mars_task_test.h>
-#include <spu_mfcio.h>
struct queue_entry {
uint64_t val1;
diff --git a/tests/TFP/TFP_4F_012/Makefile b/tests/TFP/TFP_4F_012/Makefile
index ecbce33..72cf999 100644
--- a/tests/TFP/TFP_4F_012/Makefile
+++ b/tests/TFP/TFP_4F_012/Makefile
@@ -22,7 +22,7 @@
#
top_srcdir = ../..
-test_objs = host.o mpu1.task_eo mpu2.task_eo
+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_4F_012/host.c b/tests/TFP/TFP_4F_012/host.c
index fb48517..6837455 100644
--- a/tests/TFP/TFP_4F_012/host.c
+++ b/tests/TFP/TFP_4F_012/host.c
@@ -40,14 +40,15 @@ static uint32_t depth_size[] =
};
extern spe_program_handle_t mpu1_prog;
extern spe_program_handle_t mpu2_prog;
+extern spe_program_handle_t mpu3_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 struct mars_task_id task1_id, task2_id, task3_id;
-static uint64_t mpu_to_mpu[NUM_LOOP];
+static uint64_t mpu_to_mpu;
-static uint32_t shared_resource __attribute((aligned(16)));
+static uint32_t notify __attribute__((aligned(16)));
int main(void)
{
@@ -55,15 +56,15 @@ int main(void)
int32_t exit_code;
uint32_t count;
- ret = mars_context_create(&mars_ctx, 0, 0);
+ ret = mars_context_create(&mars_ctx, 1, 0);
MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
for (i = 0; i < NUM_LOOP; i++) {
- shared_resource = 0;
+ mars_test_counter_set(&notify, 0);
ret = mars_task_queue_create(
mars_ctx,
- &mpu_to_mpu[i],
+ &mpu_to_mpu,
sizeof(struct queue_entry),
depth_size[i],
MARS_TASK_QUEUE_MPU_TO_MPU);
@@ -71,26 +72,39 @@ int main(void)
/* create peek task */
ret = mars_task_create(mars_ctx, &task1_id, NULL,
- mpu1_prog.elf_image, MARS_TASK_CONTEXT_SAVE_SIZE_MAX);
+ mpu1_prog.elf_image,
+ MARS_TASK_CONTEXT_SAVE_SIZE_MAX);
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[0] = mpu_to_mpu;
+ task1_args.type.u64[1] = mars_ptr_to_ea(&notify);
task1_args.type.u64[2] = (uint64_t)i;
ret = mars_task_schedule(&task1_id, &task1_args, 0);
MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+ /* check if queue peek is blocked in mpu task */
+ mars_test_counter_wait(&notify, 1);
+ ret = mars_task_create(mars_ctx, &task3_id, NULL,
+ mpu3_prog.elf_image,
+ MARS_TASK_CONTEXT_SAVE_SIZE_MAX);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+
+ ret = mars_task_schedule(&task3_id, NULL, 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);
+
+ MARS_TEST_ASSERT_EQUAL_INT(mars_test_counter_get(&notify), 1);
+
/* create push task */
ret = mars_task_create(mars_ctx, &task2_id, NULL,
- mpu2_prog.elf_image, MARS_TASK_CONTEXT_SAVE_SIZE_MAX);
+ mpu2_prog.elf_image,
+ MARS_TASK_CONTEXT_SAVE_SIZE_MAX);
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[0] = mpu_to_mpu;
task2_args.type.u64[1] = (uint64_t)i;
ret = mars_task_schedule(&task2_id, &task2_args, 0);
MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
@@ -105,7 +119,7 @@ int main(void)
MARS_TEST_ASSERT_ERROR(exit_code, MARS_SUCCESS);
/* queue count should be 1 */
- ret = mars_task_queue_count(mpu_to_mpu[i], &count);
+ ret = mars_task_queue_count(mpu_to_mpu, &count);
MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
MARS_TEST_ASSERT_EQUAL(count, 1);
@@ -115,7 +129,10 @@ int main(void)
ret = mars_task_destroy(&task2_id);
MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
- ret = mars_task_queue_destroy(mpu_to_mpu[i]);
+ ret = mars_task_destroy(&task3_id);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+
+ ret = mars_task_queue_destroy(mpu_to_mpu);
MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
}
diff --git a/tests/TFP/TFP_4F_012/mpu1.c b/tests/TFP/TFP_4F_012/mpu1.c
index 2f1974b..b0699e1 100644
--- a/tests/TFP/TFP_4F_012/mpu1.c
+++ b/tests/TFP/TFP_4F_012/mpu1.c
@@ -23,32 +23,26 @@
#include <mars/task.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 notify_ea = task_args->type.u64[1];
uint64_t val = task_args->type.u64[2];
+ mars_test_counter_add(notify_ea, 1);
+
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();
-
+ mars_test_counter_add(notify_ea, 1);
return 0;
}
diff --git a/tests/TFP/TFP_4F_012/mpu2.c b/tests/TFP/TFP_4F_012/mpu2.c
index 892cea2..5bdb277 100644
--- a/tests/TFP/TFP_4F_012/mpu2.c
+++ b/tests/TFP/TFP_4F_012/mpu2.c
@@ -23,7 +23,6 @@
#include <mars/task.h>
#include <mars_task_test.h>
-#include <spu_mfcio.h>
struct queue_entry {
uint64_t val1;
diff --git a/tests/TFP/TFP_4F_012/mpu3.c b/tests/TFP/TFP_4F_012/mpu3.c
new file mode 100644
index 0000000..bdc8e78
--- /dev/null
+++ b/tests/TFP/TFP_4F_012/mpu3.c
@@ -0,0 +1,30 @@
+/*
+ * Copyright 2009 Sony Corporation
+ *
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a copy
+ * of this software and associated documentation files (the "Software"), to deal
+ * in the Software without restriction, including without limitation the rights
+ * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+ * copies of the Software, and to permit persons to whom the Software is
+ * furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included in
+ * all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+ * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, 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.h>
+#include <mars_task_test.h>
+
+int mars_task_main(const struct mars_task_args *task_args)
+{
+ return 0;
+}
diff --git a/tests/TFP/TFP_4F_013/host.c b/tests/TFP/TFP_4F_013/host.c
index 8c4c828..2a11cf4 100644
--- a/tests/TFP/TFP_4F_013/host.c
+++ b/tests/TFP/TFP_4F_013/host.c
@@ -21,6 +21,9 @@
* THE SOFTWARE.
*/
+#include <sys/types.h>
+#include <linux/unistd.h>
+#include <errno.h>
#include <pthread.h>
#include <unistd.h>
#include <mars/task.h>
@@ -45,31 +48,78 @@ 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 uint64_t mpu_to_host;
-static uint32_t shared_resource __attribute((aligned(16)));
+static uint32_t notify __attribute__((aligned(16)));
static struct queue_entry data;
static pthread_t thread;
+static pid_t thread_pid;
+/*
+ * N O T E:
+ * This test uses Linux specific feature, in other word, you can not
+ * run this test program on the system other than Linux.
+ */
+
+int is_thread_blocked(pid_t tid)
+{
+ FILE *tstat;
+ char path[128];
+ char buf[1024];
+ int n;
+
+ snprintf(path, sizeof(path) - 1, "/proc/%d/status", tid);
+ tstat = fopen(path, "r");
+ MARS_TEST_ASSERT(tstat != NULL);
+
+ while ((n = fscanf(tstat, "State:\t%s\n", buf)) != EOF) {
+ if (n == 1)
+ break;
+ else
+ fgetc(tstat);
+ }
+ fclose(tstat);
+
+ switch (buf[0]) {
+ case 'R': /* running */
+ case 'D': /* disk sleep */
+ return 0;
+ break;
+ case 'S': /* sleep */
+ return 1;
+ break;
+ case 'T': /* trace stopped / stopped */
+ case 'Z': /* zonbie */
+ case 'X': /* dead */
+ default:
+ MARS_TEST_ASSERT(0);
+ return 0;
+ break;
+ };
+}
+
+pid_t linux_get_thread_id(void)
+{
+ return syscall(__NR_gettid);
+};
+
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);
+ thread_pid = linux_get_thread_id();
+ mars_test_counter_set(&notify, 1);
+
+ ret = mars_task_queue_peek(mpu_to_host, &data);
MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
- MARS_TEST_ASSERT_EQUAL(data.val1, id);
+ MARS_TEST_ASSERT_EQUAL(data.val1, thread_args.type.u32[0]);
/* check queue_count */
- ret = mars_task_queue_count(mpu_to_host[id], &count);
+ ret = mars_task_queue_count(mpu_to_host, &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;
}
@@ -82,31 +132,33 @@ int main(void)
MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
for (i = 0; i < NUM_LOOP; i++) {
- shared_resource = 0;
+ mars_test_counter_set(&notify, 0);
ret = mars_task_queue_create(
mars_ctx,
- &mpu_to_host[i],
+ &mpu_to_host,
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);
+ thread_args.type.u32[0] = i;
+ pthread_create(&thread, NULL, thread_proc, NULL);
+
+ /* check if queue peek is blocked in ppe thread */
+ mars_test_counter_wait(&notify, 1);
+ while (!is_thread_blocked(thread_pid))
+ ;
/* create push task */
ret = mars_task_create(mars_ctx, &task_id, NULL,
- mpu_prog.elf_image, MARS_TASK_CONTEXT_SAVE_SIZE_MAX);
+ mpu_prog.elf_image,
+ MARS_TASK_CONTEXT_SAVE_SIZE_MAX);
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[0] = mpu_to_host;
task_args.type.u64[1] = (uint64_t)i;
ret = mars_task_schedule(&task_id, &task_args, 0);
MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
@@ -121,7 +173,7 @@ int main(void)
ret = mars_task_destroy(&task_id);
MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
- ret = mars_task_queue_destroy(mpu_to_host[i]);
+ ret = mars_task_queue_destroy(mpu_to_host);
MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
}
diff --git a/tests/TFP/TFP_4F_014/Makefile b/tests/TFP/TFP_4F_014/Makefile
index ecbce33..72cf999 100644
--- a/tests/TFP/TFP_4F_014/Makefile
+++ b/tests/TFP/TFP_4F_014/Makefile
@@ -22,7 +22,7 @@
#
top_srcdir = ../..
-test_objs = host.o mpu1.task_eo mpu2.task_eo
+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_4F_014/host.c b/tests/TFP/TFP_4F_014/host.c
index fb48517..023fc37 100644
--- a/tests/TFP/TFP_4F_014/host.c
+++ b/tests/TFP/TFP_4F_014/host.c
@@ -40,14 +40,15 @@ static uint32_t depth_size[] =
};
extern spe_program_handle_t mpu1_prog;
extern spe_program_handle_t mpu2_prog;
+extern spe_program_handle_t mpu3_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 struct mars_task_id task1_id, task2_id, task3_id;
-static uint64_t mpu_to_mpu[NUM_LOOP];
+static uint64_t mpu_to_mpu;
-static uint32_t shared_resource __attribute((aligned(16)));
+static uint32_t notify __attribute__((aligned(16)));
int main(void)
{
@@ -55,15 +56,15 @@ int main(void)
int32_t exit_code;
uint32_t count;
- ret = mars_context_create(&mars_ctx, 0, 0);
+ ret = mars_context_create(&mars_ctx, 1, 0);
MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
for (i = 0; i < NUM_LOOP; i++) {
- shared_resource = 0;
+ mars_test_counter_set(&notify, 0);
ret = mars_task_queue_create(
mars_ctx,
- &mpu_to_mpu[i],
+ &mpu_to_mpu,
sizeof(struct queue_entry),
depth_size[i],
MARS_TASK_QUEUE_MPU_TO_MPU);
@@ -71,26 +72,40 @@ int main(void)
/* create peek task */
ret = mars_task_create(mars_ctx, &task1_id, NULL,
- mpu1_prog.elf_image, MARS_TASK_CONTEXT_SAVE_SIZE_MAX);
+ mpu1_prog.elf_image,
+ MARS_TASK_CONTEXT_SAVE_SIZE_MAX);
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[0] = mpu_to_mpu;
+ task1_args.type.u64[1] = mars_ptr_to_ea(&notify);
task1_args.type.u64[2] = (uint64_t)i;
ret = mars_task_schedule(&task1_id, &task1_args, 0);
MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+ /* check if queue peek is blocked in mpu task */
+ mars_test_counter_wait(&notify, 1);
+
+ ret = mars_task_create(mars_ctx, &task3_id, NULL,
+ mpu3_prog.elf_image,
+ MARS_TASK_CONTEXT_SAVE_SIZE_MAX);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+
+ ret = mars_task_schedule(&task3_id, NULL, 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);
+
+ MARS_TEST_ASSERT_EQUAL_INT(mars_test_counter_get(&notify), 1);
+
/* create push task */
ret = mars_task_create(mars_ctx, &task2_id, NULL,
- mpu2_prog.elf_image, MARS_TASK_CONTEXT_SAVE_SIZE_MAX);
+ mpu2_prog.elf_image,
+ MARS_TASK_CONTEXT_SAVE_SIZE_MAX);
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[0] = mpu_to_mpu;
task2_args.type.u64[1] = (uint64_t)i;
ret = mars_task_schedule(&task2_id, &task2_args, 0);
MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
@@ -105,7 +120,7 @@ int main(void)
MARS_TEST_ASSERT_ERROR(exit_code, MARS_SUCCESS);
/* queue count should be 1 */
- ret = mars_task_queue_count(mpu_to_mpu[i], &count);
+ ret = mars_task_queue_count(mpu_to_mpu, &count);
MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
MARS_TEST_ASSERT_EQUAL(count, 1);
@@ -115,7 +130,10 @@ int main(void)
ret = mars_task_destroy(&task2_id);
MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
- ret = mars_task_queue_destroy(mpu_to_mpu[i]);
+ ret = mars_task_destroy(&task3_id);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+
+ ret = mars_task_queue_destroy(mpu_to_mpu);
MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
}
diff --git a/tests/TFP/TFP_4F_014/mpu1.c b/tests/TFP/TFP_4F_014/mpu1.c
index 2f1974b..e4d0c72 100644
--- a/tests/TFP/TFP_4F_014/mpu1.c
+++ b/tests/TFP/TFP_4F_014/mpu1.c
@@ -30,25 +30,21 @@ struct queue_entry {
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 notify = task_args->type.u64[1];
uint64_t val = task_args->type.u64[2];
+ mars_test_counter_add(notify, 1);
+
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();
+ mars_test_counter_add(notify, 1);
return 0;
}
diff --git a/tests/TFP/TFP_4F_014/mpu3.c b/tests/TFP/TFP_4F_014/mpu3.c
new file mode 100644
index 0000000..bdc8e78
--- /dev/null
+++ b/tests/TFP/TFP_4F_014/mpu3.c
@@ -0,0 +1,30 @@
+/*
+ * Copyright 2009 Sony Corporation
+ *
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a copy
+ * of this software and associated documentation files (the "Software"), to deal
+ * in the Software without restriction, including without limitation the rights
+ * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+ * copies of the Software, and to permit persons to whom the Software is
+ * furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included in
+ * all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+ * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, 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.h>
+#include <mars_task_test.h>
+
+int mars_task_main(const struct mars_task_args *task_args)
+{
+ return 0;
+}
diff --git a/tests/TFP/TFP_4F_015/Makefile b/tests/TFP/TFP_4F_015/Makefile
index 432135a..ecbce33 100644
--- a/tests/TFP/TFP_4F_015/Makefile
+++ b/tests/TFP/TFP_4F_015/Makefile
@@ -22,7 +22,7 @@
#
top_srcdir = ../..
-test_objs = host.o mpu.task_eo
+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_015/host.c b/tests/TFP/TFP_4F_015/host.c
index c2d752c..f77e173 100644
--- a/tests/TFP/TFP_4F_015/host.c
+++ b/tests/TFP/TFP_4F_015/host.c
@@ -38,65 +38,79 @@ static uint32_t depth_size[] =
1,
Q_DEPTH
};
-extern spe_program_handle_t mpu_prog;
+extern spe_program_handle_t mpu1_prog, mpu2_prog;
static struct mars_context *mars_ctx;
static struct mars_task_args task_args;
-static struct mars_task_id task_id;
+static struct mars_task_id task1_id, task2_id;
-static uint64_t host_to_mpu[NUM_LOOP];
+static uint64_t host_to_mpu;
static struct queue_entry data;
-static uint32_t shared_resource __attribute((aligned(16)));
+static uint32_t notify __attribute__((aligned(16)));
int main(void)
{
int ret, i;
int32_t exit_code;
- ret = mars_context_create(&mars_ctx, 0, 0);
+ ret = mars_context_create(&mars_ctx, 1, 0);
MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
for (i = 0; i < NUM_LOOP; i++) {
- shared_resource = 0;
+ mars_test_counter_set(&notify, 0);
ret = mars_task_queue_create(
mars_ctx,
- &host_to_mpu[i],
+ &host_to_mpu,
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_SIZE_MAX);
+ ret = mars_task_create(mars_ctx, &task1_id, NULL,
+ mpu1_prog.elf_image, MARS_TASK_CONTEXT_SAVE_SIZE_MAX);
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[0] = host_to_mpu;
+ task_args.type.u64[1] = mars_ptr_to_ea(&notify);
task_args.type.u64[2] = (uint64_t)i;
- ret = mars_task_schedule(&task_id, &task_args, 0);
+ ret = mars_task_schedule(&task1_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);
+ mars_test_counter_wait(&notify, 1);
+ ret = mars_task_create(mars_ctx, &task2_id, NULL,
+ mpu2_prog.elf_image,
+ MARS_TASK_CONTEXT_SAVE_SIZE_MAX);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+
+ ret = mars_task_schedule(&task2_id, NULL, 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);
+
+ MARS_TEST_ASSERT_EQUAL_INT(mars_test_counter_get(&notify), 1);
/* try_push one */
data.val = i;
- ret = mars_task_queue_try_push(host_to_mpu[i], &data);
+ ret = mars_task_queue_try_push(host_to_mpu, &data);
MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
/* check if mpu task is successfly finished */
- ret = mars_task_wait(&task_id, &exit_code);
+ 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(&task_id);
+ 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]);
+ ret = mars_task_queue_destroy(host_to_mpu);
MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
}
diff --git a/tests/TFP/TFP_4F_010/mpu.c b/tests/TFP/TFP_4F_015/mpu1.c
index 6c94c61..fb981eb 100644
--- a/tests/TFP/TFP_4F_010/mpu.c
+++ b/tests/TFP/TFP_4F_015/mpu1.c
@@ -23,23 +23,23 @@
#include <mars/task.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 notify = task_args->type.u64[1];
uint64_t val = task_args->type.u64[2];
uint32_t count;
+ mars_test_counter_add(notify, 1);
+
ret = mars_task_queue_peek(host_to_mpu_ea, &data);
MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
MARS_TEST_ASSERT_EQUAL(data.val, val);
@@ -49,12 +49,7 @@ int mars_task_main(const struct mars_task_args *task_args)
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();
+ mars_test_counter_add(notify, 1);
return 0;
}
diff --git a/tests/TFP/TFP_4F_015/mpu2.c b/tests/TFP/TFP_4F_015/mpu2.c
new file mode 100644
index 0000000..bdc8e78
--- /dev/null
+++ b/tests/TFP/TFP_4F_015/mpu2.c
@@ -0,0 +1,30 @@
+/*
+ * Copyright 2009 Sony Corporation
+ *
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a copy
+ * of this software and associated documentation files (the "Software"), to deal
+ * in the Software without restriction, including without limitation the rights
+ * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+ * copies of the Software, and to permit persons to whom the Software is
+ * furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included in
+ * all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+ * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, 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.h>
+#include <mars_task_test.h>
+
+int mars_task_main(const struct mars_task_args *task_args)
+{
+ return 0;
+}
diff --git a/tests/TFP/TFP_4F_016/host.c b/tests/TFP/TFP_4F_016/host.c
index cddf19d..694e14f 100644
--- a/tests/TFP/TFP_4F_016/host.c
+++ b/tests/TFP/TFP_4F_016/host.c
@@ -21,6 +21,9 @@
* THE SOFTWARE.
*/
+#include <sys/types.h>
+#include <linux/unistd.h>
+#include <errno.h>
#include <pthread.h>
#include <unistd.h>
#include <mars/task.h>
@@ -45,31 +48,78 @@ 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 uint64_t mpu_to_host;
-static uint32_t shared_resource __attribute((aligned(16)));
+static uint32_t notify __attribute__((aligned(16)));
static struct queue_entry data;
static pthread_t thread;
+static pid_t thread_pid;
+/*
+ * N O T E:
+ * This test uses Linux specific feature, in other word, you can not
+ * run this test program on the system other than Linux.
+ */
+
+int is_thread_blocked(pid_t tid)
+{
+ FILE *tstat;
+ char path[128];
+ char buf[1024];
+ int n;
+
+ snprintf(path, sizeof(path) - 1, "/proc/%d/status", tid);
+ tstat = fopen(path, "r");
+ MARS_TEST_ASSERT(tstat != NULL);
+
+ while ((n = fscanf(tstat, "State:\t%s\n", buf)) != EOF) {
+ if (n == 1)
+ break;
+ else
+ fgetc(tstat);
+ }
+ fclose(tstat);
+
+ switch (buf[0]) {
+ case 'R': /* running */
+ case 'D': /* disk sleep */
+ return 0;
+ break;
+ case 'S': /* sleep */
+ return 1;
+ break;
+ case 'T': /* trace stopped / stopped */
+ case 'Z': /* zonbie */
+ case 'X': /* dead */
+ default:
+ MARS_TEST_ASSERT(0);
+ return 0;
+ break;
+ };
+}
+
+pid_t linux_get_thread_id(void)
+{
+ return syscall(__NR_gettid);
+};
+
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);
+ thread_pid = linux_get_thread_id();
+ mars_test_counter_set(&notify, 1);
+
+ ret = mars_task_queue_peek(mpu_to_host, &data);
MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
- MARS_TEST_ASSERT_EQUAL(data.val1, id);
+ MARS_TEST_ASSERT_EQUAL(data.val1, thread_args.type.u32[0]);
/* check queue_count */
- ret = mars_task_queue_count(mpu_to_host[id], &count);
+ ret = mars_task_queue_count(mpu_to_host, &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;
}
@@ -82,11 +132,11 @@ int main(void)
MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
for (i = 0; i < NUM_LOOP; i++) {
- shared_resource = 0;
+ mars_test_counter_set(&notify, 0);
ret = mars_task_queue_create(
mars_ctx,
- &mpu_to_host[i],
+ &mpu_to_host,
sizeof(struct queue_entry),
depth_size[i],
MARS_TASK_QUEUE_MPU_TO_HOST);
@@ -94,19 +144,20 @@ int main(void)
/* create peek thread */
thread_args.type.u32[0] = (uint32_t)i;
- pthread_create(&thread, NULL, thread_proc, &thread_args);
+ pthread_create(&thread, NULL, thread_proc, NULL);
/* create try_push task */
ret = mars_task_create(mars_ctx, &task_id, NULL,
mpu_prog.elf_image, MARS_TASK_CONTEXT_SAVE_SIZE_MAX);
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);
+ /* wait for the thread being blocked */
+ mars_test_counter_wait(&notify, 1);
+ while (!is_thread_blocked(thread_pid))
+ ;
/* try_push one by mpu */
- task_args.type.u64[0] = mpu_to_host[i];
+ task_args.type.u64[0] = mpu_to_host;
task_args.type.u64[1] = (uint64_t)i;
ret = mars_task_schedule(&task_id, &task_args, 0);
MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
@@ -121,7 +172,7 @@ int main(void)
ret = mars_task_destroy(&task_id);
MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
- ret = mars_task_queue_destroy(mpu_to_host[i]);
+ ret = mars_task_queue_destroy(mpu_to_host);
MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
}
diff --git a/tests/TFP/TFP_4F_016/mpu.c b/tests/TFP/TFP_4F_016/mpu.c
index 3103168..ee2d5d5 100644
--- a/tests/TFP/TFP_4F_016/mpu.c
+++ b/tests/TFP/TFP_4F_016/mpu.c
@@ -23,7 +23,6 @@
#include <mars/task.h>
#include <mars_task_test.h>
-#include <spu_mfcio.h>
struct queue_entry {
uint64_t val1;
diff --git a/tests/TFP/TFP_4F_017/Makefile b/tests/TFP/TFP_4F_017/Makefile
index ecbce33..72cf999 100644
--- a/tests/TFP/TFP_4F_017/Makefile
+++ b/tests/TFP/TFP_4F_017/Makefile
@@ -22,7 +22,7 @@
#
top_srcdir = ../..
-test_objs = host.o mpu1.task_eo mpu2.task_eo
+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_4F_017/host.c b/tests/TFP/TFP_4F_017/host.c
index fb48517..f6efbfa 100644
--- a/tests/TFP/TFP_4F_017/host.c
+++ b/tests/TFP/TFP_4F_017/host.c
@@ -40,14 +40,15 @@ static uint32_t depth_size[] =
};
extern spe_program_handle_t mpu1_prog;
extern spe_program_handle_t mpu2_prog;
+extern spe_program_handle_t mpu3_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 struct mars_task_id task1_id, task2_id, task3_id;
-static uint64_t mpu_to_mpu[NUM_LOOP];
+static uint64_t mpu_to_mpu;
-static uint32_t shared_resource __attribute((aligned(16)));
+static uint32_t notify __attribute__((aligned(16)));
int main(void)
{
@@ -55,15 +56,15 @@ int main(void)
int32_t exit_code;
uint32_t count;
- ret = mars_context_create(&mars_ctx, 0, 0);
+ ret = mars_context_create(&mars_ctx, 1, 0);
MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
for (i = 0; i < NUM_LOOP; i++) {
- shared_resource = 0;
+ mars_test_counter_set(&notify, 0);
ret = mars_task_queue_create(
mars_ctx,
- &mpu_to_mpu[i],
+ &mpu_to_mpu,
sizeof(struct queue_entry),
depth_size[i],
MARS_TASK_QUEUE_MPU_TO_MPU);
@@ -74,23 +75,33 @@ int main(void)
mpu1_prog.elf_image, MARS_TASK_CONTEXT_SAVE_SIZE_MAX);
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[0] = mpu_to_mpu;
+ task1_args.type.u64[1] = mars_ptr_to_ea(&notify);
task1_args.type.u64[2] = (uint64_t)i;
ret = mars_task_schedule(&task1_id, &task1_args, 0);
MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+ /* check if queue peek is blocked in mpu task */
+ mars_test_counter_wait(&notify, 1);
+ ret = mars_task_create(mars_ctx, &task3_id, NULL,
+ mpu3_prog.elf_image,
+ MARS_TASK_CONTEXT_SAVE_SIZE_MAX);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+
+ ret = mars_task_schedule(&task3_id, NULL, 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);
+ MARS_TEST_ASSERT_EQUAL_INT(mars_test_counter_get(&notify), 1);
+
/* create push task */
ret = mars_task_create(mars_ctx, &task2_id, NULL,
mpu2_prog.elf_image, MARS_TASK_CONTEXT_SAVE_SIZE_MAX);
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[0] = mpu_to_mpu;
task2_args.type.u64[1] = (uint64_t)i;
ret = mars_task_schedule(&task2_id, &task2_args, 0);
MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
@@ -105,7 +116,7 @@ int main(void)
MARS_TEST_ASSERT_ERROR(exit_code, MARS_SUCCESS);
/* queue count should be 1 */
- ret = mars_task_queue_count(mpu_to_mpu[i], &count);
+ ret = mars_task_queue_count(mpu_to_mpu, &count);
MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
MARS_TEST_ASSERT_EQUAL(count, 1);
@@ -115,7 +126,10 @@ int main(void)
ret = mars_task_destroy(&task2_id);
MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
- ret = mars_task_queue_destroy(mpu_to_mpu[i]);
+ ret = mars_task_destroy(&task3_id);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+
+ ret = mars_task_queue_destroy(mpu_to_mpu);
MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
}
diff --git a/tests/TFP/TFP_4F_017/mpu1.c b/tests/TFP/TFP_4F_017/mpu1.c
index 2f1974b..b0699e1 100644
--- a/tests/TFP/TFP_4F_017/mpu1.c
+++ b/tests/TFP/TFP_4F_017/mpu1.c
@@ -23,32 +23,26 @@
#include <mars/task.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 notify_ea = task_args->type.u64[1];
uint64_t val = task_args->type.u64[2];
+ mars_test_counter_add(notify_ea, 1);
+
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();
-
+ mars_test_counter_add(notify_ea, 1);
return 0;
}
diff --git a/tests/TFP/TFP_4F_017/mpu3.c b/tests/TFP/TFP_4F_017/mpu3.c
new file mode 100644
index 0000000..bdc8e78
--- /dev/null
+++ b/tests/TFP/TFP_4F_017/mpu3.c
@@ -0,0 +1,30 @@
+/*
+ * Copyright 2009 Sony Corporation
+ *
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a copy
+ * of this software and associated documentation files (the "Software"), to deal
+ * in the Software without restriction, including without limitation the rights
+ * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+ * copies of the Software, and to permit persons to whom the Software is
+ * furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included in
+ * all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+ * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, 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.h>
+#include <mars_task_test.h>
+
+int mars_task_main(const struct mars_task_args *task_args)
+{
+ return 0;
+}
diff --git a/tests/TFP/TFP_4F_018/host.c b/tests/TFP/TFP_4F_018/host.c
index 8c4c828..6938224 100644
--- a/tests/TFP/TFP_4F_018/host.c
+++ b/tests/TFP/TFP_4F_018/host.c
@@ -21,6 +21,9 @@
* THE SOFTWARE.
*/
+#include <sys/types.h>
+#include <linux/unistd.h>
+#include <errno.h>
#include <pthread.h>
#include <unistd.h>
#include <mars/task.h>
@@ -45,31 +48,78 @@ 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 uint64_t mpu_to_host;
-static uint32_t shared_resource __attribute((aligned(16)));
+static uint32_t notify __attribute__((aligned(16)));
static struct queue_entry data;
static pthread_t thread;
+static pid_t thread_pid;
+/*
+ * N O T E:
+ * This test uses Linux specific feature, in other word, you can not
+ * run this test program on the system other than Linux.
+ */
+
+int is_thread_blocked(pid_t tid)
+{
+ FILE *tstat;
+ char path[128];
+ char buf[1024];
+ int n;
+
+ snprintf(path, sizeof(path) - 1, "/proc/%d/status", tid);
+ tstat = fopen(path, "r");
+ MARS_TEST_ASSERT(tstat != NULL);
+
+ while ((n = fscanf(tstat, "State:\t%s\n", buf)) != EOF) {
+ if (n == 1)
+ break;
+ else
+ fgetc(tstat);
+ }
+ fclose(tstat);
+
+ switch (buf[0]) {
+ case 'R': /* running */
+ case 'D': /* disk sleep */
+ return 0;
+ break;
+ case 'S': /* sleep */
+ return 1;
+ break;
+ case 'T': /* trace stopped / stopped */
+ case 'Z': /* zonbie */
+ case 'X': /* dead */
+ default:
+ MARS_TEST_ASSERT(0);
+ return 0;
+ break;
+ };
+}
+
+pid_t linux_get_thread_id(void)
+{
+ return syscall(__NR_gettid);
+};
+
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);
+ thread_pid = linux_get_thread_id();
+ mars_test_counter_set(&notify, 1);
+
+ ret = mars_task_queue_peek(mpu_to_host, &data);
MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
- MARS_TEST_ASSERT_EQUAL(data.val1, id);
+ MARS_TEST_ASSERT_EQUAL(data.val1, thread_args.type.u32[0]);
/* check queue_count */
- ret = mars_task_queue_count(mpu_to_host[id], &count);
+ ret = mars_task_queue_count(mpu_to_host, &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;
}
@@ -82,11 +132,11 @@ int main(void)
MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
for (i = 0; i < NUM_LOOP; i++) {
- shared_resource = 0;
+ mars_test_counter_set(&notify, 0);
ret = mars_task_queue_create(
mars_ctx,
- &mpu_to_host[i],
+ &mpu_to_host,
sizeof(struct queue_entry),
depth_size[i],
MARS_TASK_QUEUE_MPU_TO_HOST);
@@ -94,19 +144,19 @@ int main(void)
/* create peek thread */
thread_args.type.u32[0] = (uint32_t)i;
- pthread_create(&thread, NULL, thread_proc, &thread_args);
+ pthread_create(&thread, NULL, thread_proc, NULL);
+
+ /* wait for the thread being blocked */
+ mars_test_counter_wait(&notify, 1);
+ while (!is_thread_blocked(thread_pid))
+ ;
/* create push task */
ret = mars_task_create(mars_ctx, &task_id, NULL,
mpu_prog.elf_image, MARS_TASK_CONTEXT_SAVE_SIZE_MAX);
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[0] = mpu_to_host;
task_args.type.u64[1] = (uint64_t)i;
ret = mars_task_schedule(&task_id, &task_args, 0);
MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
@@ -121,7 +171,7 @@ int main(void)
ret = mars_task_destroy(&task_id);
MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
- ret = mars_task_queue_destroy(mpu_to_host[i]);
+ ret = mars_task_queue_destroy(mpu_to_host);
MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
}
diff --git a/tests/TFP/TFP_4F_018/mpu.c b/tests/TFP/TFP_4F_018/mpu.c
index ce5bf5b..5bd0db8 100644
--- a/tests/TFP/TFP_4F_018/mpu.c
+++ b/tests/TFP/TFP_4F_018/mpu.c
@@ -23,7 +23,6 @@
#include <mars/task.h>
#include <mars_task_test.h>
-#include <spu_mfcio.h>
struct queue_entry {
uint64_t val1;
diff --git a/tests/TFP/TFP_4F_019/Makefile b/tests/TFP/TFP_4F_019/Makefile
index ecbce33..72cf999 100644
--- a/tests/TFP/TFP_4F_019/Makefile
+++ b/tests/TFP/TFP_4F_019/Makefile
@@ -22,7 +22,7 @@
#
top_srcdir = ../..
-test_objs = host.o mpu1.task_eo mpu2.task_eo
+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_4F_019/host.c b/tests/TFP/TFP_4F_019/host.c
index fb48517..023fc37 100644
--- a/tests/TFP/TFP_4F_019/host.c
+++ b/tests/TFP/TFP_4F_019/host.c
@@ -40,14 +40,15 @@ static uint32_t depth_size[] =
};
extern spe_program_handle_t mpu1_prog;
extern spe_program_handle_t mpu2_prog;
+extern spe_program_handle_t mpu3_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 struct mars_task_id task1_id, task2_id, task3_id;
-static uint64_t mpu_to_mpu[NUM_LOOP];
+static uint64_t mpu_to_mpu;
-static uint32_t shared_resource __attribute((aligned(16)));
+static uint32_t notify __attribute__((aligned(16)));
int main(void)
{
@@ -55,15 +56,15 @@ int main(void)
int32_t exit_code;
uint32_t count;
- ret = mars_context_create(&mars_ctx, 0, 0);
+ ret = mars_context_create(&mars_ctx, 1, 0);
MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
for (i = 0; i < NUM_LOOP; i++) {
- shared_resource = 0;
+ mars_test_counter_set(&notify, 0);
ret = mars_task_queue_create(
mars_ctx,
- &mpu_to_mpu[i],
+ &mpu_to_mpu,
sizeof(struct queue_entry),
depth_size[i],
MARS_TASK_QUEUE_MPU_TO_MPU);
@@ -71,26 +72,40 @@ int main(void)
/* create peek task */
ret = mars_task_create(mars_ctx, &task1_id, NULL,
- mpu1_prog.elf_image, MARS_TASK_CONTEXT_SAVE_SIZE_MAX);
+ mpu1_prog.elf_image,
+ MARS_TASK_CONTEXT_SAVE_SIZE_MAX);
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[0] = mpu_to_mpu;
+ task1_args.type.u64[1] = mars_ptr_to_ea(&notify);
task1_args.type.u64[2] = (uint64_t)i;
ret = mars_task_schedule(&task1_id, &task1_args, 0);
MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+ /* check if queue peek is blocked in mpu task */
+ mars_test_counter_wait(&notify, 1);
+
+ ret = mars_task_create(mars_ctx, &task3_id, NULL,
+ mpu3_prog.elf_image,
+ MARS_TASK_CONTEXT_SAVE_SIZE_MAX);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+
+ ret = mars_task_schedule(&task3_id, NULL, 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);
+
+ MARS_TEST_ASSERT_EQUAL_INT(mars_test_counter_get(&notify), 1);
+
/* create push task */
ret = mars_task_create(mars_ctx, &task2_id, NULL,
- mpu2_prog.elf_image, MARS_TASK_CONTEXT_SAVE_SIZE_MAX);
+ mpu2_prog.elf_image,
+ MARS_TASK_CONTEXT_SAVE_SIZE_MAX);
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[0] = mpu_to_mpu;
task2_args.type.u64[1] = (uint64_t)i;
ret = mars_task_schedule(&task2_id, &task2_args, 0);
MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
@@ -105,7 +120,7 @@ int main(void)
MARS_TEST_ASSERT_ERROR(exit_code, MARS_SUCCESS);
/* queue count should be 1 */
- ret = mars_task_queue_count(mpu_to_mpu[i], &count);
+ ret = mars_task_queue_count(mpu_to_mpu, &count);
MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
MARS_TEST_ASSERT_EQUAL(count, 1);
@@ -115,7 +130,10 @@ int main(void)
ret = mars_task_destroy(&task2_id);
MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
- ret = mars_task_queue_destroy(mpu_to_mpu[i]);
+ ret = mars_task_destroy(&task3_id);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+
+ ret = mars_task_queue_destroy(mpu_to_mpu);
MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
}
diff --git a/tests/TFP/TFP_4F_019/mpu1.c b/tests/TFP/TFP_4F_019/mpu1.c
index 2f1974b..f5b9ebe 100644
--- a/tests/TFP/TFP_4F_019/mpu1.c
+++ b/tests/TFP/TFP_4F_019/mpu1.c
@@ -23,32 +23,27 @@
#include <mars/task.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 notify = task_args->type.u64[1];
uint64_t val = task_args->type.u64[2];
+ mars_test_counter_add(notify, 1);
+
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();
+ mars_test_counter_add(notify, 1);
return 0;
}
diff --git a/tests/TFP/TFP_4F_019/mpu2.c b/tests/TFP/TFP_4F_019/mpu2.c
index 76c9de8..8d3b7ab 100644
--- a/tests/TFP/TFP_4F_019/mpu2.c
+++ b/tests/TFP/TFP_4F_019/mpu2.c
@@ -23,7 +23,6 @@
#include <mars/task.h>
#include <mars_task_test.h>
-#include <spu_mfcio.h>
struct queue_entry {
uint64_t val1;
diff --git a/tests/TFP/TFP_4F_019/mpu3.c b/tests/TFP/TFP_4F_019/mpu3.c
new file mode 100644
index 0000000..5140dc8
--- /dev/null
+++ b/tests/TFP/TFP_4F_019/mpu3.c
@@ -0,0 +1,35 @@
+/*
+ * Copyright 2009 Sony Corporation
+ *
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a copy
+ * of this software and associated documentation files (the "Software"), to deal
+ * in the Software without restriction, including without limitation the rights
+ * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+ * copies of the Software, and to permit persons to whom the Software is
+ * furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included in
+ * all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+ * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, 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.h>
+#include <mars_task_test.h>
+
+struct queue_entry {
+ uint64_t val1;
+ uint64_t val2;
+};
+
+int mars_task_main(const struct mars_task_args *task_args)
+{
+ return 0;
+}
diff --git a/tests/TFP/TFP_4G_003/Makefile b/tests/TFP/TFP_4G_003/Makefile
index 432135a..ecbce33 100644
--- a/tests/TFP/TFP_4G_003/Makefile
+++ b/tests/TFP/TFP_4G_003/Makefile
@@ -22,7 +22,7 @@
#
top_srcdir = ../..
-test_objs = host.o mpu.task_eo
+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_003/host.c b/tests/TFP/TFP_4G_003/host.c
index 330b792..05f7717 100644
--- a/tests/TFP/TFP_4G_003/host.c
+++ b/tests/TFP/TFP_4G_003/host.c
@@ -28,26 +28,28 @@
#define QUEUE_DEPTH 16
-extern spe_program_handle_t mpu_prog;
+extern spe_program_handle_t mpu1_prog;
+extern spe_program_handle_t mpu2_prog;
static struct mars_context *mars;
-static struct mars_task_id task_id;
+static struct mars_task_id task1_id, task2_id;
static struct mars_task_args task_args;
static uint64_t queue;
-static uint64_t queue_item[2], mpu_answer __attribute__((aligned(16)));
+static uint64_t queue_item[2] __attribute__((aligned(16)));
+static uint32_t notify __attribute__((aligned(16)));
int main(void)
{
int exit_code, ret;
- ret = mars_context_create(&mars, 0, 0);
+ ret = mars_context_create(&mars, 1, 0);
MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
ret = mars_task_create(
mars,
- &task_id,
+ &task1_id,
"4G003",
- mpu_prog.elf_image,
+ mpu1_prog.elf_image,
MARS_TASK_CONTEXT_SAVE_SIZE_MAX);
MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
@@ -59,28 +61,45 @@ int main(void)
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);
+ task_args.type.u64[1] = mars_ptr_to_ea(&notify);
+ ret = mars_task_schedule(&task1_id, &task_args, 0);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+
+ mars_test_counter_wait(&notify, 1);
+
+ /* see if another task can be run */
+ ret = mars_task_create(
+ mars,
+ &task2_id,
+ "4G003",
+ mpu2_prog.elf_image,
+ MARS_TASK_CONTEXT_SAVE_SIZE_MAX);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+
+ ret = mars_task_schedule(&task2_id, NULL, 0);
MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
- usleep(200000);
+ ret = mars_task_wait(&task2_id, &exit_code);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+ MARS_TEST_ASSERT_EQUAL(exit_code, 0);
+
+ ret = mars_task_destroy(&task2_id);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
- mpu_answer = 1;
+ MARS_TEST_ASSERT_EQUAL_INT(mars_test_counter_get(&notify), 1);
ret = mars_task_queue_push(queue, queue_item);
MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
- ret = mars_task_wait(&task_id, &exit_code);
+ ret = mars_task_wait(&task1_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);
+ ret = mars_task_destroy(&task1_id);
MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
ret = mars_context_destroy(mars);
diff --git a/tests/TFP/TFP_4G_003/mpu.c b/tests/TFP/TFP_4G_003/mpu1.c
index edca2c7..6f191ac 100644
--- a/tests/TFP/TFP_4G_003/mpu.c
+++ b/tests/TFP/TFP_4G_003/mpu1.c
@@ -22,7 +22,6 @@
*/
#include <string.h>
-#include <spu_mfcio.h>
#include <mars/task.h>
#include "mars_task_test.h"
@@ -32,8 +31,9 @@ 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;
+ uint64_t notify = task_args->type.u64[1];
+
+ mars_test_counter_add(notify, 1);
ret = mars_task_queue_peek_begin(queue_ea, queue_item, 0);
MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
@@ -41,10 +41,7 @@ int mars_task_main(const struct mars_task_args *task_args)
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);
+ mars_test_counter_add(notify, 1);
return 0;
}
diff --git a/tests/TFP/TFP_4G_003/mpu2.c b/tests/TFP/TFP_4G_003/mpu2.c
new file mode 100644
index 0000000..6c0e351
--- /dev/null
+++ b/tests/TFP/TFP_4G_003/mpu2.c
@@ -0,0 +1,30 @@
+/*
+ * Copyright 2009 Sony Corporation
+ *
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a copy
+ * of this software and associated documentation files (the "Software"), to deal
+ * in the Software without restriction, including without limitation the rights
+ * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+ * copies of the Software, and to permit persons to whom the Software is
+ * furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included in
+ * all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+ * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, 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.h>
+#include "mars_task_test.h"
+
+int mars_task_main(const struct mars_task_args *task_args)
+{
+ return 0;
+}
diff --git a/tests/TFP/TFP_4G_004/Makefile b/tests/TFP/TFP_4G_004/Makefile
index ecbce33..72cf999 100644
--- a/tests/TFP/TFP_4G_004/Makefile
+++ b/tests/TFP/TFP_4G_004/Makefile
@@ -22,7 +22,7 @@
#
top_srcdir = ../..
-test_objs = host.o mpu1.task_eo mpu2.task_eo
+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_4G_004/host.c b/tests/TFP/TFP_4G_004/host.c
index 7fd4a70..da61233 100644
--- a/tests/TFP/TFP_4G_004/host.c
+++ b/tests/TFP/TFP_4G_004/host.c
@@ -27,23 +27,19 @@
#define QUEUE_DEPTH 16
-extern spe_program_handle_t mpu1_prog, mpu2_prog;
+extern spe_program_handle_t mpu1_prog, mpu2_prog, mpu3_prog;
static struct mars_context *mars;
-static struct mars_task_id pusher_task_id, peeker_task_id;
+static struct mars_task_id pusher_task_id, peeker_task_id, dummy_task_id;
static struct mars_task_args task_args;
static uint64_t queue;
-static uint64_t mpu_answer __attribute__((aligned(16)));
+static uint32_t notify __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);
+ ret = mars_context_create(&mars, 1, 0);
MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
ret = mars_task_create(
@@ -62,6 +58,14 @@ int main(void)
MARS_TASK_CONTEXT_SAVE_SIZE_MAX);
MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+ ret = mars_task_create(
+ mars,
+ &dummy_task_id,
+ "4G004",
+ mpu3_prog.elf_image,
+ MARS_TASK_CONTEXT_SAVE_SIZE_MAX);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+
ret = mars_task_queue_create(
mars,
&queue,
@@ -70,17 +74,28 @@ int main(void)
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);
+ task_args.type.u64[1] = mars_ptr_to_ea(&notify);
ret = mars_task_schedule(&peeker_task_id, &task_args, 0);
MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+ mars_test_counter_wait(&notify, 1);
+
+ /* see if another task can be run */
+ ret = mars_task_schedule(&dummy_task_id, NULL, 0);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+
+ ret = mars_task_wait(&dummy_task_id, &exit_code);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+ MARS_TEST_ASSERT_EQUAL(exit_code, 0);
+
+ MARS_TEST_ASSERT_EQUAL_INT(mars_test_counter_get(&notify), 1);
+
+ /* push a data to the 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);
@@ -98,6 +113,9 @@ int main(void)
ret = mars_task_destroy(&peeker_task_id);
MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+ ret = mars_task_destroy(&dummy_task_id);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+
ret = mars_context_destroy(mars);
MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
diff --git a/tests/TFP/TFP_4G_004/mpu1.c b/tests/TFP/TFP_4G_004/mpu1.c
index ed7be18..888f688 100644
--- a/tests/TFP/TFP_4G_004/mpu1.c
+++ b/tests/TFP/TFP_4G_004/mpu1.c
@@ -22,7 +22,6 @@
*/
#include <string.h>
-#include <spu_mfcio.h>
#include <mars/task.h>
#include "mars_task_test.h"
@@ -32,17 +31,9 @@ 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
index 09b0c9f..5f4a5e1 100644
--- a/tests/TFP/TFP_4G_004/mpu2.c
+++ b/tests/TFP/TFP_4G_004/mpu2.c
@@ -21,8 +21,6 @@
* THE SOFTWARE.
*/
-#include <string.h>
-#include <spu_mfcio.h>
#include <mars/task.h>
#include "mars_task_test.h"
@@ -32,20 +30,17 @@ 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 notify = task_args->type.u64[1];
- uint64_t mpu_answer;
+ mars_test_counter_add(notify, 1);
ret = mars_task_queue_peek_begin(queue_ea, queue_item, 0);
MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+ mars_test_counter_add(notify, 1);
+
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/mpu3.c b/tests/TFP/TFP_4G_004/mpu3.c
new file mode 100644
index 0000000..6c0e351
--- /dev/null
+++ b/tests/TFP/TFP_4G_004/mpu3.c
@@ -0,0 +1,30 @@
+/*
+ * Copyright 2009 Sony Corporation
+ *
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a copy
+ * of this software and associated documentation files (the "Software"), to deal
+ * in the Software without restriction, including without limitation the rights
+ * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+ * copies of the Software, and to permit persons to whom the Software is
+ * furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included in
+ * all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+ * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, 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.h>
+#include "mars_task_test.h"
+
+int mars_task_main(const struct mars_task_args *task_args)
+{
+ return 0;
+}
diff --git a/tests/TFP/TFP_4G_006/Makefile b/tests/TFP/TFP_4G_006/Makefile
index 432135a..ecbce33 100644
--- a/tests/TFP/TFP_4G_006/Makefile
+++ b/tests/TFP/TFP_4G_006/Makefile
@@ -22,7 +22,7 @@
#
top_srcdir = ../..
-test_objs = host.o mpu.task_eo
+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_006/host.c b/tests/TFP/TFP_4G_006/host.c
index 4ac9df9..5f4c8db 100644
--- a/tests/TFP/TFP_4G_006/host.c
+++ b/tests/TFP/TFP_4G_006/host.c
@@ -38,65 +38,80 @@ static uint32_t depth_size[] =
1,
Q_DEPTH
};
-extern spe_program_handle_t mpu_prog;
+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 task_args;
-static struct mars_task_id task_id;
+static struct mars_task_id task1_id, task2_id;
-static uint64_t host_to_mpu[NUM_LOOP];
+static uint64_t host_to_mpu;
static struct queue_entry data;
-static uint32_t shared_resource __attribute((aligned(16)));
+static uint32_t notify __attribute__((aligned(16)));
int main(void)
{
int ret, i;
int32_t exit_code;
- ret = mars_context_create(&mars_ctx, 0, 0);
+ ret = mars_context_create(&mars_ctx, 1, 0);
MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
for (i = 0; i < NUM_LOOP; i++) {
- shared_resource = 0;
+ mars_test_counter_set(&notify, 0);
ret = mars_task_queue_create(
mars_ctx,
- &host_to_mpu[i],
+ &host_to_mpu,
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_SIZE_MAX);
+ ret = mars_task_create(mars_ctx, &task1_id, NULL,
+ mpu1_prog.elf_image, MARS_TASK_CONTEXT_SAVE_SIZE_MAX);
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[0] = host_to_mpu;
+ task_args.type.u64[1] = mars_ptr_to_ea(&notify);
task_args.type.u64[2] = (uint64_t)i;
- ret = mars_task_schedule(&task_id, &task_args, 0);
+ ret = mars_task_schedule(&task1_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);
+ mars_test_counter_wait(&notify, 1);
+
+ ret = mars_task_create(mars_ctx, &task2_id, NULL,
+ mpu2_prog.elf_image, MARS_TASK_CONTEXT_SAVE_SIZE_MAX);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+ ret = mars_task_schedule(&task2_id, NULL, 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);
+
+ MARS_TEST_ASSERT_EQUAL(mars_test_counter_get(&notify), 1);
/* push one */
data.val = i;
- ret = mars_task_queue_push(host_to_mpu[i], &data);
+ ret = mars_task_queue_push(host_to_mpu, &data);
MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
/* check if mpu task is successfly finished */
- ret = mars_task_wait(&task_id, &exit_code);
+ 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(&task_id);
+ ret = mars_task_destroy(&task1_id);
MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
- ret = mars_task_queue_destroy(host_to_mpu[i]);
+ ret = mars_task_queue_destroy(host_to_mpu);
MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
}
diff --git a/tests/TFP/TFP_4G_006/mpu.c b/tests/TFP/TFP_4G_006/mpu1.c
index 2489b6f..23a2d22 100644
--- a/tests/TFP/TFP_4G_006/mpu.c
+++ b/tests/TFP/TFP_4G_006/mpu1.c
@@ -23,26 +23,28 @@
#include <mars/task.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 notify = task_args->type.u64[1];
uint64_t val = task_args->type.u64[2];
uint32_t count;
+ mars_test_counter_add(notify, 1);
+
ret = mars_task_queue_peek_begin(host_to_mpu_ea, &data, 1);
MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+ mars_test_counter_add(notify, 1);
+
ret = mars_task_queue_peek_end(host_to_mpu_ea, 1);
MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
@@ -53,12 +55,5 @@ int mars_task_main(const struct mars_task_args *task_args)
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_006/mpu2.c b/tests/TFP/TFP_4G_006/mpu2.c
new file mode 100644
index 0000000..bdc8e78
--- /dev/null
+++ b/tests/TFP/TFP_4G_006/mpu2.c
@@ -0,0 +1,30 @@
+/*
+ * Copyright 2009 Sony Corporation
+ *
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a copy
+ * of this software and associated documentation files (the "Software"), to deal
+ * in the Software without restriction, including without limitation the rights
+ * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+ * copies of the Software, and to permit persons to whom the Software is
+ * furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included in
+ * all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+ * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, 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.h>
+#include <mars_task_test.h>
+
+int mars_task_main(const struct mars_task_args *task_args)
+{
+ return 0;
+}
diff --git a/tests/TFP/TFP_4G_007/Makefile b/tests/TFP/TFP_4G_007/Makefile
index ecbce33..72cf999 100644
--- a/tests/TFP/TFP_4G_007/Makefile
+++ b/tests/TFP/TFP_4G_007/Makefile
@@ -22,7 +22,7 @@
#
top_srcdir = ../..
-test_objs = host.o mpu1.task_eo mpu2.task_eo
+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_4G_007/host.c b/tests/TFP/TFP_4G_007/host.c
index fb48517..6095c81 100644
--- a/tests/TFP/TFP_4G_007/host.c
+++ b/tests/TFP/TFP_4G_007/host.c
@@ -40,14 +40,15 @@ static uint32_t depth_size[] =
};
extern spe_program_handle_t mpu1_prog;
extern spe_program_handle_t mpu2_prog;
+extern spe_program_handle_t mpu3_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 struct mars_task_id task1_id, task2_id, task3_id;
-static uint64_t mpu_to_mpu[NUM_LOOP];
+static uint64_t mpu_to_mpu;
-static uint32_t shared_resource __attribute((aligned(16)));
+static uint32_t notify __attribute__((aligned(16)));
int main(void)
{
@@ -55,15 +56,15 @@ int main(void)
int32_t exit_code;
uint32_t count;
- ret = mars_context_create(&mars_ctx, 0, 0);
+ ret = mars_context_create(&mars_ctx, 1, 0);
MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
for (i = 0; i < NUM_LOOP; i++) {
- shared_resource = 0;
+ mars_test_counter_set(&notify, 0);
ret = mars_task_queue_create(
mars_ctx,
- &mpu_to_mpu[i],
+ &mpu_to_mpu,
sizeof(struct queue_entry),
depth_size[i],
MARS_TASK_QUEUE_MPU_TO_MPU);
@@ -74,8 +75,8 @@ int main(void)
mpu1_prog.elf_image, MARS_TASK_CONTEXT_SAVE_SIZE_MAX);
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[0] = mpu_to_mpu;
+ task1_args.type.u64[1] = mars_ptr_to_ea(&notify);
task1_args.type.u64[2] = (uint64_t)i;
ret = mars_task_schedule(&task1_id, &task1_args, 0);
MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
@@ -86,11 +87,21 @@ int main(void)
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);
+ mars_test_counter_wait(&notify, 1);
+ ret = mars_task_create(mars_ctx, &task3_id, NULL,
+ mpu3_prog.elf_image,
+ MARS_TASK_CONTEXT_SAVE_SIZE_MAX);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+ ret = mars_task_schedule(&task3_id, NULL, 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);
+
+ MARS_TEST_ASSERT_EQUAL_INT(mars_test_counter_get(&notify), 1);
/* push one by mpu */
- task2_args.type.u64[0] = mpu_to_mpu[i];
+ task2_args.type.u64[0] = mpu_to_mpu;
task2_args.type.u64[1] = (uint64_t)i;
ret = mars_task_schedule(&task2_id, &task2_args, 0);
MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
@@ -105,7 +116,7 @@ int main(void)
MARS_TEST_ASSERT_ERROR(exit_code, MARS_SUCCESS);
/* queue count should be 1 */
- ret = mars_task_queue_count(mpu_to_mpu[i], &count);
+ ret = mars_task_queue_count(mpu_to_mpu, &count);
MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
MARS_TEST_ASSERT_EQUAL(count, 1);
@@ -115,7 +126,10 @@ int main(void)
ret = mars_task_destroy(&task2_id);
MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
- ret = mars_task_queue_destroy(mpu_to_mpu[i]);
+ ret = mars_task_destroy(&task3_id);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+
+ ret = mars_task_queue_destroy(mpu_to_mpu);
MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
}
diff --git a/tests/TFP/TFP_4G_007/mpu1.c b/tests/TFP/TFP_4G_007/mpu1.c
index 25e18b2..9e31cf3 100644
--- a/tests/TFP/TFP_4G_007/mpu1.c
+++ b/tests/TFP/TFP_4G_007/mpu1.c
@@ -23,36 +23,30 @@
#include <mars/task.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 notify = task_args->type.u64[1];
uint64_t val = task_args->type.u64[2];
+ mars_test_counter_add(notify, 1);
+
ret = mars_task_queue_peek_begin(mpu_to_mpu_ea, &data, 1);
MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+ mars_test_counter_add(notify, 1);
+
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
index 892cea2..5bdb277 100644
--- a/tests/TFP/TFP_4G_007/mpu2.c
+++ b/tests/TFP/TFP_4G_007/mpu2.c
@@ -23,7 +23,6 @@
#include <mars/task.h>
#include <mars_task_test.h>
-#include <spu_mfcio.h>
struct queue_entry {
uint64_t val1;
diff --git a/tests/TFP/TFP_4G_007/mpu3.c b/tests/TFP/TFP_4G_007/mpu3.c
new file mode 100644
index 0000000..bdc8e78
--- /dev/null
+++ b/tests/TFP/TFP_4G_007/mpu3.c
@@ -0,0 +1,30 @@
+/*
+ * Copyright 2009 Sony Corporation
+ *
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a copy
+ * of this software and associated documentation files (the "Software"), to deal
+ * in the Software without restriction, including without limitation the rights
+ * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+ * copies of the Software, and to permit persons to whom the Software is
+ * furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included in
+ * all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+ * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, 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.h>
+#include <mars_task_test.h>
+
+int mars_task_main(const struct mars_task_args *task_args)
+{
+ return 0;
+}
diff --git a/tests/TFP/TFP_4G_008/Makefile b/tests/TFP/TFP_4G_008/Makefile
index ecbce33..72cf999 100644
--- a/tests/TFP/TFP_4G_008/Makefile
+++ b/tests/TFP/TFP_4G_008/Makefile
@@ -22,7 +22,7 @@
#
top_srcdir = ../..
-test_objs = host.o mpu1.task_eo mpu2.task_eo
+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_4G_008/host.c b/tests/TFP/TFP_4G_008/host.c
index f51f70a..6095c81 100644
--- a/tests/TFP/TFP_4G_008/host.c
+++ b/tests/TFP/TFP_4G_008/host.c
@@ -1,5 +1,5 @@
/*
- * Copyright (C) 2008 Sony Computer Entertainment Inc.
+ * Copyright 2008 Sony Corporation
*
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
@@ -40,14 +40,15 @@ static uint32_t depth_size[] =
};
extern spe_program_handle_t mpu1_prog;
extern spe_program_handle_t mpu2_prog;
+extern spe_program_handle_t mpu3_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 struct mars_task_id task1_id, task2_id, task3_id;
-static uint64_t mpu_to_mpu[NUM_LOOP];
+static uint64_t mpu_to_mpu;
-static uint32_t shared_resource __attribute((aligned(16)));
+static uint32_t notify __attribute__((aligned(16)));
int main(void)
{
@@ -55,15 +56,15 @@ int main(void)
int32_t exit_code;
uint32_t count;
- ret = mars_context_create(&mars_ctx, 0, 0);
+ ret = mars_context_create(&mars_ctx, 1, 0);
MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
for (i = 0; i < NUM_LOOP; i++) {
- shared_resource = 0;
+ mars_test_counter_set(&notify, 0);
ret = mars_task_queue_create(
mars_ctx,
- &mpu_to_mpu[i],
+ &mpu_to_mpu,
sizeof(struct queue_entry),
depth_size[i],
MARS_TASK_QUEUE_MPU_TO_MPU);
@@ -74,8 +75,8 @@ int main(void)
mpu1_prog.elf_image, MARS_TASK_CONTEXT_SAVE_SIZE_MAX);
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[0] = mpu_to_mpu;
+ task1_args.type.u64[1] = mars_ptr_to_ea(&notify);
task1_args.type.u64[2] = (uint64_t)i;
ret = mars_task_schedule(&task1_id, &task1_args, 0);
MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
@@ -86,11 +87,21 @@ int main(void)
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);
+ mars_test_counter_wait(&notify, 1);
+ ret = mars_task_create(mars_ctx, &task3_id, NULL,
+ mpu3_prog.elf_image,
+ MARS_TASK_CONTEXT_SAVE_SIZE_MAX);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+ ret = mars_task_schedule(&task3_id, NULL, 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);
+
+ MARS_TEST_ASSERT_EQUAL_INT(mars_test_counter_get(&notify), 1);
/* push one by mpu */
- task2_args.type.u64[0] = mpu_to_mpu[i];
+ task2_args.type.u64[0] = mpu_to_mpu;
task2_args.type.u64[1] = (uint64_t)i;
ret = mars_task_schedule(&task2_id, &task2_args, 0);
MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
@@ -105,7 +116,7 @@ int main(void)
MARS_TEST_ASSERT_ERROR(exit_code, MARS_SUCCESS);
/* queue count should be 1 */
- ret = mars_task_queue_count(mpu_to_mpu[i], &count);
+ ret = mars_task_queue_count(mpu_to_mpu, &count);
MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
MARS_TEST_ASSERT_EQUAL(count, 1);
@@ -115,7 +126,10 @@ int main(void)
ret = mars_task_destroy(&task2_id);
MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
- ret = mars_task_queue_destroy(mpu_to_mpu[i]);
+ ret = mars_task_destroy(&task3_id);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+
+ ret = mars_task_queue_destroy(mpu_to_mpu);
MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
}
diff --git a/tests/TFP/TFP_4G_008/mpu1.c b/tests/TFP/TFP_4G_008/mpu1.c
index 8bc78de..9e31cf3 100644
--- a/tests/TFP/TFP_4G_008/mpu1.c
+++ b/tests/TFP/TFP_4G_008/mpu1.c
@@ -1,5 +1,5 @@
/*
- * Copyright (C) 2008 Sony Computer Entertainment Inc.
+ * Copyright 2008 Sony Corporation
*
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
@@ -23,35 +23,30 @@
#include <mars/task.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 notify = task_args->type.u64[1];
uint64_t val = task_args->type.u64[2];
+ mars_test_counter_add(notify, 1);
+
ret = mars_task_queue_peek_begin(mpu_to_mpu_ea, &data, 1);
MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+ mars_test_counter_add(notify, 1);
+
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
index 572bfde..1adcbb5 100644
--- a/tests/TFP/TFP_4G_008/mpu2.c
+++ b/tests/TFP/TFP_4G_008/mpu2.c
@@ -1,5 +1,5 @@
/*
- * Copyright (C) 2008 Sony Computer Entertainment Inc.
+ * Copyright 2008 Sony Corporation
*
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
@@ -23,7 +23,6 @@
#include <mars/task.h>
#include <mars_task_test.h>
-#include <spu_mfcio.h>
struct queue_entry {
uint64_t val1;
@@ -38,10 +37,10 @@ int mars_task_main(const struct mars_task_args *task_args)
uint64_t val = task_args->type.u64[1];
data.val1 = val;
- ret = mars_task_queue_push_begin(mpu_to_mpu_ea, &data, 0);
+ 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, 0);
+ 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_008/mpu3.c b/tests/TFP/TFP_4G_008/mpu3.c
new file mode 100644
index 0000000..bdc8e78
--- /dev/null
+++ b/tests/TFP/TFP_4G_008/mpu3.c
@@ -0,0 +1,30 @@
+/*
+ * Copyright 2009 Sony Corporation
+ *
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a copy
+ * of this software and associated documentation files (the "Software"), to deal
+ * in the Software without restriction, including without limitation the rights
+ * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+ * copies of the Software, and to permit persons to whom the Software is
+ * furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included in
+ * all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+ * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, 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.h>
+#include <mars_task_test.h>
+
+int mars_task_main(const struct mars_task_args *task_args)
+{
+ return 0;
+}
diff --git a/tests/TFP/TFP_4G_009/Makefile b/tests/TFP/TFP_4G_009/Makefile
index 432135a..ecbce33 100644
--- a/tests/TFP/TFP_4G_009/Makefile
+++ b/tests/TFP/TFP_4G_009/Makefile
@@ -22,7 +22,7 @@
#
top_srcdir = ../..
-test_objs = host.o mpu.task_eo
+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_009/host.c b/tests/TFP/TFP_4G_009/host.c
index c2d752c..d4560ff 100644
--- a/tests/TFP/TFP_4G_009/host.c
+++ b/tests/TFP/TFP_4G_009/host.c
@@ -38,65 +38,82 @@ static uint32_t depth_size[] =
1,
Q_DEPTH
};
-extern spe_program_handle_t mpu_prog;
+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 task_args;
-static struct mars_task_id task_id;
+static struct mars_task_id task1_id, task2_id;
-static uint64_t host_to_mpu[NUM_LOOP];
+static uint64_t host_to_mpu;
static struct queue_entry data;
-static uint32_t shared_resource __attribute((aligned(16)));
+static uint32_t notify __attribute__((aligned(16)));
int main(void)
{
int ret, i;
int32_t exit_code;
- ret = mars_context_create(&mars_ctx, 0, 0);
+ ret = mars_context_create(&mars_ctx, 1, 0);
MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
for (i = 0; i < NUM_LOOP; i++) {
- shared_resource = 0;
+ mars_test_counter_set(&notify, 0);
ret = mars_task_queue_create(
mars_ctx,
- &host_to_mpu[i],
+ &host_to_mpu,
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_SIZE_MAX);
+ ret = mars_task_create(mars_ctx, &task1_id, NULL,
+ mpu1_prog.elf_image, MARS_TASK_CONTEXT_SAVE_SIZE_MAX);
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[0] = host_to_mpu;
+ task_args.type.u64[1] = mars_ptr_to_ea(&notify);
task_args.type.u64[2] = (uint64_t)i;
- ret = mars_task_schedule(&task_id, &task_args, 0);
+ ret = mars_task_schedule(&task1_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);
+ mars_test_counter_wait(&notify, 1);
+
+ ret = mars_task_create(mars_ctx, &task2_id, NULL,
+ mpu2_prog.elf_image,
+ MARS_TASK_CONTEXT_SAVE_SIZE_MAX);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+
+ ret = mars_task_schedule(&task2_id, NULL, 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);
+
+ MARS_TEST_ASSERT_EQUAL_INT(mars_test_counter_get(&notify), 1);
/* try_push one */
data.val = i;
- ret = mars_task_queue_try_push(host_to_mpu[i], &data);
+ ret = mars_task_queue_try_push(host_to_mpu, &data);
MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
/* check if mpu task is successfly finished */
- ret = mars_task_wait(&task_id, &exit_code);
+ 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(&task_id);
+ 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]);
+ ret = mars_task_queue_destroy(host_to_mpu);
MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
}
diff --git a/tests/TFP/TFP_4G_009/mpu.c b/tests/TFP/TFP_4G_009/mpu1.c
index 2489b6f..ed7d936 100644
--- a/tests/TFP/TFP_4G_009/mpu.c
+++ b/tests/TFP/TFP_4G_009/mpu1.c
@@ -23,26 +23,28 @@
#include <mars/task.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 notify = task_args->type.u64[1];
uint64_t val = task_args->type.u64[2];
uint32_t count;
+ mars_test_counter_add(notify, 1);
ret = mars_task_queue_peek_begin(host_to_mpu_ea, &data, 1);
MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+ mars_test_counter_add(notify, 1);
+
ret = mars_task_queue_peek_end(host_to_mpu_ea, 1);
MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
@@ -53,12 +55,5 @@ int mars_task_main(const struct mars_task_args *task_args)
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_009/mpu2.c b/tests/TFP/TFP_4G_009/mpu2.c
new file mode 100644
index 0000000..bdc8e78
--- /dev/null
+++ b/tests/TFP/TFP_4G_009/mpu2.c
@@ -0,0 +1,30 @@
+/*
+ * Copyright 2009 Sony Corporation
+ *
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a copy
+ * of this software and associated documentation files (the "Software"), to deal
+ * in the Software without restriction, including without limitation the rights
+ * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+ * copies of the Software, and to permit persons to whom the Software is
+ * furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included in
+ * all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+ * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, 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.h>
+#include <mars_task_test.h>
+
+int mars_task_main(const struct mars_task_args *task_args)
+{
+ return 0;
+}
diff --git a/tests/TFP/TFP_4G_010/Makefile b/tests/TFP/TFP_4G_010/Makefile
index ecbce33..72cf999 100644
--- a/tests/TFP/TFP_4G_010/Makefile
+++ b/tests/TFP/TFP_4G_010/Makefile
@@ -22,7 +22,7 @@
#
top_srcdir = ../..
-test_objs = host.o mpu1.task_eo mpu2.task_eo
+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_4G_010/host.c b/tests/TFP/TFP_4G_010/host.c
index fb48517..8530bac 100644
--- a/tests/TFP/TFP_4G_010/host.c
+++ b/tests/TFP/TFP_4G_010/host.c
@@ -40,14 +40,15 @@ static uint32_t depth_size[] =
};
extern spe_program_handle_t mpu1_prog;
extern spe_program_handle_t mpu2_prog;
+extern spe_program_handle_t mpu3_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 struct mars_task_id task1_id, task2_id, task3_id;
-static uint64_t mpu_to_mpu[NUM_LOOP];
+static uint64_t mpu_to_mpu;
-static uint32_t shared_resource __attribute((aligned(16)));
+static uint32_t notify __attribute__((aligned(16)));
int main(void)
{
@@ -55,15 +56,15 @@ int main(void)
int32_t exit_code;
uint32_t count;
- ret = mars_context_create(&mars_ctx, 0, 0);
+ ret = mars_context_create(&mars_ctx, 1, 0);
MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
for (i = 0; i < NUM_LOOP; i++) {
- shared_resource = 0;
+ mars_test_counter_set(&notify, 0);
ret = mars_task_queue_create(
mars_ctx,
- &mpu_to_mpu[i],
+ &mpu_to_mpu,
sizeof(struct queue_entry),
depth_size[i],
MARS_TASK_QUEUE_MPU_TO_MPU);
@@ -74,8 +75,8 @@ int main(void)
mpu1_prog.elf_image, MARS_TASK_CONTEXT_SAVE_SIZE_MAX);
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[0] = mpu_to_mpu;
+ task1_args.type.u64[1] = mars_ptr_to_ea(&notify);
task1_args.type.u64[2] = (uint64_t)i;
ret = mars_task_schedule(&task1_id, &task1_args, 0);
MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
@@ -85,12 +86,23 @@ int main(void)
mpu2_prog.elf_image, MARS_TASK_CONTEXT_SAVE_SIZE_MAX);
MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+ ret = mars_task_create(mars_ctx, &task3_id, NULL,
+ mpu3_prog.elf_image,
+ MARS_TASK_CONTEXT_SAVE_SIZE_MAX);
+ 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);
+ mars_test_counter_wait(&notify, 1);
+ ret = mars_task_schedule(&task3_id, NULL, 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);
+
+ MARS_TEST_ASSERT_EQUAL_INT(mars_test_counter_get(&notify), 1);
/* push one by mpu */
- task2_args.type.u64[0] = mpu_to_mpu[i];
+ task2_args.type.u64[0] = mpu_to_mpu;
task2_args.type.u64[1] = (uint64_t)i;
ret = mars_task_schedule(&task2_id, &task2_args, 0);
MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
@@ -105,7 +117,7 @@ int main(void)
MARS_TEST_ASSERT_ERROR(exit_code, MARS_SUCCESS);
/* queue count should be 1 */
- ret = mars_task_queue_count(mpu_to_mpu[i], &count);
+ ret = mars_task_queue_count(mpu_to_mpu, &count);
MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
MARS_TEST_ASSERT_EQUAL(count, 1);
@@ -115,7 +127,10 @@ int main(void)
ret = mars_task_destroy(&task2_id);
MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
- ret = mars_task_queue_destroy(mpu_to_mpu[i]);
+ ret = mars_task_destroy(&task3_id);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+
+ ret = mars_task_queue_destroy(mpu_to_mpu);
MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
}
diff --git a/tests/TFP/TFP_4G_010/mpu1.c b/tests/TFP/TFP_4G_010/mpu1.c
index 25e18b2..ee34339 100644
--- a/tests/TFP/TFP_4G_010/mpu1.c
+++ b/tests/TFP/TFP_4G_010/mpu1.c
@@ -23,36 +23,28 @@
#include <mars/task.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 notify = task_args->type.u64[1];
uint64_t val = task_args->type.u64[2];
+ mars_test_counter_add(notify, 1);
ret = mars_task_queue_peek_begin(mpu_to_mpu_ea, &data, 1);
MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+ mars_test_counter_add(notify, 1);
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
index 5f86497..8c0f6a7 100644
--- a/tests/TFP/TFP_4G_010/mpu2.c
+++ b/tests/TFP/TFP_4G_010/mpu2.c
@@ -23,7 +23,6 @@
#include <mars/task.h>
#include <mars_task_test.h>
-#include <spu_mfcio.h>
struct queue_entry {
uint64_t val1;
diff --git a/tests/TFP/TFP_4G_010/mpu3.c b/tests/TFP/TFP_4G_010/mpu3.c
new file mode 100644
index 0000000..bdc8e78
--- /dev/null
+++ b/tests/TFP/TFP_4G_010/mpu3.c
@@ -0,0 +1,30 @@
+/*
+ * Copyright 2009 Sony Corporation
+ *
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a copy
+ * of this software and associated documentation files (the "Software"), to deal
+ * in the Software without restriction, including without limitation the rights
+ * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+ * copies of the Software, and to permit persons to whom the Software is
+ * furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included in
+ * all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+ * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, 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.h>
+#include <mars_task_test.h>
+
+int mars_task_main(const struct mars_task_args *task_args)
+{
+ return 0;
+}
diff --git a/tests/TFP/TFP_4G_011/Makefile b/tests/TFP/TFP_4G_011/Makefile
index ecbce33..72cf999 100644
--- a/tests/TFP/TFP_4G_011/Makefile
+++ b/tests/TFP/TFP_4G_011/Makefile
@@ -22,7 +22,7 @@
#
top_srcdir = ../..
-test_objs = host.o mpu1.task_eo mpu2.task_eo
+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_4G_011/host.c b/tests/TFP/TFP_4G_011/host.c
index f51f70a..bb087a2 100644
--- a/tests/TFP/TFP_4G_011/host.c
+++ b/tests/TFP/TFP_4G_011/host.c
@@ -40,14 +40,15 @@ static uint32_t depth_size[] =
};
extern spe_program_handle_t mpu1_prog;
extern spe_program_handle_t mpu2_prog;
+extern spe_program_handle_t mpu3_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 struct mars_task_id task1_id, task2_id, task3_id;
-static uint64_t mpu_to_mpu[NUM_LOOP];
+static uint64_t mpu_to_mpu;
-static uint32_t shared_resource __attribute((aligned(16)));
+static uint32_t notify __attribute__((aligned(16)));
int main(void)
{
@@ -55,15 +56,15 @@ int main(void)
int32_t exit_code;
uint32_t count;
- ret = mars_context_create(&mars_ctx, 0, 0);
+ ret = mars_context_create(&mars_ctx, 1, 0);
MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
for (i = 0; i < NUM_LOOP; i++) {
- shared_resource = 0;
+ mars_test_counter_set(&notify, 0);
ret = mars_task_queue_create(
mars_ctx,
- &mpu_to_mpu[i],
+ &mpu_to_mpu,
sizeof(struct queue_entry),
depth_size[i],
MARS_TASK_QUEUE_MPU_TO_MPU);
@@ -74,8 +75,8 @@ int main(void)
mpu1_prog.elf_image, MARS_TASK_CONTEXT_SAVE_SIZE_MAX);
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[0] = mpu_to_mpu;
+ task1_args.type.u64[1] = mars_ptr_to_ea(&notify);
task1_args.type.u64[2] = (uint64_t)i;
ret = mars_task_schedule(&task1_id, &task1_args, 0);
MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
@@ -85,12 +86,23 @@ int main(void)
mpu2_prog.elf_image, MARS_TASK_CONTEXT_SAVE_SIZE_MAX);
MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+ ret = mars_task_create(mars_ctx, &task3_id, NULL,
+ mpu3_prog.elf_image,
+ MARS_TASK_CONTEXT_SAVE_SIZE_MAX);
+ 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);
+ mars_test_counter_wait(&notify, 1);
+ ret = mars_task_schedule(&task3_id, NULL, 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);
+
+ MARS_TEST_ASSERT_EQUAL_INT(mars_test_counter_get(&notify), 1);
/* push one by mpu */
- task2_args.type.u64[0] = mpu_to_mpu[i];
+ task2_args.type.u64[0] = mpu_to_mpu;
task2_args.type.u64[1] = (uint64_t)i;
ret = mars_task_schedule(&task2_id, &task2_args, 0);
MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
@@ -105,7 +117,7 @@ int main(void)
MARS_TEST_ASSERT_ERROR(exit_code, MARS_SUCCESS);
/* queue count should be 1 */
- ret = mars_task_queue_count(mpu_to_mpu[i], &count);
+ ret = mars_task_queue_count(mpu_to_mpu, &count);
MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
MARS_TEST_ASSERT_EQUAL(count, 1);
@@ -115,7 +127,10 @@ int main(void)
ret = mars_task_destroy(&task2_id);
MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
- ret = mars_task_queue_destroy(mpu_to_mpu[i]);
+ ret = mars_task_destroy(&task3_id);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+
+ ret = mars_task_queue_destroy(mpu_to_mpu);
MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
}
diff --git a/tests/TFP/TFP_4G_011/mpu1.c b/tests/TFP/TFP_4G_011/mpu1.c
index 8bc78de..e7cb617 100644
--- a/tests/TFP/TFP_4G_011/mpu1.c
+++ b/tests/TFP/TFP_4G_011/mpu1.c
@@ -23,35 +23,29 @@
#include <mars/task.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 notify = task_args->type.u64[1];
uint64_t val = task_args->type.u64[2];
+ mars_test_counter_add(notify, 1);
ret = mars_task_queue_peek_begin(mpu_to_mpu_ea, &data, 1);
MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+ mars_test_counter_add(notify, 1);
+
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
index 1966ebe..27c3532 100644
--- a/tests/TFP/TFP_4G_011/mpu2.c
+++ b/tests/TFP/TFP_4G_011/mpu2.c
@@ -23,7 +23,6 @@
#include <mars/task.h>
#include <mars_task_test.h>
-#include <spu_mfcio.h>
struct queue_entry {
uint64_t val1;
diff --git a/tests/TFP/TFP_4G_011/mpu3.c b/tests/TFP/TFP_4G_011/mpu3.c
new file mode 100644
index 0000000..30210f1
--- /dev/null
+++ b/tests/TFP/TFP_4G_011/mpu3.c
@@ -0,0 +1,30 @@
+/*
+ * Copyright (C) 2009 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/task.h>
+#include <mars_task_test.h>
+
+int mars_task_main(const struct mars_task_args *task_args)
+{
+ return 0;
+}
diff --git a/tests/TFP/TFP_4H_001/host.c b/tests/TFP/TFP_4H_001/host.c
index cb0aed4..7f1a05f 100644
--- a/tests/TFP/TFP_4H_001/host.c
+++ b/tests/TFP/TFP_4H_001/host.c
@@ -48,24 +48,29 @@ 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 uint64_t mpu_to_mpu;
+static uint32_t notify __attribute__((aligned(128)));
+static uint32_t counter __attribute__((aligned(128)));
int main(void)
{
int ret, i;
int32_t exit_code;
uint32_t num, count;
+ int num_mpu;
+
+ num_mpu = 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++) {
- notify[0] = 0;
+ mars_test_counter_set(&notify, 0);
+ mars_test_counter_set(&counter, 0);
ret = mars_task_queue_create(
mars_ctx,
- &mpu_to_mpu[i],
+ &mpu_to_mpu,
sizeof(struct queue_entry),
depth_size[i],
MARS_TASK_QUEUE_MPU_TO_MPU);
@@ -76,7 +81,7 @@ int main(void)
mpu2_prog.elf_image, MARS_TASK_CONTEXT_SAVE_SIZE_MAX);
MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
- task2_args.type.u64[0] = mpu_to_mpu[i];
+ task2_args.type.u64[0] = mpu_to_mpu;
task2_args.type.u64[1] = (uint64_t)i;
ret = mars_task_schedule(&task2_id, &task2_args, 0);
MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
@@ -92,19 +97,21 @@ int main(void)
mpu1_prog.elf_image, MARS_TASK_CONTEXT_SAVE_SIZE_MAX);
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[0] = mpu_to_mpu;
+ task1_args.type.u64[1] = mars_ptr_to_ea(&notify);
task1_args.type.u64[2] = (uint64_t)i;
+ task1_args.type.u64[3] = mars_ptr_to_ea(&counter);
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);
+ if (num_mpu < depth_size[i])
+ mars_test_counter_wait(&counter, num_mpu);
+ else
+ mars_test_counter_wait(&counter, depth_size[i]);
+ mars_test_counter_set(&notify, 1);
for (num = 0; num < depth_size[i]; num++) {
ret = mars_task_wait(&task1_id[num], &exit_code);
@@ -118,11 +125,11 @@ int main(void)
ret = mars_task_destroy(&task2_id);
MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
- ret = mars_task_queue_count(mpu_to_mpu[i], &count);
+ ret = mars_task_queue_count(mpu_to_mpu, &count);
MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
MARS_TEST_ASSERT_EQUAL(count, 1);
- ret = mars_task_queue_destroy(mpu_to_mpu[i]);
+ ret = mars_task_queue_destroy(mpu_to_mpu);
MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
}
diff --git a/tests/TFP/TFP_4H_001/mpu1.c b/tests/TFP/TFP_4H_001/mpu1.c
index c5753ed..3225808 100644
--- a/tests/TFP/TFP_4H_001/mpu1.c
+++ b/tests/TFP/TFP_4H_001/mpu1.c
@@ -23,7 +23,6 @@
#include <mars/task.h>
#include <mars_task_test.h>
-#include <spu_mfcio.h>
struct queue_entry {
uint64_t val1;
@@ -37,7 +36,9 @@ int mars_task_main(const struct mars_task_args *task_args)
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];
+ uint32_t counter_ea = task_args->type.u64[3];
+ mars_test_counter_add(counter_ea, 1);
mars_test_counter_wait(notify_ea, 1);
ret = mars_task_queue_peek_begin(mpu_to_mpu_ea, &data, 1);
diff --git a/tests/TFP/TFP_4I_007/host.c b/tests/TFP/TFP_4I_007/host.c
index 9661ac0..1addc80 100644
--- a/tests/TFP/TFP_4I_007/host.c
+++ b/tests/TFP/TFP_4I_007/host.c
@@ -47,28 +47,40 @@ 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;
+static uint64_t host_to_mpu;
+static struct queue_entry data __attribute__((aligned(16)));
+static uint32_t counter __attribute__((aligned(128)));
+static uint32_t notify __attribute__((aligned(128)));
int main(void)
{
int ret, i;
int32_t exit_code;
uint32_t num, count;
+ int num_mpu;
+
+ num_mpu = 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++) {
+ mars_test_counter_set(&counter, 0);
+ mars_test_counter_set(&notify, 0);
ret = mars_task_queue_create(
mars_ctx,
- &host_to_mpu[i],
+ &host_to_mpu,
sizeof(struct queue_entry),
depth_size[i],
MARS_TASK_QUEUE_HOST_TO_MPU);
MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+ task_args.type.u64[0] = host_to_mpu;
+ task_args.type.u64[1] = (uint64_t)i;
+ task_args.type.u64[2] = mars_ptr_to_ea(&counter);
+ task_args.type.u64[3] = mars_ptr_to_ea(&notify);
+
for (num = 0; num < depth_size[i]; num++) {
/* create peek tasks */
/* all tasks will peek the same data */
@@ -76,18 +88,20 @@ int main(void)
mpu_prog.elf_image, MARS_TASK_CONTEXT_SAVE_SIZE_MAX);
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);
+ if (num_mpu < depth_size[i])
+ mars_test_counter_wait(&counter, num_mpu);
+ else
+ mars_test_counter_wait(&counter, depth_size[i]);
+ mars_test_counter_set(&notify, 1);
/* push one data to the queue */
data.val1 = i;
- ret = mars_task_queue_push(host_to_mpu[i], &data);
+ ret = mars_task_queue_push(host_to_mpu, &data);
MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
for (num = 0; num < depth_size[i]; num++) {
@@ -99,11 +113,11 @@ int main(void)
MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
}
- ret = mars_task_queue_count(host_to_mpu[i], &count);
+ ret = mars_task_queue_count(host_to_mpu, &count);
MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
MARS_TEST_ASSERT_EQUAL(count, 1);
- ret = mars_task_queue_destroy(host_to_mpu[i]);
+ ret = mars_task_queue_destroy(host_to_mpu);
MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
}
diff --git a/tests/TFP/TFP_4I_007/mpu.c b/tests/TFP/TFP_4I_007/mpu.c
index a58aca7..1c7555b 100644
--- a/tests/TFP/TFP_4I_007/mpu.c
+++ b/tests/TFP/TFP_4I_007/mpu.c
@@ -32,18 +32,30 @@ static struct queue_entry data;
int mars_task_main(const struct mars_task_args *task_args)
{
- int ret;
+ int ret, cont;
uint64_t host_to_mpu_ea = task_args->type.u64[0];
uint32_t id = (uint32_t)task_args->type.u64[1];
+ uint64_t counter = task_args->type.u64[2];
+ uint64_t notify = task_args->type.u64[3];
- while (1) {
+ mars_test_counter_add(counter, 1);
+ mars_test_counter_wait(notify, 1);
+
+ cont = 32767;
+ while (cont) {
ret = mars_task_queue_try_peek(host_to_mpu_ea, &data);
- if (ret == MARS_SUCCESS)
+
+ switch (ret) {
+ case MARS_SUCCESS:
+ cont --;
break;
- else if (ret == MARS_ERROR_BUSY)
- continue;
- else
+ case MARS_ERROR_BUSY:
+ /* empty */
+ break;
+ default:
MARS_TEST_ASSERT_ERROR(ret, 0);
+ break;
+ }
}
/* check the peeked data */
diff --git a/tests/TFP/TFP_4I_008/host.c b/tests/TFP/TFP_4I_008/host.c
index 24a354c..1221104 100644
--- a/tests/TFP/TFP_4I_008/host.c
+++ b/tests/TFP/TFP_4I_008/host.c
@@ -48,26 +48,34 @@ 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 uint64_t mpu_to_host;
static struct queue_entry data[Q_DEPTH];
static pthread_t thread[Q_DEPTH];
+static pthread_barrier_t barrier;
+
static void *thread_proc(void *ptr)
{
- int ret;
+ int ret, cont;
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];
+ uint32_t id = task_args->type.u32[0];
+ uint32_t num = task_args->type.u32[1];
+
+ pthread_barrier_wait(&barrier);
- while (1) {
- ret = mars_task_queue_try_peek(mpu_to_host[id], &data[num]);
- if (ret == MARS_SUCCESS)
+ cont = 1024;
+ while (cont) {
+ ret = mars_task_queue_try_peek(mpu_to_host, &data[num]);
+ switch (ret) {
+ case MARS_SUCCESS:
+ cont --;
+ break;
+ case MARS_ERROR_BUSY:
break;
- else if (ret == MARS_ERROR_BUSY)
- continue;
- else
+ default:
MARS_TEST_ASSERT_ERROR(ret, 0);
+ }
}
/* check the peeked data */
@@ -89,30 +97,31 @@ int main(void)
ret = mars_task_queue_create(
mars_ctx,
- &mpu_to_host[i],
+ &mpu_to_host,
sizeof(struct queue_entry),
depth_size[i],
MARS_TASK_QUEUE_MPU_TO_HOST);
MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+ ret = pthread_barrier_init(&barrier, NULL, depth_size[i]);
+ MARS_TEST_ASSERT_EQUAL_INT(ret, 0);
+
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;
+ thread_args[num].type.u32[1] = 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_SIZE_MAX);
MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
- task_args.type.u64[0] = mpu_to_host[i];
+ task_args.type.u64[0] = mpu_to_host;
task_args.type.u64[1] = (uint64_t)i;
ret = mars_task_schedule(&task_id, &task_args, 0);
MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
@@ -124,14 +133,17 @@ int main(void)
for (num = 0; num < depth_size[i]; num++)
pthread_join(thread[num], NULL);
+ ret = pthread_barrier_destroy(&barrier);
+ MARS_TEST_ASSERT_EQUAL_INT(ret, 0);
+
ret = mars_task_destroy(&task_id);
MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
- ret = mars_task_queue_count(mpu_to_host[i], &count);
+ ret = mars_task_queue_count(mpu_to_host, &count);
MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
MARS_TEST_ASSERT_EQUAL(count, 1);
- ret = mars_task_queue_destroy(mpu_to_host[i]);
+ ret = mars_task_queue_destroy(mpu_to_host);
MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
}
diff --git a/tests/TFP/TFP_4I_009/host.c b/tests/TFP/TFP_4I_009/host.c
index c6c01fb..d579133 100644
--- a/tests/TFP/TFP_4I_009/host.c
+++ b/tests/TFP/TFP_4I_009/host.c
@@ -46,10 +46,11 @@ 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_args task_args;
static struct mars_task_id task1_id[TASK_MAX], task2_id;
-static uint64_t mpu_to_mpu[NUM_LOOP];
+static uint64_t mpu_to_mpu;
+static uint32_t counter __attribute__((aligned(128)));
int main(void)
{
@@ -62,30 +63,35 @@ int main(void)
MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
for (i = 0; i < NUM_LOOP; i++) {
+ mars_test_counter_set(&counter, 0);
+
task_num = tasks[i] > spe_cnt - 1 ? spe_cnt - 1 : tasks[i];
ret = mars_task_queue_create(
mars_ctx,
- &mpu_to_mpu[i],
+ &mpu_to_mpu,
sizeof(struct queue_entry),
Q_DEPTH,
MARS_TASK_QUEUE_MPU_TO_MPU);
MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+ task_args.type.u64[0] = mpu_to_mpu;
+ task_args.type.u64[1] = (uint64_t)i;
+ task_args.type.u64[2] = mars_ptr_to_ea(&counter);
+
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_SIZE_MAX);
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);
+ &task_args, 0);
MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
}
- sleep(1);
+ mars_test_counter_wait(&counter, task_num);
+
/* check if all tasks are still running */
for (num = 0; num < task_num; num++) {
ret = mars_task_try_wait(&task1_id[num], &exit_code);
@@ -97,9 +103,7 @@ int main(void)
mpu2_prog.elf_image, MARS_TASK_CONTEXT_SAVE_SIZE_MAX);
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);
+ ret = mars_task_schedule(&task2_id, &task_args, 0);
MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
for (num = 0; num < task_num; num++) {
@@ -118,11 +122,11 @@ int main(void)
ret = mars_task_destroy(&task2_id);
MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
- ret = mars_task_queue_count(mpu_to_mpu[i], &count);
+ ret = mars_task_queue_count(mpu_to_mpu, &count);
MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
MARS_TEST_ASSERT_EQUAL(count, 1);
- ret = mars_task_queue_destroy(mpu_to_mpu[i]);
+ ret = mars_task_queue_destroy(mpu_to_mpu);
MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
}
diff --git a/tests/TFP/TFP_4I_009/mpu1.c b/tests/TFP/TFP_4I_009/mpu1.c
index 0ec4e84..319f25e 100644
--- a/tests/TFP/TFP_4I_009/mpu1.c
+++ b/tests/TFP/TFP_4I_009/mpu1.c
@@ -33,18 +33,26 @@ static struct queue_entry data;
int mars_task_main(const struct mars_task_args *task_args)
{
- int ret;
+ int ret, cont;
uint64_t mpu_to_mpu_ea = task_args->type.u64[0];
uint32_t id = (uint32_t)task_args->type.u64[1];
+ uint64_t counter = task_args->type.u64[2];
- while (1) {
+ mars_test_counter_add(counter, 1);
+
+ cont = 32767;
+ while (cont) {
ret = mars_task_queue_try_peek(mpu_to_mpu_ea, &data);
- if (ret == MARS_SUCCESS)
+
+ switch (ret) {
+ case MARS_SUCCESS:
+ cont --;
+ break;
+ case MARS_ERROR_BUSY:
break;
- else if (ret == MARS_ERROR_BUSY)
- continue;
- else
+ default:
MARS_TEST_ASSERT_ERROR(ret, 0);
+ }
}
/* check the peeked data */
diff --git a/tests/TFP/TFP_4J_007/host.c b/tests/TFP/TFP_4J_007/host.c
index c6c01fb..6db10cb 100644
--- a/tests/TFP/TFP_4J_007/host.c
+++ b/tests/TFP/TFP_4J_007/host.c
@@ -49,7 +49,8 @@ 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];
+static uint64_t mpu_to_mpu;
+static uint32_t counter __attribute__((aligned(16)));
int main(void)
{
@@ -62,11 +63,13 @@ int main(void)
MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
for (i = 0; i < NUM_LOOP; i++) {
+ mars_test_counter_set(&counter, 0);
+
task_num = tasks[i] > spe_cnt - 1 ? spe_cnt - 1 : tasks[i];
ret = mars_task_queue_create(
mars_ctx,
- &mpu_to_mpu[i],
+ &mpu_to_mpu,
sizeof(struct queue_entry),
Q_DEPTH,
MARS_TASK_QUEUE_MPU_TO_MPU);
@@ -78,14 +81,16 @@ int main(void)
mpu1_prog.elf_image, MARS_TASK_CONTEXT_SAVE_SIZE_MAX);
MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
- task1_args.type.u64[0] = mpu_to_mpu[i];
+ task1_args.type.u64[0] = mpu_to_mpu;
task1_args.type.u64[1] = (uint64_t)i;
+ task1_args.type.u64[2] = mars_ptr_to_ea(&counter);
ret = mars_task_schedule(&task1_id[num],
&task1_args, 0);
MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
}
- sleep(1);
+ mars_test_counter_wait(&counter, task_num);
+
/* check if all tasks are still running */
for (num = 0; num < task_num; num++) {
ret = mars_task_try_wait(&task1_id[num], &exit_code);
@@ -97,7 +102,7 @@ int main(void)
mpu2_prog.elf_image, MARS_TASK_CONTEXT_SAVE_SIZE_MAX);
MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
- task2_args.type.u64[0] = mpu_to_mpu[i];
+ task2_args.type.u64[0] = mpu_to_mpu;
task2_args.type.u64[1] = (uint64_t)i;
ret = mars_task_schedule(&task2_id, &task2_args, 0);
MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
@@ -118,11 +123,11 @@ int main(void)
ret = mars_task_destroy(&task2_id);
MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
- ret = mars_task_queue_count(mpu_to_mpu[i], &count);
+ ret = mars_task_queue_count(mpu_to_mpu, &count);
MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
MARS_TEST_ASSERT_EQUAL(count, 1);
- ret = mars_task_queue_destroy(mpu_to_mpu[i]);
+ ret = mars_task_queue_destroy(mpu_to_mpu);
MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
}
diff --git a/tests/TFP/TFP_4J_007/mpu1.c b/tests/TFP/TFP_4J_007/mpu1.c
index 7b3de96..36f1ae9 100644
--- a/tests/TFP/TFP_4J_007/mpu1.c
+++ b/tests/TFP/TFP_4J_007/mpu1.c
@@ -23,7 +23,6 @@
#include <mars/task.h>
#include <mars_task_test.h>
-#include <spu_mfcio.h>
struct queue_entry {
uint64_t val1;
@@ -33,21 +32,32 @@ static struct queue_entry data;
int mars_task_main(const struct mars_task_args *task_args)
{
- int ret;
+ int ret, cont, begin;
uint64_t mpu_to_mpu_ea = task_args->type.u64[0];
+ uint64_t counter = task_args->type.u64[2];
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);
+ mars_test_counter_add(counter, 1);
+
+ cont = 32767;
+ while (cont) {
+ begin = 0;
+ while (!begin) {
+ ret = mars_task_queue_try_peek_begin(mpu_to_mpu_ea, &data, 1);
+ switch (ret) {
+ case MARS_SUCCESS:
+ begin = 1;
+ break;
+ case MARS_ERROR_BUSY:
+ break;
+ default:
+ MARS_TEST_ASSERT_ERROR(ret, 0);
+ }
+ }
+ ret = mars_task_queue_peek_end(mpu_to_mpu_ea, 1);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+ cont --;
}
- 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);
diff --git a/tests/TFP/TFP_53_002/Makefile b/tests/TFP/TFP_53_002/Makefile
index 432135a..ecbce33 100644
--- a/tests/TFP/TFP_53_002/Makefile
+++ b/tests/TFP/TFP_53_002/Makefile
@@ -22,7 +22,7 @@
#
top_srcdir = ../..
-test_objs = host.o mpu.task_eo
+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_002/host.c b/tests/TFP/TFP_53_002/host.c
index de45e57..045393a 100644
--- a/tests/TFP/TFP_53_002/host.c
+++ b/tests/TFP/TFP_53_002/host.c
@@ -29,19 +29,20 @@
#define SEMAPHORE_COUNTS 10
#define WAIT_SEC 2
-extern spe_program_handle_t mpu_prog;
+extern spe_program_handle_t mpu1_prog, mpu2_prog;
static struct mars_context *mars_ctx;
-static struct mars_task_id task_id;
+static struct mars_task_id task1_id, task2_id;
static struct mars_task_args task_args;
static uint64_t semaphore;
-static uint32_t shared_resource __attribute__((aligned(16)));
+static uint32_t notify __attribute__((aligned(16)));
int main(void)
{
int ret;
+ int32_t exit_code;
- ret = mars_context_create(&mars_ctx, 0, 0);
+ ret = mars_context_create(&mars_ctx, 1, 0);
MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
ret = mars_task_semaphore_create(
@@ -50,26 +51,54 @@ int main(void)
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_SIZE_MAX);
+ ret = mars_task_create(mars_ctx, &task1_id, NULL,
+ mpu1_prog.elf_image, MARS_TASK_CONTEXT_SAVE_SIZE_MAX);
MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
- shared_resource = 0;
+ mars_test_counter_set(&notify, 0);
task_args.type.u64[0] = semaphore;
- task_args.type.u64[1] = mars_ptr_to_ea(&shared_resource);
+ task_args.type.u64[1] = mars_ptr_to_ea(&notify);
task_args.type.u64[2] = SEMAPHORE_COUNTS;
- ret = mars_task_schedule(&task_id, &task_args, 0);
+ ret = mars_task_schedule(&task1_id, &task_args, 0);
MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
- /* wait for blocking */
- sleep(WAIT_SEC);
+ /* wait for the task being executed */
+ mars_test_counter_wait(&notify, 1);
- /* Check if shared_resource hasn't been changed */
- MARS_TEST_ASSERT_EQUAL(shared_resource, 0);
+ /* start 2nd task to do unblocking of first task*/
+ ret = mars_task_create(mars_ctx, &task2_id, NULL,
+ mpu2_prog.elf_image, MARS_TASK_CONTEXT_SAVE_SIZE_MAX);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+ ret = mars_task_schedule(&task2_id, &task_args, 0);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+
+ /* test to ensure 1st task is blocked*/
+ ret = mars_task_try_wait(&task1_id, &exit_code);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_ERROR_BUSY);
+
+ /* cause semaphore to be released, unblocking first task*/
+ mars_test_counter_add(&notify, 1);
+
+ /*wait for both tasks to exit*/
+ ret = mars_task_wait(&task2_id, &exit_code);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+ ret = mars_task_wait(&task1_id, &exit_code);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+ /* destroy a semaphore */
ret = mars_task_semaphore_destroy(semaphore);
MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
- exit(0);
+ /*destroy tasks*/
+ 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);
+
+ /*destroy context*/
+ ret = mars_context_destroy(mars_ctx);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+
+ return 0;
}
diff --git a/tests/TFP/TFP_53_002/mpu.c b/tests/TFP/TFP_53_002/mpu1.c
index 50a9a8f..277785f 100644
--- a/tests/TFP/TFP_53_002/mpu.c
+++ b/tests/TFP/TFP_53_002/mpu1.c
@@ -23,15 +23,12 @@
#include <mars/task.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 notify_ea = task_args->type.u64[1];
uint64_t count = task_args->type.u64[2];
for (i = 0; i < count; i++) {
@@ -39,16 +36,12 @@ int mars_task_main(const struct mars_task_args *task_args)
MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
}
- /* limit check */
+ mars_test_counter_add(notify_ea, 1);
+
+ /* the following should be blocked */
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();
-
+ /* never reaches here */
return 0;
}
diff --git a/tests/TFP/TFP_24_003/mpu2.c b/tests/TFP/TFP_53_002/mpu2.c
index f09908d..68ffd0c 100644
--- a/tests/TFP/TFP_24_003/mpu2.c
+++ b/tests/TFP/TFP_53_002/mpu2.c
@@ -27,12 +27,12 @@
int mars_task_main(const struct mars_task_args *task_args)
{
int ret;
- uint64_t barrier_ea = task_args->type.u64[0];
+ uint64_t semaphore_ea = task_args->type.u64[0];
+ uint64_t notify_ea = task_args->type.u64[1];
- ret = mars_task_barrier_notify(barrier_ea);
- MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+ mars_test_counter_wait(notify_ea, 2);
- ret = mars_task_barrier_wait(barrier_ea);
+ ret = mars_task_semaphore_release(semaphore_ea);
MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
return 0;
diff --git a/tests/TFP/TFP_53_003/Makefile b/tests/TFP/TFP_53_003/Makefile
index ecbce33..f3f49a9 100644
--- a/tests/TFP/TFP_53_003/Makefile
+++ b/tests/TFP/TFP_53_003/Makefile
@@ -22,7 +22,7 @@
#
top_srcdir = ../..
-test_objs = host.o mpu1.task_eo mpu2.task_eo
+test_objs = host.o mpu1.task_eo mpu2.task_eo mpu3.task_eo mpu4.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
index 301f064..686dea0 100644
--- a/tests/TFP/TFP_53_003/host.c
+++ b/tests/TFP/TFP_53_003/host.c
@@ -26,27 +26,29 @@
#include <libspe2.h>
#include <mars_test.h>
-#define NUM_TASKS 10
+#define NUM_TASKS 32
#define SEMAPHORE_COUNTS 5
-#define WAIT_SEC 2
-
-extern spe_program_handle_t mpu1_prog;
-extern spe_program_handle_t mpu2_prog;
+extern spe_program_handle_t mpu1_prog, mpu2_prog, mpu3_prog, mpu4_prog;
static struct mars_context *mars_ctx;
-static struct mars_task_id task_id[NUM_TASKS];
+static struct mars_task_id task_id[NUM_TASKS], task3_id[NUM_TASKS], task2_id, task4_id;
static struct mars_task_args task_args;
+
static uint64_t semaphore;
-static uint32_t notify[32] __attribute__((aligned(128)));
+static uint32_t notify __attribute__((aligned(128)));
+static uint32_t waiter __attribute__((aligned(128)));
int main(void)
{
int ret, i;
int32_t exit_code;
+ int num_mpu;
- MARS_TEST_ASSERT( \
- MARS_TASK_SEMAPHORE_WAIT_MAX >= (NUM_TASKS * SEMAPHORE_COUNTS));
+ MARS_TEST_ASSERT(MARS_TASK_SEMAPHORE_WAIT_MAX >= NUM_TASKS);
+
+ num_mpu = spe_cpu_info_get(SPE_COUNT_PHYSICAL_SPES, -1);
+ MARS_TEST_ASSERT(num_mpu < NUM_TASKS);
ret = mars_context_create(&mars_ctx, 0, 0);
MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
@@ -57,53 +59,74 @@ int main(void)
NUM_TASKS * SEMAPHORE_COUNTS);
MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
- notify[0] = 0;
+ /* acquire the semaphore as much as possible */
+ mars_test_counter_set(&notify, 0);
+ task_args.type.u64[0] = semaphore;
+ task_args.type.u64[1] = mars_ptr_to_ea(&notify);
+ task_args.type.u64[2] = SEMAPHORE_COUNTS;
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_SIZE_MAX);
+ ret = mars_task_create(mars_ctx, &task_id[i], NULL,
+ mpu1_prog.elf_image,
+ MARS_TASK_CONTEXT_SAVE_SIZE_MAX);
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);
+ /* run them synchronously as much as possible */
+ mars_test_counter_set(&notify, 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]);
+ /* check semaphore count :
+ * 1: Run tasks (mpu3) which will do just busy wait as many as number of
+ * (num_mpu - 1).
+ * 2: Run a task (mpu2) which should be going to be blocked
+ * with semaphore_aquire() because it try to aquire the semaphore count more
+ * than the number specified in the creation time.
+ * 3: Try to run a new task (mpu4). As mpu2 should be in ready state,
+ * mpu3 will run and exit soon.
+ */
+
+ /* step 1 */
+ mars_test_counter_set(&notify, 0);
+ task_args.type.u64[0] = mars_ptr_to_ea(&notify);
+ task_args.type.u64[1] = mars_ptr_to_ea(&waiter);
+ for (i = 0; i < num_mpu - 1; i++) {
+ ret = mars_task_create(mars_ctx, &task3_id[i], NULL,
+ mpu3_prog.elf_image,
+ MARS_TASK_CONTEXT_SAVE_SIZE_MAX);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+ ret = mars_task_schedule(&task3_id[i], &task_args, 0);
MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
}
+ mars_test_counter_wait(&notify, num_mpu - 1);
- /* check semaphore count */
- notify[0] = 0;
- ret = mars_task_create(mars_ctx, &task_id[0], NULL,
- mpu2_prog.elf_image, MARS_TASK_CONTEXT_SAVE_SIZE_MAX);
- MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
-
+ /* step 2 */
+ mars_test_counter_set(&notify, 0);
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);
+ ret = mars_task_create(mars_ctx, &task2_id, NULL,
+ mpu2_prog.elf_image,
+ MARS_TASK_CONTEXT_SAVE_SIZE_MAX);
MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+ ret = mars_task_schedule(&task2_id, &task_args, 0);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+ mars_test_counter_wait(&notify, 1);
- /* 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);
+ /* step 3 */
+ ret = mars_task_create(mars_ctx, &task4_id, NULL,
+ mpu4_prog.elf_image,
+ MARS_TASK_CONTEXT_SAVE_SIZE_MAX);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+ ret = mars_task_wait(&task4_id, &exit_code);
MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+ MARS_TEST_ASSERT_ERROR(exit_code, MARS_SUCCESS);
exit(0);
}
diff --git a/tests/TFP/TFP_53_003/mpu1.c b/tests/TFP/TFP_53_003/mpu1.c
index 2190b84..87a3f92 100644
--- a/tests/TFP/TFP_53_003/mpu1.c
+++ b/tests/TFP/TFP_53_003/mpu1.c
@@ -23,18 +23,17 @@
#include <mars/task.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];
+ uint64_t n = task_args->type.u64[2];
mars_test_counter_wait(notify_ea, 1);
- for (i = 0; i < counts; i++) {
+ for (i = 0; i < n; i++) {
ret = mars_task_semaphore_acquire(semaphore_ea);
MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
}
diff --git a/tests/TFP/TFP_53_003/mpu2.c b/tests/TFP/TFP_53_003/mpu2.c
index 37205b2..b204c17 100644
--- a/tests/TFP/TFP_53_003/mpu2.c
+++ b/tests/TFP/TFP_53_003/mpu2.c
@@ -23,7 +23,6 @@
#include <mars/task.h>
#include <mars_task_test.h>
-#include <spu_mfcio.h>
int mars_task_main(const struct mars_task_args *task_args)
{
@@ -31,11 +30,10 @@ int mars_task_main(const struct mars_task_args *task_args)
uint64_t semaphore_ea = task_args->type.u64[0];
uint64_t notify_ea = task_args->type.u64[1];
+ mars_test_counter_add(notify_ea, 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);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_ERROR_NULL);
+ mars_test_counter_wait(notify_ea, 2);
return 0;
}
diff --git a/tests/TFP/TFP_53_003/mpu3.c b/tests/TFP/TFP_53_003/mpu3.c
new file mode 100644
index 0000000..3068fa9
--- /dev/null
+++ b/tests/TFP/TFP_53_003/mpu3.c
@@ -0,0 +1,36 @@
+/*
+ * Copyright 2009 Sony Corporation
+ *
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a copy
+ * of this software and associated documentation files (the "Software"), to deal
+ * in the Software without restriction, including without limitation the rights
+ * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+ * copies of the Software, and to permit persons to whom the Software is
+ * furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included in
+ * all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+ * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, 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.h>
+#include <mars_task_test.h>
+
+int mars_task_main(const struct mars_task_args *task_args)
+{
+ uint64_t notify_ea = task_args->type.u64[0];
+ uint64_t waiter_ea = task_args->type.u64[1];
+
+ mars_test_counter_add(notify_ea, 1);
+ mars_test_counter_wait(waiter_ea, 1);
+
+ return 0;
+}
diff --git a/tests/TFP/TFP_53_003/mpu4.c b/tests/TFP/TFP_53_003/mpu4.c
new file mode 100644
index 0000000..bdc8e78
--- /dev/null
+++ b/tests/TFP/TFP_53_003/mpu4.c
@@ -0,0 +1,30 @@
+/*
+ * Copyright 2009 Sony Corporation
+ *
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a copy
+ * of this software and associated documentation files (the "Software"), to deal
+ * in the Software without restriction, including without limitation the rights
+ * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+ * copies of the Software, and to permit persons to whom the Software is
+ * furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included in
+ * all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+ * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, 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.h>
+#include <mars_task_test.h>
+
+int mars_task_main(const struct mars_task_args *task_args)
+{
+ return 0;
+}
diff --git a/tests/TFP/TFP_61_001/Makefile b/tests/TFP/TFP_61_001/Makefile
index 432135a..ecbce33 100644
--- a/tests/TFP/TFP_61_001/Makefile
+++ b/tests/TFP/TFP_61_001/Makefile
@@ -22,7 +22,7 @@
#
top_srcdir = ../..
-test_objs = host.o mpu.task_eo
+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_001/host.c b/tests/TFP/TFP_61_001/host.c
index 65d7c3d..0a6b575 100644
--- a/tests/TFP/TFP_61_001/host.c
+++ b/tests/TFP/TFP_61_001/host.c
@@ -28,41 +28,62 @@
#define WAIT_SEC 1
-extern spe_program_handle_t mpu_prog;
+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;
-static struct mars_task_args task_args;
-static uint32_t shared_resource __attribute__((aligned(16)));
+static struct mars_task_id task1_id, task2_id;
+static struct mars_task_args task1_args;
+static uint32_t counter __attribute__((aligned(16)));
int main(void)
{
int ret;
int32_t exit_code;
- ret = mars_context_create(&mars_ctx, 0, 0);
+ ret = mars_context_create(&mars_ctx, 1, 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_SIZE_MAX);
+ ret = mars_task_create(mars_ctx, &task1_id, NULL,
+ mpu1_prog.elf_image,
+ MARS_TASK_CONTEXT_SAVE_SIZE_MAX);
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);
+ task1_args.type.u64[0] = mars_ptr_to_ea(&counter);
+ ret = mars_task_schedule(&task1_id, &task1_args, 0);
MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
- sleep(WAIT_SEC);
- MARS_TEST_ASSERT_EQUAL(shared_resource, 0);
+ /* see if the task1 is blocked and in sleep state */
+ mars_test_counter_wait(&counter, 1);
+ ret = mars_task_create(mars_ctx, &task2_id, NULL,
+ mpu2_prog.elf_image,
+ MARS_TASK_CONTEXT_SAVE_SIZE_MAX);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+
+ ret = mars_task_schedule(&task2_id, &task1_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_signal_send(&task_id);
+ ret = mars_task_destroy(&task2_id);
MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
- ret = mars_task_wait(&task_id, &exit_code);
+ MARS_TEST_ASSERT_EQUAL_INT(mars_test_counter_get(&counter), 1);
+
+ /* send a signal */
+ ret = mars_task_signal_send(&task1_id);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+
+ mars_test_counter_wait(&counter, 2);
+ mars_test_counter_add(&counter, 1);
+
+ 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(&task_id);
+ ret = mars_task_destroy(&task1_id);
MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
ret = mars_context_destroy(mars_ctx);
diff --git a/tests/TFP/TFP_36_009/mpu3.c b/tests/TFP/TFP_61_001/mpu1.c
index 69cca3e..69194de 100644
--- a/tests/TFP/TFP_36_009/mpu3.c
+++ b/tests/TFP/TFP_61_001/mpu1.c
@@ -27,11 +27,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 counter = task_args->type.u64[0];
+
+ mars_test_counter_add(counter, 1);
+
+ ret = mars_task_signal_wait();
- ret = mars_task_event_flag_set(mpu_to_mpu_ea, chk_bit);
MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+ mars_test_counter_add(counter, 1);
+ mars_test_counter_wait(counter, 3);
+
return 0;
}
diff --git a/tests/TFP/TFP_61_001/mpu2.c b/tests/TFP/TFP_61_001/mpu2.c
new file mode 100644
index 0000000..bdc8e78
--- /dev/null
+++ b/tests/TFP/TFP_61_001/mpu2.c
@@ -0,0 +1,30 @@
+/*
+ * Copyright 2009 Sony Corporation
+ *
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a copy
+ * of this software and associated documentation files (the "Software"), to deal
+ * in the Software without restriction, including without limitation the rights
+ * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+ * copies of the Software, and to permit persons to whom the Software is
+ * furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included in
+ * all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+ * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, 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.h>
+#include <mars_task_test.h>
+
+int mars_task_main(const struct mars_task_args *task_args)
+{
+ return 0;
+}
diff --git a/tests/TFP/TFP_61_002/Makefile b/tests/TFP/TFP_61_002/Makefile
index ecbce33..72cf999 100644
--- a/tests/TFP/TFP_61_002/Makefile
+++ b/tests/TFP/TFP_61_002/Makefile
@@ -22,7 +22,7 @@
#
top_srcdir = ../..
-test_objs = host.o mpu1.task_eo mpu2.task_eo
+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_61_002/host.c b/tests/TFP/TFP_61_002/host.c
index 1eabb33..69ed96a 100644
--- a/tests/TFP/TFP_61_002/host.c
+++ b/tests/TFP/TFP_61_002/host.c
@@ -27,56 +27,80 @@
#include <mars_test.h>
#define WAIT_SEC 1
+
extern spe_program_handle_t mpu1_prog;
extern spe_program_handle_t mpu2_prog;
+extern spe_program_handle_t mpu3_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_id task3_id __attribute__((aligned(16)));
static struct mars_task_args task_args;
+static uint32_t counter __attribute__((aligned(16)));
int main(void)
{
int ret;
int32_t exit_code;
- ret = mars_context_create(&mars_ctx, 0, 0);
+ ret = mars_context_create(&mars_ctx, 1, 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_SIZE_MAX);
- MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
-
- ret = mars_task_create(mars_ctx, &task2_id, NULL,
- mpu2_prog.elf_image, MARS_TASK_CONTEXT_SAVE_SIZE_MAX);
+ mpu1_prog.elf_image,
+ MARS_TASK_CONTEXT_SAVE_SIZE_MAX);
MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
- /* task1: wait task */
+ task_args.type.u64[0] = mars_ptr_to_ea(&counter);
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);
+ /* see if the task1 is blocked and in sleep state */
+ mars_test_counter_wait(&counter, 1);
+ ret = mars_task_create(mars_ctx, &task3_id, NULL,
+ mpu3_prog.elf_image,
+ MARS_TASK_CONTEXT_SAVE_SIZE_MAX);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
- /* task2: send task */
- task_args.type.u64[0] = mars_ptr_to_ea(&task1_id);
- ret = mars_task_schedule(&task2_id, &task_args, 0);
+ ret = mars_task_schedule(&task3_id, NULL, 0);
MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
- ret = mars_task_wait(&task1_id, &exit_code);
+ 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);
+
+ MARS_TEST_ASSERT_EQUAL_INT(mars_test_counter_get(&counter), 1);
+
+ /* send a signal */
+ task_args.type.u64[1] = mars_ptr_to_ea(&task1_id);
+ ret = mars_task_create(mars_ctx, &task2_id, NULL,
+ mpu2_prog.elf_image,
+ MARS_TASK_CONTEXT_SAVE_SIZE_MAX);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+
+ ret = mars_task_schedule(&task2_id, &task_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(&task1_id);
+ ret = mars_task_destroy(&task2_id);
MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
- ret = mars_task_destroy(&task2_id);
+ /* task1 end ? */
+ mars_test_counter_wait(&counter, 2);
+ mars_test_counter_add(&counter, 1);
+
+ 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_context_destroy(mars_ctx);
diff --git a/tests/TFP/TFP_61_002/mpu1.c b/tests/TFP/TFP_61_002/mpu1.c
index e4d4c8c..69194de 100644
--- a/tests/TFP/TFP_61_002/mpu1.c
+++ b/tests/TFP/TFP_61_002/mpu1.c
@@ -27,9 +27,16 @@
int mars_task_main(const struct mars_task_args *task_args)
{
int ret;
+ uint64_t counter = task_args->type.u64[0];
+
+ mars_test_counter_add(counter, 1);
ret = mars_task_signal_wait();
+
MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+ mars_test_counter_add(counter, 1);
+ mars_test_counter_wait(counter, 3);
+
return 0;
}
diff --git a/tests/TFP/TFP_61_002/mpu2.c b/tests/TFP/TFP_61_002/mpu2.c
index 6cbba6a..5ccfda0 100644
--- a/tests/TFP/TFP_61_002/mpu2.c
+++ b/tests/TFP/TFP_61_002/mpu2.c
@@ -32,7 +32,7 @@ int mars_task_main(const struct mars_task_args *task_args)
int ret;
mfc_get(&task1_id,
- task_args->type.u64[0],
+ task_args->type.u64[1],
sizeof(struct mars_task_id), 0, 0, 0);
mfc_write_tag_mask(1 << 0);
mfc_read_tag_status_all();
diff --git a/tests/TFP/TFP_61_002/mpu3.c b/tests/TFP/TFP_61_002/mpu3.c
new file mode 100644
index 0000000..bdc8e78
--- /dev/null
+++ b/tests/TFP/TFP_61_002/mpu3.c
@@ -0,0 +1,30 @@
+/*
+ * Copyright 2009 Sony Corporation
+ *
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a copy
+ * of this software and associated documentation files (the "Software"), to deal
+ * in the Software without restriction, including without limitation the rights
+ * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+ * copies of the Software, and to permit persons to whom the Software is
+ * furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included in
+ * all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+ * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, 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.h>
+#include <mars_task_test.h>
+
+int mars_task_main(const struct mars_task_args *task_args)
+{
+ return 0;
+}
diff --git a/tests/TFP/TFP_62_001/host.c b/tests/TFP/TFP_62_001/host.c
index 79e5a8c..1f30a22 100644
--- a/tests/TFP/TFP_62_001/host.c
+++ b/tests/TFP/TFP_62_001/host.c
@@ -33,7 +33,7 @@ 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)));
+static uint32_t notify __attribute__((aligned(128)));
int main(void)
{
@@ -43,23 +43,22 @@ int main(void)
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_SIZE_MAX);
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 */
+ mars_test_counter_wait(&notify, 1);
+
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);
+ mars_test_counter_add(&notify, 1);
ret = mars_task_wait(&task_id, &exit_code);
MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
diff --git a/tests/TFP/TFP_62_001/mpu.c b/tests/TFP/TFP_62_001/mpu.c
index 7809db8..ccbf332 100644
--- a/tests/TFP/TFP_62_001/mpu.c
+++ b/tests/TFP/TFP_62_001/mpu.c
@@ -31,7 +31,8 @@ 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);
+ mars_test_counter_add(notify_ea, 1);
+ mars_test_counter_wait(notify_ea, 2);
ret = mars_task_signal_wait();
MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
diff --git a/tests/TFP/TFP_63_001/host.c b/tests/TFP/TFP_63_001/host.c
index 79e5a8c..37c3cfa 100644
--- a/tests/TFP/TFP_63_001/host.c
+++ b/tests/TFP/TFP_63_001/host.c
@@ -33,7 +33,7 @@ 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)));
+static uint32_t notify __attribute__((aligned(128)));
int main(void)
{
@@ -43,7 +43,6 @@ int main(void)
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_SIZE_MAX);
MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
@@ -52,14 +51,14 @@ int main(void)
ret = mars_task_schedule(&task_id, &task_args, 0);
MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
- sleep(WAIT_SEC);
+ mars_test_counter_wait(&notify, 1);
/* 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);
+ mars_test_counter_add(&notify, 1);
ret = mars_task_wait(&task_id, &exit_code);
MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
diff --git a/tests/TFP/TFP_63_001/mpu.c b/tests/TFP/TFP_63_001/mpu.c
index 17ba870..34eff38 100644
--- a/tests/TFP/TFP_63_001/mpu.c
+++ b/tests/TFP/TFP_63_001/mpu.c
@@ -31,7 +31,9 @@ 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);
+ mars_test_counter_add(notify_ea, 1);
+
+ mars_test_counter_wait(notify_ea, 2);
ret = mars_task_signal_try_wait();
MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
diff --git a/tests/TFP/TFP_63_003/host.c b/tests/TFP/TFP_63_003/host.c
index 88cca66..bc3f90e 100644
--- a/tests/TFP/TFP_63_003/host.c
+++ b/tests/TFP/TFP_63_003/host.c
@@ -33,7 +33,7 @@ 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)));
+static uint32_t notify __attribute__((aligned(128)));
int main(void)
{
@@ -43,23 +43,23 @@ int main(void)
ret = mars_context_create(&mars_ctx, 0, 0);
MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
- notify[0] = 0;
+ notify = 0;
ret = mars_task_create(mars_ctx, &task_id, NULL,
- mpu_prog.elf_image, MARS_TASK_CONTEXT_SAVE_SIZE_MAX);
+ mpu_prog.elf_image, MARS_TASK_CONTEXT_SAVE_SIZE_MAX);
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);
+ mars_test_counter_wait(&notify, 1);
/* 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);
+ mars_test_counter_add(&notify, 1);
ret = mars_task_wait(&task_id, &exit_code);
MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
diff --git a/tests/TFP/TFP_63_003/mpu.c b/tests/TFP/TFP_63_003/mpu.c
index 5d85743..73f0ac8 100644
--- a/tests/TFP/TFP_63_003/mpu.c
+++ b/tests/TFP/TFP_63_003/mpu.c
@@ -23,13 +23,13 @@
#include <mars/task.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_add(notify_ea, 1);
mars_test_counter_wait(notify_ea, 1);
ret = mars_task_signal_try_wait();
diff --git a/tests/TPF/Makefile b/tests/TPF/Makefile
new file mode 100644
index 0000000..429c2ab
--- /dev/null
+++ b/tests/TPF/Makefile
@@ -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.
+#
+
+top_srcdir = ..
+test_items = \
+ TPF_10_001 \
+ TPF_10_002 \
+ TPF_10_003 \
+ TPF_10_004 \
+ TPF_20_001 \
+ TPF_20_002 \
+ TPF_30_001 \
+ TPF_30_002 \
+ TPF_30_003 \
+ TPF_30_004 \
+ TPF_40_001 \
+ TPF_40_002 \
+ TPF_40_003 \
+ TPF_40_004 \
+ TPF_40_005 \
+ TPF_40_006 \
+ TPF_40_007 \
+ TPF_40_008 \
+ TPF_40_009 \
+ TPF_40_010 \
+ TPF_40_011 \
+ TPF_40_012 \
+ TPF_40_013 \
+ TPF_40_014 \
+ TPF_40_015 \
+ TPF_40_016 \
+ TPF_40_017 \
+ TPF_40_018 \
+ TPF_40_019 \
+ TPF_40_020 \
+ TPF_40_021 \
+ TPF_40_022 \
+ TPF_40_023 \
+ TPF_40_024 \
+ TPF_40_025 \
+ TPF_40_026 \
+ TPF_40_027 \
+ TPF_40_028 \
+ TPF_40_029 \
+ TPF_40_030 \
+ TPF_40_031 \
+ TPF_40_032 \
+ TPF_40_033 \
+ TPF_40_034 \
+ TPF_40_035 \
+ TPF_40_036 \
+ TPF_40_037 \
+ TPF_40_038 \
+ TPF_40_039 \
+ TPF_40_040 \
+ TPF_40_041 \
+ TPF_40_042 \
+ TPF_40_043 \
+ TPF_40_044 \
+ TPF_40_045 \
+ TPF_50_001 \
+ TPF_50_002 \
+ TPF_50_003 \
+ TPF_50_004 \
+ TPF_50_005 \
+ TPF_60_001 \
+ TPF_60_002 \
+ TPF_60_003 \
+ TPF_60_004 \
+ TPF_60_005 \
+ TPF_60_006
+include $(top_srcdir)/scripts/config.mk
+include $(top_srcdir)/scripts/rules_class.mk
diff --git a/tests/TPF/TPF_10_001/Makefile b/tests/TPF/TPF_10_001/Makefile
new file mode 100644
index 0000000..b605c75
--- /dev/null
+++ b/tests/TPF/TPF_10_001/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.
+#
+
+EXTRA_LDFLAGS=-lm
+top_srcdir = ../..
+test_objs = host.o mpu.task_eo
+timeout = 120
+
+include $(top_srcdir)/scripts/config.mk
+include $(top_srcdir)/scripts/rules_item.mk
+include $(top_srcdir)/scripts/rules_tpf.mk
diff --git a/tests/TPF/TPF_10_001/host.c b/tests/TPF/TPF_10_001/host.c
new file mode 100644
index 0000000..3b9613a
--- /dev/null
+++ b/tests/TPF/TPF_10_001/host.c
@@ -0,0 +1,80 @@
+/*
+ * Copyright 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 <stdio.h>
+#include <libspe2.h>
+#include <mars/task.h>
+#include <mars_test.h>
+
+#define TASK_MAX 512
+
+extern spe_program_handle_t mpu_prog;
+
+uint32_t test(int task, int *create, int *destroy)
+{
+ int ret, i;
+ int32_t start, end;
+ struct mars_context *mars_ctx;
+ struct mars_task_id task_id[TASK_MAX];
+
+ ret = mars_context_create(&mars_ctx, 0, 0);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+
+ for (i = 0; i < task; i++) {
+ start = mars_task_get_ticks();
+ ret = mars_task_create(mars_ctx, &task_id[i], NULL,
+ mpu_prog.elf_image,
+ MARS_TASK_CONTEXT_SAVE_SIZE_MAX);
+ end = mars_task_get_ticks();
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+ create[i] = end - start;
+ }
+
+ for (i = 0; i < task; i++) {
+ start = mars_task_get_ticks();
+ ret = mars_task_destroy(&task_id[i]);
+ end = mars_task_get_ticks();
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+ destroy[i] = end - start;
+ }
+
+ ret = mars_context_destroy(mars_ctx);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+
+ return 0;
+}
+
+int main(void)
+{
+ int task = TASK_MAX;
+ int32_t create[TASK_MAX], destroy[TASK_MAX];
+
+ MARS_TEST_PERF_INIT();
+
+ test(task, create, destroy);
+
+ mars_test_print_statistics(create, task, "task create");
+ mars_test_print_statistics(destroy, task, "task destroy");
+
+ return 0;
+}
diff --git a/tests/TPF/TPF_10_001/mpu.c b/tests/TPF/TPF_10_001/mpu.c
new file mode 100644
index 0000000..dc61628
--- /dev/null
+++ b/tests/TPF/TPF_10_001/mpu.c
@@ -0,0 +1,30 @@
+/*
+ * Copyright 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/task.h>
+#include <mars_test.h>
+
+int mars_task_main(const struct mars_task_args *task_args)
+{
+ return 0;
+}
diff --git a/tests/TPF/TPF_10_002/Makefile b/tests/TPF/TPF_10_002/Makefile
new file mode 100644
index 0000000..b605c75
--- /dev/null
+++ b/tests/TPF/TPF_10_002/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.
+#
+
+EXTRA_LDFLAGS=-lm
+top_srcdir = ../..
+test_objs = host.o mpu.task_eo
+timeout = 120
+
+include $(top_srcdir)/scripts/config.mk
+include $(top_srcdir)/scripts/rules_item.mk
+include $(top_srcdir)/scripts/rules_tpf.mk
diff --git a/tests/TPF/TPF_10_002/host.c b/tests/TPF/TPF_10_002/host.c
new file mode 100644
index 0000000..41e9245
--- /dev/null
+++ b/tests/TPF/TPF_10_002/host.c
@@ -0,0 +1,91 @@
+/*
+ * Copyright 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 <stdio.h>
+#include <libspe2.h>
+#include <mars/task.h>
+#include <mars_test.h>
+
+#define TASK_MAX 512
+
+extern spe_program_handle_t mpu_prog;
+
+uint32_t test(int task, int *schedule, int *wait)
+{
+ int32_t ret, i;
+ int32_t start, end;
+ struct mars_context *mars_ctx;
+ struct mars_task_id task_id[TASK_MAX];
+ struct mars_task_args task_args;
+
+ ret = mars_context_create(&mars_ctx, 0, 0);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+
+ for (i = 0; i < task; i++) {
+ ret = mars_task_create(mars_ctx, &task_id[i], NULL,
+ mpu_prog.elf_image,
+ MARS_TASK_CONTEXT_SAVE_SIZE_MAX);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+ }
+
+ for (i = 0; i < task; i++) {
+ start = mars_task_get_ticks();
+ ret = mars_task_schedule(&task_id[i], &task_args, 0);
+ end = mars_task_get_ticks();
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+ schedule[i] = end - start;
+ }
+
+ for (i = 0; i < task; i++) {
+ start = mars_task_get_ticks();
+ ret = mars_task_wait(&task_id[i], NULL);
+ end = mars_task_get_ticks();
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+ wait[i] = end - start;
+ }
+
+ for (i = 0; i < task; i++) {
+ 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;
+}
+
+int main(void)
+{
+ int task = TASK_MAX;
+ int32_t schedule[TASK_MAX], wait[TASK_MAX];
+
+ MARS_TEST_PERF_INIT();
+
+ test(task, schedule, wait);
+
+ mars_test_print_statistics(schedule, task, "task create");
+ mars_test_print_statistics(wait, task, "task destroy");
+
+ return 0;
+}
diff --git a/tests/TPF/TPF_10_002/mpu.c b/tests/TPF/TPF_10_002/mpu.c
new file mode 100644
index 0000000..dc61628
--- /dev/null
+++ b/tests/TPF/TPF_10_002/mpu.c
@@ -0,0 +1,30 @@
+/*
+ * Copyright 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/task.h>
+#include <mars_test.h>
+
+int mars_task_main(const struct mars_task_args *task_args)
+{
+ return 0;
+}
diff --git a/tests/TPF/TPF_10_003/Makefile b/tests/TPF/TPF_10_003/Makefile
new file mode 100644
index 0000000..82e6036
--- /dev/null
+++ b/tests/TPF/TPF_10_003/Makefile
@@ -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.
+#
+
+top_srcdir = ../..
+test_objs = host.o mpu.task_eo
+timeout = 120
+
+include $(top_srcdir)/scripts/config.mk
+include $(top_srcdir)/scripts/rules_item.mk
+include $(top_srcdir)/scripts/rules_tpf.mk
diff --git a/tests/TPF/TPF_10_003/host.c b/tests/TPF/TPF_10_003/host.c
new file mode 100644
index 0000000..d978be8
--- /dev/null
+++ b/tests/TPF/TPF_10_003/host.c
@@ -0,0 +1,101 @@
+/*
+ * Copyright 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 <stdio.h>
+#include <libspe2.h>
+#include <mars/task.h>
+#include <mars_test.h>
+
+#define NUM_RETRY 10
+#define TASK_INITIAL 4
+#define TASK_MAX 512
+
+extern spe_program_handle_t mpu_prog;
+
+uint32_t test(int yield, int task)
+{
+ int ret, i;
+ uint32_t start, end;
+ struct mars_context *mars_ctx;
+ struct mars_task_id task_id[TASK_MAX];
+ struct mars_task_args task_args;
+
+ task_args.type.u32[0] = yield;
+
+ ret = mars_context_create(&mars_ctx, 0, 0);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+
+ for (i = 0; i < task; i++) {
+ ret = mars_task_create(mars_ctx, &task_id[i], NULL,
+ mpu_prog.elf_image, MARS_TASK_CONTEXT_SAVE_SIZE_MAX);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+ }
+
+ start = mars_task_get_ticks();
+
+ for (i = 0; i < task; i++) {
+ ret = mars_task_schedule(&task_id[i], &task_args, 0);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+ }
+
+ for (i = 0; i < task; i++) {
+ ret = mars_task_wait(&task_id[i], NULL);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+ }
+
+ end = mars_task_get_ticks();
+
+ for (i = 0; i < task; i++) {
+ 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 end - start;
+}
+
+int main(void)
+{
+ int i, yield, task;
+
+ MARS_TEST_PERF_INIT();
+
+ for (yield = 0; yield <= 4; yield++) {
+ for (task = TASK_INITIAL; task <= TASK_MAX; task *= 2) {
+ uint32_t average = 0;
+ char buf[256];
+
+ for (i = 0; i < NUM_RETRY; i++)
+ average += test(task, yield);
+ average /= NUM_RETRY;
+
+ sprintf(buf, "yield:%d task:%d ", yield, task);
+ MARS_TEST_PERF_RESULT_PRINT(buf, average);
+ }
+ }
+
+ return 0;
+}
+
diff --git a/tests/TPF/TPF_10_003/mpu.c b/tests/TPF/TPF_10_003/mpu.c
new file mode 100644
index 0000000..85f0ebe
--- /dev/null
+++ b/tests/TPF/TPF_10_003/mpu.c
@@ -0,0 +1,38 @@
+/*
+ * Copyright 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/task.h>
+#include <mars_test.h>
+
+int mars_task_main(const struct mars_task_args *task_args)
+{
+ int ret, i;
+ uint32_t yield = task_args->type.u32[0];
+
+ for (i = 0; i < yield; i++) {
+ ret = mars_task_yield();
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+ }
+
+ return 0;
+}
diff --git a/tests/TPF/TPF_10_004/Makefile b/tests/TPF/TPF_10_004/Makefile
new file mode 100644
index 0000000..82e6036
--- /dev/null
+++ b/tests/TPF/TPF_10_004/Makefile
@@ -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.
+#
+
+top_srcdir = ../..
+test_objs = host.o mpu.task_eo
+timeout = 120
+
+include $(top_srcdir)/scripts/config.mk
+include $(top_srcdir)/scripts/rules_item.mk
+include $(top_srcdir)/scripts/rules_tpf.mk
diff --git a/tests/TPF/TPF_10_004/host.c b/tests/TPF/TPF_10_004/host.c
new file mode 100644
index 0000000..eda4be5
--- /dev/null
+++ b/tests/TPF/TPF_10_004/host.c
@@ -0,0 +1,102 @@
+/*
+ * Copyright 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 <stdio.h>
+#include <libspe2.h>
+#include <mars/task.h>
+#include <mars_test.h>
+
+#define NUM_RETRY 10
+#define TASK_INITIAL 4
+#define TASK_MAX 512
+
+extern spe_program_handle_t mpu_prog;
+
+uint32_t test(int yield, int task)
+{
+ int ret, i;
+ uint32_t start, end;
+ struct mars_context *mars_ctx;
+ struct mars_task_id task_id[TASK_MAX];
+ struct mars_task_args task_args;
+
+ task_args.type.u32[0] = yield;
+
+ ret = mars_context_create(&mars_ctx, 0, 0);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+
+ for (i = 0; i < task; i++) {
+ ret = mars_task_create(mars_ctx, &task_id[i], NULL,
+ mpu_prog.elf_image, MARS_TASK_CONTEXT_SAVE_SIZE_MAX);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+ }
+
+ start = mars_task_get_ticks();
+
+ for (i = 0; i < task; i++) {
+ ret = mars_task_schedule(
+ &task_id[i], &task_args, i % UINT8_MAX);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+ }
+
+ for (i = 0; i < task; i++) {
+ ret = mars_task_wait(&task_id[i], NULL);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+ }
+
+ end = mars_task_get_ticks();
+
+ for (i = 0; i < task; i++) {
+ 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 end - start;
+}
+
+int main(void)
+{
+ int i, yield, task;
+
+ MARS_TEST_PERF_INIT();
+
+ for (yield = 0; yield <= 4; yield++) {
+ for (task = TASK_INITIAL; task <= TASK_MAX; task *= 2) {
+ uint32_t average = 0;
+ char buf[256];
+
+ for (i = 0; i < NUM_RETRY; i++)
+ average += test(task, yield);
+ average /= NUM_RETRY;
+
+ sprintf(buf, "yield:%d task:%d ", yield, task);
+ MARS_TEST_PERF_RESULT_PRINT(buf, average);
+ }
+ }
+
+ return 0;
+}
+
diff --git a/tests/TPF/TPF_10_004/mpu.c b/tests/TPF/TPF_10_004/mpu.c
new file mode 100644
index 0000000..85f0ebe
--- /dev/null
+++ b/tests/TPF/TPF_10_004/mpu.c
@@ -0,0 +1,38 @@
+/*
+ * Copyright 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/task.h>
+#include <mars_test.h>
+
+int mars_task_main(const struct mars_task_args *task_args)
+{
+ int ret, i;
+ uint32_t yield = task_args->type.u32[0];
+
+ for (i = 0; i < yield; i++) {
+ ret = mars_task_yield();
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+ }
+
+ return 0;
+}
diff --git a/tests/TPF/TPF_20_001/Makefile b/tests/TPF/TPF_20_001/Makefile
new file mode 100644
index 0000000..c8d78c3
--- /dev/null
+++ b/tests/TPF/TPF_20_001/Makefile
@@ -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.
+#
+
+EXTRA_LDFLAGS=-lm
+INCLUDE_CFLAGS+= -I./
+MPU_INCLUDE_CFLAGS+= -I./
+
+top_srcdir = ../..
+test_objs = host.o mpu1.task_eo mpu2.task_eo mpu3.task_eo
+timeout = 120
+
+include $(top_srcdir)/scripts/config.mk
+include $(top_srcdir)/scripts/rules_item.mk
+include $(top_srcdir)/scripts/rules_tpf.mk
+
+host.o: common.h
+mpu1.task_o: common.h
+mpu2.task_o: common.h
diff --git a/tests/TPF/TPF_20_001/common.h b/tests/TPF/TPF_20_001/common.h
new file mode 100644
index 0000000..b32648b
--- /dev/null
+++ b/tests/TPF/TPF_20_001/common.h
@@ -0,0 +1,45 @@
+/*
+ * Copyright 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/task.h>
+#include <mars_test.h>
+
+#define MAX_THREADS 16
+
+#define MIN_MPUS 1
+#define MAX_MPUS spe/2
+
+#define TEST1_ELEMENT_COUNT 4096
+
+#define ALIGN128 __attribute__((aligned(128)))
+
+struct test_task_args_st {
+ uint64_t barrier1_ea;
+ uint64_t barrier2_ea;
+ uint64_t ticks1_ea;
+ uint64_t ticks2_ea;
+ uint64_t ticks3_ea;
+ uint32_t tb_freq;
+ uint32_t pad[1];
+};
+
diff --git a/tests/TPF/TPF_20_001/host.c b/tests/TPF/TPF_20_001/host.c
new file mode 100644
index 0000000..7e823d2
--- /dev/null
+++ b/tests/TPF/TPF_20_001/host.c
@@ -0,0 +1,325 @@
+/*
+ * Copyright 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 <pthread.h>
+#include <libspe2.h>
+#include <mars/task.h>
+#include <mars_test.h>
+#include <common.h>
+
+extern spe_program_handle_t mpu1_prog, mpu2_prog, mpu3_prog;
+
+struct thread_arg_st {
+ int32_t *ticks1;
+ int32_t *ticks2;
+ int32_t *ticks3;
+ uint64_t barrier1;
+ uint64_t barrier2;
+ struct mars_context *mars_ctx;
+};
+
+void *test_thread1(void *arg)
+{
+ int ret;
+ struct thread_arg_st *thread_arg = arg;
+ int32_t *start1_ticks = thread_arg->ticks1;
+ int32_t *start2_ticks = thread_arg->ticks2;
+ int32_t *end_ticks = thread_arg->ticks3;
+ struct mars_context *mars_ctx = thread_arg->mars_ctx;
+ struct mars_task_id task_id_notify, task_id_wait;
+ struct mars_task_args task_args_notify, task_args_wait;
+ static __thread struct test_task_args_st args ALIGN128;
+ uint64_t barrier1;
+ uint64_t barrier2;
+
+ ret = mars_task_create(mars_ctx, &task_id_notify, NULL,
+ mpu1_prog.elf_image, MARS_TASK_CONTEXT_SAVE_SIZE_MAX);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+
+ ret = mars_task_create(mars_ctx, &task_id_wait, NULL,
+ mpu2_prog.elf_image, MARS_TASK_CONTEXT_SAVE_SIZE_MAX);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+
+ ret = mars_task_barrier_create(mars_ctx, &barrier1, 1);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+
+ ret = mars_task_barrier_create(mars_ctx, &barrier2, 2);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+
+ ret = mars_test_get_timebase_freq(&args.tb_freq);
+ MARS_TEST_ASSERT_EQUAL(ret, MARS_SUCCESS);
+
+ args.barrier1_ea = barrier1;
+ args.barrier2_ea = barrier2;
+ args.ticks1_ea = mars_ptr_to_ea(start1_ticks);
+ args.ticks2_ea = mars_ptr_to_ea(start2_ticks);
+ args.ticks3_ea = mars_ptr_to_ea(end_ticks);
+
+ task_args_notify.type.u64[0] = mars_ptr_to_ea(&args);
+ task_args_wait.type.u64[0] = mars_ptr_to_ea(&args);
+
+ ret = mars_task_schedule(&task_id_notify, &task_args_notify, 0);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+
+ ret = mars_task_schedule(&task_id_wait, &task_args_wait, 0);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+
+ ret = mars_task_wait(&task_id_notify, NULL);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+
+ ret = mars_task_wait(&task_id_wait, NULL);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+
+ ret = mars_task_barrier_destroy(barrier1);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+
+ ret = mars_task_barrier_destroy(barrier2);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+
+ ret = mars_task_destroy(&task_id_notify);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+
+ ret = mars_task_destroy(&task_id_wait);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+
+ return NULL;
+}
+
+void test1(int mpu, pthread_t * threads, struct thread_arg_st *thread_args)
+{
+ int ret, i;
+ size_t size;
+ char text[128];
+ int32_t *start1_ticks, *start2_ticks, *end_ticks, *ticks;
+ struct mars_context *mars_ctx;
+
+ size = sizeof(uint32_t) * TEST1_ELEMENT_COUNT * mpu;
+
+ ret = posix_memalign((void **)&start1_ticks, 128, size);
+ MARS_TEST_ASSERT_EQUAL(ret, 0);
+
+ ret = posix_memalign((void **)&start2_ticks, 128, size);
+ MARS_TEST_ASSERT_EQUAL(ret, 0);
+
+ ret = posix_memalign((void **)&end_ticks, 128, size);
+ MARS_TEST_ASSERT_EQUAL(ret, 0);
+
+ ret = posix_memalign((void **)&ticks, 128, size);
+ MARS_TEST_ASSERT_EQUAL(ret, 0);
+
+ ret = mars_context_create(&mars_ctx, 0, 1);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+
+ for (i = 0; i < mpu; i++) {
+ thread_args[i].ticks1 = &start1_ticks[TEST1_ELEMENT_COUNT * i];
+ thread_args[i].ticks2 = &start2_ticks[TEST1_ELEMENT_COUNT * i];
+ thread_args[i].ticks3 = &end_ticks[TEST1_ELEMENT_COUNT * i];
+ thread_args[i].mars_ctx = mars_ctx;
+ ret = pthread_create(&threads[i], NULL, test_thread1, &thread_args[i]);
+ MARS_TEST_ASSERT_EQUAL(ret, 0);
+ }
+
+ for (i = 0; i < mpu; i++) {
+ ret = pthread_join(threads[i], NULL);
+ MARS_TEST_ASSERT_EQUAL(ret, 0);
+ }
+
+ ret = mars_context_destroy(mars_ctx);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+
+ size = TEST1_ELEMENT_COUNT * mpu;
+ for (i = 0; i < size; i++) {
+ ticks[i]=start2_ticks[i]-start1_ticks[i];
+ }
+ sprintf(text, "barrier single: notify (%d mpu pairs)", mpu);
+ mars_test_print_statistics(ticks, size, text);
+
+ for (i = 0; i < size; i++) {
+ ticks[i]=end_ticks[i]-start1_ticks[i];
+ }
+ sprintf(text, "barrier single: start notify - end wait (%d mpu pairs)", mpu);
+ mars_test_print_statistics(ticks, size, text);
+
+ for (i = 0; i < size; i++) {
+ ticks[i]=end_ticks[i]-start2_ticks[i];
+ }
+ sprintf(text, "barrier single: end notify - end wait (%d mpu pairs)", mpu);
+ mars_test_print_statistics(ticks, size, text);
+
+ free(start1_ticks);
+ free(start2_ticks);
+ free(end_ticks);
+ free(ticks);
+}
+
+void *test_thread2(void *arg)
+{
+ int ret;
+ struct thread_arg_st *thread_arg = arg;
+ int32_t *start1_ticks = thread_arg->ticks1;
+ int32_t *start2_ticks = thread_arg->ticks2;
+ int32_t *end_ticks = thread_arg->ticks3;
+ uint64_t barrier1 = thread_arg->barrier1;
+ uint64_t barrier2 = thread_arg->barrier2;
+ struct mars_context *mars_ctx = thread_arg->mars_ctx;
+ struct mars_task_id task_id;
+ struct mars_task_args task_args;
+ static __thread struct test_task_args_st args ALIGN128;
+
+ ret = mars_task_create(mars_ctx, &task_id, NULL,
+ mpu3_prog.elf_image, MARS_TASK_CONTEXT_SAVE_SIZE_MAX);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+
+ args.barrier1_ea = barrier1;
+ args.barrier2_ea = barrier2;
+ args.ticks1_ea = mars_ptr_to_ea(start1_ticks);
+ args.ticks2_ea = mars_ptr_to_ea(start2_ticks);
+ args.ticks3_ea = mars_ptr_to_ea(end_ticks);
+
+ task_args.type.u64[0] = mars_ptr_to_ea(&args);
+
+ ret = mars_task_schedule(&task_id, &task_args, 0);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+
+ ret = mars_task_wait(&task_id, NULL);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+
+
+ ret = mars_task_destroy(&task_id);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+
+ return NULL;
+}
+
+void test2(int mpu, pthread_t * threads, struct thread_arg_st *thread_args)
+{
+ int ret, i;
+ size_t size;
+ char text[128];
+ int32_t *start1_ticks, *start2_ticks, *end_ticks, *ticks;
+ struct mars_context *mars_ctx;
+ uint64_t barrier1;
+ uint64_t barrier2;
+
+ size = sizeof(uint32_t) * TEST1_ELEMENT_COUNT * mpu;
+
+ ret = posix_memalign((void **)&start1_ticks, 128, size);
+ MARS_TEST_ASSERT_EQUAL(ret, 0);
+
+ ret = posix_memalign((void **)&start2_ticks, 128, size);
+ MARS_TEST_ASSERT_EQUAL(ret, 0);
+
+ ret = posix_memalign((void **)&end_ticks, 128, size);
+ MARS_TEST_ASSERT_EQUAL(ret, 0);
+
+ ret = posix_memalign((void **)&ticks, 128, size);
+ MARS_TEST_ASSERT_EQUAL(ret, 0);
+
+ ret = mars_context_create(&mars_ctx, 0, 1);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+
+ ret = mars_task_barrier_create(mars_ctx, &barrier1, mpu );
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+
+ ret = mars_task_barrier_create(mars_ctx, &barrier2, mpu);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+
+ for (i = 0; i < mpu; i++) {
+ thread_args[i].ticks1 = &start1_ticks[TEST1_ELEMENT_COUNT * i];
+ thread_args[i].ticks2 = &start2_ticks[TEST1_ELEMENT_COUNT * i];
+ thread_args[i].ticks3 = &end_ticks[TEST1_ELEMENT_COUNT * i];
+ thread_args[i].mars_ctx = mars_ctx;
+ thread_args[i].barrier1 = barrier1;
+ thread_args[i].barrier2 = barrier2;
+ ret = pthread_create(&threads[i], NULL, test_thread2, &thread_args[i]);
+ MARS_TEST_ASSERT_EQUAL(ret, 0);
+ }
+
+ for (i = 0; i < mpu; i++) {
+ ret = pthread_join(threads[i], NULL);
+ MARS_TEST_ASSERT_EQUAL(ret, 0);
+ }
+
+ ret = mars_task_barrier_destroy(barrier1);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+
+ ret = mars_task_barrier_destroy(barrier2);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+
+ ret = mars_context_destroy(mars_ctx);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+
+ size = TEST1_ELEMENT_COUNT * mpu;
+ for (i = 0; i < size; i++) {
+ ticks[i]=start2_ticks[i]-start1_ticks[i];
+ }
+ sprintf(text, "barrier multiple: notify (%d mpu pairs)", mpu);
+ mars_test_print_statistics(ticks, size, text);
+
+ for (i = 0; i < size; i++) {
+ ticks[i]=end_ticks[i]-start1_ticks[i];
+ }
+ sprintf(text, "barrier multiple: start notify - end wait (%d mpu pairs)", mpu);
+ mars_test_print_statistics(ticks, size, text);
+
+ for (i = 0; i < size; i++) {
+ ticks[i]=end_ticks[i]-start2_ticks[i];
+ }
+ sprintf(text, "barrier multiple: end notify - end wait (%d mpu pairs)", mpu);
+ mars_test_print_statistics(ticks, size, text);
+
+ free(start1_ticks);
+ free(start2_ticks);
+ free(end_ticks);
+ free(ticks);
+}
+
+int main(int argc, char *argv[])
+{
+ int mpu,spe;
+ size_t size;
+ pthread_t *threads;
+ struct thread_arg_st *thread_args;
+
+ spe = spe_cpu_info_get(SPE_COUNT_PHYSICAL_SPES, -1);
+
+ for (mpu = MIN_MPUS; mpu <= MAX_MPUS; mpu++) {
+
+ threads = (pthread_t *) malloc(sizeof(pthread_t) * mpu);
+ MARS_TEST_ASSERT(threads != NULL);
+
+ size = sizeof(struct thread_arg_st) * mpu;
+ thread_args = (struct thread_arg_st *)malloc(size);
+ MARS_TEST_ASSERT(thread_args != NULL);
+
+ MARS_TEST_PERF_INIT();
+
+ test1(mpu, threads, thread_args);
+ test2(mpu, threads, thread_args);
+
+ free(thread_args);
+ free(threads);
+ }
+
+ return 0;
+}
diff --git a/tests/TPF/TPF_20_001/mpu1.c b/tests/TPF/TPF_20_001/mpu1.c
new file mode 100644
index 0000000..c2f89ac
--- /dev/null
+++ b/tests/TPF/TPF_20_001/mpu1.c
@@ -0,0 +1,63 @@
+/*
+ * Copyright 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/task.h>
+#include <mars_test.h>
+#include <common.h>
+
+int mars_task_main(const struct mars_task_args *task_args)
+{
+ int ret, i;
+ static struct test_task_args_st args ALIGN128;
+ static int32_t start1_ticks[TEST1_ELEMENT_COUNT] ALIGN128;
+ static int32_t start2_ticks[TEST1_ELEMENT_COUNT] ALIGN128;
+
+ mfc_get(&args, task_args->type.u64[0], sizeof(struct test_task_args_st), 0, 0, 0);
+ mfc_write_tag_mask(1);
+ mfc_read_tag_status_all();
+
+ for (i = 0; i < TEST1_ELEMENT_COUNT; i++) {
+
+ mars_test_usleep(args.tb_freq, DELAY); /*give wait task time to block*/
+
+ start1_ticks[i] = mars_task_get_ticks();
+ ret = mars_task_barrier_notify(args.barrier1_ea);
+ start2_ticks[i] = mars_task_get_ticks();
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+
+
+ ret = mars_task_barrier_notify(args.barrier2_ea);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+ ret = mars_task_barrier_wait(args.barrier2_ea);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+ }
+
+ mfc_put(start1_ticks, args.ticks1_ea, TEST1_ELEMENT_COUNT * 4, 0, 0, 0);
+ mfc_write_tag_mask(1);
+ mfc_read_tag_status_all();
+
+ mfc_put(start2_ticks, args.ticks2_ea, TEST1_ELEMENT_COUNT * 4, 0, 0, 0);
+ mfc_write_tag_mask(1);
+ mfc_read_tag_status_all();
+ return 0;
+}
diff --git a/tests/TPF/TPF_20_001/mpu2.c b/tests/TPF/TPF_20_001/mpu2.c
new file mode 100644
index 0000000..08788cc
--- /dev/null
+++ b/tests/TPF/TPF_20_001/mpu2.c
@@ -0,0 +1,56 @@
+/*
+ * Copyright 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/task.h>
+#include <mars_test.h>
+#include <common.h>
+
+int mars_task_main(const struct mars_task_args *task_args)
+{
+ int ret, i;
+ static struct test_task_args_st args ALIGN128;
+ static int32_t end_ticks[TEST1_ELEMENT_COUNT] ALIGN128;
+
+ mfc_get(&args, task_args->type.u64[0], sizeof(struct test_task_args_st), 0, 0, 0);
+ mfc_write_tag_mask(1);
+ mfc_read_tag_status_all();
+
+ for (i = 0; i < TEST1_ELEMENT_COUNT; i++) {
+
+ ret = mars_task_barrier_wait(args.barrier1_ea);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+
+ end_ticks[i] = mars_task_get_ticks();
+
+ ret = mars_task_barrier_notify(args.barrier2_ea);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+ ret = mars_task_barrier_wait(args.barrier2_ea);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+ }
+
+ mfc_put(end_ticks, args.ticks3_ea, TEST1_ELEMENT_COUNT * 4, 0, 0, 0);
+ mfc_write_tag_mask(1);
+ mfc_read_tag_status_all();
+
+ return 0;
+}
diff --git a/tests/TPF/TPF_20_001/mpu3.c b/tests/TPF/TPF_20_001/mpu3.c
new file mode 100644
index 0000000..1574f1e
--- /dev/null
+++ b/tests/TPF/TPF_20_001/mpu3.c
@@ -0,0 +1,70 @@
+/*
+ * Copyright 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/task.h>
+#include <mars_test.h>
+#include <common.h>
+
+int mars_task_main(const struct mars_task_args *task_args)
+{
+ int ret, i;
+ static struct test_task_args_st args ALIGN128;
+ static int32_t start1_ticks[TEST1_ELEMENT_COUNT] ALIGN128;
+ static int32_t start2_ticks[TEST1_ELEMENT_COUNT] ALIGN128;
+ static int32_t end_ticks[TEST1_ELEMENT_COUNT] ALIGN128;
+
+ mfc_get(&args, task_args->type.u64[0], sizeof(struct test_task_args_st), 0, 0, 0);
+ mfc_write_tag_mask(1);
+ mfc_read_tag_status_all();
+
+ for (i = 0; i < TEST1_ELEMENT_COUNT; i++) {
+ start1_ticks[i] = mars_task_get_ticks();
+ ret = mars_task_barrier_notify(args.barrier1_ea);
+ start2_ticks[i] = mars_task_get_ticks();
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+
+ ret = mars_task_barrier_wait(args.barrier1_ea);
+ end_ticks[i] = mars_task_get_ticks();
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+
+ ret = mars_task_barrier_notify(args.barrier2_ea);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+
+ ret = mars_task_barrier_wait(args.barrier2_ea);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+ }
+
+ mfc_put(start1_ticks, args.ticks1_ea, TEST1_ELEMENT_COUNT * 4, 0, 0, 0);
+ mfc_write_tag_mask(1);
+ mfc_read_tag_status_all();
+
+ mfc_put(start2_ticks, args.ticks2_ea, TEST1_ELEMENT_COUNT * 4, 0, 0, 0);
+ mfc_write_tag_mask(1);
+ mfc_read_tag_status_all();
+
+ mfc_put(end_ticks, args.ticks3_ea, TEST1_ELEMENT_COUNT * 4, 0, 0, 0);
+ mfc_write_tag_mask(1);
+ mfc_read_tag_status_all();
+
+ return 0;
+}
diff --git a/tests/TPF/TPF_20_002/Makefile b/tests/TPF/TPF_20_002/Makefile
new file mode 100644
index 0000000..c8d78c3
--- /dev/null
+++ b/tests/TPF/TPF_20_002/Makefile
@@ -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.
+#
+
+EXTRA_LDFLAGS=-lm
+INCLUDE_CFLAGS+= -I./
+MPU_INCLUDE_CFLAGS+= -I./
+
+top_srcdir = ../..
+test_objs = host.o mpu1.task_eo mpu2.task_eo mpu3.task_eo
+timeout = 120
+
+include $(top_srcdir)/scripts/config.mk
+include $(top_srcdir)/scripts/rules_item.mk
+include $(top_srcdir)/scripts/rules_tpf.mk
+
+host.o: common.h
+mpu1.task_o: common.h
+mpu2.task_o: common.h
diff --git a/tests/TPF/TPF_20_002/common.h b/tests/TPF/TPF_20_002/common.h
new file mode 100644
index 0000000..b70ed4a
--- /dev/null
+++ b/tests/TPF/TPF_20_002/common.h
@@ -0,0 +1,45 @@
+/*
+ * Copyright 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/task.h>
+#include <mars_test.h>
+
+#define MAX_THREADS 16
+
+#define MIN_MPUS (spe/2)+1
+#define MAX_MPUS spe
+
+#define TEST1_ELEMENT_COUNT 4096
+
+#define ALIGN128 __attribute__((aligned(128)))
+
+struct test_task_args_st {
+ uint64_t barrier1_ea;
+ uint64_t barrier2_ea;
+ uint64_t ticks1_ea;
+ uint64_t ticks2_ea;
+ uint64_t ticks3_ea;
+ uint32_t tb_freq;
+ uint32_t pad[1];
+};
+
diff --git a/tests/TPF/TPF_20_002/host.c b/tests/TPF/TPF_20_002/host.c
new file mode 100644
index 0000000..4d49a41
--- /dev/null
+++ b/tests/TPF/TPF_20_002/host.c
@@ -0,0 +1,24 @@
+/*
+ * Copyright 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 "../TPF_20_001/host.c"
diff --git a/tests/TPF/TPF_20_002/mpu1.c b/tests/TPF/TPF_20_002/mpu1.c
new file mode 100644
index 0000000..c273dc3
--- /dev/null
+++ b/tests/TPF/TPF_20_002/mpu1.c
@@ -0,0 +1,24 @@
+/*
+ * Copyright 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 "../TPF_20_001/mpu1.c"
diff --git a/tests/TPF/TPF_20_002/mpu2.c b/tests/TPF/TPF_20_002/mpu2.c
new file mode 100644
index 0000000..d9d68d3
--- /dev/null
+++ b/tests/TPF/TPF_20_002/mpu2.c
@@ -0,0 +1,24 @@
+/*
+ * Copyright 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 "../TPF_20_001/mpu2.c"
diff --git a/tests/TPF/TPF_20_002/mpu3.c b/tests/TPF/TPF_20_002/mpu3.c
new file mode 100644
index 0000000..b0256c9
--- /dev/null
+++ b/tests/TPF/TPF_20_002/mpu3.c
@@ -0,0 +1,24 @@
+/*
+ * Copyright 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 "../TPF_20_001/mpu3.c"
diff --git a/tests/TPF/TPF_30_001/Makefile b/tests/TPF/TPF_30_001/Makefile
new file mode 100644
index 0000000..0bad622
--- /dev/null
+++ b/tests/TPF/TPF_30_001/Makefile
@@ -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.
+#
+
+EXTRA_LDFLAGS=-lm
+INCLUDE_CFLAGS+= -I./
+MPU_INCLUDE_CFLAGS+= -I./
+
+top_srcdir = ../..
+test_objs = host.o mpu1.task_eo
+timeout = 120
+
+include $(top_srcdir)/scripts/config.mk
+include $(top_srcdir)/scripts/rules_item.mk
+include $(top_srcdir)/scripts/rules_tpf.mk
+
+host.o: common.h
+mpu1.task_o: common.h
+mpu2.task_o: common.h
diff --git a/tests/TPF/TPF_30_001/common.h b/tests/TPF/TPF_30_001/common.h
new file mode 100644
index 0000000..15a460b
--- /dev/null
+++ b/tests/TPF/TPF_30_001/common.h
@@ -0,0 +1,43 @@
+/*
+ * Copyright 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/task.h>
+#include <mars_test.h>
+
+#define MIN_MPUS 1
+#define MAX_MPUS spe
+
+#define TEST1_ELEMENT_COUNT 4096
+
+#define ALIGN128 __attribute__((aligned(128)))
+
+struct test_task_args_st {
+ uint64_t ticks1_ea;
+ uint64_t ticks2_ea;
+ uint64_t sender_to_receiver_ea;
+ uint64_t receiver_to_sender_ea;
+ uint64_t eventflag_ea;
+ uint32_t tb_freq;
+ uint32_t pad[1];
+};
+
diff --git a/tests/TPF/TPF_30_001/host.c b/tests/TPF/TPF_30_001/host.c
new file mode 100644
index 0000000..ba5b1c1
--- /dev/null
+++ b/tests/TPF/TPF_30_001/host.c
@@ -0,0 +1,198 @@
+/*
+ * Copyright 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 <pthread.h>
+#include <libspe2.h>
+#include <mars/task.h>
+#include <mars_test.h>
+#include <unistd.h>
+#include <common.h>
+
+extern spe_program_handle_t mpu1_prog;
+
+struct thread_arg_st {
+ int32_t *ticks1;
+ int32_t *ticks2;
+ int32_t *ticks3;
+ struct mars_context *mars_ctx;
+};
+
+void *test_thread(void *arg)
+{
+ int ret, i;
+ struct thread_arg_st *thread_arg = arg;
+ int32_t *start1_ticks = thread_arg->ticks1;
+ int32_t *start2_ticks = thread_arg->ticks2;
+ int32_t *end_ticks = thread_arg->ticks3;
+ struct mars_context *mars_ctx = thread_arg->mars_ctx;
+ struct mars_task_id task_id;
+ struct mars_task_args task_args;
+ static __thread struct test_task_args_st args ALIGN128;
+ uint64_t eventflag;
+ uint32_t tb_freq;
+
+ uint32_t sender_to_receiver = UINT32_MAX;
+ uint32_t receiver_to_sender = UINT32_MAX;
+
+ ret = mars_task_create(mars_ctx, &task_id, NULL,
+ mpu1_prog.elf_image,
+ MARS_TASK_CONTEXT_SAVE_SIZE_MAX);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+
+ ret = mars_task_event_flag_create(mars_ctx, &eventflag,
+ MARS_TASK_EVENT_FLAG_MPU_TO_HOST,
+ MARS_TASK_EVENT_FLAG_CLEAR_AUTO);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+
+ ret = mars_test_get_timebase_freq(&tb_freq);
+ MARS_TEST_ASSERT_EQUAL(ret, 0);
+
+ args.sender_to_receiver_ea = mars_ptr_to_ea(&sender_to_receiver);
+ args.receiver_to_sender_ea = mars_ptr_to_ea(&receiver_to_sender);
+ args.eventflag_ea = eventflag;
+ args.tb_freq = tb_freq;
+ args.ticks1_ea = mars_ptr_to_ea(start1_ticks);
+ args.ticks2_ea = mars_ptr_to_ea(start2_ticks);
+ task_args.type.u64[0] = mars_ptr_to_ea(&args);
+
+ ret = mars_task_schedule(&task_id, &task_args, 0);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+
+ for (i = 0; i < TEST1_ELEMENT_COUNT; i++) {
+ mars_test_counter_set(&sender_to_receiver, i);
+ mars_test_counter_wait(&receiver_to_sender, i);
+
+ /* wait for the sender */
+ ret = mars_task_event_flag_wait(eventflag,
+ i+1, MARS_TASK_EVENT_FLAG_MASK_OR, NULL);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+
+ end_ticks[i] = mars_task_get_ticks();
+ }
+
+ ret = mars_task_wait(&task_id, NULL);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+
+ ret = mars_task_destroy(&task_id);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+
+ return NULL;
+}
+
+void test1(int mpu, pthread_t * threads, struct thread_arg_st *thread_args)
+{
+ int ret, i;
+ size_t size;
+ int32_t *start1_ticks,*start2_ticks, *end_ticks, *ticks;
+ char text[128];
+ struct mars_context *mars_ctx;
+
+ size = sizeof(uint32_t) * TEST1_ELEMENT_COUNT * mpu;
+
+ ret = posix_memalign((void **)&start1_ticks, 128, size);
+ MARS_TEST_ASSERT_EQUAL(ret, 0);
+
+ ret = posix_memalign((void **)&start2_ticks, 128, size);
+ MARS_TEST_ASSERT_EQUAL(ret, 0);
+
+ ret = posix_memalign((void **)&end_ticks, 128, size);
+ MARS_TEST_ASSERT_EQUAL(ret, 0);
+
+ ret = posix_memalign((void **)&ticks, 128, size);
+ MARS_TEST_ASSERT_EQUAL(ret, 0);
+
+ ret = mars_context_create(&mars_ctx, 0, 1);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+
+ for (i = 0; i < mpu; i++) {
+ thread_args[i].ticks1 = &start1_ticks[TEST1_ELEMENT_COUNT * i];
+ thread_args[i].ticks2 = &start2_ticks[TEST1_ELEMENT_COUNT * i];
+ thread_args[i].ticks3 = &end_ticks[TEST1_ELEMENT_COUNT * i];
+ thread_args[i].mars_ctx = mars_ctx;
+ ret = pthread_create(&threads[i], NULL, test_thread,
+ &thread_args[i]);
+ MARS_TEST_ASSERT_EQUAL(ret, 0);
+ }
+
+ for (i = 0; i < mpu; i++) {
+ ret = pthread_join(threads[i], NULL);
+ MARS_TEST_ASSERT_EQUAL(ret, 0);
+ }
+
+ ret = mars_context_destroy(mars_ctx);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+
+ size = TEST1_ELEMENT_COUNT * mpu;
+
+ for (i = 0; i < size; i++) {
+ ticks[i] = start2_ticks[i] - start1_ticks[i];
+ }
+ sprintf(text, "event flag host-mpu: event (%d mpu)", mpu);
+ mars_test_print_statistics(ticks, size, text);
+
+ for (i = 0; i < size; i++) {
+ ticks[i] = end_ticks[i] - start1_ticks[i];
+ }
+ sprintf(text, "event flag host-mpu: start event - end wait (%d mpu)", mpu);
+ mars_test_print_statistics(ticks, size, text);
+
+ for (i = 0; i < size; i++) {
+ ticks[i] = end_ticks[i] - start2_ticks[i];
+ }
+ sprintf(text, "event flag host-mpu: end event - end wait (%d mpu)", mpu);
+ mars_test_print_statistics(ticks, size, text);
+
+
+ free(start1_ticks);
+ free(start2_ticks);
+ free(end_ticks);
+ free(ticks);
+}
+
+int main(int argc, char *argv[])
+{
+ int mpu,spe;
+ size_t size;
+ pthread_t *threads;
+ struct thread_arg_st *thread_args;
+
+ spe = spe_cpu_info_get(SPE_COUNT_PHYSICAL_SPES, -1);
+
+ for (mpu = MIN_MPUS; mpu <= MAX_MPUS; mpu++) {
+
+ threads = (pthread_t *) malloc(sizeof(pthread_t) * mpu);
+ MARS_TEST_ASSERT(threads != NULL);
+
+ size = sizeof(struct thread_arg_st) * mpu;
+ thread_args = (struct thread_arg_st *)malloc(size);
+ MARS_TEST_ASSERT(thread_args != NULL);
+
+ MARS_TEST_PERF_INIT();
+
+ test1(mpu, threads, thread_args);
+ free(thread_args);
+ free(threads);
+ }
+
+ return 0;
+}
diff --git a/tests/TPF/TPF_30_001/mpu1.c b/tests/TPF/TPF_30_001/mpu1.c
new file mode 100644
index 0000000..455f4a9
--- /dev/null
+++ b/tests/TPF/TPF_30_001/mpu1.c
@@ -0,0 +1,63 @@
+/*
+ * Copyright 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/task.h>
+#include <mars_test.h>
+#include <common.h>
+
+int mars_task_main(const struct mars_task_args *task_args)
+{
+ int ret, i;
+ static struct test_task_args_st args ALIGN128;
+ int start1_ticks[TEST1_ELEMENT_COUNT] ALIGN128;
+ int start2_ticks[TEST1_ELEMENT_COUNT] ALIGN128;
+
+ mfc_get(&args, task_args->type.u64[0], sizeof(struct test_task_args_st),
+ 0, 0, 0);
+ mfc_write_tag_mask(1);
+ mfc_read_tag_status_all();
+
+ for (i = 0; i < TEST1_ELEMENT_COUNT; i++) {
+ mars_test_counter_wait(args.sender_to_receiver_ea, i);
+ mars_test_counter_set(args.receiver_to_sender_ea, i);
+ MARS_TEST_ASSERT_EQUAL(ret, 0);
+
+ mars_test_usleep(args.tb_freq, DELAY); /*give wait task time to block*/
+
+ start1_ticks[i] = mars_task_get_ticks();
+ /* notify the sender */
+ ret = mars_task_event_flag_set(args.eventflag_ea, i+1);
+ start2_ticks[i] = mars_task_get_ticks();
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+ }
+
+ mfc_put(start1_ticks, args.ticks1_ea, TEST1_ELEMENT_COUNT * 4, 0, 0, 0);
+ mfc_write_tag_mask(1);
+ mfc_read_tag_status_all();
+
+ mfc_put(start2_ticks, args.ticks2_ea, TEST1_ELEMENT_COUNT * 4, 0, 0, 0);
+ mfc_write_tag_mask(1);
+ mfc_read_tag_status_all();
+
+ return 0;
+}
diff --git a/tests/TPF/TPF_30_002/Makefile b/tests/TPF/TPF_30_002/Makefile
new file mode 100644
index 0000000..4a5a01a
--- /dev/null
+++ b/tests/TPF/TPF_30_002/Makefile
@@ -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.
+#
+
+EXTRA_LDFLAGS=-lm
+INCLUDE_CFLAGS+= -I./
+MPU_INCLUDE_CFLAGS+= -I./
+
+top_srcdir = ../..
+test_objs = host.o mpu1.task_eo
+timeout = 240
+
+include $(top_srcdir)/scripts/config.mk
+include $(top_srcdir)/scripts/rules_item.mk
+include $(top_srcdir)/scripts/rules_tpf.mk
+
+host.o: common.h
+mpu1.task_o: common.h
+mpu2.task_o: common.h
diff --git a/tests/TPF/TPF_30_002/common.h b/tests/TPF/TPF_30_002/common.h
new file mode 100644
index 0000000..bbf4eac
--- /dev/null
+++ b/tests/TPF/TPF_30_002/common.h
@@ -0,0 +1,43 @@
+/*
+ * Copyright 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/task.h>
+#include <mars_test.h>
+
+#define MIN_MPUS spe+1
+#define MAX_MPUS spe*2
+
+#define TEST1_ELEMENT_COUNT 4096
+
+#define ALIGN128 __attribute__((aligned(128)))
+
+struct test_task_args_st {
+ uint64_t ticks1_ea;
+ uint64_t ticks2_ea;
+ uint64_t sender_to_receiver_ea;
+ uint64_t receiver_to_sender_ea;
+ uint64_t eventflag_ea;
+ uint32_t tb_freq;
+ uint32_t pad[1];
+};
+
diff --git a/tests/TPF/TPF_30_002/host.c b/tests/TPF/TPF_30_002/host.c
new file mode 100644
index 0000000..3b2332c
--- /dev/null
+++ b/tests/TPF/TPF_30_002/host.c
@@ -0,0 +1,24 @@
+/*
+ * Copyright 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 "../TPF_30_001/host.c"
diff --git a/tests/TPF/TPF_30_002/mpu1.c b/tests/TPF/TPF_30_002/mpu1.c
new file mode 100644
index 0000000..efa9458
--- /dev/null
+++ b/tests/TPF/TPF_30_002/mpu1.c
@@ -0,0 +1,24 @@
+/*
+ * Copyright 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 "../TPF_30_001/mpu1.c"
diff --git a/tests/TPF/TPF_30_003/Makefile b/tests/TPF/TPF_30_003/Makefile
new file mode 100644
index 0000000..dc68b86
--- /dev/null
+++ b/tests/TPF/TPF_30_003/Makefile
@@ -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.
+#
+
+EXTRA_LDFLAGS=-lm
+INCLUDE_CFLAGS+= -I./
+MPU_INCLUDE_CFLAGS+= -I./
+
+top_srcdir = ../..
+test_objs = host.o mpu1.task_eo mpu2.task_eo
+timeout = 120
+
+include $(top_srcdir)/scripts/config.mk
+include $(top_srcdir)/scripts/rules_item.mk
+include $(top_srcdir)/scripts/rules_tpf.mk
+
+host.o: common.h
+mpu1.task_o: common.h
+mpu2.task_o: common.h
diff --git a/tests/TPF/TPF_30_003/common.h b/tests/TPF/TPF_30_003/common.h
new file mode 100644
index 0000000..cf62a37
--- /dev/null
+++ b/tests/TPF/TPF_30_003/common.h
@@ -0,0 +1,43 @@
+/*
+ * Copyright 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/task.h>
+#include <mars_test.h>
+
+#define MIN_MPUS 1
+#define MAX_MPUS spe/2
+
+#define TEST1_ELEMENT_COUNT 4096
+
+#define ALIGN128 __attribute__((aligned(128)))
+
+struct test_task_args_st {
+ uint64_t barrier_ea;
+ uint64_t eventflag_ea;
+ uint64_t ticks1_ea;
+ uint64_t ticks2_ea;
+ uint64_t ticks3_ea;
+ uint32_t tb_freq;
+ uint32_t pad[1];
+};
+
diff --git a/tests/TPF/TPF_30_003/host.c b/tests/TPF/TPF_30_003/host.c
new file mode 100644
index 0000000..86827d5
--- /dev/null
+++ b/tests/TPF/TPF_30_003/host.c
@@ -0,0 +1,205 @@
+/*
+ * Copyright 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 <pthread.h>
+#include <libspe2.h>
+#include <mars/task.h>
+#include <mars_test.h>
+#include <string.h>
+#include <unistd.h>
+#include <common.h>
+
+extern spe_program_handle_t mpu1_prog, mpu2_prog;
+
+struct thread_arg_st {
+ int32_t *ticks1;
+ int32_t *ticks2;
+ int32_t *ticks3;
+ struct mars_context *mars_ctx;
+};
+
+void *test_thread(void *arg)
+{
+ int ret;
+ struct thread_arg_st *thread_arg = arg;
+ int32_t *start1_ticks = thread_arg->ticks1;
+ int32_t *start2_ticks = thread_arg->ticks2;
+ int32_t *end_ticks = thread_arg->ticks3;
+ struct mars_context *mars_ctx = thread_arg->mars_ctx;
+ struct mars_task_id task_id_send, task_id_wait;
+ struct mars_task_args task_args_send, task_args_wait;
+ static __thread struct test_task_args_st args ALIGN128;
+ uint64_t barrier;
+ uint64_t eventflag;
+
+ ret = mars_task_create(mars_ctx, &task_id_send, NULL,
+ mpu1_prog.elf_image,
+ MARS_TASK_CONTEXT_SAVE_SIZE_MAX);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+
+ ret = mars_task_create(mars_ctx, &task_id_wait, NULL,
+ mpu2_prog.elf_image,
+ MARS_TASK_CONTEXT_SAVE_SIZE_MAX);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+
+ ret = mars_task_event_flag_create(mars_ctx, &eventflag,
+ MARS_TASK_EVENT_FLAG_MPU_TO_MPU,
+ MARS_TASK_EVENT_FLAG_CLEAR_AUTO);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+
+ ret = mars_task_barrier_create(mars_ctx, &barrier, 2);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+
+ ret = mars_test_get_timebase_freq(&args.tb_freq);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+
+ args.barrier_ea = barrier;
+ args.eventflag_ea = eventflag;
+ args.ticks1_ea = mars_ptr_to_ea(start1_ticks);
+ args.ticks2_ea = mars_ptr_to_ea(start2_ticks);
+ args.ticks3_ea = mars_ptr_to_ea(end_ticks);
+ task_args_send.type.u64[0] = mars_ptr_to_ea(&args);
+ task_args_wait.type.u64[0] = mars_ptr_to_ea(&args);
+
+ ret = mars_task_schedule(&task_id_send, &task_args_send, 0);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+
+ ret = mars_task_schedule(&task_id_wait, &task_args_wait, 0);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+
+ ret = mars_task_wait(&task_id_send, NULL);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+
+ ret = mars_task_wait(&task_id_wait, NULL);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+
+ ret = mars_task_barrier_destroy(barrier);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+
+ ret = mars_task_destroy(&task_id_send);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+
+ ret = mars_task_destroy(&task_id_wait);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+
+ return NULL;
+}
+
+void test1(int mpu, pthread_t * threads,
+ struct thread_arg_st *thread_args)
+{
+ int ret, i;
+ char buffer[64];
+ size_t size;
+ int32_t *start1_ticks, *start2_ticks, *end_ticks, *ticks;
+ struct mars_context *mars_ctx;
+
+ size = sizeof(uint32_t) * TEST1_ELEMENT_COUNT * mpu;
+
+ ret = posix_memalign((void **)&start1_ticks, 128, size);
+ MARS_TEST_ASSERT_EQUAL(ret, 0);
+
+ ret = posix_memalign((void **)&start2_ticks, 128, size);
+ MARS_TEST_ASSERT_EQUAL(ret, 0);
+
+ ret = posix_memalign((void **)&end_ticks, 128, size);
+ MARS_TEST_ASSERT_EQUAL(ret, 0);
+
+ ret = posix_memalign((void **)&ticks, 128, size);
+ MARS_TEST_ASSERT_EQUAL(ret, 0);
+
+ ret = mars_context_create(&mars_ctx, 0, 1);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+
+ for (i = 0; i < mpu; i++) {
+ thread_args[i].ticks1 = &start1_ticks[TEST1_ELEMENT_COUNT * i];
+ thread_args[i].ticks2 = &start2_ticks[TEST1_ELEMENT_COUNT * i];
+ thread_args[i].ticks3 = &end_ticks[TEST1_ELEMENT_COUNT * i];
+ thread_args[i].mars_ctx = mars_ctx;
+ ret = pthread_create(&threads[i], NULL, test_thread,
+ &thread_args[i]);
+ MARS_TEST_ASSERT_EQUAL(ret, 0);
+ }
+
+ for (i = 0; i < mpu; i++) {
+ ret = pthread_join(threads[i], NULL);
+ MARS_TEST_ASSERT_EQUAL(ret, 0);
+ }
+
+ ret = mars_context_destroy(mars_ctx);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+
+ size = TEST1_ELEMENT_COUNT * mpu;
+
+ for (i = 0; i < size; i++) {
+ ticks[i] = start2_ticks[i] - start1_ticks[i];
+ }
+ sprintf(buffer, "event flag mpu-mpu: event (%d mpu pairs)", mpu);
+ mars_test_print_statistics(ticks, size, buffer);
+
+ for (i = 0; i < size; i++) {
+ ticks[i] = end_ticks[i] - start1_ticks[i];
+ }
+ sprintf(buffer, "event flag mpu-mpu: start event - end wait (%d mpu pairs)", mpu);
+ mars_test_print_statistics(ticks, size, buffer);
+
+ for (i = 0; i < size; i++) {
+ ticks[i] = end_ticks[i] - start2_ticks[i];
+ }
+ sprintf(buffer, "event flag mpu-mpu: end event - end wait (%d mpu pairs)", mpu);
+ mars_test_print_statistics(ticks, size, buffer);
+
+ free(start1_ticks);
+ free(start2_ticks);
+ free(end_ticks);
+ free(ticks);
+}
+
+int main(int argc, char *argv[])
+{
+ int mpu,spe;
+ size_t size;
+ pthread_t *threads;
+ struct thread_arg_st *thread_args;
+
+ spe = spe_cpu_info_get(SPE_COUNT_PHYSICAL_SPES, -1);
+
+ for(mpu = MIN_MPUS; mpu<=MAX_MPUS; mpu++){
+
+ threads = (pthread_t *) malloc(sizeof(pthread_t) * mpu);
+ MARS_TEST_ASSERT(threads != NULL);
+
+ size = sizeof(struct thread_arg_st) * mpu;
+ thread_args = (struct thread_arg_st *)malloc(size);
+ MARS_TEST_ASSERT(thread_args != NULL);
+
+ MARS_TEST_PERF_INIT();
+
+ test1(mpu, threads, thread_args);
+
+ free(thread_args);
+ free(threads);
+ }
+
+ return 0;
+}
diff --git a/tests/TPF/TPF_30_003/mpu1.c b/tests/TPF/TPF_30_003/mpu1.c
new file mode 100644
index 0000000..d394d3c
--- /dev/null
+++ b/tests/TPF/TPF_30_003/mpu1.c
@@ -0,0 +1,63 @@
+/*
+ * Copyright 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/task.h>
+#include <mars_test.h>
+#include <common.h>
+
+int mars_task_main(const struct mars_task_args *task_args)
+{
+ int ret, i;
+ static struct test_task_args_st args ALIGN128;
+ static uint32_t start1_ticks[TEST1_ELEMENT_COUNT] ALIGN128;
+ static uint32_t start2_ticks[TEST1_ELEMENT_COUNT] ALIGN128;
+
+ mfc_get(&args, task_args->type.u64[0], sizeof(struct test_task_args_st),
+ 0, 0, 0);
+ mfc_write_tag_mask(1);
+ mfc_read_tag_status_all();
+
+ for (i = 0; i < TEST1_ELEMENT_COUNT; i++) {
+ ret = mars_task_barrier_notify(args.barrier_ea);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+ ret = mars_task_barrier_wait(args.barrier_ea);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+
+ mars_test_usleep(args.tb_freq, DELAY); /*give wait task time to block */
+
+ start1_ticks[i] = mars_task_get_ticks();
+ /* notify the sender */
+ ret = mars_task_event_flag_set(args.eventflag_ea, i+1);
+ start2_ticks[i] = mars_task_get_ticks();
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+ }
+
+ mfc_put(start1_ticks, args.ticks1_ea, TEST1_ELEMENT_COUNT * 4, 0, 0, 0);
+ mfc_write_tag_mask(1);
+ mfc_read_tag_status_all();
+
+ mfc_put(start2_ticks, args.ticks2_ea, TEST1_ELEMENT_COUNT * 4, 0, 0, 0);
+ mfc_write_tag_mask(1);
+ mfc_read_tag_status_all();
+ return 0;
+}
diff --git a/tests/TPF/TPF_30_003/mpu2.c b/tests/TPF/TPF_30_003/mpu2.c
new file mode 100644
index 0000000..aca0972
--- /dev/null
+++ b/tests/TPF/TPF_30_003/mpu2.c
@@ -0,0 +1,57 @@
+/*
+ * Copyright 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/task.h>
+#include <mars_test.h>
+#include <common.h>
+
+int mars_task_main(const struct mars_task_args *task_args)
+{
+ int ret, i;
+ static struct test_task_args_st args ALIGN128;
+ static uint32_t end_ticks[TEST1_ELEMENT_COUNT] ALIGN128;
+
+ mfc_get(&args, task_args->type.u64[0], sizeof(struct test_task_args_st),
+ 0, 0, 0);
+ mfc_write_tag_mask(1);
+ mfc_read_tag_status_all();
+
+ for (i = 0; i < TEST1_ELEMENT_COUNT; i++) {
+ ret = mars_task_barrier_notify(args.barrier_ea);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+ ret = mars_task_barrier_wait(args.barrier_ea);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+
+ /* wait for the sender */
+ ret = mars_task_event_flag_wait(args.eventflag_ea,
+ i+1, MARS_TASK_EVENT_FLAG_MASK_OR, NULL);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+ end_ticks[i] = mars_task_get_ticks();
+ }
+
+ mfc_put(end_ticks, args.ticks3_ea, TEST1_ELEMENT_COUNT * 4, 0, 0, 0);
+ mfc_write_tag_mask(1);
+ mfc_read_tag_status_all();
+
+ return 0;
+}
diff --git a/tests/TPF/TPF_30_004/Makefile b/tests/TPF/TPF_30_004/Makefile
new file mode 100644
index 0000000..dc68b86
--- /dev/null
+++ b/tests/TPF/TPF_30_004/Makefile
@@ -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.
+#
+
+EXTRA_LDFLAGS=-lm
+INCLUDE_CFLAGS+= -I./
+MPU_INCLUDE_CFLAGS+= -I./
+
+top_srcdir = ../..
+test_objs = host.o mpu1.task_eo mpu2.task_eo
+timeout = 120
+
+include $(top_srcdir)/scripts/config.mk
+include $(top_srcdir)/scripts/rules_item.mk
+include $(top_srcdir)/scripts/rules_tpf.mk
+
+host.o: common.h
+mpu1.task_o: common.h
+mpu2.task_o: common.h
diff --git a/tests/TPF/TPF_30_004/common.h b/tests/TPF/TPF_30_004/common.h
new file mode 100644
index 0000000..9b45cda
--- /dev/null
+++ b/tests/TPF/TPF_30_004/common.h
@@ -0,0 +1,43 @@
+/*
+ * Copyright 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/task.h>
+#include <mars_test.h>
+
+#define MIN_MPUS spe/2+1
+#define MAX_MPUS spe
+
+#define TEST1_ELEMENT_COUNT 4096
+
+#define ALIGN128 __attribute__((aligned(128)))
+
+struct test_task_args_st {
+ uint64_t barrier_ea;
+ uint64_t eventflag_ea;
+ uint64_t ticks1_ea;
+ uint64_t ticks2_ea;
+ uint64_t ticks3_ea;
+ uint32_t tb_freq;
+ uint32_t pad[1];
+};
+
diff --git a/tests/TPF/TPF_30_004/host.c b/tests/TPF/TPF_30_004/host.c
new file mode 100644
index 0000000..7e53a57
--- /dev/null
+++ b/tests/TPF/TPF_30_004/host.c
@@ -0,0 +1,24 @@
+/*
+ * Copyright 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 "../TPF_30_003/host.c"
diff --git a/tests/TPF/TPF_30_004/mpu1.c b/tests/TPF/TPF_30_004/mpu1.c
new file mode 100644
index 0000000..1cde6f2
--- /dev/null
+++ b/tests/TPF/TPF_30_004/mpu1.c
@@ -0,0 +1,24 @@
+/*
+ * Copyright 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 "../TPF_30_003/mpu1.c"
diff --git a/tests/TPF/TPF_30_004/mpu2.c b/tests/TPF/TPF_30_004/mpu2.c
new file mode 100644
index 0000000..466e7fe
--- /dev/null
+++ b/tests/TPF/TPF_30_004/mpu2.c
@@ -0,0 +1,24 @@
+/*
+ * Copyright 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 "../TPF_30_003/mpu2.c"
diff --git a/tests/TPF/TPF_40_001/Makefile b/tests/TPF/TPF_40_001/Makefile
new file mode 100644
index 0000000..e498594
--- /dev/null
+++ b/tests/TPF/TPF_40_001/Makefile
@@ -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.
+#
+
+EXTRA_LDFLAGS=-lm
+
+top_srcdir = ../..
+test_objs = host.o mpu1.task_eo mpu2.task_eo mpu3.task_eo
+timeout = 120
+
+include $(top_srcdir)/scripts/config.mk
+include $(top_srcdir)/scripts/rules_item.mk
+include $(top_srcdir)/scripts/rules_tpf.mk
+
+host.o: common.h
+mpu1.task_o: common.h
+mpu2.task_o: common.h
+mpu3.task_o: common.h
diff --git a/tests/TPF/TPF_40_001/common.h b/tests/TPF/TPF_40_001/common.h
new file mode 100644
index 0000000..a590dd2
--- /dev/null
+++ b/tests/TPF/TPF_40_001/common.h
@@ -0,0 +1,78 @@
+/*
+ * Copyright 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/task.h>
+#include <mars_test.h>
+
+#define QUEUE_DEPTH 16
+#define ELEMENT_SIZE 128
+#define TEST1_ELEMENT_COUNT 4096
+#define TEST2_ELEMENT_COUNT 4096
+#define TEST3_ELEMENT_COUNT 4096
+
+#define ALIGN128 __attribute__((aligned(128)))
+
+struct test_task_args_st {
+ uint64_t queue_ea;
+ uint64_t sender_to_receiver_ea;
+ uint64_t receiver_to_sender_ea;
+ uint64_t shared_resource_ea;
+ uint64_t ticks1_ea;
+ uint64_t ticks2_ea;
+ uint32_t tb_freq;
+ uint8_t pad[12];
+};
+
+/* magic to avoid the page faults during the test */
+#ifdef __SPU__
+static inline void suppress_page_faults(
+ uint64_t queue_ea, char *buf, int sender)
+{
+ int i, ret;
+
+ for (i = 0; i < QUEUE_DEPTH; i++) {
+ if (sender)
+ ret = mars_task_queue_push(queue_ea, buf);
+ else
+ ret = mars_task_queue_pop(queue_ea, buf);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+ }
+
+ mars_task_yield();
+}
+#else
+static inline void suppress_page_faults(
+ uint64_t queue, char *buf, int sender)
+{
+ int i, ret;
+
+ for (i = 0; i < QUEUE_DEPTH; i++) {
+ if (sender)
+ ret = mars_task_queue_push(queue, buf);
+ else
+ ret = mars_task_queue_pop(queue, buf);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+ }
+}
+#endif
+
diff --git a/tests/TPF/TPF_40_001/host.c b/tests/TPF/TPF_40_001/host.c
new file mode 100644
index 0000000..7894819
--- /dev/null
+++ b/tests/TPF/TPF_40_001/host.c
@@ -0,0 +1,236 @@
+/*
+ * Copyright 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/task.h>
+#include <mars_test.h>
+#include "common.h"
+
+extern spe_program_handle_t mpu1_prog, mpu2_prog, mpu3_prog;
+
+void test1()
+{
+ int ret, i;
+ uint32_t start, end;
+ int32_t push_ticks[TEST1_ELEMENT_COUNT];
+ static int32_t pop_ticks[TEST1_ELEMENT_COUNT] ALIGN128;
+ uint32_t sender_to_receiver = UINT32_MAX;
+ uint32_t receiver_to_sender = UINT32_MAX;
+ char buf[ELEMENT_SIZE];
+ struct mars_context *mars_ctx;
+ struct mars_task_id task_id;
+ struct mars_task_args task_args;
+ uint64_t queue;
+ static struct test_task_args_st args ALIGN128;
+
+ ret = mars_context_create(&mars_ctx, 0, 0);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+
+ ret = mars_task_queue_create(mars_ctx, &queue,
+ ELEMENT_SIZE, QUEUE_DEPTH, MARS_TASK_QUEUE_HOST_TO_MPU);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+
+ ret = mars_task_create(mars_ctx, &task_id, NULL,
+ mpu1_prog.elf_image, MARS_TASK_CONTEXT_SAVE_SIZE_MAX);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+
+ args.queue_ea = queue;
+ args.sender_to_receiver_ea = mars_ptr_to_ea(&sender_to_receiver);
+ args.receiver_to_sender_ea = mars_ptr_to_ea(&receiver_to_sender);
+ args.ticks1_ea = mars_ptr_to_ea(pop_ticks);
+ task_args.type.u64[0] = mars_ptr_to_ea(&args);
+
+ ret = mars_task_schedule(&task_id, &task_args, 0);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+
+ for (i = 0; i < TEST1_ELEMENT_COUNT; i++) {
+ start = mars_task_get_ticks();
+ ret = mars_task_queue_push(queue, buf);
+ end = mars_task_get_ticks();
+ push_ticks[i] = end - start;
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+ mars_test_counter_set(&sender_to_receiver, i);
+ mars_test_counter_wait(&receiver_to_sender, i);
+ }
+
+ ret = mars_task_wait(&task_id, NULL);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+
+ ret = mars_task_destroy(&task_id);
+ 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_ctx);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+
+ mars_test_print_statistics(push_ticks, TEST1_ELEMENT_COUNT, "push");
+ mars_test_print_statistics(pop_ticks, TEST1_ELEMENT_COUNT, "pop");
+}
+
+void test2()
+{
+ int ret, i;
+ uint32_t start, end;
+ int32_t ticks[TEST2_ELEMENT_COUNT];
+ uint32_t sender_to_receiver = UINT32_MAX;
+ uint32_t receiver_to_sender = UINT32_MAX;
+ char buf[ELEMENT_SIZE];
+ struct mars_context *mars_ctx;
+ struct mars_task_id task_id;
+ struct mars_task_args task_args;
+ uint64_t queue;
+ static struct test_task_args_st args ALIGN128;
+
+ ret = mars_context_create(&mars_ctx, 0, 0);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+
+ ret = mars_task_queue_create(mars_ctx, &queue,
+ ELEMENT_SIZE, QUEUE_DEPTH, MARS_TASK_QUEUE_HOST_TO_MPU);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+
+ ret = mars_task_create(mars_ctx, &task_id, NULL,
+ mpu2_prog.elf_image, MARS_TASK_CONTEXT_SAVE_SIZE_MAX);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+
+ args.queue_ea = queue;
+ args.sender_to_receiver_ea = mars_ptr_to_ea(&sender_to_receiver);
+ args.receiver_to_sender_ea = mars_ptr_to_ea(&receiver_to_sender);
+ args.shared_resource_ea = mars_ptr_to_ea(&end);
+ task_args.type.u64[0] = mars_ptr_to_ea(&args);
+
+ ret = mars_task_schedule(&task_id, &task_args, 0);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+
+ suppress_page_faults(queue, buf, 1);
+
+ for (i = 0; i < TEST2_ELEMENT_COUNT; i++) {
+ mars_test_counter_wait(&receiver_to_sender, i * 2);
+ mars_test_counter_set(&sender_to_receiver, i * 2);
+
+ /* wait for the MARS task blocked */
+ usleep(DELAY);
+
+ start = mars_task_get_ticks();
+ ret = mars_task_queue_push(queue, buf);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+
+ mars_test_counter_wait(&receiver_to_sender, i * 2 + 1);
+ ticks[i] = end - start;
+ mars_test_counter_set(&sender_to_receiver, i * 2 + 1);
+ }
+
+ ret = mars_task_wait(&task_id, NULL);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+
+ ret = mars_task_destroy(&task_id);
+ 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_ctx);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+
+ mars_test_print_statistics(
+ ticks, TEST2_ELEMENT_COUNT, "beginning of push - end of pop");
+}
+
+void test3()
+{
+ int ret, i;
+ uint32_t start, end;
+ int32_t ticks[TEST3_ELEMENT_COUNT];
+ uint32_t sender_to_receiver = UINT32_MAX;
+ uint32_t receiver_to_sender = UINT32_MAX;
+ char buf[ELEMENT_SIZE];
+ struct mars_context *mars_ctx;
+ struct mars_task_id task_id;
+ struct mars_task_args task_args;
+ uint64_t queue;
+ static struct test_task_args_st args ALIGN128;
+
+ ret = mars_context_create(&mars_ctx, 0, 0);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+
+ ret = mars_task_queue_create(mars_ctx, &queue,
+ ELEMENT_SIZE, QUEUE_DEPTH, MARS_TASK_QUEUE_HOST_TO_MPU);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+
+ ret = mars_task_create(mars_ctx, &task_id, NULL,
+ mpu3_prog.elf_image, MARS_TASK_CONTEXT_SAVE_SIZE_MAX);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+
+ args.queue_ea = queue;
+ args.sender_to_receiver_ea = mars_ptr_to_ea(&sender_to_receiver);
+ args.receiver_to_sender_ea = mars_ptr_to_ea(&receiver_to_sender);
+ args.shared_resource_ea = mars_ptr_to_ea(&end);
+ task_args.type.u64[0] = mars_ptr_to_ea(&args);
+
+ ret = mars_task_schedule(&task_id, &task_args, 0);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+
+ suppress_page_faults(queue, buf, 1);
+
+ for (i = 0; i < TEST3_ELEMENT_COUNT; i++) {
+ mars_test_counter_wait(&receiver_to_sender, i * 2);
+ mars_test_counter_set(&sender_to_receiver, i * 2);
+
+ /* wait for the MARS task blocked */
+ usleep(DELAY);
+
+ ret = mars_task_queue_push(queue, buf);
+ start = mars_task_get_ticks();
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+
+ mars_test_counter_wait(&receiver_to_sender, i * 2 + 1);
+ ticks[i] = end - start;
+ mars_test_counter_set(&sender_to_receiver, i * 2 + 1);
+ }
+
+ ret = mars_task_wait(&task_id, NULL);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+
+ ret = mars_task_destroy(&task_id);
+ 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_ctx);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+
+ mars_test_print_statistics(
+ ticks, TEST3_ELEMENT_COUNT, "end of push - end of pop");
+}
+int main(int argc, char *argv[])
+{
+ MARS_TEST_PERF_INIT();
+
+ test1();
+ test2();
+ test3();
+
+ return 0;
+}
diff --git a/tests/TPF/TPF_40_001/mpu1.c b/tests/TPF/TPF_40_001/mpu1.c
new file mode 100644
index 0000000..7172948
--- /dev/null
+++ b/tests/TPF/TPF_40_001/mpu1.c
@@ -0,0 +1,57 @@
+/*
+ * Copyright 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/task.h>
+#include <mars_test.h>
+#include "common.h"
+
+int mars_task_main(const struct mars_task_args *task_args)
+{
+ int ret, i;
+ uint32_t start, end;
+ char buf[ELEMENT_SIZE];
+ static struct test_task_args_st args ALIGN128;
+ static int32_t pop_ticks[TEST1_ELEMENT_COUNT] ALIGN128;
+
+ mfc_get(&args, task_args->type.u64[0],
+ sizeof(struct test_task_args_st), 0, 0, 0);
+ mfc_write_tag_mask(1);
+ mfc_read_tag_status_all();
+
+ for (i = 0; i < TEST1_ELEMENT_COUNT; i++) {
+ mars_test_counter_wait(args.sender_to_receiver_ea, i);
+ start = mars_task_get_ticks();
+ ret = mars_task_queue_pop(args.queue_ea, buf);
+ end = mars_task_get_ticks();
+ pop_ticks[i] = end - start;
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+ mars_test_counter_set(args.receiver_to_sender_ea, i);
+ }
+
+ mfc_put(pop_ticks, args.ticks1_ea, sizeof(pop_ticks), 0, 0, 0);
+ mfc_write_tag_mask(1);
+ mfc_read_tag_status_all();
+
+ return 0;
+}
diff --git a/tests/TPF/TPF_40_001/mpu2.c b/tests/TPF/TPF_40_001/mpu2.c
new file mode 100644
index 0000000..f56120a
--- /dev/null
+++ b/tests/TPF/TPF_40_001/mpu2.c
@@ -0,0 +1,57 @@
+/*
+ * Copyright 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/task.h>
+#include <mars_test.h>
+#include "common.h"
+
+int mars_task_main(const struct mars_task_args *task_args)
+{
+ int ret, i;
+ uint32_t end;
+ char buf[ELEMENT_SIZE];
+ static struct test_task_args_st args ALIGN128;
+
+ mfc_get(&args, task_args->type.u64[0],
+ sizeof(struct test_task_args_st), 0, 0, 0);
+ mfc_write_tag_mask(1);
+ mfc_read_tag_status_all();
+
+ suppress_page_faults(args.queue_ea, buf, 0);
+
+ for (i = 0; i < TEST2_ELEMENT_COUNT; i++) {
+ mars_test_counter_set(args.receiver_to_sender_ea, i * 2);
+ mars_test_counter_wait(args.sender_to_receiver_ea, i * 2);
+
+ ret = mars_task_queue_pop(args.queue_ea, buf);
+ end = mars_task_get_ticks();
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+
+ mars_test_int32_put(args.shared_resource_ea, end);
+ mars_test_counter_set(args.receiver_to_sender_ea, i * 2 + 1);
+ mars_test_counter_wait(args.sender_to_receiver_ea, i * 2 + 1);
+ }
+
+ return 0;
+}
diff --git a/tests/TPF/TPF_40_001/mpu3.c b/tests/TPF/TPF_40_001/mpu3.c
new file mode 100644
index 0000000..2653be8
--- /dev/null
+++ b/tests/TPF/TPF_40_001/mpu3.c
@@ -0,0 +1,57 @@
+/*
+ * Copyright 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/task.h>
+#include <mars_test.h>
+#include "common.h"
+
+int mars_task_main(const struct mars_task_args *task_args)
+{
+ int ret, i;
+ uint32_t end;
+ char buf[ELEMENT_SIZE];
+ static struct test_task_args_st args ALIGN128;
+
+ mfc_get(&args, task_args->type.u64[0],
+ sizeof(struct test_task_args_st), 0, 0, 0);
+ mfc_write_tag_mask(1);
+ mfc_read_tag_status_all();
+
+ suppress_page_faults(args.queue_ea, buf, 0);
+
+ for (i = 0; i < TEST3_ELEMENT_COUNT; i++) {
+ mars_test_counter_set(args.receiver_to_sender_ea, i * 2);
+ mars_test_counter_wait(args.sender_to_receiver_ea, i * 2);
+
+ ret = mars_task_queue_pop(args.queue_ea, buf);
+ end = mars_task_get_ticks();
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+
+ mars_test_int32_put(args.shared_resource_ea, end);
+ mars_test_counter_set(args.receiver_to_sender_ea, i * 2 + 1);
+ mars_test_counter_wait(args.sender_to_receiver_ea, i * 2 + 1);
+ }
+
+ return 0;
+}
diff --git a/tests/TPF/TPF_40_002/Makefile b/tests/TPF/TPF_40_002/Makefile
new file mode 100644
index 0000000..e498594
--- /dev/null
+++ b/tests/TPF/TPF_40_002/Makefile
@@ -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.
+#
+
+EXTRA_LDFLAGS=-lm
+
+top_srcdir = ../..
+test_objs = host.o mpu1.task_eo mpu2.task_eo mpu3.task_eo
+timeout = 120
+
+include $(top_srcdir)/scripts/config.mk
+include $(top_srcdir)/scripts/rules_item.mk
+include $(top_srcdir)/scripts/rules_tpf.mk
+
+host.o: common.h
+mpu1.task_o: common.h
+mpu2.task_o: common.h
+mpu3.task_o: common.h
diff --git a/tests/TPF/TPF_40_002/common.h b/tests/TPF/TPF_40_002/common.h
new file mode 100644
index 0000000..b394b04
--- /dev/null
+++ b/tests/TPF/TPF_40_002/common.h
@@ -0,0 +1,45 @@
+/*
+ * Copyright 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/task.h>
+#include <mars_test.h>
+
+#define QUEUE_DEPTH 16
+#define ELEMENT_SIZE 128
+#define TEST1_ELEMENT_COUNT 4096
+#define TEST2_ELEMENT_COUNT 4096
+#define TEST3_ELEMENT_COUNT 4096
+
+#define ALIGN128 __attribute__((aligned(128)))
+
+struct test_task_args_st {
+ uint64_t queue_ea;
+ uint64_t sender_to_receiver_ea;
+ uint64_t receiver_to_sender_ea;
+ uint64_t shared_resource_ea;
+ uint64_t ticks1_ea;
+ uint64_t ticks2_ea;
+ uint32_t tb_freq;
+ uint8_t pad[12];
+};
+
diff --git a/tests/TPF/TPF_40_002/host.c b/tests/TPF/TPF_40_002/host.c
new file mode 100644
index 0000000..565b245
--- /dev/null
+++ b/tests/TPF/TPF_40_002/host.c
@@ -0,0 +1,248 @@
+/*
+ * Copyright 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/task.h>
+#include <mars_test.h>
+#include "common.h"
+
+extern spe_program_handle_t mpu1_prog, mpu2_prog, mpu3_prog;
+
+void test1()
+{
+ int ret, i;
+ uint32_t start, end;
+ int32_t push_ticks[TEST1_ELEMENT_COUNT];
+ static int32_t pop_ticks[TEST1_ELEMENT_COUNT] ALIGN128;
+ uint32_t sender_to_receiver = UINT32_MAX;
+ uint32_t receiver_to_sender = UINT32_MAX;
+ char buf[ELEMENT_SIZE];
+ struct mars_context *mars_ctx;
+ struct mars_task_id task_id;
+ struct mars_task_args task_args;
+ uint64_t queue;
+ static struct test_task_args_st args ALIGN128;
+
+ ret = mars_context_create(&mars_ctx, 0, 0);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+
+ ret = mars_task_queue_create(mars_ctx, &queue,
+ ELEMENT_SIZE, QUEUE_DEPTH, MARS_TASK_QUEUE_HOST_TO_MPU);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+
+ for (i = 0; i < QUEUE_DEPTH - 1; i++) {
+ ret = mars_task_queue_push(queue, buf);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+ }
+
+ ret = mars_task_create(mars_ctx, &task_id, NULL,
+ mpu1_prog.elf_image, MARS_TASK_CONTEXT_SAVE_SIZE_MAX);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+
+ args.queue_ea = queue;
+ args.sender_to_receiver_ea = mars_ptr_to_ea(&sender_to_receiver);
+ args.receiver_to_sender_ea = mars_ptr_to_ea(&receiver_to_sender);
+ args.ticks1_ea = mars_ptr_to_ea(pop_ticks);
+ task_args.type.u64[0] = mars_ptr_to_ea(&args);
+
+ ret = mars_task_schedule(&task_id, &task_args, 0);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+
+ for (i = 0; i < TEST1_ELEMENT_COUNT; i++) {
+ start = mars_task_get_ticks();
+ ret = mars_task_queue_push(queue, buf);
+ end = mars_task_get_ticks();
+ push_ticks[i] = end - start;
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+ mars_test_counter_set(&sender_to_receiver, i);
+ mars_test_counter_wait(&receiver_to_sender, i);
+ }
+
+ ret = mars_task_wait(&task_id, NULL);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+
+ ret = mars_task_destroy(&task_id);
+ 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_ctx);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+
+ mars_test_print_statistics(push_ticks, TEST1_ELEMENT_COUNT, "push");
+ mars_test_print_statistics(pop_ticks, TEST1_ELEMENT_COUNT, "pop");
+}
+
+void test2()
+{
+ int ret, i;
+ uint32_t start, end;
+ int32_t ticks[TEST2_ELEMENT_COUNT];
+ uint32_t sender_to_receiver = UINT32_MAX;
+ uint32_t receiver_to_sender = UINT32_MAX;
+ char buf[ELEMENT_SIZE];
+ struct mars_context *mars_ctx;
+ struct mars_task_id task_id;
+ struct mars_task_args task_args;
+ uint64_t queue;
+ static struct test_task_args_st args ALIGN128;
+
+ ret = mars_test_get_timebase_freq(&args.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_queue_create(mars_ctx, &queue,
+ ELEMENT_SIZE, 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, buf);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+ }
+
+ ret = mars_task_create(mars_ctx, &task_id, NULL,
+ mpu2_prog.elf_image, MARS_TASK_CONTEXT_SAVE_SIZE_MAX);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+
+ args.queue_ea = queue;
+ args.sender_to_receiver_ea = mars_ptr_to_ea(&sender_to_receiver);
+ args.receiver_to_sender_ea = mars_ptr_to_ea(&receiver_to_sender);
+ args.shared_resource_ea = mars_ptr_to_ea(&start);
+ task_args.type.u64[0] = mars_ptr_to_ea(&args);
+
+ ret = mars_task_schedule(&task_id, &task_args, 0);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+
+ for (i = 0; i < TEST2_ELEMENT_COUNT; i++) {
+ mars_test_counter_wait(&receiver_to_sender, i * 2);
+ mars_test_counter_set(&sender_to_receiver, i * 2);
+
+ ret = mars_task_queue_push(queue, buf);
+ end = mars_task_get_ticks();
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+
+ mars_test_counter_wait(&receiver_to_sender, i * 2 + 1);
+ ticks[i] = end - start;
+ mars_test_counter_set(&sender_to_receiver, i * 2 + 1);
+ }
+
+ ret = mars_task_wait(&task_id, NULL);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+
+ ret = mars_task_destroy(&task_id);
+ 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_ctx);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+
+ mars_test_print_statistics(
+ ticks, TEST2_ELEMENT_COUNT, "beginning of pop - end of push");
+}
+
+void test3()
+{
+ int ret, i;
+ uint32_t start, end;
+ int32_t ticks[TEST3_ELEMENT_COUNT];
+ uint32_t sender_to_receiver = UINT32_MAX;
+ uint32_t receiver_to_sender = UINT32_MAX;
+ char buf[ELEMENT_SIZE];
+ struct mars_context *mars_ctx;
+ struct mars_task_id task_id;
+ struct mars_task_args task_args;
+ uint64_t queue;
+ static struct test_task_args_st args ALIGN128;
+
+ ret = mars_test_get_timebase_freq(&args.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_queue_create(mars_ctx, &queue,
+ ELEMENT_SIZE, 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, buf);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+ }
+
+ ret = mars_task_create(mars_ctx, &task_id, NULL,
+ mpu3_prog.elf_image, MARS_TASK_CONTEXT_SAVE_SIZE_MAX);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+
+ args.queue_ea = queue;
+ args.sender_to_receiver_ea = mars_ptr_to_ea(&sender_to_receiver);
+ args.receiver_to_sender_ea = mars_ptr_to_ea(&receiver_to_sender);
+ args.shared_resource_ea = mars_ptr_to_ea(&start);
+ task_args.type.u64[0] = mars_ptr_to_ea(&args);
+
+ ret = mars_task_schedule(&task_id, &task_args, 0);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+
+ for (i = 0; i < TEST3_ELEMENT_COUNT; i++) {
+ mars_test_counter_wait(&receiver_to_sender, i * 2);
+ mars_test_counter_set(&sender_to_receiver, i * 2);
+
+ ret = mars_task_queue_push(queue, buf);
+ end = mars_task_get_ticks();
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+
+ mars_test_counter_wait(&receiver_to_sender, i * 2 + 1);
+ ticks[i] = end - start;
+ mars_test_counter_set(&sender_to_receiver, i * 2 + 1);
+ }
+
+ ret = mars_task_wait(&task_id, NULL);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+
+ ret = mars_task_destroy(&task_id);
+ 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_ctx);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+
+ mars_test_print_statistics(
+ ticks, TEST3_ELEMENT_COUNT, "end of pop - end of push");
+}
+
+int main(int argc, char *argv[])
+{
+ MARS_TEST_PERF_INIT();
+
+ test1();
+ test2();
+ test3();
+
+ return 0;
+}
diff --git a/tests/TPF/TPF_40_002/mpu1.c b/tests/TPF/TPF_40_002/mpu1.c
new file mode 100644
index 0000000..0cc409a
--- /dev/null
+++ b/tests/TPF/TPF_40_002/mpu1.c
@@ -0,0 +1,60 @@
+/*
+ * Copyright 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/task.h>
+#include <mars_test.h>
+#include "common.h"
+
+int mars_task_main(const struct mars_task_args *task_args)
+{
+ int ret, i;
+ uint32_t start, end;
+ char buf[ELEMENT_SIZE];
+ static struct test_task_args_st args ALIGN128;
+ static int32_t pop_ticks[TEST1_ELEMENT_COUNT] ALIGN128;
+
+ mfc_get(&args, task_args->type.u64[0],
+ sizeof(struct test_task_args_st), 0, 0, 0);
+ mfc_write_tag_mask(1);
+ mfc_read_tag_status_all();
+
+ for (i = 0; i < TEST1_ELEMENT_COUNT; i++) {
+ mars_test_counter_wait(args.sender_to_receiver_ea, i);
+
+ start = mars_task_get_ticks();
+ ret = mars_task_queue_pop(args.queue_ea, buf);
+ end = mars_task_get_ticks();
+
+ pop_ticks[i] = end - start;
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+
+ mars_test_counter_set(args.receiver_to_sender_ea, i);
+ }
+
+ mfc_put(pop_ticks, args.ticks1_ea, sizeof(pop_ticks), 0, 0, 0);
+ mfc_write_tag_mask(1);
+ mfc_read_tag_status_all();
+
+ return 0;
+}
diff --git a/tests/TPF/TPF_40_002/mpu2.c b/tests/TPF/TPF_40_002/mpu2.c
new file mode 100644
index 0000000..7fd77d7
--- /dev/null
+++ b/tests/TPF/TPF_40_002/mpu2.c
@@ -0,0 +1,61 @@
+/*
+ * Copyright 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/task.h>
+#include <mars_test.h>
+#include "common.h"
+
+int mars_task_main(const struct mars_task_args *task_args)
+{
+ int ret, i;
+ uint32_t start;
+ char buf[ELEMENT_SIZE];
+ static struct test_task_args_st args ALIGN128;
+
+ mfc_get(&args, task_args->type.u64[0],
+ sizeof(struct test_task_args_st), 0, 0, 0);
+ mfc_write_tag_mask(1);
+ mfc_read_tag_status_all();
+
+ /* This MPU task will not be blocked and the internal buffer of
+ the queue is already touched, so suppress_page_faults() is
+ needless. */
+
+ for (i = 0; i < TEST2_ELEMENT_COUNT; i++) {
+ mars_test_counter_set(args.receiver_to_sender_ea, i * 2);
+ mars_test_counter_wait(args.sender_to_receiver_ea, i * 2);
+
+ mars_test_usleep(args.tb_freq, DELAY);
+
+ start = mars_task_get_ticks();
+ ret = mars_task_queue_pop(args.queue_ea, buf);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+
+ mars_test_int32_put(args.shared_resource_ea, start);
+ mars_test_counter_set(args.receiver_to_sender_ea, i * 2 + 1);
+ mars_test_counter_wait(args.sender_to_receiver_ea, i * 2 + 1);
+ }
+
+ return 0;
+}
diff --git a/tests/TPF/TPF_40_002/mpu3.c b/tests/TPF/TPF_40_002/mpu3.c
new file mode 100644
index 0000000..72a1c53
--- /dev/null
+++ b/tests/TPF/TPF_40_002/mpu3.c
@@ -0,0 +1,61 @@
+/*
+ * Copyright 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/task.h>
+#include <mars_test.h>
+#include "common.h"
+
+int mars_task_main(const struct mars_task_args *task_args)
+{
+ int ret, i;
+ uint32_t start;
+ char buf[ELEMENT_SIZE];
+ static struct test_task_args_st args ALIGN128;
+
+ mfc_get(&args, task_args->type.u64[0],
+ sizeof(struct test_task_args_st), 0, 0, 0);
+ mfc_write_tag_mask(1);
+ mfc_read_tag_status_all();
+
+ /* This MPU task will not be blocked and the internal buffer of
+ the queue is already touched, so suppress_page_faults() is
+ needless. */
+
+ for (i = 0; i < TEST3_ELEMENT_COUNT; i++) {
+ mars_test_counter_set(args.receiver_to_sender_ea, i * 2);
+ mars_test_counter_wait(args.sender_to_receiver_ea, i * 2);
+
+ mars_test_usleep(args.tb_freq, DELAY);
+
+ ret = mars_task_queue_pop(args.queue_ea, buf);
+ start = mars_task_get_ticks();
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+
+ mars_test_int32_put(args.shared_resource_ea, start);
+ mars_test_counter_set(args.receiver_to_sender_ea, i * 2 + 1);
+ mars_test_counter_wait(args.sender_to_receiver_ea, i * 2 + 1);
+ }
+
+ return 0;
+}
diff --git a/tests/TPF/TPF_40_003/Makefile b/tests/TPF/TPF_40_003/Makefile
new file mode 100644
index 0000000..5888f26
--- /dev/null
+++ b/tests/TPF/TPF_40_003/Makefile
@@ -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.
+#
+
+EXTRA_LDFLAGS=-lm
+
+top_srcdir = ../..
+test_objs = host.o mpu.task_eo
+timeout = 120
+
+include $(top_srcdir)/scripts/config.mk
+include $(top_srcdir)/scripts/rules_item.mk
+include $(top_srcdir)/scripts/rules_tpf.mk
+
+host.o: common.h
+mpu.task_o: common.h
diff --git a/tests/TPF/TPF_40_003/common.h b/tests/TPF/TPF_40_003/common.h
new file mode 100644
index 0000000..015646a
--- /dev/null
+++ b/tests/TPF/TPF_40_003/common.h
@@ -0,0 +1,43 @@
+/*
+ * Copyright 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/task.h>
+#include <mars_test.h>
+
+#define QUEUE_DEPTH 16
+#define ELEMENT_SIZE 128
+#define TEST_ELEMENT_COUNT 4096
+
+#define ALIGN128 __attribute__((aligned(128)))
+
+struct test_task_args_st {
+ uint64_t queue_ea;
+ uint64_t sender_to_receiver_ea;
+ uint64_t receiver_to_sender_ea;
+ uint64_t shared_resource_ea;
+ uint64_t ticks1_ea;
+ uint64_t ticks2_ea;
+ uint32_t tb_freq;
+ uint8_t pad[12];
+};
+
diff --git a/tests/TPF/TPF_40_003/host.c b/tests/TPF/TPF_40_003/host.c
new file mode 100644
index 0000000..bd0232e
--- /dev/null
+++ b/tests/TPF/TPF_40_003/host.c
@@ -0,0 +1,99 @@
+/*
+ * Copyright 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/task.h>
+#include <mars_test.h>
+#include "common.h"
+
+extern spe_program_handle_t mpu_prog;
+
+int main(int argc, char *argv[])
+{
+ int ret, i;
+ uint32_t start, end;
+ int32_t push_ticks[TEST_ELEMENT_COUNT];
+ static int32_t pop_ticks[TEST_ELEMENT_COUNT] ALIGN128;
+ uint32_t sender_to_receiver = UINT32_MAX;
+ uint32_t receiver_to_sender = UINT32_MAX;
+ char buf[ELEMENT_SIZE];
+ struct mars_context *mars_ctx;
+ struct mars_task_id task_id;
+ struct mars_task_args task_args;
+ uint64_t queue;
+ static struct test_task_args_st args ALIGN128;
+
+ MARS_TEST_PERF_INIT();
+
+ ret = mars_context_create(&mars_ctx, 0, 0);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+
+ ret = mars_task_queue_create(mars_ctx, &queue,
+ ELEMENT_SIZE, QUEUE_DEPTH, MARS_TASK_QUEUE_HOST_TO_MPU);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+
+ for (i = 0; i < QUEUE_DEPTH / 2; i++) {
+ ret = mars_task_queue_push(queue, buf);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+ }
+
+ ret = mars_task_create(mars_ctx, &task_id, NULL,
+ mpu_prog.elf_image, MARS_TASK_CONTEXT_SAVE_SIZE_MAX);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+
+ args.queue_ea = queue;
+ args.sender_to_receiver_ea = mars_ptr_to_ea(&sender_to_receiver);
+ args.receiver_to_sender_ea = mars_ptr_to_ea(&receiver_to_sender);
+ args.ticks1_ea = mars_ptr_to_ea(pop_ticks);
+ task_args.type.u64[0] = mars_ptr_to_ea(&args);
+
+ ret = mars_task_schedule(&task_id, &task_args, 0);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+
+ for (i = 0; i < TEST_ELEMENT_COUNT; i++) {
+ start = mars_task_get_ticks();
+ ret = mars_task_queue_push(queue, buf);
+ end = mars_task_get_ticks();
+ push_ticks[i] = end - start;
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+ mars_test_counter_set(&sender_to_receiver, i);
+ mars_test_counter_wait(&receiver_to_sender, i);
+ }
+
+ ret = mars_task_wait(&task_id, NULL);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+
+ ret = mars_task_destroy(&task_id);
+ 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_ctx);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+
+ mars_test_print_statistics(push_ticks, TEST_ELEMENT_COUNT, "push");
+ mars_test_print_statistics(pop_ticks, TEST_ELEMENT_COUNT, "pop");
+
+ return 0;
+}
diff --git a/tests/TPF/TPF_40_003/mpu.c b/tests/TPF/TPF_40_003/mpu.c
new file mode 100644
index 0000000..af57d9f
--- /dev/null
+++ b/tests/TPF/TPF_40_003/mpu.c
@@ -0,0 +1,57 @@
+/*
+ * Copyright 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/task.h>
+#include <mars_test.h>
+#include "common.h"
+
+int mars_task_main(const struct mars_task_args *task_args)
+{
+ int ret, i;
+ uint32_t start, end;
+ char buf[ELEMENT_SIZE];
+ static struct test_task_args_st args ALIGN128;
+ static int32_t pop_ticks[TEST_ELEMENT_COUNT] ALIGN128;
+
+ mfc_get(&args, task_args->type.u64[0],
+ sizeof(struct test_task_args_st), 0, 0, 0);
+ mfc_write_tag_mask(1);
+ mfc_read_tag_status_all();
+
+ for (i = 0; i < TEST_ELEMENT_COUNT; i++) {
+ mars_test_counter_wait(args.sender_to_receiver_ea, i);
+ start = mars_task_get_ticks();
+ ret = mars_task_queue_pop(args.queue_ea, buf);
+ end = mars_task_get_ticks();
+ pop_ticks[i] = end - start;
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+ mars_test_counter_set(args.receiver_to_sender_ea, i);
+ }
+
+ mfc_put(pop_ticks, args.ticks1_ea, sizeof(pop_ticks), 0, 0, 0);
+ mfc_write_tag_mask(1);
+ mfc_read_tag_status_all();
+
+ return 0;
+}
diff --git a/tests/TPF/TPF_40_004/Makefile b/tests/TPF/TPF_40_004/Makefile
new file mode 100644
index 0000000..e498594
--- /dev/null
+++ b/tests/TPF/TPF_40_004/Makefile
@@ -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.
+#
+
+EXTRA_LDFLAGS=-lm
+
+top_srcdir = ../..
+test_objs = host.o mpu1.task_eo mpu2.task_eo mpu3.task_eo
+timeout = 120
+
+include $(top_srcdir)/scripts/config.mk
+include $(top_srcdir)/scripts/rules_item.mk
+include $(top_srcdir)/scripts/rules_tpf.mk
+
+host.o: common.h
+mpu1.task_o: common.h
+mpu2.task_o: common.h
+mpu3.task_o: common.h
diff --git a/tests/TPF/TPF_40_004/common.h b/tests/TPF/TPF_40_004/common.h
new file mode 100644
index 0000000..b394b04
--- /dev/null
+++ b/tests/TPF/TPF_40_004/common.h
@@ -0,0 +1,45 @@
+/*
+ * Copyright 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/task.h>
+#include <mars_test.h>
+
+#define QUEUE_DEPTH 16
+#define ELEMENT_SIZE 128
+#define TEST1_ELEMENT_COUNT 4096
+#define TEST2_ELEMENT_COUNT 4096
+#define TEST3_ELEMENT_COUNT 4096
+
+#define ALIGN128 __attribute__((aligned(128)))
+
+struct test_task_args_st {
+ uint64_t queue_ea;
+ uint64_t sender_to_receiver_ea;
+ uint64_t receiver_to_sender_ea;
+ uint64_t shared_resource_ea;
+ uint64_t ticks1_ea;
+ uint64_t ticks2_ea;
+ uint32_t tb_freq;
+ uint8_t pad[12];
+};
+
diff --git a/tests/TPF/TPF_40_004/host.c b/tests/TPF/TPF_40_004/host.c
new file mode 100644
index 0000000..8557f90
--- /dev/null
+++ b/tests/TPF/TPF_40_004/host.c
@@ -0,0 +1,233 @@
+/*
+ * Copyright 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/task.h>
+#include <mars_test.h>
+#include "common.h"
+
+extern spe_program_handle_t mpu1_prog, mpu2_prog, mpu3_prog;
+
+void test1()
+{
+ int ret, i;
+ uint32_t start, end;
+ static int32_t push_ticks[TEST1_ELEMENT_COUNT] ALIGN128;
+ int32_t pop_ticks[TEST1_ELEMENT_COUNT];
+ uint32_t receiver_to_sender = UINT32_MAX;
+ uint32_t sender_to_receiver = UINT32_MAX;
+ char buf[ELEMENT_SIZE];
+ struct mars_context *mars_ctx;
+ struct mars_task_id task_id;
+ struct mars_task_args task_args;
+ uint64_t queue;
+ static struct test_task_args_st args ALIGN128;
+
+ ret = mars_context_create(&mars_ctx, 0, 0);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+
+ ret = mars_task_queue_create(mars_ctx, &queue,
+ ELEMENT_SIZE, QUEUE_DEPTH, MARS_TASK_QUEUE_MPU_TO_HOST);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+
+ ret = mars_task_create(mars_ctx, &task_id, NULL,
+ mpu1_prog.elf_image, MARS_TASK_CONTEXT_SAVE_SIZE_MAX);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+
+ args.queue_ea = queue;
+ args.sender_to_receiver_ea = mars_ptr_to_ea(&sender_to_receiver);
+ args.receiver_to_sender_ea = mars_ptr_to_ea(&receiver_to_sender);
+ args.ticks1_ea = mars_ptr_to_ea(push_ticks);
+ task_args.type.u64[0] = mars_ptr_to_ea(&args);
+
+ ret = mars_task_schedule(&task_id, &task_args, 0);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+
+ for (i = 0; i < TEST1_ELEMENT_COUNT; i++) {
+ mars_test_counter_wait(&sender_to_receiver, i);
+ start = mars_task_get_ticks();
+ ret = mars_task_queue_pop(queue, buf);
+ end = mars_task_get_ticks();
+ pop_ticks[i] = end - start;
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+ mars_test_counter_set(&receiver_to_sender, i);
+ }
+
+ ret = mars_task_wait(&task_id, NULL);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+
+ ret = mars_task_destroy(&task_id);
+ 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_ctx);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+
+ mars_test_print_statistics(push_ticks, TEST1_ELEMENT_COUNT, "push");
+ mars_test_print_statistics(pop_ticks, TEST1_ELEMENT_COUNT, "pop");
+}
+
+void test2()
+{
+ int ret, i;
+ uint32_t start, end;
+ int32_t ticks[TEST2_ELEMENT_COUNT];
+ uint32_t receiver_to_sender = UINT32_MAX;
+ uint32_t sender_to_receiver = UINT32_MAX;
+ char buf[ELEMENT_SIZE];
+ struct mars_context *mars_ctx;
+ struct mars_task_id task_id;
+ struct mars_task_args task_args;
+ uint64_t queue;
+ static struct test_task_args_st args ALIGN128;
+
+ ret = mars_test_get_timebase_freq(&args.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_queue_create(mars_ctx, &queue,
+ ELEMENT_SIZE, QUEUE_DEPTH, MARS_TASK_QUEUE_MPU_TO_HOST);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+
+ ret = mars_task_create(mars_ctx, &task_id, NULL,
+ mpu2_prog.elf_image, MARS_TASK_CONTEXT_SAVE_SIZE_MAX);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+
+ args.queue_ea = queue;
+ args.sender_to_receiver_ea = mars_ptr_to_ea(&sender_to_receiver);
+ args.receiver_to_sender_ea = mars_ptr_to_ea(&receiver_to_sender);
+ args.shared_resource_ea = mars_ptr_to_ea(&start);
+ task_args.type.u64[0] = mars_ptr_to_ea(&args);
+
+ ret = mars_task_schedule(&task_id, &task_args, 0);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+
+ for (i = 0; i < TEST2_ELEMENT_COUNT; i++) {
+ mars_test_counter_wait(&sender_to_receiver, i * 2);
+ mars_test_counter_set(&receiver_to_sender, i * 2);
+
+ ret = mars_task_queue_pop(queue, buf);
+ end = mars_task_get_ticks();
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+
+ mars_test_counter_wait(&sender_to_receiver, i * 2 + 1);
+ ticks[i] = end - start;
+ mars_test_counter_set(&receiver_to_sender, i * 2 + 1);
+ }
+
+ ret = mars_task_wait(&task_id, NULL);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+
+ ret = mars_task_destroy(&task_id);
+ 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_ctx);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+
+ mars_test_print_statistics(
+ ticks, TEST3_ELEMENT_COUNT, "beginning of push - end of pop");
+}
+
+void test3()
+{
+ int ret, i;
+ uint32_t start, end;
+ int32_t ticks[TEST3_ELEMENT_COUNT];
+ uint32_t receiver_to_sender = UINT32_MAX;
+ uint32_t sender_to_receiver = UINT32_MAX;
+ char buf[ELEMENT_SIZE];
+ struct mars_context *mars_ctx;
+ struct mars_task_id task_id;
+ struct mars_task_args task_args;
+ uint64_t queue;
+ static struct test_task_args_st args ALIGN128;
+
+ ret = mars_test_get_timebase_freq(&args.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_queue_create(mars_ctx, &queue,
+ ELEMENT_SIZE, QUEUE_DEPTH, MARS_TASK_QUEUE_MPU_TO_HOST);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+
+ ret = mars_task_create(mars_ctx, &task_id, NULL,
+ mpu3_prog.elf_image, MARS_TASK_CONTEXT_SAVE_SIZE_MAX);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+
+ args.queue_ea = queue;
+ args.sender_to_receiver_ea = mars_ptr_to_ea(&sender_to_receiver);
+ args.receiver_to_sender_ea = mars_ptr_to_ea(&receiver_to_sender);
+ args.shared_resource_ea = mars_ptr_to_ea(&start);
+ task_args.type.u64[0] = mars_ptr_to_ea(&args);
+
+ ret = mars_task_schedule(&task_id, &task_args, 0);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+
+ for (i = 0; i < TEST3_ELEMENT_COUNT; i++) {
+ mars_test_counter_wait(&sender_to_receiver, i * 2);
+ mars_test_counter_set(&receiver_to_sender, i * 2);
+
+ ret = mars_task_queue_pop(queue, buf);
+ end = mars_task_get_ticks();
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+
+ mars_test_counter_wait(&sender_to_receiver, i * 2 + 1);
+ ticks[i] = end - start;
+ mars_test_counter_set(&receiver_to_sender, i * 2 + 1);
+ }
+
+ ret = mars_task_wait(&task_id, NULL);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+
+ ret = mars_task_destroy(&task_id);
+ 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_ctx);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+
+ mars_test_print_statistics(
+ ticks, TEST3_ELEMENT_COUNT, "end of push - end of pop");
+}
+
+int main(int argc, char *argv[])
+{
+ MARS_TEST_PERF_INIT();
+
+ test1();
+ test2();
+ test3();
+
+ return 0;
+}
diff --git a/tests/TPF/TPF_40_004/mpu1.c b/tests/TPF/TPF_40_004/mpu1.c
new file mode 100644
index 0000000..7a03037
--- /dev/null
+++ b/tests/TPF/TPF_40_004/mpu1.c
@@ -0,0 +1,56 @@
+/*
+ * Copyright 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/task.h>
+#include <mars_test.h>
+#include "common.h"
+
+int mars_task_main(const struct mars_task_args *task_args)
+{
+ int ret, i;
+ uint32_t start, end;
+ char buf[ELEMENT_SIZE];
+ static struct test_task_args_st args ALIGN128;
+ static int32_t push_ticks[TEST1_ELEMENT_COUNT] ALIGN128;
+
+ mfc_get(&args, task_args->type.u64[0],
+ sizeof(struct test_task_args_st), 0, 0, 0);
+ mfc_write_tag_mask(1);
+ mfc_read_tag_status_all();
+
+ for (i = 0; i < TEST1_ELEMENT_COUNT; i++) {
+ start = mars_task_get_ticks();
+ ret = mars_task_queue_push(args.queue_ea, buf);
+ end = mars_task_get_ticks();
+ push_ticks[i] = end - start;
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+ mars_test_counter_set(args.sender_to_receiver_ea, i);
+ mars_test_counter_wait(args.receiver_to_sender_ea, i);
+ }
+
+ mfc_put(push_ticks, args.ticks1_ea, sizeof(push_ticks), 0, 0, 0);
+ mfc_write_tag_mask(1);
+ mfc_read_tag_status_all();
+
+ return 0;
+}
diff --git a/tests/TPF/TPF_40_004/mpu2.c b/tests/TPF/TPF_40_004/mpu2.c
new file mode 100644
index 0000000..b4d88bf
--- /dev/null
+++ b/tests/TPF/TPF_40_004/mpu2.c
@@ -0,0 +1,57 @@
+/*
+ * Copyright 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/task.h>
+#include <mars_test.h>
+#include "common.h"
+
+int mars_task_main(const struct mars_task_args *task_args)
+{
+ int ret, i;
+ uint32_t start;
+ char buf[ELEMENT_SIZE];
+ static struct test_task_args_st args ALIGN128;
+
+ mfc_get(&args, task_args->type.u64[0],
+ sizeof(struct test_task_args_st), 0, 0, 0);
+ mfc_write_tag_mask(1);
+ mfc_read_tag_status_all();
+
+ for (i = 0; i < TEST2_ELEMENT_COUNT; i++) {
+ mars_test_counter_set(args.sender_to_receiver_ea, i * 2);
+ mars_test_counter_wait(args.receiver_to_sender_ea, i * 2);
+
+ /* wait the host program blocked */
+ mars_test_usleep(args.tb_freq, DELAY);
+
+ start = mars_task_get_ticks();
+ ret = mars_task_queue_push(args.queue_ea, buf);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+
+ mars_test_int32_put(args.shared_resource_ea, start);
+ mars_test_counter_set(args.sender_to_receiver_ea, i * 2 + 1);
+ mars_test_counter_wait(args.receiver_to_sender_ea, i * 2 + 1);
+ }
+
+ return 0;
+}
diff --git a/tests/TPF/TPF_40_004/mpu3.c b/tests/TPF/TPF_40_004/mpu3.c
new file mode 100644
index 0000000..b24addc
--- /dev/null
+++ b/tests/TPF/TPF_40_004/mpu3.c
@@ -0,0 +1,57 @@
+/*
+ * Copyright 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/task.h>
+#include <mars_test.h>
+#include "common.h"
+
+int mars_task_main(const struct mars_task_args *task_args)
+{
+ int ret, i;
+ uint32_t start;
+ char buf[ELEMENT_SIZE];
+ static struct test_task_args_st args ALIGN128;
+
+ mfc_get(&args, task_args->type.u64[0],
+ sizeof(struct test_task_args_st), 0, 0, 0);
+ mfc_write_tag_mask(1);
+ mfc_read_tag_status_all();
+
+ for (i = 0; i < TEST3_ELEMENT_COUNT; i++) {
+ mars_test_counter_set(args.sender_to_receiver_ea, i * 2);
+ mars_test_counter_wait(args.receiver_to_sender_ea, i * 2);
+
+ /* wait the host program blocked */
+ mars_test_usleep(args.tb_freq, DELAY);
+
+ ret = mars_task_queue_push(args.queue_ea, buf);
+ start = mars_task_get_ticks();
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+
+ mars_test_int32_put(args.shared_resource_ea, start);
+ mars_test_counter_set(args.sender_to_receiver_ea, i * 2 + 1);
+ mars_test_counter_wait(args.receiver_to_sender_ea, i * 2 + 1);
+ }
+
+ return 0;
+}
diff --git a/tests/TPF/TPF_40_005/Makefile b/tests/TPF/TPF_40_005/Makefile
new file mode 100644
index 0000000..e498594
--- /dev/null
+++ b/tests/TPF/TPF_40_005/Makefile
@@ -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.
+#
+
+EXTRA_LDFLAGS=-lm
+
+top_srcdir = ../..
+test_objs = host.o mpu1.task_eo mpu2.task_eo mpu3.task_eo
+timeout = 120
+
+include $(top_srcdir)/scripts/config.mk
+include $(top_srcdir)/scripts/rules_item.mk
+include $(top_srcdir)/scripts/rules_tpf.mk
+
+host.o: common.h
+mpu1.task_o: common.h
+mpu2.task_o: common.h
+mpu3.task_o: common.h
diff --git a/tests/TPF/TPF_40_005/common.h b/tests/TPF/TPF_40_005/common.h
new file mode 100644
index 0000000..b394b04
--- /dev/null
+++ b/tests/TPF/TPF_40_005/common.h
@@ -0,0 +1,45 @@
+/*
+ * Copyright 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/task.h>
+#include <mars_test.h>
+
+#define QUEUE_DEPTH 16
+#define ELEMENT_SIZE 128
+#define TEST1_ELEMENT_COUNT 4096
+#define TEST2_ELEMENT_COUNT 4096
+#define TEST3_ELEMENT_COUNT 4096
+
+#define ALIGN128 __attribute__((aligned(128)))
+
+struct test_task_args_st {
+ uint64_t queue_ea;
+ uint64_t sender_to_receiver_ea;
+ uint64_t receiver_to_sender_ea;
+ uint64_t shared_resource_ea;
+ uint64_t ticks1_ea;
+ uint64_t ticks2_ea;
+ uint32_t tb_freq;
+ uint8_t pad[12];
+};
+
diff --git a/tests/TPF/TPF_40_005/host.c b/tests/TPF/TPF_40_005/host.c
new file mode 100644
index 0000000..4277616
--- /dev/null
+++ b/tests/TPF/TPF_40_005/host.c
@@ -0,0 +1,235 @@
+/*
+ * Copyright 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/task.h>
+#include <mars_test.h>
+#include "common.h"
+
+extern spe_program_handle_t mpu1_prog, mpu2_prog, mpu3_prog;
+
+void test1()
+{
+ int ret, i;
+ uint32_t start, end;
+ static int32_t push_ticks[TEST1_ELEMENT_COUNT] ALIGN128;
+ int32_t pop_ticks[TEST1_ELEMENT_COUNT];
+ uint32_t receiver_to_sender = UINT32_MAX;
+ uint32_t sender_to_receiver = UINT32_MAX;
+ char buf[ELEMENT_SIZE];
+ struct mars_context *mars_ctx;
+ struct mars_task_id task_id;
+ struct mars_task_args task_args;
+ uint64_t queue;
+ static struct test_task_args_st args ALIGN128;
+
+ ret = mars_context_create(&mars_ctx, 0, 0);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+
+ ret = mars_task_queue_create(mars_ctx, &queue,
+ ELEMENT_SIZE, QUEUE_DEPTH, MARS_TASK_QUEUE_MPU_TO_HOST);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+
+ ret = mars_task_create(mars_ctx, &task_id, NULL,
+ mpu1_prog.elf_image, MARS_TASK_CONTEXT_SAVE_SIZE_MAX);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+
+ args.queue_ea = queue;
+ args.sender_to_receiver_ea = mars_ptr_to_ea(&sender_to_receiver);
+ args.receiver_to_sender_ea = mars_ptr_to_ea(&receiver_to_sender);
+ args.ticks1_ea = mars_ptr_to_ea(push_ticks);
+ task_args.type.u64[0] = mars_ptr_to_ea(&args);
+
+ ret = mars_task_schedule(&task_id, &task_args, 0);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+
+ for (i = 0; i < TEST1_ELEMENT_COUNT; i++) {
+ mars_test_counter_wait(&sender_to_receiver, i);
+ start = mars_task_get_ticks();
+ ret = mars_task_queue_pop(queue, buf);
+ end = mars_task_get_ticks();
+ pop_ticks[i] = end - start;
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+ mars_test_counter_set(&receiver_to_sender, i);
+ }
+
+ ret = mars_task_wait(&task_id, NULL);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+
+ ret = mars_task_destroy(&task_id);
+ 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_ctx);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+
+ mars_test_print_statistics(push_ticks, TEST1_ELEMENT_COUNT, "push");
+ mars_test_print_statistics(pop_ticks, TEST1_ELEMENT_COUNT, "pop");
+}
+
+void test2()
+{
+ int ret, i;
+ uint32_t start, end;
+ int32_t ticks[TEST2_ELEMENT_COUNT];
+ uint32_t receiver_to_sender = UINT32_MAX;
+ uint32_t sender_to_receiver = UINT32_MAX;
+ char buf[ELEMENT_SIZE];
+ struct mars_context *mars_ctx;
+ struct mars_task_id task_id;
+ struct mars_task_args task_args;
+ uint64_t queue;
+ static struct test_task_args_st args ALIGN128;
+
+ ret = mars_test_get_timebase_freq(&args.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_queue_create(mars_ctx, &queue,
+ ELEMENT_SIZE, QUEUE_DEPTH, MARS_TASK_QUEUE_MPU_TO_HOST);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+
+ ret = mars_task_create(mars_ctx, &task_id, NULL,
+ mpu2_prog.elf_image, MARS_TASK_CONTEXT_SAVE_SIZE_MAX);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+
+ args.queue_ea = queue;
+ args.sender_to_receiver_ea = mars_ptr_to_ea(&sender_to_receiver);
+ args.receiver_to_sender_ea = mars_ptr_to_ea(&receiver_to_sender);
+ args.shared_resource_ea = mars_ptr_to_ea(&end);
+ task_args.type.u64[0] = mars_ptr_to_ea(&args);
+
+ ret = mars_task_schedule(&task_id, &task_args, 0);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+
+ for (i = 0; i < TEST2_ELEMENT_COUNT; i++) {
+ mars_test_counter_wait(&sender_to_receiver, i * 2);
+ mars_test_counter_set(&receiver_to_sender, i * 2);
+
+ usleep(DELAY);
+
+ start = mars_task_get_ticks();
+ ret = mars_task_queue_pop(queue, buf);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+
+ mars_test_counter_wait(&sender_to_receiver, i * 2 + 1);
+ ticks[i] = end - start;
+ mars_test_counter_set(&receiver_to_sender, i * 2 + 1);
+ }
+
+ ret = mars_task_wait(&task_id, NULL);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+
+ ret = mars_task_destroy(&task_id);
+ 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_ctx);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+
+ mars_test_print_statistics(
+ ticks, TEST3_ELEMENT_COUNT, "beginning of pop - end of push");
+}
+
+void test3()
+{
+ int ret, i;
+ uint32_t start, end;
+ int32_t ticks[TEST3_ELEMENT_COUNT];
+ uint32_t receiver_to_sender = UINT32_MAX;
+ uint32_t sender_to_receiver = UINT32_MAX;
+ char buf[ELEMENT_SIZE];
+ struct mars_context *mars_ctx;
+ struct mars_task_id task_id;
+ struct mars_task_args task_args;
+ uint64_t queue;
+ static struct test_task_args_st args ALIGN128;
+
+ ret = mars_test_get_timebase_freq(&args.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_queue_create(mars_ctx, &queue,
+ ELEMENT_SIZE, QUEUE_DEPTH, MARS_TASK_QUEUE_MPU_TO_HOST);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+
+ ret = mars_task_create(mars_ctx, &task_id, NULL,
+ mpu3_prog.elf_image, MARS_TASK_CONTEXT_SAVE_SIZE_MAX);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+
+ args.queue_ea = queue;
+ args.sender_to_receiver_ea = mars_ptr_to_ea(&sender_to_receiver);
+ args.receiver_to_sender_ea = mars_ptr_to_ea(&receiver_to_sender);
+ args.shared_resource_ea = mars_ptr_to_ea(&end);
+ task_args.type.u64[0] = mars_ptr_to_ea(&args);
+
+ ret = mars_task_schedule(&task_id, &task_args, 0);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+
+ for (i = 0; i < TEST3_ELEMENT_COUNT; i++) {
+ mars_test_counter_wait(&sender_to_receiver, i * 2);
+ mars_test_counter_set(&receiver_to_sender, i * 2);
+
+ ret = mars_task_queue_pop(queue, buf);
+ start = mars_task_get_ticks();
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+
+ mars_test_counter_wait(&sender_to_receiver, i * 2 + 1);
+ ticks[i] = end - start;
+ mars_test_counter_set(&receiver_to_sender, i * 2 + 1);
+ }
+
+ ret = mars_task_wait(&task_id, NULL);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+
+ ret = mars_task_destroy(&task_id);
+ 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_ctx);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+
+ mars_test_print_statistics(
+ ticks, TEST3_ELEMENT_COUNT, "end of pop - end of push");
+}
+
+int main(int argc, char *argv[])
+{
+ MARS_TEST_PERF_INIT();
+
+ test1();
+ test2();
+ test3();
+
+ return 0;
+}
diff --git a/tests/TPF/TPF_40_005/mpu1.c b/tests/TPF/TPF_40_005/mpu1.c
new file mode 100644
index 0000000..a7f39ae
--- /dev/null
+++ b/tests/TPF/TPF_40_005/mpu1.c
@@ -0,0 +1,61 @@
+/*
+ * Copyright 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/task.h>
+#include <mars_test.h>
+#include "common.h"
+
+int mars_task_main(const struct mars_task_args *task_args)
+{
+ int ret, i;
+ uint32_t start, end;
+ char buf[ELEMENT_SIZE];
+ static struct test_task_args_st args ALIGN128;
+ static int32_t push_ticks[TEST1_ELEMENT_COUNT] ALIGN128;
+
+ mfc_get(&args, task_args->type.u64[0],
+ sizeof(struct test_task_args_st), 0, 0, 0);
+ mfc_write_tag_mask(1);
+ mfc_read_tag_status_all();
+
+ for (i = 0; i < QUEUE_DEPTH - 1; i++) {
+ ret = mars_task_queue_push(args.queue_ea, buf);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+ }
+
+ for (i = 0; i < TEST1_ELEMENT_COUNT; i++) {
+ start = mars_task_get_ticks();
+ ret = mars_task_queue_push(args.queue_ea, buf);
+ end = mars_task_get_ticks();
+ push_ticks[i] = end - start;
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+ mars_test_counter_set(args.sender_to_receiver_ea, i);
+ mars_test_counter_wait(args.receiver_to_sender_ea, i);
+ }
+
+ mfc_put(push_ticks, args.ticks1_ea, sizeof(push_ticks), 0, 0, 0);
+ mfc_write_tag_mask(1);
+ mfc_read_tag_status_all();
+
+ return 0;
+}
diff --git a/tests/TPF/TPF_40_005/mpu2.c b/tests/TPF/TPF_40_005/mpu2.c
new file mode 100644
index 0000000..1033783
--- /dev/null
+++ b/tests/TPF/TPF_40_005/mpu2.c
@@ -0,0 +1,62 @@
+/*
+ * Copyright 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/task.h>
+#include <mars_test.h>
+#include "common.h"
+
+int mars_task_main(const struct mars_task_args *task_args)
+{
+ int ret, i;
+ uint32_t end;
+ char buf[ELEMENT_SIZE];
+ static struct test_task_args_st args ALIGN128;
+
+ mfc_get(&args, task_args->type.u64[0],
+ sizeof(struct test_task_args_st), 0, 0, 0);
+ mfc_write_tag_mask(1);
+ mfc_read_tag_status_all();
+
+ for (i = 0; i < QUEUE_DEPTH; i++) {
+ ret = mars_task_queue_push(args.queue_ea, buf);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+ }
+
+ /* for avoiding page faults during the test */
+ mars_task_yield();
+
+ for (i = 0; i < TEST2_ELEMENT_COUNT; i++) {
+ mars_test_counter_set(args.sender_to_receiver_ea, i * 2);
+ mars_test_counter_wait(args.receiver_to_sender_ea, i * 2);
+
+ ret = mars_task_queue_push(args.queue_ea, buf);
+ end = mars_task_get_ticks();
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+
+ mars_test_int32_put(args.shared_resource_ea, end);
+ mars_test_counter_set(args.sender_to_receiver_ea, i * 2 + 1);
+ mars_test_counter_wait(args.receiver_to_sender_ea, i * 2 + 1);
+ }
+
+ return 0;
+}
diff --git a/tests/TPF/TPF_40_005/mpu3.c b/tests/TPF/TPF_40_005/mpu3.c
new file mode 100644
index 0000000..7e35fb5
--- /dev/null
+++ b/tests/TPF/TPF_40_005/mpu3.c
@@ -0,0 +1,60 @@
+/*
+ * Copyright 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/task.h>
+#include <mars_test.h>
+#include "common.h"
+
+int mars_task_main(const struct mars_task_args *task_args)
+{
+ int ret, i;
+ uint32_t end;
+ char buf[ELEMENT_SIZE];
+ static struct test_task_args_st args ALIGN128;
+
+ mfc_get(&args, task_args->type.u64[0],
+ sizeof(struct test_task_args_st), 0, 0, 0);
+ mfc_write_tag_mask(1);
+ mfc_read_tag_status_all();
+
+ for (i = 0; i < QUEUE_DEPTH; i++) {
+ ret = mars_task_queue_push(args.queue_ea, buf);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+ }
+
+ for (i = 0; i < TEST3_ELEMENT_COUNT; i++) {
+ mars_test_counter_set(args.sender_to_receiver_ea, i * 2);
+ mars_test_counter_wait(args.receiver_to_sender_ea, i * 2);
+
+ ret = mars_task_queue_push(args.queue_ea, buf);
+ end = mars_task_get_ticks();
+
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+
+ mars_test_int32_put(args.shared_resource_ea, end);
+ mars_test_counter_set(args.sender_to_receiver_ea, i * 2 + 1);
+ mars_test_counter_wait(args.receiver_to_sender_ea, i * 2 + 1);
+ }
+
+ return 0;
+}
diff --git a/tests/TPF/TPF_40_006/Makefile b/tests/TPF/TPF_40_006/Makefile
new file mode 100644
index 0000000..5888f26
--- /dev/null
+++ b/tests/TPF/TPF_40_006/Makefile
@@ -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.
+#
+
+EXTRA_LDFLAGS=-lm
+
+top_srcdir = ../..
+test_objs = host.o mpu.task_eo
+timeout = 120
+
+include $(top_srcdir)/scripts/config.mk
+include $(top_srcdir)/scripts/rules_item.mk
+include $(top_srcdir)/scripts/rules_tpf.mk
+
+host.o: common.h
+mpu.task_o: common.h
diff --git a/tests/TPF/TPF_40_006/common.h b/tests/TPF/TPF_40_006/common.h
new file mode 100644
index 0000000..015646a
--- /dev/null
+++ b/tests/TPF/TPF_40_006/common.h
@@ -0,0 +1,43 @@
+/*
+ * Copyright 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/task.h>
+#include <mars_test.h>
+
+#define QUEUE_DEPTH 16
+#define ELEMENT_SIZE 128
+#define TEST_ELEMENT_COUNT 4096
+
+#define ALIGN128 __attribute__((aligned(128)))
+
+struct test_task_args_st {
+ uint64_t queue_ea;
+ uint64_t sender_to_receiver_ea;
+ uint64_t receiver_to_sender_ea;
+ uint64_t shared_resource_ea;
+ uint64_t ticks1_ea;
+ uint64_t ticks2_ea;
+ uint32_t tb_freq;
+ uint8_t pad[12];
+};
+
diff --git a/tests/TPF/TPF_40_006/host.c b/tests/TPF/TPF_40_006/host.c
new file mode 100644
index 0000000..3ada594
--- /dev/null
+++ b/tests/TPF/TPF_40_006/host.c
@@ -0,0 +1,95 @@
+/*
+ * Copyright 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/task.h>
+#include <mars_test.h>
+#include "common.h"
+
+extern spe_program_handle_t mpu_prog;
+
+int main(int argc, char *aggv[])
+{
+ int ret, i;
+ uint32_t start, end;
+ static int32_t push_ticks[TEST_ELEMENT_COUNT] ALIGN128;
+ int32_t pop_ticks[TEST_ELEMENT_COUNT];
+ uint32_t receiver_to_sender = UINT32_MAX;
+ uint32_t sender_to_receiver = UINT32_MAX;
+ char buf[ELEMENT_SIZE];
+ struct mars_context *mars_ctx;
+ struct mars_task_id task_id;
+ struct mars_task_args task_args;
+ uint64_t queue;
+ static struct test_task_args_st args ALIGN128;
+
+ MARS_TEST_PERF_INIT();
+
+ ret = mars_context_create(&mars_ctx, 0, 0);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+
+ ret = mars_task_queue_create(mars_ctx, &queue,
+ ELEMENT_SIZE, QUEUE_DEPTH, 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_SIZE_MAX);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+
+ args.queue_ea = queue;
+ args.sender_to_receiver_ea = mars_ptr_to_ea(&sender_to_receiver);
+ args.receiver_to_sender_ea = mars_ptr_to_ea(&receiver_to_sender);
+ args.ticks1_ea = mars_ptr_to_ea(push_ticks);
+ task_args.type.u64[0] = mars_ptr_to_ea(&args);
+
+ ret = mars_task_schedule(&task_id, &task_args, 0);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+
+ for (i = 0; i < TEST_ELEMENT_COUNT; i++) {
+ mars_test_counter_wait(&sender_to_receiver, i);
+ start = mars_task_get_ticks();
+ ret = mars_task_queue_pop(queue, buf);
+ end = mars_task_get_ticks();
+ pop_ticks[i] = end - start;
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+ mars_test_counter_set(&receiver_to_sender, i);
+ }
+
+ ret = mars_task_wait(&task_id, NULL);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+
+ ret = mars_task_destroy(&task_id);
+ 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_ctx);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+
+ mars_test_print_statistics(push_ticks, TEST_ELEMENT_COUNT, "push");
+ mars_test_print_statistics(pop_ticks, TEST_ELEMENT_COUNT, "pop");
+
+ return 0;
+}
+
diff --git a/tests/TPF/TPF_40_006/mpu.c b/tests/TPF/TPF_40_006/mpu.c
new file mode 100644
index 0000000..079a43b
--- /dev/null
+++ b/tests/TPF/TPF_40_006/mpu.c
@@ -0,0 +1,61 @@
+/*
+ * Copyright 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/task.h>
+#include <mars_test.h>
+#include "common.h"
+
+int mars_task_main(const struct mars_task_args *task_args)
+{
+ int ret, i;
+ uint32_t start, end;
+ char buf[ELEMENT_SIZE];
+ static struct test_task_args_st args ALIGN128;
+ static int32_t push_ticks[TEST_ELEMENT_COUNT] ALIGN128;
+
+ mfc_get(&args, task_args->type.u64[0],
+ sizeof(struct test_task_args_st), 0, 0, 0);
+ mfc_write_tag_mask(1);
+ mfc_read_tag_status_all();
+
+ for (i = 0; i < QUEUE_DEPTH / 2; i++) {
+ ret = mars_task_queue_push(args.queue_ea, buf);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+ }
+
+ for (i = 0; i < TEST_ELEMENT_COUNT; i++) {
+ start = mars_task_get_ticks();
+ ret = mars_task_queue_push(args.queue_ea, buf);
+ end = mars_task_get_ticks();
+ push_ticks[i] = end - start;
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+ mars_test_counter_set(args.sender_to_receiver_ea, i);
+ mars_test_counter_wait(args.receiver_to_sender_ea, i);
+ }
+
+ mfc_put(push_ticks, args.ticks1_ea, sizeof(push_ticks), 0, 0, 0);
+ mfc_write_tag_mask(1);
+ mfc_read_tag_status_all();
+
+ return 0;
+}
diff --git a/tests/TPF/TPF_40_007/Makefile b/tests/TPF/TPF_40_007/Makefile
new file mode 100644
index 0000000..dc68b86
--- /dev/null
+++ b/tests/TPF/TPF_40_007/Makefile
@@ -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.
+#
+
+EXTRA_LDFLAGS=-lm
+INCLUDE_CFLAGS+= -I./
+MPU_INCLUDE_CFLAGS+= -I./
+
+top_srcdir = ../..
+test_objs = host.o mpu1.task_eo mpu2.task_eo
+timeout = 120
+
+include $(top_srcdir)/scripts/config.mk
+include $(top_srcdir)/scripts/rules_item.mk
+include $(top_srcdir)/scripts/rules_tpf.mk
+
+host.o: common.h
+mpu1.task_o: common.h
+mpu2.task_o: common.h
diff --git a/tests/TFP/TFP_18_002/mpu2.c b/tests/TPF/TPF_40_007/common.h
index 86409fd..bd90801 100644
--- a/tests/TFP/TFP_18_002/mpu2.c
+++ b/tests/TPF/TPF_40_007/common.h
@@ -1,5 +1,5 @@
/*
- * Copyright 2008 Sony Corporation
+ * Copyright 2008 Sony Computer Entertainment Inc.
*
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
@@ -21,23 +21,25 @@
* THE SOFTWARE.
*/
-#include <mars_task_test.h>
#include <mars/task.h>
+#include <mars_test.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];
+#define MIN_MPUS 1
+#define MAX_MPUS 1
- mars_test_counter_set(trigger0_ea, 1);
+#define QUEUE_DEPTH 16
+#define ELEMENT_SIZE 128
+#define TEST1_ELEMENT_COUNT 4096
- ret = mars_task_yield();
- MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+#define ALIGN128 __attribute__((aligned(128)))
- mars_test_counter_set(trigger1_ea, 1);
+struct test_task_args_st {
+ uint64_t barrier_ea;
+ uint64_t ticks1_ea;
+ uint64_t ticks2_ea;
+ uint64_t ticks3_ea;
+ uint64_t queue_ea;
+ uint32_t tb_freq;
+ uint32_t pad[1];
+};
- mars_task_exit(0);
-
- return 0;
-}
diff --git a/tests/TPF/TPF_40_007/host.c b/tests/TPF/TPF_40_007/host.c
new file mode 100644
index 0000000..8604b76
--- /dev/null
+++ b/tests/TPF/TPF_40_007/host.c
@@ -0,0 +1,205 @@
+/*
+ * Copyright 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 <pthread.h>
+#include <libspe2.h>
+#include <mars/task.h>
+#include <mars_test.h>
+#include <string.h>
+#include <unistd.h>
+#include <common.h>
+
+extern spe_program_handle_t mpu1_prog, mpu2_prog;
+
+struct thread_arg_st {
+ int32_t *ticks1;
+ int32_t *ticks2;
+ int32_t *ticks3;
+ struct mars_context *mars_ctx;
+};
+
+void *test_thread(void *arg)
+{
+ int ret;
+ struct thread_arg_st *thread_arg = arg;
+ int32_t *start1_ticks = thread_arg->ticks1;
+ int32_t *start2_ticks = thread_arg->ticks2;
+ int32_t *end1_ticks = thread_arg->ticks3;
+ struct mars_context *mars_ctx = thread_arg->mars_ctx;
+ struct mars_task_id task_id_send, task_id_wait;
+ struct mars_task_args task_args_send, task_args_wait;
+ static __thread struct test_task_args_st args ALIGN128;
+ uint64_t barrier;
+ uint64_t queue;
+
+
+ ret = mars_task_barrier_create(mars_ctx, &barrier, 2);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+
+ ret = mars_task_queue_create(mars_ctx, &queue,
+ ELEMENT_SIZE, QUEUE_DEPTH, MARS_TASK_QUEUE_MPU_TO_MPU);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+
+ ret = mars_task_create(mars_ctx, &task_id_send, NULL,
+ mpu1_prog.elf_image,
+ MARS_TASK_CONTEXT_SAVE_SIZE_MAX);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+
+ ret = mars_task_create(mars_ctx, &task_id_wait, NULL,
+ mpu2_prog.elf_image,
+ MARS_TASK_CONTEXT_SAVE_SIZE_MAX);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+
+ ret = mars_test_get_timebase_freq(&args.tb_freq);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+
+ args.barrier_ea = barrier;
+ args.queue_ea = queue;
+ args.ticks1_ea = mars_ptr_to_ea(start1_ticks);
+ args.ticks2_ea = mars_ptr_to_ea(start2_ticks);
+ args.ticks3_ea = mars_ptr_to_ea(end1_ticks);
+ task_args_send.type.u64[0] = mars_ptr_to_ea(&args);
+ task_args_wait.type.u64[0] = mars_ptr_to_ea(&args);
+
+ ret = mars_task_schedule(&task_id_send, &task_args_send, 0);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+
+ ret = mars_task_schedule(&task_id_wait, &task_args_wait, 0);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+
+ ret = mars_task_wait(&task_id_send, NULL);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+
+ ret = mars_task_wait(&task_id_wait, NULL);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+
+ ret = mars_task_barrier_destroy(barrier);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+
+ ret = mars_task_destroy(&task_id_send);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+
+ ret = mars_task_destroy(&task_id_wait);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+
+ return NULL;
+}
+
+void test1(int mpu, pthread_t * threads,
+ struct thread_arg_st *thread_args)
+{
+ int ret, i;
+ char text[128];
+ size_t size;
+ int32_t *start1_ticks, *start2_ticks, *end1_ticks, *ticks;
+ struct mars_context *mars_ctx;
+
+ size = sizeof(uint32_t) * TEST1_ELEMENT_COUNT * mpu;
+
+ ret = posix_memalign((void **)&start1_ticks, 128, size);
+ MARS_TEST_ASSERT_EQUAL(ret, 0);
+
+ ret = posix_memalign((void **)&start2_ticks, 128, size);
+ MARS_TEST_ASSERT_EQUAL(ret, 0);
+
+ ret = posix_memalign((void **)&end1_ticks, 128, size);
+ MARS_TEST_ASSERT_EQUAL(ret, 0);
+
+ ret = posix_memalign((void **)&ticks, 128, size);
+ MARS_TEST_ASSERT_EQUAL(ret, 0);
+
+ ret = mars_context_create(&mars_ctx, 0, 1);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+
+ for (i = 0; i < mpu; i++) {
+ thread_args[i].ticks1 = &start1_ticks[TEST1_ELEMENT_COUNT * i];
+ thread_args[i].ticks2 = &start2_ticks[TEST1_ELEMENT_COUNT * i];
+ thread_args[i].ticks3 = &end1_ticks[TEST1_ELEMENT_COUNT * i];
+ thread_args[i].mars_ctx = mars_ctx;
+ ret = pthread_create(&threads[i], NULL, test_thread,
+ &thread_args[i]);
+ MARS_TEST_ASSERT_EQUAL(ret, 0);
+ }
+
+ for (i = 0; i < mpu; i++) {
+ ret = pthread_join(threads[i], NULL);
+ MARS_TEST_ASSERT_EQUAL(ret, 0);
+ }
+
+ ret = mars_context_destroy(mars_ctx);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+
+ size = TEST1_ELEMENT_COUNT * mpu;
+
+ for (i = 0; i < size; i++) {
+ ticks[i] = start2_ticks[i] - start1_ticks[i];
+ }
+ sprintf(text, "queue mpu-mpu: push (%d mpu pairs)",mpu);
+ mars_test_print_statistics(ticks, size, text);
+
+ for (i = 0; i < size; i++) {
+ ticks[i] = end1_ticks[i] - start1_ticks[i];
+ }
+ sprintf(text, "queue mpu-mpu: start push - end pop (%d mpu pairs)",mpu);
+ mars_test_print_statistics(ticks, size, text);
+ for (i = 0; i < size; i++) {
+ ticks[i] = end1_ticks[i] - start2_ticks[i];
+ }
+ sprintf(text, "queue mpu-mpu: end push - end pop (%d mpu pairs)",mpu);
+ mars_test_print_statistics(ticks, size, text);
+
+ free(start1_ticks);
+ free(start2_ticks);
+ free(end1_ticks);
+ free(ticks);
+}
+
+int main(int argc, char *argv[])
+{
+ int mpu,spe;
+ size_t size;
+ pthread_t *threads;
+ struct thread_arg_st *thread_args;
+
+ spe = spe_cpu_info_get(SPE_COUNT_PHYSICAL_SPES, -1);
+
+ for(mpu = MIN_MPUS; mpu<=MAX_MPUS; mpu++){
+
+ threads = (pthread_t *) malloc(sizeof(pthread_t) * mpu);
+ MARS_TEST_ASSERT(threads != NULL);
+
+ size = sizeof(struct thread_arg_st) * mpu;
+ thread_args = (struct thread_arg_st *)malloc(size);
+ MARS_TEST_ASSERT(thread_args != NULL);
+
+ MARS_TEST_PERF_INIT();
+
+ test1(mpu, threads, thread_args);
+
+ free(thread_args);
+ free(threads);
+
+ }
+
+ return 0;
+}
diff --git a/tests/TPF/TPF_40_007/mpu1.c b/tests/TPF/TPF_40_007/mpu1.c
new file mode 100644
index 0000000..6508784
--- /dev/null
+++ b/tests/TPF/TPF_40_007/mpu1.c
@@ -0,0 +1,63 @@
+/*
+ * Copyright 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/task.h>
+#include <mars_test.h>
+#include <common.h>
+
+int mars_task_main(const struct mars_task_args *task_args)
+{
+ int ret, i;
+ static struct test_task_args_st args ALIGN128;
+ static uint32_t start1_ticks[TEST1_ELEMENT_COUNT] ALIGN128;
+ static uint32_t start2_ticks[TEST1_ELEMENT_COUNT] ALIGN128;
+ char buf[ELEMENT_SIZE];
+
+ mfc_get(&args, task_args->type.u64[0], sizeof(struct test_task_args_st),
+ 0, 0, 0);
+ mfc_write_tag_mask(1);
+ mfc_read_tag_status_all();
+
+ for (i = 0; i < TEST1_ELEMENT_COUNT; i++) {
+ ret = mars_task_barrier_notify(args.barrier_ea);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+ ret = mars_task_barrier_wait(args.barrier_ea);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+
+ mars_test_usleep(args.tb_freq, DELAY); /*give wait task time to block */
+
+ start1_ticks[i] = mars_task_get_ticks();
+ ret = mars_task_queue_push(args.queue_ea, buf);
+ start2_ticks[i] = mars_task_get_ticks();
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+ }
+
+ mfc_put(start1_ticks, args.ticks1_ea, TEST1_ELEMENT_COUNT * 4, 0, 0, 0);
+ mfc_write_tag_mask(1);
+ mfc_read_tag_status_all();
+
+ mfc_put(start2_ticks, args.ticks2_ea, TEST1_ELEMENT_COUNT * 4, 0, 0, 0);
+ mfc_write_tag_mask(1);
+ mfc_read_tag_status_all();
+ return 0;
+}
diff --git a/tests/TPF/TPF_40_007/mpu2.c b/tests/TPF/TPF_40_007/mpu2.c
new file mode 100644
index 0000000..e9c526c
--- /dev/null
+++ b/tests/TPF/TPF_40_007/mpu2.c
@@ -0,0 +1,57 @@
+/*
+ * Copyright 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/task.h>
+#include <mars_test.h>
+#include <common.h>
+
+int mars_task_main(const struct mars_task_args *task_args)
+{
+ int ret, i;
+ static struct test_task_args_st args ALIGN128;
+ static uint32_t end1_ticks[TEST1_ELEMENT_COUNT] ALIGN128;
+ char buf[ELEMENT_SIZE];
+
+ mfc_get(&args, task_args->type.u64[0], sizeof(struct test_task_args_st),
+ 0, 0, 0);
+ mfc_write_tag_mask(1);
+ mfc_read_tag_status_all();
+
+
+ for (i = 0; i < TEST1_ELEMENT_COUNT; i++) {
+ ret = mars_task_barrier_notify(args.barrier_ea);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+ ret = mars_task_barrier_wait(args.barrier_ea);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+
+ ret = mars_task_queue_pop(args.queue_ea, buf);
+ end1_ticks[i] = mars_task_get_ticks();
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+ }
+
+ mfc_put(end1_ticks, args.ticks3_ea, TEST1_ELEMENT_COUNT * 4, 0, 0, 0);
+ mfc_write_tag_mask(1);
+ mfc_read_tag_status_all();
+
+ return 0;
+}
diff --git a/tests/TPF/TPF_40_008/Makefile b/tests/TPF/TPF_40_008/Makefile
new file mode 100644
index 0000000..dc68b86
--- /dev/null
+++ b/tests/TPF/TPF_40_008/Makefile
@@ -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.
+#
+
+EXTRA_LDFLAGS=-lm
+INCLUDE_CFLAGS+= -I./
+MPU_INCLUDE_CFLAGS+= -I./
+
+top_srcdir = ../..
+test_objs = host.o mpu1.task_eo mpu2.task_eo
+timeout = 120
+
+include $(top_srcdir)/scripts/config.mk
+include $(top_srcdir)/scripts/rules_item.mk
+include $(top_srcdir)/scripts/rules_tpf.mk
+
+host.o: common.h
+mpu1.task_o: common.h
+mpu2.task_o: common.h
diff --git a/tests/TPF/TPF_40_008/common.h b/tests/TPF/TPF_40_008/common.h
new file mode 100644
index 0000000..bd90801
--- /dev/null
+++ b/tests/TPF/TPF_40_008/common.h
@@ -0,0 +1,45 @@
+/*
+ * Copyright 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/task.h>
+#include <mars_test.h>
+
+#define MIN_MPUS 1
+#define MAX_MPUS 1
+
+#define QUEUE_DEPTH 16
+#define ELEMENT_SIZE 128
+#define TEST1_ELEMENT_COUNT 4096
+
+#define ALIGN128 __attribute__((aligned(128)))
+
+struct test_task_args_st {
+ uint64_t barrier_ea;
+ uint64_t ticks1_ea;
+ uint64_t ticks2_ea;
+ uint64_t ticks3_ea;
+ uint64_t queue_ea;
+ uint32_t tb_freq;
+ uint32_t pad[1];
+};
+
diff --git a/tests/TPF/TPF_40_008/host.c b/tests/TPF/TPF_40_008/host.c
new file mode 100644
index 0000000..5ec9cfa
--- /dev/null
+++ b/tests/TPF/TPF_40_008/host.c
@@ -0,0 +1,205 @@
+/*
+ * Copyright 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 <pthread.h>
+#include <libspe2.h>
+#include <mars/task.h>
+#include <mars_test.h>
+#include <string.h>
+#include <unistd.h>
+#include <common.h>
+
+extern spe_program_handle_t mpu1_prog, mpu2_prog;
+
+struct thread_arg_st {
+ int32_t *ticks1;
+ int32_t *ticks2;
+ int32_t *ticks3;
+ struct mars_context *mars_ctx;
+};
+
+void *test_thread(void *arg)
+{
+ int ret;
+ struct thread_arg_st *thread_arg = arg;
+ int32_t *start1_ticks = thread_arg->ticks1;
+ int32_t *start2_ticks = thread_arg->ticks2;
+ int32_t *end1_ticks = thread_arg->ticks3;
+ struct mars_context *mars_ctx = thread_arg->mars_ctx;
+ struct mars_task_id task_id_send, task_id_wait;
+ struct mars_task_args task_args_send, task_args_wait;
+ static __thread struct test_task_args_st args ALIGN128;
+ uint64_t barrier;
+ uint64_t queue;
+
+
+ ret = mars_task_barrier_create(mars_ctx, &barrier, 2);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+
+ ret = mars_task_queue_create(mars_ctx, &queue,
+ ELEMENT_SIZE, QUEUE_DEPTH, MARS_TASK_QUEUE_MPU_TO_MPU);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+
+ ret = mars_task_create(mars_ctx, &task_id_send, NULL,
+ mpu1_prog.elf_image,
+ MARS_TASK_CONTEXT_SAVE_SIZE_MAX);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+
+ ret = mars_task_create(mars_ctx, &task_id_wait, NULL,
+ mpu2_prog.elf_image,
+ MARS_TASK_CONTEXT_SAVE_SIZE_MAX);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+
+ ret = mars_test_get_timebase_freq(&args.tb_freq);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+
+ args.barrier_ea = barrier;
+ args.queue_ea = queue;
+ args.ticks1_ea = mars_ptr_to_ea(start1_ticks);
+ args.ticks2_ea = mars_ptr_to_ea(start2_ticks);
+ args.ticks3_ea = mars_ptr_to_ea(end1_ticks);
+ task_args_send.type.u64[0] = mars_ptr_to_ea(&args);
+ task_args_wait.type.u64[0] = mars_ptr_to_ea(&args);
+
+ ret = mars_task_schedule(&task_id_send, &task_args_send, 0);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+
+ ret = mars_task_schedule(&task_id_wait, &task_args_wait, 0);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+
+ ret = mars_task_wait(&task_id_send, NULL);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+
+ ret = mars_task_wait(&task_id_wait, NULL);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+
+ ret = mars_task_barrier_destroy(barrier);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+
+ ret = mars_task_destroy(&task_id_send);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+
+ ret = mars_task_destroy(&task_id_wait);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+
+ return NULL;
+}
+
+void test1(int mpu, pthread_t * threads,
+ struct thread_arg_st *thread_args)
+{
+ int ret, i;
+ char text[128];
+ size_t size;
+ int32_t *start1_ticks, *start2_ticks, *end1_ticks, *ticks;
+ struct mars_context *mars_ctx;
+
+ size = sizeof(uint32_t) * TEST1_ELEMENT_COUNT * mpu;
+
+ ret = posix_memalign((void **)&start1_ticks, 128, size);
+ MARS_TEST_ASSERT_EQUAL(ret, 0);
+
+ ret = posix_memalign((void **)&start2_ticks, 128, size);
+ MARS_TEST_ASSERT_EQUAL(ret, 0);
+
+ ret = posix_memalign((void **)&end1_ticks, 128, size);
+ MARS_TEST_ASSERT_EQUAL(ret, 0);
+
+ ret = posix_memalign((void **)&ticks, 128, size);
+ MARS_TEST_ASSERT_EQUAL(ret, 0);
+
+ ret = mars_context_create(&mars_ctx, 0, 1);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+
+ for (i = 0; i < mpu; i++) {
+ thread_args[i].ticks1 = &start1_ticks[TEST1_ELEMENT_COUNT * i];
+ thread_args[i].ticks2 = &start2_ticks[TEST1_ELEMENT_COUNT * i];
+ thread_args[i].ticks3 = &end1_ticks[TEST1_ELEMENT_COUNT * i];
+ thread_args[i].mars_ctx = mars_ctx;
+ ret = pthread_create(&threads[i], NULL, test_thread,
+ &thread_args[i]);
+ MARS_TEST_ASSERT_EQUAL(ret, 0);
+ }
+
+ for (i = 0; i < mpu; i++) {
+ ret = pthread_join(threads[i], NULL);
+ MARS_TEST_ASSERT_EQUAL(ret, 0);
+ }
+
+ ret = mars_context_destroy(mars_ctx);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+
+ size = TEST1_ELEMENT_COUNT * mpu;
+
+ for (i = 0; i < size; i++) {
+ ticks[i] = start2_ticks[i] - start1_ticks[i];
+ }
+ sprintf(text, "queue mpu-mpu: push (%d mpu pairs)",mpu);
+ mars_test_print_statistics(ticks, size, text);
+
+ for (i = 0; i < size; i++) {
+ ticks[i] = end1_ticks[i] - start1_ticks[i];
+ }
+ sprintf(text, "queue mpu-mpu: start pop - end push (%d mpu pairs)",mpu);
+ mars_test_print_statistics(ticks, size, text);
+ for (i = 0; i < size; i++) {
+ ticks[i] = end1_ticks[i] - start2_ticks[i];
+ }
+ sprintf(text, "queue mpu-mpu: end pop - end push (%d mpu pairs)",mpu);
+ mars_test_print_statistics(ticks, size, text);
+
+ free(start1_ticks);
+ free(start2_ticks);
+ free(end1_ticks);
+ free(ticks);
+}
+
+int main(int argc, char *argv[])
+{
+ int mpu,spe;
+ size_t size;
+ pthread_t *threads;
+ struct thread_arg_st *thread_args;
+
+ spe = spe_cpu_info_get(SPE_COUNT_PHYSICAL_SPES, -1);
+
+ for(mpu = MIN_MPUS; mpu<=MAX_MPUS; mpu++){
+
+ threads = (pthread_t *) malloc(sizeof(pthread_t) * mpu);
+ MARS_TEST_ASSERT(threads != NULL);
+
+ size = sizeof(struct thread_arg_st) * mpu;
+ thread_args = (struct thread_arg_st *)malloc(size);
+ MARS_TEST_ASSERT(thread_args != NULL);
+
+ MARS_TEST_PERF_INIT();
+
+ test1(mpu, threads, thread_args);
+
+ free(thread_args);
+ free(threads);
+
+ }
+
+ return 0;
+}
diff --git a/tests/TPF/TPF_40_008/mpu1.c b/tests/TPF/TPF_40_008/mpu1.c
new file mode 100644
index 0000000..8b43b28
--- /dev/null
+++ b/tests/TPF/TPF_40_008/mpu1.c
@@ -0,0 +1,60 @@
+/*
+ * Copyright 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/task.h>
+#include <mars_test.h>
+#include <common.h>
+
+int mars_task_main(const struct mars_task_args *task_args)
+{
+ int ret, i;
+ static struct test_task_args_st args ALIGN128;
+ static uint32_t end1_ticks[TEST1_ELEMENT_COUNT] ALIGN128;
+ char buf[ELEMENT_SIZE];
+
+ mfc_get(&args, task_args->type.u64[0], sizeof(struct test_task_args_st),
+ 0, 0, 0);
+ mfc_write_tag_mask(1);
+ mfc_read_tag_status_all();
+
+ for (i = 0; i < QUEUE_DEPTH; i++) {
+ ret = mars_task_queue_push(args.queue_ea, buf);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+ }
+
+ for (i = 0; i < TEST1_ELEMENT_COUNT; i++) {
+ ret = mars_task_barrier_notify(args.barrier_ea);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+ ret = mars_task_barrier_wait(args.barrier_ea);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+
+ ret = mars_task_queue_push(args.queue_ea, buf);
+ end1_ticks[i] = mars_task_get_ticks();
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+ }
+
+ mfc_put(end1_ticks, args.ticks3_ea, TEST1_ELEMENT_COUNT * 4, 0, 0, 0);
+ mfc_write_tag_mask(1);
+ mfc_read_tag_status_all();
+ return 0;
+}
diff --git a/tests/TPF/TPF_40_008/mpu2.c b/tests/TPF/TPF_40_008/mpu2.c
new file mode 100644
index 0000000..c5236eb
--- /dev/null
+++ b/tests/TPF/TPF_40_008/mpu2.c
@@ -0,0 +1,65 @@
+/*
+ * Copyright 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/task.h>
+#include <mars_test.h>
+#include <common.h>
+
+int mars_task_main(const struct mars_task_args *task_args)
+{
+ int ret, i;
+ static struct test_task_args_st args ALIGN128;
+ static uint32_t start1_ticks[TEST1_ELEMENT_COUNT] ALIGN128;
+ static uint32_t start2_ticks[TEST1_ELEMENT_COUNT] ALIGN128;
+ char buf[ELEMENT_SIZE];
+
+ mfc_get(&args, task_args->type.u64[0], sizeof(struct test_task_args_st),
+ 0, 0, 0);
+ mfc_write_tag_mask(1);
+ mfc_read_tag_status_all();
+
+
+ for (i = 0; i < TEST1_ELEMENT_COUNT; i++) {
+ ret = mars_task_barrier_notify(args.barrier_ea);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+ ret = mars_task_barrier_wait(args.barrier_ea);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+
+ mars_test_usleep(args.tb_freq, DELAY); /*give wait task time to block */
+
+ start1_ticks[i] = mars_task_get_ticks();
+ ret = mars_task_queue_pop(args.queue_ea, buf);
+ start2_ticks[i] = mars_task_get_ticks();
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+ }
+
+ mfc_put(start1_ticks, args.ticks1_ea, TEST1_ELEMENT_COUNT * 4, 0, 0, 0);
+ mfc_write_tag_mask(1);
+ mfc_read_tag_status_all();
+
+ mfc_put(start2_ticks, args.ticks2_ea, TEST1_ELEMENT_COUNT * 4, 0, 0, 0);
+ mfc_write_tag_mask(1);
+ mfc_read_tag_status_all();
+
+ return 0;
+}
diff --git a/tests/TPF/TPF_40_009/Makefile b/tests/TPF/TPF_40_009/Makefile
new file mode 100644
index 0000000..dc68b86
--- /dev/null
+++ b/tests/TPF/TPF_40_009/Makefile
@@ -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.
+#
+
+EXTRA_LDFLAGS=-lm
+INCLUDE_CFLAGS+= -I./
+MPU_INCLUDE_CFLAGS+= -I./
+
+top_srcdir = ../..
+test_objs = host.o mpu1.task_eo mpu2.task_eo
+timeout = 120
+
+include $(top_srcdir)/scripts/config.mk
+include $(top_srcdir)/scripts/rules_item.mk
+include $(top_srcdir)/scripts/rules_tpf.mk
+
+host.o: common.h
+mpu1.task_o: common.h
+mpu2.task_o: common.h
diff --git a/tests/TPF/TPF_40_009/common.h b/tests/TPF/TPF_40_009/common.h
new file mode 100644
index 0000000..bd90801
--- /dev/null
+++ b/tests/TPF/TPF_40_009/common.h
@@ -0,0 +1,45 @@
+/*
+ * Copyright 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/task.h>
+#include <mars_test.h>
+
+#define MIN_MPUS 1
+#define MAX_MPUS 1
+
+#define QUEUE_DEPTH 16
+#define ELEMENT_SIZE 128
+#define TEST1_ELEMENT_COUNT 4096
+
+#define ALIGN128 __attribute__((aligned(128)))
+
+struct test_task_args_st {
+ uint64_t barrier_ea;
+ uint64_t ticks1_ea;
+ uint64_t ticks2_ea;
+ uint64_t ticks3_ea;
+ uint64_t queue_ea;
+ uint32_t tb_freq;
+ uint32_t pad[1];
+};
+
diff --git a/tests/TPF/TPF_40_009/host.c b/tests/TPF/TPF_40_009/host.c
new file mode 100644
index 0000000..ee13463
--- /dev/null
+++ b/tests/TPF/TPF_40_009/host.c
@@ -0,0 +1,182 @@
+/*
+ * Copyright 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 <pthread.h>
+#include <libspe2.h>
+#include <mars/task.h>
+#include <mars_test.h>
+#include <string.h>
+#include <unistd.h>
+#include <common.h>
+
+extern spe_program_handle_t mpu1_prog, mpu2_prog;
+
+struct thread_arg_st {
+ int32_t *ticks1;
+ int32_t *ticks2;
+ struct mars_context *mars_ctx;
+};
+
+void *test_thread(void *arg)
+{
+ int ret;
+ struct thread_arg_st *thread_arg = arg;
+ int32_t *push_ticks = thread_arg->ticks1;
+ int32_t *pop_ticks = thread_arg->ticks2;
+ struct mars_context *mars_ctx = thread_arg->mars_ctx;
+ struct mars_task_id task_id_send, task_id_wait;
+ struct mars_task_args task_args_send, task_args_wait;
+ static __thread struct test_task_args_st args ALIGN128;
+ uint64_t barrier;
+ uint64_t queue;
+
+
+ ret = mars_task_barrier_create(mars_ctx, &barrier, 2);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+
+ ret = mars_task_queue_create(mars_ctx, &queue,
+ ELEMENT_SIZE, QUEUE_DEPTH, MARS_TASK_QUEUE_MPU_TO_MPU);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+
+ ret = mars_task_create(mars_ctx, &task_id_send, NULL,
+ mpu1_prog.elf_image,
+ MARS_TASK_CONTEXT_SAVE_SIZE_MAX);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+
+ ret = mars_task_create(mars_ctx, &task_id_wait, NULL,
+ mpu2_prog.elf_image,
+ MARS_TASK_CONTEXT_SAVE_SIZE_MAX);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+
+ ret = mars_test_get_timebase_freq(&args.tb_freq);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+
+ args.barrier_ea = barrier;
+ args.queue_ea = queue;
+ args.ticks1_ea = mars_ptr_to_ea(push_ticks);
+ args.ticks2_ea = mars_ptr_to_ea(pop_ticks);
+ task_args_send.type.u64[0] = mars_ptr_to_ea(&args);
+ task_args_wait.type.u64[0] = mars_ptr_to_ea(&args);
+
+ ret = mars_task_schedule(&task_id_send, &task_args_send, 0);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+
+ ret = mars_task_schedule(&task_id_wait, &task_args_wait, 0);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+
+ ret = mars_task_wait(&task_id_send, NULL);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+
+ ret = mars_task_wait(&task_id_wait, NULL);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+
+ ret = mars_task_barrier_destroy(barrier);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+
+ ret = mars_task_destroy(&task_id_send);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+
+ ret = mars_task_destroy(&task_id_wait);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+
+ return NULL;
+}
+
+void test1(int mpu, pthread_t * threads,
+ struct thread_arg_st *thread_args)
+{
+ int ret, i;
+ char text[128];
+ size_t size;
+ int32_t *push_ticks, *pop_ticks;
+ struct mars_context *mars_ctx;
+
+ size = sizeof(uint32_t) * TEST1_ELEMENT_COUNT * mpu;
+
+ ret = posix_memalign((void **)&push_ticks, 128, size);
+ MARS_TEST_ASSERT_EQUAL(ret, 0);
+
+ ret = posix_memalign((void **)&pop_ticks, 128, size);
+ MARS_TEST_ASSERT_EQUAL(ret, 0);
+
+ ret = mars_context_create(&mars_ctx, 0, 1);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+
+ for (i = 0; i < mpu; i++) {
+ thread_args[i].ticks1 = &push_ticks[TEST1_ELEMENT_COUNT * i];
+ thread_args[i].ticks2 = &pop_ticks[TEST1_ELEMENT_COUNT * i];
+ thread_args[i].mars_ctx = mars_ctx;
+ ret = pthread_create(&threads[i], NULL, test_thread,
+ &thread_args[i]);
+ MARS_TEST_ASSERT_EQUAL(ret, 0);
+ }
+
+ for (i = 0; i < mpu; i++) {
+ ret = pthread_join(threads[i], NULL);
+ MARS_TEST_ASSERT_EQUAL(ret, 0);
+ }
+
+ ret = mars_context_destroy(mars_ctx);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+
+ size = TEST1_ELEMENT_COUNT * mpu;
+
+ sprintf(text, "queue mpu-mpu: push (%d mpu pairs)",mpu);
+ mars_test_print_statistics(push_ticks, size, text);
+
+ sprintf(text, "queue mpu-mpu: pop (%d mpu pairs)",mpu);
+ mars_test_print_statistics(pop_ticks, size, text);
+
+ free(push_ticks);
+ free(pop_ticks);
+}
+
+int main(int argc, char *argv[])
+{
+ int mpu,spe;
+ size_t size;
+ pthread_t *threads;
+ struct thread_arg_st *thread_args;
+
+ spe = spe_cpu_info_get(SPE_COUNT_PHYSICAL_SPES, -1);
+
+ for(mpu = MIN_MPUS; mpu<=MAX_MPUS; mpu++){
+
+ threads = (pthread_t *) malloc(sizeof(pthread_t) * mpu);
+ MARS_TEST_ASSERT(threads != NULL);
+
+ size = sizeof(struct thread_arg_st) * mpu;
+ thread_args = (struct thread_arg_st *)malloc(size);
+ MARS_TEST_ASSERT(thread_args != NULL);
+
+ MARS_TEST_PERF_INIT();
+
+ test1(mpu, threads, thread_args);
+
+ free(thread_args);
+ free(threads);
+
+ }
+
+ return 0;
+}
diff --git a/tests/TPF/TPF_40_009/mpu1.c b/tests/TPF/TPF_40_009/mpu1.c
new file mode 100644
index 0000000..e13c2e8
--- /dev/null
+++ b/tests/TPF/TPF_40_009/mpu1.c
@@ -0,0 +1,64 @@
+/*
+ * Copyright 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/task.h>
+#include <mars_test.h>
+#include "common.h"
+
+int mars_task_main(const struct mars_task_args *task_args)
+{
+ int ret, i;
+ uint32_t start, end;
+ char buf[ELEMENT_SIZE];
+ static struct test_task_args_st args ALIGN128;
+ static int32_t push_ticks[TEST1_ELEMENT_COUNT] ALIGN128;
+
+ mfc_get(&args, task_args->type.u64[0],
+ sizeof(struct test_task_args_st), 0, 0, 0);
+ mfc_write_tag_mask(1);
+ mfc_read_tag_status_all();
+
+ for (i = 0; i < QUEUE_DEPTH / 2; i++) {
+ ret = mars_task_queue_push(args.queue_ea, buf);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+ }
+
+ for (i = 0; i < TEST1_ELEMENT_COUNT; i++) {
+ start = mars_task_get_ticks();
+ ret = mars_task_queue_push(args.queue_ea, buf);
+ end = mars_task_get_ticks();
+ push_ticks[i] = end - start;
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+
+ ret = mars_task_barrier_notify(args.barrier_ea);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+ ret = mars_task_barrier_wait(args.barrier_ea);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+ }
+
+ mfc_put(push_ticks, args.ticks1_ea, sizeof(push_ticks), 0, 0, 0);
+ mfc_write_tag_mask(1);
+ mfc_read_tag_status_all();
+
+ return 0;
+}
diff --git a/tests/TPF/TPF_40_009/mpu2.c b/tests/TPF/TPF_40_009/mpu2.c
new file mode 100644
index 0000000..d3471e4
--- /dev/null
+++ b/tests/TPF/TPF_40_009/mpu2.c
@@ -0,0 +1,59 @@
+/*
+ * Copyright 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/task.h>
+#include <mars_test.h>
+#include "common.h"
+
+int mars_task_main(const struct mars_task_args *task_args)
+{
+ int ret, i;
+ uint32_t start, end;
+ char buf[ELEMENT_SIZE];
+ static struct test_task_args_st args ALIGN128;
+ static int32_t pop_ticks[TEST1_ELEMENT_COUNT] ALIGN128;
+
+ mfc_get(&args, task_args->type.u64[0],
+ sizeof(struct test_task_args_st), 0, 0, 0);
+ mfc_write_tag_mask(1);
+ mfc_read_tag_status_all();
+
+ for (i = 0; i < TEST1_ELEMENT_COUNT; i++) {
+ ret = mars_task_barrier_notify(args.barrier_ea);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+ ret = mars_task_barrier_wait(args.barrier_ea);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+
+ start = mars_task_get_ticks();
+ ret = mars_task_queue_pop(args.queue_ea, buf);
+ end = mars_task_get_ticks();
+ pop_ticks[i] = end - start;
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+ }
+
+ mfc_put(pop_ticks, args.ticks2_ea, sizeof(pop_ticks), 0, 0, 0);
+ mfc_write_tag_mask(1);
+ mfc_read_tag_status_all();
+
+ return 0;
+}
diff --git a/tests/TPF/TPF_40_010/Makefile b/tests/TPF/TPF_40_010/Makefile
new file mode 100644
index 0000000..b590ac2
--- /dev/null
+++ b/tests/TPF/TPF_40_010/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.
+#
+
+EXTRA_LDFLAGS=-lm
+INCLUDE_CFLAGS+= -I./
+MPU_INCLUDE_CFLAGS+= -I./
+
+top_srcdir = ../..
+test_objs = host.o mpu1.task_eo mpu2.task_eo mpu3.task_eo
+timeout = 120
+
+include $(top_srcdir)/scripts/config.mk
+include $(top_srcdir)/scripts/rules_item.mk
+include $(top_srcdir)/scripts/rules_tpf.mk
+
+host.o: common.h
+mpu1.task_o: common.h
+mpu2.task_o: common.h
+mpu3.task_o: common.h
diff --git a/tests/TPF/TPF_40_010/common.h b/tests/TPF/TPF_40_010/common.h
new file mode 100644
index 0000000..17f0512
--- /dev/null
+++ b/tests/TPF/TPF_40_010/common.h
@@ -0,0 +1,80 @@
+/*
+ * Copyright 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/task.h>
+#include <mars_test.h>
+
+#define QUEUE_DEPTH 16
+#define ELEMENT_SIZE 128
+#define TEST1_ELEMENT_COUNT 4096
+#define TEST2_ELEMENT_COUNT 4096
+#define TEST3_ELEMENT_COUNT 4096
+
+#define MAX_MPUS spe
+
+#define ALIGN128 __attribute__((aligned(128)))
+
+struct test_task_args_st {
+ uint64_t queue_ea;
+ uint64_t sender_to_receiver_ea;
+ uint64_t receiver_to_sender_ea;
+ uint64_t shared_resource_ea;
+ uint64_t ticks1_ea;
+ uint64_t ticks2_ea;
+ uint32_t tb_freq;
+ uint8_t pad[12];
+};
+
+/* magic to avoid the page faults during the test */
+#ifdef __SPU__
+static inline void suppress_page_faults(
+ uint64_t queue_ea, char *buf, int sender)
+{
+ int i, ret;
+
+ for (i = 0; i < QUEUE_DEPTH; i++) {
+ if (sender)
+ ret = mars_task_queue_push(queue_ea, buf);
+ else
+ ret = mars_task_queue_pop(queue_ea, buf);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+ }
+
+ mars_task_yield();
+}
+#else
+static inline void suppress_page_faults(
+ uint64_t queue, char *buf, int sender)
+{
+ int i, ret;
+
+ for (i = 0; i < QUEUE_DEPTH; i++) {
+ if (sender)
+ ret = mars_task_queue_push(queue, buf);
+ else
+ ret = mars_task_queue_pop(queue, buf);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+ }
+}
+#endif
+
diff --git a/tests/TPF/TPF_40_010/host.c b/tests/TPF/TPF_40_010/host.c
new file mode 100644
index 0000000..fb0b6eb
--- /dev/null
+++ b/tests/TPF/TPF_40_010/host.c
@@ -0,0 +1,384 @@
+/*
+ * Copyright 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 <pthread.h>
+#include <libspe2.h>
+#include <mars/task.h>
+#include <mars_test.h>
+#include <common.h>
+
+extern spe_program_handle_t mpu1_prog, mpu2_prog, mpu3_prog;
+
+struct thread_arg_st {
+ int32_t *ticks1;
+ int32_t *ticks2;
+ pthread_barrier_t *barrier;
+};
+
+void *test1_thread(void *arg)
+{
+ int i, ret;
+ uint32_t start, end;
+ struct thread_arg_st *thread_arg = arg;
+ int32_t *push_ticks = thread_arg->ticks1;
+ int32_t *pop_ticks = thread_arg->ticks2;
+ uint32_t sender_to_receiver = UINT32_MAX;
+ uint32_t receiver_to_sender = UINT32_MAX;
+ char buf[ELEMENT_SIZE];
+ struct mars_context *mars_ctx;
+ struct mars_task_id task_id;
+ struct mars_task_args task_args;
+ uint64_t queue;
+ static __thread struct test_task_args_st args ALIGN128;
+
+ ret = mars_context_create(&mars_ctx, 0, 1);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+
+ ret = mars_task_queue_create(mars_ctx, &queue,
+ ELEMENT_SIZE, QUEUE_DEPTH, MARS_TASK_QUEUE_HOST_TO_MPU);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+
+ ret = mars_task_create(mars_ctx, &task_id, NULL,
+ mpu1_prog.elf_image, MARS_TASK_CONTEXT_SAVE_SIZE_MAX);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+
+ args.queue_ea = queue;
+ args.sender_to_receiver_ea = mars_ptr_to_ea(&sender_to_receiver);
+ args.receiver_to_sender_ea = mars_ptr_to_ea(&receiver_to_sender);
+ args.ticks1_ea = mars_ptr_to_ea(pop_ticks);
+ task_args.type.u64[0] = mars_ptr_to_ea(&args);
+
+ ret = mars_task_schedule(&task_id, &task_args, 0);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+
+ ret = pthread_barrier_wait(thread_arg->barrier);
+ MARS_TEST_ASSERT(ret == PTHREAD_BARRIER_SERIAL_THREAD || ret == 0);
+
+ for (i = 0; i < TEST1_ELEMENT_COUNT; i++) {
+ start = mars_task_get_ticks();
+ ret = mars_task_queue_push(queue, buf);
+ end = mars_task_get_ticks();
+ push_ticks[i] = end - start;
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+ mars_test_counter_set(&sender_to_receiver, i);
+ mars_test_counter_wait(&receiver_to_sender, i);
+ }
+
+ ret = mars_task_wait(&task_id, NULL);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+
+ ret = mars_task_destroy(&task_id);
+ 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_ctx);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+
+ return NULL;
+}
+
+void test1(int mpu, pthread_t *threads, struct thread_arg_st *thread_args)
+{
+ int ret, i;
+ size_t size;
+ int32_t *push_ticks, *pop_ticks;
+ pthread_barrier_t barrier;
+
+ size = sizeof(int32_t) * TEST1_ELEMENT_COUNT * mpu;
+
+ push_ticks = (int32_t *)malloc(size);
+ MARS_TEST_ASSERT(push_ticks != NULL);
+
+ ret = posix_memalign((void **)&pop_ticks, 128, size);
+ MARS_TEST_ASSERT_EQUAL(ret, 0);
+
+ ret = pthread_barrier_init(&barrier, NULL, mpu);
+ MARS_TEST_ASSERT_EQUAL(ret, 0);
+
+ for (i = 0; i < mpu; i++) {
+ thread_args[i].ticks1 = &push_ticks[TEST1_ELEMENT_COUNT * i];
+ thread_args[i].ticks2 = &pop_ticks[TEST1_ELEMENT_COUNT * i];
+ thread_args[i].barrier = &barrier;
+ ret = pthread_create(&threads[i], NULL,
+ test1_thread, &thread_args[i]);
+ MARS_TEST_ASSERT_EQUAL(ret, 0);
+ }
+
+ for (i = 0; i < mpu; i++) {
+ ret = pthread_join(threads[i], NULL);
+ MARS_TEST_ASSERT_EQUAL(ret, 0);
+ }
+
+ pthread_barrier_destroy(&barrier);
+
+ size = TEST1_ELEMENT_COUNT * mpu;
+ mars_test_print_statistics(push_ticks, size, "push");
+ mars_test_print_statistics(pop_ticks, size, "pop");
+
+ free(pop_ticks);
+ free(push_ticks);
+}
+
+void *test2_thread(void *arg)
+{
+ int i, ret;
+ int32_t start, end;
+ struct thread_arg_st *thread_arg = arg;
+ int32_t *ticks = thread_arg->ticks1;
+ uint32_t sender_to_receiver = UINT32_MAX;
+ uint32_t receiver_to_sender = UINT32_MAX;
+ char buf[ELEMENT_SIZE];
+ struct mars_context *mars_ctx;
+ struct mars_task_id task_id;
+ struct mars_task_args task_args;
+ uint64_t queue;
+ static __thread struct test_task_args_st args ALIGN128;
+
+ ret = mars_context_create(&mars_ctx, 0, 1);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+
+ ret = mars_task_queue_create(mars_ctx, &queue,
+ ELEMENT_SIZE, QUEUE_DEPTH, MARS_TASK_QUEUE_HOST_TO_MPU);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+
+ ret = mars_task_create(mars_ctx, &task_id, NULL,
+ mpu2_prog.elf_image, MARS_TASK_CONTEXT_SAVE_SIZE_MAX);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+
+ args.queue_ea = queue;
+ args.sender_to_receiver_ea = mars_ptr_to_ea(&sender_to_receiver);
+ args.receiver_to_sender_ea = mars_ptr_to_ea(&receiver_to_sender);
+ args.shared_resource_ea = mars_ptr_to_ea(&end);
+ task_args.type.u64[0] = mars_ptr_to_ea(&args);
+
+ ret = mars_task_schedule(&task_id, &task_args, 0);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+
+ suppress_page_faults(queue, buf, 1);
+
+ pthread_barrier_wait(thread_arg->barrier);
+
+ for (i = 0; i < TEST2_ELEMENT_COUNT; i++) {
+ mars_test_counter_wait(&receiver_to_sender, i * 2);
+ mars_test_counter_set(&sender_to_receiver, i * 2);
+
+ /* wait for the MARS task blocked */
+ usleep(DELAY);
+
+ start = mars_task_get_ticks();
+ ret = mars_task_queue_push(queue, buf);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+
+ mars_test_counter_wait(&receiver_to_sender, i * 2 + 1);
+ ticks[i] = end - start;
+ mars_test_counter_set(&sender_to_receiver, i * 2 + 1);
+ }
+
+ ret = mars_task_wait(&task_id, NULL);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+
+ ret = mars_task_destroy(&task_id);
+ 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_ctx);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+
+ return NULL;
+}
+
+void test2(int mpu, pthread_t *threads, struct thread_arg_st *thread_args)
+{
+ int ret, i;
+ size_t size;
+ int32_t *ticks;
+ pthread_barrier_t barrier;
+
+ size = sizeof(int32_t) * TEST2_ELEMENT_COUNT * mpu;
+ ticks = (int32_t *)malloc(size);
+ MARS_TEST_ASSERT(ticks != NULL);
+
+ ret = pthread_barrier_init(&barrier, NULL, mpu);
+ MARS_TEST_ASSERT_EQUAL(ret, 0);
+
+ for (i = 0; i < mpu; i++) {
+ thread_args[i].ticks1 = &ticks[TEST2_ELEMENT_COUNT * i];
+ thread_args[i].barrier = &barrier;
+ ret = pthread_create(&threads[i], NULL,
+ test2_thread, &thread_args[i]);
+ MARS_TEST_ASSERT_EQUAL(ret, 0);
+ }
+
+ for (i = 0; i < mpu; i++) {
+ ret = pthread_join(threads[i], NULL);
+ MARS_TEST_ASSERT_EQUAL(ret, 0);
+ }
+
+ pthread_barrier_destroy(&barrier);
+
+ size = TEST2_ELEMENT_COUNT * mpu;
+ mars_test_print_statistics(
+ ticks, size, "beginning of push - end of pop");
+
+ free(ticks);
+}
+
+void *test3_thread(void *arg)
+{
+ int i, ret;
+ int32_t start, end;
+ struct thread_arg_st *thread_arg = arg;
+ int32_t *ticks = thread_arg->ticks1;
+ uint32_t sender_to_receiver = UINT32_MAX;
+ uint32_t receiver_to_sender = UINT32_MAX;
+ char buf[ELEMENT_SIZE];
+ struct mars_context *mars_ctx;
+ struct mars_task_id task_id;
+ struct mars_task_args task_args;
+ uint64_t queue;
+ static __thread struct test_task_args_st args ALIGN128;
+
+ ret = mars_context_create(&mars_ctx, 0, 1);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+
+ ret = mars_task_queue_create(mars_ctx, &queue,
+ ELEMENT_SIZE, QUEUE_DEPTH, MARS_TASK_QUEUE_HOST_TO_MPU);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+
+ ret = mars_task_create(mars_ctx, &task_id, NULL,
+ mpu3_prog.elf_image, MARS_TASK_CONTEXT_SAVE_SIZE_MAX);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+
+ args.queue_ea = queue;
+ args.sender_to_receiver_ea = mars_ptr_to_ea(&sender_to_receiver);
+ args.receiver_to_sender_ea = mars_ptr_to_ea(&receiver_to_sender);
+ args.shared_resource_ea = mars_ptr_to_ea(&end);
+ task_args.type.u64[0] = mars_ptr_to_ea(&args);
+
+ ret = mars_task_schedule(&task_id, &task_args, 0);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+
+ suppress_page_faults(queue, buf, 1);
+
+ pthread_barrier_wait(thread_arg->barrier);
+
+ for (i = 0; i < TEST3_ELEMENT_COUNT; i++) {
+ mars_test_counter_wait(&receiver_to_sender, i * 2);
+ mars_test_counter_set(&sender_to_receiver, i * 2);
+
+ /* wait for the MARS task blocked */
+ usleep(DELAY);
+
+ ret = mars_task_queue_push(queue, buf);
+ start = mars_task_get_ticks();
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+
+ mars_test_counter_wait(&receiver_to_sender, i * 2 + 1);
+ ticks[i] = end - start;
+ mars_test_counter_set(&sender_to_receiver, i * 2 + 1);
+ }
+
+ ret = mars_task_wait(&task_id, NULL);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+
+ ret = mars_task_destroy(&task_id);
+ 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_ctx);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+
+ return NULL;
+}
+
+void test3(int mpu, pthread_t *threads, struct thread_arg_st *thread_args)
+{
+ int ret, i;
+ size_t size;
+ int32_t *ticks;
+ pthread_barrier_t barrier;
+
+ size = sizeof(int32_t) * TEST3_ELEMENT_COUNT * mpu;
+ ticks = (int32_t *)malloc(size);
+ MARS_TEST_ASSERT(ticks != NULL);
+
+ ret = pthread_barrier_init(&barrier, NULL, mpu);
+ MARS_TEST_ASSERT_EQUAL(ret, 0);
+
+ for (i = 0; i < mpu; i++) {
+ thread_args[i].ticks1 = &ticks[TEST3_ELEMENT_COUNT * i];
+ thread_args[i].barrier = &barrier;
+ ret = pthread_create(&threads[i], NULL,
+ test2_thread, &thread_args[i]);
+ MARS_TEST_ASSERT_EQUAL(ret, 0);
+ }
+
+ for (i = 0; i < mpu; i++) {
+ ret = pthread_join(threads[i], NULL);
+ MARS_TEST_ASSERT_EQUAL(ret, 0);
+ }
+
+ pthread_barrier_destroy(&barrier);
+
+ size = TEST3_ELEMENT_COUNT * mpu;
+ mars_test_print_statistics(
+ ticks, size, "end of push - end of pop");
+
+ free(ticks);
+}
+
+int main(int argc, char *argv[])
+{
+ int mpu, spe;
+ size_t size;
+ pthread_t *threads;
+ struct thread_arg_st *thread_args;
+
+ spe = spe_cpu_info_get(SPE_COUNT_PHYSICAL_SPES, -1);
+
+ mpu = MAX_MPUS;
+
+ threads = (pthread_t *)malloc(sizeof(pthread_t) * mpu);
+ MARS_TEST_ASSERT(threads != NULL);
+
+ size = sizeof(struct thread_arg_st) * mpu;
+ thread_args = (struct thread_arg_st *)malloc(size);
+ MARS_TEST_ASSERT(thread_args != NULL);
+
+ MARS_TEST_PERF_INIT();
+
+ test1(mpu, threads, thread_args);
+ test2(mpu, threads, thread_args);
+ test3(mpu, threads, thread_args);
+
+ free(thread_args);
+ free(threads);
+
+ return 0;
+}
diff --git a/tests/TPF/TPF_40_010/mpu1.c b/tests/TPF/TPF_40_010/mpu1.c
new file mode 100644
index 0000000..7172948
--- /dev/null
+++ b/tests/TPF/TPF_40_010/mpu1.c
@@ -0,0 +1,57 @@
+/*
+ * Copyright 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/task.h>
+#include <mars_test.h>
+#include "common.h"
+
+int mars_task_main(const struct mars_task_args *task_args)
+{
+ int ret, i;
+ uint32_t start, end;
+ char buf[ELEMENT_SIZE];
+ static struct test_task_args_st args ALIGN128;
+ static int32_t pop_ticks[TEST1_ELEMENT_COUNT] ALIGN128;
+
+ mfc_get(&args, task_args->type.u64[0],
+ sizeof(struct test_task_args_st), 0, 0, 0);
+ mfc_write_tag_mask(1);
+ mfc_read_tag_status_all();
+
+ for (i = 0; i < TEST1_ELEMENT_COUNT; i++) {
+ mars_test_counter_wait(args.sender_to_receiver_ea, i);
+ start = mars_task_get_ticks();
+ ret = mars_task_queue_pop(args.queue_ea, buf);
+ end = mars_task_get_ticks();
+ pop_ticks[i] = end - start;
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+ mars_test_counter_set(args.receiver_to_sender_ea, i);
+ }
+
+ mfc_put(pop_ticks, args.ticks1_ea, sizeof(pop_ticks), 0, 0, 0);
+ mfc_write_tag_mask(1);
+ mfc_read_tag_status_all();
+
+ return 0;
+}
diff --git a/tests/TPF/TPF_40_010/mpu2.c b/tests/TPF/TPF_40_010/mpu2.c
new file mode 100644
index 0000000..f56120a
--- /dev/null
+++ b/tests/TPF/TPF_40_010/mpu2.c
@@ -0,0 +1,57 @@
+/*
+ * Copyright 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/task.h>
+#include <mars_test.h>
+#include "common.h"
+
+int mars_task_main(const struct mars_task_args *task_args)
+{
+ int ret, i;
+ uint32_t end;
+ char buf[ELEMENT_SIZE];
+ static struct test_task_args_st args ALIGN128;
+
+ mfc_get(&args, task_args->type.u64[0],
+ sizeof(struct test_task_args_st), 0, 0, 0);
+ mfc_write_tag_mask(1);
+ mfc_read_tag_status_all();
+
+ suppress_page_faults(args.queue_ea, buf, 0);
+
+ for (i = 0; i < TEST2_ELEMENT_COUNT; i++) {
+ mars_test_counter_set(args.receiver_to_sender_ea, i * 2);
+ mars_test_counter_wait(args.sender_to_receiver_ea, i * 2);
+
+ ret = mars_task_queue_pop(args.queue_ea, buf);
+ end = mars_task_get_ticks();
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+
+ mars_test_int32_put(args.shared_resource_ea, end);
+ mars_test_counter_set(args.receiver_to_sender_ea, i * 2 + 1);
+ mars_test_counter_wait(args.sender_to_receiver_ea, i * 2 + 1);
+ }
+
+ return 0;
+}
diff --git a/tests/TPF/TPF_40_010/mpu3.c b/tests/TPF/TPF_40_010/mpu3.c
new file mode 100644
index 0000000..2653be8
--- /dev/null
+++ b/tests/TPF/TPF_40_010/mpu3.c
@@ -0,0 +1,57 @@
+/*
+ * Copyright 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/task.h>
+#include <mars_test.h>
+#include "common.h"
+
+int mars_task_main(const struct mars_task_args *task_args)
+{
+ int ret, i;
+ uint32_t end;
+ char buf[ELEMENT_SIZE];
+ static struct test_task_args_st args ALIGN128;
+
+ mfc_get(&args, task_args->type.u64[0],
+ sizeof(struct test_task_args_st), 0, 0, 0);
+ mfc_write_tag_mask(1);
+ mfc_read_tag_status_all();
+
+ suppress_page_faults(args.queue_ea, buf, 0);
+
+ for (i = 0; i < TEST3_ELEMENT_COUNT; i++) {
+ mars_test_counter_set(args.receiver_to_sender_ea, i * 2);
+ mars_test_counter_wait(args.sender_to_receiver_ea, i * 2);
+
+ ret = mars_task_queue_pop(args.queue_ea, buf);
+ end = mars_task_get_ticks();
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+
+ mars_test_int32_put(args.shared_resource_ea, end);
+ mars_test_counter_set(args.receiver_to_sender_ea, i * 2 + 1);
+ mars_test_counter_wait(args.sender_to_receiver_ea, i * 2 + 1);
+ }
+
+ return 0;
+}
diff --git a/tests/TPF/TPF_40_011/Makefile b/tests/TPF/TPF_40_011/Makefile
new file mode 100644
index 0000000..b590ac2
--- /dev/null
+++ b/tests/TPF/TPF_40_011/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.
+#
+
+EXTRA_LDFLAGS=-lm
+INCLUDE_CFLAGS+= -I./
+MPU_INCLUDE_CFLAGS+= -I./
+
+top_srcdir = ../..
+test_objs = host.o mpu1.task_eo mpu2.task_eo mpu3.task_eo
+timeout = 120
+
+include $(top_srcdir)/scripts/config.mk
+include $(top_srcdir)/scripts/rules_item.mk
+include $(top_srcdir)/scripts/rules_tpf.mk
+
+host.o: common.h
+mpu1.task_o: common.h
+mpu2.task_o: common.h
+mpu3.task_o: common.h
diff --git a/tests/TPF/TPF_40_011/common.h b/tests/TPF/TPF_40_011/common.h
new file mode 100644
index 0000000..ce77d5e
--- /dev/null
+++ b/tests/TPF/TPF_40_011/common.h
@@ -0,0 +1,47 @@
+/*
+ * Copyright 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/task.h>
+#include <mars_test.h>
+
+#define QUEUE_DEPTH 16
+#define ELEMENT_SIZE 128
+#define TEST1_ELEMENT_COUNT 4096
+#define TEST2_ELEMENT_COUNT 4096
+#define TEST3_ELEMENT_COUNT 4096
+
+#define MAX_MPUS spe
+
+#define ALIGN128 __attribute__((aligned(128)))
+
+struct test_task_args_st {
+ uint64_t queue_ea;
+ uint64_t sender_to_receiver_ea;
+ uint64_t receiver_to_sender_ea;
+ uint64_t shared_resource_ea;
+ uint64_t ticks1_ea;
+ uint64_t ticks2_ea;
+ uint32_t tb_freq;
+ uint8_t pad[12];
+};
+
diff --git a/tests/TPF/TPF_40_011/host.c b/tests/TPF/TPF_40_011/host.c
new file mode 100644
index 0000000..d397ef6
--- /dev/null
+++ b/tests/TPF/TPF_40_011/host.c
@@ -0,0 +1,398 @@
+/*
+ * Copyright 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 <pthread.h>
+#include <libspe2.h>
+#include <mars/task.h>
+#include <mars_test.h>
+#include <common.h>
+
+extern spe_program_handle_t mpu1_prog, mpu2_prog, mpu3_prog;
+
+struct thread_arg_st {
+ int32_t *ticks1;
+ int32_t *ticks2;
+ pthread_barrier_t *barrier;
+};
+
+void *test1_thread(void *arg)
+{
+ int i, ret;
+ uint32_t start, end;
+ struct thread_arg_st *thread_arg = arg;
+ int32_t *push_ticks = thread_arg->ticks1;
+ int32_t *pop_ticks = thread_arg->ticks2;
+ uint32_t sender_to_receiver = UINT32_MAX;
+ uint32_t receiver_to_sender = UINT32_MAX;
+ char buf[ELEMENT_SIZE];
+ struct mars_context *mars_ctx;
+ struct mars_task_id task_id;
+ struct mars_task_args task_args;
+ uint64_t queue;
+ static __thread struct test_task_args_st args ALIGN128;
+
+ ret = mars_context_create(&mars_ctx, 0, 1);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+
+ ret = mars_task_queue_create(mars_ctx, &queue,
+ ELEMENT_SIZE, QUEUE_DEPTH, MARS_TASK_QUEUE_HOST_TO_MPU);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+
+ ret = mars_task_create(mars_ctx, &task_id, NULL,
+ mpu1_prog.elf_image, MARS_TASK_CONTEXT_SAVE_SIZE_MAX);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+
+ for (i = 0; i < QUEUE_DEPTH - 1; i++) {
+ ret = mars_task_queue_push(queue, buf);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+ }
+
+ args.queue_ea = queue;
+ args.sender_to_receiver_ea = mars_ptr_to_ea(&sender_to_receiver);
+ args.receiver_to_sender_ea = mars_ptr_to_ea(&receiver_to_sender);
+ args.ticks1_ea = mars_ptr_to_ea(pop_ticks);
+ task_args.type.u64[0] = mars_ptr_to_ea(&args);
+
+ ret = mars_task_schedule(&task_id, &task_args, 0);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+
+ ret = pthread_barrier_wait(thread_arg->barrier);
+ MARS_TEST_ASSERT(ret == PTHREAD_BARRIER_SERIAL_THREAD || ret == 0);
+
+ for (i = 0; i < TEST1_ELEMENT_COUNT; i++) {
+ start = mars_task_get_ticks();
+ ret = mars_task_queue_push(queue, buf);
+ end = mars_task_get_ticks();
+ push_ticks[i] = end - start;
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+ mars_test_counter_set(&sender_to_receiver, i);
+ mars_test_counter_wait(&receiver_to_sender, i);
+ }
+
+ ret = mars_task_wait(&task_id, NULL);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+
+ ret = mars_task_destroy(&task_id);
+ 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_ctx);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+
+ return NULL;
+}
+
+void test1(int mpu, pthread_t *threads, struct thread_arg_st *thread_args)
+{
+ int ret, i;
+ size_t size;
+ int32_t *push_ticks, *pop_ticks;
+ pthread_barrier_t barrier;
+
+ size = sizeof(int32_t) * TEST1_ELEMENT_COUNT * mpu;
+
+ push_ticks = (int32_t *)malloc(size);
+ MARS_TEST_ASSERT(push_ticks != NULL);
+
+ ret = posix_memalign((void **)&pop_ticks, 128, size);
+ MARS_TEST_ASSERT_EQUAL(ret, 0);
+
+ ret = pthread_barrier_init(&barrier, NULL, mpu);
+ MARS_TEST_ASSERT_EQUAL(ret, 0);
+
+ for (i = 0; i < mpu; i++) {
+ thread_args[i].ticks1 = &push_ticks[TEST1_ELEMENT_COUNT * i];
+ thread_args[i].ticks2 = &pop_ticks[TEST1_ELEMENT_COUNT * i];
+ thread_args[i].barrier = &barrier;
+ ret = pthread_create(&threads[i], NULL,
+ test1_thread, &thread_args[i]);
+ MARS_TEST_ASSERT_EQUAL(ret, 0);
+ }
+
+ for (i = 0; i < mpu; i++) {
+ ret = pthread_join(threads[i], NULL);
+ MARS_TEST_ASSERT_EQUAL(ret, 0);
+ }
+
+ pthread_barrier_destroy(&barrier);
+
+ size = TEST1_ELEMENT_COUNT * mpu;
+ mars_test_print_statistics(push_ticks, size, "push");
+ mars_test_print_statistics(pop_ticks, size, "pop");
+
+ free(pop_ticks);
+ free(push_ticks);
+}
+
+void *test2_thread(void *arg)
+{
+ int i, ret;
+ int32_t start, end;
+ struct thread_arg_st *thread_arg = arg;
+ int32_t *ticks = thread_arg->ticks1;
+ uint32_t sender_to_receiver = UINT32_MAX;
+ uint32_t receiver_to_sender = UINT32_MAX;
+ char buf[ELEMENT_SIZE];
+ struct mars_context *mars_ctx;
+ struct mars_task_id task_id;
+ struct mars_task_args task_args;
+ uint64_t queue;
+ static __thread struct test_task_args_st args ALIGN128;
+
+ ret = mars_test_get_timebase_freq(&args.tb_freq);
+ MARS_TEST_ASSERT_EQUAL(ret, 0);
+
+ ret = mars_context_create(&mars_ctx, 0, 1);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+
+ ret = mars_task_queue_create(mars_ctx, &queue,
+ ELEMENT_SIZE, 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, buf);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+ }
+
+ ret = mars_task_create(mars_ctx, &task_id, NULL,
+ mpu2_prog.elf_image, MARS_TASK_CONTEXT_SAVE_SIZE_MAX);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+
+ args.queue_ea = queue;
+ args.sender_to_receiver_ea = mars_ptr_to_ea(&sender_to_receiver);
+ args.receiver_to_sender_ea = mars_ptr_to_ea(&receiver_to_sender);
+ args.shared_resource_ea = mars_ptr_to_ea(&start);
+ task_args.type.u64[0] = mars_ptr_to_ea(&args);
+
+ ret = mars_task_schedule(&task_id, &task_args, 0);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+
+ pthread_barrier_wait(thread_arg->barrier);
+
+ for (i = 0; i < TEST2_ELEMENT_COUNT; i++) {
+ mars_test_counter_wait(&receiver_to_sender, i * 2);
+ mars_test_counter_set(&sender_to_receiver, i * 2);
+
+ ret = mars_task_queue_push(queue, buf);
+ end = mars_task_get_ticks();
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+
+ mars_test_counter_wait(&receiver_to_sender, i * 2 + 1);
+ ticks[i] = end - start;
+ mars_test_counter_set(&sender_to_receiver, i * 2 + 1);
+ }
+
+ ret = mars_task_wait(&task_id, NULL);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+
+ ret = mars_task_destroy(&task_id);
+ 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_ctx);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+
+ return NULL;
+}
+
+void test2(int mpu, pthread_t *threads, struct thread_arg_st *thread_args)
+{
+ int ret, i;
+ size_t size;
+ int32_t *ticks;
+ pthread_barrier_t barrier;
+
+ size = sizeof(int32_t) * TEST2_ELEMENT_COUNT * mpu;
+ ticks = (int32_t *)malloc(size);
+ MARS_TEST_ASSERT(ticks != NULL);
+
+ ret = pthread_barrier_init(&barrier, NULL, mpu);
+ MARS_TEST_ASSERT_EQUAL(ret, 0);
+
+ for (i = 0; i < mpu; i++) {
+ thread_args[i].ticks1 = &ticks[TEST2_ELEMENT_COUNT * i];
+ thread_args[i].barrier = &barrier;
+ ret = pthread_create(&threads[i], NULL,
+ test2_thread, &thread_args[i]);
+ MARS_TEST_ASSERT_EQUAL(ret, 0);
+ }
+
+ for (i = 0; i < mpu; i++) {
+ ret = pthread_join(threads[i], NULL);
+ MARS_TEST_ASSERT_EQUAL(ret, 0);
+ }
+
+ pthread_barrier_destroy(&barrier);
+
+ size = TEST2_ELEMENT_COUNT * mpu;
+ mars_test_print_statistics(
+ ticks, size, "beginning of pop - end of push");
+
+ free(ticks);
+}
+
+void *test3_thread(void *arg)
+{
+ int i, ret;
+ int32_t start, end;
+ struct thread_arg_st *thread_arg = arg;
+ int32_t *ticks = thread_arg->ticks1;
+ uint32_t sender_to_receiver = UINT32_MAX;
+ uint32_t receiver_to_sender = UINT32_MAX;
+ char buf[ELEMENT_SIZE];
+ struct mars_context *mars_ctx;
+ struct mars_task_id task_id;
+ struct mars_task_args task_args;
+ uint64_t queue;
+ static __thread struct test_task_args_st args ALIGN128;
+
+ ret = mars_test_get_timebase_freq(&args.tb_freq);
+ MARS_TEST_ASSERT_EQUAL(ret, 0);
+
+ ret = mars_context_create(&mars_ctx, 0, 1);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+
+ ret = mars_task_queue_create(mars_ctx, &queue,
+ ELEMENT_SIZE, 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, buf);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+ }
+
+ ret = mars_task_create(mars_ctx, &task_id, NULL,
+ mpu3_prog.elf_image, MARS_TASK_CONTEXT_SAVE_SIZE_MAX);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+
+ args.queue_ea = queue;
+ args.sender_to_receiver_ea = mars_ptr_to_ea(&sender_to_receiver);
+ args.receiver_to_sender_ea = mars_ptr_to_ea(&receiver_to_sender);
+ args.shared_resource_ea = mars_ptr_to_ea(&start);
+ task_args.type.u64[0] = mars_ptr_to_ea(&args);
+
+ ret = mars_task_schedule(&task_id, &task_args, 0);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+
+ pthread_barrier_wait(thread_arg->barrier);
+
+ for (i = 0; i < TEST3_ELEMENT_COUNT; i++) {
+ mars_test_counter_wait(&receiver_to_sender, i * 2);
+ mars_test_counter_set(&sender_to_receiver, i * 2);
+
+ /* wait for the MARS task blocked */
+ usleep(DELAY);
+
+ ret = mars_task_queue_push(queue, buf);
+ end = mars_task_get_ticks();
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+
+ mars_test_counter_wait(&receiver_to_sender, i * 2 + 1);
+ ticks[i] = end - start;
+ mars_test_counter_set(&sender_to_receiver, i * 2 + 1);
+ }
+
+ ret = mars_task_wait(&task_id, NULL);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+
+ ret = mars_task_destroy(&task_id);
+ 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_ctx);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+
+ return NULL;
+}
+
+void test3(int mpu, pthread_t *threads, struct thread_arg_st *thread_args)
+{
+ int ret, i;
+ size_t size;
+ int32_t *ticks;
+ pthread_barrier_t barrier;
+
+ size = sizeof(int32_t) * TEST3_ELEMENT_COUNT * mpu;
+ ticks = (int32_t *)malloc(size);
+ MARS_TEST_ASSERT(ticks != NULL);
+
+ ret = pthread_barrier_init(&barrier, NULL, mpu);
+ MARS_TEST_ASSERT_EQUAL(ret, 0);
+
+ for (i = 0; i < mpu; i++) {
+ thread_args[i].ticks1 = &ticks[TEST3_ELEMENT_COUNT * i];
+ thread_args[i].barrier = &barrier;
+ ret = pthread_create(&threads[i], NULL,
+ test2_thread, &thread_args[i]);
+ MARS_TEST_ASSERT_EQUAL(ret, 0);
+ }
+
+ for (i = 0; i < mpu; i++) {
+ ret = pthread_join(threads[i], NULL);
+ MARS_TEST_ASSERT_EQUAL(ret, 0);
+ }
+
+ pthread_barrier_destroy(&barrier);
+
+ size = TEST3_ELEMENT_COUNT * mpu;
+ mars_test_print_statistics(
+ ticks, size, "end of pop - end of push");
+
+ free(ticks);
+}
+
+int main(int argc, char *argv[])
+{
+ int spe, mpu;
+ size_t size;
+ pthread_t *threads;
+ struct thread_arg_st *thread_args;
+
+ spe = spe_cpu_info_get(SPE_COUNT_PHYSICAL_SPES, -1);
+
+ mpu = MAX_MPUS;
+
+ threads = (pthread_t *)malloc(sizeof(pthread_t) * mpu);
+ MARS_TEST_ASSERT(threads != NULL);
+
+ size = sizeof(struct thread_arg_st) * mpu;
+ thread_args = (struct thread_arg_st *)malloc(size);
+ MARS_TEST_ASSERT(thread_args != NULL);
+
+ MARS_TEST_PERF_INIT();
+
+ test1(mpu, threads, thread_args);
+ test2(mpu, threads, thread_args);
+ test3(mpu, threads, thread_args);
+
+ free(thread_args);
+ free(threads);
+
+ return 0;
+}
diff --git a/tests/TPF/TPF_40_011/mpu1.c b/tests/TPF/TPF_40_011/mpu1.c
new file mode 100644
index 0000000..0cc409a
--- /dev/null
+++ b/tests/TPF/TPF_40_011/mpu1.c
@@ -0,0 +1,60 @@
+/*
+ * Copyright 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/task.h>
+#include <mars_test.h>
+#include "common.h"
+
+int mars_task_main(const struct mars_task_args *task_args)
+{
+ int ret, i;
+ uint32_t start, end;
+ char buf[ELEMENT_SIZE];
+ static struct test_task_args_st args ALIGN128;
+ static int32_t pop_ticks[TEST1_ELEMENT_COUNT] ALIGN128;
+
+ mfc_get(&args, task_args->type.u64[0],
+ sizeof(struct test_task_args_st), 0, 0, 0);
+ mfc_write_tag_mask(1);
+ mfc_read_tag_status_all();
+
+ for (i = 0; i < TEST1_ELEMENT_COUNT; i++) {
+ mars_test_counter_wait(args.sender_to_receiver_ea, i);
+
+ start = mars_task_get_ticks();
+ ret = mars_task_queue_pop(args.queue_ea, buf);
+ end = mars_task_get_ticks();
+
+ pop_ticks[i] = end - start;
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+
+ mars_test_counter_set(args.receiver_to_sender_ea, i);
+ }
+
+ mfc_put(pop_ticks, args.ticks1_ea, sizeof(pop_ticks), 0, 0, 0);
+ mfc_write_tag_mask(1);
+ mfc_read_tag_status_all();
+
+ return 0;
+}
diff --git a/tests/TPF/TPF_40_011/mpu2.c b/tests/TPF/TPF_40_011/mpu2.c
new file mode 100644
index 0000000..7fd77d7
--- /dev/null
+++ b/tests/TPF/TPF_40_011/mpu2.c
@@ -0,0 +1,61 @@
+/*
+ * Copyright 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/task.h>
+#include <mars_test.h>
+#include "common.h"
+
+int mars_task_main(const struct mars_task_args *task_args)
+{
+ int ret, i;
+ uint32_t start;
+ char buf[ELEMENT_SIZE];
+ static struct test_task_args_st args ALIGN128;
+
+ mfc_get(&args, task_args->type.u64[0],
+ sizeof(struct test_task_args_st), 0, 0, 0);
+ mfc_write_tag_mask(1);
+ mfc_read_tag_status_all();
+
+ /* This MPU task will not be blocked and the internal buffer of
+ the queue is already touched, so suppress_page_faults() is
+ needless. */
+
+ for (i = 0; i < TEST2_ELEMENT_COUNT; i++) {
+ mars_test_counter_set(args.receiver_to_sender_ea, i * 2);
+ mars_test_counter_wait(args.sender_to_receiver_ea, i * 2);
+
+ mars_test_usleep(args.tb_freq, DELAY);
+
+ start = mars_task_get_ticks();
+ ret = mars_task_queue_pop(args.queue_ea, buf);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+
+ mars_test_int32_put(args.shared_resource_ea, start);
+ mars_test_counter_set(args.receiver_to_sender_ea, i * 2 + 1);
+ mars_test_counter_wait(args.sender_to_receiver_ea, i * 2 + 1);
+ }
+
+ return 0;
+}
diff --git a/tests/TPF/TPF_40_011/mpu3.c b/tests/TPF/TPF_40_011/mpu3.c
new file mode 100644
index 0000000..5976a45
--- /dev/null
+++ b/tests/TPF/TPF_40_011/mpu3.c
@@ -0,0 +1,62 @@
+/*
+ * Copyright 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/task.h>
+#include <mars_test.h>
+#include "common.h"
+
+int mars_task_main(const struct mars_task_args *task_args)
+{
+ int ret, i;
+ uint32_t start;
+ char buf[ELEMENT_SIZE];
+ static struct test_task_args_st args ALIGN128;
+
+ mfc_get(&args, task_args->type.u64[0],
+ sizeof(struct test_task_args_st), 0, 0, 0);
+ mfc_write_tag_mask(1);
+ mfc_read_tag_status_all();
+
+ /* This MPU task will not be blocked and the internal buffer of
+ the queue is already touched, so suppress_page_faults() is
+ needless. */
+ mars_task_yield();
+
+ for (i = 0; i < TEST3_ELEMENT_COUNT; i++) {
+ mars_test_counter_set(args.receiver_to_sender_ea, i * 2);
+ mars_test_counter_wait(args.sender_to_receiver_ea, i * 2);
+
+ mars_test_usleep(args.tb_freq, DELAY);
+
+ ret = mars_task_queue_pop(args.queue_ea, buf);
+ start = mars_task_get_ticks();
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+
+ mars_test_int32_put(args.shared_resource_ea, start);
+ mars_test_counter_set(args.receiver_to_sender_ea, i * 2 + 1);
+ mars_test_counter_wait(args.sender_to_receiver_ea, i * 2 + 1);
+ }
+
+ return 0;
+}
diff --git a/tests/TPF/TPF_40_012/Makefile b/tests/TPF/TPF_40_012/Makefile
new file mode 100644
index 0000000..97b0752
--- /dev/null
+++ b/tests/TPF/TPF_40_012/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.
+#
+
+EXTRA_LDFLAGS=-lm
+INCLUDE_CFLAGS+= -I./
+MPU_INCLUDE_CFLAGS+= -I./
+
+top_srcdir = ../..
+test_objs = host.o mpu1.task_eo
+timeout = 120
+
+include $(top_srcdir)/scripts/config.mk
+include $(top_srcdir)/scripts/rules_item.mk
+include $(top_srcdir)/scripts/rules_tpf.mk
+
+host.o: common.h
+mpu1.task_o: common.h
+mpu2.task_o: common.h
+mpu3.task_o: common.h
diff --git a/tests/TPF/TPF_40_012/common.h b/tests/TPF/TPF_40_012/common.h
new file mode 100644
index 0000000..17f0512
--- /dev/null
+++ b/tests/TPF/TPF_40_012/common.h
@@ -0,0 +1,80 @@
+/*
+ * Copyright 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/task.h>
+#include <mars_test.h>
+
+#define QUEUE_DEPTH 16
+#define ELEMENT_SIZE 128
+#define TEST1_ELEMENT_COUNT 4096
+#define TEST2_ELEMENT_COUNT 4096
+#define TEST3_ELEMENT_COUNT 4096
+
+#define MAX_MPUS spe
+
+#define ALIGN128 __attribute__((aligned(128)))
+
+struct test_task_args_st {
+ uint64_t queue_ea;
+ uint64_t sender_to_receiver_ea;
+ uint64_t receiver_to_sender_ea;
+ uint64_t shared_resource_ea;
+ uint64_t ticks1_ea;
+ uint64_t ticks2_ea;
+ uint32_t tb_freq;
+ uint8_t pad[12];
+};
+
+/* magic to avoid the page faults during the test */
+#ifdef __SPU__
+static inline void suppress_page_faults(
+ uint64_t queue_ea, char *buf, int sender)
+{
+ int i, ret;
+
+ for (i = 0; i < QUEUE_DEPTH; i++) {
+ if (sender)
+ ret = mars_task_queue_push(queue_ea, buf);
+ else
+ ret = mars_task_queue_pop(queue_ea, buf);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+ }
+
+ mars_task_yield();
+}
+#else
+static inline void suppress_page_faults(
+ uint64_t queue, char *buf, int sender)
+{
+ int i, ret;
+
+ for (i = 0; i < QUEUE_DEPTH; i++) {
+ if (sender)
+ ret = mars_task_queue_push(queue, buf);
+ else
+ ret = mars_task_queue_pop(queue, buf);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+ }
+}
+#endif
+
diff --git a/tests/TPF/TPF_40_012/host.c b/tests/TPF/TPF_40_012/host.c
new file mode 100644
index 0000000..25d1aba
--- /dev/null
+++ b/tests/TPF/TPF_40_012/host.c
@@ -0,0 +1,175 @@
+/*
+ * Copyright 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 <pthread.h>
+#include <libspe2.h>
+#include <mars/task.h>
+#include <mars_test.h>
+#include <common.h>
+
+extern spe_program_handle_t mpu1_prog, mpu2_prog, mpu3_prog;
+
+struct thread_arg_st {
+ int32_t *ticks1;
+ int32_t *ticks2;
+ pthread_barrier_t *barrier;
+};
+
+void *test1_thread(void *arg)
+{
+ int i, ret;
+ uint32_t start, end;
+ struct thread_arg_st *thread_arg = arg;
+ int32_t *push_ticks = thread_arg->ticks1;
+ int32_t *pop_ticks = thread_arg->ticks2;
+ uint32_t sender_to_receiver = UINT32_MAX;
+ uint32_t receiver_to_sender = UINT32_MAX;
+ char buf[ELEMENT_SIZE];
+ struct mars_context *mars_ctx;
+ struct mars_task_id task_id;
+ struct mars_task_args task_args;
+ uint64_t queue;
+ static __thread struct test_task_args_st args ALIGN128;
+
+ ret = mars_context_create(&mars_ctx, 0, 1);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+
+ ret = mars_task_queue_create(mars_ctx, &queue,
+ ELEMENT_SIZE, QUEUE_DEPTH, MARS_TASK_QUEUE_HOST_TO_MPU);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+
+ ret = mars_task_create(mars_ctx, &task_id, NULL,
+ mpu1_prog.elf_image, MARS_TASK_CONTEXT_SAVE_SIZE_MAX);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+
+ args.queue_ea = queue;
+ args.sender_to_receiver_ea = mars_ptr_to_ea(&sender_to_receiver);
+ args.receiver_to_sender_ea = mars_ptr_to_ea(&receiver_to_sender);
+ args.ticks1_ea = mars_ptr_to_ea(pop_ticks);
+ task_args.type.u64[0] = mars_ptr_to_ea(&args);
+
+ ret = mars_task_schedule(&task_id, &task_args, 0);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+
+ ret = pthread_barrier_wait(thread_arg->barrier);
+ MARS_TEST_ASSERT(ret == PTHREAD_BARRIER_SERIAL_THREAD || ret == 0);
+
+ for (i = 0; i < QUEUE_DEPTH / 2; i++) {
+ ret = mars_task_queue_push(queue, buf);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+ }
+
+ for (i = 0; i < TEST1_ELEMENT_COUNT; i++) {
+ start = mars_task_get_ticks();
+ ret = mars_task_queue_push(queue, buf);
+ end = mars_task_get_ticks();
+ push_ticks[i] = end - start;
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+ mars_test_counter_set(&sender_to_receiver, i);
+ mars_test_counter_wait(&receiver_to_sender, i);
+ }
+
+ ret = mars_task_wait(&task_id, NULL);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+
+ ret = mars_task_destroy(&task_id);
+ 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_ctx);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+
+ return NULL;
+}
+
+void test1(int mpu, pthread_t *threads, struct thread_arg_st *thread_args)
+{
+ int ret, i;
+ size_t size;
+ int32_t *push_ticks, *pop_ticks;
+ pthread_barrier_t barrier;
+
+ size = sizeof(int32_t) * TEST1_ELEMENT_COUNT * mpu;
+
+ push_ticks = (int32_t *)malloc(size);
+ MARS_TEST_ASSERT(push_ticks != NULL);
+
+ ret = posix_memalign((void **)&pop_ticks, 128, size);
+ MARS_TEST_ASSERT_EQUAL(ret, 0);
+
+ ret = pthread_barrier_init(&barrier, NULL, mpu);
+ MARS_TEST_ASSERT_EQUAL(ret, 0);
+
+ for (i = 0; i < mpu; i++) {
+ thread_args[i].ticks1 = &push_ticks[TEST1_ELEMENT_COUNT * i];
+ thread_args[i].ticks2 = &pop_ticks[TEST1_ELEMENT_COUNT * i];
+ thread_args[i].barrier = &barrier;
+ ret = pthread_create(&threads[i], NULL,
+ test1_thread, &thread_args[i]);
+ MARS_TEST_ASSERT_EQUAL(ret, 0);
+ }
+
+ for (i = 0; i < mpu; i++) {
+ ret = pthread_join(threads[i], NULL);
+ MARS_TEST_ASSERT_EQUAL(ret, 0);
+ }
+
+ pthread_barrier_destroy(&barrier);
+
+ size = TEST1_ELEMENT_COUNT * mpu;
+ mars_test_print_statistics(push_ticks, size, "push");
+ mars_test_print_statistics(pop_ticks, size, "pop");
+
+ free(pop_ticks);
+ free(push_ticks);
+}
+
+int main(int argc, char *argv[])
+{
+ int spe, mpu;
+ size_t size;
+ pthread_t *threads;
+ struct thread_arg_st *thread_args;
+
+ spe = spe_cpu_info_get(SPE_COUNT_PHYSICAL_SPES, -1);
+
+ mpu = MAX_MPUS;
+
+ threads = (pthread_t *)malloc(sizeof(pthread_t) * mpu);
+ MARS_TEST_ASSERT(threads != NULL);
+
+ size = sizeof(struct thread_arg_st) * mpu;
+ thread_args = (struct thread_arg_st *)malloc(size);
+ MARS_TEST_ASSERT(thread_args != NULL);
+
+ MARS_TEST_PERF_INIT();
+
+ test1(mpu, threads, thread_args);
+
+ free(thread_args);
+ free(threads);
+
+ return 0;
+}
diff --git a/tests/TPF/TPF_40_012/mpu1.c b/tests/TPF/TPF_40_012/mpu1.c
new file mode 100644
index 0000000..7172948
--- /dev/null
+++ b/tests/TPF/TPF_40_012/mpu1.c
@@ -0,0 +1,57 @@
+/*
+ * Copyright 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/task.h>
+#include <mars_test.h>
+#include "common.h"
+
+int mars_task_main(const struct mars_task_args *task_args)
+{
+ int ret, i;
+ uint32_t start, end;
+ char buf[ELEMENT_SIZE];
+ static struct test_task_args_st args ALIGN128;
+ static int32_t pop_ticks[TEST1_ELEMENT_COUNT] ALIGN128;
+
+ mfc_get(&args, task_args->type.u64[0],
+ sizeof(struct test_task_args_st), 0, 0, 0);
+ mfc_write_tag_mask(1);
+ mfc_read_tag_status_all();
+
+ for (i = 0; i < TEST1_ELEMENT_COUNT; i++) {
+ mars_test_counter_wait(args.sender_to_receiver_ea, i);
+ start = mars_task_get_ticks();
+ ret = mars_task_queue_pop(args.queue_ea, buf);
+ end = mars_task_get_ticks();
+ pop_ticks[i] = end - start;
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+ mars_test_counter_set(args.receiver_to_sender_ea, i);
+ }
+
+ mfc_put(pop_ticks, args.ticks1_ea, sizeof(pop_ticks), 0, 0, 0);
+ mfc_write_tag_mask(1);
+ mfc_read_tag_status_all();
+
+ return 0;
+}
diff --git a/tests/TPF/TPF_40_013/Makefile b/tests/TPF/TPF_40_013/Makefile
new file mode 100644
index 0000000..b590ac2
--- /dev/null
+++ b/tests/TPF/TPF_40_013/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.
+#
+
+EXTRA_LDFLAGS=-lm
+INCLUDE_CFLAGS+= -I./
+MPU_INCLUDE_CFLAGS+= -I./
+
+top_srcdir = ../..
+test_objs = host.o mpu1.task_eo mpu2.task_eo mpu3.task_eo
+timeout = 120
+
+include $(top_srcdir)/scripts/config.mk
+include $(top_srcdir)/scripts/rules_item.mk
+include $(top_srcdir)/scripts/rules_tpf.mk
+
+host.o: common.h
+mpu1.task_o: common.h
+mpu2.task_o: common.h
+mpu3.task_o: common.h
diff --git a/tests/TPF/TPF_40_013/common.h b/tests/TPF/TPF_40_013/common.h
new file mode 100644
index 0000000..3e24427
--- /dev/null
+++ b/tests/TPF/TPF_40_013/common.h
@@ -0,0 +1,48 @@
+/*
+ * Copyright 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/task.h>
+#include <mars_test.h>
+
+#define QUEUE_DEPTH 16
+#define ELEMENT_SIZE 128
+#define TEST1_ELEMENT_COUNT 4096
+#define TEST2_ELEMENT_COUNT 4096
+#define TEST3_ELEMENT_COUNT 4096
+
+#define MAX_MPUS spe
+
+#define ALIGN128 __attribute__((aligned(128)))
+
+struct test_task_args_st {
+ uint64_t queue_ea;
+ uint64_t barrier_ea;
+ uint64_t sender_to_receiver_ea;
+ uint64_t receiver_to_sender_ea;
+ uint64_t shared_resource_ea;
+ uint64_t ticks1_ea;
+ uint64_t ticks2_ea;
+ uint32_t tb_freq;
+ uint8_t pad[4];
+};
+
diff --git a/tests/TPF/TPF_40_013/host.c b/tests/TPF/TPF_40_013/host.c
new file mode 100644
index 0000000..3178710
--- /dev/null
+++ b/tests/TPF/TPF_40_013/host.c
@@ -0,0 +1,386 @@
+/*
+ * Copyright 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 <pthread.h>
+#include <libspe2.h>
+#include <mars/task.h>
+#include <mars_test.h>
+#include <common.h>
+
+extern spe_program_handle_t mpu1_prog, mpu2_prog, mpu3_prog;
+
+struct thread_arg_st {
+ int32_t *ticks1;
+ int32_t *ticks2;
+ struct mars_context *mars_ctx;
+ uint64_t barrier;
+};
+
+void *test1_thread(void *arg)
+{
+ int i, ret;
+ uint32_t start, end;
+ struct thread_arg_st *thread_arg = arg;
+ int32_t *push_ticks = thread_arg->ticks1;
+ int32_t *pop_ticks = thread_arg->ticks2;
+ uint32_t sender_to_receiver = UINT32_MAX;
+ uint32_t receiver_to_sender = UINT32_MAX;
+ char buf[ELEMENT_SIZE];
+ struct mars_context *mars_ctx = thread_arg->mars_ctx;
+ struct mars_task_id task_id;
+ struct mars_task_args task_args;
+ uint64_t queue;
+ static __thread struct test_task_args_st args ALIGN128;
+
+ ret = mars_task_queue_create(mars_ctx, &queue,
+ ELEMENT_SIZE, QUEUE_DEPTH, MARS_TASK_QUEUE_MPU_TO_HOST);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+
+ ret = mars_task_create(mars_ctx, &task_id, NULL,
+ mpu1_prog.elf_image, MARS_TASK_CONTEXT_SAVE_SIZE_MAX);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+
+ args.queue_ea = queue;
+ args.barrier_ea = thread_arg->barrier;
+ args.sender_to_receiver_ea = mars_ptr_to_ea(&sender_to_receiver);
+ args.receiver_to_sender_ea = mars_ptr_to_ea(&receiver_to_sender);
+ args.ticks1_ea = mars_ptr_to_ea(push_ticks);
+ task_args.type.u64[0] = mars_ptr_to_ea(&args);
+
+ ret = mars_task_schedule(&task_id, &task_args, 0);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+
+ for (i = 0; i < TEST1_ELEMENT_COUNT; i++) {
+ mars_test_counter_wait(&sender_to_receiver, i);
+ start = mars_task_get_ticks();
+ ret = mars_task_queue_pop(queue, buf);
+ end = mars_task_get_ticks();
+ pop_ticks[i] = end - start;
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+ mars_test_counter_set(&receiver_to_sender, i);
+ }
+
+ ret = mars_task_wait(&task_id, NULL);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+
+ ret = mars_task_destroy(&task_id);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+
+ ret = mars_task_queue_destroy(queue);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+
+ return NULL;
+}
+
+void test1(int mpu, pthread_t *threads, struct thread_arg_st *thread_args)
+{
+ int ret, i;
+ size_t size;
+ int32_t *push_ticks, *pop_ticks;
+ struct mars_context *mars_ctx;
+ uint64_t barrier;
+
+ size = sizeof(int32_t) * TEST1_ELEMENT_COUNT * mpu;
+
+ ret = posix_memalign((void **)&push_ticks, 128, size);
+ MARS_TEST_ASSERT_EQUAL(ret, 0);
+
+ pop_ticks = (int32_t *)malloc(size);
+ MARS_TEST_ASSERT(pop_ticks != NULL);
+
+ ret = mars_context_create(&mars_ctx, 0, 1);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+
+ ret = mars_task_barrier_create(mars_ctx, &barrier, mpu);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+
+ for (i = 0; i < mpu; i++) {
+ thread_args[i].ticks1 = &push_ticks[TEST1_ELEMENT_COUNT * i];
+ thread_args[i].ticks2 = &pop_ticks[TEST1_ELEMENT_COUNT * i];
+ thread_args[i].mars_ctx = mars_ctx;
+ thread_args[i].barrier = barrier;
+ ret = pthread_create(&threads[i], NULL,
+ test1_thread, &thread_args[i]);
+ MARS_TEST_ASSERT_EQUAL(ret, 0);
+ }
+
+ for (i = 0; i < mpu; i++) {
+ ret = pthread_join(threads[i], NULL);
+ MARS_TEST_ASSERT_EQUAL(ret, 0);
+ }
+
+ 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);
+
+ size = TEST1_ELEMENT_COUNT * mpu;
+ mars_test_print_statistics(push_ticks, size, "push");
+ mars_test_print_statistics(pop_ticks, size, "pop");
+
+ free(pop_ticks);
+ free(push_ticks);
+}
+
+void *test2_thread(void *arg)
+{
+ int i, ret;
+ int32_t start, end;
+ struct thread_arg_st *thread_arg = arg;
+ int32_t *ticks = thread_arg->ticks1;
+ uint32_t sender_to_receiver = UINT32_MAX;
+ uint32_t receiver_to_sender = UINT32_MAX;
+ char buf[ELEMENT_SIZE];
+ struct mars_context *mars_ctx = thread_arg->mars_ctx;
+ struct mars_task_id task_id;
+ struct mars_task_args task_args;
+ uint64_t queue;
+ static __thread struct test_task_args_st args ALIGN128;
+
+ ret = mars_test_get_timebase_freq(&args.tb_freq);
+ MARS_TEST_ASSERT_EQUAL(ret, 0);
+
+ ret = mars_task_queue_create(mars_ctx, &queue,
+ ELEMENT_SIZE, QUEUE_DEPTH, MARS_TASK_QUEUE_MPU_TO_HOST);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+
+ ret = mars_task_create(mars_ctx, &task_id, NULL,
+ mpu2_prog.elf_image, MARS_TASK_CONTEXT_SAVE_SIZE_MAX);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+
+ args.queue_ea = queue;
+ args.barrier_ea = thread_arg->barrier;
+ args.sender_to_receiver_ea = mars_ptr_to_ea(&sender_to_receiver);
+ args.receiver_to_sender_ea = mars_ptr_to_ea(&receiver_to_sender);
+ args.shared_resource_ea = mars_ptr_to_ea(&start);
+ task_args.type.u64[0] = mars_ptr_to_ea(&args);
+
+ ret = mars_task_schedule(&task_id, &task_args, 0);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+
+ for (i = 0; i < TEST2_ELEMENT_COUNT; i++) {
+ mars_test_counter_wait(&sender_to_receiver, i * 2);
+ mars_test_counter_set(&receiver_to_sender, i * 2);
+
+ ret = mars_task_queue_pop(queue, buf);
+ end = mars_task_get_ticks();
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+
+ mars_test_counter_wait(&sender_to_receiver, i * 2 + 1);
+ ticks[i] = end - start;
+ mars_test_counter_set(&receiver_to_sender, i * 2 + 1);
+ }
+
+ ret = mars_task_wait(&task_id, NULL);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+
+ ret = mars_task_destroy(&task_id);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+
+ ret = mars_task_queue_destroy(queue);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+
+ return NULL;
+}
+
+void test2(int mpu, pthread_t *threads, struct thread_arg_st *thread_args)
+{
+ int ret, i;
+ size_t size;
+ int32_t *ticks;
+ struct mars_context *mars_ctx;
+ uint64_t barrier;
+
+ size = sizeof(int32_t) * TEST2_ELEMENT_COUNT * mpu;
+ ticks = (int32_t *)malloc(size);
+ MARS_TEST_ASSERT(ticks != NULL);
+
+ ret = mars_context_create(&mars_ctx, 0, 1);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+
+ ret = mars_task_barrier_create(mars_ctx, &barrier, mpu);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+
+ for (i = 0; i < mpu; i++) {
+ thread_args[i].ticks1 = &ticks[TEST2_ELEMENT_COUNT * i];
+ thread_args[i].mars_ctx = mars_ctx;
+ thread_args[i].barrier = barrier;
+ ret = pthread_create(&threads[i], NULL,
+ test2_thread, &thread_args[i]);
+ MARS_TEST_ASSERT_EQUAL(ret, 0);
+ }
+
+ for (i = 0; i < mpu; i++) {
+ ret = pthread_join(threads[i], NULL);
+ MARS_TEST_ASSERT_EQUAL(ret, 0);
+ }
+
+ 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);
+
+ size = TEST2_ELEMENT_COUNT * mpu;
+ mars_test_print_statistics(
+ ticks, size, "beginning of push - end of pop");
+
+ free(ticks);
+}
+
+void *test3_thread(void *arg)
+{
+ int i, ret;
+ int32_t start, end;
+ struct thread_arg_st *thread_arg = arg;
+ int32_t *ticks = thread_arg->ticks1;
+ uint32_t sender_to_receiver = UINT32_MAX;
+ uint32_t receiver_to_sender = UINT32_MAX;
+ char buf[ELEMENT_SIZE];
+ struct mars_context *mars_ctx = thread_arg->mars_ctx;
+ struct mars_task_id task_id;
+ struct mars_task_args task_args;
+ uint64_t queue;
+ static __thread struct test_task_args_st args ALIGN128;
+
+ ret = mars_test_get_timebase_freq(&args.tb_freq);
+ MARS_TEST_ASSERT_EQUAL(ret, 0);
+
+ ret = mars_task_queue_create(mars_ctx, &queue,
+ ELEMENT_SIZE, QUEUE_DEPTH, MARS_TASK_QUEUE_MPU_TO_HOST);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+
+ ret = mars_task_create(mars_ctx, &task_id, NULL,
+ mpu3_prog.elf_image, MARS_TASK_CONTEXT_SAVE_SIZE_MAX);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+
+ args.queue_ea = queue;
+ args.barrier_ea = thread_arg->barrier;
+ args.sender_to_receiver_ea = mars_ptr_to_ea(&sender_to_receiver);
+ args.receiver_to_sender_ea = mars_ptr_to_ea(&receiver_to_sender);
+ args.shared_resource_ea = mars_ptr_to_ea(&start);
+ task_args.type.u64[0] = mars_ptr_to_ea(&args);
+
+ ret = mars_task_schedule(&task_id, &task_args, 0);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+
+ for (i = 0; i < TEST3_ELEMENT_COUNT; i++) {
+ mars_test_counter_wait(&sender_to_receiver, i * 2);
+ mars_test_counter_set(&receiver_to_sender, i * 2);
+
+ ret = mars_task_queue_pop(queue, buf);
+ end = mars_task_get_ticks();
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+
+ mars_test_counter_wait(&sender_to_receiver, i * 2 + 1);
+ ticks[i] = end - start;
+ mars_test_counter_set(&receiver_to_sender, i * 2 + 1);
+ }
+
+ ret = mars_task_wait(&task_id, NULL);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+
+ ret = mars_task_destroy(&task_id);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+
+ ret = mars_task_queue_destroy(queue);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+
+ return NULL;
+}
+
+void test3(int mpu, pthread_t *threads, struct thread_arg_st *thread_args)
+{
+ int ret, i;
+ size_t size;
+ int32_t *ticks;
+ struct mars_context *mars_ctx;
+ uint64_t barrier;
+
+ size = sizeof(int32_t) * TEST3_ELEMENT_COUNT * mpu;
+ ticks = (int32_t *)malloc(size);
+ MARS_TEST_ASSERT(ticks != NULL);
+
+ ret = mars_context_create(&mars_ctx, 0, 1);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+
+ ret = mars_task_barrier_create(mars_ctx, &barrier, mpu);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+
+ for (i = 0; i < mpu; i++) {
+ thread_args[i].ticks1 = &ticks[TEST3_ELEMENT_COUNT * i];
+ thread_args[i].mars_ctx = mars_ctx;
+ thread_args[i].barrier = barrier;
+ ret = pthread_create(&threads[i], NULL,
+ test3_thread, &thread_args[i]);
+ MARS_TEST_ASSERT_EQUAL(ret, 0);
+ }
+
+ for (i = 0; i < mpu; i++) {
+ ret = pthread_join(threads[i], NULL);
+ MARS_TEST_ASSERT_EQUAL(ret, 0);
+ }
+
+ 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);
+
+ size = TEST3_ELEMENT_COUNT * mpu;
+ mars_test_print_statistics(
+ ticks, size, "end of push - end of pop");
+
+ free(ticks);
+}
+
+int main(int argc, char *argv[])
+{
+ int spe, mpu;
+ size_t size;
+ pthread_t *threads;
+ struct thread_arg_st *thread_args;
+
+ spe = spe_cpu_info_get(SPE_COUNT_PHYSICAL_SPES, -1);
+
+ mpu = MAX_MPUS;
+
+ threads = (pthread_t *)malloc(sizeof(pthread_t) * mpu);
+ MARS_TEST_ASSERT(threads != NULL);
+
+ size = sizeof(struct thread_arg_st) * mpu;
+ thread_args = (struct thread_arg_st *)malloc(size);
+ MARS_TEST_ASSERT(thread_args != NULL);
+
+ MARS_TEST_PERF_INIT();
+
+ test1(mpu, threads, thread_args);
+ test2(mpu, threads, thread_args);
+ test3(mpu, threads, thread_args);
+
+ free(thread_args);
+ free(threads);
+
+ return 0;
+}
diff --git a/tests/TPF/TPF_40_013/mpu1.c b/tests/TPF/TPF_40_013/mpu1.c
new file mode 100644
index 0000000..9c46c74
--- /dev/null
+++ b/tests/TPF/TPF_40_013/mpu1.c
@@ -0,0 +1,62 @@
+/*
+ * Copyright 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/task.h>
+#include <mars_test.h>
+#include "common.h"
+#include <stdio.h>
+
+int mars_task_main(const struct mars_task_args *task_args)
+{
+ int ret, i;
+ uint32_t start, end;
+ char buf[ELEMENT_SIZE];
+ static struct test_task_args_st args ALIGN128;
+ static int32_t push_ticks[TEST1_ELEMENT_COUNT] ALIGN128;
+
+ mfc_get(&args, task_args->type.u64[0],
+ sizeof(struct test_task_args_st), 0, 0, 0);
+ mfc_write_tag_mask(1);
+ mfc_read_tag_status_all();
+
+ ret = mars_task_barrier_notify(args.barrier_ea);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+ ret = mars_task_barrier_wait(args.barrier_ea);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+
+ for (i = 0; i < TEST1_ELEMENT_COUNT; i++) {
+ start = mars_task_get_ticks();
+ ret = mars_task_queue_push(args.queue_ea, buf);
+ end = mars_task_get_ticks();
+ push_ticks[i] = end - start;
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+ mars_test_counter_set(args.sender_to_receiver_ea, i);
+ mars_test_counter_wait(args.receiver_to_sender_ea, i);
+ }
+
+ mfc_put(push_ticks, args.ticks1_ea, sizeof(push_ticks), 0, 0, 0);
+ mfc_write_tag_mask(1);
+ mfc_read_tag_status_all();
+
+ return 0;
+}
diff --git a/tests/TPF/TPF_40_013/mpu2.c b/tests/TPF/TPF_40_013/mpu2.c
new file mode 100644
index 0000000..4a54d6c
--- /dev/null
+++ b/tests/TPF/TPF_40_013/mpu2.c
@@ -0,0 +1,62 @@
+/*
+ * Copyright 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/task.h>
+#include <mars_test.h>
+#include "common.h"
+
+int mars_task_main(const struct mars_task_args *task_args)
+{
+ int ret, i;
+ uint32_t start;
+ char buf[ELEMENT_SIZE];
+ static struct test_task_args_st args ALIGN128;
+
+ mfc_get(&args, task_args->type.u64[0],
+ sizeof(struct test_task_args_st), 0, 0, 0);
+ mfc_write_tag_mask(1);
+ mfc_read_tag_status_all();
+
+ ret = mars_task_barrier_notify(args.barrier_ea);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+ ret = mars_task_barrier_wait(args.barrier_ea);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+
+ for (i = 0; i < TEST2_ELEMENT_COUNT; i++) {
+ mars_test_counter_set(args.sender_to_receiver_ea, i * 2);
+ mars_test_counter_wait(args.receiver_to_sender_ea, i * 2);
+
+ /* wait the host program blocked */
+ mars_test_usleep(args.tb_freq, DELAY);
+
+ start = mars_task_get_ticks();
+ ret = mars_task_queue_push(args.queue_ea, buf);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+
+ mars_test_int32_put(args.shared_resource_ea, start);
+ mars_test_counter_set(args.sender_to_receiver_ea, i * 2 + 1);
+ mars_test_counter_wait(args.receiver_to_sender_ea, i * 2 + 1);
+ }
+
+ return 0;
+}
diff --git a/tests/TPF/TPF_40_013/mpu3.c b/tests/TPF/TPF_40_013/mpu3.c
new file mode 100644
index 0000000..f5191ea
--- /dev/null
+++ b/tests/TPF/TPF_40_013/mpu3.c
@@ -0,0 +1,62 @@
+/*
+ * Copyright 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/task.h>
+#include <mars_test.h>
+#include "common.h"
+
+int mars_task_main(const struct mars_task_args *task_args)
+{
+ int ret, i;
+ uint32_t start;
+ char buf[ELEMENT_SIZE];
+ static struct test_task_args_st args ALIGN128;
+
+ mfc_get(&args, task_args->type.u64[0],
+ sizeof(struct test_task_args_st), 0, 0, 0);
+ mfc_write_tag_mask(1);
+ mfc_read_tag_status_all();
+
+ ret = mars_task_barrier_notify(args.barrier_ea);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+ ret = mars_task_barrier_wait(args.barrier_ea);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+
+ for (i = 0; i < TEST3_ELEMENT_COUNT; i++) {
+ mars_test_counter_set(args.sender_to_receiver_ea, i * 2);
+ mars_test_counter_wait(args.receiver_to_sender_ea, i * 2);
+
+ /* wait the host program blocked */
+ mars_test_usleep(args.tb_freq, DELAY);
+
+ ret = mars_task_queue_push(args.queue_ea, buf);
+ start = mars_task_get_ticks();
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+
+ mars_test_int32_put(args.shared_resource_ea, start);
+ mars_test_counter_set(args.sender_to_receiver_ea, i * 2 + 1);
+ mars_test_counter_wait(args.receiver_to_sender_ea, i * 2 + 1);
+ }
+
+ return 0;
+}
diff --git a/tests/TPF/TPF_40_014/Makefile b/tests/TPF/TPF_40_014/Makefile
new file mode 100644
index 0000000..b590ac2
--- /dev/null
+++ b/tests/TPF/TPF_40_014/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.
+#
+
+EXTRA_LDFLAGS=-lm
+INCLUDE_CFLAGS+= -I./
+MPU_INCLUDE_CFLAGS+= -I./
+
+top_srcdir = ../..
+test_objs = host.o mpu1.task_eo mpu2.task_eo mpu3.task_eo
+timeout = 120
+
+include $(top_srcdir)/scripts/config.mk
+include $(top_srcdir)/scripts/rules_item.mk
+include $(top_srcdir)/scripts/rules_tpf.mk
+
+host.o: common.h
+mpu1.task_o: common.h
+mpu2.task_o: common.h
+mpu3.task_o: common.h
diff --git a/tests/TPF/TPF_40_014/common.h b/tests/TPF/TPF_40_014/common.h
new file mode 100644
index 0000000..3e24427
--- /dev/null
+++ b/tests/TPF/TPF_40_014/common.h
@@ -0,0 +1,48 @@
+/*
+ * Copyright 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/task.h>
+#include <mars_test.h>
+
+#define QUEUE_DEPTH 16
+#define ELEMENT_SIZE 128
+#define TEST1_ELEMENT_COUNT 4096
+#define TEST2_ELEMENT_COUNT 4096
+#define TEST3_ELEMENT_COUNT 4096
+
+#define MAX_MPUS spe
+
+#define ALIGN128 __attribute__((aligned(128)))
+
+struct test_task_args_st {
+ uint64_t queue_ea;
+ uint64_t barrier_ea;
+ uint64_t sender_to_receiver_ea;
+ uint64_t receiver_to_sender_ea;
+ uint64_t shared_resource_ea;
+ uint64_t ticks1_ea;
+ uint64_t ticks2_ea;
+ uint32_t tb_freq;
+ uint8_t pad[4];
+};
+
diff --git a/tests/TPF/TPF_40_014/host.c b/tests/TPF/TPF_40_014/host.c
new file mode 100644
index 0000000..c7a840d
--- /dev/null
+++ b/tests/TPF/TPF_40_014/host.c
@@ -0,0 +1,391 @@
+/*
+ * Copyright 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 <pthread.h>
+#include <libspe2.h>
+#include <mars/task.h>
+#include <mars_test.h>
+#include <common.h>
+#include <stdio.h>
+
+extern spe_program_handle_t mpu1_prog, mpu2_prog, mpu3_prog;
+
+struct thread_arg_st {
+ int32_t *ticks1;
+ int32_t *ticks2;
+ struct mars_context *mars_ctx;
+ uint64_t barrier;
+};
+
+void *test1_thread(void *arg)
+{
+ int i, ret;
+ uint32_t start, end;
+ struct thread_arg_st *thread_arg = arg;
+ int32_t *push_ticks = thread_arg->ticks1;
+ int32_t *pop_ticks = thread_arg->ticks2;
+ uint32_t sender_to_receiver = UINT32_MAX;
+ uint32_t receiver_to_sender = UINT32_MAX;
+ char buf[ELEMENT_SIZE];
+ struct mars_context *mars_ctx = thread_arg->mars_ctx;
+ struct mars_task_id task_id;
+ struct mars_task_args task_args;
+ uint64_t queue;
+ static __thread struct test_task_args_st args ALIGN128;
+
+ ret = mars_task_queue_create(mars_ctx, &queue,
+ ELEMENT_SIZE, QUEUE_DEPTH, MARS_TASK_QUEUE_MPU_TO_HOST);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+
+ ret = mars_task_create(mars_ctx, &task_id, NULL,
+ mpu1_prog.elf_image, MARS_TASK_CONTEXT_SAVE_SIZE_MAX);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+
+ args.queue_ea = queue;
+ args.barrier_ea = thread_arg->barrier;
+ args.sender_to_receiver_ea = mars_ptr_to_ea(&sender_to_receiver);
+ args.receiver_to_sender_ea = mars_ptr_to_ea(&receiver_to_sender);
+ args.ticks1_ea = mars_ptr_to_ea(push_ticks);
+ task_args.type.u64[0] = mars_ptr_to_ea(&args);
+
+ ret = mars_task_schedule(&task_id, &task_args, 0);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+
+ for (i = 0; i < TEST1_ELEMENT_COUNT; i++) {
+ mars_test_counter_wait(&sender_to_receiver, i);
+ start = mars_task_get_ticks();
+ ret = mars_task_queue_pop(queue, buf);
+ end = mars_task_get_ticks();
+ pop_ticks[i] = end - start;
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+ mars_test_counter_set(&receiver_to_sender, i);
+ }
+
+ ret = mars_task_wait(&task_id, NULL);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+
+ ret = mars_task_destroy(&task_id);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+
+ ret = mars_task_queue_destroy(queue);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+
+ return NULL;
+}
+
+void test1(int mpu, pthread_t *threads, struct thread_arg_st *thread_args)
+{
+ int ret, i;
+ size_t size;
+ int32_t *push_ticks, *pop_ticks;
+ struct mars_context *mars_ctx;
+ uint64_t barrier;
+
+ size = sizeof(int32_t) * TEST1_ELEMENT_COUNT * mpu;
+
+ ret = posix_memalign((void **)&push_ticks, 128, size);
+ MARS_TEST_ASSERT_EQUAL(ret, 0);
+
+ pop_ticks = (int32_t *)malloc(size);
+ MARS_TEST_ASSERT(pop_ticks != NULL);
+
+ ret = mars_context_create(&mars_ctx, 0, 1);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+
+ ret = mars_task_barrier_create(mars_ctx, &barrier, mpu);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+
+ for (i = 0; i < mpu; i++) {
+ thread_args[i].ticks1 = &push_ticks[TEST1_ELEMENT_COUNT * i];
+ thread_args[i].ticks2 = &pop_ticks[TEST1_ELEMENT_COUNT * i];
+ thread_args[i].mars_ctx = mars_ctx;
+ thread_args[i].barrier = barrier;
+ ret = pthread_create(&threads[i], NULL,
+ test1_thread, &thread_args[i]);
+ MARS_TEST_ASSERT_EQUAL(ret, 0);
+ }
+
+ for (i = 0; i < mpu; i++) {
+ ret = pthread_join(threads[i], NULL);
+ MARS_TEST_ASSERT_EQUAL(ret, 0);
+ }
+
+ 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);
+
+ size = TEST1_ELEMENT_COUNT * mpu;
+ mars_test_print_statistics(push_ticks, size, "push");
+ mars_test_print_statistics(pop_ticks, size, "pop");
+
+ free(pop_ticks);
+ free(push_ticks);
+}
+
+void *test2_thread(void *arg)
+{
+ int i, ret;
+ int32_t start, end;
+ struct thread_arg_st *thread_arg = arg;
+ int32_t *ticks = thread_arg->ticks1;
+ uint32_t sender_to_receiver = UINT32_MAX;
+ uint32_t receiver_to_sender = UINT32_MAX;
+ char buf[ELEMENT_SIZE];
+ struct mars_context *mars_ctx = thread_arg->mars_ctx;
+ struct mars_task_id task_id;
+ struct mars_task_args task_args;
+ uint64_t queue;
+ static __thread struct test_task_args_st args ALIGN128;
+
+ ret = mars_test_get_timebase_freq(&args.tb_freq);
+ MARS_TEST_ASSERT_EQUAL(ret, 0);
+
+ ret = mars_task_queue_create(mars_ctx, &queue,
+ ELEMENT_SIZE, QUEUE_DEPTH, MARS_TASK_QUEUE_MPU_TO_HOST);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+
+ ret = mars_task_create(mars_ctx, &task_id, NULL,
+ mpu2_prog.elf_image, MARS_TASK_CONTEXT_SAVE_SIZE_MAX);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+
+ args.queue_ea = queue;
+ args.barrier_ea = thread_arg->barrier;
+ args.sender_to_receiver_ea = mars_ptr_to_ea(&sender_to_receiver);
+ args.receiver_to_sender_ea = mars_ptr_to_ea(&receiver_to_sender);
+ args.shared_resource_ea = mars_ptr_to_ea(&end);
+ task_args.type.u64[0] = mars_ptr_to_ea(&args);
+
+ ret = mars_task_schedule(&task_id, &task_args, 0);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+
+ for (i = 0; i < TEST2_ELEMENT_COUNT; i++) {
+ mars_test_counter_wait(&sender_to_receiver, i * 2);
+ mars_test_counter_set(&receiver_to_sender, i * 2);
+
+ usleep(DELAY);
+
+ start = mars_task_get_ticks();
+ ret = mars_task_queue_pop(queue, buf);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+
+ mars_test_counter_wait(&sender_to_receiver, i * 2 + 1);
+ ticks[i] = end - start;
+ mars_test_counter_set(&receiver_to_sender, i * 2 + 1);
+ }
+
+ ret = mars_task_wait(&task_id, NULL);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+
+ ret = mars_task_destroy(&task_id);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+
+ ret = mars_task_queue_destroy(queue);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+
+ return NULL;
+}
+
+void test2(int mpu, pthread_t *threads, struct thread_arg_st *thread_args)
+{
+ int ret, i;
+ size_t size;
+ int32_t *ticks;
+ struct mars_context *mars_ctx;
+ uint64_t barrier;
+
+ size = sizeof(int32_t) * TEST2_ELEMENT_COUNT * mpu;
+ ticks = (int32_t *)malloc(size);
+ MARS_TEST_ASSERT(ticks != NULL);
+
+ ret = mars_context_create(&mars_ctx, 0, 1);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+
+ ret = mars_task_barrier_create(mars_ctx, &barrier, mpu);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+
+ for (i = 0; i < mpu; i++) {
+ thread_args[i].ticks1 = &ticks[TEST2_ELEMENT_COUNT * i];
+ thread_args[i].mars_ctx = mars_ctx;
+ thread_args[i].barrier = barrier;
+ ret = pthread_create(&threads[i], NULL,
+ test2_thread, &thread_args[i]);
+ MARS_TEST_ASSERT_EQUAL(ret, 0);
+ }
+
+ for (i = 0; i < mpu; i++) {
+ ret = pthread_join(threads[i], NULL);
+ MARS_TEST_ASSERT_EQUAL(ret, 0);
+ }
+
+ 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);
+
+ size = TEST2_ELEMENT_COUNT * mpu;
+ mars_test_print_statistics(
+ ticks, size, "beginning of pop - end of push");
+
+ free(ticks);
+}
+
+void *test3_thread(void *arg)
+{
+ int i, ret;
+ int32_t start, end;
+ struct thread_arg_st *thread_arg = arg;
+ int32_t *ticks = thread_arg->ticks1;
+ uint32_t sender_to_receiver = UINT32_MAX;
+ uint32_t receiver_to_sender = UINT32_MAX;
+ char buf[ELEMENT_SIZE];
+ struct mars_context *mars_ctx = thread_arg->mars_ctx;
+ struct mars_task_id task_id;
+ struct mars_task_args task_args;
+ uint64_t queue;
+ static __thread struct test_task_args_st args ALIGN128;
+
+ ret = mars_test_get_timebase_freq(&args.tb_freq);
+ MARS_TEST_ASSERT_EQUAL(ret, 0);
+
+ ret = mars_task_queue_create(mars_ctx, &queue,
+ ELEMENT_SIZE, QUEUE_DEPTH, MARS_TASK_QUEUE_MPU_TO_HOST);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+
+ ret = mars_task_create(mars_ctx, &task_id, NULL,
+ mpu3_prog.elf_image, MARS_TASK_CONTEXT_SAVE_SIZE_MAX);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+
+ args.queue_ea = queue;
+ args.barrier_ea = thread_arg->barrier;
+ args.sender_to_receiver_ea = mars_ptr_to_ea(&sender_to_receiver);
+ args.receiver_to_sender_ea = mars_ptr_to_ea(&receiver_to_sender);
+ args.shared_resource_ea = mars_ptr_to_ea(&end);
+ task_args.type.u64[0] = mars_ptr_to_ea(&args);
+
+ ret = mars_task_schedule(&task_id, &task_args, 0);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+
+ for (i = 0; i < TEST3_ELEMENT_COUNT; i++) {
+ mars_test_counter_wait(&sender_to_receiver, i * 2);
+ mars_test_counter_set(&receiver_to_sender, i * 2);
+
+ usleep(DELAY);
+
+ ret = mars_task_queue_pop(queue, buf);
+ start = mars_task_get_ticks();
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+
+ mars_test_counter_wait(&sender_to_receiver, i * 2 + 1);
+ ticks[i] = end - start;
+ mars_test_counter_set(&receiver_to_sender, i * 2 + 1);
+ }
+
+ ret = mars_task_wait(&task_id, NULL);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+
+ ret = mars_task_destroy(&task_id);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+
+ ret = mars_task_queue_destroy(queue);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+
+ return NULL;
+}
+
+void test3(int mpu, pthread_t *threads, struct thread_arg_st *thread_args)
+{
+ int ret, i;
+ size_t size;
+ int32_t *ticks;
+ struct mars_context *mars_ctx;
+ uint64_t barrier;
+
+ size = sizeof(int32_t) * TEST3_ELEMENT_COUNT * mpu;
+ ticks = (int32_t *)malloc(size);
+ MARS_TEST_ASSERT(ticks != NULL);
+
+ ret = mars_context_create(&mars_ctx, 0, 1);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+
+ ret = mars_task_barrier_create(mars_ctx, &barrier, mpu);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+
+ for (i = 0; i < mpu; i++) {
+ thread_args[i].ticks1 = &ticks[TEST3_ELEMENT_COUNT * i];
+ thread_args[i].mars_ctx = mars_ctx;
+ thread_args[i].barrier = barrier;
+ ret = pthread_create(&threads[i], NULL,
+ test3_thread, &thread_args[i]);
+ MARS_TEST_ASSERT_EQUAL(ret, 0);
+ }
+
+ for (i = 0; i < mpu; i++) {
+ ret = pthread_join(threads[i], NULL);
+ MARS_TEST_ASSERT_EQUAL(ret, 0);
+ }
+
+ 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);
+
+ size = TEST3_ELEMENT_COUNT * mpu;
+ mars_test_print_statistics(
+ ticks, size, "end of pop - end of push");
+
+ free(ticks);
+}
+
+int main(int argc, char *argv[])
+{
+ int spe, mpu;
+ size_t size;
+ pthread_t *threads;
+ struct thread_arg_st *thread_args;
+
+ spe = spe_cpu_info_get(SPE_COUNT_PHYSICAL_SPES, -1);
+
+ mpu = MAX_MPUS;
+
+ threads = (pthread_t *)malloc(sizeof(pthread_t) * mpu);
+ MARS_TEST_ASSERT(threads != NULL);
+
+ size = sizeof(struct thread_arg_st) * mpu;
+ thread_args = (struct thread_arg_st *)malloc(size);
+ MARS_TEST_ASSERT(thread_args != NULL);
+
+ MARS_TEST_PERF_INIT();
+
+ test1(mpu, threads, thread_args);
+ test2(mpu, threads, thread_args);
+ test3(mpu, threads, thread_args);
+
+ free(thread_args);
+ free(threads);
+
+ return 0;
+}
diff --git a/tests/TPF/TPF_40_014/mpu1.c b/tests/TPF/TPF_40_014/mpu1.c
new file mode 100644
index 0000000..9fc0d6f
--- /dev/null
+++ b/tests/TPF/TPF_40_014/mpu1.c
@@ -0,0 +1,67 @@
+/*
+ * Copyright 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/task.h>
+#include <mars_test.h>
+#include "common.h"
+#include <stdio.h>
+
+int mars_task_main(const struct mars_task_args *task_args)
+{
+ int ret, i;
+ uint32_t start, end;
+ char buf[ELEMENT_SIZE];
+ static struct test_task_args_st args ALIGN128;
+ static int32_t push_ticks[TEST1_ELEMENT_COUNT] ALIGN128;
+
+ mfc_get(&args, task_args->type.u64[0],
+ sizeof(struct test_task_args_st), 0, 0, 0);
+ mfc_write_tag_mask(1);
+ mfc_read_tag_status_all();
+
+ for (i = 0; i < QUEUE_DEPTH - 1; i++) {
+ ret = mars_task_queue_push(args.queue_ea, buf);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+ }
+
+ ret = mars_task_barrier_notify(args.barrier_ea);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+ ret = mars_task_barrier_wait(args.barrier_ea);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+
+ for (i = 0; i < TEST1_ELEMENT_COUNT; i++) {
+ start = mars_task_get_ticks();
+ ret = mars_task_queue_push(args.queue_ea, buf);
+ end = mars_task_get_ticks();
+ push_ticks[i] = end - start;
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+ mars_test_counter_set(args.sender_to_receiver_ea, i);
+ mars_test_counter_wait(args.receiver_to_sender_ea, i);
+ }
+
+ mfc_put(push_ticks, args.ticks1_ea, sizeof(push_ticks), 0, 0, 0);
+ mfc_write_tag_mask(1);
+ mfc_read_tag_status_all();
+
+ return 0;
+}
diff --git a/tests/TPF/TPF_40_014/mpu2.c b/tests/TPF/TPF_40_014/mpu2.c
new file mode 100644
index 0000000..e16edb7
--- /dev/null
+++ b/tests/TPF/TPF_40_014/mpu2.c
@@ -0,0 +1,66 @@
+/*
+ * Copyright 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/task.h>
+#include <mars_test.h>
+#include "common.h"
+
+int mars_task_main(const struct mars_task_args *task_args)
+{
+ int ret, i;
+ uint32_t end;
+ char buf[ELEMENT_SIZE];
+ static struct test_task_args_st args ALIGN128;
+
+ mfc_get(&args, task_args->type.u64[0],
+ sizeof(struct test_task_args_st), 0, 0, 0);
+ mfc_write_tag_mask(1);
+ mfc_read_tag_status_all();
+
+ for (i = 0; i < QUEUE_DEPTH; i++) {
+ ret = mars_task_queue_push(args.queue_ea, buf);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+ }
+
+ mars_task_yield();
+
+ ret = mars_task_barrier_notify(args.barrier_ea);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+ ret = mars_task_barrier_wait(args.barrier_ea);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+
+ for (i = 0; i < TEST2_ELEMENT_COUNT; i++) {
+ mars_test_counter_set(args.sender_to_receiver_ea, i * 2);
+ mars_test_counter_wait(args.receiver_to_sender_ea, i * 2);
+
+ ret = mars_task_queue_push(args.queue_ea, buf);
+ end = mars_task_get_ticks();
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+
+ mars_test_int32_put(args.shared_resource_ea, end);
+ mars_test_counter_set(args.sender_to_receiver_ea, i * 2 + 1);
+ mars_test_counter_wait(args.receiver_to_sender_ea, i * 2 + 1);
+ }
+
+ return 0;
+}
diff --git a/tests/TPF/TPF_40_014/mpu3.c b/tests/TPF/TPF_40_014/mpu3.c
new file mode 100644
index 0000000..ad0c579
--- /dev/null
+++ b/tests/TPF/TPF_40_014/mpu3.c
@@ -0,0 +1,66 @@
+/*
+ * Copyright 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/task.h>
+#include <mars_test.h>
+#include "common.h"
+
+int mars_task_main(const struct mars_task_args *task_args)
+{
+ int ret, i;
+ uint32_t end;
+ char buf[ELEMENT_SIZE];
+ static struct test_task_args_st args ALIGN128;
+
+ mfc_get(&args, task_args->type.u64[0],
+ sizeof(struct test_task_args_st), 0, 0, 0);
+ mfc_write_tag_mask(1);
+ mfc_read_tag_status_all();
+
+ for (i = 0; i < QUEUE_DEPTH; i++) {
+ ret = mars_task_queue_push(args.queue_ea, buf);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+ }
+
+ mars_task_yield();
+
+ ret = mars_task_barrier_notify(args.barrier_ea);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+ ret = mars_task_barrier_wait(args.barrier_ea);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+
+ for (i = 0; i < TEST3_ELEMENT_COUNT; i++) {
+ mars_test_counter_set(args.sender_to_receiver_ea, i * 2);
+ mars_test_counter_wait(args.receiver_to_sender_ea, i * 2);
+
+ ret = mars_task_queue_push(args.queue_ea, buf);
+ end = mars_task_get_ticks();
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+
+ mars_test_int32_put(args.shared_resource_ea, end);
+ mars_test_counter_set(args.sender_to_receiver_ea, i * 2 + 1);
+ mars_test_counter_wait(args.receiver_to_sender_ea, i * 2 + 1);
+ }
+
+ return 0;
+}
diff --git a/tests/TPF/TPF_40_015/Makefile b/tests/TPF/TPF_40_015/Makefile
new file mode 100644
index 0000000..97b0752
--- /dev/null
+++ b/tests/TPF/TPF_40_015/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.
+#
+
+EXTRA_LDFLAGS=-lm
+INCLUDE_CFLAGS+= -I./
+MPU_INCLUDE_CFLAGS+= -I./
+
+top_srcdir = ../..
+test_objs = host.o mpu1.task_eo
+timeout = 120
+
+include $(top_srcdir)/scripts/config.mk
+include $(top_srcdir)/scripts/rules_item.mk
+include $(top_srcdir)/scripts/rules_tpf.mk
+
+host.o: common.h
+mpu1.task_o: common.h
+mpu2.task_o: common.h
+mpu3.task_o: common.h
diff --git a/tests/TPF/TPF_40_015/common.h b/tests/TPF/TPF_40_015/common.h
new file mode 100644
index 0000000..3e24427
--- /dev/null
+++ b/tests/TPF/TPF_40_015/common.h
@@ -0,0 +1,48 @@
+/*
+ * Copyright 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/task.h>
+#include <mars_test.h>
+
+#define QUEUE_DEPTH 16
+#define ELEMENT_SIZE 128
+#define TEST1_ELEMENT_COUNT 4096
+#define TEST2_ELEMENT_COUNT 4096
+#define TEST3_ELEMENT_COUNT 4096
+
+#define MAX_MPUS spe
+
+#define ALIGN128 __attribute__((aligned(128)))
+
+struct test_task_args_st {
+ uint64_t queue_ea;
+ uint64_t barrier_ea;
+ uint64_t sender_to_receiver_ea;
+ uint64_t receiver_to_sender_ea;
+ uint64_t shared_resource_ea;
+ uint64_t ticks1_ea;
+ uint64_t ticks2_ea;
+ uint32_t tb_freq;
+ uint8_t pad[4];
+};
+
diff --git a/tests/TPF/TPF_40_015/host.c b/tests/TPF/TPF_40_015/host.c
new file mode 100644
index 0000000..9a33eb6
--- /dev/null
+++ b/tests/TPF/TPF_40_015/host.c
@@ -0,0 +1,172 @@
+/*
+ * Copyright 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 <pthread.h>
+#include <libspe2.h>
+#include <mars/task.h>
+#include <mars_test.h>
+#include <common.h>
+
+extern spe_program_handle_t mpu1_prog, mpu2_prog, mpu3_prog;
+
+struct thread_arg_st {
+ int32_t *ticks1;
+ int32_t *ticks2;
+ struct mars_context *mars_ctx;
+ uint64_t barrier;
+};
+
+void *test1_thread(void *arg)
+{
+ int i, ret;
+ uint32_t start, end;
+ struct thread_arg_st *thread_arg = arg;
+ int32_t *push_ticks = thread_arg->ticks1;
+ int32_t *pop_ticks = thread_arg->ticks2;
+ uint32_t sender_to_receiver = UINT32_MAX;
+ uint32_t receiver_to_sender = UINT32_MAX;
+ char buf[ELEMENT_SIZE];
+ struct mars_context *mars_ctx = thread_arg->mars_ctx;
+ struct mars_task_id task_id;
+ struct mars_task_args task_args;
+ uint64_t queue;
+ static __thread struct test_task_args_st args ALIGN128;
+
+ ret = mars_task_queue_create(mars_ctx, &queue,
+ ELEMENT_SIZE, QUEUE_DEPTH, MARS_TASK_QUEUE_MPU_TO_HOST);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+
+ ret = mars_task_create(mars_ctx, &task_id, NULL,
+ mpu1_prog.elf_image, MARS_TASK_CONTEXT_SAVE_SIZE_MAX);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+
+ args.queue_ea = queue;
+ args.barrier_ea = thread_arg->barrier;
+ args.sender_to_receiver_ea = mars_ptr_to_ea(&sender_to_receiver);
+ args.receiver_to_sender_ea = mars_ptr_to_ea(&receiver_to_sender);
+ args.ticks1_ea = mars_ptr_to_ea(push_ticks);
+ task_args.type.u64[0] = mars_ptr_to_ea(&args);
+
+ ret = mars_task_schedule(&task_id, &task_args, 0);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+
+ for (i = 0; i < TEST1_ELEMENT_COUNT; i++) {
+ mars_test_counter_wait(&sender_to_receiver, i);
+ start = mars_task_get_ticks();
+ ret = mars_task_queue_pop(queue, buf);
+ end = mars_task_get_ticks();
+ pop_ticks[i] = end - start;
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+ mars_test_counter_set(&receiver_to_sender, i);
+ }
+
+ ret = mars_task_wait(&task_id, NULL);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+
+ ret = mars_task_destroy(&task_id);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+
+ ret = mars_task_queue_destroy(queue);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+
+ return NULL;
+}
+
+void test1(int mpu, pthread_t *threads, struct thread_arg_st *thread_args)
+{
+ int ret, i;
+ size_t size;
+ int32_t *push_ticks, *pop_ticks;
+ struct mars_context *mars_ctx;
+ uint64_t barrier;
+
+ size = sizeof(int32_t) * TEST1_ELEMENT_COUNT * mpu;
+
+ ret = posix_memalign((void **)&push_ticks, 128, size);
+ MARS_TEST_ASSERT_EQUAL(ret, 0);
+
+ pop_ticks = (int32_t *)malloc(size);
+ MARS_TEST_ASSERT(pop_ticks != NULL);
+
+ ret = mars_context_create(&mars_ctx, 0, 1);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+
+ ret = mars_task_barrier_create(mars_ctx, &barrier, mpu);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+
+ for (i = 0; i < mpu; i++) {
+ thread_args[i].ticks1 = &push_ticks[TEST1_ELEMENT_COUNT * i];
+ thread_args[i].ticks2 = &pop_ticks[TEST1_ELEMENT_COUNT * i];
+ thread_args[i].mars_ctx = mars_ctx;
+ thread_args[i].barrier = barrier;
+ ret = pthread_create(&threads[i], NULL,
+ test1_thread, &thread_args[i]);
+ MARS_TEST_ASSERT_EQUAL(ret, 0);
+ }
+
+ for (i = 0; i < mpu; i++) {
+ ret = pthread_join(threads[i], NULL);
+ MARS_TEST_ASSERT_EQUAL(ret, 0);
+ }
+
+ 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);
+
+ size = TEST1_ELEMENT_COUNT * mpu;
+ mars_test_print_statistics(push_ticks, size, "push");
+ mars_test_print_statistics(pop_ticks, size, "pop");
+
+ free(pop_ticks);
+ free(push_ticks);
+}
+
+int main(int argc, char *argv[])
+{
+ int spe, mpu;
+ size_t size;
+ pthread_t *threads;
+ struct thread_arg_st *thread_args;
+
+ spe = spe_cpu_info_get(SPE_COUNT_PHYSICAL_SPES, -1);
+
+ mpu = MAX_MPUS;
+
+ threads = (pthread_t *)malloc(sizeof(pthread_t) * mpu);
+ MARS_TEST_ASSERT(threads != NULL);
+
+ size = sizeof(struct thread_arg_st) * mpu;
+ thread_args = (struct thread_arg_st *)malloc(size);
+ MARS_TEST_ASSERT(thread_args != NULL);
+
+ MARS_TEST_PERF_INIT();
+
+ test1(mpu, threads, thread_args);
+
+ free(thread_args);
+ free(threads);
+
+ return 0;
+}
diff --git a/tests/TPF/TPF_40_015/mpu1.c b/tests/TPF/TPF_40_015/mpu1.c
new file mode 100644
index 0000000..3314c82
--- /dev/null
+++ b/tests/TPF/TPF_40_015/mpu1.c
@@ -0,0 +1,68 @@
+/*
+ * Copyright 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/task.h>
+#include <mars_test.h>
+#include "common.h"
+#include <stdio.h>
+
+int mars_task_main(const struct mars_task_args *task_args)
+{
+ int ret, i;
+ uint32_t start, end;
+ char buf[ELEMENT_SIZE];
+ static struct test_task_args_st args ALIGN128;
+ static int32_t push_ticks[TEST1_ELEMENT_COUNT] ALIGN128;
+
+ mfc_get(&args, task_args->type.u64[0],
+ sizeof(struct test_task_args_st), 0, 0, 0);
+ mfc_write_tag_mask(1);
+ mfc_read_tag_status_all();
+
+ ret = mars_task_barrier_notify(args.barrier_ea);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+ ret = mars_task_barrier_wait(args.barrier_ea);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+
+ for (i = 0; i < QUEUE_DEPTH / 2; i++) {
+ ret = mars_task_queue_push(args.queue_ea, buf);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+ }
+
+
+ for (i = 0; i < TEST1_ELEMENT_COUNT; i++) {
+ start = mars_task_get_ticks();
+ ret = mars_task_queue_push(args.queue_ea, buf);
+ end = mars_task_get_ticks();
+ push_ticks[i] = end - start;
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+ mars_test_counter_set(args.sender_to_receiver_ea, i);
+ mars_test_counter_wait(args.receiver_to_sender_ea, i);
+ }
+
+ mfc_put(push_ticks, args.ticks1_ea, sizeof(push_ticks), 0, 0, 0);
+ mfc_write_tag_mask(1);
+ mfc_read_tag_status_all();
+
+ return 0;
+}
diff --git a/tests/TPF/TPF_40_016/Makefile b/tests/TPF/TPF_40_016/Makefile
new file mode 100644
index 0000000..dc68b86
--- /dev/null
+++ b/tests/TPF/TPF_40_016/Makefile
@@ -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.
+#
+
+EXTRA_LDFLAGS=-lm
+INCLUDE_CFLAGS+= -I./
+MPU_INCLUDE_CFLAGS+= -I./
+
+top_srcdir = ../..
+test_objs = host.o mpu1.task_eo mpu2.task_eo
+timeout = 120
+
+include $(top_srcdir)/scripts/config.mk
+include $(top_srcdir)/scripts/rules_item.mk
+include $(top_srcdir)/scripts/rules_tpf.mk
+
+host.o: common.h
+mpu1.task_o: common.h
+mpu2.task_o: common.h
diff --git a/tests/TPF/TPF_40_016/common.h b/tests/TPF/TPF_40_016/common.h
new file mode 100644
index 0000000..08485fb
--- /dev/null
+++ b/tests/TPF/TPF_40_016/common.h
@@ -0,0 +1,45 @@
+/*
+ * Copyright 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/task.h>
+#include <mars_test.h>
+
+#define MIN_MPUS 2
+#define MAX_MPUS spe/2
+
+#define QUEUE_DEPTH 16
+#define ELEMENT_SIZE 128
+#define TEST1_ELEMENT_COUNT 4096
+
+#define ALIGN128 __attribute__((aligned(128)))
+
+struct test_task_args_st {
+ uint64_t barrier_ea;
+ uint64_t ticks1_ea;
+ uint64_t ticks2_ea;
+ uint64_t ticks3_ea;
+ uint64_t queue_ea;
+ uint32_t tb_freq;
+ uint32_t pad[1];
+};
+
diff --git a/tests/TPF/TPF_40_016/host.c b/tests/TPF/TPF_40_016/host.c
new file mode 100644
index 0000000..f633a30
--- /dev/null
+++ b/tests/TPF/TPF_40_016/host.c
@@ -0,0 +1,24 @@
+/*
+ * Copyright 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 "../TPF_40_007/host.c"
diff --git a/tests/TPF/TPF_40_016/mpu1.c b/tests/TPF/TPF_40_016/mpu1.c
new file mode 100644
index 0000000..2c1b962
--- /dev/null
+++ b/tests/TPF/TPF_40_016/mpu1.c
@@ -0,0 +1,24 @@
+/*
+ * Copyright 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 "../TPF_40_007/mpu1.c"
diff --git a/tests/TPF/TPF_40_016/mpu2.c b/tests/TPF/TPF_40_016/mpu2.c
new file mode 100644
index 0000000..1c0c49b
--- /dev/null
+++ b/tests/TPF/TPF_40_016/mpu2.c
@@ -0,0 +1,24 @@
+/*
+ * Copyright 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 "../TPF_40_007/mpu2.c"
diff --git a/tests/TPF/TPF_40_017/Makefile b/tests/TPF/TPF_40_017/Makefile
new file mode 100644
index 0000000..dc68b86
--- /dev/null
+++ b/tests/TPF/TPF_40_017/Makefile
@@ -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.
+#
+
+EXTRA_LDFLAGS=-lm
+INCLUDE_CFLAGS+= -I./
+MPU_INCLUDE_CFLAGS+= -I./
+
+top_srcdir = ../..
+test_objs = host.o mpu1.task_eo mpu2.task_eo
+timeout = 120
+
+include $(top_srcdir)/scripts/config.mk
+include $(top_srcdir)/scripts/rules_item.mk
+include $(top_srcdir)/scripts/rules_tpf.mk
+
+host.o: common.h
+mpu1.task_o: common.h
+mpu2.task_o: common.h
diff --git a/tests/TPF/TPF_40_017/common.h b/tests/TPF/TPF_40_017/common.h
new file mode 100644
index 0000000..08485fb
--- /dev/null
+++ b/tests/TPF/TPF_40_017/common.h
@@ -0,0 +1,45 @@
+/*
+ * Copyright 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/task.h>
+#include <mars_test.h>
+
+#define MIN_MPUS 2
+#define MAX_MPUS spe/2
+
+#define QUEUE_DEPTH 16
+#define ELEMENT_SIZE 128
+#define TEST1_ELEMENT_COUNT 4096
+
+#define ALIGN128 __attribute__((aligned(128)))
+
+struct test_task_args_st {
+ uint64_t barrier_ea;
+ uint64_t ticks1_ea;
+ uint64_t ticks2_ea;
+ uint64_t ticks3_ea;
+ uint64_t queue_ea;
+ uint32_t tb_freq;
+ uint32_t pad[1];
+};
+
diff --git a/tests/TPF/TPF_40_017/host.c b/tests/TPF/TPF_40_017/host.c
new file mode 100644
index 0000000..ba198ed
--- /dev/null
+++ b/tests/TPF/TPF_40_017/host.c
@@ -0,0 +1,24 @@
+/*
+ * Copyright 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 "../TPF_40_008/host.c"
diff --git a/tests/TPF/TPF_40_017/mpu1.c b/tests/TPF/TPF_40_017/mpu1.c
new file mode 100644
index 0000000..396a02b
--- /dev/null
+++ b/tests/TPF/TPF_40_017/mpu1.c
@@ -0,0 +1,24 @@
+/*
+ * Copyright 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 "../TPF_40_008/mpu1.c"
diff --git a/tests/TPF/TPF_40_017/mpu2.c b/tests/TPF/TPF_40_017/mpu2.c
new file mode 100644
index 0000000..1bdb3b9
--- /dev/null
+++ b/tests/TPF/TPF_40_017/mpu2.c
@@ -0,0 +1,24 @@
+/*
+ * Copyright 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 "../TPF_40_008/mpu2.c"
diff --git a/tests/TPF/TPF_40_018/Makefile b/tests/TPF/TPF_40_018/Makefile
new file mode 100644
index 0000000..dc68b86
--- /dev/null
+++ b/tests/TPF/TPF_40_018/Makefile
@@ -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.
+#
+
+EXTRA_LDFLAGS=-lm
+INCLUDE_CFLAGS+= -I./
+MPU_INCLUDE_CFLAGS+= -I./
+
+top_srcdir = ../..
+test_objs = host.o mpu1.task_eo mpu2.task_eo
+timeout = 120
+
+include $(top_srcdir)/scripts/config.mk
+include $(top_srcdir)/scripts/rules_item.mk
+include $(top_srcdir)/scripts/rules_tpf.mk
+
+host.o: common.h
+mpu1.task_o: common.h
+mpu2.task_o: common.h
diff --git a/tests/TPF/TPF_40_018/common.h b/tests/TPF/TPF_40_018/common.h
new file mode 100644
index 0000000..08485fb
--- /dev/null
+++ b/tests/TPF/TPF_40_018/common.h
@@ -0,0 +1,45 @@
+/*
+ * Copyright 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/task.h>
+#include <mars_test.h>
+
+#define MIN_MPUS 2
+#define MAX_MPUS spe/2
+
+#define QUEUE_DEPTH 16
+#define ELEMENT_SIZE 128
+#define TEST1_ELEMENT_COUNT 4096
+
+#define ALIGN128 __attribute__((aligned(128)))
+
+struct test_task_args_st {
+ uint64_t barrier_ea;
+ uint64_t ticks1_ea;
+ uint64_t ticks2_ea;
+ uint64_t ticks3_ea;
+ uint64_t queue_ea;
+ uint32_t tb_freq;
+ uint32_t pad[1];
+};
+
diff --git a/tests/TPF/TPF_40_018/host.c b/tests/TPF/TPF_40_018/host.c
new file mode 100644
index 0000000..c1e2dfe
--- /dev/null
+++ b/tests/TPF/TPF_40_018/host.c
@@ -0,0 +1,24 @@
+/*
+ * Copyright 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 "../TPF_40_009/host.c"
diff --git a/tests/TPF/TPF_40_018/mpu1.c b/tests/TPF/TPF_40_018/mpu1.c
new file mode 100644
index 0000000..6a042af
--- /dev/null
+++ b/tests/TPF/TPF_40_018/mpu1.c
@@ -0,0 +1,24 @@
+/*
+ * Copyright 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 "../TPF_40_009/mpu1.c"
diff --git a/tests/TPF/TPF_40_018/mpu2.c b/tests/TPF/TPF_40_018/mpu2.c
new file mode 100644
index 0000000..11a99f7
--- /dev/null
+++ b/tests/TPF/TPF_40_018/mpu2.c
@@ -0,0 +1,24 @@
+/*
+ * Copyright 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 "../TPF_40_009/mpu2.c"
diff --git a/tests/TPF/TPF_40_019/Makefile b/tests/TPF/TPF_40_019/Makefile
new file mode 100644
index 0000000..96a8390
--- /dev/null
+++ b/tests/TPF/TPF_40_019/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.
+#
+
+EXTRA_LDFLAGS=-lm
+INCLUDE_CFLAGS+= -I./
+MPU_INCLUDE_CFLAGS+= -I./
+
+top_srcdir = ../..
+test_objs = host.o mpu1.task_eo mpu2.task_eo mpu3.task_eo
+timeout = 240
+
+include $(top_srcdir)/scripts/config.mk
+include $(top_srcdir)/scripts/rules_item.mk
+include $(top_srcdir)/scripts/rules_tpf.mk
+
+host.o: common.h
+mpu1.task_o: common.h
+mpu2.task_o: common.h
+mpu3.task_o: common.h
diff --git a/tests/TPF/TPF_40_019/common.h b/tests/TPF/TPF_40_019/common.h
new file mode 100644
index 0000000..ef02624
--- /dev/null
+++ b/tests/TPF/TPF_40_019/common.h
@@ -0,0 +1,80 @@
+/*
+ * Copyright 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/task.h>
+#include <mars_test.h>
+
+#define QUEUE_DEPTH 16
+#define ELEMENT_SIZE 128
+#define TEST1_ELEMENT_COUNT 4096
+#define TEST2_ELEMENT_COUNT 4096
+#define TEST3_ELEMENT_COUNT 4096
+
+#define MAX_MPUS spe*2
+
+#define ALIGN128 __attribute__((aligned(128)))
+
+struct test_task_args_st {
+ uint64_t queue_ea;
+ uint64_t sender_to_receiver_ea;
+ uint64_t receiver_to_sender_ea;
+ uint64_t shared_resource_ea;
+ uint64_t ticks1_ea;
+ uint64_t ticks2_ea;
+ uint32_t tb_freq;
+ uint8_t pad[12];
+};
+
+/* magic to avoid the page faults during the test */
+#ifdef __SPU__
+static inline void suppress_page_faults(
+ uint64_t queue_ea, char *buf, int sender)
+{
+ int i, ret;
+
+ for (i = 0; i < QUEUE_DEPTH; i++) {
+ if (sender)
+ ret = mars_task_queue_push(queue_ea, buf);
+ else
+ ret = mars_task_queue_pop(queue_ea, buf);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+ }
+
+ mars_task_yield();
+}
+#else
+static inline void suppress_page_faults(
+ uint64_t queue, char *buf, int sender)
+{
+ int i, ret;
+
+ for (i = 0; i < QUEUE_DEPTH; i++) {
+ if (sender)
+ ret = mars_task_queue_push(queue, buf);
+ else
+ ret = mars_task_queue_pop(queue, buf);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+ }
+}
+#endif
+
diff --git a/tests/TPF/TPF_40_019/host.c b/tests/TPF/TPF_40_019/host.c
new file mode 100644
index 0000000..49d54df
--- /dev/null
+++ b/tests/TPF/TPF_40_019/host.c
@@ -0,0 +1,24 @@
+/*
+ * Copyright 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 "../TPF_40_010/host.c"
diff --git a/tests/TPF/TPF_40_019/mpu1.c b/tests/TPF/TPF_40_019/mpu1.c
new file mode 100644
index 0000000..a4d2b28
--- /dev/null
+++ b/tests/TPF/TPF_40_019/mpu1.c
@@ -0,0 +1,24 @@
+/*
+ * Copyright 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 "../TPF_40_010/mpu1.c"
diff --git a/tests/TPF/TPF_40_019/mpu2.c b/tests/TPF/TPF_40_019/mpu2.c
new file mode 100644
index 0000000..cc525f9
--- /dev/null
+++ b/tests/TPF/TPF_40_019/mpu2.c
@@ -0,0 +1,24 @@
+/*
+ * Copyright 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 "../TPF_40_010/mpu2.c"
diff --git a/tests/TPF/TPF_40_019/mpu3.c b/tests/TPF/TPF_40_019/mpu3.c
new file mode 100644
index 0000000..b016019
--- /dev/null
+++ b/tests/TPF/TPF_40_019/mpu3.c
@@ -0,0 +1,24 @@
+/*
+ * Copyright 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 "../TPF_40_010/mpu3.c"
diff --git a/tests/TPF/TPF_40_020/Makefile b/tests/TPF/TPF_40_020/Makefile
new file mode 100644
index 0000000..b590ac2
--- /dev/null
+++ b/tests/TPF/TPF_40_020/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.
+#
+
+EXTRA_LDFLAGS=-lm
+INCLUDE_CFLAGS+= -I./
+MPU_INCLUDE_CFLAGS+= -I./
+
+top_srcdir = ../..
+test_objs = host.o mpu1.task_eo mpu2.task_eo mpu3.task_eo
+timeout = 120
+
+include $(top_srcdir)/scripts/config.mk
+include $(top_srcdir)/scripts/rules_item.mk
+include $(top_srcdir)/scripts/rules_tpf.mk
+
+host.o: common.h
+mpu1.task_o: common.h
+mpu2.task_o: common.h
+mpu3.task_o: common.h
diff --git a/tests/TPF/TPF_40_020/common.h b/tests/TPF/TPF_40_020/common.h
new file mode 100644
index 0000000..5ba9dd3
--- /dev/null
+++ b/tests/TPF/TPF_40_020/common.h
@@ -0,0 +1,46 @@
+/*
+ * Copyright 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/task.h>
+#include <mars_test.h>
+
+#define QUEUE_DEPTH 16
+#define ELEMENT_SIZE 128
+#define TEST1_ELEMENT_COUNT 4096
+#define TEST2_ELEMENT_COUNT 4096
+#define TEST3_ELEMENT_COUNT 4096
+
+#define MAX_MPUS spe*2
+
+#define ALIGN128 __attribute__((aligned(128)))
+
+struct test_task_args_st {
+ uint64_t queue_ea;
+ uint64_t sender_to_receiver_ea;
+ uint64_t receiver_to_sender_ea;
+ uint64_t shared_resource_ea;
+ uint64_t ticks1_ea;
+ uint64_t ticks2_ea;
+ uint32_t tb_freq;
+ uint8_t pad[12];
+};
diff --git a/tests/TPF/TPF_40_020/host.c b/tests/TPF/TPF_40_020/host.c
new file mode 100644
index 0000000..baa4092
--- /dev/null
+++ b/tests/TPF/TPF_40_020/host.c
@@ -0,0 +1,24 @@
+/*
+ * Copyright 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 "../TPF_40_011/host.c"
diff --git a/tests/TPF/TPF_40_020/mpu1.c b/tests/TPF/TPF_40_020/mpu1.c
new file mode 100644
index 0000000..990d0b4
--- /dev/null
+++ b/tests/TPF/TPF_40_020/mpu1.c
@@ -0,0 +1,24 @@
+/*
+ * Copyright 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 "../TPF_40_011/mpu1.c"
diff --git a/tests/TPF/TPF_40_020/mpu2.c b/tests/TPF/TPF_40_020/mpu2.c
new file mode 100644
index 0000000..d890477
--- /dev/null
+++ b/tests/TPF/TPF_40_020/mpu2.c
@@ -0,0 +1,24 @@
+/*
+ * Copyright 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 "../TPF_40_011/mpu2.c"
diff --git a/tests/TPF/TPF_40_020/mpu3.c b/tests/TPF/TPF_40_020/mpu3.c
new file mode 100644
index 0000000..91ad26d
--- /dev/null
+++ b/tests/TPF/TPF_40_020/mpu3.c
@@ -0,0 +1,24 @@
+/*
+ * Copyright 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 "../TPF_40_011/mpu3.c"
diff --git a/tests/TPF/TPF_40_021/Makefile b/tests/TPF/TPF_40_021/Makefile
new file mode 100644
index 0000000..52f5df8
--- /dev/null
+++ b/tests/TPF/TPF_40_021/Makefile
@@ -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.
+#
+
+EXTRA_LDFLAGS=-lm
+INCLUDE_CFLAGS+= -I./
+MPU_INCLUDE_CFLAGS+= -I./
+
+top_srcdir = ../..
+test_objs = host.o mpu1.task_eo
+timeout = 120
+
+include $(top_srcdir)/scripts/config.mk
+include $(top_srcdir)/scripts/rules_item.mk
+include $(top_srcdir)/scripts/rules_tpf.mk
+
+host.o: common.h
+mpu1.task_o: common.h
diff --git a/tests/TPF/TPF_40_021/common.h b/tests/TPF/TPF_40_021/common.h
new file mode 100644
index 0000000..ef02624
--- /dev/null
+++ b/tests/TPF/TPF_40_021/common.h
@@ -0,0 +1,80 @@
+/*
+ * Copyright 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/task.h>
+#include <mars_test.h>
+
+#define QUEUE_DEPTH 16
+#define ELEMENT_SIZE 128
+#define TEST1_ELEMENT_COUNT 4096
+#define TEST2_ELEMENT_COUNT 4096
+#define TEST3_ELEMENT_COUNT 4096
+
+#define MAX_MPUS spe*2
+
+#define ALIGN128 __attribute__((aligned(128)))
+
+struct test_task_args_st {
+ uint64_t queue_ea;
+ uint64_t sender_to_receiver_ea;
+ uint64_t receiver_to_sender_ea;
+ uint64_t shared_resource_ea;
+ uint64_t ticks1_ea;
+ uint64_t ticks2_ea;
+ uint32_t tb_freq;
+ uint8_t pad[12];
+};
+
+/* magic to avoid the page faults during the test */
+#ifdef __SPU__
+static inline void suppress_page_faults(
+ uint64_t queue_ea, char *buf, int sender)
+{
+ int i, ret;
+
+ for (i = 0; i < QUEUE_DEPTH; i++) {
+ if (sender)
+ ret = mars_task_queue_push(queue_ea, buf);
+ else
+ ret = mars_task_queue_pop(queue_ea, buf);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+ }
+
+ mars_task_yield();
+}
+#else
+static inline void suppress_page_faults(
+ uint64_t queue, char *buf, int sender)
+{
+ int i, ret;
+
+ for (i = 0; i < QUEUE_DEPTH; i++) {
+ if (sender)
+ ret = mars_task_queue_push(queue, buf);
+ else
+ ret = mars_task_queue_pop(queue, buf);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+ }
+}
+#endif
+
diff --git a/tests/TPF/TPF_40_021/host.c b/tests/TPF/TPF_40_021/host.c
new file mode 100644
index 0000000..4a3b484
--- /dev/null
+++ b/tests/TPF/TPF_40_021/host.c
@@ -0,0 +1,24 @@
+/*
+ * Copyright 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 "../TPF_40_012/host.c"
diff --git a/tests/TPF/TPF_40_021/mpu1.c b/tests/TPF/TPF_40_021/mpu1.c
new file mode 100644
index 0000000..8c411da
--- /dev/null
+++ b/tests/TPF/TPF_40_021/mpu1.c
@@ -0,0 +1,24 @@
+/*
+ * Copyright 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 "../TPF_40_012/mpu1.c"
diff --git a/tests/TPF/TPF_40_022/Makefile b/tests/TPF/TPF_40_022/Makefile
new file mode 100644
index 0000000..b590ac2
--- /dev/null
+++ b/tests/TPF/TPF_40_022/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.
+#
+
+EXTRA_LDFLAGS=-lm
+INCLUDE_CFLAGS+= -I./
+MPU_INCLUDE_CFLAGS+= -I./
+
+top_srcdir = ../..
+test_objs = host.o mpu1.task_eo mpu2.task_eo mpu3.task_eo
+timeout = 120
+
+include $(top_srcdir)/scripts/config.mk
+include $(top_srcdir)/scripts/rules_item.mk
+include $(top_srcdir)/scripts/rules_tpf.mk
+
+host.o: common.h
+mpu1.task_o: common.h
+mpu2.task_o: common.h
+mpu3.task_o: common.h
diff --git a/tests/TPF/TPF_40_022/common.h b/tests/TPF/TPF_40_022/common.h
new file mode 100644
index 0000000..20e47a7
--- /dev/null
+++ b/tests/TPF/TPF_40_022/common.h
@@ -0,0 +1,48 @@
+/*
+ * Copyright 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/task.h>
+#include <mars_test.h>
+
+#define QUEUE_DEPTH 16
+#define ELEMENT_SIZE 128
+#define TEST1_ELEMENT_COUNT 4096
+#define TEST2_ELEMENT_COUNT 4096
+#define TEST3_ELEMENT_COUNT 4096
+
+#define MAX_MPUS spe*2
+
+#define ALIGN128 __attribute__((aligned(128)))
+
+struct test_task_args_st {
+ uint64_t queue_ea;
+ uint64_t barrier_ea;
+ uint64_t sender_to_receiver_ea;
+ uint64_t receiver_to_sender_ea;
+ uint64_t shared_resource_ea;
+ uint64_t ticks1_ea;
+ uint64_t ticks2_ea;
+ uint32_t tb_freq;
+ uint8_t pad[4];
+};
+
diff --git a/tests/TPF/TPF_40_022/host.c b/tests/TPF/TPF_40_022/host.c
new file mode 100644
index 0000000..a5333e2
--- /dev/null
+++ b/tests/TPF/TPF_40_022/host.c
@@ -0,0 +1,24 @@
+/*
+ * Copyright 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 "../TPF_40_013/host.c"
diff --git a/tests/TPF/TPF_40_022/mpu1.c b/tests/TPF/TPF_40_022/mpu1.c
new file mode 100644
index 0000000..8efc455
--- /dev/null
+++ b/tests/TPF/TPF_40_022/mpu1.c
@@ -0,0 +1,24 @@
+/*
+ * Copyright 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 "../TPF_40_013/mpu1.c"
diff --git a/tests/TPF/TPF_40_022/mpu2.c b/tests/TPF/TPF_40_022/mpu2.c
new file mode 100644
index 0000000..526ae2d
--- /dev/null
+++ b/tests/TPF/TPF_40_022/mpu2.c
@@ -0,0 +1,24 @@
+/*
+ * Copyright 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 "../TPF_40_013/mpu2.c"
diff --git a/tests/TPF/TPF_40_022/mpu3.c b/tests/TPF/TPF_40_022/mpu3.c
new file mode 100644
index 0000000..b186bb9
--- /dev/null
+++ b/tests/TPF/TPF_40_022/mpu3.c
@@ -0,0 +1,24 @@
+/*
+ * Copyright 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 "../TPF_40_013/mpu3.c"
diff --git a/tests/TPF/TPF_40_023/Makefile b/tests/TPF/TPF_40_023/Makefile
new file mode 100644
index 0000000..b590ac2
--- /dev/null
+++ b/tests/TPF/TPF_40_023/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.
+#
+
+EXTRA_LDFLAGS=-lm
+INCLUDE_CFLAGS+= -I./
+MPU_INCLUDE_CFLAGS+= -I./
+
+top_srcdir = ../..
+test_objs = host.o mpu1.task_eo mpu2.task_eo mpu3.task_eo
+timeout = 120
+
+include $(top_srcdir)/scripts/config.mk
+include $(top_srcdir)/scripts/rules_item.mk
+include $(top_srcdir)/scripts/rules_tpf.mk
+
+host.o: common.h
+mpu1.task_o: common.h
+mpu2.task_o: common.h
+mpu3.task_o: common.h
diff --git a/tests/TPF/TPF_40_023/common.h b/tests/TPF/TPF_40_023/common.h
new file mode 100644
index 0000000..20e47a7
--- /dev/null
+++ b/tests/TPF/TPF_40_023/common.h
@@ -0,0 +1,48 @@
+/*
+ * Copyright 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/task.h>
+#include <mars_test.h>
+
+#define QUEUE_DEPTH 16
+#define ELEMENT_SIZE 128
+#define TEST1_ELEMENT_COUNT 4096
+#define TEST2_ELEMENT_COUNT 4096
+#define TEST3_ELEMENT_COUNT 4096
+
+#define MAX_MPUS spe*2
+
+#define ALIGN128 __attribute__((aligned(128)))
+
+struct test_task_args_st {
+ uint64_t queue_ea;
+ uint64_t barrier_ea;
+ uint64_t sender_to_receiver_ea;
+ uint64_t receiver_to_sender_ea;
+ uint64_t shared_resource_ea;
+ uint64_t ticks1_ea;
+ uint64_t ticks2_ea;
+ uint32_t tb_freq;
+ uint8_t pad[4];
+};
+
diff --git a/tests/TPF/TPF_40_023/host.c b/tests/TPF/TPF_40_023/host.c
new file mode 100644
index 0000000..12d5fd8
--- /dev/null
+++ b/tests/TPF/TPF_40_023/host.c
@@ -0,0 +1,24 @@
+/*
+ * Copyright 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 "../TPF_40_014/host.c"
diff --git a/tests/TPF/TPF_40_023/mpu1.c b/tests/TPF/TPF_40_023/mpu1.c
new file mode 100644
index 0000000..8728c4c
--- /dev/null
+++ b/tests/TPF/TPF_40_023/mpu1.c
@@ -0,0 +1,24 @@
+/*
+ * Copyright 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 "../TPF_40_014/mpu1.c"
diff --git a/tests/TPF/TPF_40_023/mpu2.c b/tests/TPF/TPF_40_023/mpu2.c
new file mode 100644
index 0000000..4e1b32b
--- /dev/null
+++ b/tests/TPF/TPF_40_023/mpu2.c
@@ -0,0 +1,24 @@
+/*
+ * Copyright 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 "../TPF_40_014/mpu2.c"
diff --git a/tests/TPF/TPF_40_023/mpu3.c b/tests/TPF/TPF_40_023/mpu3.c
new file mode 100644
index 0000000..92729a3
--- /dev/null
+++ b/tests/TPF/TPF_40_023/mpu3.c
@@ -0,0 +1,24 @@
+/*
+ * Copyright 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 "../TPF_40_014/mpu3.c"
diff --git a/tests/TPF/TPF_40_024/Makefile b/tests/TPF/TPF_40_024/Makefile
new file mode 100644
index 0000000..52f5df8
--- /dev/null
+++ b/tests/TPF/TPF_40_024/Makefile
@@ -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.
+#
+
+EXTRA_LDFLAGS=-lm
+INCLUDE_CFLAGS+= -I./
+MPU_INCLUDE_CFLAGS+= -I./
+
+top_srcdir = ../..
+test_objs = host.o mpu1.task_eo
+timeout = 120
+
+include $(top_srcdir)/scripts/config.mk
+include $(top_srcdir)/scripts/rules_item.mk
+include $(top_srcdir)/scripts/rules_tpf.mk
+
+host.o: common.h
+mpu1.task_o: common.h
diff --git a/tests/TPF/TPF_40_024/common.h b/tests/TPF/TPF_40_024/common.h
new file mode 100644
index 0000000..20e47a7
--- /dev/null
+++ b/tests/TPF/TPF_40_024/common.h
@@ -0,0 +1,48 @@
+/*
+ * Copyright 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/task.h>
+#include <mars_test.h>
+
+#define QUEUE_DEPTH 16
+#define ELEMENT_SIZE 128
+#define TEST1_ELEMENT_COUNT 4096
+#define TEST2_ELEMENT_COUNT 4096
+#define TEST3_ELEMENT_COUNT 4096
+
+#define MAX_MPUS spe*2
+
+#define ALIGN128 __attribute__((aligned(128)))
+
+struct test_task_args_st {
+ uint64_t queue_ea;
+ uint64_t barrier_ea;
+ uint64_t sender_to_receiver_ea;
+ uint64_t receiver_to_sender_ea;
+ uint64_t shared_resource_ea;
+ uint64_t ticks1_ea;
+ uint64_t ticks2_ea;
+ uint32_t tb_freq;
+ uint8_t pad[4];
+};
+
diff --git a/tests/TPF/TPF_40_024/host.c b/tests/TPF/TPF_40_024/host.c
new file mode 100644
index 0000000..cf80d34
--- /dev/null
+++ b/tests/TPF/TPF_40_024/host.c
@@ -0,0 +1,24 @@
+/*
+ * Copyright 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 "../TPF_40_015/host.c"
diff --git a/tests/TPF/TPF_40_024/mpu1.c b/tests/TPF/TPF_40_024/mpu1.c
new file mode 100644
index 0000000..0fad39e
--- /dev/null
+++ b/tests/TPF/TPF_40_024/mpu1.c
@@ -0,0 +1,24 @@
+/*
+ * Copyright 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 "../TPF_40_015/mpu1.c"
diff --git a/tests/TPF/TPF_40_025/Makefile b/tests/TPF/TPF_40_025/Makefile
new file mode 100644
index 0000000..dc68b86
--- /dev/null
+++ b/tests/TPF/TPF_40_025/Makefile
@@ -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.
+#
+
+EXTRA_LDFLAGS=-lm
+INCLUDE_CFLAGS+= -I./
+MPU_INCLUDE_CFLAGS+= -I./
+
+top_srcdir = ../..
+test_objs = host.o mpu1.task_eo mpu2.task_eo
+timeout = 120
+
+include $(top_srcdir)/scripts/config.mk
+include $(top_srcdir)/scripts/rules_item.mk
+include $(top_srcdir)/scripts/rules_tpf.mk
+
+host.o: common.h
+mpu1.task_o: common.h
+mpu2.task_o: common.h
diff --git a/tests/TPF/TPF_40_025/common.h b/tests/TPF/TPF_40_025/common.h
new file mode 100644
index 0000000..2e12f22
--- /dev/null
+++ b/tests/TPF/TPF_40_025/common.h
@@ -0,0 +1,45 @@
+/*
+ * Copyright 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/task.h>
+#include <mars_test.h>
+
+#define MIN_MPUS (spe/2)+1
+#define MAX_MPUS spe
+
+#define QUEUE_DEPTH 16
+#define ELEMENT_SIZE 128
+#define TEST1_ELEMENT_COUNT 4096
+
+#define ALIGN128 __attribute__((aligned(128)))
+
+struct test_task_args_st {
+ uint64_t barrier_ea;
+ uint64_t ticks1_ea;
+ uint64_t ticks2_ea;
+ uint64_t ticks3_ea;
+ uint64_t queue_ea;
+ uint32_t tb_freq;
+ uint32_t pad[1];
+};
+
diff --git a/tests/TPF/TPF_40_025/host.c b/tests/TPF/TPF_40_025/host.c
new file mode 100644
index 0000000..f633a30
--- /dev/null
+++ b/tests/TPF/TPF_40_025/host.c
@@ -0,0 +1,24 @@
+/*
+ * Copyright 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 "../TPF_40_007/host.c"
diff --git a/tests/TPF/TPF_40_025/mpu1.c b/tests/TPF/TPF_40_025/mpu1.c
new file mode 100644
index 0000000..2c1b962
--- /dev/null
+++ b/tests/TPF/TPF_40_025/mpu1.c
@@ -0,0 +1,24 @@
+/*
+ * Copyright 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 "../TPF_40_007/mpu1.c"
diff --git a/tests/TPF/TPF_40_025/mpu2.c b/tests/TPF/TPF_40_025/mpu2.c
new file mode 100644
index 0000000..1c0c49b
--- /dev/null
+++ b/tests/TPF/TPF_40_025/mpu2.c
@@ -0,0 +1,24 @@
+/*
+ * Copyright 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 "../TPF_40_007/mpu2.c"
diff --git a/tests/TPF/TPF_40_026/Makefile b/tests/TPF/TPF_40_026/Makefile
new file mode 100644
index 0000000..dc68b86
--- /dev/null
+++ b/tests/TPF/TPF_40_026/Makefile
@@ -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.
+#
+
+EXTRA_LDFLAGS=-lm
+INCLUDE_CFLAGS+= -I./
+MPU_INCLUDE_CFLAGS+= -I./
+
+top_srcdir = ../..
+test_objs = host.o mpu1.task_eo mpu2.task_eo
+timeout = 120
+
+include $(top_srcdir)/scripts/config.mk
+include $(top_srcdir)/scripts/rules_item.mk
+include $(top_srcdir)/scripts/rules_tpf.mk
+
+host.o: common.h
+mpu1.task_o: common.h
+mpu2.task_o: common.h
diff --git a/tests/TPF/TPF_40_026/common.h b/tests/TPF/TPF_40_026/common.h
new file mode 100644
index 0000000..2e12f22
--- /dev/null
+++ b/tests/TPF/TPF_40_026/common.h
@@ -0,0 +1,45 @@
+/*
+ * Copyright 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/task.h>
+#include <mars_test.h>
+
+#define MIN_MPUS (spe/2)+1
+#define MAX_MPUS spe
+
+#define QUEUE_DEPTH 16
+#define ELEMENT_SIZE 128
+#define TEST1_ELEMENT_COUNT 4096
+
+#define ALIGN128 __attribute__((aligned(128)))
+
+struct test_task_args_st {
+ uint64_t barrier_ea;
+ uint64_t ticks1_ea;
+ uint64_t ticks2_ea;
+ uint64_t ticks3_ea;
+ uint64_t queue_ea;
+ uint32_t tb_freq;
+ uint32_t pad[1];
+};
+
diff --git a/tests/TPF/TPF_40_026/host.c b/tests/TPF/TPF_40_026/host.c
new file mode 100644
index 0000000..ba198ed
--- /dev/null
+++ b/tests/TPF/TPF_40_026/host.c
@@ -0,0 +1,24 @@
+/*
+ * Copyright 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 "../TPF_40_008/host.c"
diff --git a/tests/TPF/TPF_40_026/mpu1.c b/tests/TPF/TPF_40_026/mpu1.c
new file mode 100644
index 0000000..396a02b
--- /dev/null
+++ b/tests/TPF/TPF_40_026/mpu1.c
@@ -0,0 +1,24 @@
+/*
+ * Copyright 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 "../TPF_40_008/mpu1.c"
diff --git a/tests/TPF/TPF_40_026/mpu2.c b/tests/TPF/TPF_40_026/mpu2.c
new file mode 100644
index 0000000..1bdb3b9
--- /dev/null
+++ b/tests/TPF/TPF_40_026/mpu2.c
@@ -0,0 +1,24 @@
+/*
+ * Copyright 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 "../TPF_40_008/mpu2.c"
diff --git a/tests/TPF/TPF_40_027/Makefile b/tests/TPF/TPF_40_027/Makefile
new file mode 100644
index 0000000..dc68b86
--- /dev/null
+++ b/tests/TPF/TPF_40_027/Makefile
@@ -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.
+#
+
+EXTRA_LDFLAGS=-lm
+INCLUDE_CFLAGS+= -I./
+MPU_INCLUDE_CFLAGS+= -I./
+
+top_srcdir = ../..
+test_objs = host.o mpu1.task_eo mpu2.task_eo
+timeout = 120
+
+include $(top_srcdir)/scripts/config.mk
+include $(top_srcdir)/scripts/rules_item.mk
+include $(top_srcdir)/scripts/rules_tpf.mk
+
+host.o: common.h
+mpu1.task_o: common.h
+mpu2.task_o: common.h
diff --git a/tests/TPF/TPF_40_027/common.h b/tests/TPF/TPF_40_027/common.h
new file mode 100644
index 0000000..2e12f22
--- /dev/null
+++ b/tests/TPF/TPF_40_027/common.h
@@ -0,0 +1,45 @@
+/*
+ * Copyright 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/task.h>
+#include <mars_test.h>
+
+#define MIN_MPUS (spe/2)+1
+#define MAX_MPUS spe
+
+#define QUEUE_DEPTH 16
+#define ELEMENT_SIZE 128
+#define TEST1_ELEMENT_COUNT 4096
+
+#define ALIGN128 __attribute__((aligned(128)))
+
+struct test_task_args_st {
+ uint64_t barrier_ea;
+ uint64_t ticks1_ea;
+ uint64_t ticks2_ea;
+ uint64_t ticks3_ea;
+ uint64_t queue_ea;
+ uint32_t tb_freq;
+ uint32_t pad[1];
+};
+
diff --git a/tests/TPF/TPF_40_027/host.c b/tests/TPF/TPF_40_027/host.c
new file mode 100644
index 0000000..c1e2dfe
--- /dev/null
+++ b/tests/TPF/TPF_40_027/host.c
@@ -0,0 +1,24 @@
+/*
+ * Copyright 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 "../TPF_40_009/host.c"
diff --git a/tests/TPF/TPF_40_027/mpu1.c b/tests/TPF/TPF_40_027/mpu1.c
new file mode 100644
index 0000000..6a042af
--- /dev/null
+++ b/tests/TPF/TPF_40_027/mpu1.c
@@ -0,0 +1,24 @@
+/*
+ * Copyright 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 "../TPF_40_009/mpu1.c"
diff --git a/tests/TPF/TPF_40_027/mpu2.c b/tests/TPF/TPF_40_027/mpu2.c
new file mode 100644
index 0000000..11a99f7
--- /dev/null
+++ b/tests/TPF/TPF_40_027/mpu2.c
@@ -0,0 +1,24 @@
+/*
+ * Copyright 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 "../TPF_40_009/mpu2.c"
diff --git a/tests/TPF/TPF_40_028/Makefile b/tests/TPF/TPF_40_028/Makefile
new file mode 100644
index 0000000..211cb9f
--- /dev/null
+++ b/tests/TPF/TPF_40_028/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.
+#
+
+EXTRA_LDFLAGS=-lm
+INCLUDE_CFLAGS+= -I./
+MPU_INCLUDE_CFLAGS+= -I./
+
+top_srcdir = ../..
+test_objs = host.o mpu1.task_eo mpu2.task_eo mpu3.task_eo
+timeout = 120
+
+include $(top_srcdir)/scripts/config.mk
+include $(top_srcdir)/scripts/rules_item.mk
+include $(top_srcdir)/scripts/rules_tpf.mk
+
+host.o: common.h
+mpu1.task_o: common.h
+mpu2.task_o: common.h
+mpu3.task_o: common.h
diff --git a/tests/TPF/TPF_40_028/common.h b/tests/TPF/TPF_40_028/common.h
new file mode 100644
index 0000000..c9033d8
--- /dev/null
+++ b/tests/TPF/TPF_40_028/common.h
@@ -0,0 +1,48 @@
+/*
+ * Copyright 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/task.h>
+#include <mars_test.h>
+
+#define QUEUE_EMPTY
+#define QUEUE_PREFILL 0
+
+#define QUEUE_DEPTH 64
+#define ELEMENT_SIZE 128
+#define TEST1_ELEMENT_COUNT 512
+#define TEST2_ELEMENT_COUNT 512
+#define TEST3_ELEMENT_COUNT 512
+
+#define ALIGN128 __attribute__((aligned(128)))
+
+struct test_task_args_st {
+ uint64_t queue_ea;
+ uint64_t sender_to_receiver_ea;
+ uint64_t receiver_to_sender_ea;
+ uint64_t shared_resource_ea;
+ uint64_t ticks1_ea;
+ uint64_t ticks2_ea;
+ uint32_t tb_freq;
+ uint32_t pushers_ea;
+ uint8_t pad[8];
+};
diff --git a/tests/TPF/TPF_40_028/host.c b/tests/TPF/TPF_40_028/host.c
new file mode 100644
index 0000000..c147423
--- /dev/null
+++ b/tests/TPF/TPF_40_028/host.c
@@ -0,0 +1,478 @@
+/*
+ * Copyright 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 <pthread.h>
+#include <libspe2.h>
+#include <mars/task.h>
+#include <mars_test.h>
+#include <common.h>
+
+extern spe_program_handle_t mpu1_prog, mpu2_prog, mpu3_prog;
+
+uint32_t sender_to_receiver = UINT32_MAX;
+uint32_t receiver_to_sender = UINT32_MAX;
+uint32_t shared_resource = UINT32_MAX;
+
+struct thread_arg_st {
+ int32_t *ticks1;
+ int32_t *ticks2;
+ uint32_t id;
+ uint32_t pushers;
+ uint64_t queue;
+ pthread_barrier_t *barrier;
+};
+
+void *test1_thread(void *arg)
+{
+ int i, ret;
+ int32_t start, end;
+ struct thread_arg_st *thread_arg = arg;
+ int32_t *push_ticks = thread_arg->ticks1;
+ int32_t *pop_ticks = thread_arg->ticks2;
+ char buf[ELEMENT_SIZE];
+
+ for (i = 0; i < TEST1_ELEMENT_COUNT; i++) {
+ /*stagger pushes starting with thread id 0*/
+ mars_test_counter_wait(&sender_to_receiver,
+ (i * thread_arg->pushers +
+ thread_arg->id) * 2);
+ mars_test_counter_set(&receiver_to_sender,
+ (i * thread_arg->pushers +
+ thread_arg->id) * 2);
+
+#ifdef QUEUE_FULL
+ usleep(DELAY); /*to prevent block on push*/
+#endif
+
+ start = mars_task_get_ticks();
+ ret = mars_task_queue_push(thread_arg->queue, buf);
+ end = mars_task_get_ticks();
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+
+ mars_test_counter_wait(&sender_to_receiver,
+ (i * thread_arg->pushers +
+ thread_arg->id) * 2 + 1);
+ mars_test_counter_set(&receiver_to_sender,
+ (i * thread_arg->pushers +
+ thread_arg->id) * 2 + 1);
+
+ pop_ticks[i] = shared_resource;
+ push_ticks[i] = end - start;
+
+ }
+ return NULL;
+}
+
+void test1(uint32_t pushers)
+{
+ int ret, i;
+ size_t size;
+ int32_t *push_ticks, *pop_ticks;
+
+ struct thread_arg_st thread_arg[pushers];
+ static __thread struct test_task_args_st args ALIGN128;
+ struct mars_context *mars_ctx;
+ struct mars_task_id task_id;
+ struct mars_task_args task_args;
+ uint64_t queue;
+ pthread_t *threads;
+ char buf[ELEMENT_SIZE];
+
+ threads = (pthread_t *) malloc(sizeof(pthread_t) * pushers);
+ MARS_TEST_ASSERT(threads != NULL);
+
+ size = sizeof(uint32_t) * TEST1_ELEMENT_COUNT * pushers;
+ push_ticks = (int32_t *) malloc(size);
+ MARS_TEST_ASSERT(push_ticks != NULL);
+ pop_ticks = (int32_t *) malloc(size);
+ MARS_TEST_ASSERT(push_ticks != NULL);
+
+ ret = posix_memalign((void **)&pop_ticks, 128, size);
+ MARS_TEST_ASSERT_EQUAL(ret, 0);
+
+ ret = mars_context_create(&mars_ctx, 0, 1);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+
+ ret = mars_test_get_timebase_freq(&args.tb_freq);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+
+ ret = mars_task_queue_create(mars_ctx, &queue, ELEMENT_SIZE, QUEUE_DEPTH,
+ MARS_TASK_QUEUE_HOST_TO_MPU);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+
+ ret = mars_task_create(mars_ctx, &task_id, NULL, mpu1_prog.elf_image,
+ MARS_TASK_CONTEXT_SAVE_SIZE_MAX);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+
+ args.queue_ea = queue;
+ args.shared_resource_ea = mars_ptr_to_ea(&shared_resource);
+ args.pushers_ea = mars_ptr_to_ea(&pushers);
+ args.sender_to_receiver_ea = mars_ptr_to_ea(&sender_to_receiver);
+ args.receiver_to_sender_ea = mars_ptr_to_ea(&receiver_to_sender);
+ task_args.type.u64[0] = mars_ptr_to_ea(&args);
+
+ ret = mars_task_schedule(&task_id, &task_args, 0);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+
+ for (i = 0; i < QUEUE_PREFILL; i++) {
+ ret = mars_task_queue_push(queue, buf);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+ }
+
+ for (i = 0; i < pushers; i++) {
+ thread_arg[i].id = i;
+ thread_arg[i].queue = queue;
+ thread_arg[i].pushers = pushers;
+ thread_arg[i].ticks1 = &push_ticks[TEST1_ELEMENT_COUNT * i];
+ thread_arg[i].ticks2 = &pop_ticks[TEST1_ELEMENT_COUNT * i];
+ ret =
+ pthread_create(&threads[i], NULL, test1_thread,
+ &thread_arg[i]);
+ MARS_TEST_ASSERT_EQUAL(ret, 0);
+ }
+
+ for (i = 0; i < pushers; i++) {
+ ret = pthread_join(threads[i], NULL);
+ MARS_TEST_ASSERT_EQUAL(ret, 0);
+ }
+
+ ret = mars_task_wait(&task_id, NULL);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+
+ ret = mars_task_destroy(&task_id);
+ 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_ctx);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+
+ size = TEST1_ELEMENT_COUNT * pushers;
+ mars_test_print_statistics(push_ticks, size, "push");
+ mars_test_print_statistics(pop_ticks, size, "pop");
+
+ free(threads);
+ free(pop_ticks);
+ free(push_ticks);
+}
+
+#ifndef QUEUE_INTERMEDIATE
+
+void *test2_thread(void *arg)
+{
+ int i, ret;
+ int32_t host_ticks, mpu_ticks;
+ struct thread_arg_st *thread_arg = arg;
+ int32_t *push_ticks = thread_arg->ticks1;
+ char buf[ELEMENT_SIZE];
+
+ for (i = 0; i < TEST2_ELEMENT_COUNT; i++) {
+
+ /*stagger pushes to give mpu time to block on pop*/
+ mars_test_counter_wait(&sender_to_receiver,
+ (i * thread_arg->pushers +
+ thread_arg->id) * 2);
+ mars_test_counter_set(&receiver_to_sender,
+ (i * thread_arg->pushers +
+ thread_arg->id) * 2);
+
+#ifdef QUEUE_EMPTY
+ usleep(DELAY); /*block on pop*/
+ host_ticks = mars_task_get_ticks(); /*start ticks*/
+#endif
+
+ ret = mars_task_queue_push(thread_arg->queue, buf);
+#ifdef QUEUE_FULL
+ host_ticks = mars_task_get_ticks(); /*end ticks*/
+#endif
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+
+ mars_test_counter_wait(&sender_to_receiver,
+ (i * thread_arg->pushers +
+ thread_arg->id) * 2 + 1);
+ mars_test_counter_set(&receiver_to_sender,
+ (i * thread_arg->pushers +
+ thread_arg->id) * 2 + 1);
+
+ mpu_ticks = shared_resource;
+
+#ifdef QUEUE_FULL
+ push_ticks[i] = host_ticks - mpu_ticks;
+#endif
+#ifdef QUEUE_EMPTY
+ push_ticks[i] = mpu_ticks - host_ticks;
+#endif
+ }
+ return NULL;
+}
+
+void test2(uint32_t pushers)
+{
+ int ret, i;
+ size_t size;
+ int32_t *ticks;
+
+ struct thread_arg_st thread_arg[pushers];
+ static __thread struct test_task_args_st args ALIGN128;
+ struct mars_context *mars_ctx;
+ struct mars_task_id task_id;
+ struct mars_task_args task_args;
+ uint64_t queue;
+ pthread_t *threads;
+ char buf[ELEMENT_SIZE];
+
+ threads = (pthread_t *) malloc(sizeof(pthread_t) * pushers);
+ MARS_TEST_ASSERT(threads != NULL);
+
+ size = sizeof(uint32_t) * TEST1_ELEMENT_COUNT * pushers;
+ ticks = (int32_t *) malloc(size);
+ MARS_TEST_ASSERT(ticks != NULL);
+
+ ret = mars_context_create(&mars_ctx, 0, 1);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+
+ ret = mars_task_queue_create(mars_ctx, &queue, ELEMENT_SIZE, QUEUE_DEPTH,
+ MARS_TASK_QUEUE_HOST_TO_MPU);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+
+ ret = mars_task_create(mars_ctx, &task_id, NULL, mpu2_prog.elf_image,
+ MARS_TASK_CONTEXT_SAVE_SIZE_MAX);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+
+ ret = mars_test_get_timebase_freq(&args.tb_freq);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+
+ args.queue_ea = queue;
+ args.pushers_ea = mars_ptr_to_ea(&pushers);
+ args.shared_resource_ea = mars_ptr_to_ea(&shared_resource);
+ args.sender_to_receiver_ea = mars_ptr_to_ea(&sender_to_receiver);
+ args.receiver_to_sender_ea = mars_ptr_to_ea(&receiver_to_sender);
+ task_args.type.u64[0] = mars_ptr_to_ea(&args);
+
+ ret = mars_task_schedule(&task_id, &task_args, 0);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+
+ for (i = 0; i < QUEUE_PREFILL; i++) {
+ ret = mars_task_queue_push(queue, buf);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+ }
+
+ for (i = 0; i < pushers; i++) {
+ thread_arg[i].id = i;
+ thread_arg[i].pushers = pushers;
+ thread_arg[i].queue = queue;
+ thread_arg[i].ticks1 = &ticks[TEST2_ELEMENT_COUNT * i];
+ ret =
+ pthread_create(&threads[i], NULL, test2_thread,
+ &thread_arg[i]);
+ MARS_TEST_ASSERT_EQUAL(ret, 0);
+ }
+
+ for (i = 0; i < pushers; i++) {
+ ret = pthread_join(threads[i], NULL);
+ MARS_TEST_ASSERT_EQUAL(ret, 0);
+ }
+
+ ret = mars_task_wait(&task_id, NULL);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+
+ ret = mars_task_destroy(&task_id);
+ 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_ctx);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+
+ size = TEST1_ELEMENT_COUNT * pushers;
+#ifdef QUEUE_EMPTY
+ mars_test_print_statistics(ticks, TEST2_ELEMENT_COUNT * pushers,
+ "beginning of push - end of pop");
+#endif
+#ifdef QUEUE_FULL
+ mars_test_print_statistics(ticks, TEST2_ELEMENT_COUNT * pushers,
+ "beginning of pop - end of push");
+#endif
+
+ free(threads);
+ free(ticks);
+}
+
+void *test3_thread(void *arg)
+{
+ int i, ret;
+ int32_t host_ticks, mpu_ticks;
+ struct thread_arg_st *thread_arg = arg;
+ int32_t *push_ticks = thread_arg->ticks1;
+ char buf[ELEMENT_SIZE];
+
+ for (i = 0; i < TEST1_ELEMENT_COUNT; i++) {
+
+ /*stagger pushes to give mpu time to block on pop*/
+ mars_test_counter_wait(&sender_to_receiver,
+ (i * thread_arg->pushers +
+ thread_arg->id) * 2);
+ mars_test_counter_set(&receiver_to_sender,
+ (i * thread_arg->pushers +
+ thread_arg->id) * 2);
+
+#ifdef QUEUE_EMPTY
+ usleep(DELAY); /*block on pop*/
+#endif
+ ret = mars_task_queue_push(thread_arg->queue, buf);
+#ifdef QUEUE_EMPTY
+ host_ticks = mars_task_get_ticks(); /* start ticks */
+#endif
+#ifdef QUEUE_FULL
+ host_ticks = mars_task_get_ticks(); /* end ticks */
+#endif
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+
+ mars_test_counter_wait(&sender_to_receiver,
+ (i * thread_arg->pushers +
+ thread_arg->id) * 2 + 1);
+ mars_test_counter_set(&receiver_to_sender,
+ (i * thread_arg->pushers +
+ thread_arg->id) * 2 + 1);
+
+ mpu_ticks = shared_resource;
+
+#ifdef QUEUE_FULL
+ push_ticks[i] = host_ticks - mpu_ticks;
+#endif
+#ifdef QUEUE_EMPTY
+ push_ticks[i] = mpu_ticks - host_ticks;
+#endif
+ }
+ return NULL;
+}
+
+void test3(uint32_t pushers)
+{
+ int ret, i;
+ size_t size;
+ int32_t *ticks;
+
+ struct thread_arg_st thread_arg[pushers];
+ static __thread struct test_task_args_st args ALIGN128;
+ struct mars_context *mars_ctx;
+ struct mars_task_id task_id;
+ struct mars_task_args task_args;
+ uint64_t queue;
+ pthread_t *threads;
+ char buf[ELEMENT_SIZE];
+
+ threads = (pthread_t *) malloc(sizeof(pthread_t) * pushers);
+ MARS_TEST_ASSERT(threads != NULL);
+
+ size = sizeof(uint32_t) * TEST1_ELEMENT_COUNT * pushers;
+ ticks = (int32_t *) malloc(size);
+ MARS_TEST_ASSERT(ticks != NULL);
+
+ ret = mars_context_create(&mars_ctx, 0, 1);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+
+ ret = mars_task_queue_create(mars_ctx, &queue, ELEMENT_SIZE, QUEUE_DEPTH,
+ MARS_TASK_QUEUE_HOST_TO_MPU);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+
+ ret = mars_task_create(mars_ctx, &task_id, NULL, mpu3_prog.elf_image,
+ MARS_TASK_CONTEXT_SAVE_SIZE_MAX);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+
+ ret = mars_test_get_timebase_freq(&args.tb_freq);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+
+ args.queue_ea = queue;
+ args.pushers_ea = mars_ptr_to_ea(&pushers);
+ args.shared_resource_ea = mars_ptr_to_ea(&shared_resource);
+ args.sender_to_receiver_ea = mars_ptr_to_ea(&sender_to_receiver);
+ args.receiver_to_sender_ea = mars_ptr_to_ea(&receiver_to_sender);
+ task_args.type.u64[0] = mars_ptr_to_ea(&args);
+
+ ret = mars_task_schedule(&task_id, &task_args, 0);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+
+ for (i = 0; i < QUEUE_PREFILL; i++) {
+ ret = mars_task_queue_push(queue, buf);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+ }
+
+ for (i = 0; i < pushers; i++) {
+ thread_arg[i].id = i;
+ thread_arg[i].pushers = pushers;
+ thread_arg[i].queue = queue;
+ thread_arg[i].ticks1 = &ticks[TEST3_ELEMENT_COUNT * i];
+ ret =
+ pthread_create(&threads[i], NULL, test3_thread,
+ &thread_arg[i]);
+ MARS_TEST_ASSERT_EQUAL(ret, 0);
+ }
+
+ for (i = 0; i < pushers; i++) {
+ ret = pthread_join(threads[i], NULL);
+ MARS_TEST_ASSERT_EQUAL(ret, 0);
+ }
+
+ ret = mars_task_wait(&task_id, NULL);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+
+ ret = mars_task_destroy(&task_id);
+ 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_ctx);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+
+ size = TEST1_ELEMENT_COUNT * pushers;
+#ifdef QUEUE_EMPTY
+ mars_test_print_statistics(ticks, TEST3_ELEMENT_COUNT * pushers,
+ "end of push - end of pop");
+#endif
+#ifdef QUEUE_FULL
+ mars_test_print_statistics(ticks, TEST3_ELEMENT_COUNT * pushers,
+ "end of pop - end of push");
+#endif
+
+ free(threads);
+ free(ticks);
+}
+
+#endif
+
+int main(int argc, char *argv[])
+{
+ uint32_t pushers = 6;
+
+ test1(pushers);
+#ifndef QUEUE_INTERMEDIATE
+ test2(pushers);
+ test3(pushers);
+#endif
+
+ return 0;
+}
diff --git a/tests/TPF/TPF_40_028/mpu1.c b/tests/TPF/TPF_40_028/mpu1.c
new file mode 100644
index 0000000..8cce073
--- /dev/null
+++ b/tests/TPF/TPF_40_028/mpu1.c
@@ -0,0 +1,72 @@
+/*
+ * Copyright 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/task.h>
+#include <mars_test.h>
+#include <common.h>
+
+int mars_task_main(const struct mars_task_args *task_args)
+{
+ int ret, i, j;
+ uint32_t start, end, pushers;
+ char buf[ELEMENT_SIZE];
+ static struct test_task_args_st args ALIGN128;
+
+ mfc_get(&args, task_args->type.u64[0], sizeof(struct test_task_args_st),
+ 0, 0, 0);
+ mfc_write_tag_mask(1);
+ mfc_read_tag_status_all();
+
+ pushers = mars_test_int32_get(args.pushers_ea);
+
+ for (i = 0; i < TEST1_ELEMENT_COUNT; i++) {
+ for (j = 0; j < pushers; j++) {
+
+ mars_test_counter_set(args.sender_to_receiver_ea,
+ (i * pushers + j) * 2);
+ mars_test_counter_wait(args.receiver_to_sender_ea,
+ (i * pushers + j) * 2);
+
+#ifdef QUEUE_EMPTY
+ mars_test_usleep(args.tb_freq, DELAY);
+#endif
+
+ start = mars_task_get_ticks();
+ ret = mars_task_queue_pop(args.queue_ea, buf);
+ end = mars_task_get_ticks();
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+
+ mars_test_int32_put(args.shared_resource_ea,
+ end - start);
+
+ mars_test_counter_set(args.sender_to_receiver_ea,
+ (i * pushers + j) * 2 + 1);
+ mars_test_counter_wait(args.receiver_to_sender_ea,
+ (i * pushers + j) * 2 + 1);
+
+ }
+ }
+
+ return 0;
+}
diff --git a/tests/TPF/TPF_40_028/mpu2.c b/tests/TPF/TPF_40_028/mpu2.c
new file mode 100644
index 0000000..5feb676
--- /dev/null
+++ b/tests/TPF/TPF_40_028/mpu2.c
@@ -0,0 +1,71 @@
+/*
+ * Copyright 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/task.h>
+#include <mars_test.h>
+#include <common.h>
+
+int mars_task_main(const struct mars_task_args *task_args)
+{
+ int ret, i, j;
+ int32_t mpu_ticks = 0;
+ int32_t pushers;
+ char buf[ELEMENT_SIZE];
+ static struct test_task_args_st args ALIGN128;
+
+ mfc_get(&args, task_args->type.u64[0], sizeof(struct test_task_args_st),
+ 0, 0, 0);
+ mfc_write_tag_mask(1);
+ mfc_read_tag_status_all();
+
+ pushers = mars_test_int32_get(args.pushers_ea);
+
+ for (i = 0; i < TEST1_ELEMENT_COUNT; i++) {
+ for (j = 0; j < pushers; j++) {
+
+ mars_test_counter_set(args.sender_to_receiver_ea,
+ (i * pushers + j) * 2);
+ mars_test_counter_wait(args.receiver_to_sender_ea,
+ (i * pushers + j) * 2);
+#ifdef QUEUE_FULL
+ mars_test_usleep(args.tb_freq, DELAY);
+ mpu_ticks = mars_task_get_ticks(); /* start ticks*/
+#endif
+ ret = mars_task_queue_pop(args.queue_ea, buf);
+#ifdef QUEUE_EMPTY
+ mpu_ticks = mars_task_get_ticks(); /* end ticks*/
+#endif
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+
+ mars_test_int32_put(args.shared_resource_ea, mpu_ticks);
+
+ mars_test_counter_set(args.sender_to_receiver_ea,
+ (i * pushers + j) * 2 + 1);
+ mars_test_counter_wait(args.receiver_to_sender_ea,
+ (i * pushers + j) * 2 + 1);
+
+ }
+ }
+ return 0;
+}
diff --git a/tests/TPF/TPF_40_028/mpu3.c b/tests/TPF/TPF_40_028/mpu3.c
new file mode 100644
index 0000000..a7cc8c9
--- /dev/null
+++ b/tests/TPF/TPF_40_028/mpu3.c
@@ -0,0 +1,67 @@
+/*
+ * Copyright 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/task.h>
+#include <mars_test.h>
+#include <common.h>
+
+int mars_task_main(const struct mars_task_args *task_args)
+{
+ int ret, i, j;
+ uint32_t mpu_ticks, pushers;
+ char buf[ELEMENT_SIZE];
+ static struct test_task_args_st args ALIGN128;
+
+ mfc_get(&args, task_args->type.u64[0], sizeof(struct test_task_args_st),
+ 0, 0, 0);
+ mfc_write_tag_mask(1);
+ mfc_read_tag_status_all();
+
+ pushers = mars_test_int32_get(args.pushers_ea);
+
+ for (i = 0; i < TEST1_ELEMENT_COUNT; i++) {
+ for (j = 0; j < pushers; j++) {
+
+ mars_test_counter_set(args.sender_to_receiver_ea,
+ (i * pushers + j) * 2);
+ mars_test_counter_wait(args.receiver_to_sender_ea,
+ (i * pushers + j) * 2);
+#ifdef QUEUE_FULL
+ mars_test_usleep(args.tb_freq, DELAY);
+#endif
+ ret = mars_task_queue_pop(args.queue_ea, buf);
+ mpu_ticks = mars_task_get_ticks(); /* end ticks for empty, but start ticks for full*/
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+
+ mars_test_int32_put(args.shared_resource_ea, mpu_ticks);
+
+ mars_test_counter_set(args.sender_to_receiver_ea,
+ (i * pushers + j) * 2 + 1);
+ mars_test_counter_wait(args.receiver_to_sender_ea,
+ (i * pushers + j) * 2 + 1);
+
+ }
+ }
+ return 0;
+}
diff --git a/tests/TPF/TPF_40_029/Makefile b/tests/TPF/TPF_40_029/Makefile
new file mode 100644
index 0000000..b590ac2
--- /dev/null
+++ b/tests/TPF/TPF_40_029/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.
+#
+
+EXTRA_LDFLAGS=-lm
+INCLUDE_CFLAGS+= -I./
+MPU_INCLUDE_CFLAGS+= -I./
+
+top_srcdir = ../..
+test_objs = host.o mpu1.task_eo mpu2.task_eo mpu3.task_eo
+timeout = 120
+
+include $(top_srcdir)/scripts/config.mk
+include $(top_srcdir)/scripts/rules_item.mk
+include $(top_srcdir)/scripts/rules_tpf.mk
+
+host.o: common.h
+mpu1.task_o: common.h
+mpu2.task_o: common.h
+mpu3.task_o: common.h
diff --git a/tests/TPF/TPF_40_029/common.h b/tests/TPF/TPF_40_029/common.h
new file mode 100644
index 0000000..ce74d5c
--- /dev/null
+++ b/tests/TPF/TPF_40_029/common.h
@@ -0,0 +1,48 @@
+/*
+ * Copyright 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/task.h>
+#include <mars_test.h>
+
+#define QUEUE_FULL
+#define QUEUE_PREFILL 64
+
+#define QUEUE_DEPTH 64
+#define ELEMENT_SIZE 128
+#define TEST1_ELEMENT_COUNT 512
+#define TEST2_ELEMENT_COUNT 512
+#define TEST3_ELEMENT_COUNT 512
+
+#define ALIGN128 __attribute__((aligned(128)))
+
+struct test_task_args_st {
+ uint64_t queue_ea;
+ uint64_t sender_to_receiver_ea;
+ uint64_t receiver_to_sender_ea;
+ uint64_t shared_resource_ea;
+ uint64_t ticks1_ea;
+ uint64_t ticks2_ea;
+ uint32_t tb_freq;
+ uint32_t pushers_ea;
+ uint8_t pad[8];
+};
diff --git a/tests/TPF/TPF_40_029/host.c b/tests/TPF/TPF_40_029/host.c
new file mode 100644
index 0000000..53b853d
--- /dev/null
+++ b/tests/TPF/TPF_40_029/host.c
@@ -0,0 +1,24 @@
+/*
+ * Copyright 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 "../TPF_40_028/host.c"
diff --git a/tests/TPF/TPF_40_029/mpu1.c b/tests/TPF/TPF_40_029/mpu1.c
new file mode 100644
index 0000000..f7638bf
--- /dev/null
+++ b/tests/TPF/TPF_40_029/mpu1.c
@@ -0,0 +1,24 @@
+/*
+ * Copyright 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 "../TPF_40_028/mpu1.c"
diff --git a/tests/TPF/TPF_40_029/mpu2.c b/tests/TPF/TPF_40_029/mpu2.c
new file mode 100644
index 0000000..641eb51
--- /dev/null
+++ b/tests/TPF/TPF_40_029/mpu2.c
@@ -0,0 +1,24 @@
+/*
+ * Copyright 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 "../TPF_40_028/mpu2.c"
diff --git a/tests/TPF/TPF_40_029/mpu3.c b/tests/TPF/TPF_40_029/mpu3.c
new file mode 100644
index 0000000..e73a75a
--- /dev/null
+++ b/tests/TPF/TPF_40_029/mpu3.c
@@ -0,0 +1,24 @@
+/*
+ * Copyright 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 "../TPF_40_028/mpu3.c"
diff --git a/tests/TPF/TPF_40_030/Makefile b/tests/TPF/TPF_40_030/Makefile
new file mode 100644
index 0000000..fe85af5
--- /dev/null
+++ b/tests/TPF/TPF_40_030/Makefile
@@ -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.
+#
+
+EXTRA_LDFLAGS=-lm
+INCLUDE_CFLAGS+= -I./
+MPU_INCLUDE_CFLAGS+= -I./
+
+
+top_srcdir = ../..
+test_objs = host.o mpu1.task_eo mpu2.task_eo mpu3.task_eo
+timeout = 120
+
+include $(top_srcdir)/scripts/config.mk
+include $(top_srcdir)/scripts/rules_item.mk
+include $(top_srcdir)/scripts/rules_tpf.mk
+
+host.o: common.h
+mpu1.task_o: common.h
+mpu2.task_o: common.h
+mpu3.task_o: common.h
diff --git a/tests/TPF/TPF_40_030/common.h b/tests/TPF/TPF_40_030/common.h
new file mode 100644
index 0000000..d3f8509
--- /dev/null
+++ b/tests/TPF/TPF_40_030/common.h
@@ -0,0 +1,48 @@
+/*
+ * Copyright 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/task.h>
+#include <mars_test.h>
+
+#define QUEUE_INTERMEDIATE
+#define QUEUE_PREFILL 32
+
+#define QUEUE_DEPTH 64
+#define ELEMENT_SIZE 128
+#define TEST1_ELEMENT_COUNT 512
+#define TEST2_ELEMENT_COUNT 512
+#define TEST3_ELEMENT_COUNT 512
+
+#define ALIGN128 __attribute__((aligned(128)))
+
+struct test_task_args_st {
+ uint64_t queue_ea;
+ uint64_t sender_to_receiver_ea;
+ uint64_t receiver_to_sender_ea;
+ uint64_t shared_resource_ea;
+ uint64_t ticks1_ea;
+ uint64_t ticks2_ea;
+ uint32_t tb_freq;
+ uint32_t pushers_ea;
+ uint8_t pad[8];
+};
diff --git a/tests/TPF/TPF_40_030/host.c b/tests/TPF/TPF_40_030/host.c
new file mode 100644
index 0000000..53b853d
--- /dev/null
+++ b/tests/TPF/TPF_40_030/host.c
@@ -0,0 +1,24 @@
+/*
+ * Copyright 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 "../TPF_40_028/host.c"
diff --git a/tests/TPF/TPF_40_030/mpu1.c b/tests/TPF/TPF_40_030/mpu1.c
new file mode 100644
index 0000000..f7638bf
--- /dev/null
+++ b/tests/TPF/TPF_40_030/mpu1.c
@@ -0,0 +1,24 @@
+/*
+ * Copyright 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 "../TPF_40_028/mpu1.c"
diff --git a/tests/TPF/TPF_40_030/mpu2.c b/tests/TPF/TPF_40_030/mpu2.c
new file mode 100644
index 0000000..641eb51
--- /dev/null
+++ b/tests/TPF/TPF_40_030/mpu2.c
@@ -0,0 +1,24 @@
+/*
+ * Copyright 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 "../TPF_40_028/mpu2.c"
diff --git a/tests/TPF/TPF_40_030/mpu3.c b/tests/TPF/TPF_40_030/mpu3.c
new file mode 100644
index 0000000..e73a75a
--- /dev/null
+++ b/tests/TPF/TPF_40_030/mpu3.c
@@ -0,0 +1,24 @@
+/*
+ * Copyright 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 "../TPF_40_028/mpu3.c"
diff --git a/tests/TPF/TPF_40_031/Makefile b/tests/TPF/TPF_40_031/Makefile
new file mode 100644
index 0000000..fe85af5
--- /dev/null
+++ b/tests/TPF/TPF_40_031/Makefile
@@ -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.
+#
+
+EXTRA_LDFLAGS=-lm
+INCLUDE_CFLAGS+= -I./
+MPU_INCLUDE_CFLAGS+= -I./
+
+
+top_srcdir = ../..
+test_objs = host.o mpu1.task_eo mpu2.task_eo mpu3.task_eo
+timeout = 120
+
+include $(top_srcdir)/scripts/config.mk
+include $(top_srcdir)/scripts/rules_item.mk
+include $(top_srcdir)/scripts/rules_tpf.mk
+
+host.o: common.h
+mpu1.task_o: common.h
+mpu2.task_o: common.h
+mpu3.task_o: common.h
diff --git a/tests/TPF/TPF_40_031/common.h b/tests/TPF/TPF_40_031/common.h
new file mode 100644
index 0000000..c9033d8
--- /dev/null
+++ b/tests/TPF/TPF_40_031/common.h
@@ -0,0 +1,48 @@
+/*
+ * Copyright 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/task.h>
+#include <mars_test.h>
+
+#define QUEUE_EMPTY
+#define QUEUE_PREFILL 0
+
+#define QUEUE_DEPTH 64
+#define ELEMENT_SIZE 128
+#define TEST1_ELEMENT_COUNT 512
+#define TEST2_ELEMENT_COUNT 512
+#define TEST3_ELEMENT_COUNT 512
+
+#define ALIGN128 __attribute__((aligned(128)))
+
+struct test_task_args_st {
+ uint64_t queue_ea;
+ uint64_t sender_to_receiver_ea;
+ uint64_t receiver_to_sender_ea;
+ uint64_t shared_resource_ea;
+ uint64_t ticks1_ea;
+ uint64_t ticks2_ea;
+ uint32_t tb_freq;
+ uint32_t pushers_ea;
+ uint8_t pad[8];
+};
diff --git a/tests/TPF/TPF_40_031/host.c b/tests/TPF/TPF_40_031/host.c
new file mode 100644
index 0000000..901a8f5
--- /dev/null
+++ b/tests/TPF/TPF_40_031/host.c
@@ -0,0 +1,454 @@
+/*
+ * Copyright 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 <pthread.h>
+#include <libspe2.h>
+#include <mars/task.h>
+#include <mars_test.h>
+#include <common.h>
+
+extern spe_program_handle_t mpu1_prog, mpu2_prog, mpu3_prog;
+
+uint32_t sender_to_receiver = UINT32_MAX;
+uint32_t receiver_to_sender = UINT32_MAX;
+uint32_t shared_resource = UINT32_MAX;
+
+struct thread_arg_st {
+ uint32_t id;
+ uint32_t pushers;
+ uint64_t queue;
+ int32_t *ticks1;
+ int32_t *ticks2;
+ pthread_barrier_t *barrier;
+};
+
+void *test1_thread(void *arg)
+{
+ int i, ret;
+ int32_t start, end;
+ struct thread_arg_st *thread_arg = arg;
+ int32_t *push_ticks = thread_arg->ticks1;
+ int32_t *pop_ticks = thread_arg->ticks2;
+ char buf[ELEMENT_SIZE];
+
+ for (i = 0; i < TEST1_ELEMENT_COUNT; i++) {
+ /*stagger pushes starting with thread id 0*/
+ mars_test_counter_wait(&sender_to_receiver,
+ (i * thread_arg->pushers +
+ thread_arg->id) * 2);
+ mars_test_counter_set(&receiver_to_sender,
+ (i * thread_arg->pushers +
+ thread_arg->id) * 2);
+
+#ifdef QUEUE_EMPTY
+ usleep(DELAY);
+#endif
+
+ start = mars_task_get_ticks();
+ ret = mars_task_queue_pop(thread_arg->queue, buf);
+ end = mars_task_get_ticks();
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+
+ mars_test_counter_wait(&sender_to_receiver,
+ (i * thread_arg->pushers +
+ thread_arg->id) * 2 + 1);
+ mars_test_counter_set(&receiver_to_sender,
+ (i * thread_arg->pushers +
+ thread_arg->id) * 2 + 1);
+
+ pop_ticks[i] = shared_resource;
+ push_ticks[i] = end - start;
+
+ }
+ return NULL;
+}
+
+void test1(uint32_t pushers)
+{
+ int ret, i;
+ size_t size;
+ int32_t *push_ticks, *pop_ticks;
+
+ struct thread_arg_st thread_arg[pushers];
+ static __thread struct test_task_args_st args ALIGN128;
+ struct mars_context *mars_ctx;
+ struct mars_task_id task_id;
+ struct mars_task_args task_args;
+ uint64_t queue;
+ pthread_t *threads;
+
+ threads = (pthread_t *) malloc(sizeof(pthread_t) * pushers);
+ MARS_TEST_ASSERT(threads != NULL);
+
+ size = sizeof(uint32_t) * TEST1_ELEMENT_COUNT * pushers;
+ push_ticks = (int32_t *) malloc(size);
+ MARS_TEST_ASSERT(push_ticks != NULL);
+ pop_ticks = (int32_t *) malloc(size);
+ MARS_TEST_ASSERT(push_ticks != NULL);
+
+ ret = posix_memalign((void **)&pop_ticks, 128, size);
+ MARS_TEST_ASSERT_EQUAL(ret, 0);
+
+ ret = mars_test_get_timebase_freq(&args.tb_freq);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+
+ ret = mars_context_create(&mars_ctx, 0, 1);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+
+ ret = mars_task_queue_create(mars_ctx, &queue, ELEMENT_SIZE, QUEUE_DEPTH,
+ MARS_TASK_QUEUE_MPU_TO_HOST);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+
+ ret = mars_task_create(mars_ctx, &task_id, NULL, mpu1_prog.elf_image,
+ MARS_TASK_CONTEXT_SAVE_SIZE_MAX);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+
+ args.queue_ea = queue;
+ args.shared_resource_ea = mars_ptr_to_ea(&shared_resource);
+ args.pushers_ea = mars_ptr_to_ea(&pushers);
+ args.sender_to_receiver_ea = mars_ptr_to_ea(&sender_to_receiver);
+ args.receiver_to_sender_ea = mars_ptr_to_ea(&receiver_to_sender);
+ task_args.type.u64[0] = mars_ptr_to_ea(&args);
+
+ ret = mars_task_schedule(&task_id, &task_args, 0);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+
+ for (i = 0; i < pushers; i++) {
+ thread_arg[i].id = i;
+ thread_arg[i].pushers = pushers;
+ thread_arg[i].queue = queue;
+ thread_arg[i].ticks1 = &push_ticks[TEST1_ELEMENT_COUNT * i];
+ thread_arg[i].ticks2 = &pop_ticks[TEST1_ELEMENT_COUNT * i];
+ ret =
+ pthread_create(&threads[i], NULL, test1_thread,
+ &thread_arg[i]);
+ MARS_TEST_ASSERT_EQUAL(ret, 0);
+ }
+
+ for (i = 0; i < pushers; i++) {
+ ret = pthread_join(threads[i], NULL);
+ MARS_TEST_ASSERT_EQUAL(ret, 0);
+ }
+
+ ret = mars_task_wait(&task_id, NULL);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+
+ ret = mars_task_destroy(&task_id);
+ 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_ctx);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+
+ size = TEST1_ELEMENT_COUNT * pushers;
+ mars_test_print_statistics(push_ticks, size, "push");
+ mars_test_print_statistics(pop_ticks, size, "pop");
+
+ free(threads);
+ free(pop_ticks);
+ free(push_ticks);
+}
+
+#ifndef QUEUE_INTERMEDIATE
+
+void *test2_thread(void *arg)
+{
+ int i, ret;
+ int32_t host_ticks, mpu_ticks;
+ struct thread_arg_st *thread_arg = arg;
+ int32_t *push_ticks = thread_arg->ticks1;
+ char buf[ELEMENT_SIZE];
+
+ for (i = 0; i < TEST2_ELEMENT_COUNT; i++) {
+
+ /*stagger pushes to give mpu time to block on pop*/
+ mars_test_counter_wait(&sender_to_receiver,
+ (i * thread_arg->pushers +
+ thread_arg->id) * 2);
+ mars_test_counter_set(&receiver_to_sender,
+ (i * thread_arg->pushers +
+ thread_arg->id) * 2);
+
+#ifdef QUEUE_FULL
+ usleep(5000); /*block on push*/
+ host_ticks = mars_task_get_ticks(); /*start ticks*/
+#endif
+ ret = mars_task_queue_pop(thread_arg->queue, buf);
+#ifdef QUEUE_EMPTY
+ host_ticks = mars_task_get_ticks(); /*end ticks*/
+#endif
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+
+ mars_test_counter_wait(&sender_to_receiver,
+ (i * thread_arg->pushers +
+ thread_arg->id) * 2 + 1);
+ mars_test_counter_set(&receiver_to_sender,
+ (i * thread_arg->pushers +
+ thread_arg->id) * 2 + 1);
+
+ mpu_ticks = shared_resource;
+
+#ifdef QUEUE_FULL
+ push_ticks[i] = mpu_ticks - host_ticks; /*end - start*/
+#endif
+#ifdef QUEUE_EMPTY
+ push_ticks[i] = host_ticks - mpu_ticks; /*end -start*/
+#endif
+ }
+ return NULL;
+}
+
+void test2(uint32_t pushers)
+{
+ int ret, i;
+ size_t size;
+ int32_t *ticks;
+
+ struct thread_arg_st thread_arg[pushers];
+ static __thread struct test_task_args_st args ALIGN128;
+ struct mars_context *mars_ctx;
+ struct mars_task_id task_id;
+ struct mars_task_args task_args;
+ uint64_t queue;
+ pthread_t *threads;
+
+ threads = (pthread_t *) malloc(sizeof(pthread_t) * pushers);
+ MARS_TEST_ASSERT(threads != NULL);
+
+ size = sizeof(uint32_t) * TEST1_ELEMENT_COUNT * pushers;
+ ticks = (int32_t *) malloc(size);
+ MARS_TEST_ASSERT(ticks != NULL);
+
+ ret = mars_test_get_timebase_freq(&args.tb_freq);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+
+ ret = mars_context_create(&mars_ctx, 0, 1);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+
+ ret = mars_task_queue_create(mars_ctx, &queue, ELEMENT_SIZE, QUEUE_DEPTH,
+ MARS_TASK_QUEUE_MPU_TO_HOST);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+
+ ret = mars_task_create(mars_ctx, &task_id, NULL, mpu2_prog.elf_image,
+ MARS_TASK_CONTEXT_SAVE_SIZE_MAX);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+
+ args.queue_ea = queue;
+ args.pushers_ea = mars_ptr_to_ea(&pushers);
+ args.shared_resource_ea = mars_ptr_to_ea(&shared_resource);
+ args.sender_to_receiver_ea = mars_ptr_to_ea(&sender_to_receiver);
+ args.receiver_to_sender_ea = mars_ptr_to_ea(&receiver_to_sender);
+ task_args.type.u64[0] = mars_ptr_to_ea(&args);
+
+ ret = mars_task_schedule(&task_id, &task_args, 0);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+
+ for (i = 0; i < pushers; i++) {
+ thread_arg[i].id = i;
+ thread_arg[i].pushers = pushers;
+ thread_arg[i].queue = queue;
+ thread_arg[i].ticks1 = &ticks[TEST2_ELEMENT_COUNT * i];
+ ret =
+ pthread_create(&threads[i], NULL, test2_thread,
+ &thread_arg[i]);
+ MARS_TEST_ASSERT_EQUAL(ret, 0);
+ }
+
+ for (i = 0; i < pushers; i++) {
+ ret = pthread_join(threads[i], NULL);
+ MARS_TEST_ASSERT_EQUAL(ret, 0);
+ }
+
+ ret = mars_task_wait(&task_id, NULL);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+
+ ret = mars_task_destroy(&task_id);
+ 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_ctx);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+
+ size = TEST1_ELEMENT_COUNT * pushers;
+#ifdef QUEUE_EMPTY
+ mars_test_print_statistics(ticks, TEST2_ELEMENT_COUNT * pushers,
+ "beginning of push - end of pop");
+#endif
+#ifdef QUEUE_FULL
+ mars_test_print_statistics(ticks, TEST2_ELEMENT_COUNT * pushers,
+ "beginning of pop - end of push");
+#endif
+
+ free(threads);
+ free(ticks);
+}
+
+void *test3_thread(void *arg)
+{
+ int i, ret;
+ int32_t host_ticks, mpu_ticks;
+ struct thread_arg_st *thread_arg = arg;
+ int32_t *push_ticks = thread_arg->ticks1;
+ char buf[ELEMENT_SIZE];
+
+ for (i = 0; i < TEST1_ELEMENT_COUNT; i++) {
+
+ /*stagger pushes to give mpu time to block on pop*/
+ mars_test_counter_wait(&sender_to_receiver,
+ (i * thread_arg->pushers +
+ thread_arg->id) * 2);
+ mars_test_counter_set(&receiver_to_sender,
+ (i * thread_arg->pushers +
+ thread_arg->id) * 2);
+
+#ifdef QUEUE_FULL
+ usleep(5000);
+#endif
+
+ ret = mars_task_queue_pop(thread_arg->queue, buf);
+ host_ticks = mars_task_get_ticks(); /*end ticks for empty, but start ticks for full*/
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+
+ mars_test_counter_wait(&sender_to_receiver,
+ (i * thread_arg->pushers +
+ thread_arg->id) * 2 + 1);
+ mars_test_counter_set(&receiver_to_sender,
+ (i * thread_arg->pushers +
+ thread_arg->id) * 2 + 1);
+
+ mpu_ticks = shared_resource;
+
+#ifdef QUEUE_FULL
+ push_ticks[i] = mpu_ticks - host_ticks;
+#endif
+#ifdef QUEUE_EMPTY
+ push_ticks[i] = host_ticks - mpu_ticks;
+#endif
+ }
+ return NULL;
+}
+
+void test3(uint32_t pushers)
+{
+ int ret, i;
+ size_t size;
+ int32_t *ticks;
+
+ struct thread_arg_st thread_arg[pushers];
+ static __thread struct test_task_args_st args ALIGN128;
+ struct mars_context *mars_ctx;
+ struct mars_task_id task_id;
+ struct mars_task_args task_args;
+ uint64_t queue;
+ pthread_t *threads;
+
+ threads = (pthread_t *) malloc(sizeof(pthread_t) * pushers);
+ MARS_TEST_ASSERT(threads != NULL);
+
+ size = sizeof(uint32_t) * TEST1_ELEMENT_COUNT * pushers;
+ ticks = (int32_t *) malloc(size);
+ MARS_TEST_ASSERT(ticks != NULL);
+
+ ret = mars_test_get_timebase_freq(&args.tb_freq);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+
+ ret = mars_context_create(&mars_ctx, 0, 1);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+
+ ret = mars_task_queue_create(mars_ctx, &queue, ELEMENT_SIZE, QUEUE_DEPTH,
+ MARS_TASK_QUEUE_MPU_TO_HOST);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+
+ ret = mars_task_create(mars_ctx, &task_id, NULL, mpu3_prog.elf_image,
+ MARS_TASK_CONTEXT_SAVE_SIZE_MAX);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+
+ args.queue_ea = queue;
+ args.pushers_ea = mars_ptr_to_ea(&pushers);
+ args.shared_resource_ea = mars_ptr_to_ea(&shared_resource);
+ args.sender_to_receiver_ea = mars_ptr_to_ea(&sender_to_receiver);
+ args.receiver_to_sender_ea = mars_ptr_to_ea(&receiver_to_sender);
+ task_args.type.u64[0] = mars_ptr_to_ea(&args);
+
+ ret = mars_task_schedule(&task_id, &task_args, 0);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+
+ for (i = 0; i < pushers; i++) {
+ thread_arg[i].id = i;
+ thread_arg[i].pushers = pushers;
+ thread_arg[i].queue = queue;
+ thread_arg[i].ticks1 = &ticks[TEST3_ELEMENT_COUNT * i];
+ ret =
+ pthread_create(&threads[i], NULL, test3_thread,
+ &thread_arg[i]);
+ MARS_TEST_ASSERT_EQUAL(ret, 0);
+ }
+
+ for (i = 0; i < pushers; i++) {
+ ret = pthread_join(threads[i], NULL);
+ MARS_TEST_ASSERT_EQUAL(ret, 0);
+ }
+
+ ret = mars_task_wait(&task_id, NULL);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+
+ ret = mars_task_destroy(&task_id);
+ 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_ctx);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+
+ size = TEST1_ELEMENT_COUNT * pushers;
+#ifdef QUEUE_EMPTY
+ mars_test_print_statistics(ticks, TEST3_ELEMENT_COUNT * pushers,
+ "end of push - end of pop");
+#endif
+#ifdef QUEUE_FULL
+ mars_test_print_statistics(ticks, TEST3_ELEMENT_COUNT * pushers,
+ "end of pop - end of push");
+#endif
+
+ free(threads);
+ free(ticks);
+}
+#endif
+
+int main(int argc, char *argv[])
+{
+ uint32_t pushers = 6;
+
+ test1(pushers);
+#ifndef QUEUE_INTERMEDIATE
+ test2(pushers);
+ test3(pushers);
+#endif
+
+ return 0;
+}
diff --git a/tests/TPF/TPF_40_031/mpu1.c b/tests/TPF/TPF_40_031/mpu1.c
new file mode 100644
index 0000000..061c53a
--- /dev/null
+++ b/tests/TPF/TPF_40_031/mpu1.c
@@ -0,0 +1,72 @@
+/*
+ * Copyright 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/task.h>
+#include <mars_test.h>
+#include <common.h>
+
+int mars_task_main(const struct mars_task_args *task_args)
+{
+ int ret, i, j;
+ uint32_t start, end, pushers;
+ char buf[ELEMENT_SIZE];
+ static struct test_task_args_st args ALIGN128;
+
+ mfc_get(&args, task_args->type.u64[0], sizeof(struct test_task_args_st),
+ 0, 0, 0);
+ mfc_write_tag_mask(1);
+ mfc_read_tag_status_all();
+
+ pushers = mars_test_int32_get(args.pushers_ea);
+
+ for (i = 0; i < QUEUE_PREFILL; i++) {
+ ret = mars_task_queue_push(args.queue_ea, buf);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+ }
+
+ for (i = 0; i < TEST1_ELEMENT_COUNT; i++) {
+ for (j = 0; j < pushers; j++) {
+
+ mars_test_counter_set(args.sender_to_receiver_ea,
+ (i * pushers + j) * 2);
+ mars_test_counter_wait(args.receiver_to_sender_ea,
+ (i * pushers + j) * 2);
+
+ start = mars_task_get_ticks();
+ ret = mars_task_queue_push(args.queue_ea, buf);
+ end = mars_task_get_ticks();
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+
+ mars_test_int32_put(args.shared_resource_ea,
+ end - start);
+
+ mars_test_counter_set(args.sender_to_receiver_ea,
+ (i * pushers + j) * 2 + 1);
+ mars_test_counter_wait(args.receiver_to_sender_ea,
+ (i * pushers + j) * 2 + 1);
+ }
+ }
+
+ return 0;
+}
diff --git a/tests/TPF/TPF_40_031/mpu2.c b/tests/TPF/TPF_40_031/mpu2.c
new file mode 100644
index 0000000..65d5cba
--- /dev/null
+++ b/tests/TPF/TPF_40_031/mpu2.c
@@ -0,0 +1,77 @@
+/*
+ * Copyright 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/task.h>
+#include <mars_test.h>
+#include <common.h>
+
+int mars_task_main(const struct mars_task_args *task_args)
+{
+ int ret, i, j;
+ int32_t mpu_ticks = 0;
+ int32_t pushers;
+ char buf[ELEMENT_SIZE];
+ static struct test_task_args_st args ALIGN128;
+
+ mfc_get(&args, task_args->type.u64[0], sizeof(struct test_task_args_st),
+ 0, 0, 0);
+ mfc_write_tag_mask(1);
+ mfc_read_tag_status_all();
+
+ pushers = mars_test_int32_get(args.pushers_ea);
+
+ for (i = 0; i < QUEUE_PREFILL; i++) {
+ ret = mars_task_queue_push(args.queue_ea, buf);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+ }
+
+ for (i = 0; i < TEST1_ELEMENT_COUNT; i++) {
+ for (j = 0; j < pushers; j++) {
+
+ mars_test_counter_set(args.sender_to_receiver_ea,
+ (i * pushers + j) * 2);
+ mars_test_counter_wait(args.receiver_to_sender_ea,
+ (i * pushers + j) * 2);
+
+#ifdef QUEUE_EMPTY
+ mars_test_usleep(args.tb_freq, DELAY);
+ mpu_ticks = mars_task_get_ticks(); /*this is the start time*/
+#endif
+ ret = mars_task_queue_push(args.queue_ea, buf);
+#ifdef QUEUE_FULL
+ mpu_ticks = mars_task_get_ticks(); /*this is the end time*/
+#endif
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+
+ mars_test_int32_put(args.shared_resource_ea, mpu_ticks);
+
+ mars_test_counter_set(args.sender_to_receiver_ea,
+ (i * pushers + j) * 2 + 1);
+ mars_test_counter_wait(args.receiver_to_sender_ea,
+ (i * pushers + j) * 2 + 1);
+
+ }
+ }
+ return 0;
+}
diff --git a/tests/TPF/TPF_40_031/mpu3.c b/tests/TPF/TPF_40_031/mpu3.c
new file mode 100644
index 0000000..bbce8cb
--- /dev/null
+++ b/tests/TPF/TPF_40_031/mpu3.c
@@ -0,0 +1,75 @@
+/*
+ * Copyright 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/task.h>
+#include <mars_test.h>
+#include <common.h>
+
+int mars_task_main(const struct mars_task_args *task_args)
+{
+ int ret, i, j;
+ int32_t pushers;
+ int32_t mpu_ticks = 0;
+ char buf[ELEMENT_SIZE];
+ static struct test_task_args_st args ALIGN128;
+
+ mfc_get(&args, task_args->type.u64[0], sizeof(struct test_task_args_st),
+ 0, 0, 0);
+ mfc_write_tag_mask(1);
+ mfc_read_tag_status_all();
+
+ pushers = mars_test_int32_get(args.pushers_ea);
+
+ for (i = 0; i < QUEUE_PREFILL; i++) {
+ ret = mars_task_queue_push(args.queue_ea, buf);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+ }
+
+ for (i = 0; i < TEST1_ELEMENT_COUNT; i++) {
+ for (j = 0; j < pushers; j++) {
+
+ mars_test_counter_set(args.sender_to_receiver_ea,
+ (i * pushers + j) * 2);
+ mars_test_counter_wait(args.receiver_to_sender_ea,
+ (i * pushers + j) * 2);
+
+#ifdef QUEUE_EMPTY
+ mars_test_usleep(args.tb_freq, DELAY);
+ mpu_ticks = mars_task_get_ticks(); /*start ticks*/
+#endif
+ ret = mars_task_queue_push(args.queue_ea, buf);
+#ifdef QUEUE_FULL
+ mpu_ticks = mars_task_get_ticks(); /*end ticks*/
+#endif
+ mars_test_int32_put(args.shared_resource_ea, mpu_ticks);
+
+ mars_test_counter_set(args.sender_to_receiver_ea,
+ (i * pushers + j) * 2 + 1);
+ mars_test_counter_wait(args.receiver_to_sender_ea,
+ (i * pushers + j) * 2 + 1);
+
+ }
+ }
+ return 0;
+}
diff --git a/tests/TPF/TPF_40_032/Makefile b/tests/TPF/TPF_40_032/Makefile
new file mode 100644
index 0000000..fe85af5
--- /dev/null
+++ b/tests/TPF/TPF_40_032/Makefile
@@ -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.
+#
+
+EXTRA_LDFLAGS=-lm
+INCLUDE_CFLAGS+= -I./
+MPU_INCLUDE_CFLAGS+= -I./
+
+
+top_srcdir = ../..
+test_objs = host.o mpu1.task_eo mpu2.task_eo mpu3.task_eo
+timeout = 120
+
+include $(top_srcdir)/scripts/config.mk
+include $(top_srcdir)/scripts/rules_item.mk
+include $(top_srcdir)/scripts/rules_tpf.mk
+
+host.o: common.h
+mpu1.task_o: common.h
+mpu2.task_o: common.h
+mpu3.task_o: common.h
diff --git a/tests/TPF/TPF_40_032/common.h b/tests/TPF/TPF_40_032/common.h
new file mode 100644
index 0000000..ce74d5c
--- /dev/null
+++ b/tests/TPF/TPF_40_032/common.h
@@ -0,0 +1,48 @@
+/*
+ * Copyright 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/task.h>
+#include <mars_test.h>
+
+#define QUEUE_FULL
+#define QUEUE_PREFILL 64
+
+#define QUEUE_DEPTH 64
+#define ELEMENT_SIZE 128
+#define TEST1_ELEMENT_COUNT 512
+#define TEST2_ELEMENT_COUNT 512
+#define TEST3_ELEMENT_COUNT 512
+
+#define ALIGN128 __attribute__((aligned(128)))
+
+struct test_task_args_st {
+ uint64_t queue_ea;
+ uint64_t sender_to_receiver_ea;
+ uint64_t receiver_to_sender_ea;
+ uint64_t shared_resource_ea;
+ uint64_t ticks1_ea;
+ uint64_t ticks2_ea;
+ uint32_t tb_freq;
+ uint32_t pushers_ea;
+ uint8_t pad[8];
+};
diff --git a/tests/TPF/TPF_40_032/host.c b/tests/TPF/TPF_40_032/host.c
new file mode 100644
index 0000000..c13d692
--- /dev/null
+++ b/tests/TPF/TPF_40_032/host.c
@@ -0,0 +1,24 @@
+/*
+ * Copyright 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 "../TPF_40_031/host.c"
diff --git a/tests/TPF/TPF_40_032/mpu1.c b/tests/TPF/TPF_40_032/mpu1.c
new file mode 100644
index 0000000..7cff00d
--- /dev/null
+++ b/tests/TPF/TPF_40_032/mpu1.c
@@ -0,0 +1,24 @@
+/*
+ * Copyright 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 "../TPF_40_031/mpu1.c"
diff --git a/tests/TPF/TPF_40_032/mpu2.c b/tests/TPF/TPF_40_032/mpu2.c
new file mode 100644
index 0000000..f62b56f
--- /dev/null
+++ b/tests/TPF/TPF_40_032/mpu2.c
@@ -0,0 +1,24 @@
+/*
+ * Copyright 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 "../TPF_40_031/mpu2.c"
diff --git a/tests/TPF/TPF_40_032/mpu3.c b/tests/TPF/TPF_40_032/mpu3.c
new file mode 100644
index 0000000..5640480
--- /dev/null
+++ b/tests/TPF/TPF_40_032/mpu3.c
@@ -0,0 +1,24 @@
+/*
+ * Copyright 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 "../TPF_40_031/mpu3.c"
diff --git a/tests/TPF/TPF_40_033/Makefile b/tests/TPF/TPF_40_033/Makefile
new file mode 100644
index 0000000..fe85af5
--- /dev/null
+++ b/tests/TPF/TPF_40_033/Makefile
@@ -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.
+#
+
+EXTRA_LDFLAGS=-lm
+INCLUDE_CFLAGS+= -I./
+MPU_INCLUDE_CFLAGS+= -I./
+
+
+top_srcdir = ../..
+test_objs = host.o mpu1.task_eo mpu2.task_eo mpu3.task_eo
+timeout = 120
+
+include $(top_srcdir)/scripts/config.mk
+include $(top_srcdir)/scripts/rules_item.mk
+include $(top_srcdir)/scripts/rules_tpf.mk
+
+host.o: common.h
+mpu1.task_o: common.h
+mpu2.task_o: common.h
+mpu3.task_o: common.h
diff --git a/tests/TPF/TPF_40_033/common.h b/tests/TPF/TPF_40_033/common.h
new file mode 100644
index 0000000..2b22cb6
--- /dev/null
+++ b/tests/TPF/TPF_40_033/common.h
@@ -0,0 +1,48 @@
+/*
+ * Copyright 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/task.h>
+#include <mars_test.h>
+
+#define QUEUE_INTERMEDIATE
+#define QUEUE_PREFILL 32
+
+#define QUEUE_DEPTH 64
+#define ELEMENT_SIZE 128
+#define TEST1_ELEMENT_COUNT 512
+#define TEST2_ELEMENT_COUNT 512
+#define TEST3_ELEMENT_COUNT 512
+
+#define ALIGN128 __attribute__((aligned(128)))
+
+struct test_task_args_st {
+ uint64_t queue_ea;
+ uint64_t sender_to_receiver_ea;
+ uint64_t receiver_to_sender_ea;
+ uint64_t shared_resource_ea;
+ uint64_t ticks1_ea;
+ uint64_t ticks2_ea;
+ uint32_t tb_freq;
+ uint32_t pushers_ea;
+ uint8_t pad[8];
+};
diff --git a/tests/TPF/TPF_40_033/host.c b/tests/TPF/TPF_40_033/host.c
new file mode 100644
index 0000000..c13d692
--- /dev/null
+++ b/tests/TPF/TPF_40_033/host.c
@@ -0,0 +1,24 @@
+/*
+ * Copyright 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 "../TPF_40_031/host.c"
diff --git a/tests/TPF/TPF_40_033/mpu1.c b/tests/TPF/TPF_40_033/mpu1.c
new file mode 100644
index 0000000..7cff00d
--- /dev/null
+++ b/tests/TPF/TPF_40_033/mpu1.c
@@ -0,0 +1,24 @@
+/*
+ * Copyright 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 "../TPF_40_031/mpu1.c"
diff --git a/tests/TPF/TPF_40_033/mpu2.c b/tests/TPF/TPF_40_033/mpu2.c
new file mode 100644
index 0000000..f62b56f
--- /dev/null
+++ b/tests/TPF/TPF_40_033/mpu2.c
@@ -0,0 +1,24 @@
+/*
+ * Copyright 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 "../TPF_40_031/mpu2.c"
diff --git a/tests/TPF/TPF_40_033/mpu3.c b/tests/TPF/TPF_40_033/mpu3.c
new file mode 100644
index 0000000..5640480
--- /dev/null
+++ b/tests/TPF/TPF_40_033/mpu3.c
@@ -0,0 +1,24 @@
+/*
+ * Copyright 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 "../TPF_40_031/mpu3.c"
diff --git a/tests/TPF/TPF_40_034/Makefile b/tests/TPF/TPF_40_034/Makefile
new file mode 100644
index 0000000..1498fa4
--- /dev/null
+++ b/tests/TPF/TPF_40_034/Makefile
@@ -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.
+#
+#DEFS_CFLAGS+=-DQUEUE_EMPTY
+EXTRA_LDFLAGS=-lm
+INCLUDE_CFLAGS+= -I./
+MPU_INCLUDE_CFLAGS+= -I./
+
+top_srcdir = ../..
+test_objs = host.o mpu1.task_eo mpu2.task_eo mpu3.task_eo \
+ mpu4.task_eo mpu5.task_eo mpu6.task_eo
+timeout = 120
+
+include $(top_srcdir)/scripts/config.mk
+include $(top_srcdir)/scripts/rules_item.mk
+include $(top_srcdir)/scripts/rules_tpf.mk
+
+host.o: common.h
+mpu1.task_o: common.h
+mpu2.task_o: common.h
+mpu3.task_o: common.h
+mpu4.task_o: common.h
+mpu5.task_o: common.h
+mpu6.task_o: common.h
+
+
+
diff --git a/tests/TPF/TPF_40_034/common.h b/tests/TPF/TPF_40_034/common.h
new file mode 100644
index 0000000..f2e2b28
--- /dev/null
+++ b/tests/TPF/TPF_40_034/common.h
@@ -0,0 +1,58 @@
+/*
+ * Copyright 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.
+ */
+
+
+#ifndef TEST_COMMON_H
+#define TEST_COMMON_H
+
+#include <mars/task.h>
+#include <mars_test.h>
+
+#define MAX_RECEIVERS 4
+#define QUEUE_DEPTH 64
+
+#define QUEUE_PRE_CONDITION 0
+#define QUEUE_EMPTY
+
+#define ELEMENT_SIZE 128
+#define TEST1_ELEMENT_COUNT 400
+#define TEST2_ELEMENT_COUNT 400
+#define TEST3_ELEMENT_COUNT 400
+
+#define ALIGN128 __attribute__((aligned(128)))
+
+struct test_task_args_st {
+ uint64_t queue_ea;
+ uint64_t sender_to_receiver_ea;
+ uint64_t receivers_to_sender_ea[MAX_RECEIVERS];
+ uint64_t shared_resources_ea[MAX_RECEIVERS];
+ uint64_t ticks1_ea;
+ uint64_t ticks2_ea;
+ uint64_t barrier1_ea;
+ uint64_t barrier2_ea;
+ uint32_t tb_freq;
+ uint32_t receivers;
+ uint32_t mpu_run;
+ uint8_t pad[4];
+};
+#endif
diff --git a/tests/TPF/TPF_40_034/host.c b/tests/TPF/TPF_40_034/host.c
new file mode 100644
index 0000000..aeec922
--- /dev/null
+++ b/tests/TPF/TPF_40_034/host.c
@@ -0,0 +1,405 @@
+/*
+ * Copyright 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/task.h>
+#include <mars_test.h>
+#include <common.h>
+
+extern spe_program_handle_t mpu1_prog, mpu2_prog, mpu3_prog;
+extern spe_program_handle_t mpu4_prog, mpu5_prog, mpu6_prog;
+
+/*
+ * This test times the execution time of mars_task_queue_push() and
+ * mars_task_queue_pop() separately using mpu1.c and mpu2.c.
+ */
+
+uint32_t aligned_num(uint32_t num, uint32_t aligned)
+{
+ return num + (aligned - num % aligned);
+}
+
+void test1(uint32_t receivers)
+{
+ int ret;
+ int32_t *push_ticks;
+ int32_t *pop_ticks;
+ struct mars_context *mars_ctx;
+ struct mars_task_id sender_task_id, receiver_task_id[receivers];
+ struct mars_task_args task_args;
+ uint64_t queue;
+ uint64_t barrier1;
+ uint64_t barrier2;
+
+ uint32_t shared_resources[receivers] ALIGN128;
+ char name[128];
+
+ static struct test_task_args_st args ALIGN128;
+
+ uint32_t i, size;
+
+ size =
+ aligned_num(TEST1_ELEMENT_COUNT * receivers,
+ 128) * sizeof(uint32_t);
+ ret = posix_memalign((void **)&push_ticks, 128, size);
+ MARS_TEST_ASSERT_EQUAL(ret, 0);
+ ret = posix_memalign((void **)&pop_ticks, 128, size);
+ MARS_TEST_ASSERT_EQUAL(ret, 0);
+
+ ret = mars_test_get_timebase_freq(&args.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_queue_create(mars_ctx, &queue, ELEMENT_SIZE, QUEUE_DEPTH,
+ MARS_TASK_QUEUE_MPU_TO_MPU);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+
+ sprintf(name, "%d", 0);
+ ret = mars_task_create(mars_ctx, &sender_task_id, name,
+ mpu1_prog.elf_image, MARS_TASK_CONTEXT_SAVE_SIZE_MAX);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+
+ ret = mars_task_barrier_create(mars_ctx, &barrier1, receivers + 1);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+
+ ret = mars_task_barrier_create(mars_ctx, &barrier2, receivers + 1);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+
+ for (i = 0; i < receivers; i++) {
+ sprintf(name, "%d", i);
+ ret = mars_task_create(mars_ctx, &receiver_task_id[i], name,
+ mpu2_prog.elf_image,
+ MARS_TASK_CONTEXT_SAVE_SIZE_MAX);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+ }
+
+ for (i = 0; i < receivers; i++) {
+ shared_resources[i] = 0;
+ args.shared_resources_ea[i] =
+ mars_ptr_to_ea(&shared_resources[i]);
+ }
+
+ args.queue_ea = queue;
+ args.barrier1_ea = barrier1;
+ args.barrier2_ea = barrier2;
+ args.ticks1_ea = mars_ptr_to_ea(push_ticks);
+ args.ticks2_ea = mars_ptr_to_ea(pop_ticks);
+ args.receivers = mars_ptr_to_ea(&receivers);
+
+ task_args.type.u64[0] = mars_ptr_to_ea(&args);
+ ret = mars_task_schedule(&sender_task_id, &task_args, 255);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+
+ for (i = 0; i < receivers; i++) {
+ ret =
+ mars_task_schedule(&receiver_task_id[i], &task_args,
+ receivers - i);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+ }
+
+ ret = mars_task_wait(&sender_task_id, NULL);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+
+ for (i = 0; i < receivers; i++) {
+ ret = mars_task_wait(&receiver_task_id[i], NULL);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+ }
+
+ ret = mars_task_destroy(&sender_task_id);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+
+ for (i = 0; i < receivers; i++) {
+ ret = mars_task_destroy(&receiver_task_id[i]);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+ }
+
+ ret = mars_task_barrier_destroy(barrier1);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+
+ ret = mars_task_barrier_destroy(barrier2);
+ 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_ctx);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+
+ mars_test_print_statistics(push_ticks, TEST1_ELEMENT_COUNT * receivers,
+ "push");
+ mars_test_print_statistics(pop_ticks, TEST1_ELEMENT_COUNT * receivers,
+ "pop");
+
+ free(push_ticks);
+ free(pop_ticks);
+}
+
+#ifndef QUEUE_INTERMEDIATE
+
+void test2(uint32_t receivers)
+{
+ int ret;
+ int32_t *ticks;
+ struct mars_context *mars_ctx;
+ struct mars_task_id sender_task_id, receiver_task_id[receivers];
+ struct mars_task_args task_args;
+ uint64_t queue;
+ uint64_t barrier1;
+ uint64_t barrier2;
+ char name[128];
+
+ uint32_t shared_resources[receivers] ALIGN128;
+
+ static struct test_task_args_st args ALIGN128;
+
+ uint32_t i, size;
+ uint32_t mpu_run;
+
+ size = aligned_num(TEST1_ELEMENT_COUNT * receivers,
+ 128) * sizeof(uint32_t);
+ ret = posix_memalign((void **)&ticks, 128, size);
+ MARS_TEST_ASSERT_EQUAL(ret, 0);
+
+ ret = mars_test_get_timebase_freq(&args.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_queue_create(mars_ctx, &queue, ELEMENT_SIZE, QUEUE_DEPTH,
+ MARS_TASK_QUEUE_MPU_TO_MPU);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+ sprintf(name, "%d", 255);
+ ret = mars_task_create(mars_ctx, &sender_task_id, name,
+ mpu3_prog.elf_image, MARS_TASK_CONTEXT_SAVE_SIZE_MAX);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+
+ ret = mars_task_barrier_create(mars_ctx, &barrier1, receivers + 1);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+
+ ret = mars_task_barrier_create(mars_ctx, &barrier2, receivers + 1);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+
+ for (i = 0; i < receivers; i++) {
+ sprintf(name, "%02d", i);
+ ret = mars_task_create(mars_ctx, &receiver_task_id[i], name,
+ mpu4_prog.elf_image,
+ MARS_TASK_CONTEXT_SAVE_SIZE_MAX);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+ }
+
+ args.queue_ea = queue;
+ args.barrier1_ea = barrier1;
+ args.barrier2_ea = barrier2;
+ args.ticks1_ea = mars_ptr_to_ea(ticks);
+ args.receivers = mars_ptr_to_ea(&receivers);
+ args.mpu_run = mars_ptr_to_ea(&mpu_run);
+ task_args.type.u64[0] = mars_ptr_to_ea(&args);
+
+ for (i = 0; i < receivers; i++) {
+ shared_resources[i] = 0;
+ }
+
+ for (i = 0; i < receivers; i++) {
+ args.shared_resources_ea[i] =
+ mars_ptr_to_ea(&shared_resources[i]);
+ }
+
+ ret = mars_task_schedule(&sender_task_id, &task_args, 255);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+
+ for (i = 0; i < receivers; i++) {
+ ret = mars_task_schedule(&receiver_task_id[i], &task_args, 0);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+ }
+
+ ret = mars_task_wait(&sender_task_id, NULL);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+
+ for (i = 0; i < receivers; i++) {
+ ret = mars_task_wait(&receiver_task_id[i], NULL);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+ }
+
+ ret = mars_task_destroy(&sender_task_id);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+
+ for (i = 0; i < receivers; i++) {
+ ret = mars_task_destroy(&receiver_task_id[i]);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+ }
+
+ ret = mars_task_barrier_destroy(barrier1);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+
+ ret = mars_task_barrier_destroy(barrier2);
+ 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_ctx);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+#ifdef QUEUE_EMPTY
+ mars_test_print_statistics(ticks, TEST2_ELEMENT_COUNT * receivers,
+ "beginning of push - end of pop");
+#endif
+#ifdef QUEUE_FULL
+ mars_test_print_statistics(ticks, TEST2_ELEMENT_COUNT * receivers,
+ "beginning of pop - end of push");
+#endif
+ free(ticks);
+}
+
+void test3(uint32_t receivers)
+{
+ int ret;
+ int32_t *ticks;
+ struct mars_context *mars_ctx;
+ struct mars_task_id sender_task_id, receiver_task_id[receivers];
+ struct mars_task_args task_args;
+ uint64_t queue;
+ uint64_t barrier1;
+ uint64_t barrier2;
+ char name[128];
+
+ uint32_t shared_resources[receivers] ALIGN128;
+
+ static struct test_task_args_st args ALIGN128;
+
+ uint32_t i, size;
+ uint32_t mpu_run;
+
+ size =
+ aligned_num(TEST1_ELEMENT_COUNT * receivers,
+ 128) * sizeof(uint32_t);
+ ret = posix_memalign((void **)&ticks, 128, size);
+ MARS_TEST_ASSERT_EQUAL(ret, 0);
+
+ ret = mars_test_get_timebase_freq(&args.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_queue_create(mars_ctx, &queue, ELEMENT_SIZE, QUEUE_DEPTH,
+ MARS_TASK_QUEUE_MPU_TO_MPU);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+ sprintf(name, "%d", 254);
+ ret = mars_task_create(mars_ctx, &sender_task_id, name,
+ mpu5_prog.elf_image, MARS_TASK_CONTEXT_SAVE_SIZE_MAX);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+
+ ret = mars_task_barrier_create(mars_ctx, &barrier1, receivers + 1);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+
+ ret = mars_task_barrier_create(mars_ctx, &barrier2, receivers + 1);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+
+ for (i = 0; i < receivers; i++) {
+ sprintf(name, "%02d", i);
+ ret = mars_task_create(mars_ctx, &receiver_task_id[i], name,
+ mpu6_prog.elf_image,
+ MARS_TASK_CONTEXT_SAVE_SIZE_MAX);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+ }
+
+ args.queue_ea = queue;
+ args.barrier1_ea = barrier1;
+ args.barrier2_ea = barrier2;
+ args.ticks1_ea = mars_ptr_to_ea(ticks);
+ args.receivers = mars_ptr_to_ea(&receivers);
+ args.mpu_run = mars_ptr_to_ea(&mpu_run);
+ task_args.type.u64[0] = mars_ptr_to_ea(&args);
+
+ for (i = 0; i < receivers; i++) {
+ shared_resources[i] = 0;
+ args.shared_resources_ea[i] =
+ mars_ptr_to_ea(&shared_resources[i]);
+ }
+
+ ret = mars_task_schedule(&sender_task_id, &task_args, 255);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+
+ for (i = 0; i < receivers; i++) {
+ ret = mars_task_schedule(&receiver_task_id[i], &task_args, 0);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+ }
+
+ ret = mars_task_wait(&sender_task_id, NULL);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+
+ for (i = 0; i < receivers; i++) {
+ ret = mars_task_wait(&receiver_task_id[i], NULL);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+ }
+
+ ret = mars_task_destroy(&sender_task_id);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+
+ for (i = 0; i < receivers; i++) {
+ ret = mars_task_destroy(&receiver_task_id[i]);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+ }
+
+ ret = mars_task_barrier_destroy(barrier1);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+
+ ret = mars_task_barrier_destroy(barrier2);
+ 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_ctx);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+
+#ifdef QUEUE_EMPTY
+ mars_test_print_statistics(ticks, TEST3_ELEMENT_COUNT * receivers,
+ "end of push - end of pop");
+#endif
+#ifdef QUEUE_FULL
+ mars_test_print_statistics(ticks, TEST3_ELEMENT_COUNT * receivers,
+ "end of pop - end of push");
+#endif
+ free(ticks);
+
+}
+#endif
+
+int main(int argc, char *argv[])
+{
+ MARS_TEST_PERF_INIT();
+ int i;
+ for (i = MAX_RECEIVERS; i <= MAX_RECEIVERS; i++) {
+ test1(i);
+#ifndef QUEUE_INTERMEDIATE
+ test2(i);
+ test3(i);
+#endif
+ }
+
+ return 0;
+}
diff --git a/tests/TPF/TPF_40_034/mpu1.c b/tests/TPF/TPF_40_034/mpu1.c
new file mode 100644
index 0000000..ebdffe7
--- /dev/null
+++ b/tests/TPF/TPF_40_034/mpu1.c
@@ -0,0 +1,107 @@
+/*
+ * Copyright 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 <malloc.h>
+#include <mars/task.h>
+#include <mars_test.h>
+#include <common.h>
+
+uint32_t aligned_num(uint32_t num, uint32_t aligned)
+{
+ return num + (aligned - num % aligned);
+}
+
+int mars_task_main(const struct mars_task_args *task_args)
+{
+ int ret, i, j;
+ uint32_t start, end;
+ char buf[ELEMENT_SIZE];
+ static struct test_task_args_st args ALIGN128;
+ uint32_t *push_ticks;
+ uint32_t *pop_ticks;
+
+ uint32_t size;
+ uint32_t receivers;
+
+ mfc_get(&args, task_args->type.u64[0], sizeof(struct test_task_args_st),
+ 0, 0, 0);
+ mfc_write_tag_mask(1);
+ mfc_read_tag_status_all();
+ receivers = mars_test_int32_get(args.receivers);
+
+ size =
+ aligned_num(TEST1_ELEMENT_COUNT * receivers,
+ 128) * sizeof(uint32_t);
+ pop_ticks = (uint32_t *) memalign(128, size);
+ push_ticks = (uint32_t *) memalign(128, size);
+ if (!pop_ticks || !push_ticks) {
+ return 1;
+ }
+
+ /*pre-fill queue if required by test scenareo */
+ for (i = 0; i < QUEUE_PRE_CONDITION; i++) {
+ ret = mars_task_queue_push(args.queue_ea, buf);
+ }
+
+ for (i = 0; i < TEST1_ELEMENT_COUNT; i++) {
+
+ mars_test_usleep(args.tb_freq, DELAY);
+
+ /* ensure receivers wait untill sender has finished pushing */
+ ret = mars_task_barrier_notify(args.barrier1_ea);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+ ret = mars_task_barrier_wait(args.barrier1_ea);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+
+ for (j = 0; j < receivers; j++) {
+ start = mars_task_get_ticks();
+ ret = mars_task_queue_push(args.queue_ea, buf);
+ end = mars_task_get_ticks();
+ push_ticks[i * receivers + j] = end - start;
+ }
+
+ /* wait at barrier untill receivers have finished poping */
+ ret = mars_task_barrier_notify(args.barrier2_ea);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+ ret = mars_task_barrier_wait(args.barrier2_ea);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+
+ for (j = 0; j < receivers; j++) {
+ pop_ticks[i * receivers + j] =
+ mars_test_int32_get(args.shared_resources_ea[j]);
+ }
+
+ }
+
+ mfc_put(push_ticks, args.ticks1_ea, size, 0, 0, 0);
+ mfc_write_tag_mask(1);
+ mfc_read_tag_status_all();
+
+ mfc_put(pop_ticks, args.ticks2_ea, size, 0, 0, 0);
+ mfc_write_tag_mask(1);
+ mfc_read_tag_status_all();
+
+ free(pop_ticks);
+ free(push_ticks);
+
+ return 0;
+}
diff --git a/tests/TPF/TPF_40_034/mpu2.c b/tests/TPF/TPF_40_034/mpu2.c
new file mode 100644
index 0000000..5414cb1
--- /dev/null
+++ b/tests/TPF/TPF_40_034/mpu2.c
@@ -0,0 +1,64 @@
+/*
+ * Copyright 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 <malloc.h>
+#include <mars/task.h>
+#include <mars_test.h>
+#include <common.h>
+
+int mars_task_main(const struct mars_task_args *task_args)
+{
+ int ret, i, id;
+ uint32_t start, end;
+ char buf[ELEMENT_SIZE];
+ static struct test_task_args_st args ALIGN128;
+
+ mfc_get(&args, task_args->type.u64[0], sizeof(struct test_task_args_st),
+ 0, 0, 0);
+ mfc_write_tag_mask(1);
+ mfc_read_tag_status_all();
+
+ id = atoi(mars_task_get_name());
+
+ for (i = 0; i < TEST1_ELEMENT_COUNT; i++) {
+
+ /* wait at barrier untill sender has finished pushing */
+ ret = mars_task_barrier_notify(args.barrier1_ea);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+ ret = mars_task_barrier_wait(args.barrier1_ea);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+
+ start = mars_task_get_ticks();
+ ret = mars_task_queue_pop(args.queue_ea, buf);
+ end = mars_task_get_ticks();
+ mars_test_int32_put(args.shared_resources_ea[id], end - start);
+
+ /* wait at barrier untill all receivers have finished poping */
+ ret = mars_task_barrier_notify(args.barrier2_ea);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+ ret = mars_task_barrier_wait(args.barrier2_ea);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+
+ }
+
+ return 0;
+}
diff --git a/tests/TPF/TPF_40_034/mpu3.c b/tests/TPF/TPF_40_034/mpu3.c
new file mode 100644
index 0000000..b823f32
--- /dev/null
+++ b/tests/TPF/TPF_40_034/mpu3.c
@@ -0,0 +1,115 @@
+/*
+ * Copyright 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 <malloc.h>
+#include <mars/task.h>
+#include <mars_test.h>
+#include <common.h>
+
+uint32_t aligned_num(uint32_t num, uint32_t aligned)
+{
+ return num + (aligned - num % aligned);
+}
+
+int mars_task_main(const struct mars_task_args *task_args)
+{
+ int ret, i, j;
+ int32_t receiver_time, size;
+#ifndef QUEUE_INTERMEDIATE
+ int32_t sender_time[MAX_RECEIVERS];
+#endif
+ char buf[ELEMENT_SIZE];
+ static struct test_task_args_st args ALIGN128;
+ uint32_t *ticks;
+ uint32_t receivers;
+
+ mfc_get(&args, task_args->type.u64[0], sizeof(struct test_task_args_st),
+ 0, 0, 0);
+ mfc_write_tag_mask(1);
+ mfc_read_tag_status_all();
+
+ receivers = mars_test_int32_get(args.receivers);
+ size =
+ aligned_num(TEST1_ELEMENT_COUNT * receivers,
+ 128) * sizeof(uint32_t);
+
+ ticks = (uint32_t *) memalign(128, size);
+ if (!ticks) {
+ return 1;
+ }
+
+ /*pre-fill queue if required by test scenareo */
+ for (i = 0; i < QUEUE_PRE_CONDITION; i++) {
+ ret = mars_task_queue_push(args.queue_ea, buf);
+ }
+
+ for (i = 0; i < TEST2_ELEMENT_COUNT; i++) {
+
+ mars_test_int32_put(args.mpu_run, 0);
+
+ /* ensure receivers wait untill sender has finished pushing */
+ ret = mars_task_barrier_notify(args.barrier1_ea);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+ ret = mars_task_barrier_wait(args.barrier1_ea);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+
+#ifdef QUEUE_EMPTY
+ /* wait for the recievers to be blocked on pop */
+ mars_test_usleep(args.tb_freq, 5000);
+#endif
+
+ for (j = 0; j < receivers; j++) {
+#ifdef QUEUE_EMPTY
+ buf[0] = j;
+ sender_time[j] = mars_task_get_ticks(); /*this is the start time*/
+#endif
+ ret = mars_task_queue_push(args.queue_ea, buf);
+#ifdef QUEUE_FULL
+ sender_time[j] = mars_task_get_ticks();
+#endif
+ }
+
+ /* wait at barrier untill receivers have finished poping */
+ ret = mars_task_barrier_notify(args.barrier2_ea);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+ ret = mars_task_barrier_wait(args.barrier2_ea);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+
+ for (j = 0; j < receivers; j++) {
+ receiver_time = mars_test_int32_get(args.shared_resources_ea[j]); /*for QUEUE_EMPTY end time.*/
+#ifdef QUEUE_EMPTY
+ ticks[i * receivers + j] = receiver_time - sender_time[j]; /*end - start*/
+#endif
+#ifdef QUEUE_FULL
+ ticks[i * receivers + j] = sender_time[j] - receiver_time; /*end -start*/
+#endif
+ }
+ }
+
+ mfc_put(ticks, args.ticks1_ea, size, 0, 0, 0);
+ mfc_write_tag_mask(1);
+ mfc_read_tag_status_all();
+
+ free(ticks);
+
+ return 0;
+}
diff --git a/tests/TPF/TPF_40_034/mpu4.c b/tests/TPF/TPF_40_034/mpu4.c
new file mode 100644
index 0000000..cb2b8be
--- /dev/null
+++ b/tests/TPF/TPF_40_034/mpu4.c
@@ -0,0 +1,84 @@
+/*
+ * Copyright 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 <malloc.h>
+#include <mars/task.h>
+#include <mars_test.h>
+#include <common.h>
+
+int mars_task_main(const struct mars_task_args *task_args)
+{
+ int ret, i, id, receivers, mpu_run;
+#ifndef QUEUE_INTERMEDIATE
+ int32_t reciever_time;
+#endif
+ char buf[ELEMENT_SIZE];
+ static struct test_task_args_st args ALIGN128;
+ mpu_run = 0;
+ mfc_get(&args, task_args->type.u64[0], sizeof(struct test_task_args_st),
+ 0, 0, 0);
+ mfc_write_tag_mask(1);
+ mfc_read_tag_status_all();
+
+ id = atoi(mars_task_get_name());
+ receivers = mars_test_int32_get(args.receivers);
+
+ for (i = 0; i < TEST2_ELEMENT_COUNT; i++) {
+
+ /* wait at barrier untill sender has finished pushing */
+ ret = mars_task_barrier_notify(args.barrier1_ea);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+ ret = mars_task_barrier_wait(args.barrier1_ea);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+
+#ifdef QUEUE_FULL
+ mpu_run = mars_test_int32_get(args.mpu_run);
+ while (mpu_run != id) {
+ mars_test_usleep(args.tb_freq, DELAY);
+ mpu_run = mars_test_int32_get(args.mpu_run);
+ mars_task_yield();
+ }
+ reciever_time = mars_task_get_ticks(); /*start time*/
+#endif
+ ret = mars_task_queue_pop(args.queue_ea, buf);
+#ifdef QUEUE_EMPTY
+ reciever_time = mars_task_get_ticks(); /*end time*/
+ mars_test_int32_put(args.shared_resources_ea[(uint32_t) buf[0]],
+ reciever_time);
+#endif
+#ifdef QUEUE_FULL
+ mars_test_int32_put(args.shared_resources_ea[id],
+ reciever_time);
+ mars_test_int32_put(args.mpu_run, ++mpu_run);
+#endif
+
+ /* wait at barrier untill all receivers have finished poping */
+ ret = mars_task_barrier_notify(args.barrier2_ea);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+ ret = mars_task_barrier_wait(args.barrier2_ea);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+
+ }
+
+ return 0;
+}
diff --git a/tests/TPF/TPF_40_034/mpu5.c b/tests/TPF/TPF_40_034/mpu5.c
new file mode 100644
index 0000000..0028b06
--- /dev/null
+++ b/tests/TPF/TPF_40_034/mpu5.c
@@ -0,0 +1,111 @@
+/*
+ * Copyright 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 <malloc.h>
+#include <mars/task.h>
+#include <mars_test.h>
+#include <common.h>
+
+uint32_t aligned_num(uint32_t num, uint32_t aligned)
+{
+ return num + (aligned - num % aligned);
+}
+
+int mars_task_main(const struct mars_task_args *task_args)
+{
+ int ret, i, j;
+ uint32_t sender_time[MAX_RECEIVERS], receiver_time;
+ char buf[ELEMENT_SIZE];
+ static struct test_task_args_st args ALIGN128;
+ uint32_t *ticks;
+
+ uint32_t receivers, size;
+
+ mfc_get(&args, task_args->type.u64[0], sizeof(struct test_task_args_st),
+ 0, 0, 0);
+ mfc_write_tag_mask(1);
+ mfc_read_tag_status_all();
+
+ receivers = mars_test_int32_get(args.receivers);
+
+ size =
+ aligned_num(TEST3_ELEMENT_COUNT * receivers,
+ 128) * sizeof(uint32_t);
+ ticks = (uint32_t *) memalign(128, size);
+ if (!ticks) {
+ return 1;
+ }
+
+ /*pre-fill queue if required by test scenareo */
+ for (i = 0; i < QUEUE_PRE_CONDITION; i++) {
+ ret = mars_task_queue_push(args.queue_ea, buf);
+ }
+
+ for (i = 0; i < TEST1_ELEMENT_COUNT; i++) {
+
+ mars_test_int32_put(args.mpu_run, 0);
+
+ /* ensure receivers wait untill sender has finished pushing */
+ ret = mars_task_barrier_notify(args.barrier1_ea);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+ ret = mars_task_barrier_wait(args.barrier1_ea);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+
+#ifdef QUEUE_EMPTY
+ /* wait for the MARS task blocked */
+ mars_test_usleep(args.tb_freq, 5000);
+#endif
+ for (j = 0; j < receivers; j++) {
+#ifdef QUEUE_EMPTY
+ buf[0] = j;
+#endif
+ ret = mars_task_queue_push(args.queue_ea, buf);
+ sender_time[j] = mars_task_get_ticks(); /*this is the start time*/
+ }
+
+ /* wait at barrier untill receivers have finished poping */
+ ret = mars_task_barrier_notify(args.barrier2_ea);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+ ret = mars_task_barrier_wait(args.barrier2_ea);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+
+ for (j = 0; j < receivers; j++) {
+ receiver_time = mars_test_int32_get(args.shared_resources_ea[j]); /*this is the end time*/
+#ifdef QUEUE_EMPTY
+ ticks[i * receivers + j] = receiver_time - sender_time[j]; /*end - start*/
+#endif
+#ifdef QUEUE_FULL
+ ticks[i * receivers + j] = sender_time[j] - receiver_time; /*end - start*/
+#endif
+ }
+
+ }
+
+ mfc_put(ticks, args.ticks1_ea, size, 0, 0, 0);
+ mfc_write_tag_mask(1);
+ mfc_read_tag_status_all();
+
+ free(ticks);
+
+ return 0;
+}
diff --git a/tests/TPF/TPF_40_034/mpu6.c b/tests/TPF/TPF_40_034/mpu6.c
new file mode 100644
index 0000000..4ca862d
--- /dev/null
+++ b/tests/TPF/TPF_40_034/mpu6.c
@@ -0,0 +1,89 @@
+/*
+ * Copyright 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 <malloc.h>
+#include <mars/task.h>
+#include <mars_test.h>
+#include <common.h>
+
+int mars_task_main(const struct mars_task_args *task_args)
+{
+ int ret, i, id, receivers, mpu_run;
+#ifndef QUEUE_INTERMEDIATE
+ int32_t reciever_time;
+ char buf[ELEMENT_SIZE];
+#endif
+ static struct test_task_args_st args ALIGN128;
+
+ mpu_run = 0;
+
+ mfc_get(&args, task_args->type.u64[0], sizeof(struct test_task_args_st),
+ 0, 0, 0);
+ mfc_write_tag_mask(1);
+ mfc_read_tag_status_all();
+
+ id = atoi(mars_task_get_name());
+ receivers = mars_test_int32_get(args.receivers);
+
+ for (i = 0; i < TEST3_ELEMENT_COUNT; i++) {
+
+ ret = mars_task_barrier_notify(args.barrier1_ea);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+ ret = mars_task_barrier_wait(args.barrier1_ea);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+
+#ifdef QUEUE_FULL
+ mpu_run = mars_test_int32_get(args.mpu_run);
+ while (mpu_run != id) {
+ mars_test_usleep(args.tb_freq, DELAY);
+ mpu_run = mars_test_int32_get(args.mpu_run);
+ mars_task_yield();
+ }
+ ret = mars_task_queue_pop(args.queue_ea, buf);
+ reciever_time = mars_task_get_ticks();
+ mars_test_int32_put(args.shared_resources_ea[id],
+ reciever_time);
+#endif
+
+#ifdef QUEUE_EMPTY
+ ret = mars_task_queue_pop(args.queue_ea, buf);
+ reciever_time = mars_task_get_ticks(); /*this is the end time*/
+ mars_test_int32_put(args.shared_resources_ea[(uint32_t) buf[0]],
+ reciever_time);
+#endif
+
+#ifdef QUEUE_FULL
+ mars_test_int32_put(args.shared_resources_ea[id],
+ reciever_time);
+ mars_test_int32_put(args.mpu_run, ++mpu_run);
+#endif
+
+ ret = mars_task_barrier_notify(args.barrier2_ea);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+ ret = mars_task_barrier_wait(args.barrier2_ea);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+
+ }
+
+ return 0;
+}
diff --git a/tests/TPF/TPF_40_035/Makefile b/tests/TPF/TPF_40_035/Makefile
new file mode 100644
index 0000000..1de70d4
--- /dev/null
+++ b/tests/TPF/TPF_40_035/Makefile
@@ -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.
+#
+
+EXTRA_LDFLAGS=-lm
+INCLUDE_CFLAGS+= -I./
+MPU_INCLUDE_CFLAGS+= -I./
+
+top_srcdir = ../..
+test_objs = host.o mpu1.task_eo mpu2.task_eo mpu3.task_eo \
+ mpu4.task_eo mpu5.task_eo mpu6.task_eo
+timeout = 120
+
+include $(top_srcdir)/scripts/config.mk
+include $(top_srcdir)/scripts/rules_item.mk
+include $(top_srcdir)/scripts/rules_tpf.mk
+
+host.o: common.h
+mpu1.task_o: common.h
+mpu2.task_o: common.h
+mpu3.task_o: common.h
+mpu4.task_o: common.h
+mpu5.task_o: common.h
+mpu6.task_o: common.h
+
+
+
diff --git a/tests/TPF/TPF_40_035/common.h b/tests/TPF/TPF_40_035/common.h
new file mode 100644
index 0000000..050ecc4
--- /dev/null
+++ b/tests/TPF/TPF_40_035/common.h
@@ -0,0 +1,58 @@
+/*
+ * Copyright 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.
+ */
+
+
+#ifndef TEST_COMMON_H
+#define TEST_COMMON_H
+
+#include <mars/task.h>
+#include <mars_test.h>
+
+#define MAX_RECEIVERS 4
+#define QUEUE_DEPTH 64
+
+#define QUEUE_PRE_CONDITION 64
+#define QUEUE_FULL
+
+#define ELEMENT_SIZE 128
+#define TEST1_ELEMENT_COUNT 400
+#define TEST2_ELEMENT_COUNT 400
+#define TEST3_ELEMENT_COUNT 400
+
+#define ALIGN128 __attribute__((aligned(128)))
+
+struct test_task_args_st {
+ uint64_t queue_ea;
+ uint64_t sender_to_receiver_ea;
+ uint64_t receiver_to_sender_ea;
+ uint64_t shared_resources_ea[MAX_RECEIVERS];
+ uint64_t ticks1_ea;
+ uint64_t ticks2_ea;
+ uint64_t barrier1_ea;
+ uint64_t barrier2_ea;
+ uint32_t tb_freq;
+ uint32_t receivers;
+ uint32_t mpu_run;
+ uint8_t pad[8];
+};
+#endif
diff --git a/tests/TPF/TPF_40_035/host.c b/tests/TPF/TPF_40_035/host.c
new file mode 100644
index 0000000..069f3ec
--- /dev/null
+++ b/tests/TPF/TPF_40_035/host.c
@@ -0,0 +1,24 @@
+/*
+ * Copyright 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 "../TPF_40_034/host.c"
diff --git a/tests/TPF/TPF_40_035/mpu1.c b/tests/TPF/TPF_40_035/mpu1.c
new file mode 100644
index 0000000..1914452
--- /dev/null
+++ b/tests/TPF/TPF_40_035/mpu1.c
@@ -0,0 +1,24 @@
+/*
+ * Copyright 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 "../TPF_40_034/mpu1.c"
diff --git a/tests/TPF/TPF_40_035/mpu2.c b/tests/TPF/TPF_40_035/mpu2.c
new file mode 100644
index 0000000..0f29f7d
--- /dev/null
+++ b/tests/TPF/TPF_40_035/mpu2.c
@@ -0,0 +1,24 @@
+/*
+ * Copyright 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 "../TPF_40_034/mpu2.c"
diff --git a/tests/TPF/TPF_40_035/mpu3.c b/tests/TPF/TPF_40_035/mpu3.c
new file mode 100644
index 0000000..3ac6240
--- /dev/null
+++ b/tests/TPF/TPF_40_035/mpu3.c
@@ -0,0 +1,24 @@
+/*
+ * Copyright 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 "../TPF_40_034/mpu3.c"
diff --git a/tests/TPF/TPF_40_035/mpu4.c b/tests/TPF/TPF_40_035/mpu4.c
new file mode 100644
index 0000000..2c390af
--- /dev/null
+++ b/tests/TPF/TPF_40_035/mpu4.c
@@ -0,0 +1,24 @@
+/*
+ * Copyright 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 "../TPF_40_034/mpu4.c"
diff --git a/tests/TPF/TPF_40_035/mpu5.c b/tests/TPF/TPF_40_035/mpu5.c
new file mode 100644
index 0000000..061e422
--- /dev/null
+++ b/tests/TPF/TPF_40_035/mpu5.c
@@ -0,0 +1,24 @@
+/*
+ * Copyright 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 "../TPF_40_034/mpu5.c"
diff --git a/tests/TPF/TPF_40_035/mpu6.c b/tests/TPF/TPF_40_035/mpu6.c
new file mode 100644
index 0000000..8aa9939
--- /dev/null
+++ b/tests/TPF/TPF_40_035/mpu6.c
@@ -0,0 +1,24 @@
+/*
+ * Copyright 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 "../TPF_40_034/mpu6.c"
diff --git a/tests/TPF/TPF_40_036/Makefile b/tests/TPF/TPF_40_036/Makefile
new file mode 100644
index 0000000..1de70d4
--- /dev/null
+++ b/tests/TPF/TPF_40_036/Makefile
@@ -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.
+#
+
+EXTRA_LDFLAGS=-lm
+INCLUDE_CFLAGS+= -I./
+MPU_INCLUDE_CFLAGS+= -I./
+
+top_srcdir = ../..
+test_objs = host.o mpu1.task_eo mpu2.task_eo mpu3.task_eo \
+ mpu4.task_eo mpu5.task_eo mpu6.task_eo
+timeout = 120
+
+include $(top_srcdir)/scripts/config.mk
+include $(top_srcdir)/scripts/rules_item.mk
+include $(top_srcdir)/scripts/rules_tpf.mk
+
+host.o: common.h
+mpu1.task_o: common.h
+mpu2.task_o: common.h
+mpu3.task_o: common.h
+mpu4.task_o: common.h
+mpu5.task_o: common.h
+mpu6.task_o: common.h
+
+
+
diff --git a/tests/TPF/TPF_40_036/common.h b/tests/TPF/TPF_40_036/common.h
new file mode 100644
index 0000000..3ae618b
--- /dev/null
+++ b/tests/TPF/TPF_40_036/common.h
@@ -0,0 +1,58 @@
+/*
+ * Copyright 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.
+ */
+
+
+#ifndef TEST_COMMON_H
+#define TEST_COMMON_H
+
+#include <mars/task.h>
+#include <mars_test.h>
+
+#define MAX_RECEIVERS 4
+#define QUEUE_DEPTH 64
+
+#define QUEUE_PRE_CONDITION 32
+#define QUEUE_INTERMEDIATE
+
+#define ELEMENT_SIZE 128
+#define TEST1_ELEMENT_COUNT 400
+#define TEST2_ELEMENT_COUNT 400
+#define TEST3_ELEMENT_COUNT 400
+
+#define ALIGN128 __attribute__((aligned(128)))
+
+struct test_task_args_st {
+ uint64_t queue_ea;
+ uint64_t sender_to_receiver_ea;
+ uint64_t receiver_to_sender_ea;
+ uint64_t shared_resources_ea[MAX_RECEIVERS];
+ uint64_t ticks1_ea;
+ uint64_t ticks2_ea;
+ uint64_t barrier1_ea;
+ uint64_t barrier2_ea;
+ uint32_t tb_freq;
+ uint32_t receivers;
+ uint32_t mpu_run;
+ uint8_t pad[8];
+};
+#endif
diff --git a/tests/TPF/TPF_40_036/host.c b/tests/TPF/TPF_40_036/host.c
new file mode 100644
index 0000000..069f3ec
--- /dev/null
+++ b/tests/TPF/TPF_40_036/host.c
@@ -0,0 +1,24 @@
+/*
+ * Copyright 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 "../TPF_40_034/host.c"
diff --git a/tests/TPF/TPF_40_036/mpu1.c b/tests/TPF/TPF_40_036/mpu1.c
new file mode 100644
index 0000000..1914452
--- /dev/null
+++ b/tests/TPF/TPF_40_036/mpu1.c
@@ -0,0 +1,24 @@
+/*
+ * Copyright 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 "../TPF_40_034/mpu1.c"
diff --git a/tests/TPF/TPF_40_036/mpu2.c b/tests/TPF/TPF_40_036/mpu2.c
new file mode 100644
index 0000000..0f29f7d
--- /dev/null
+++ b/tests/TPF/TPF_40_036/mpu2.c
@@ -0,0 +1,24 @@
+/*
+ * Copyright 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 "../TPF_40_034/mpu2.c"
diff --git a/tests/TPF/TPF_40_036/mpu3.c b/tests/TPF/TPF_40_036/mpu3.c
new file mode 100644
index 0000000..3ac6240
--- /dev/null
+++ b/tests/TPF/TPF_40_036/mpu3.c
@@ -0,0 +1,24 @@
+/*
+ * Copyright 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 "../TPF_40_034/mpu3.c"
diff --git a/tests/TPF/TPF_40_036/mpu4.c b/tests/TPF/TPF_40_036/mpu4.c
new file mode 100644
index 0000000..2c390af
--- /dev/null
+++ b/tests/TPF/TPF_40_036/mpu4.c
@@ -0,0 +1,24 @@
+/*
+ * Copyright 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 "../TPF_40_034/mpu4.c"
diff --git a/tests/TPF/TPF_40_036/mpu5.c b/tests/TPF/TPF_40_036/mpu5.c
new file mode 100644
index 0000000..061e422
--- /dev/null
+++ b/tests/TPF/TPF_40_036/mpu5.c
@@ -0,0 +1,24 @@
+/*
+ * Copyright 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 "../TPF_40_034/mpu5.c"
diff --git a/tests/TPF/TPF_40_036/mpu6.c b/tests/TPF/TPF_40_036/mpu6.c
new file mode 100644
index 0000000..8aa9939
--- /dev/null
+++ b/tests/TPF/TPF_40_036/mpu6.c
@@ -0,0 +1,24 @@
+/*
+ * Copyright 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 "../TPF_40_034/mpu6.c"
diff --git a/tests/TPF/TPF_40_037/Makefile b/tests/TPF/TPF_40_037/Makefile
new file mode 100644
index 0000000..1de70d4
--- /dev/null
+++ b/tests/TPF/TPF_40_037/Makefile
@@ -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.
+#
+
+EXTRA_LDFLAGS=-lm
+INCLUDE_CFLAGS+= -I./
+MPU_INCLUDE_CFLAGS+= -I./
+
+top_srcdir = ../..
+test_objs = host.o mpu1.task_eo mpu2.task_eo mpu3.task_eo \
+ mpu4.task_eo mpu5.task_eo mpu6.task_eo
+timeout = 120
+
+include $(top_srcdir)/scripts/config.mk
+include $(top_srcdir)/scripts/rules_item.mk
+include $(top_srcdir)/scripts/rules_tpf.mk
+
+host.o: common.h
+mpu1.task_o: common.h
+mpu2.task_o: common.h
+mpu3.task_o: common.h
+mpu4.task_o: common.h
+mpu5.task_o: common.h
+mpu6.task_o: common.h
+
+
+
diff --git a/tests/TPF/TPF_40_037/common.h b/tests/TPF/TPF_40_037/common.h
new file mode 100644
index 0000000..53d1db1
--- /dev/null
+++ b/tests/TPF/TPF_40_037/common.h
@@ -0,0 +1,58 @@
+/*
+ * Copyright 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.
+ */
+
+
+#ifndef TEST_COMMON_H
+#define TEST_COMMON_H
+
+#include <mars/task.h>
+#include <mars_test.h>
+
+#define MAX_RECEIVERS 16
+#define QUEUE_DEPTH 64
+
+#define QUEUE_PRE_CONDITION 0
+#define QUEUE_EMPTY
+
+#define ELEMENT_SIZE 128
+#define TEST1_ELEMENT_COUNT 200
+#define TEST2_ELEMENT_COUNT 200
+#define TEST3_ELEMENT_COUNT 200
+
+#define ALIGN128 __attribute__((aligned(128)))
+
+struct test_task_args_st {
+ uint64_t queue_ea;
+ uint64_t sender_to_receiver_ea;
+ uint64_t receiver_to_sender_ea;
+ uint64_t shared_resources_ea[MAX_RECEIVERS];
+ uint64_t ticks1_ea;
+ uint64_t ticks2_ea;
+ uint64_t barrier1_ea;
+ uint64_t barrier2_ea;
+ uint32_t tb_freq;
+ uint32_t receivers;
+ uint32_t mpu_run;
+ uint8_t pad[8];
+};
+#endif
diff --git a/tests/TPF/TPF_40_037/host.c b/tests/TPF/TPF_40_037/host.c
new file mode 100644
index 0000000..069f3ec
--- /dev/null
+++ b/tests/TPF/TPF_40_037/host.c
@@ -0,0 +1,24 @@
+/*
+ * Copyright 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 "../TPF_40_034/host.c"
diff --git a/tests/TPF/TPF_40_037/mpu1.c b/tests/TPF/TPF_40_037/mpu1.c
new file mode 100644
index 0000000..1914452
--- /dev/null
+++ b/tests/TPF/TPF_40_037/mpu1.c
@@ -0,0 +1,24 @@
+/*
+ * Copyright 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 "../TPF_40_034/mpu1.c"
diff --git a/tests/TPF/TPF_40_037/mpu2.c b/tests/TPF/TPF_40_037/mpu2.c
new file mode 100644
index 0000000..0f29f7d
--- /dev/null
+++ b/tests/TPF/TPF_40_037/mpu2.c
@@ -0,0 +1,24 @@
+/*
+ * Copyright 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 "../TPF_40_034/mpu2.c"
diff --git a/tests/TPF/TPF_40_037/mpu3.c b/tests/TPF/TPF_40_037/mpu3.c
new file mode 100644
index 0000000..3ac6240
--- /dev/null
+++ b/tests/TPF/TPF_40_037/mpu3.c
@@ -0,0 +1,24 @@
+/*
+ * Copyright 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 "../TPF_40_034/mpu3.c"
diff --git a/tests/TPF/TPF_40_037/mpu4.c b/tests/TPF/TPF_40_037/mpu4.c
new file mode 100644
index 0000000..2c390af
--- /dev/null
+++ b/tests/TPF/TPF_40_037/mpu4.c
@@ -0,0 +1,24 @@
+/*
+ * Copyright 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 "../TPF_40_034/mpu4.c"
diff --git a/tests/TPF/TPF_40_037/mpu5.c b/tests/TPF/TPF_40_037/mpu5.c
new file mode 100644
index 0000000..061e422
--- /dev/null
+++ b/tests/TPF/TPF_40_037/mpu5.c
@@ -0,0 +1,24 @@
+/*
+ * Copyright 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 "../TPF_40_034/mpu5.c"
diff --git a/tests/TPF/TPF_40_037/mpu6.c b/tests/TPF/TPF_40_037/mpu6.c
new file mode 100644
index 0000000..8aa9939
--- /dev/null
+++ b/tests/TPF/TPF_40_037/mpu6.c
@@ -0,0 +1,24 @@
+/*
+ * Copyright 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 "../TPF_40_034/mpu6.c"
diff --git a/tests/TPF/TPF_40_038/Makefile b/tests/TPF/TPF_40_038/Makefile
new file mode 100644
index 0000000..1de70d4
--- /dev/null
+++ b/tests/TPF/TPF_40_038/Makefile
@@ -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.
+#
+
+EXTRA_LDFLAGS=-lm
+INCLUDE_CFLAGS+= -I./
+MPU_INCLUDE_CFLAGS+= -I./
+
+top_srcdir = ../..
+test_objs = host.o mpu1.task_eo mpu2.task_eo mpu3.task_eo \
+ mpu4.task_eo mpu5.task_eo mpu6.task_eo
+timeout = 120
+
+include $(top_srcdir)/scripts/config.mk
+include $(top_srcdir)/scripts/rules_item.mk
+include $(top_srcdir)/scripts/rules_tpf.mk
+
+host.o: common.h
+mpu1.task_o: common.h
+mpu2.task_o: common.h
+mpu3.task_o: common.h
+mpu4.task_o: common.h
+mpu5.task_o: common.h
+mpu6.task_o: common.h
+
+
+
diff --git a/tests/TPF/TPF_40_038/common.h b/tests/TPF/TPF_40_038/common.h
new file mode 100644
index 0000000..acad6e1
--- /dev/null
+++ b/tests/TPF/TPF_40_038/common.h
@@ -0,0 +1,58 @@
+/*
+ * Copyright 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.
+ */
+
+
+#ifndef TEST_COMMON_H
+#define TEST_COMMON_H
+
+#include <mars/task.h>
+#include <mars_test.h>
+
+#define MAX_RECEIVERS 16
+#define QUEUE_DEPTH 64
+
+#define QUEUE_PRE_CONDITION 64
+#define QUEUE_FULL
+
+#define ELEMENT_SIZE 128
+#define TEST1_ELEMENT_COUNT 200
+#define TEST2_ELEMENT_COUNT 200
+#define TEST3_ELEMENT_COUNT 200
+
+#define ALIGN128 __attribute__((aligned(128)))
+
+struct test_task_args_st {
+ uint64_t queue_ea;
+ uint64_t sender_to_receiver_ea;
+ uint64_t receiver_to_sender_ea;
+ uint64_t shared_resources_ea[MAX_RECEIVERS];
+ uint64_t ticks1_ea;
+ uint64_t ticks2_ea;
+ uint64_t barrier1_ea;
+ uint64_t barrier2_ea;
+ uint32_t tb_freq;
+ uint32_t receivers;
+ uint32_t mpu_run;
+ uint8_t pad[8];
+};
+#endif
diff --git a/tests/TPF/TPF_40_038/host.c b/tests/TPF/TPF_40_038/host.c
new file mode 100644
index 0000000..069f3ec
--- /dev/null
+++ b/tests/TPF/TPF_40_038/host.c
@@ -0,0 +1,24 @@
+/*
+ * Copyright 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 "../TPF_40_034/host.c"
diff --git a/tests/TPF/TPF_40_038/mpu1.c b/tests/TPF/TPF_40_038/mpu1.c
new file mode 100644
index 0000000..1914452
--- /dev/null
+++ b/tests/TPF/TPF_40_038/mpu1.c
@@ -0,0 +1,24 @@
+/*
+ * Copyright 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 "../TPF_40_034/mpu1.c"
diff --git a/tests/TPF/TPF_40_038/mpu2.c b/tests/TPF/TPF_40_038/mpu2.c
new file mode 100644
index 0000000..0f29f7d
--- /dev/null
+++ b/tests/TPF/TPF_40_038/mpu2.c
@@ -0,0 +1,24 @@
+/*
+ * Copyright 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 "../TPF_40_034/mpu2.c"
diff --git a/tests/TPF/TPF_40_038/mpu3.c b/tests/TPF/TPF_40_038/mpu3.c
new file mode 100644
index 0000000..3ac6240
--- /dev/null
+++ b/tests/TPF/TPF_40_038/mpu3.c
@@ -0,0 +1,24 @@
+/*
+ * Copyright 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 "../TPF_40_034/mpu3.c"
diff --git a/tests/TPF/TPF_40_038/mpu4.c b/tests/TPF/TPF_40_038/mpu4.c
new file mode 100644
index 0000000..2c390af
--- /dev/null
+++ b/tests/TPF/TPF_40_038/mpu4.c
@@ -0,0 +1,24 @@
+/*
+ * Copyright 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 "../TPF_40_034/mpu4.c"
diff --git a/tests/TPF/TPF_40_038/mpu5.c b/tests/TPF/TPF_40_038/mpu5.c
new file mode 100644
index 0000000..061e422
--- /dev/null
+++ b/tests/TPF/TPF_40_038/mpu5.c
@@ -0,0 +1,24 @@
+/*
+ * Copyright 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 "../TPF_40_034/mpu5.c"
diff --git a/tests/TPF/TPF_40_038/mpu6.c b/tests/TPF/TPF_40_038/mpu6.c
new file mode 100644
index 0000000..8aa9939
--- /dev/null
+++ b/tests/TPF/TPF_40_038/mpu6.c
@@ -0,0 +1,24 @@
+/*
+ * Copyright 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 "../TPF_40_034/mpu6.c"
diff --git a/tests/TPF/TPF_40_039/Makefile b/tests/TPF/TPF_40_039/Makefile
new file mode 100644
index 0000000..1de70d4
--- /dev/null
+++ b/tests/TPF/TPF_40_039/Makefile
@@ -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.
+#
+
+EXTRA_LDFLAGS=-lm
+INCLUDE_CFLAGS+= -I./
+MPU_INCLUDE_CFLAGS+= -I./
+
+top_srcdir = ../..
+test_objs = host.o mpu1.task_eo mpu2.task_eo mpu3.task_eo \
+ mpu4.task_eo mpu5.task_eo mpu6.task_eo
+timeout = 120
+
+include $(top_srcdir)/scripts/config.mk
+include $(top_srcdir)/scripts/rules_item.mk
+include $(top_srcdir)/scripts/rules_tpf.mk
+
+host.o: common.h
+mpu1.task_o: common.h
+mpu2.task_o: common.h
+mpu3.task_o: common.h
+mpu4.task_o: common.h
+mpu5.task_o: common.h
+mpu6.task_o: common.h
+
+
+
diff --git a/tests/TPF/TPF_40_039/common.h b/tests/TPF/TPF_40_039/common.h
new file mode 100644
index 0000000..e37ce56
--- /dev/null
+++ b/tests/TPF/TPF_40_039/common.h
@@ -0,0 +1,58 @@
+/*
+ * Copyright 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.
+ */
+
+
+#ifndef TEST_COMMON_H
+#define TEST_COMMON_H
+
+#include <mars/task.h>
+#include <mars_test.h>
+
+#define MAX_RECEIVERS 16
+#define QUEUE_DEPTH 64
+
+#define QUEUE_PRE_CONDITION 32
+#define QUEUE_INTERMEDIATE
+
+#define ELEMENT_SIZE 128
+#define TEST1_ELEMENT_COUNT 200
+#define TEST2_ELEMENT_COUNT 200
+#define TEST3_ELEMENT_COUNT 200
+
+#define ALIGN128 __attribute__((aligned(128)))
+
+struct test_task_args_st {
+ uint64_t queue_ea;
+ uint64_t sender_to_receiver_ea;
+ uint64_t receiver_to_sender_ea;
+ uint64_t shared_resources_ea[MAX_RECEIVERS];
+ uint64_t ticks1_ea;
+ uint64_t ticks2_ea;
+ uint64_t barrier1_ea;
+ uint64_t barrier2_ea;
+ uint32_t tb_freq;
+ uint32_t receivers;
+ uint32_t mpu_run;
+ uint8_t pad[8];
+};
+#endif
diff --git a/tests/TPF/TPF_40_039/host.c b/tests/TPF/TPF_40_039/host.c
new file mode 100644
index 0000000..069f3ec
--- /dev/null
+++ b/tests/TPF/TPF_40_039/host.c
@@ -0,0 +1,24 @@
+/*
+ * Copyright 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 "../TPF_40_034/host.c"
diff --git a/tests/TPF/TPF_40_039/mpu1.c b/tests/TPF/TPF_40_039/mpu1.c
new file mode 100644
index 0000000..1914452
--- /dev/null
+++ b/tests/TPF/TPF_40_039/mpu1.c
@@ -0,0 +1,24 @@
+/*
+ * Copyright 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 "../TPF_40_034/mpu1.c"
diff --git a/tests/TPF/TPF_40_039/mpu2.c b/tests/TPF/TPF_40_039/mpu2.c
new file mode 100644
index 0000000..0f29f7d
--- /dev/null
+++ b/tests/TPF/TPF_40_039/mpu2.c
@@ -0,0 +1,24 @@
+/*
+ * Copyright 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 "../TPF_40_034/mpu2.c"
diff --git a/tests/TPF/TPF_40_039/mpu3.c b/tests/TPF/TPF_40_039/mpu3.c
new file mode 100644
index 0000000..3ac6240
--- /dev/null
+++ b/tests/TPF/TPF_40_039/mpu3.c
@@ -0,0 +1,24 @@
+/*
+ * Copyright 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 "../TPF_40_034/mpu3.c"
diff --git a/tests/TPF/TPF_40_039/mpu4.c b/tests/TPF/TPF_40_039/mpu4.c
new file mode 100644
index 0000000..2c390af
--- /dev/null
+++ b/tests/TPF/TPF_40_039/mpu4.c
@@ -0,0 +1,24 @@
+/*
+ * Copyright 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 "../TPF_40_034/mpu4.c"
diff --git a/tests/TPF/TPF_40_039/mpu5.c b/tests/TPF/TPF_40_039/mpu5.c
new file mode 100644
index 0000000..061e422
--- /dev/null
+++ b/tests/TPF/TPF_40_039/mpu5.c
@@ -0,0 +1,24 @@
+/*
+ * Copyright 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 "../TPF_40_034/mpu5.c"
diff --git a/tests/TPF/TPF_40_039/mpu6.c b/tests/TPF/TPF_40_039/mpu6.c
new file mode 100644
index 0000000..8aa9939
--- /dev/null
+++ b/tests/TPF/TPF_40_039/mpu6.c
@@ -0,0 +1,24 @@
+/*
+ * Copyright 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 "../TPF_40_034/mpu6.c"
diff --git a/tests/TPF/TPF_40_040/Makefile b/tests/TPF/TPF_40_040/Makefile
new file mode 100644
index 0000000..1de70d4
--- /dev/null
+++ b/tests/TPF/TPF_40_040/Makefile
@@ -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.
+#
+
+EXTRA_LDFLAGS=-lm
+INCLUDE_CFLAGS+= -I./
+MPU_INCLUDE_CFLAGS+= -I./
+
+top_srcdir = ../..
+test_objs = host.o mpu1.task_eo mpu2.task_eo mpu3.task_eo \
+ mpu4.task_eo mpu5.task_eo mpu6.task_eo
+timeout = 120
+
+include $(top_srcdir)/scripts/config.mk
+include $(top_srcdir)/scripts/rules_item.mk
+include $(top_srcdir)/scripts/rules_tpf.mk
+
+host.o: common.h
+mpu1.task_o: common.h
+mpu2.task_o: common.h
+mpu3.task_o: common.h
+mpu4.task_o: common.h
+mpu5.task_o: common.h
+mpu6.task_o: common.h
+
+
+
diff --git a/tests/TPF/TPF_40_040/common.h b/tests/TPF/TPF_40_040/common.h
new file mode 100644
index 0000000..050ecc4
--- /dev/null
+++ b/tests/TPF/TPF_40_040/common.h
@@ -0,0 +1,58 @@
+/*
+ * Copyright 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.
+ */
+
+
+#ifndef TEST_COMMON_H
+#define TEST_COMMON_H
+
+#include <mars/task.h>
+#include <mars_test.h>
+
+#define MAX_RECEIVERS 4
+#define QUEUE_DEPTH 64
+
+#define QUEUE_PRE_CONDITION 64
+#define QUEUE_FULL
+
+#define ELEMENT_SIZE 128
+#define TEST1_ELEMENT_COUNT 400
+#define TEST2_ELEMENT_COUNT 400
+#define TEST3_ELEMENT_COUNT 400
+
+#define ALIGN128 __attribute__((aligned(128)))
+
+struct test_task_args_st {
+ uint64_t queue_ea;
+ uint64_t sender_to_receiver_ea;
+ uint64_t receiver_to_sender_ea;
+ uint64_t shared_resources_ea[MAX_RECEIVERS];
+ uint64_t ticks1_ea;
+ uint64_t ticks2_ea;
+ uint64_t barrier1_ea;
+ uint64_t barrier2_ea;
+ uint32_t tb_freq;
+ uint32_t receivers;
+ uint32_t mpu_run;
+ uint8_t pad[8];
+};
+#endif
diff --git a/tests/TPF/TPF_40_040/host.c b/tests/TPF/TPF_40_040/host.c
new file mode 100644
index 0000000..bd12fa4
--- /dev/null
+++ b/tests/TPF/TPF_40_040/host.c
@@ -0,0 +1,492 @@
+/*
+ * Copyright 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/task.h>
+#include <mars_test.h>
+#include <common.h>
+
+extern spe_program_handle_t mpu1_prog, mpu2_prog, mpu3_prog;
+extern spe_program_handle_t mpu4_prog, mpu5_prog, mpu6_prog;
+
+/*
+ * This test times the execution time of mars_task_queue_push() and
+ * mars_task_queue_pop() separately using mpu1.c and mpu2.c.
+ */
+
+uint32_t aligned_num(uint32_t num, uint32_t aligned)
+{
+ return num + (aligned - num % aligned);
+}
+
+void test1(uint32_t receivers)
+{
+ int ret;
+ int32_t *push_ticks;
+ int32_t *pop_ticks;
+ struct mars_context *mars_ctx;
+ struct mars_task_id receiver_task_id[receivers];
+ struct mars_task_args task_args;
+ uint64_t queue;
+ uint64_t barrier1;
+ uint64_t barrier2;
+
+ char buf[ELEMENT_SIZE];
+
+ uint32_t sender_to_receiver = UINT32_MAX;
+ uint32_t receiver_to_sender = UINT32_MAX;
+ uint32_t start, end;
+ uint32_t shared_resources[receivers] ALIGN128;
+ char name[128];
+
+ static struct test_task_args_st args ALIGN128;
+
+ uint32_t i, j, size;
+
+ size = aligned_num(TEST1_ELEMENT_COUNT * receivers,
+ 128) * sizeof(uint32_t);
+ ret = posix_memalign((void **)&push_ticks, 128, size);
+ MARS_TEST_ASSERT_EQUAL(ret, 0);
+ ret = posix_memalign((void **)&pop_ticks, 128, size);
+ MARS_TEST_ASSERT_EQUAL(ret, 0);
+
+ ret = mars_test_get_timebase_freq(&args.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_queue_create(mars_ctx, &queue, ELEMENT_SIZE, QUEUE_DEPTH,
+ MARS_TASK_QUEUE_HOST_TO_MPU);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+
+ ret = mars_task_barrier_create(mars_ctx, &barrier1, receivers);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+
+ ret = mars_task_barrier_create(mars_ctx, &barrier2, receivers);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+
+ sprintf(name, "%d", 0);
+ ret = mars_task_create(mars_ctx, &receiver_task_id[0], name,
+ mpu1_prog.elf_image, MARS_TASK_CONTEXT_SAVE_SIZE_MAX);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+
+ for (i = 1; i < receivers; i++) {
+ sprintf(name, "%d", i);
+ ret = mars_task_create(mars_ctx, &receiver_task_id[i], name,
+ mpu2_prog.elf_image,
+ MARS_TASK_CONTEXT_SAVE_SIZE_MAX);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+ }
+
+ for (i = 0; i < receivers; i++) {
+ shared_resources[i] = 0;
+ args.shared_resources_ea[i] =
+ mars_ptr_to_ea(&shared_resources[i]);
+ }
+
+ args.queue_ea = queue;
+ args.barrier1_ea = barrier1;
+ args.barrier2_ea = barrier2;
+ args.ticks1_ea = mars_ptr_to_ea(push_ticks);
+ args.ticks2_ea = mars_ptr_to_ea(pop_ticks);
+ args.receivers = mars_ptr_to_ea(&receivers);
+ args.sender_to_receiver_ea = mars_ptr_to_ea(&sender_to_receiver);
+ args.receiver_to_sender_ea = mars_ptr_to_ea(&receiver_to_sender);
+
+ task_args.type.u64[0] = mars_ptr_to_ea(&args);
+
+ for (i = 0; i < receivers; i++) {
+ ret = mars_task_schedule(&receiver_task_id[i], &task_args, 0);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+ }
+
+ /*pre-fill queue if required by test scenareo */
+ for (i = 0; i < QUEUE_PRE_CONDITION; i++) {
+ ret = mars_task_queue_push(queue, buf);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+ }
+
+ for (i = 0; i < TEST1_ELEMENT_COUNT; i++) {
+ mars_test_counter_wait(&receiver_to_sender, i * 2);
+ mars_test_counter_set(&sender_to_receiver, i * 2);
+ for (j = 0; j < receivers; j++) {
+ start = mars_task_get_ticks();
+ ret = mars_task_queue_push(queue, buf);
+ end = mars_task_get_ticks();
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+ push_ticks[i * receivers + j] = end - start;
+ }
+
+ mars_test_counter_wait(&receiver_to_sender, i * 2 + 1);
+ mars_test_counter_set(&sender_to_receiver, i * 2 + 1);
+
+ for (j = 0; j < receivers; j++) {
+ pop_ticks[i * receivers + j] = shared_resources[j];
+ }
+ }
+
+ for (i = 0; i < receivers; i++) {
+ ret = mars_task_wait(&receiver_task_id[i], NULL);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+ }
+
+ for (i = 0; i < receivers; i++) {
+ ret = mars_task_destroy(&receiver_task_id[i]);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+ }
+
+ ret = mars_task_barrier_destroy(barrier1);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+
+ ret = mars_task_barrier_destroy(barrier2);
+ 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_ctx);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+
+ mars_test_print_statistics(push_ticks, TEST1_ELEMENT_COUNT * receivers,
+ "push");
+ mars_test_print_statistics(pop_ticks, TEST1_ELEMENT_COUNT * receivers,
+ "pop");
+
+ free(push_ticks);
+ free(pop_ticks);
+
+}
+
+#ifndef QUEUE_INTERMEDIATE
+
+void test2(uint32_t receivers)
+{
+ int ret, i, j, size;
+ int32_t *ticks;
+ struct mars_context *mars_ctx;
+ struct mars_task_id receiver_task_id[receivers];
+ struct mars_task_args task_args;
+ uint64_t queue;
+ uint64_t barrier1;
+ uint64_t barrier2;
+ char name[128];
+
+ uint32_t sender_to_receiver = UINT32_MAX;
+ uint32_t receiver_to_sender = UINT32_MAX;
+ uint32_t mpu_run = 0;
+ uint32_t sender_time[receivers], receiver_time;
+ char buf[ELEMENT_SIZE];
+
+ uint32_t shared_resources[receivers] ALIGN128;
+
+ static struct test_task_args_st args ALIGN128;
+
+ size = aligned_num(TEST2_ELEMENT_COUNT * receivers,
+ 128) * sizeof(uint32_t);
+ ret = posix_memalign((void **)&ticks, 128, size);
+ MARS_TEST_ASSERT_EQUAL(ret, 0);
+
+ ret = mars_test_get_timebase_freq(&args.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_queue_create(mars_ctx, &queue, ELEMENT_SIZE, QUEUE_DEPTH,
+ MARS_TASK_QUEUE_HOST_TO_MPU);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+
+ ret = mars_task_barrier_create(mars_ctx, &barrier1, receivers);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+
+ ret = mars_task_barrier_create(mars_ctx, &barrier2, receivers);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+
+ sprintf(name, "%d", 0);
+ ret = mars_task_create(mars_ctx, &receiver_task_id[0], name,
+ mpu3_prog.elf_image, MARS_TASK_CONTEXT_SAVE_SIZE_MAX);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+
+ for (i = 1; i < receivers; i++) {
+ sprintf(name, "%d", i);
+ ret = mars_task_create(mars_ctx, &receiver_task_id[i], name,
+ mpu4_prog.elf_image,
+ MARS_TASK_CONTEXT_SAVE_SIZE_MAX);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+ }
+
+ for (i = 0; i < receivers; i++) {
+ shared_resources[i] = 0;
+ args.shared_resources_ea[i] =
+ mars_ptr_to_ea(&shared_resources[i]);
+ }
+
+ args.queue_ea = queue;
+ args.barrier1_ea = barrier1;
+ args.barrier2_ea = barrier2;
+ args.ticks1_ea = mars_ptr_to_ea(ticks);
+ args.receivers = mars_ptr_to_ea(&receivers);
+ args.mpu_run = mars_ptr_to_ea(&mpu_run);
+ args.sender_to_receiver_ea = mars_ptr_to_ea(&sender_to_receiver);
+ args.receiver_to_sender_ea = mars_ptr_to_ea(&receiver_to_sender);
+ task_args.type.u64[0] = mars_ptr_to_ea(&args);
+
+ /*pre-fill queue if required by test scenareo */
+ for (i = 0; i < QUEUE_PRE_CONDITION; i++) {
+ ret = mars_task_queue_push(queue, buf);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+ }
+
+ for (i = 0; i < receivers; i++) {
+ ret = mars_task_schedule(&receiver_task_id[i], &task_args, 0);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+ }
+
+ for (i = 0; i < TEST2_ELEMENT_COUNT; i++) {
+ mars_test_counter_wait(&receiver_to_sender, i * 2);
+ mars_test_counter_set(&sender_to_receiver, i * 2);
+
+#ifdef QUEUE_EMPTY
+ /* wait for the recievers to be blocked on pop */
+ usleep(5000);
+#endif
+
+ for (j = 0; j < receivers; j++) {
+#ifdef QUEUE_EMPTY
+ buf[0] = j;
+ sender_time[j] = mars_task_get_ticks(); /*this is the start time*/
+#endif
+ ret = mars_task_queue_push(args.queue_ea, buf);
+#ifdef QUEUE_FULL
+ sender_time[j] = mars_task_get_ticks();
+#endif
+ }
+
+ mars_test_counter_wait(&receiver_to_sender, i * 2 + 1);
+ mars_test_counter_set(&sender_to_receiver, i * 2 + 1);
+
+ for (j = 0; j < receivers; j++) {
+ receiver_time = shared_resources[j];
+#ifdef QUEUE_EMPTY
+ ticks[i * receivers + j] = receiver_time - sender_time[j]; /*end - start*/
+#endif
+#ifdef QUEUE_FULL
+ ticks[i * receivers + j] = sender_time[j] - receiver_time; /*end -start*/
+#endif
+
+ }
+ }
+
+ for (i = 0; i < receivers; i++) {
+ ret = mars_task_wait(&receiver_task_id[i], NULL);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+ }
+
+ for (i = 0; i < receivers; i++) {
+ ret = mars_task_destroy(&receiver_task_id[i]);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+ }
+
+ ret = mars_task_barrier_destroy(barrier1);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+
+ ret = mars_task_barrier_destroy(barrier2);
+ 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_ctx);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+
+ mars_test_print_statistics(ticks, TEST2_ELEMENT_COUNT * receivers,
+ "beginning of push - end of pop");
+
+ free(ticks);
+
+}
+
+void test3(uint32_t receivers)
+{
+ int ret;
+ int32_t *ticks;
+ struct mars_context *mars_ctx;
+ struct mars_task_id receiver_task_id[receivers];
+ struct mars_task_args task_args;
+ uint64_t queue;
+ uint64_t barrier1;
+ uint64_t barrier2;
+ char name[128];
+
+ uint32_t sender_to_receiver = UINT32_MAX;
+ uint32_t receiver_to_sender = UINT32_MAX;
+ uint32_t mpu_run = 0;
+ uint32_t sender_time[receivers], receiver_time, size;
+ char buf[ELEMENT_SIZE];
+
+ uint32_t shared_resources[receivers] ALIGN128;
+
+ static struct test_task_args_st args ALIGN128;
+
+ uint32_t i, j;
+
+ size = aligned_num(TEST3_ELEMENT_COUNT * receivers,
+ 128) * sizeof(uint32_t);
+ ret = posix_memalign((void **)&ticks, 128, size);
+ MARS_TEST_ASSERT_EQUAL(ret, 0);
+
+ ret = mars_test_get_timebase_freq(&args.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_queue_create(mars_ctx, &queue, ELEMENT_SIZE, QUEUE_DEPTH,
+ MARS_TASK_QUEUE_HOST_TO_MPU);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+
+ ret = mars_task_barrier_create(mars_ctx, &barrier1, receivers);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+
+ ret = mars_task_barrier_create(mars_ctx, &barrier2, receivers);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+
+ sprintf(name, "%d", 0);
+ ret = mars_task_create(mars_ctx, &receiver_task_id[0], name,
+ mpu5_prog.elf_image, MARS_TASK_CONTEXT_SAVE_SIZE_MAX);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+
+ for (i = 1; i < receivers; i++) {
+ sprintf(name, "%d", i);
+ ret = mars_task_create(mars_ctx, &receiver_task_id[i], name,
+ mpu6_prog.elf_image,
+ MARS_TASK_CONTEXT_SAVE_SIZE_MAX);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+ }
+
+ for (i = 0; i < receivers; i++) {
+ shared_resources[i] = 0;
+ args.shared_resources_ea[i] =
+ mars_ptr_to_ea(&shared_resources[i]);
+ }
+
+ args.queue_ea = queue;
+ args.barrier1_ea = barrier1;
+ args.barrier2_ea = barrier2;
+ args.ticks1_ea = mars_ptr_to_ea(ticks);
+ args.receivers = mars_ptr_to_ea(&receivers);
+ args.mpu_run = mars_ptr_to_ea(&mpu_run);
+ args.sender_to_receiver_ea = mars_ptr_to_ea(&sender_to_receiver);
+ args.receiver_to_sender_ea = mars_ptr_to_ea(&receiver_to_sender);
+ task_args.type.u64[0] = mars_ptr_to_ea(&args);
+
+ /*pre-fill queue if required by test scenareo */
+ for (i = 0; i < QUEUE_PRE_CONDITION; i++) {
+ ret = mars_task_queue_push(queue, buf);
+ }
+
+ for (i = 0; i < receivers; i++) {
+ shared_resources[i] = 0;
+ args.shared_resources_ea[i] =
+ mars_ptr_to_ea(&shared_resources[i]);
+ }
+
+ for (i = 0; i < receivers; i++) {
+ ret = mars_task_schedule(&receiver_task_id[i], &task_args, 0);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+ }
+
+ for (i = 0; i < TEST3_ELEMENT_COUNT; i++) {
+ mars_test_counter_wait(&receiver_to_sender, i * 2);
+ mars_test_counter_set(&sender_to_receiver, i * 2);
+
+#ifdef QUEUE_EMPTY
+ usleep(5000);
+#endif
+ for (j = 0; j < receivers; j++) {
+#ifdef QUEUE_EMPTY
+ buf[0] = j;
+#endif
+ ret = mars_task_queue_push(args.queue_ea, buf);
+ sender_time[j] = mars_task_get_ticks(); /*this is the start time*/
+ }
+
+ mars_test_counter_wait(&receiver_to_sender, i * 2 + 1);
+ mars_test_counter_set(&sender_to_receiver, i * 2 + 1);
+
+ for (j = 0; j < receivers; j++) {
+ receiver_time = shared_resources[j];
+#ifdef QUEUE_EMPTY
+ ticks[i * receivers + j] = receiver_time - sender_time[j]; /*end - start*/
+#endif
+#ifdef QUEUE_FULL
+ ticks[i * receivers + j] = sender_time[j] - receiver_time; /*end -start*/
+#endif
+ }
+
+ }
+
+ for (i = 0; i < receivers; i++) {
+ ret = mars_task_wait(&receiver_task_id[i], NULL);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+ }
+
+ for (i = 0; i < receivers; i++) {
+ ret = mars_task_destroy(&receiver_task_id[i]);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+ }
+
+ ret = mars_task_barrier_destroy(barrier1);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+
+ ret = mars_task_barrier_destroy(barrier2);
+ 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_ctx);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+
+ mars_test_print_statistics(ticks, TEST3_ELEMENT_COUNT * receivers,
+ "end of push - end of pop");
+
+ free(ticks);
+}
+#endif
+
+int main(int argc, char *argv[])
+{
+ MARS_TEST_PERF_INIT();
+ int i;
+ for (i = MAX_RECEIVERS; i <= MAX_RECEIVERS; i++) {
+ test1(i);
+#ifndef QUEUE_INTERMEDIATE
+ test2(i);
+ test3(i);
+#endif
+ }
+
+ return 0;
+}
diff --git a/tests/TPF/TPF_40_040/mpu1.c b/tests/TPF/TPF_40_040/mpu1.c
new file mode 100644
index 0000000..765ae6a
--- /dev/null
+++ b/tests/TPF/TPF_40_040/mpu1.c
@@ -0,0 +1,72 @@
+/*
+ * Copyright 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 <malloc.h>
+#include <mars/task.h>
+#include <mars_test.h>
+#include <common.h>
+
+int mars_task_main(const struct mars_task_args *task_args)
+{
+ int ret, i, id;
+ uint32_t start, end;
+ char buf[ELEMENT_SIZE];
+ static struct test_task_args_st args ALIGN128;
+
+ mfc_get(&args, task_args->type.u64[0], sizeof(struct test_task_args_st),
+ 0, 0, 0);
+ mfc_write_tag_mask(1);
+ mfc_read_tag_status_all();
+
+ id = atoi(mars_task_get_name());
+
+ for (i = 0; i < TEST1_ELEMENT_COUNT; i++) {
+
+ /*sync with host */
+ mars_test_counter_set(args.receiver_to_sender_ea, i * 2);
+ mars_test_counter_wait(args.sender_to_receiver_ea, i * 2);
+
+ /* wait at barrier untill sender has finished pushing */
+ ret = mars_task_barrier_notify(args.barrier1_ea);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+ ret = mars_task_barrier_wait(args.barrier1_ea);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+
+ start = mars_task_get_ticks();
+ ret = mars_task_queue_pop(args.queue_ea, buf);
+ end = mars_task_get_ticks();
+ mars_test_int32_put(args.shared_resources_ea[id], end - start);
+
+ /* wait at barrier untill all receivers have finished poping */
+ ret = mars_task_barrier_notify(args.barrier2_ea);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+ ret = mars_task_barrier_wait(args.barrier2_ea);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+
+ /*sync with host */
+ mars_test_counter_set(args.receiver_to_sender_ea, i * 2 + 1);
+ mars_test_counter_wait(args.sender_to_receiver_ea, i * 2 + 1);
+
+ }
+
+ return 0;
+}
diff --git a/tests/TPF/TPF_40_040/mpu2.c b/tests/TPF/TPF_40_040/mpu2.c
new file mode 100644
index 0000000..0f29f7d
--- /dev/null
+++ b/tests/TPF/TPF_40_040/mpu2.c
@@ -0,0 +1,24 @@
+/*
+ * Copyright 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 "../TPF_40_034/mpu2.c"
diff --git a/tests/TPF/TPF_40_040/mpu3.c b/tests/TPF/TPF_40_040/mpu3.c
new file mode 100644
index 0000000..c2cdf01
--- /dev/null
+++ b/tests/TPF/TPF_40_040/mpu3.c
@@ -0,0 +1,93 @@
+/*
+ * Copyright 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 <malloc.h>
+#include <mars/task.h>
+#include <mars_test.h>
+#include <common.h>
+
+int mars_task_main(const struct mars_task_args *task_args)
+{
+ int ret, i, id, receivers;
+#ifndef QUEUE_INTERMEDIATE
+ uint32_t reciever_time;
+#endif
+ uint32_t mpu_run;
+ char buf[ELEMENT_SIZE];
+ static struct test_task_args_st args ALIGN128;
+
+ mfc_get(&args, task_args->type.u64[0], sizeof(struct test_task_args_st),
+ 0, 0, 0);
+ mfc_write_tag_mask(1);
+ mfc_read_tag_status_all();
+
+ id = atoi(mars_task_get_name());
+ receivers = mars_test_int32_get(args.receivers);
+
+ for (i = 0; i < TEST2_ELEMENT_COUNT; i++) {
+
+ /*sync with host */
+ mars_test_counter_set(args.receiver_to_sender_ea, i * 2);
+ mars_test_counter_wait(args.sender_to_receiver_ea, i * 2);
+
+ /* wait at barrier untill sender has finished pushing */
+
+ mpu_run = 0;
+#ifdef QUEUE_FULL
+ mars_test_int32_put(args.mpu_run, mpu_run);
+#endif
+
+ ret = mars_task_barrier_notify(args.barrier1_ea);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+ ret = mars_task_barrier_wait(args.barrier1_ea);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+#ifdef QUEUE_FULL
+ mars_test_usleep(args.tb_freq, DELAY);
+ reciever_time = mars_task_get_ticks();
+#endif
+ ret = mars_task_queue_pop(args.queue_ea, buf);
+#ifdef QUEUE_EMPTY
+ reciever_time = mars_task_get_ticks(); /*end time*/
+ mars_test_int32_put(args.shared_resources_ea[(uint32_t) buf[0]],
+ reciever_time);
+#endif
+#ifdef QUEUE_FULL
+ mars_test_int32_put(args.shared_resources_ea[id],
+ reciever_time);
+ mars_test_int32_put(args.mpu_run, ++mpu_run);
+#endif
+
+ /* wait at barrier untill all receivers have finished poping */
+ ret = mars_task_barrier_notify(args.barrier2_ea);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+ ret = mars_task_barrier_wait(args.barrier2_ea);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+
+ /*sync with host */
+ mars_test_counter_set(args.receiver_to_sender_ea, i * 2 + 1);
+ mars_test_counter_wait(args.sender_to_receiver_ea, i * 2 + 1);
+
+ }
+
+ return 0;
+}
diff --git a/tests/TPF/TPF_40_040/mpu4.c b/tests/TPF/TPF_40_040/mpu4.c
new file mode 100644
index 0000000..2c390af
--- /dev/null
+++ b/tests/TPF/TPF_40_040/mpu4.c
@@ -0,0 +1,24 @@
+/*
+ * Copyright 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 "../TPF_40_034/mpu4.c"
diff --git a/tests/TPF/TPF_40_040/mpu5.c b/tests/TPF/TPF_40_040/mpu5.c
new file mode 100644
index 0000000..6256783
--- /dev/null
+++ b/tests/TPF/TPF_40_040/mpu5.c
@@ -0,0 +1,91 @@
+/*
+ * Copyright 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 <malloc.h>
+#include <mars/task.h>
+#include <mars_test.h>
+#include <common.h>
+
+int mars_task_main(const struct mars_task_args *task_args)
+{
+ int ret, i, id, receivers, mpu_run;
+#ifndef QUEUE_INTERMEDIATE
+ uint32_t reciever_time;
+ char buf[ELEMENT_SIZE];
+#endif
+ static struct test_task_args_st args ALIGN128;
+
+ mfc_get(&args, task_args->type.u64[0], sizeof(struct test_task_args_st),
+ 0, 0, 0);
+ mfc_write_tag_mask(1);
+ mfc_read_tag_status_all();
+
+ id = atoi(mars_task_get_name());
+ receivers = mars_test_int32_get(args.receivers);
+
+ for (i = 0; i < TEST2_ELEMENT_COUNT; i++) {
+
+ /*sync with host */
+ mars_test_counter_set(args.receiver_to_sender_ea, i * 2);
+ mars_test_counter_wait(args.sender_to_receiver_ea, i * 2);
+
+ mpu_run = 0;
+#ifdef QUEUE_FULL
+ mars_test_int32_put(args.mpu_run, mpu_run);
+#endif
+
+ ret = mars_task_barrier_notify(args.barrier1_ea);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+ ret = mars_task_barrier_wait(args.barrier1_ea);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+
+#ifdef QUEUE_FULL
+ mars_test_usleep(args.tb_freq, DELAY);
+ ret = mars_task_queue_pop(args.queue_ea, buf);
+ reciever_time = mars_task_get_ticks(); /*this is the end time*/
+ mars_test_int32_put(args.shared_resources_ea[id],
+ reciever_time);
+#endif
+
+#ifdef QUEUE_EMPTY
+ ret = mars_task_queue_pop(args.queue_ea, buf);
+ reciever_time = mars_task_get_ticks(); /*this is the end time*/
+ mars_test_int32_put(args.shared_resources_ea[(uint32_t) buf[0]],
+ reciever_time);
+#endif
+
+ mars_test_int32_put(args.mpu_run, ++mpu_run);
+
+ ret = mars_task_barrier_notify(args.barrier2_ea);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+ ret = mars_task_barrier_wait(args.barrier2_ea);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+
+ /*sync with host */
+ mars_test_counter_set(args.receiver_to_sender_ea, i * 2 + 1);
+ mars_test_counter_wait(args.sender_to_receiver_ea, i * 2 + 1);
+
+ }
+
+ return 0;
+}
diff --git a/tests/TPF/TPF_40_040/mpu6.c b/tests/TPF/TPF_40_040/mpu6.c
new file mode 100644
index 0000000..8aa9939
--- /dev/null
+++ b/tests/TPF/TPF_40_040/mpu6.c
@@ -0,0 +1,24 @@
+/*
+ * Copyright 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 "../TPF_40_034/mpu6.c"
diff --git a/tests/TPF/TPF_40_041/Makefile b/tests/TPF/TPF_40_041/Makefile
new file mode 100644
index 0000000..1de70d4
--- /dev/null
+++ b/tests/TPF/TPF_40_041/Makefile
@@ -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.
+#
+
+EXTRA_LDFLAGS=-lm
+INCLUDE_CFLAGS+= -I./
+MPU_INCLUDE_CFLAGS+= -I./
+
+top_srcdir = ../..
+test_objs = host.o mpu1.task_eo mpu2.task_eo mpu3.task_eo \
+ mpu4.task_eo mpu5.task_eo mpu6.task_eo
+timeout = 120
+
+include $(top_srcdir)/scripts/config.mk
+include $(top_srcdir)/scripts/rules_item.mk
+include $(top_srcdir)/scripts/rules_tpf.mk
+
+host.o: common.h
+mpu1.task_o: common.h
+mpu2.task_o: common.h
+mpu3.task_o: common.h
+mpu4.task_o: common.h
+mpu5.task_o: common.h
+mpu6.task_o: common.h
+
+
+
diff --git a/tests/TPF/TPF_40_041/common.h b/tests/TPF/TPF_40_041/common.h
new file mode 100644
index 0000000..01cf5e2
--- /dev/null
+++ b/tests/TPF/TPF_40_041/common.h
@@ -0,0 +1,58 @@
+/*
+ * Copyright 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.
+ */
+
+
+#ifndef TEST_COMMON_H
+#define TEST_COMMON_H
+
+#include <mars/task.h>
+#include <mars_test.h>
+
+#define MAX_RECEIVERS 4
+#define QUEUE_DEPTH 64
+
+#define QUEUE_PRE_CONDITION 64
+#define QUEUE_FULL
+
+#define ELEMENT_SIZE 128
+#define TEST1_ELEMENT_COUNT 200
+#define TEST2_ELEMENT_COUNT 200
+#define TEST3_ELEMENT_COUNT 200
+
+#define ALIGN128 __attribute__((aligned(128)))
+
+struct test_task_args_st {
+ uint64_t queue_ea;
+ uint64_t sender_to_receiver_ea;
+ uint64_t receiver_to_sender_ea;
+ uint64_t shared_resources_ea[MAX_RECEIVERS];
+ uint64_t ticks1_ea;
+ uint64_t ticks2_ea;
+ uint64_t barrier1_ea;
+ uint64_t barrier2_ea;
+ uint32_t tb_freq;
+ uint32_t receivers;
+ uint32_t mpu_run;
+ uint8_t pad[8];
+};
+#endif
diff --git a/tests/TPF/TPF_40_041/host.c b/tests/TPF/TPF_40_041/host.c
new file mode 100644
index 0000000..177df38
--- /dev/null
+++ b/tests/TPF/TPF_40_041/host.c
@@ -0,0 +1,24 @@
+/*
+ * Copyright 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 "../TPF_40_040/host.c"
diff --git a/tests/TPF/TPF_40_041/mpu1.c b/tests/TPF/TPF_40_041/mpu1.c
new file mode 100644
index 0000000..a86f552
--- /dev/null
+++ b/tests/TPF/TPF_40_041/mpu1.c
@@ -0,0 +1,24 @@
+/*
+ * Copyright 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 "../TPF_40_040/mpu1.c"
diff --git a/tests/TPF/TPF_40_041/mpu2.c b/tests/TPF/TPF_40_041/mpu2.c
new file mode 100644
index 0000000..0f29f7d
--- /dev/null
+++ b/tests/TPF/TPF_40_041/mpu2.c
@@ -0,0 +1,24 @@
+/*
+ * Copyright 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 "../TPF_40_034/mpu2.c"
diff --git a/tests/TPF/TPF_40_041/mpu3.c b/tests/TPF/TPF_40_041/mpu3.c
new file mode 100644
index 0000000..eb5a959
--- /dev/null
+++ b/tests/TPF/TPF_40_041/mpu3.c
@@ -0,0 +1,24 @@
+/*
+ * Copyright 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 "../TPF_40_040/mpu3.c"
diff --git a/tests/TPF/TPF_40_041/mpu4.c b/tests/TPF/TPF_40_041/mpu4.c
new file mode 100644
index 0000000..2c390af
--- /dev/null
+++ b/tests/TPF/TPF_40_041/mpu4.c
@@ -0,0 +1,24 @@
+/*
+ * Copyright 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 "../TPF_40_034/mpu4.c"
diff --git a/tests/TPF/TPF_40_041/mpu5.c b/tests/TPF/TPF_40_041/mpu5.c
new file mode 100644
index 0000000..f4e5215
--- /dev/null
+++ b/tests/TPF/TPF_40_041/mpu5.c
@@ -0,0 +1,24 @@
+/*
+ * Copyright 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 "../TPF_40_040/mpu5.c"
diff --git a/tests/TPF/TPF_40_041/mpu6.c b/tests/TPF/TPF_40_041/mpu6.c
new file mode 100644
index 0000000..8aa9939
--- /dev/null
+++ b/tests/TPF/TPF_40_041/mpu6.c
@@ -0,0 +1,24 @@
+/*
+ * Copyright 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 "../TPF_40_034/mpu6.c"
diff --git a/tests/TPF/TPF_40_042/Makefile b/tests/TPF/TPF_40_042/Makefile
new file mode 100644
index 0000000..1de70d4
--- /dev/null
+++ b/tests/TPF/TPF_40_042/Makefile
@@ -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.
+#
+
+EXTRA_LDFLAGS=-lm
+INCLUDE_CFLAGS+= -I./
+MPU_INCLUDE_CFLAGS+= -I./
+
+top_srcdir = ../..
+test_objs = host.o mpu1.task_eo mpu2.task_eo mpu3.task_eo \
+ mpu4.task_eo mpu5.task_eo mpu6.task_eo
+timeout = 120
+
+include $(top_srcdir)/scripts/config.mk
+include $(top_srcdir)/scripts/rules_item.mk
+include $(top_srcdir)/scripts/rules_tpf.mk
+
+host.o: common.h
+mpu1.task_o: common.h
+mpu2.task_o: common.h
+mpu3.task_o: common.h
+mpu4.task_o: common.h
+mpu5.task_o: common.h
+mpu6.task_o: common.h
+
+
+
diff --git a/tests/TPF/TPF_40_042/common.h b/tests/TPF/TPF_40_042/common.h
new file mode 100644
index 0000000..156aae9
--- /dev/null
+++ b/tests/TPF/TPF_40_042/common.h
@@ -0,0 +1,58 @@
+/*
+ * Copyright 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.
+ */
+
+
+#ifndef TEST_COMMON_H
+#define TEST_COMMON_H
+
+#include <mars/task.h>
+#include <mars_test.h>
+
+#define MAX_RECEIVERS 4
+#define QUEUE_DEPTH 64
+
+#define QUEUE_PRE_CONDITION 32
+#define QUEUE_INTERMEDIATE
+
+#define ELEMENT_SIZE 128
+#define TEST1_ELEMENT_COUNT 200
+#define TEST2_ELEMENT_COUNT 200
+#define TEST3_ELEMENT_COUNT 200
+
+#define ALIGN128 __attribute__((aligned(128)))
+
+struct test_task_args_st {
+ uint64_t queue_ea;
+ uint64_t sender_to_receiver_ea;
+ uint64_t receiver_to_sender_ea;
+ uint64_t shared_resources_ea[MAX_RECEIVERS];
+ uint64_t ticks1_ea;
+ uint64_t ticks2_ea;
+ uint64_t barrier1_ea;
+ uint64_t barrier2_ea;
+ uint32_t tb_freq;
+ uint32_t receivers;
+ uint32_t mpu_run;
+ uint8_t pad[8];
+};
+#endif
diff --git a/tests/TPF/TPF_40_042/host.c b/tests/TPF/TPF_40_042/host.c
new file mode 100644
index 0000000..177df38
--- /dev/null
+++ b/tests/TPF/TPF_40_042/host.c
@@ -0,0 +1,24 @@
+/*
+ * Copyright 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 "../TPF_40_040/host.c"
diff --git a/tests/TPF/TPF_40_042/mpu1.c b/tests/TPF/TPF_40_042/mpu1.c
new file mode 100644
index 0000000..a86f552
--- /dev/null
+++ b/tests/TPF/TPF_40_042/mpu1.c
@@ -0,0 +1,24 @@
+/*
+ * Copyright 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 "../TPF_40_040/mpu1.c"
diff --git a/tests/TPF/TPF_40_042/mpu2.c b/tests/TPF/TPF_40_042/mpu2.c
new file mode 100644
index 0000000..0f29f7d
--- /dev/null
+++ b/tests/TPF/TPF_40_042/mpu2.c
@@ -0,0 +1,24 @@
+/*
+ * Copyright 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 "../TPF_40_034/mpu2.c"
diff --git a/tests/TPF/TPF_40_042/mpu3.c b/tests/TPF/TPF_40_042/mpu3.c
new file mode 100644
index 0000000..eb5a959
--- /dev/null
+++ b/tests/TPF/TPF_40_042/mpu3.c
@@ -0,0 +1,24 @@
+/*
+ * Copyright 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 "../TPF_40_040/mpu3.c"
diff --git a/tests/TPF/TPF_40_042/mpu4.c b/tests/TPF/TPF_40_042/mpu4.c
new file mode 100644
index 0000000..2c390af
--- /dev/null
+++ b/tests/TPF/TPF_40_042/mpu4.c
@@ -0,0 +1,24 @@
+/*
+ * Copyright 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 "../TPF_40_034/mpu4.c"
diff --git a/tests/TPF/TPF_40_042/mpu5.c b/tests/TPF/TPF_40_042/mpu5.c
new file mode 100644
index 0000000..f4e5215
--- /dev/null
+++ b/tests/TPF/TPF_40_042/mpu5.c
@@ -0,0 +1,24 @@
+/*
+ * Copyright 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 "../TPF_40_040/mpu5.c"
diff --git a/tests/TPF/TPF_40_042/mpu6.c b/tests/TPF/TPF_40_042/mpu6.c
new file mode 100644
index 0000000..8aa9939
--- /dev/null
+++ b/tests/TPF/TPF_40_042/mpu6.c
@@ -0,0 +1,24 @@
+/*
+ * Copyright 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 "../TPF_40_034/mpu6.c"
diff --git a/tests/TPF/TPF_40_043/Makefile b/tests/TPF/TPF_40_043/Makefile
new file mode 100644
index 0000000..1de70d4
--- /dev/null
+++ b/tests/TPF/TPF_40_043/Makefile
@@ -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.
+#
+
+EXTRA_LDFLAGS=-lm
+INCLUDE_CFLAGS+= -I./
+MPU_INCLUDE_CFLAGS+= -I./
+
+top_srcdir = ../..
+test_objs = host.o mpu1.task_eo mpu2.task_eo mpu3.task_eo \
+ mpu4.task_eo mpu5.task_eo mpu6.task_eo
+timeout = 120
+
+include $(top_srcdir)/scripts/config.mk
+include $(top_srcdir)/scripts/rules_item.mk
+include $(top_srcdir)/scripts/rules_tpf.mk
+
+host.o: common.h
+mpu1.task_o: common.h
+mpu2.task_o: common.h
+mpu3.task_o: common.h
+mpu4.task_o: common.h
+mpu5.task_o: common.h
+mpu6.task_o: common.h
+
+
+
diff --git a/tests/TPF/TPF_40_043/common.h b/tests/TPF/TPF_40_043/common.h
new file mode 100644
index 0000000..ff1fbe6
--- /dev/null
+++ b/tests/TPF/TPF_40_043/common.h
@@ -0,0 +1,58 @@
+/*
+ * Copyright 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.
+ */
+
+
+#ifndef TEST_COMMON_H
+#define TEST_COMMON_H
+
+#include <mars/task.h>
+#include <mars_test.h>
+
+#define MAX_RECEIVERS 16
+#define QUEUE_DEPTH 64
+
+#define QUEUE_PRE_CONDITION 0
+#define QUEUE_EMPTY
+
+#define ELEMENT_SIZE 128
+#define TEST1_ELEMENT_COUNT 400
+#define TEST2_ELEMENT_COUNT 400
+#define TEST3_ELEMENT_COUNT 400
+
+#define ALIGN128 __attribute__((aligned(128)))
+
+struct test_task_args_st {
+ uint64_t queue_ea;
+ uint64_t sender_to_receiver_ea;
+ uint64_t receiver_to_sender_ea;
+ uint64_t shared_resources_ea[MAX_RECEIVERS];
+ uint64_t ticks1_ea;
+ uint64_t ticks2_ea;
+ uint64_t barrier1_ea;
+ uint64_t barrier2_ea;
+ uint32_t tb_freq;
+ uint32_t receivers;
+ uint32_t mpu_run;
+ uint8_t pad[8];
+};
+#endif
diff --git a/tests/TPF/TPF_40_043/host.c b/tests/TPF/TPF_40_043/host.c
new file mode 100644
index 0000000..177df38
--- /dev/null
+++ b/tests/TPF/TPF_40_043/host.c
@@ -0,0 +1,24 @@
+/*
+ * Copyright 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 "../TPF_40_040/host.c"
diff --git a/tests/TPF/TPF_40_043/mpu1.c b/tests/TPF/TPF_40_043/mpu1.c
new file mode 100644
index 0000000..a86f552
--- /dev/null
+++ b/tests/TPF/TPF_40_043/mpu1.c
@@ -0,0 +1,24 @@
+/*
+ * Copyright 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 "../TPF_40_040/mpu1.c"
diff --git a/tests/TPF/TPF_40_043/mpu2.c b/tests/TPF/TPF_40_043/mpu2.c
new file mode 100644
index 0000000..0f29f7d
--- /dev/null
+++ b/tests/TPF/TPF_40_043/mpu2.c
@@ -0,0 +1,24 @@
+/*
+ * Copyright 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 "../TPF_40_034/mpu2.c"
diff --git a/tests/TPF/TPF_40_043/mpu3.c b/tests/TPF/TPF_40_043/mpu3.c
new file mode 100644
index 0000000..eb5a959
--- /dev/null
+++ b/tests/TPF/TPF_40_043/mpu3.c
@@ -0,0 +1,24 @@
+/*
+ * Copyright 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 "../TPF_40_040/mpu3.c"
diff --git a/tests/TPF/TPF_40_043/mpu4.c b/tests/TPF/TPF_40_043/mpu4.c
new file mode 100644
index 0000000..2c390af
--- /dev/null
+++ b/tests/TPF/TPF_40_043/mpu4.c
@@ -0,0 +1,24 @@
+/*
+ * Copyright 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 "../TPF_40_034/mpu4.c"
diff --git a/tests/TPF/TPF_40_043/mpu5.c b/tests/TPF/TPF_40_043/mpu5.c
new file mode 100644
index 0000000..f4e5215
--- /dev/null
+++ b/tests/TPF/TPF_40_043/mpu5.c
@@ -0,0 +1,24 @@
+/*
+ * Copyright 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 "../TPF_40_040/mpu5.c"
diff --git a/tests/TPF/TPF_40_043/mpu6.c b/tests/TPF/TPF_40_043/mpu6.c
new file mode 100644
index 0000000..8aa9939
--- /dev/null
+++ b/tests/TPF/TPF_40_043/mpu6.c
@@ -0,0 +1,24 @@
+/*
+ * Copyright 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 "../TPF_40_034/mpu6.c"
diff --git a/tests/TPF/TPF_40_044/Makefile b/tests/TPF/TPF_40_044/Makefile
new file mode 100644
index 0000000..1de70d4
--- /dev/null
+++ b/tests/TPF/TPF_40_044/Makefile
@@ -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.
+#
+
+EXTRA_LDFLAGS=-lm
+INCLUDE_CFLAGS+= -I./
+MPU_INCLUDE_CFLAGS+= -I./
+
+top_srcdir = ../..
+test_objs = host.o mpu1.task_eo mpu2.task_eo mpu3.task_eo \
+ mpu4.task_eo mpu5.task_eo mpu6.task_eo
+timeout = 120
+
+include $(top_srcdir)/scripts/config.mk
+include $(top_srcdir)/scripts/rules_item.mk
+include $(top_srcdir)/scripts/rules_tpf.mk
+
+host.o: common.h
+mpu1.task_o: common.h
+mpu2.task_o: common.h
+mpu3.task_o: common.h
+mpu4.task_o: common.h
+mpu5.task_o: common.h
+mpu6.task_o: common.h
+
+
+
diff --git a/tests/TPF/TPF_40_044/common.h b/tests/TPF/TPF_40_044/common.h
new file mode 100644
index 0000000..873a513
--- /dev/null
+++ b/tests/TPF/TPF_40_044/common.h
@@ -0,0 +1,58 @@
+/*
+ * Copyright 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.
+ */
+
+
+#ifndef TEST_COMMON_H
+#define TEST_COMMON_H
+
+#include <mars/task.h>
+#include <mars_test.h>
+
+#define MAX_RECEIVERS 16
+#define QUEUE_DEPTH 64
+
+#define QUEUE_PRE_CONDITION 64
+#define QUEUE_FULL
+
+#define ELEMENT_SIZE 128
+#define TEST1_ELEMENT_COUNT 400
+#define TEST2_ELEMENT_COUNT 400
+#define TEST3_ELEMENT_COUNT 400
+
+#define ALIGN128 __attribute__((aligned(128)))
+
+struct test_task_args_st {
+ uint64_t queue_ea;
+ uint64_t sender_to_receiver_ea;
+ uint64_t receiver_to_sender_ea;
+ uint64_t shared_resources_ea[MAX_RECEIVERS];
+ uint64_t ticks1_ea;
+ uint64_t ticks2_ea;
+ uint64_t barrier1_ea;
+ uint64_t barrier2_ea;
+ uint32_t tb_freq;
+ uint32_t receivers;
+ uint32_t mpu_run;
+ uint8_t pad[8];
+};
+#endif
diff --git a/tests/TPF/TPF_40_044/host.c b/tests/TPF/TPF_40_044/host.c
new file mode 100644
index 0000000..177df38
--- /dev/null
+++ b/tests/TPF/TPF_40_044/host.c
@@ -0,0 +1,24 @@
+/*
+ * Copyright 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 "../TPF_40_040/host.c"
diff --git a/tests/TPF/TPF_40_044/mpu1.c b/tests/TPF/TPF_40_044/mpu1.c
new file mode 100644
index 0000000..a86f552
--- /dev/null
+++ b/tests/TPF/TPF_40_044/mpu1.c
@@ -0,0 +1,24 @@
+/*
+ * Copyright 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 "../TPF_40_040/mpu1.c"
diff --git a/tests/TPF/TPF_40_044/mpu2.c b/tests/TPF/TPF_40_044/mpu2.c
new file mode 100644
index 0000000..0f29f7d
--- /dev/null
+++ b/tests/TPF/TPF_40_044/mpu2.c
@@ -0,0 +1,24 @@
+/*
+ * Copyright 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 "../TPF_40_034/mpu2.c"
diff --git a/tests/TPF/TPF_40_044/mpu3.c b/tests/TPF/TPF_40_044/mpu3.c
new file mode 100644
index 0000000..eb5a959
--- /dev/null
+++ b/tests/TPF/TPF_40_044/mpu3.c
@@ -0,0 +1,24 @@
+/*
+ * Copyright 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 "../TPF_40_040/mpu3.c"
diff --git a/tests/TPF/TPF_40_044/mpu4.c b/tests/TPF/TPF_40_044/mpu4.c
new file mode 100644
index 0000000..2c390af
--- /dev/null
+++ b/tests/TPF/TPF_40_044/mpu4.c
@@ -0,0 +1,24 @@
+/*
+ * Copyright 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 "../TPF_40_034/mpu4.c"
diff --git a/tests/TPF/TPF_40_044/mpu5.c b/tests/TPF/TPF_40_044/mpu5.c
new file mode 100644
index 0000000..f4e5215
--- /dev/null
+++ b/tests/TPF/TPF_40_044/mpu5.c
@@ -0,0 +1,24 @@
+/*
+ * Copyright 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 "../TPF_40_040/mpu5.c"
diff --git a/tests/TPF/TPF_40_044/mpu6.c b/tests/TPF/TPF_40_044/mpu6.c
new file mode 100644
index 0000000..8aa9939
--- /dev/null
+++ b/tests/TPF/TPF_40_044/mpu6.c
@@ -0,0 +1,24 @@
+/*
+ * Copyright 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 "../TPF_40_034/mpu6.c"
diff --git a/tests/TPF/TPF_40_045/Makefile b/tests/TPF/TPF_40_045/Makefile
new file mode 100644
index 0000000..1de70d4
--- /dev/null
+++ b/tests/TPF/TPF_40_045/Makefile
@@ -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.
+#
+
+EXTRA_LDFLAGS=-lm
+INCLUDE_CFLAGS+= -I./
+MPU_INCLUDE_CFLAGS+= -I./
+
+top_srcdir = ../..
+test_objs = host.o mpu1.task_eo mpu2.task_eo mpu3.task_eo \
+ mpu4.task_eo mpu5.task_eo mpu6.task_eo
+timeout = 120
+
+include $(top_srcdir)/scripts/config.mk
+include $(top_srcdir)/scripts/rules_item.mk
+include $(top_srcdir)/scripts/rules_tpf.mk
+
+host.o: common.h
+mpu1.task_o: common.h
+mpu2.task_o: common.h
+mpu3.task_o: common.h
+mpu4.task_o: common.h
+mpu5.task_o: common.h
+mpu6.task_o: common.h
+
+
+
diff --git a/tests/TPF/TPF_40_045/common.h b/tests/TPF/TPF_40_045/common.h
new file mode 100644
index 0000000..350ae44
--- /dev/null
+++ b/tests/TPF/TPF_40_045/common.h
@@ -0,0 +1,58 @@
+/*
+ * Copyright 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.
+ */
+
+
+#ifndef TEST_COMMON_H
+#define TEST_COMMON_H
+
+#include <mars/task.h>
+#include <mars_test.h>
+
+#define MAX_RECEIVERS 16
+#define QUEUE_DEPTH 64
+
+#define QUEUE_PRE_CONDITION 32
+#define QUEUE_INTERMEDIATE
+
+#define ELEMENT_SIZE 128
+#define TEST1_ELEMENT_COUNT 400
+#define TEST2_ELEMENT_COUNT 400
+#define TEST3_ELEMENT_COUNT 400
+
+#define ALIGN128 __attribute__((aligned(128)))
+
+struct test_task_args_st {
+ uint64_t queue_ea;
+ uint64_t sender_to_receiver_ea;
+ uint64_t receiver_to_sender_ea;
+ uint64_t shared_resources_ea[MAX_RECEIVERS];
+ uint64_t ticks1_ea;
+ uint64_t ticks2_ea;
+ uint64_t barrier1_ea;
+ uint64_t barrier2_ea;
+ uint32_t tb_freq;
+ uint32_t receivers;
+ uint32_t mpu_run;
+ uint8_t pad[8];
+};
+#endif
diff --git a/tests/TPF/TPF_40_045/host.c b/tests/TPF/TPF_40_045/host.c
new file mode 100644
index 0000000..177df38
--- /dev/null
+++ b/tests/TPF/TPF_40_045/host.c
@@ -0,0 +1,24 @@
+/*
+ * Copyright 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 "../TPF_40_040/host.c"
diff --git a/tests/TPF/TPF_40_045/mpu1.c b/tests/TPF/TPF_40_045/mpu1.c
new file mode 100644
index 0000000..a86f552
--- /dev/null
+++ b/tests/TPF/TPF_40_045/mpu1.c
@@ -0,0 +1,24 @@
+/*
+ * Copyright 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 "../TPF_40_040/mpu1.c"
diff --git a/tests/TPF/TPF_40_045/mpu2.c b/tests/TPF/TPF_40_045/mpu2.c
new file mode 100644
index 0000000..0f29f7d
--- /dev/null
+++ b/tests/TPF/TPF_40_045/mpu2.c
@@ -0,0 +1,24 @@
+/*
+ * Copyright 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 "../TPF_40_034/mpu2.c"
diff --git a/tests/TPF/TPF_40_045/mpu3.c b/tests/TPF/TPF_40_045/mpu3.c
new file mode 100644
index 0000000..eb5a959
--- /dev/null
+++ b/tests/TPF/TPF_40_045/mpu3.c
@@ -0,0 +1,24 @@
+/*
+ * Copyright 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 "../TPF_40_040/mpu3.c"
diff --git a/tests/TPF/TPF_40_045/mpu4.c b/tests/TPF/TPF_40_045/mpu4.c
new file mode 100644
index 0000000..2c390af
--- /dev/null
+++ b/tests/TPF/TPF_40_045/mpu4.c
@@ -0,0 +1,24 @@
+/*
+ * Copyright 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 "../TPF_40_034/mpu4.c"
diff --git a/tests/TPF/TPF_40_045/mpu5.c b/tests/TPF/TPF_40_045/mpu5.c
new file mode 100644
index 0000000..f4e5215
--- /dev/null
+++ b/tests/TPF/TPF_40_045/mpu5.c
@@ -0,0 +1,24 @@
+/*
+ * Copyright 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 "../TPF_40_040/mpu5.c"
diff --git a/tests/TPF/TPF_40_045/mpu6.c b/tests/TPF/TPF_40_045/mpu6.c
new file mode 100644
index 0000000..8aa9939
--- /dev/null
+++ b/tests/TPF/TPF_40_045/mpu6.c
@@ -0,0 +1,24 @@
+/*
+ * Copyright 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 "../TPF_40_034/mpu6.c"
diff --git a/tests/TPF/TPF_50_001/Makefile b/tests/TPF/TPF_50_001/Makefile
new file mode 100644
index 0000000..a856922
--- /dev/null
+++ b/tests/TPF/TPF_50_001/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 mpu1.task_eo mpu2.task_eo
+
+EXTRA_LDFLAGS=-lm
+
+include $(top_srcdir)/scripts/config.mk
+include $(top_srcdir)/scripts/rules_item.mk
+include $(top_srcdir)/scripts/rules_tpf.mk
diff --git a/tests/TPF/TPF_50_001/common.h b/tests/TPF/TPF_50_001/common.h
new file mode 100644
index 0000000..0d0c0d1
--- /dev/null
+++ b/tests/TPF/TPF_50_001/common.h
@@ -0,0 +1,32 @@
+/*
+ * 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 LOOP_COUNT 4096
+#define ALIGN128 __attribute__((aligned(128)))
+struct test_task_args_st {
+ uint64_t semaphore_ea;
+ uint64_t shared_resource_ea;
+ uint64_t ticks1_ea;
+ uint64_t ticks2_ea;
+};
diff --git a/tests/TPF/TPF_50_001/host.c b/tests/TPF/TPF_50_001/host.c
new file mode 100644
index 0000000..48c88dd
--- /dev/null
+++ b/tests/TPF/TPF_50_001/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 <libspe2.h>
+#include <mars/task.h>
+#include <mars_test.h>
+#include "common.h"
+extern spe_program_handle_t mpu1_prog, mpu2_prog ALIGN128;
+
+static struct mars_task_args task_args;
+
+int test1(void)
+{
+ int exit_code, ret;
+ int32_t acquire[LOOP_COUNT] ALIGN128;
+ int32_t release[LOOP_COUNT] ALIGN128;
+
+ struct test_task_args_st args ALIGN128;
+
+ uint64_t semaphore ALIGN128;
+ int spe_cnt = spe_cpu_info_get(SPE_COUNT_PHYSICAL_SPES, -1);
+
+ static struct mars_context *mars ALIGN128;
+ static struct mars_task_id task_id ALIGN128;
+
+ ret = mars_context_create(&mars, spe_cnt, 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_task_create(mars, &task_id, "50001", mpu1_prog.elf_image,
+ MARS_TASK_CONTEXT_SAVE_SIZE_MAX);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+
+ args.semaphore_ea = semaphore;
+ args.ticks1_ea = mars_ptr_to_ea(acquire);
+ args.ticks2_ea = mars_ptr_to_ea(release);
+ task_args.type.u64[0] = mars_ptr_to_ea(&args);
+
+ 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_task_semaphore_destroy(semaphore);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+
+ ret = mars_context_destroy(mars);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+
+ mars_test_print_statistics(acquire, LOOP_COUNT,
+ "single semaphore: acquire");
+ mars_test_print_statistics(release, LOOP_COUNT,
+ "single semaphore: release");
+
+ return 0;
+}
+
+int test2(void)
+{
+ static struct mars_context *mars;
+ static struct mars_task_id task_id;
+ int exit_code, ret;
+ uint64_t semaphore ALIGN128;
+ int32_t acquire[LOOP_COUNT], release[LOOP_COUNT];
+
+ struct test_task_args_st args ALIGN128;
+ 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_task_semaphore_create(mars, &semaphore, 50);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+
+ ret = mars_task_create(mars, &task_id, "50001", mpu2_prog.elf_image,
+ MARS_TASK_CONTEXT_SAVE_SIZE_MAX);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+
+ args.semaphore_ea = semaphore;
+ args.ticks1_ea = mars_ptr_to_ea(acquire);
+ args.ticks2_ea = mars_ptr_to_ea(release);
+ task_args.type.u64[0] = mars_ptr_to_ea(&args);
+
+ 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_task_semaphore_destroy(semaphore);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+
+ ret = mars_context_destroy(mars);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+
+ mars_test_print_statistics(acquire, LOOP_COUNT,
+ "max_wait semaphore: acquire");
+ mars_test_print_statistics(release, LOOP_COUNT,
+ "max_wait semaphore: release");
+ return 0;
+}
+
+int main(void)
+{
+ int ret;
+ ret = test1();
+ ret = test2();
+
+ return 0;
+}
diff --git a/tests/TPF/TPF_50_001/mpu1.c b/tests/TPF/TPF_50_001/mpu1.c
new file mode 100644
index 0000000..0e31ee8
--- /dev/null
+++ b/tests/TPF/TPF_50_001/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/task.h>
+#include "mars_task_test.h"
+#include "common.h"
+
+int mars_task_main(const struct mars_task_args *task_args)
+{
+ int i, ret, acquire[LOOP_COUNT], release[LOOP_COUNT];
+ int t1, t2, t3, t4;
+ struct test_task_args_st args ALIGN128;
+
+ mfc_get(&args, task_args->type.u64[0], sizeof(struct test_task_args_st),
+ 0, 0, 0);
+ mfc_write_tag_mask(1);
+ mfc_read_tag_status_all();
+
+ for (i = 0; i < LOOP_COUNT; i++) {
+ t1 = mars_task_get_ticks();
+ ret = mars_task_semaphore_acquire(args.semaphore_ea);
+ t2 = mars_task_get_ticks();
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+
+ t3 = mars_task_get_ticks();
+ ret = mars_task_semaphore_release(args.semaphore_ea);
+ t4 = mars_task_get_ticks();
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+ acquire[i] = t2 - t1;
+ release[i] = t4 - t3;
+ }
+
+ mfc_put(acquire, args.ticks1_ea, LOOP_COUNT * 4, 0, 0, 0);
+ mfc_write_tag_mask(1);
+ mfc_read_tag_status_all();
+
+ mfc_put(release, args.ticks2_ea, LOOP_COUNT * 4, 0, 0, 0);
+ mfc_write_tag_mask(1);
+ mfc_read_tag_status_all();
+
+ mars_task_exit(0);
+
+ return 0;
+}
diff --git a/tests/TPF/TPF_50_001/mpu2.c b/tests/TPF/TPF_50_001/mpu2.c
new file mode 100644
index 0000000..1333396
--- /dev/null
+++ b/tests/TPF/TPF_50_001/mpu2.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 <mars/task.h>
+#include "mars_task_test.h"
+#include "common.h"
+
+int mars_task_main(const struct mars_task_args *task_args)
+{
+ int i, j, ret, acquire[LOOP_COUNT], release[LOOP_COUNT];
+ int t1, t2, t3, t4;
+ struct test_task_args_st args ALIGN128;
+
+ mfc_get(&args, task_args->type.u64[0], sizeof(struct test_task_args_st),
+ 0, 0, 0);
+ mfc_write_tag_mask(1);
+ mfc_read_tag_status_all();
+
+ for (i = 0; i < LOOP_COUNT; i++) {
+ t1 = mars_task_get_ticks();
+ for (j = 0; j < 50; j++) {
+ ret = mars_task_semaphore_acquire(args.semaphore_ea);
+ }
+ t2 = mars_task_get_ticks();
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+
+ t3 = mars_task_get_ticks();
+ for (j = 0; j < 50; j++) {
+ ret = mars_task_semaphore_release(args.semaphore_ea);
+ }
+ t4 = mars_task_get_ticks();
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+ acquire[i] = (t2 - t1) / 50;
+ release[i] = (t4 - t3) / 50;
+ }
+
+ mfc_put(acquire, args.ticks1_ea, LOOP_COUNT * 4, 0, 0, 0);
+ mfc_write_tag_mask(1);
+ mfc_read_tag_status_all();
+
+ mfc_put(release, args.ticks2_ea, LOOP_COUNT * 4, 0, 0, 0);
+ mfc_write_tag_mask(1);
+ mfc_read_tag_status_all();
+
+ mars_task_exit(0);
+
+ return 0;
+}
diff --git a/tests/TPF/TPF_50_002/Makefile b/tests/TPF/TPF_50_002/Makefile
new file mode 100644
index 0000000..dc68b86
--- /dev/null
+++ b/tests/TPF/TPF_50_002/Makefile
@@ -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.
+#
+
+EXTRA_LDFLAGS=-lm
+INCLUDE_CFLAGS+= -I./
+MPU_INCLUDE_CFLAGS+= -I./
+
+top_srcdir = ../..
+test_objs = host.o mpu1.task_eo mpu2.task_eo
+timeout = 120
+
+include $(top_srcdir)/scripts/config.mk
+include $(top_srcdir)/scripts/rules_item.mk
+include $(top_srcdir)/scripts/rules_tpf.mk
+
+host.o: common.h
+mpu1.task_o: common.h
+mpu2.task_o: common.h
diff --git a/tests/TPF/TPF_50_002/common.h b/tests/TPF/TPF_50_002/common.h
new file mode 100644
index 0000000..b53b742
--- /dev/null
+++ b/tests/TPF/TPF_50_002/common.h
@@ -0,0 +1,46 @@
+/*
+ * Copyright 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/task.h>
+#include <mars_test.h>
+
+#define MIN_MPUS 2
+#define MAX_MPUS spe/2
+
+#define QUEUE_DEPTH 16
+#define ELEMENT_SIZE 128
+#define TEST1_ELEMENT_COUNT 4096
+#define TEST2_ELEMENT_COUNT 4096
+#define TEST3_ELEMENT_COUNT 4096
+
+#define ALIGN128 __attribute__((aligned(128)))
+
+struct test_task_args_st {
+ uint64_t semaphore_ea;
+ uint64_t barrier_ea;
+ uint64_t ticks1_ea;
+ uint64_t ticks2_ea;
+ uint32_t semaphore_count_ea;
+ uint32_t pad[3];
+};
+
diff --git a/tests/TPF/TPF_50_002/host.c b/tests/TPF/TPF_50_002/host.c
new file mode 100644
index 0000000..749187a
--- /dev/null
+++ b/tests/TPF/TPF_50_002/host.c
@@ -0,0 +1,226 @@
+/*
+ * Copyright 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 <pthread.h>
+#include <libspe2.h>
+#include <mars/task.h>
+#include <mars_test.h>
+#include <common.h>
+
+extern spe_program_handle_t mpu1_prog, mpu2_prog;
+
+struct thread_arg_st {
+ int32_t *ticks1;
+ int32_t *ticks2;
+ uint32_t semaphore_count;
+ struct mars_context *mars_ctx;
+};
+
+void *test_thread(void *arg)
+{
+ int ret;
+ struct thread_arg_st *thread_arg = arg;
+ int32_t *acquire_ticks = thread_arg->ticks1;
+ int32_t *release_ticks = thread_arg->ticks2;
+ uint32_t semaphore_count = thread_arg->semaphore_count;
+ struct mars_context *mars_ctx = thread_arg->mars_ctx;
+ struct mars_task_id task_id_acquire, task_id_release;
+ struct mars_task_args task_args_acquire, task_args_release;
+ static __thread struct test_task_args_st args ALIGN128;
+ uint64_t barrier;
+ uint64_t semaphore;
+
+ ret = mars_task_create(mars_ctx, &task_id_acquire, NULL,
+ mpu1_prog.elf_image,
+ MARS_TASK_CONTEXT_SAVE_SIZE_MAX);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+
+ ret = mars_task_create(mars_ctx, &task_id_release, NULL,
+ mpu2_prog.elf_image,
+ MARS_TASK_CONTEXT_SAVE_SIZE_MAX);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+
+ ret = mars_task_barrier_create(mars_ctx, &barrier, 2);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+
+ ret = mars_task_semaphore_create(mars_ctx, &semaphore, semaphore_count);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+
+ args.barrier_ea = barrier;
+ args.semaphore_ea = semaphore;
+ args.ticks1_ea = mars_ptr_to_ea(acquire_ticks);
+ args.ticks2_ea = mars_ptr_to_ea(release_ticks);
+ args.semaphore_count_ea = mars_ptr_to_ea(&semaphore_count);
+ task_args_acquire.type.u64[0] = mars_ptr_to_ea(&args);
+ task_args_release.type.u64[0] = mars_ptr_to_ea(&args);
+
+ ret = mars_task_schedule(&task_id_acquire, &task_args_acquire, 0);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+
+ ret = mars_task_schedule(&task_id_release, &task_args_release, 0);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+
+ ret = mars_task_wait(&task_id_acquire, NULL);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+
+ ret = mars_task_wait(&task_id_release, NULL);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+
+ ret = mars_task_barrier_destroy(barrier);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+
+ ret = mars_task_semaphore_destroy(semaphore);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+
+ ret = mars_task_destroy(&task_id_acquire);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+
+ ret = mars_task_destroy(&task_id_release);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+
+ return NULL;
+}
+
+void test1(int mpu, pthread_t * threads, struct thread_arg_st *thread_args)
+{
+ int ret, i;
+ size_t size;
+ char text[128];
+ int32_t *acquire_ticks, *release_ticks;
+ struct mars_context *mars_ctx;
+
+ size = sizeof(uint32_t) * TEST1_ELEMENT_COUNT * mpu;
+
+ ret = posix_memalign((void **)&acquire_ticks, 128, size);
+ MARS_TEST_ASSERT_EQUAL(ret, 0);
+
+ ret = posix_memalign((void **)&release_ticks, 128, size);
+ MARS_TEST_ASSERT_EQUAL(ret, 0);
+
+ ret = mars_context_create(&mars_ctx, 0, 1);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+
+ for (i = 0; i < mpu; i++) {
+ thread_args[i].ticks1 = &acquire_ticks[TEST1_ELEMENT_COUNT * i];
+ thread_args[i].ticks2 = &release_ticks[TEST1_ELEMENT_COUNT * i];
+ thread_args[i].mars_ctx = mars_ctx;
+ thread_args[i].semaphore_count = 1;
+ ret = pthread_create(&threads[i], NULL,
+ test_thread, &thread_args[i]);
+ MARS_TEST_ASSERT_EQUAL(ret, 0);
+ }
+
+ for (i = 0; i < mpu; i++) {
+ ret = pthread_join(threads[i], NULL);
+ MARS_TEST_ASSERT_EQUAL(ret, 0);
+ }
+
+ ret = mars_context_destroy(mars_ctx);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+
+ size = TEST1_ELEMENT_COUNT * mpu;
+ sprintf(text,"single semaphore: acquire (%d mpu paris)",mpu);
+ mars_test_print_statistics(acquire_ticks, size, text);
+ sprintf(text,"single semaphore: release (%d mpu pairs)",mpu);
+ mars_test_print_statistics(release_ticks, size, text);
+
+ free(acquire_ticks);
+ free(release_ticks);
+}
+
+void test2(int mpu, pthread_t * threads, struct thread_arg_st *thread_args)
+{
+ int ret, i;
+ size_t size;
+ char text[128];
+ int32_t *acquire_ticks, *release_ticks;
+ struct mars_context *mars_ctx;
+
+ size = sizeof(uint32_t) * TEST1_ELEMENT_COUNT * mpu;
+
+ ret = posix_memalign((void **)&acquire_ticks, 128, size);
+ MARS_TEST_ASSERT_EQUAL(ret, 0);
+
+ ret = posix_memalign((void **)&release_ticks, 128, size);
+ MARS_TEST_ASSERT_EQUAL(ret, 0);
+
+ ret = mars_context_create(&mars_ctx, 0, 1);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+
+ for (i = 0; i < mpu; i++) {
+ thread_args[i].ticks1 = &acquire_ticks[TEST1_ELEMENT_COUNT * i];
+ thread_args[i].ticks2 = &release_ticks[TEST1_ELEMENT_COUNT * i];
+ thread_args[i].mars_ctx = mars_ctx;
+ thread_args[i].semaphore_count = MARS_TASK_SEMAPHORE_WAIT_MAX;
+ ret = pthread_create(&threads[i], NULL, test_thread,
+ &thread_args[i]);
+ MARS_TEST_ASSERT_EQUAL(ret, 0);
+ }
+
+ for (i = 0; i < mpu; i++) {
+ ret = pthread_join(threads[i], NULL);
+ MARS_TEST_ASSERT_EQUAL(ret, 0);
+ }
+
+ ret = mars_context_destroy(mars_ctx);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+
+ size = TEST1_ELEMENT_COUNT * mpu;
+ sprintf(text,"semaphore max_wait: acquire (%d mpu paris)",mpu);
+ mars_test_print_statistics(acquire_ticks, size, text);
+ sprintf(text,"semaphore max_wait: release (%d mpu paris)",mpu);
+ mars_test_print_statistics(release_ticks, size, text);
+
+ free(acquire_ticks);
+ free(release_ticks);
+}
+
+int main(int argc, char *argv[])
+{
+ int mpu,spe;
+ size_t size;
+ pthread_t *threads;
+ struct thread_arg_st *thread_args;
+
+ spe = spe_cpu_info_get(SPE_COUNT_PHYSICAL_SPES, -1);
+
+ for (mpu = MIN_MPUS; mpu <= MAX_MPUS; mpu++) {
+
+ threads = (pthread_t *) malloc(sizeof(pthread_t) * mpu);
+ MARS_TEST_ASSERT(threads != NULL);
+
+ size = sizeof(struct thread_arg_st) * mpu;
+ thread_args = (struct thread_arg_st *)malloc(size);
+ MARS_TEST_ASSERT(thread_args != NULL);
+
+ MARS_TEST_PERF_INIT();
+
+ test1(mpu, threads, thread_args);
+ test2(mpu, threads, thread_args);
+
+ free(thread_args);
+ free(threads);
+ }
+
+ return 0;
+}
diff --git a/tests/TPF/TPF_50_002/mpu1.c b/tests/TPF/TPF_50_002/mpu1.c
new file mode 100644
index 0000000..b67070b
--- /dev/null
+++ b/tests/TPF/TPF_50_002/mpu1.c
@@ -0,0 +1,69 @@
+/*
+ * Copyright 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/task.h>
+#include <mars_test.h>
+#include "common.h"
+
+int mars_task_main(const struct mars_task_args *task_args)
+{
+ int ret, i, j, semaphore_count;
+ uint32_t start, end;
+ static struct test_task_args_st args ALIGN128;
+ static uint32_t acquire_ticks[TEST1_ELEMENT_COUNT] ALIGN128;
+
+ mfc_get(&args, task_args->type.u64[0],
+ sizeof(struct test_task_args_st), 0, 0, 0);
+ mfc_write_tag_mask(1);
+ mfc_read_tag_status_all();
+
+ semaphore_count = mars_test_int32_get(args.semaphore_count_ea);
+
+ for (i = 0; i < TEST1_ELEMENT_COUNT; i++) {
+ ret = mars_task_barrier_notify(args.barrier_ea);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+ ret = mars_task_barrier_wait(args.barrier_ea);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+
+ start = mars_task_get_ticks();
+ for (j = 0; j < semaphore_count; j++) {
+ ret = mars_task_semaphore_acquire(args.semaphore_ea);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+ }
+
+ end = mars_task_get_ticks();
+
+ ret = mars_task_barrier_notify(args.barrier_ea);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+ ret = mars_task_barrier_wait(args.barrier_ea);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+
+ acquire_ticks[i] = (end - start) / semaphore_count;
+ }
+
+ mfc_put(acquire_ticks, args.ticks1_ea, sizeof(acquire_ticks), 0, 0, 0);
+ mfc_write_tag_mask(1);
+ mfc_read_tag_status_all();
+
+ return 0;
+}
diff --git a/tests/TPF/TPF_50_002/mpu2.c b/tests/TPF/TPF_50_002/mpu2.c
new file mode 100644
index 0000000..c3cbbea
--- /dev/null
+++ b/tests/TPF/TPF_50_002/mpu2.c
@@ -0,0 +1,70 @@
+/*
+ * Copyright 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/task.h>
+#include <mars_test.h>
+#include "common.h"
+#include <stdio.h>
+
+int mars_task_main(const struct mars_task_args *task_args)
+{
+ int ret, i, j;
+ uint32_t start, end, semaphore_count;
+ static struct test_task_args_st args ALIGN128;
+ static uint32_t release_ticks[TEST1_ELEMENT_COUNT] ALIGN128;
+
+ mfc_get(&args, task_args->type.u64[0],
+ sizeof(struct test_task_args_st), 0, 0, 0);
+ mfc_write_tag_mask(1);
+ mfc_read_tag_status_all();
+
+ semaphore_count = mars_test_int32_get(args.semaphore_count_ea);
+
+ for (i = 0; i < TEST1_ELEMENT_COUNT; i++) {
+
+ ret = mars_task_barrier_notify(args.barrier_ea);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+ ret = mars_task_barrier_wait(args.barrier_ea);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+
+ ret = mars_task_barrier_notify(args.barrier_ea);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+ ret = mars_task_barrier_wait(args.barrier_ea);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+
+ start = mars_task_get_ticks();
+ for (j = 0; j < semaphore_count; j++) {
+ ret = mars_task_semaphore_release(args.semaphore_ea);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+ }
+ end = mars_task_get_ticks();
+
+ release_ticks[i] = (end - start) / semaphore_count;
+ }
+
+ mfc_put(release_ticks, args.ticks2_ea, sizeof(release_ticks), 0, 0, 0);
+ mfc_write_tag_mask(1);
+ mfc_read_tag_status_all();
+
+ return 0;
+}
diff --git a/tests/TPF/TPF_50_003/Makefile b/tests/TPF/TPF_50_003/Makefile
new file mode 100644
index 0000000..dc68b86
--- /dev/null
+++ b/tests/TPF/TPF_50_003/Makefile
@@ -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.
+#
+
+EXTRA_LDFLAGS=-lm
+INCLUDE_CFLAGS+= -I./
+MPU_INCLUDE_CFLAGS+= -I./
+
+top_srcdir = ../..
+test_objs = host.o mpu1.task_eo mpu2.task_eo
+timeout = 120
+
+include $(top_srcdir)/scripts/config.mk
+include $(top_srcdir)/scripts/rules_item.mk
+include $(top_srcdir)/scripts/rules_tpf.mk
+
+host.o: common.h
+mpu1.task_o: common.h
+mpu2.task_o: common.h
diff --git a/tests/TPF/TPF_50_003/common.h b/tests/TPF/TPF_50_003/common.h
new file mode 100644
index 0000000..9a22be0
--- /dev/null
+++ b/tests/TPF/TPF_50_003/common.h
@@ -0,0 +1,46 @@
+/*
+ * Copyright 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/task.h>
+#include <mars_test.h>
+
+#define MIN_MPUS (spe/2)+1
+#define MAX_MPUS spe
+
+#define QUEUE_DEPTH 16
+#define ELEMENT_SIZE 128
+#define TEST1_ELEMENT_COUNT 4096
+#define TEST2_ELEMENT_COUNT 4096
+#define TEST3_ELEMENT_COUNT 4096
+
+#define ALIGN128 __attribute__((aligned(128)))
+
+struct test_task_args_st {
+ uint64_t semaphore_ea;
+ uint64_t barrier_ea;
+ uint64_t ticks1_ea;
+ uint64_t ticks2_ea;
+ uint32_t semaphore_count_ea;
+ uint32_t pad[3];
+};
+
diff --git a/tests/TPF/TPF_50_003/host.c b/tests/TPF/TPF_50_003/host.c
new file mode 100644
index 0000000..fcdcd09
--- /dev/null
+++ b/tests/TPF/TPF_50_003/host.c
@@ -0,0 +1,24 @@
+/*
+ * Copyright 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 "../TPF_50_002/host.c"
diff --git a/tests/TPF/TPF_50_003/mpu1.c b/tests/TPF/TPF_50_003/mpu1.c
new file mode 100644
index 0000000..2c5a4b1
--- /dev/null
+++ b/tests/TPF/TPF_50_003/mpu1.c
@@ -0,0 +1,24 @@
+/*
+ * Copyright 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 "../TPF_50_002/mpu1.c"
diff --git a/tests/TPF/TPF_50_003/mpu2.c b/tests/TPF/TPF_50_003/mpu2.c
new file mode 100644
index 0000000..8522d59
--- /dev/null
+++ b/tests/TPF/TPF_50_003/mpu2.c
@@ -0,0 +1,24 @@
+/*
+ * Copyright 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 "../TPF_50_002/mpu2.c"
diff --git a/tests/TPF/TPF_50_004/Makefile b/tests/TPF/TPF_50_004/Makefile
new file mode 100644
index 0000000..dc68b86
--- /dev/null
+++ b/tests/TPF/TPF_50_004/Makefile
@@ -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.
+#
+
+EXTRA_LDFLAGS=-lm
+INCLUDE_CFLAGS+= -I./
+MPU_INCLUDE_CFLAGS+= -I./
+
+top_srcdir = ../..
+test_objs = host.o mpu1.task_eo mpu2.task_eo
+timeout = 120
+
+include $(top_srcdir)/scripts/config.mk
+include $(top_srcdir)/scripts/rules_item.mk
+include $(top_srcdir)/scripts/rules_tpf.mk
+
+host.o: common.h
+mpu1.task_o: common.h
+mpu2.task_o: common.h
diff --git a/tests/TPF/TPF_50_004/common.h b/tests/TPF/TPF_50_004/common.h
new file mode 100644
index 0000000..367f59c
--- /dev/null
+++ b/tests/TPF/TPF_50_004/common.h
@@ -0,0 +1,49 @@
+/*
+ * Copyright 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/task.h>
+#include <mars_test.h>
+
+#define MIN_MPUS 1
+#define MAX_MPUS spe/2
+
+#define QUEUE_DEPTH 16
+#define ELEMENT_SIZE 128
+#define TEST1_ELEMENT_COUNT 4096
+#define TEST2_ELEMENT_COUNT 4096
+#define TEST3_ELEMENT_COUNT 4096
+
+#define ALIGN128 __attribute__((aligned(128)))
+
+struct test_task_args_st {
+ uint64_t semaphore_ea;
+ uint64_t barrier_ea;
+ uint64_t ticks1_ea;
+ uint64_t ticks2_ea;
+ uint64_t ticks3_ea;
+ uint32_t semaphore_count_ea;
+ uint32_t shared_resource_ea;
+ uint32_t tb_freq;
+ uint32_t pad[3];
+};
+
diff --git a/tests/TPF/TPF_50_004/host.c b/tests/TPF/TPF_50_004/host.c
new file mode 100644
index 0000000..e360aba
--- /dev/null
+++ b/tests/TPF/TPF_50_004/host.c
@@ -0,0 +1,280 @@
+/*
+ * Copyright 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 <pthread.h>
+#include <libspe2.h>
+#include <mars/task.h>
+#include <mars_test.h>
+#include <common.h>
+
+extern spe_program_handle_t mpu1_prog, mpu2_prog;
+
+struct thread_arg_st {
+ int32_t *ticks1;
+ int32_t *ticks2;
+ int32_t *ticks3;
+ uint32_t semaphore_count;
+ struct mars_context *mars_ctx;
+};
+
+void *test_thread(void *arg)
+{
+ int ret;
+ struct thread_arg_st *thread_arg = arg;
+ int32_t *start1_ticks = thread_arg->ticks1;
+ int32_t *start2_ticks = thread_arg->ticks2;
+ int32_t *end_ticks = thread_arg->ticks3;
+ uint32_t semaphore_count = thread_arg->semaphore_count;
+ uint32_t shared_resource;
+ struct mars_context *mars_ctx = thread_arg->mars_ctx;
+ struct mars_task_id task_id_acquire, task_id_release;
+ struct mars_task_args task_args_acquire, task_args_release;
+ static __thread struct test_task_args_st args ALIGN128;
+ uint64_t barrier;
+ uint64_t semaphore;
+
+ ret = mars_task_create(mars_ctx, &task_id_acquire, NULL,
+ mpu1_prog.elf_image,
+ MARS_TASK_CONTEXT_SAVE_SIZE_MAX);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+
+ ret = mars_task_create(mars_ctx, &task_id_release, NULL,
+ mpu2_prog.elf_image,
+ MARS_TASK_CONTEXT_SAVE_SIZE_MAX);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+
+ ret = mars_task_barrier_create(mars_ctx, &barrier, 2);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+
+ ret = mars_task_semaphore_create(mars_ctx, &semaphore, semaphore_count);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+
+ ret = mars_test_get_timebase_freq(&args.tb_freq);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+
+ args.barrier_ea = barrier;
+ args.semaphore_ea = semaphore;
+ args.ticks1_ea = mars_ptr_to_ea(start1_ticks);
+ args.ticks2_ea = mars_ptr_to_ea(start2_ticks);
+ args.ticks3_ea = mars_ptr_to_ea(end_ticks);
+ args.semaphore_count_ea = mars_ptr_to_ea(&semaphore_count);
+ args.shared_resource_ea = mars_ptr_to_ea(&shared_resource);
+ task_args_acquire.type.u64[0] = mars_ptr_to_ea(&args);
+ task_args_release.type.u64[0] = mars_ptr_to_ea(&args);
+
+ ret = mars_task_schedule(&task_id_acquire, &task_args_acquire, 0);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+
+ ret = mars_task_schedule(&task_id_release, &task_args_release, 0);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+
+ ret = mars_task_wait(&task_id_acquire, NULL);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+
+ ret = mars_task_wait(&task_id_release, NULL);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+
+ ret = mars_task_barrier_destroy(barrier);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+
+ ret = mars_task_semaphore_destroy(semaphore);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+
+ ret = mars_task_destroy(&task_id_acquire);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+
+ ret = mars_task_destroy(&task_id_release);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+
+ return NULL;
+}
+
+void test1(int mpu, pthread_t * threads, struct thread_arg_st *thread_args)
+{
+ int ret, i;
+ size_t size;
+ char text[128];
+ int32_t *start1_ticks, *start2_ticks, *end_ticks, *ticks;
+ struct mars_context *mars_ctx;
+
+ size = sizeof(uint32_t) * TEST1_ELEMENT_COUNT * mpu;
+
+ ret = posix_memalign((void **)&start1_ticks, 128, size);
+ MARS_TEST_ASSERT_EQUAL(ret, 0);
+
+ ret = posix_memalign((void **)&start2_ticks, 128, size);
+ MARS_TEST_ASSERT_EQUAL(ret, 0);
+
+ ret = posix_memalign((void **)&end_ticks, 128, size);
+ MARS_TEST_ASSERT_EQUAL(ret, 0);
+
+ ret = posix_memalign((void **)&ticks, 128, size);
+ MARS_TEST_ASSERT_EQUAL(ret, 0);
+
+ ret = mars_context_create(&mars_ctx, 0, 1);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+
+ for (i = 0; i < mpu; i++) {
+ thread_args[i].ticks1 = &start1_ticks[TEST1_ELEMENT_COUNT * i];
+ thread_args[i].ticks2 = &start2_ticks[TEST1_ELEMENT_COUNT * i];
+ thread_args[i].ticks3 = &end_ticks[TEST1_ELEMENT_COUNT * i];
+ thread_args[i].mars_ctx = mars_ctx;
+ thread_args[i].semaphore_count = 1;
+ ret = pthread_create(&threads[i], NULL, test_thread,
+ &thread_args[i]);
+ MARS_TEST_ASSERT_EQUAL(ret, 0);
+ }
+
+ for (i = 0; i < mpu; i++) {
+ ret = pthread_join(threads[i], NULL);
+ MARS_TEST_ASSERT_EQUAL(ret, 0);
+ }
+
+ ret = mars_context_destroy(mars_ctx);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+
+ size = TEST1_ELEMENT_COUNT * mpu;
+
+ for (i = 0; i < size; i++) {
+ ticks[i] = start2_ticks[i] - start1_ticks[i];
+ }
+ sprintf(text,"single semaphore: release (%d mpu paris)",mpu);
+ mars_test_print_statistics(ticks, size, text);
+
+ for (i = 0; i < size; i++) {
+ ticks[i] = end_ticks[i] - start1_ticks[i];
+ }
+ sprintf(text,"single semaphore: start release - end acquire (%d mpu paris)",mpu);
+ mars_test_print_statistics(ticks, size, text);
+
+ for (i = 0; i < size; i++) {
+ ticks[i] = end_ticks[i] - start2_ticks[i];
+ }
+ sprintf(text,"single semaphore: end release - end acquire (%d mpu paris)",mpu);
+ mars_test_print_statistics(ticks, size, text);
+
+ free(start1_ticks);
+ free(start2_ticks);
+ free(end_ticks);
+ free(ticks);
+}
+
+void test2(int mpu, pthread_t * threads, struct thread_arg_st *thread_args)
+{
+ int ret, i;
+ size_t size;
+ char text[128];
+ int32_t *start1_ticks, *start2_ticks, *end_ticks, *ticks;
+ struct mars_context *mars_ctx;
+
+ size = sizeof(uint32_t) * TEST1_ELEMENT_COUNT * mpu;
+
+ ret = posix_memalign((void **)&start1_ticks, 128, size);
+ MARS_TEST_ASSERT_EQUAL(ret, 0);
+
+ ret = posix_memalign((void **)&start2_ticks, 128, size);
+ MARS_TEST_ASSERT_EQUAL(ret, 0);
+
+ ret = posix_memalign((void **)&end_ticks, 128, size);
+ MARS_TEST_ASSERT_EQUAL(ret, 0);
+
+ ret = posix_memalign((void **)&ticks, 128, size);
+ MARS_TEST_ASSERT_EQUAL(ret, 0);
+
+ ret = mars_context_create(&mars_ctx, 0, 1);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+
+ for (i = 0; i < mpu; i++) {
+ thread_args[i].ticks1 = &start1_ticks[TEST1_ELEMENT_COUNT * i];
+ thread_args[i].ticks2 = &start2_ticks[TEST1_ELEMENT_COUNT * i];
+ thread_args[i].ticks3 = &end_ticks[TEST1_ELEMENT_COUNT * i];
+ thread_args[i].mars_ctx = mars_ctx;
+ thread_args[i].semaphore_count = MARS_TASK_SEMAPHORE_WAIT_MAX;
+ ret = pthread_create(&threads[i], NULL, test_thread,
+ &thread_args[i]);
+ MARS_TEST_ASSERT_EQUAL(ret, 0);
+ }
+
+ for (i = 0; i < mpu; i++) {
+ ret = pthread_join(threads[i], NULL);
+ MARS_TEST_ASSERT_EQUAL(ret, 0);
+ }
+
+ ret = mars_context_destroy(mars_ctx);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+
+ size = TEST1_ELEMENT_COUNT * mpu;
+
+ for (i = 0; i < size; i++) {
+ ticks[i] = start2_ticks[i] - start1_ticks[i];
+ }
+ sprintf(text,"max_wait semaphore: release (%d mpu paris)",mpu);
+ mars_test_print_statistics(ticks, size, text);
+
+ for (i = 0; i < size; i++) {
+ ticks[i] = end_ticks[i] - start1_ticks[i];
+ }
+ sprintf(text,"max_wait semaphore: start release - end acquire (%d mpu paris)",mpu);
+ mars_test_print_statistics(ticks, size, text);
+
+ for (i = 0; i < size; i++) {
+ ticks[i] = end_ticks[i] - start2_ticks[i];
+ }
+ sprintf(text,"max_wait semaphore: end release - end acquire (%d mpu paris)",mpu);
+ mars_test_print_statistics(ticks, size, text);
+
+ free(start1_ticks);
+ free(start2_ticks);
+ free(end_ticks);
+ free(ticks);
+}
+
+int main(int argc, char *argv[])
+{
+ int mpu,spe;
+ size_t size;
+ pthread_t *threads;
+ struct thread_arg_st *thread_args;
+
+ spe = spe_cpu_info_get(SPE_COUNT_PHYSICAL_SPES, -1);
+
+ for (mpu = MIN_MPUS; mpu <= MAX_MPUS; mpu++) {
+
+ threads = (pthread_t *) malloc(sizeof(pthread_t) * mpu);
+ MARS_TEST_ASSERT(threads != NULL);
+
+ size = sizeof(struct thread_arg_st) * mpu;
+ thread_args = (struct thread_arg_st *)malloc(size);
+ MARS_TEST_ASSERT(thread_args != NULL);
+
+ MARS_TEST_PERF_INIT();
+
+ test1(mpu, threads, thread_args);
+ test2(mpu, threads, thread_args);
+
+ free(thread_args);
+ free(threads);
+ }
+
+ return 0;
+}
diff --git a/tests/TPF/TPF_50_004/mpu1.c b/tests/TPF/TPF_50_004/mpu1.c
new file mode 100644
index 0000000..f176090
--- /dev/null
+++ b/tests/TPF/TPF_50_004/mpu1.c
@@ -0,0 +1,68 @@
+/*
+ * Copyright 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/task.h>
+#include <mars_test.h>
+#include "common.h"
+#include <stdio.h>
+
+int mars_task_main(const struct mars_task_args *task_args)
+{
+ int ret, i, j, semaphore_count;
+ static struct test_task_args_st args ALIGN128;
+ static uint32_t end_ticks[TEST1_ELEMENT_COUNT] ALIGN128;
+
+ mfc_get(&args, task_args->type.u64[0], sizeof(struct test_task_args_st),
+ 0, 0, 0);
+ mfc_write_tag_mask(1);
+ mfc_read_tag_status_all();
+
+ semaphore_count = mars_test_int32_get(args.semaphore_count_ea);
+
+ for (i = 0; i < TEST1_ELEMENT_COUNT; i++) {
+ ret = mars_task_barrier_notify(args.barrier_ea);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+ ret = mars_task_barrier_wait(args.barrier_ea);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+
+ for (j = 0; j < semaphore_count; j++) {
+ ret = mars_task_semaphore_acquire(args.semaphore_ea);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+ }
+
+ ret = mars_task_semaphore_acquire(args.semaphore_ea);
+ end_ticks[i] = mars_task_get_ticks();
+
+ ret = mars_task_barrier_notify(args.barrier_ea);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+ ret = mars_task_barrier_wait(args.barrier_ea);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+
+ }
+
+ mfc_put(end_ticks, args.ticks3_ea, sizeof(end_ticks), 0, 0, 0);
+ mfc_write_tag_mask(1);
+ mfc_read_tag_status_all();
+
+ return 0;
+}
diff --git a/tests/TPF/TPF_50_004/mpu2.c b/tests/TPF/TPF_50_004/mpu2.c
new file mode 100644
index 0000000..91f9c86
--- /dev/null
+++ b/tests/TPF/TPF_50_004/mpu2.c
@@ -0,0 +1,75 @@
+/*
+ * Copyright 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/task.h>
+#include <mars_test.h>
+#include "common.h"
+#include <stdio.h>
+
+int mars_task_main(const struct mars_task_args *task_args)
+{
+ int ret, i, j;
+ uint32_t semaphore_count;
+ static struct test_task_args_st args ALIGN128;
+ static uint32_t start1_ticks[TEST1_ELEMENT_COUNT] ALIGN128;
+ static uint32_t start2_ticks[TEST1_ELEMENT_COUNT] ALIGN128;
+
+ mfc_get(&args, task_args->type.u64[0], sizeof(struct test_task_args_st), 0, 0, 0);
+ mfc_write_tag_mask(1);
+ mfc_read_tag_status_all();
+
+ semaphore_count = mars_test_int32_get(args.semaphore_count_ea);
+
+ for (i = 0; i < TEST1_ELEMENT_COUNT; i++) {
+ ret = mars_task_barrier_notify(args.barrier_ea);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+ ret = mars_task_barrier_wait(args.barrier_ea);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+
+ mars_test_usleep(args.tb_freq, DELAY);
+
+ start1_ticks[i] = mars_task_get_ticks();
+ ret = mars_task_semaphore_release(args.semaphore_ea);
+ start2_ticks[i] = mars_task_get_ticks();
+
+ ret = mars_task_barrier_notify(args.barrier_ea);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+ ret = mars_task_barrier_wait(args.barrier_ea);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+
+ for (j = 0; j < semaphore_count; j++) {
+ ret = mars_task_semaphore_release(args.semaphore_ea);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+ }
+ }
+
+ mfc_put(start1_ticks, args.ticks1_ea, sizeof(start1_ticks), 0, 0, 0);
+ mfc_write_tag_mask(1);
+ mfc_read_tag_status_all();
+
+ mfc_put(start2_ticks, args.ticks2_ea, sizeof(start2_ticks), 0, 0, 0);
+ mfc_write_tag_mask(1);
+ mfc_read_tag_status_all();
+
+ return 0;
+}
diff --git a/tests/TPF/TPF_50_005/Makefile b/tests/TPF/TPF_50_005/Makefile
new file mode 100644
index 0000000..dc68b86
--- /dev/null
+++ b/tests/TPF/TPF_50_005/Makefile
@@ -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.
+#
+
+EXTRA_LDFLAGS=-lm
+INCLUDE_CFLAGS+= -I./
+MPU_INCLUDE_CFLAGS+= -I./
+
+top_srcdir = ../..
+test_objs = host.o mpu1.task_eo mpu2.task_eo
+timeout = 120
+
+include $(top_srcdir)/scripts/config.mk
+include $(top_srcdir)/scripts/rules_item.mk
+include $(top_srcdir)/scripts/rules_tpf.mk
+
+host.o: common.h
+mpu1.task_o: common.h
+mpu2.task_o: common.h
diff --git a/tests/TPF/TPF_50_005/common.h b/tests/TPF/TPF_50_005/common.h
new file mode 100644
index 0000000..f76509d
--- /dev/null
+++ b/tests/TPF/TPF_50_005/common.h
@@ -0,0 +1,49 @@
+/*
+ * Copyright 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/task.h>
+#include <mars_test.h>
+
+#define MIN_MPUS spe/2+1
+#define MAX_MPUS spe
+
+#define QUEUE_DEPTH 16
+#define ELEMENT_SIZE 128
+#define TEST1_ELEMENT_COUNT 4096
+#define TEST2_ELEMENT_COUNT 4096
+#define TEST3_ELEMENT_COUNT 4096
+
+#define ALIGN128 __attribute__((aligned(128)))
+
+struct test_task_args_st {
+ uint64_t semaphore_ea;
+ uint64_t barrier_ea;
+ uint64_t ticks1_ea;
+ uint64_t ticks2_ea;
+ uint64_t ticks3_ea;
+ uint32_t semaphore_count_ea;
+ uint32_t shared_resource_ea;
+ uint32_t tb_freq;
+ uint32_t pad[3];
+};
+
diff --git a/tests/TPF/TPF_50_005/host.c b/tests/TPF/TPF_50_005/host.c
new file mode 100644
index 0000000..c5904a8
--- /dev/null
+++ b/tests/TPF/TPF_50_005/host.c
@@ -0,0 +1,24 @@
+/*
+ * Copyright 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 "../TPF_50_004/host.c"
diff --git a/tests/TPF/TPF_50_005/mpu1.c b/tests/TPF/TPF_50_005/mpu1.c
new file mode 100644
index 0000000..414eb19
--- /dev/null
+++ b/tests/TPF/TPF_50_005/mpu1.c
@@ -0,0 +1,24 @@
+/*
+ * Copyright 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 "../TPF_50_004/mpu1.c"
diff --git a/tests/TPF/TPF_50_005/mpu2.c b/tests/TPF/TPF_50_005/mpu2.c
new file mode 100644
index 0000000..92103ae
--- /dev/null
+++ b/tests/TPF/TPF_50_005/mpu2.c
@@ -0,0 +1,24 @@
+/*
+ * Copyright 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 "../TPF_50_004/mpu2.c"
diff --git a/tests/TPF/TPF_60_001/Makefile b/tests/TPF/TPF_60_001/Makefile
new file mode 100644
index 0000000..0bad622
--- /dev/null
+++ b/tests/TPF/TPF_60_001/Makefile
@@ -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.
+#
+
+EXTRA_LDFLAGS=-lm
+INCLUDE_CFLAGS+= -I./
+MPU_INCLUDE_CFLAGS+= -I./
+
+top_srcdir = ../..
+test_objs = host.o mpu1.task_eo
+timeout = 120
+
+include $(top_srcdir)/scripts/config.mk
+include $(top_srcdir)/scripts/rules_item.mk
+include $(top_srcdir)/scripts/rules_tpf.mk
+
+host.o: common.h
+mpu1.task_o: common.h
+mpu2.task_o: common.h
diff --git a/tests/TPF/TPF_60_001/common.h b/tests/TPF/TPF_60_001/common.h
new file mode 100644
index 0000000..07c6f1d
--- /dev/null
+++ b/tests/TPF/TPF_60_001/common.h
@@ -0,0 +1,40 @@
+/*
+ * Copyright 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/task.h>
+#include <mars_test.h>
+
+#define MIN_MPUS 1
+#define MAX_MPUS 1
+
+#define TEST1_ELEMENT_COUNT 4096
+
+#define ALIGN128 __attribute__((aligned(128)))
+
+struct test_task_args_st {
+ uint64_t ticks_ea;
+ uint64_t ticks2_ea;
+ uint64_t sender_to_receiver_ea;
+ uint64_t receiver_to_sender_ea;
+};
+
diff --git a/tests/TPF/TPF_60_001/host.c b/tests/TPF/TPF_60_001/host.c
new file mode 100644
index 0000000..2f07c77
--- /dev/null
+++ b/tests/TPF/TPF_60_001/host.c
@@ -0,0 +1,181 @@
+/*
+ * Copyright 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 <pthread.h>
+#include <libspe2.h>
+#include <mars/task.h>
+#include <mars_test.h>
+#include <unistd.h>
+#include <common.h>
+
+extern spe_program_handle_t mpu1_prog;
+
+struct thread_arg_st {
+ int32_t *ticks1;
+ int32_t *ticks2;
+ int32_t *ticks3;
+ struct mars_context *mars_ctx;
+};
+
+void *test_thread(void *arg)
+{
+ int ret, i;
+ struct thread_arg_st *thread_arg = arg;
+ int32_t *start1_ticks = thread_arg->ticks1;
+ int32_t *start2_ticks = thread_arg->ticks2;
+ int32_t *end_ticks = thread_arg->ticks3;
+ struct mars_context *mars_ctx = thread_arg->mars_ctx;
+ struct mars_task_id task_id;
+ struct mars_task_args task_args;
+ static __thread struct test_task_args_st args ALIGN128;
+
+ uint32_t sender_to_receiver = UINT32_MAX;
+ uint32_t receiver_to_sender = UINT32_MAX;
+
+ ret = mars_task_create(mars_ctx, &task_id, NULL,
+ mpu1_prog.elf_image,
+ MARS_TASK_CONTEXT_SAVE_SIZE_MAX);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+
+ args.sender_to_receiver_ea = mars_ptr_to_ea(&sender_to_receiver);
+ args.receiver_to_sender_ea = mars_ptr_to_ea(&receiver_to_sender);
+ args.ticks_ea = mars_ptr_to_ea(end_ticks);
+ task_args.type.u64[0] = mars_ptr_to_ea(&args);
+
+ ret = mars_task_schedule(&task_id, &task_args, 0);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+
+ for (i = 0; i < TEST1_ELEMENT_COUNT; i++) {
+ mars_test_counter_set(&sender_to_receiver, i);
+ mars_test_counter_wait(&receiver_to_sender, i);
+ usleep(DELAY); /*give mpu time to block */
+ start1_ticks[i] = mars_task_get_ticks();
+ mars_task_signal_send(&task_id);
+ start2_ticks[i] = mars_task_get_ticks();
+ }
+
+ ret = mars_task_wait(&task_id, NULL);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+
+ ret = mars_task_destroy(&task_id);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+
+ return NULL;
+}
+
+void test1(int mpu, pthread_t * threads, struct thread_arg_st *thread_args)
+{
+ int ret, i;
+ size_t size;
+ int32_t *start1_ticks, *start2_ticks, *end_ticks; int32_t *ticks;
+ char text[64];
+ struct mars_context *mars_ctx;
+
+ size = sizeof(uint32_t) * TEST1_ELEMENT_COUNT * mpu;
+
+ ret = posix_memalign((void **)&start1_ticks, 128, size);
+ MARS_TEST_ASSERT_EQUAL(ret, 0);
+
+ ret = posix_memalign((void **)&start2_ticks, 128, size);
+ MARS_TEST_ASSERT_EQUAL(ret, 0);
+
+ ret = posix_memalign((void **)&end_ticks, 128, size);
+ MARS_TEST_ASSERT_EQUAL(ret, 0);
+
+ ret = posix_memalign((void **)&ticks, 128, size);
+ MARS_TEST_ASSERT_EQUAL(ret, 0);
+
+ ret = mars_context_create(&mars_ctx, 0, 1);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+
+ for (i = 0; i < mpu; i++) {
+ thread_args[i].ticks1 = &start1_ticks[TEST1_ELEMENT_COUNT * i];
+ thread_args[i].ticks2 = &start2_ticks[TEST1_ELEMENT_COUNT * i];
+ thread_args[i].ticks3 = &end_ticks[TEST1_ELEMENT_COUNT * i];
+ thread_args[i].mars_ctx = mars_ctx;
+ ret = pthread_create(&threads[i], NULL, test_thread,
+ &thread_args[i]);
+ MARS_TEST_ASSERT_EQUAL(ret, 0);
+ }
+
+ for (i = 0; i < mpu; i++) {
+ ret = pthread_join(threads[i], NULL);
+ MARS_TEST_ASSERT_EQUAL(ret, 0);
+ }
+
+ ret = mars_context_destroy(mars_ctx);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+
+ size = TEST1_ELEMENT_COUNT * mpu;
+
+ for (i = 0; i < size; i++) {
+ ticks[i] = start2_ticks[i] - start1_ticks[i];
+ }
+ sprintf(text, "signal host-mpu: signal (%d mpu)", mpu);
+ mars_test_print_statistics(ticks, size, text);
+
+ for (i = 0; i < size; i++) {
+ ticks[i] = end_ticks[i] - start1_ticks[i];
+ }
+ sprintf(text, "signal host-mpu: start signal - end wait (%d mpu)", mpu);
+ mars_test_print_statistics(ticks, size, text);
+
+ for (i = 0; i < size; i++) {
+ ticks[i] = end_ticks[i] - start2_ticks[i];
+ }
+ sprintf(text, "signal host-mpu: end signal - end wait (%d mpu)", mpu);
+ mars_test_print_statistics(ticks, size, text);
+
+ free(start1_ticks);
+ free(start2_ticks);
+ free(end_ticks);
+ free(ticks);
+}
+
+int main(int argc, char *argv[])
+{
+ int mpu,spe;
+ size_t size;
+ pthread_t *threads;
+ struct thread_arg_st *thread_args;
+
+ spe = spe_cpu_info_get(SPE_COUNT_PHYSICAL_SPES, -1);
+
+ for (mpu = MIN_MPUS; mpu <= MAX_MPUS; mpu++) {
+
+ threads = (pthread_t *) malloc(sizeof(pthread_t) * mpu);
+ MARS_TEST_ASSERT(threads != NULL);
+
+ size = sizeof(struct thread_arg_st) * mpu;
+ thread_args = (struct thread_arg_st *)malloc(size);
+ MARS_TEST_ASSERT(thread_args != NULL);
+
+ MARS_TEST_PERF_INIT();
+
+ test1(mpu, threads, thread_args);
+ free(thread_args);
+ free(threads);
+ }
+
+ return 0;
+}
diff --git a/tests/TFP/TFP_35_001/mpu.c b/tests/TPF/TPF_60_001/mpu1.c
index 92a6455..bbb64b5 100644
--- a/tests/TFP/TFP_35_001/mpu.c
+++ b/tests/TPF/TPF_60_001/mpu1.c
@@ -1,5 +1,5 @@
/*
- * Copyright 2008 Sony Corporation
+ * Copyright 2008 Sony Computer Entertainment Inc.
*
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
@@ -22,29 +22,30 @@
*/
#include <mars/task.h>
-#include <mars_task_test.h>
-#include <spu_mfcio.h>
-
-static uint32_t shared_resource __attribute((aligned(16)));
+#include <mars_test.h>
+#include <common.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 shared_resource_ea = task_args->type.u64[2];
+ int ret, i;
+ static struct test_task_args_st args ALIGN128;
+ int end_ticks[TEST1_ELEMENT_COUNT] ALIGN128;
+
+ mfc_get(&args, task_args->type.u64[0], sizeof(struct test_task_args_st),
+ 0, 0, 0);
+ mfc_write_tag_mask(1);
+ mfc_read_tag_status_all();
- 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);
+ for (i = 0; i < TEST1_ELEMENT_COUNT; i++) {
+ mars_test_counter_wait(args.sender_to_receiver_ea, i);
+ mars_test_counter_set(args.receiver_to_sender_ea, i);
+ ret = mars_task_signal_wait();
+ MARS_TEST_ASSERT_EQUAL(ret, 0);
+ end_ticks[i] = mars_task_get_ticks();
+ }
- /* 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_put(end_ticks, args.ticks_ea, TEST1_ELEMENT_COUNT * 4, 0, 0, 0);
+ mfc_write_tag_mask(1);
mfc_read_tag_status_all();
return 0;
diff --git a/tests/TPF/TPF_60_002/Makefile b/tests/TPF/TPF_60_002/Makefile
new file mode 100644
index 0000000..0bad622
--- /dev/null
+++ b/tests/TPF/TPF_60_002/Makefile
@@ -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.
+#
+
+EXTRA_LDFLAGS=-lm
+INCLUDE_CFLAGS+= -I./
+MPU_INCLUDE_CFLAGS+= -I./
+
+top_srcdir = ../..
+test_objs = host.o mpu1.task_eo
+timeout = 120
+
+include $(top_srcdir)/scripts/config.mk
+include $(top_srcdir)/scripts/rules_item.mk
+include $(top_srcdir)/scripts/rules_tpf.mk
+
+host.o: common.h
+mpu1.task_o: common.h
+mpu2.task_o: common.h
diff --git a/tests/TPF/TPF_60_002/common.h b/tests/TPF/TPF_60_002/common.h
new file mode 100644
index 0000000..16eb1c3
--- /dev/null
+++ b/tests/TPF/TPF_60_002/common.h
@@ -0,0 +1,40 @@
+/*
+ * Copyright 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/task.h>
+#include <mars_test.h>
+
+#define MIN_MPUS 2
+#define MAX_MPUS spe
+
+#define TEST1_ELEMENT_COUNT 4096
+
+#define ALIGN128 __attribute__((aligned(128)))
+
+struct test_task_args_st {
+ uint64_t ticks_ea;
+ uint64_t ticks2_ea;
+ uint64_t sender_to_receiver_ea;
+ uint64_t receiver_to_sender_ea;
+};
+
diff --git a/tests/TPF/TPF_60_002/host.c b/tests/TPF/TPF_60_002/host.c
new file mode 100644
index 0000000..20a3aaf
--- /dev/null
+++ b/tests/TPF/TPF_60_002/host.c
@@ -0,0 +1,24 @@
+/*
+ * Copyright 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 "../TPF_60_001/host.c"
diff --git a/tests/TPF/TPF_60_002/mpu1.c b/tests/TPF/TPF_60_002/mpu1.c
new file mode 100644
index 0000000..85dc875
--- /dev/null
+++ b/tests/TPF/TPF_60_002/mpu1.c
@@ -0,0 +1,24 @@
+/*
+ * Copyright 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 "../TPF_60_001/mpu1.c"
diff --git a/tests/TPF/TPF_60_003/Makefile b/tests/TPF/TPF_60_003/Makefile
new file mode 100644
index 0000000..0bad622
--- /dev/null
+++ b/tests/TPF/TPF_60_003/Makefile
@@ -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.
+#
+
+EXTRA_LDFLAGS=-lm
+INCLUDE_CFLAGS+= -I./
+MPU_INCLUDE_CFLAGS+= -I./
+
+top_srcdir = ../..
+test_objs = host.o mpu1.task_eo
+timeout = 120
+
+include $(top_srcdir)/scripts/config.mk
+include $(top_srcdir)/scripts/rules_item.mk
+include $(top_srcdir)/scripts/rules_tpf.mk
+
+host.o: common.h
+mpu1.task_o: common.h
+mpu2.task_o: common.h
diff --git a/tests/TPF/TPF_60_003/common.h b/tests/TPF/TPF_60_003/common.h
new file mode 100644
index 0000000..d657bc2
--- /dev/null
+++ b/tests/TPF/TPF_60_003/common.h
@@ -0,0 +1,41 @@
+/*
+ * Copyright 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/task.h>
+#include <mars_test.h>
+
+#define MIN_MPUS spe+1
+#define MAX_MPUS spe*2
+
+#define TEST1_ELEMENT_COUNT 4096
+
+#define ALIGN128 __attribute__((aligned(128)))
+
+struct test_task_args_st {
+ uint64_t ticks_ea;
+ uint64_t ticks2_ea;
+ uint64_t sender_to_receiver_ea;
+ uint64_t receiver_to_sender_ea;
+
+};
+
diff --git a/tests/TPF/TPF_60_003/host.c b/tests/TPF/TPF_60_003/host.c
new file mode 100644
index 0000000..20a3aaf
--- /dev/null
+++ b/tests/TPF/TPF_60_003/host.c
@@ -0,0 +1,24 @@
+/*
+ * Copyright 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 "../TPF_60_001/host.c"
diff --git a/tests/TPF/TPF_60_003/mpu1.c b/tests/TPF/TPF_60_003/mpu1.c
new file mode 100644
index 0000000..85dc875
--- /dev/null
+++ b/tests/TPF/TPF_60_003/mpu1.c
@@ -0,0 +1,24 @@
+/*
+ * Copyright 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 "../TPF_60_001/mpu1.c"
diff --git a/tests/TPF/TPF_60_004/Makefile b/tests/TPF/TPF_60_004/Makefile
new file mode 100644
index 0000000..dc68b86
--- /dev/null
+++ b/tests/TPF/TPF_60_004/Makefile
@@ -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.
+#
+
+EXTRA_LDFLAGS=-lm
+INCLUDE_CFLAGS+= -I./
+MPU_INCLUDE_CFLAGS+= -I./
+
+top_srcdir = ../..
+test_objs = host.o mpu1.task_eo mpu2.task_eo
+timeout = 120
+
+include $(top_srcdir)/scripts/config.mk
+include $(top_srcdir)/scripts/rules_item.mk
+include $(top_srcdir)/scripts/rules_tpf.mk
+
+host.o: common.h
+mpu1.task_o: common.h
+mpu2.task_o: common.h
diff --git a/tests/TPF/TPF_60_004/common.h b/tests/TPF/TPF_60_004/common.h
new file mode 100644
index 0000000..a1040ef
--- /dev/null
+++ b/tests/TPF/TPF_60_004/common.h
@@ -0,0 +1,43 @@
+/*
+ * Copyright 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/task.h>
+#include <mars_test.h>
+
+#define MIN_MPUS 1
+#define MAX_MPUS 1
+
+#define TEST1_ELEMENT_COUNT 4096
+
+#define ALIGN128 __attribute__((aligned(128)))
+
+struct test_task_args_st {
+ uint64_t barrier_ea;
+ uint64_t ticks1_ea;
+ uint64_t ticks2_ea;
+ uint64_t ticks3_ea;
+ struct mars_task_id task_id;
+ uint32_t tb_freq;
+ uint32_t pad[2];
+};
+
diff --git a/tests/TPF/TPF_60_004/host.c b/tests/TPF/TPF_60_004/host.c
new file mode 100644
index 0000000..1da4dad
--- /dev/null
+++ b/tests/TPF/TPF_60_004/host.c
@@ -0,0 +1,199 @@
+/*
+ * Copyright 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 <pthread.h>
+#include <libspe2.h>
+#include <mars/task.h>
+#include <mars_test.h>
+#include <string.h>
+#include <unistd.h>
+#include <common.h>
+
+extern spe_program_handle_t mpu1_prog, mpu2_prog;
+
+struct thread_arg_st {
+ int32_t *ticks1;
+ int32_t *ticks2;
+ int32_t *ticks3;
+ struct mars_context *mars_ctx;
+};
+
+void *test_thread(void *arg)
+{
+ int ret;
+ struct thread_arg_st *thread_arg = arg;
+ int32_t *start1_ticks = thread_arg->ticks1;
+ int32_t *start2_ticks = thread_arg->ticks2;
+ int32_t *end_ticks = thread_arg->ticks3;
+ struct mars_context *mars_ctx = thread_arg->mars_ctx;
+ struct mars_task_id task_id_send, task_id_wait;
+ struct mars_task_args task_args_send, task_args_wait;
+ static __thread struct test_task_args_st args ALIGN128;
+ uint64_t barrier;
+
+ ret = mars_task_create(mars_ctx, &task_id_send, NULL,
+ mpu1_prog.elf_image,
+ MARS_TASK_CONTEXT_SAVE_SIZE_MAX);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+
+ ret = mars_task_create(mars_ctx, &task_id_wait, NULL,
+ mpu2_prog.elf_image,
+ MARS_TASK_CONTEXT_SAVE_SIZE_MAX);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+
+ ret = mars_task_barrier_create(mars_ctx, &barrier, 2);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+
+ ret = mars_test_get_timebase_freq(&args.tb_freq);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+
+ args.barrier_ea = barrier;
+ args.ticks1_ea = mars_ptr_to_ea(start1_ticks);
+ args.ticks2_ea = mars_ptr_to_ea(start2_ticks);
+ args.ticks3_ea = mars_ptr_to_ea(end_ticks);
+ memcpy(&args.task_id, &task_id_wait, sizeof(task_id_wait));
+ task_args_send.type.u64[0] = mars_ptr_to_ea(&args);
+ task_args_wait.type.u64[0] = mars_ptr_to_ea(&args);
+
+ ret = mars_task_schedule(&task_id_send, &task_args_send, 0);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+
+ ret = mars_task_schedule(&task_id_wait, &task_args_wait, 0);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+
+ ret = mars_task_wait(&task_id_send, NULL);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+
+ ret = mars_task_wait(&task_id_wait, NULL);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+
+ ret = mars_task_barrier_destroy(barrier);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+
+ ret = mars_task_destroy(&task_id_send);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+
+ ret = mars_task_destroy(&task_id_wait);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+
+ return NULL;
+}
+
+void test1(int mpu, pthread_t * threads,
+ struct thread_arg_st *thread_args)
+{
+ int ret, i;
+ char text[128];
+ size_t size;
+ int32_t *start1_ticks, *start2_ticks, *end_ticks, *ticks;
+ struct mars_context *mars_ctx;
+
+ size = sizeof(uint32_t) * TEST1_ELEMENT_COUNT * mpu;
+
+ ret = posix_memalign((void **)&start1_ticks, 128, size);
+ MARS_TEST_ASSERT_EQUAL(ret, 0);
+
+ ret = posix_memalign((void **)&start2_ticks, 128, size);
+ MARS_TEST_ASSERT_EQUAL(ret, 0);
+
+ ret = posix_memalign((void **)&end_ticks, 128, size);
+ MARS_TEST_ASSERT_EQUAL(ret, 0);
+
+ ret = posix_memalign((void **)&ticks, 128, size);
+ MARS_TEST_ASSERT_EQUAL(ret, 0);
+
+ ret = mars_context_create(&mars_ctx, 0, 1);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+
+ for (i = 0; i < mpu; i++) {
+ thread_args[i].ticks1 = &start1_ticks[TEST1_ELEMENT_COUNT * i];
+ thread_args[i].ticks2 = &start2_ticks[TEST1_ELEMENT_COUNT * i];
+ thread_args[i].ticks3 = &end_ticks[TEST1_ELEMENT_COUNT * i];
+ thread_args[i].mars_ctx = mars_ctx;
+ ret = pthread_create(&threads[i], NULL, test_thread,
+ &thread_args[i]);
+ MARS_TEST_ASSERT_EQUAL(ret, 0);
+ }
+
+ for (i = 0; i < mpu; i++) {
+ ret = pthread_join(threads[i], NULL);
+ MARS_TEST_ASSERT_EQUAL(ret, 0);
+ }
+
+ ret = mars_context_destroy(mars_ctx);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+
+ size = TEST1_ELEMENT_COUNT * mpu;
+
+ for (i = 0; i < size; i++) {
+ ticks[i] = start2_ticks[i] - start1_ticks[i];
+ }
+ sprintf(text, "signal mpu-mpu: signal (%d mpu pairs)",mpu);
+ mars_test_print_statistics(ticks, size, text);
+
+ for (i = 0; i < size; i++) {
+ ticks[i] = end_ticks[i] - start1_ticks[i];
+ }
+ sprintf(text, "signal mpu-mpu: start signal - end wait (%d mpu pairs)",mpu);
+ mars_test_print_statistics(ticks, size, text);
+ for (i = 0; i < size; i++) {
+ ticks[i] = end_ticks[i] - start2_ticks[i];
+ }
+ sprintf(text, "signal mpu-mpu: end signal - end wait (%d mpu pairs)",mpu);
+ mars_test_print_statistics(ticks, size, text);
+
+ free(start1_ticks);
+ free(start2_ticks);
+ free(end_ticks);
+ free(ticks);
+}
+
+int main(int argc, char *argv[])
+{
+ int mpu,spe;
+ size_t size;
+ pthread_t *threads;
+ struct thread_arg_st *thread_args;
+
+ spe = spe_cpu_info_get(SPE_COUNT_PHYSICAL_SPES, -1);
+
+ for(mpu = MIN_MPUS; mpu<=MAX_MPUS; mpu++){
+
+ threads = (pthread_t *) malloc(sizeof(pthread_t) * mpu);
+ MARS_TEST_ASSERT(threads != NULL);
+
+ size = sizeof(struct thread_arg_st) * mpu;
+ thread_args = (struct thread_arg_st *)malloc(size);
+ MARS_TEST_ASSERT(thread_args != NULL);
+
+ MARS_TEST_PERF_INIT();
+
+ test1(mpu, threads, thread_args);
+
+ free(thread_args);
+ free(threads);
+
+ }
+
+ return 0;
+}
diff --git a/tests/TPF/TPF_60_004/mpu1.c b/tests/TPF/TPF_60_004/mpu1.c
new file mode 100644
index 0000000..597edb5
--- /dev/null
+++ b/tests/TPF/TPF_60_004/mpu1.c
@@ -0,0 +1,62 @@
+/*
+ * Copyright 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/task.h>
+#include <mars_test.h>
+#include <common.h>
+
+int mars_task_main(const struct mars_task_args *task_args)
+{
+ int ret, i;
+ static struct test_task_args_st args ALIGN128;
+ static uint32_t start1_ticks[TEST1_ELEMENT_COUNT] ALIGN128;
+ static uint32_t start2_ticks[TEST1_ELEMENT_COUNT] ALIGN128;
+
+ mfc_get(&args, task_args->type.u64[0], sizeof(struct test_task_args_st),
+ 0, 0, 0);
+ mfc_write_tag_mask(1);
+ mfc_read_tag_status_all();
+
+ for (i = 0; i < TEST1_ELEMENT_COUNT; i++) {
+ ret = mars_task_barrier_notify(args.barrier_ea);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+ ret = mars_task_barrier_wait(args.barrier_ea);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+
+ mars_test_usleep(args.tb_freq, DELAY); /*give wait task time to block */
+
+ start1_ticks[i] = mars_task_get_ticks();
+ ret = mars_task_signal_send(&args.task_id);
+ start2_ticks[i] = mars_task_get_ticks();
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+ }
+
+ mfc_put(start1_ticks, args.ticks1_ea, TEST1_ELEMENT_COUNT * 4, 0, 0, 0);
+ mfc_write_tag_mask(1);
+ mfc_read_tag_status_all();
+
+ mfc_put(start2_ticks, args.ticks2_ea, TEST1_ELEMENT_COUNT * 4, 0, 0, 0);
+ mfc_write_tag_mask(1);
+ mfc_read_tag_status_all();
+ return 0;
+}
diff --git a/tests/TPF/TPF_60_004/mpu2.c b/tests/TPF/TPF_60_004/mpu2.c
new file mode 100644
index 0000000..4e5ba7a
--- /dev/null
+++ b/tests/TPF/TPF_60_004/mpu2.c
@@ -0,0 +1,54 @@
+/*
+ * Copyright 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/task.h>
+#include <mars_test.h>
+#include <common.h>
+
+int mars_task_main(const struct mars_task_args *task_args)
+{
+ int ret, i;
+ static struct test_task_args_st args ALIGN128;
+ static uint32_t end_ticks[TEST1_ELEMENT_COUNT] ALIGN128;
+
+ mfc_get(&args, task_args->type.u64[0], sizeof(struct test_task_args_st),
+ 0, 0, 0);
+ mfc_write_tag_mask(1);
+ mfc_read_tag_status_all();
+
+ for (i = 0; i < TEST1_ELEMENT_COUNT; i++) {
+ ret = mars_task_barrier_notify(args.barrier_ea);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+ ret = mars_task_barrier_wait(args.barrier_ea);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+
+ mars_task_signal_wait();
+ end_ticks[i] = mars_task_get_ticks();
+ }
+
+ mfc_put(end_ticks, args.ticks3_ea, TEST1_ELEMENT_COUNT * 4, 0, 0, 0);
+ mfc_write_tag_mask(1);
+ mfc_read_tag_status_all();
+
+ return 0;
+}
diff --git a/tests/TPF/TPF_60_005/Makefile b/tests/TPF/TPF_60_005/Makefile
new file mode 100644
index 0000000..9eeb382
--- /dev/null
+++ b/tests/TPF/TPF_60_005/Makefile
@@ -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.
+#
+
+EXTRA_LDFLAGS=-lm
+INCLUDE_CFLAGS+= -I./
+MPU_INCLUDE_CFLAGS+= -I./
+
+top_srcdir = ../..
+test_objs = host.o mpu1.task_eo mpu2.task_eo
+timeout = 180
+
+include $(top_srcdir)/scripts/config.mk
+include $(top_srcdir)/scripts/rules_item.mk
+include $(top_srcdir)/scripts/rules_tpf.mk
+
+host.o: common.h
+mpu1.task_o: common.h
+mpu2.task_o: common.h
diff --git a/tests/TPF/TPF_60_005/common.h b/tests/TPF/TPF_60_005/common.h
new file mode 100644
index 0000000..04bc050
--- /dev/null
+++ b/tests/TPF/TPF_60_005/common.h
@@ -0,0 +1,43 @@
+/*
+ * Copyright 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/task.h>
+#include <mars_test.h>
+
+#define MIN_MPUS 2
+#define MAX_MPUS spe/2
+
+#define TEST1_ELEMENT_COUNT 4096
+
+#define ALIGN128 __attribute__((aligned(128)))
+
+struct test_task_args_st {
+ uint64_t barrier_ea;
+ uint64_t ticks1_ea;
+ uint64_t ticks2_ea;
+ uint64_t ticks3_ea;
+ struct mars_task_id task_id;
+ uint32_t tb_freq;
+ uint32_t pad[2];
+};
+
diff --git a/tests/TPF/TPF_60_005/host.c b/tests/TPF/TPF_60_005/host.c
new file mode 100644
index 0000000..fe984eb
--- /dev/null
+++ b/tests/TPF/TPF_60_005/host.c
@@ -0,0 +1,24 @@
+/*
+ * Copyright 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 "../TPF_60_004/host.c"
diff --git a/tests/TPF/TPF_60_005/mpu1.c b/tests/TPF/TPF_60_005/mpu1.c
new file mode 100644
index 0000000..c1b1ccc
--- /dev/null
+++ b/tests/TPF/TPF_60_005/mpu1.c
@@ -0,0 +1,24 @@
+/*
+ * Copyright 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 "../TPF_60_004/mpu1.c"
diff --git a/tests/TPF/TPF_60_005/mpu2.c b/tests/TPF/TPF_60_005/mpu2.c
new file mode 100644
index 0000000..409e5cc
--- /dev/null
+++ b/tests/TPF/TPF_60_005/mpu2.c
@@ -0,0 +1,24 @@
+/*
+ * Copyright 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 "../TPF_60_004/mpu2.c"
diff --git a/tests/TPF/TPF_60_006/Makefile b/tests/TPF/TPF_60_006/Makefile
new file mode 100644
index 0000000..9eeb382
--- /dev/null
+++ b/tests/TPF/TPF_60_006/Makefile
@@ -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.
+#
+
+EXTRA_LDFLAGS=-lm
+INCLUDE_CFLAGS+= -I./
+MPU_INCLUDE_CFLAGS+= -I./
+
+top_srcdir = ../..
+test_objs = host.o mpu1.task_eo mpu2.task_eo
+timeout = 180
+
+include $(top_srcdir)/scripts/config.mk
+include $(top_srcdir)/scripts/rules_item.mk
+include $(top_srcdir)/scripts/rules_tpf.mk
+
+host.o: common.h
+mpu1.task_o: common.h
+mpu2.task_o: common.h
diff --git a/tests/TPF/TPF_60_006/common.h b/tests/TPF/TPF_60_006/common.h
new file mode 100644
index 0000000..d0817c9
--- /dev/null
+++ b/tests/TPF/TPF_60_006/common.h
@@ -0,0 +1,43 @@
+/*
+ * Copyright 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/task.h>
+#include <mars_test.h>
+
+#define MIN_MPUS (spe/2)+1
+#define MAX_MPUS spe
+
+#define TEST1_ELEMENT_COUNT 4096
+
+#define ALIGN128 __attribute__((aligned(128)))
+
+struct test_task_args_st {
+ uint64_t barrier_ea;
+ uint64_t ticks1_ea;
+ uint64_t ticks2_ea;
+ uint64_t ticks3_ea;
+ struct mars_task_id task_id;
+ uint32_t tb_freq;
+ uint32_t pad[2];
+};
+
diff --git a/tests/TPF/TPF_60_006/host.c b/tests/TPF/TPF_60_006/host.c
new file mode 100644
index 0000000..fe984eb
--- /dev/null
+++ b/tests/TPF/TPF_60_006/host.c
@@ -0,0 +1,24 @@
+/*
+ * Copyright 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 "../TPF_60_004/host.c"
diff --git a/tests/TPF/TPF_60_006/mpu1.c b/tests/TPF/TPF_60_006/mpu1.c
new file mode 100644
index 0000000..c1b1ccc
--- /dev/null
+++ b/tests/TPF/TPF_60_006/mpu1.c
@@ -0,0 +1,24 @@
+/*
+ * Copyright 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 "../TPF_60_004/mpu1.c"
diff --git a/tests/TPF/TPF_60_006/mpu2.c b/tests/TPF/TPF_60_006/mpu2.c
new file mode 100644
index 0000000..409e5cc
--- /dev/null
+++ b/tests/TPF/TPF_60_006/mpu2.c
@@ -0,0 +1,24 @@
+/*
+ * Copyright 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 "../TPF_60_004/mpu2.c"
diff --git a/tests/TPI/Makefile b/tests/TPI/Makefile
new file mode 100644
index 0000000..1cd197d
--- /dev/null
+++ b/tests/TPI/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_items = \
+ TPI_10_001 \
+ TPI_10_002 \
+ TPI_10_003 \
+ TPI_10_004 \
+ TPI_10_005
+include $(top_srcdir)/scripts/config.mk
+include $(top_srcdir)/scripts/rules_class.mk
diff --git a/tests/TPI/TPI_10_001/Makefile b/tests/TPI/TPI_10_001/Makefile
new file mode 100644
index 0000000..669d1c3
--- /dev/null
+++ b/tests/TPI/TPI_10_001/Makefile
@@ -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.
+#
+
+EXTRA_LDFLAGS=-lm
+
+top_srcdir = ../..
+test_objs = host.o
+timeout = 120
+
+include $(top_srcdir)/scripts/config.mk
+include $(top_srcdir)/scripts/rules_item.mk
+
+host.o:
diff --git a/tests/TPI/TPI_10_001/host.c b/tests/TPI/TPI_10_001/host.c
new file mode 100644
index 0000000..95510e2
--- /dev/null
+++ b/tests/TPI/TPI_10_001/host.c
@@ -0,0 +1,112 @@
+/*
+ * Copyright 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 TEST1_ELEMENT_COUNT 4096
+
+#include <pthread.h>
+#include <libspe2.h>
+#include <mars/task.h>
+#include <mars/mutex.h>
+#include <mars_test.h>
+
+struct thread_arg_st {
+ int32_t *ticks1;
+ int32_t *ticks2;
+};
+
+void *test_thread(void *arg)
+{
+ int ret, i;
+ int32_t start, end;
+ struct thread_arg_st *thread_arg = arg;
+ int32_t *lock_ticks = thread_arg->ticks1;
+ int32_t *unlock_ticks = thread_arg->ticks2;
+ uint64_t mutex;
+
+ ret = mars_mutex_create(&mutex);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+
+ for (i = 0; i < TEST1_ELEMENT_COUNT; i++) {
+ start = mars_task_get_ticks();
+ ret = mars_mutex_lock(mutex);
+ end = mars_task_get_ticks();
+ lock_ticks[i] = end - start;
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+
+ start = mars_task_get_ticks();
+ ret = mars_mutex_unlock(mutex);
+ end = mars_task_get_ticks();
+ unlock_ticks[i] = end - start;
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+ }
+
+ ret = mars_mutex_destroy(mutex);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+
+ return NULL;
+}
+
+void test1(void)
+{
+ int ret;
+ size_t size;
+ int32_t *lock_ticks, *unlock_ticks;
+ struct mars_context *mars_ctx;
+ struct thread_arg_st thread_arg;
+ pthread_t thread;
+
+ size = sizeof(uint32_t) * TEST1_ELEMENT_COUNT;
+
+ ret = posix_memalign((void **)&lock_ticks, 128, size);
+ MARS_TEST_ASSERT_EQUAL(ret, 0);
+ ret = posix_memalign((void **)&unlock_ticks, 128, size);
+ MARS_TEST_ASSERT_EQUAL(ret, 0);
+
+ ret = mars_context_create(&mars_ctx, 0, 1);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+
+ thread_arg.ticks1 = lock_ticks;
+ thread_arg.ticks2 = unlock_ticks;
+ ret = pthread_create(&thread, NULL, test_thread, &thread_arg);
+ MARS_TEST_ASSERT_EQUAL(ret, 0);
+
+ ret = pthread_join(thread, NULL);
+ MARS_TEST_ASSERT_EQUAL(ret, 0);
+
+ ret = mars_context_destroy(mars_ctx);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+
+ size = TEST1_ELEMENT_COUNT;
+ mars_test_print_statistics(lock_ticks, size, "mutex lock");
+ mars_test_print_statistics(unlock_ticks, size, "mutex unlock");
+
+ free(lock_ticks);
+ free(unlock_ticks);
+}
+
+int main(int argc, char *argv[])
+{
+ test1();
+
+ return 0;
+}
diff --git a/tests/TPI/TPI_10_002/Makefile b/tests/TPI/TPI_10_002/Makefile
new file mode 100644
index 0000000..f8f4351
--- /dev/null
+++ b/tests/TPI/TPI_10_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.
+#
+
+EXTRA_LDFLAGS=-lm
+EXTRA_MPU_LDFLAGS+=$(MARS_BUILD)/base/src/mpu/kernel/mutex.o
+MPU_INCLUDE_CFLAGS+= -I$(MARS_BUILD)/base/include/host/
+MPU_INCLUDE_CFLAGS+= -I$(MARS_BUILD)/base/src/common/
+top_srcdir = ../..
+test_objs = host.o mpu1.task_eo
+
+include $(top_srcdir)/scripts/config.mk
+include $(top_srcdir)/scripts/rules_item.mk
diff --git a/tests/TPI/TPI_10_002/common.h b/tests/TPI/TPI_10_002/common.h
new file mode 100644
index 0000000..b577505
--- /dev/null
+++ b/tests/TPI/TPI_10_002/common.h
@@ -0,0 +1,32 @@
+/*
+ * 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 LOOP_COUNT 1024
+#define ALIGN128 __attribute__((aligned(128)))
+struct test_task_args_st {
+ uint64_t mutex_ea;
+ uint64_t shared_resource_ea;
+ uint64_t ticks1_ea;
+ uint64_t ticks2_ea;
+};
diff --git a/tests/TPI/TPI_10_002/host.c b/tests/TPI/TPI_10_002/host.c
new file mode 100644
index 0000000..2a694e3
--- /dev/null
+++ b/tests/TPI/TPI_10_002/host.c
@@ -0,0 +1,94 @@
+/*
+ * Copyright 2008 Sony Corporation
+ *
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a copy
+ * of this software and associated documentation files (the "Software"), to deal
+ * in the Software without restriction, including without limitation the rights
+ * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+ * copies of the Software, and to permit persons to whom the Software is
+ * furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included in
+ * all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+ * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ * LIABILITY, WHETHER IN AN ACTION OF 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/task.h>
+#include <mars/mutex.h>
+#include <mars_test.h>
+#include "common.h"
+
+extern spe_program_handle_t mpu1_prog ALIGN128;
+
+static struct mars_task_args task_args;
+
+int test1(void)
+{
+ int exit_code, ret;
+ int32_t lock[LOOP_COUNT] ALIGN128;
+ int32_t unlock[LOOP_COUNT] ALIGN128;
+
+ struct test_task_args_st args ALIGN128;
+
+ uint64_t mutex ALIGN128;
+ int spe_cnt = spe_cpu_info_get(SPE_COUNT_PHYSICAL_SPES, -1);
+
+ static struct mars_context *mars ALIGN128;
+ static struct mars_task_id task_id ALIGN128;
+
+ ret = mars_context_create(&mars, spe_cnt, 0);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+
+ ret = mars_mutex_create(&mutex);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+
+ ret = mars_task_create(mars, &task_id, "TPI10002", mpu1_prog.elf_image,
+ MARS_TASK_CONTEXT_SAVE_SIZE_MAX);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+
+ args.mutex_ea = mutex;
+ args.ticks1_ea = mars_ptr_to_ea(lock);
+ args.ticks2_ea = mars_ptr_to_ea(unlock);
+ task_args.type.u64[0] = mars_ptr_to_ea(&args);
+
+ 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_mutex_destroy(mutex);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+
+ ret = mars_context_destroy(mars);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+
+ mars_test_print_statistics(lock, LOOP_COUNT,
+ "mutex lock single mpu task");
+ mars_test_print_statistics(unlock, LOOP_COUNT,
+ "mutex unlock single mpu task");
+
+ return 0;
+}
+
+int main(void)
+{
+ int ret;
+ ret = test1();
+
+ return 0;
+}
diff --git a/tests/TPI/TPI_10_002/mpu1.c b/tests/TPI/TPI_10_002/mpu1.c
new file mode 100644
index 0000000..b39f766
--- /dev/null
+++ b/tests/TPI/TPI_10_002/mpu1.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 <mars_test.h>
+#include <mars/task.h>
+#include <mars/mutex.h>
+#include <kernel_internal_types.h>
+#include "common.h"
+
+int mars_task_main(const struct mars_task_args *task_args)
+{
+ int32_t i, ret, lock[LOOP_COUNT], unlock[LOOP_COUNT];
+ int32_t end, start;
+ struct test_task_args_st args ALIGN128;
+ static struct mars_mutex mutex;
+
+ mfc_get(&args, task_args->type.u64[0],
+ sizeof(struct test_task_args_st), 0, 0, 0);
+ mfc_write_tag_mask(1);
+ mfc_read_tag_status_all();
+
+ for (i = 0; i < LOOP_COUNT; i++) {
+ start = mars_task_get_ticks();
+ ret = mutex_lock_get(args.mutex_ea, &mutex);
+ end = mars_task_get_ticks();
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+ lock[i] = end - start;
+
+ start = mars_task_get_ticks();
+ ret = mutex_unlock_put(args.mutex_ea, &mutex);
+ end = mars_task_get_ticks();
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+ unlock[i] = end - start;
+ }
+
+ mfc_put(lock, args.ticks1_ea, LOOP_COUNT * 4, 0, 0, 0);
+ mfc_write_tag_mask(1);
+ mfc_read_tag_status_all();
+
+ mfc_put(unlock, args.ticks2_ea, LOOP_COUNT * 4, 0, 0, 0);
+ mfc_write_tag_mask(1);
+ mfc_read_tag_status_all();
+
+ mars_task_exit(0);
+
+ return 0;
+}
diff --git a/tests/TPI/TPI_10_003/Makefile b/tests/TPI/TPI_10_003/Makefile
new file mode 100644
index 0000000..669d1c3
--- /dev/null
+++ b/tests/TPI/TPI_10_003/Makefile
@@ -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.
+#
+
+EXTRA_LDFLAGS=-lm
+
+top_srcdir = ../..
+test_objs = host.o
+timeout = 120
+
+include $(top_srcdir)/scripts/config.mk
+include $(top_srcdir)/scripts/rules_item.mk
+
+host.o:
diff --git a/tests/TPI/TPI_10_003/host.c b/tests/TPI/TPI_10_003/host.c
new file mode 100644
index 0000000..3c0e1bb
--- /dev/null
+++ b/tests/TPI/TPI_10_003/host.c
@@ -0,0 +1,158 @@
+/*
+ * Copyright 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 TEST1_ELEMENT_COUNT 4096
+
+#include <pthread.h>
+#include <libspe2.h>
+#include <mars/task.h>
+#include <mars/mutex.h>
+#include <mars_test.h>
+
+struct thread_arg_st {
+ int32_t *start_ticks;
+ int32_t *end_ticks;
+ uint64_t mutex;
+ pthread_barrier_t *barrier;
+};
+
+void *test_thread1(void *arg)
+{
+ int ret, i;
+ struct thread_arg_st *thread_arg = arg;
+ int32_t *end_ticks = thread_arg->end_ticks;
+
+ ret = mars_mutex_lock(thread_arg->mutex);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+
+ for (i = 0; i < TEST1_ELEMENT_COUNT; i++) {
+ ret = mars_mutex_lock(thread_arg->mutex);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+ end_ticks[i] = mars_task_get_ticks();
+
+ ret = pthread_barrier_wait(thread_arg->barrier);
+ MARS_TEST_ASSERT(ret == PTHREAD_BARRIER_SERIAL_THREAD
+ || ret == 0);
+ }
+
+ return NULL;
+}
+
+void *test_thread2(void *arg)
+{
+ int ret, i;
+ struct thread_arg_st *thread_arg = arg;
+ int32_t *start_ticks = thread_arg->start_ticks;
+
+
+ for (i = 0; i < TEST1_ELEMENT_COUNT; i++) {
+ usleep(500);
+ start_ticks[i] = mars_task_get_ticks();
+ ret = mars_mutex_unlock(thread_arg->mutex);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+
+ ret = pthread_barrier_wait(thread_arg->barrier);
+ MARS_TEST_ASSERT(ret == PTHREAD_BARRIER_SERIAL_THREAD
+ || ret == 0);
+ }
+
+ ret = mars_mutex_unlock(thread_arg->mutex);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+
+ return NULL;
+}
+
+void test1(void)
+{
+ int ret, i;
+ int threads = 2;
+ size_t size;
+
+ struct mars_context *mars_ctx;
+ struct thread_arg_st thread_arg;
+ pthread_t thread[threads];
+ pthread_barrier_t barrier;
+ uint64_t mutex;
+ int32_t *start_ticks, *end_ticks, *ticks;
+
+ size = sizeof(uint32_t) * TEST1_ELEMENT_COUNT;
+
+ ret = posix_memalign((void **)&start_ticks, 128, size);
+ MARS_TEST_ASSERT_EQUAL(ret, 0);
+ ret = posix_memalign((void **)&end_ticks, 128, size);
+ MARS_TEST_ASSERT_EQUAL(ret, 0);
+ ret = posix_memalign((void **)&ticks, 128, size);
+ MARS_TEST_ASSERT_EQUAL(ret, 0);
+
+ ret = mars_context_create(&mars_ctx, 0, 1);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+
+ ret = mars_mutex_create(&mutex);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+
+ ret = pthread_barrier_init(&barrier, NULL, threads);
+ MARS_TEST_ASSERT_EQUAL(ret, 0);
+
+ thread_arg.start_ticks = start_ticks;
+ thread_arg.end_ticks = end_ticks;
+ thread_arg.barrier = &barrier;
+ thread_arg.mutex = mutex;
+
+ ret = pthread_create(&thread[0], NULL, test_thread1, &thread_arg);
+ MARS_TEST_ASSERT_EQUAL(ret, 0);
+
+ ret = pthread_create(&thread[1], NULL, test_thread2, &thread_arg);
+ MARS_TEST_ASSERT_EQUAL(ret, 0);
+
+ for (i = 0; i < threads; i++) {
+ ret = pthread_join(thread[i], NULL);
+ MARS_TEST_ASSERT_EQUAL(ret, 0);
+ }
+
+ ret = mars_mutex_destroy(mutex);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+
+ ret = mars_context_destroy(mars_ctx);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+
+ size = TEST1_ELEMENT_COUNT;
+
+ for (i = 0; i < size; i++) {
+ ticks[i] = end_ticks[i] - start_ticks[i];
+ }
+
+ mars_test_print_statistics(ticks, size,
+ "mutex start of unlock end of lock");
+ /*Note:end of unlock to end of lock time to small to be reliably measured*/
+
+ free(start_ticks);
+ free(end_ticks);
+ free(ticks);
+}
+
+int main(int argc, char *argv[])
+{
+ test1();
+
+ return 0;
+}
diff --git a/tests/TPI/TPI_10_004/Makefile b/tests/TPI/TPI_10_004/Makefile
new file mode 100644
index 0000000..f4ae4d7
--- /dev/null
+++ b/tests/TPI/TPI_10_004/Makefile
@@ -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.
+#
+EXTRA_LDFLAGS=-lm
+EXTRA_MPU_LDFLAGS+=$(MARS_BUILD)/base/src/mpu/kernel/mutex.o
+MPU_INCLUDE_CFLAGS+= -I$(MARS_BUILD)/base/src/common/
+MPU_INCLUDE_CFLAGS+= -I$(MARS_BUILD)/base/include/host/
+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/TPI/TPI_10_004/common.h b/tests/TPI/TPI_10_004/common.h
new file mode 100644
index 0000000..a7cca18
--- /dev/null
+++ b/tests/TPI/TPI_10_004/common.h
@@ -0,0 +1,33 @@
+/*
+ * 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 LOOP_COUNT 96
+#define ALIGN128 __attribute__((aligned(128)))
+struct test_task_args_st {
+ uint64_t mutex_ea;
+ uint64_t ticks1_ea;
+ uint64_t ticks2_ea;
+ uint32_t tb_freq;
+ uint32_t pad[1];
+};
diff --git a/tests/TPI/TPI_10_004/host.c b/tests/TPI/TPI_10_004/host.c
new file mode 100644
index 0000000..3a3692c
--- /dev/null
+++ b/tests/TPI/TPI_10_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/task.h>
+#include <mars/mutex.h>
+#include <mars_test.h>
+#include "common.h"
+
+extern spe_program_handle_t mpu1_prog, mpu2_prog ALIGN128;
+
+static struct mars_task_args task_args;
+
+int test1(void)
+{
+ int i, exit_code, ret;
+ int32_t start[LOOP_COUNT] ALIGN128;
+ int32_t end[LOOP_COUNT] ALIGN128;
+ int32_t time[LOOP_COUNT] ALIGN128;
+ struct test_task_args_st args ALIGN128;
+ uint32_t tb_freq;
+
+ uint64_t mutex ALIGN128;
+ int spe_cnt = spe_cpu_info_get(SPE_COUNT_PHYSICAL_SPES, -1);
+
+ static struct mars_context *mars ALIGN128;
+ static struct mars_task_id task_id[2] ALIGN128;
+
+ ret = mars_context_create(&mars, spe_cnt, 0);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+
+ 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);
+
+ ret = mars_task_create(mars, &task_id[0], "10004", mpu1_prog.elf_image,
+ MARS_TASK_CONTEXT_SAVE_SIZE_MAX);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+
+ ret = mars_task_create(mars, &task_id[1], "10004", mpu2_prog.elf_image,
+ MARS_TASK_CONTEXT_SAVE_SIZE_MAX);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+
+ args.mutex_ea = mutex;
+ args.tb_freq = tb_freq;
+ args.ticks1_ea = mars_ptr_to_ea(start);
+ args.ticks2_ea = mars_ptr_to_ea(end);
+ task_args.type.u64[0] = mars_ptr_to_ea(&args);
+
+ for (i = 0; i < 2; i++) {
+ ret = mars_task_schedule(&task_id[i], &task_args, 0);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+ }
+ for (i = 0; i < 2; i++) {
+ ret = mars_task_wait(&task_id[i], &exit_code);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+
+ ret = mars_task_destroy(&task_id[i]);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+ }
+
+ ret = mars_mutex_destroy(mutex);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+
+ ret = mars_context_destroy(mars);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+
+ for (i = 0; i < LOOP_COUNT; i++) {
+ time[i] = end[i] - start[i];
+ }
+
+ mars_test_print_statistics(time, LOOP_COUNT,
+ "mutex: start of put - end of get");
+ return 0;
+}
+
+int main(void)
+{
+ int ret;
+ ret = test1();
+
+ return 0;
+}
diff --git a/tests/TPI/TPI_10_004/mpu1.c b/tests/TPI/TPI_10_004/mpu1.c
new file mode 100644
index 0000000..01e6ec4
--- /dev/null
+++ b/tests/TPI/TPI_10_004/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_test.h>
+#include <mars/task.h>
+#include <mars/mutex.h>
+#include <kernel_internal_types.h>
+#include "common.h"
+#include <unistd.h>
+
+
+int mars_task_main(const struct mars_task_args *task_args)
+{
+ int i, ret;
+ int32_t start[LOOP_COUNT] ALIGN128;
+ struct test_task_args_st args ALIGN128;
+ static struct mars_mutex mutex;
+
+ mfc_get(&args, task_args->type.u64[0], sizeof(struct test_task_args_st),
+ 0, 0, 0);
+ mfc_write_tag_mask(1);
+ mfc_read_tag_status_all();
+
+ for (i = 0; i < LOOP_COUNT; i++) {
+ ret = mutex_lock_get(args.mutex_ea, &mutex);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+
+ mars_test_usleep(args.tb_freq, 100); /*ensure mpu2 is blocking */
+
+ start[i] = mars_task_get_ticks();
+ ret = mutex_unlock_put(args.mutex_ea, &mutex);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+ }
+
+ mfc_put(start, args.ticks1_ea, LOOP_COUNT * 4, 0, 0, 0);
+ mfc_write_tag_mask(1);
+ mfc_read_tag_status_all();
+
+ mars_task_exit(0);
+
+ return 0;
+}
diff --git a/tests/TPI/TPI_10_004/mpu2.c b/tests/TPI/TPI_10_004/mpu2.c
new file mode 100644
index 0000000..994942f
--- /dev/null
+++ b/tests/TPI/TPI_10_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_test.h>
+#include <mars/task.h>
+#include <mars/mutex.h>
+#include <kernel_internal_types.h>
+#include "common.h"
+
+int mars_task_main(const struct mars_task_args *task_args)
+{
+ int i, ret;
+ int32_t end[LOOP_COUNT] ALIGN128;
+ struct test_task_args_st args ALIGN128;
+ static struct mars_mutex mutex;
+
+ mfc_get(&args, task_args->type.u64[0], sizeof(struct test_task_args_st),
+ 0, 0, 0);
+ mfc_write_tag_mask(1);
+ mfc_read_tag_status_all();
+
+ mars_test_usleep(args.tb_freq, 100); /*ensure mpu1 starts first */
+
+ for (i = 0; i < LOOP_COUNT; i++) {
+
+ ret = mutex_lock_get(args.mutex_ea, &mutex); /*this should block until released*/
+ end[i] = mars_task_get_ticks();
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+
+ ret = mutex_unlock_put(args.mutex_ea, &mutex);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+ }
+
+ mfc_put(end, args.ticks2_ea, LOOP_COUNT * 4, 0, 0, 0);
+ mfc_write_tag_mask(1);
+ mfc_read_tag_status_all();
+
+ mars_task_exit(0);
+
+ return 0;
+}
diff --git a/tests/TPI/TPI_10_005/Makefile b/tests/TPI/TPI_10_005/Makefile
new file mode 100644
index 0000000..1eb0be8
--- /dev/null
+++ b/tests/TPI/TPI_10_005/Makefile
@@ -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.
+#
+
+EXTRA_LDFLAGS=-lm
+EXTRA_MPU_LDFLAGS+=$(MARS_BUILD)/base/src/mpu/kernel/mutex.o
+MPU_INCLUDE_CFLAGS+= -I$(MARS_BUILD)/base/src/common/
+
+top_srcdir = ../..
+test_objs = host.o mpu1.task_eo
+timeout = 120
+
+include $(top_srcdir)/scripts/config.mk
+include $(top_srcdir)/scripts/rules_item.mk
+
+host.o: common.h
+mpu1.task_o: common.h
diff --git a/tests/TPI/TPI_10_005/common.h b/tests/TPI/TPI_10_005/common.h
new file mode 100644
index 0000000..76181e0
--- /dev/null
+++ b/tests/TPI/TPI_10_005/common.h
@@ -0,0 +1,44 @@
+/*
+ * Copyright 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/task.h>
+#include <mars_test.h>
+
+#define QUEUE_DEPTH 16
+#define ELEMENT_SIZE 128
+#define TEST1_ELEMENT_COUNT 4096
+#define TEST2_ELEMENT_COUNT 4096
+#define TEST3_ELEMENT_COUNT 4096
+
+#define ALIGN128 __attribute__((aligned(128)))
+
+struct test_task_args_st {
+ uint64_t ticks1_ea;
+ uint64_t ticks2_ea;
+ uint64_t ticks3_ea;
+ uint64_t sender_to_receiver_ea;
+ uint64_t receiver_to_sender_ea;
+ uint64_t mutex_ea;
+
+};
+
diff --git a/tests/TPI/TPI_10_005/host.c b/tests/TPI/TPI_10_005/host.c
new file mode 100644
index 0000000..2f91bf5
--- /dev/null
+++ b/tests/TPI/TPI_10_005/host.c
@@ -0,0 +1,149 @@
+/*
+ * Copyright 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 <pthread.h>
+#include <libspe2.h>
+#include <mars/task.h>
+#include <mars/mutex.h>
+#include <mars_test.h>
+#include "common.h"
+
+extern spe_program_handle_t mpu1_prog;
+
+struct thread_arg_st {
+ int32_t *ticks1;
+ int32_t *ticks2;
+ struct mars_context *mars_ctx;
+};
+
+void *test_thread(void *arg)
+{
+ int i, ret;
+ struct thread_arg_st *thread_arg = arg;
+ int32_t *start_ticks = thread_arg->ticks1;
+ int32_t *end_ticks = thread_arg->ticks2;
+ struct mars_context *mars_ctx = thread_arg->mars_ctx;
+ struct mars_task_id task_id;
+ struct mars_task_args task_args;
+ static __thread struct test_task_args_st args ALIGN128;
+
+ uint32_t sender_to_receiver = UINT32_MAX;
+ uint32_t receiver_to_sender = UINT32_MAX;
+ uint64_t mutex ALIGN128;
+
+ ret = mars_task_create(mars_ctx, &task_id, NULL,
+ mpu1_prog.elf_image,
+ MARS_TASK_CONTEXT_SAVE_SIZE_MAX);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+
+ ret = mars_mutex_create(&mutex);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+
+ args.mutex_ea = mutex;
+ args.sender_to_receiver_ea = mars_ptr_to_ea(&sender_to_receiver);
+ args.receiver_to_sender_ea = mars_ptr_to_ea(&receiver_to_sender);
+ args.ticks1_ea = mars_ptr_to_ea(start_ticks);
+ args.ticks2_ea = mars_ptr_to_ea(end_ticks);
+ task_args.type.u64[0] = mars_ptr_to_ea(&args);
+
+ ret = mars_task_schedule(&task_id, &task_args, 0);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+
+ for (i = 0; i < TEST1_ELEMENT_COUNT; i++) {
+ ret = mars_mutex_lock(mutex);
+ mars_test_counter_set(&sender_to_receiver, i);
+ mars_test_counter_wait(&receiver_to_sender, i);
+
+ usleep(1000);/*give mpu time to block*/
+
+ start_ticks[i] = mars_task_get_ticks();
+ ret = mars_mutex_unlock(mutex);
+ }
+
+ ret = mars_mutex_destroy(mutex);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+
+ ret = mars_task_wait(&task_id, NULL);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+
+ ret = mars_task_destroy(&task_id);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+
+ return NULL;
+}
+
+void test1()
+{
+ int ret, i;
+ size_t size;
+ int32_t *start_ticks, *end_ticks, *ticks;
+ struct mars_context *mars_ctx;
+ pthread_t thread;
+ struct thread_arg_st thread_arg;
+
+ size = sizeof(uint32_t) * TEST1_ELEMENT_COUNT;
+
+ ret = posix_memalign((void **)&start_ticks, 128, size);
+ MARS_TEST_ASSERT_EQUAL(ret, 0);
+
+ ret = posix_memalign((void **)&end_ticks, 128, size);
+ MARS_TEST_ASSERT_EQUAL(ret, 0);
+
+ ret = posix_memalign((void **)&ticks, 128, size);
+ MARS_TEST_ASSERT_EQUAL(ret, 0);
+
+ ret = mars_context_create(&mars_ctx, 0, 1);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+
+ thread_arg.ticks1 = start_ticks;
+ thread_arg.ticks2 = end_ticks;
+ thread_arg.mars_ctx = mars_ctx;
+
+ ret = pthread_create(&thread, NULL, test_thread, &thread_arg);
+ MARS_TEST_ASSERT_EQUAL(ret, 0);
+
+ ret = pthread_join(thread, NULL);
+ MARS_TEST_ASSERT_EQUAL(ret, 0);
+
+ ret = mars_context_destroy(mars_ctx);
+ MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+
+ size = TEST1_ELEMENT_COUNT;
+
+ for (i = 0; i < size; i++) {
+ ticks[i] = end_ticks[i] - start_ticks[i];
+ }
+
+ mars_test_print_statistics(ticks, size, "start of acquire end of release");
+
+ free(start_ticks);
+ free(end_ticks);
+ free(ticks);
+}
+
+int main(int argc, char *argv[])
+{
+ test1();
+
+ return 0;
+}
diff --git a/tests/TFP/TFP_24_003/mpu1.c b/tests/TPI/TPI_10_005/mpu1.c
index f90e163..8080b05 100644
--- a/tests/TFP/TFP_24_003/mpu1.c
+++ b/tests/TPI/TPI_10_005/mpu1.c
@@ -1,5 +1,5 @@
/*
- * Copyright 2008 Sony Corporation
+ * Copyright 2008 Sony Computer Entertainment Inc.
*
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
@@ -22,36 +22,34 @@
*/
#include <mars/task.h>
-#include <mars_task_test.h>
-#include <spu_mfcio.h>
-
-static uint32_t shared_resource __attribute((aligned(16)));
+#include <mars_test.h>
+#include <kernel_internal_types.h>
+#include "common.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 shared_resource_ea = task_args->type.u64[1];
+ int ret, i;
+ static struct test_task_args_st args ALIGN128;
+ static int32_t end_ticks[TEST1_ELEMENT_COUNT] ALIGN128;
+ static struct mars_mutex mutex;
+
+ mfc_get(&args, task_args->type.u64[0],
+ sizeof(struct test_task_args_st), 0, 0, 0);
+ mfc_write_tag_mask(1);
+ mfc_read_tag_status_all();
- /* 1st notify/barrier */
- ret = mars_task_barrier_notify(barrier_ea);
- MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+ for (i = 0; i < TEST1_ELEMENT_COUNT; i++) {
+ mars_test_counter_wait(args.sender_to_receiver_ea, i);
+ mars_test_counter_set(args.receiver_to_sender_ea, i);
- ret = mars_task_barrier_wait(barrier_ea);
- MARS_TEST_ASSERT_ERROR(ret, MARS_SUCCESS);
+ ret = mutex_lock_get(args.mutex_ea, &mutex); /*should block here*/
+ end_ticks[i] = mars_task_get_ticks();
+ ret = mutex_unlock_put(args.mutex_ea, &mutex);
+ }
- shared_resource = 1;
- mfc_put(&shared_resource, shared_resource_ea,
- sizeof(uint32_t), 0, 0, 0);
- mfc_write_tag_mask(1 << 0);
+ mfc_put(end_ticks, args.ticks2_ea, sizeof(end_ticks), 0, 0, 0);
+ mfc_write_tag_mask(1);
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/scripts/config.mk b/tests/scripts/config.mk
index d67a208..1b114c4 100644
--- a/tests/scripts/config.mk
+++ b/tests/scripts/config.mk
@@ -47,7 +47,7 @@ MPU_LDFLAGS = \
$(MPU_LIB_LDFLAGS) $(EXTRA_MPU_LDFLAGS)
MPU_TASK_LDFLAGS = \
$(MPU_LDFLAGS) \
- -Wl,-N -Wl,--section-start,.init=0x4000
+ -Wl,--section-start,.init=0x4000
OPT_CFLAGS = -O3
DEFS_CFLAGS = -DMARS_TEST_NAME=\"$(test)\"
@@ -62,27 +62,27 @@ endif
ifneq ($(MARS_SRC),)
MARS_BUILD = $(MARS_SRC)
- INCLUDE_CFLAGS = \
+ INCLUDE_CFLAGS += \
-I$(MARS_SRC)/base/include/host \
-I$(MARS_SRC)/base/include/common \
-I$(MARS_SRC)/task/include/host \
-I$(MARS_SRC)/task/include/common \
-I$(MARS_BUILD)/base/include/host
- LIB_LDFLAGS = \
+ LIB_LDFLAGS += \
-L$(MARS_BUILD)/base/src/host/lib/.libs \
-L$(MARS_BUILD)/task/src/host/lib/.libs
- MPU_INCLUDE_CFLAGS = \
+ MPU_INCLUDE_CFLAGS += \
-I$(MARS_SRC)/base/include/mpu \
-I$(MARS_SRC)/base/include/common \
-I$(MARS_SRC)/task/include/mpu \
-I$(MARS_SRC)/task/include/common \
-I$(MARS_BUILD)/base/include/mpu
- MPU_LIB_LDFLAGS = \
+ MPU_LIB_LDFLAGS += \
-L$(MARS_BUILD)/base/src/mpu/lib/.libs \
-L$(MARS_BUILD)/task/src/mpu/lib/.libs
- RUN_LD_LIBRARY_PATH = \
+ RUN_LD_LIBRARY_PATH += \
LD_LIBRARY_PATH=$(MARS_BUILD)/base/src/host/lib/.libs:$(MARS_BUILD)/task/src/host/lib/.libs
else
ifneq ($(MARS_PREFIX),)
diff --git a/tests/scripts/rules_tpf.mk b/tests/scripts/rules_tpf.mk
new file mode 100644
index 0000000..d1d16f3
--- /dev/null
+++ b/tests/scripts/rules_tpf.mk
@@ -0,0 +1 @@
+DEFS_CFLAGS+=-DDELAY=4000
diff --git a/tests/scripts/tests.csv b/tests/scripts/tests.csv
index f41ca31..b150b19 100644
--- a/tests/scripts/tests.csv
+++ b/tests/scripts/tests.csv
@@ -30,17 +30,6 @@ TICKET#;STATUS;CLASS;ID;DIFFICULT;PRIORITY;PROCESSOR;FUNCTION(S);DESCRIPTION;DET
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."
@@ -149,7 +138,7 @@ TICKET#;STATUS;CLASS;ID;DIFFICULT;PRIORITY;PROCESSOR;FUNCTION(S);DESCRIPTION;DET
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"
+166;new;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"
@@ -277,7 +266,7 @@ TICKET#;STATUS;CLASS;ID;DIFFICULT;PRIORITY;PROCESSOR;FUNCTION(S);DESCRIPTION;DET
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."
+294;closed;POS. FUNC.;TFP01003;N;C;HOST;mars_context_create;"Check if mars_context_create is thread-safe.";"Create MARS contexts respectively for multiple host side threads by calling mars_context_create 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."
@@ -286,32 +275,27 @@ TICKET#;STATUS;CLASS;ID;DIFFICULT;PRIORITY;PROCESSOR;FUNCTION(S);DESCRIPTION;DET
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.";
+328;closed;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;closed;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.";
+337;closed;PERFORMANCE;TPF60001;N;C;;;"Measure performance of signal from HOST to MPU with single task. Sample implementation:";
+338;closed;PERFORMANCE;TPF60002;N;C;;;"Measure performance of signal from HOST to MPU with multiple tasks (<= # of MPUs). Sample implementation:";
+339;closed;PERFORMANCE;TPF60003;N;C;;;"Measure performance of signal from HOST to MPU with multiple tasks (> # of MPUs). Sample implementation:";
+340;closed;PERFORMANCE;TPF60004;N;C;;;"Measure performance of signal from MPU to MPU with single task. Sample implementation:";
+341;closed;PERFORMANCE;TPF60005;N;C;;;"Measure performance of signal from MPU to MPU with multiple tasks (<= # of MPUs). Sample implementation:";
+342;closed;PERFORMANCE;TPF60006;N;C;;;"Measure performance of signal from MPU to MPU with multiple tasks (> # of MPUs). Sample implementation:";
+343;closed;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;closed;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:";
+347;closed;PERFORMANCE;TPF30003;N;A;;;"Measure performance of MPU to MPU event flag with multiple tasks (<= # of MPUs). Sample implementation:";
+348;closed;PERFORMANCE;TPF30004;N;A;;;"Measure performance of MPU to MPU event flag with multiple tasks (> # of MPUs). Sample implementation:";
+349;closed;PERFORMANCE;TPF50001;N;C;;;"Measure performance of semaphore with single task. Sample implementation:";
+350;closed;PERFORMANCE;TPF50002;N;B;;;"Measure performance of semaphore with multiple tasks (<= #of MPUs) without intentional contention. Sample implementation:";
+351;closed;PERFORMANCE;TPF50003;N;B;;;"Measure performance of semaphore with multiple tasks (> #of MPUs) without intentional contention. Sample implementation:";
+352;closed;PERFORMANCE;TPF50004;N;B;;;"Measure performance of semaphore with multiple tasks (<= #of MPUs) with intentional contention. Sample implementation:";
+353;closed;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:";
@@ -324,7 +308,7 @@ TICKET#;STATUS;CLASS;ID;DIFFICULT;PRIORITY;PROCESSOR;FUNCTION(S);DESCRIPTION;DET
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:";
+366;closed;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:";
@@ -339,21 +323,50 @@ TICKET#;STATUS;CLASS;ID;DIFFICULT;PRIORITY;PROCESSOR;FUNCTION(S);DESCRIPTION;DET
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:";
+381;closed;PERFORMANCE;TPF40028;N;A;;;"Measure performance of multiple HOST threads to 1 MPU queue with single task mainly with empty condition. Sample implementation:";
+382;closed;PERFORMANCE;TPF40029;N;A;;;"Measure performance of multiple HOST threads to 1 MPU queue with single task mainly with full condition. Sample implementation:";
+383;closed;PERFORMANCE;TPF40030;Y;C;;;"Measure performance of multiple HOST threads to 1 MPU queue with single task mainly with intermediate condition. Sample implementation:";
+384;closed;PERFORMANCE;TPF40031;N;A;;;"Measure performance of 1 MPU to multiple HOST threads queue with single task mainly with empty condition. Sample implementation:";
+385;closed;PERFORMANCE;TPF40032;N;A;;;"Measure performance of 1 MPU to multiple HOST threads queue with single task mainly with full condition. Sample implementation:";
+386;closed;PERFORMANCE;TPF40033;Y;C;;;"Measure performance of 1 MPU to multiple HOST threads queue with single task mainly with intermediate condition. Sample implementation:";
+387;closed;PERFORMANCE;TPF40034;N;A;;;"Measure performance of 1 MPU to multiple MPU (<= # of MPUs) queue mainly with empty condition. Sample implementation:";
+388;closed;PERFORMANCE;TPF40035;N;A;;;"Measure performance of 1 MPU to multiple MPU (<= # of MPUs) queue mainly with full condition. Sample implementation:";
+389;closed;PERFORMANCE;TPF40036;Y;C;;;"Measure performance of 1 MPU to multiple MPU (<= # of MPUs) queue mainly with intermediate condition. Sample implementation:";
+390;closed;PERFORMANCE;TPF40037;N;A;;;"Measure performance of 1 MPU to multiple MPU (> # of MPUs) queue mainly with empty condition. Sample implementation:";
+391;closed;PERFORMANCE;TPF40038;N;A;;;"Measure performance of 1 MPU to multiple MPU (> # of MPUs) queue mainly with full condition. Sample implementation:";
+392;closed;PERFORMANCE;TPF40039;Y;C;;;"Measure performance of 1 MPU to multiple MPU (> # of MPUs) queue mainly with intermediate condition. Sample implementation:";
+393;closed;PERFORMANCE;TPF40040;N;A;;;"Measure performance of 1 HOST to multiple MPU (<= # of MPUs) queue mainly with empty condition. Sample implementation:";
+394;closed;PERFORMANCE;TPF40041;N;A;;;"Measure performance of 1 HOST to multiple MPU (<= # of MPUs) queue mainly with full condition. Sample implementation:";
+395;closed;PERFORMANCE;TPF40042;Y;C;;;"Measure performance of 1 HOST to multiple MPU (<= # of MPUs) queue mainly with intermediate condition. Sample implementation:";
+396;closed;PERFORMANCE;TPF40043;N;A;;;"Measure performance of 1 HOST to multiple MPU (> # of MPUs) queue mainly with empty condition. Sample implementation:";
+397;closed;PERFORMANCE;TPF40044;N;A;;;"Measure performance of 1 HOST to multiple MPU (> # of MPUs) queue mainly with full condition. Sample implementation:";
+398;closed;PERFORMANCE;TPF40045;Y;C;;;"Measure performance of 1 HOST to multiple MPU (> # of MPUs) queue mainly with intermediate condition. Sample implementation:";
+541;closed;NEG. FUNC.;TFN01001;N;B;HOST;mars_context_create;"Check if mars_context_create return MARS_ERROR_NULL when a null pointer is passed as a first argument (struct mars_context **mars_ret).";
+542;closed;NEG. FUNC.;TFN02001;N;B;HOST;mars_context_destroy;"Check if mars_context_destroy return MARS_ERROR_NULL when a null pointer is passed as a first argument.";
+543;closed;NEG. FUNC.;TFN01002;N;B;HOST;mars_context_create;"Check if mars_context_create returns MARS_ERROR_PARAMS when argument num_mpus < 0.";
+544;closed;NEG. FUNC.;TFN01003;Y;B;HOST;mars_context_create;"Check if mars_context_create returns MARS_ERROR_LIMIT when argument num_mpus is larger than physical (spe_cpu_info_get(SPE_COUNT_PHYSICAL_SPES, -1) + 1) and usable (spe_cpu_info_get(SPE_COUNT_USABLE_SPES, -1) + 1).";
+545;closed;NEG. FUNC.;TFN01004;N;B;HOST;mars_context_create;"Check if mars_context_create returns MARS_SUCCESS when argument shared is not 0 or 1 and behaves as the shared flag has been set.";
+546;closed;NEG. FUNC.;TFN02002;N;B;HOST;mars_context_destroy;"Check if mars_context_destroy returns MARS_ERROR_STATE when mars_context_destroy is called without the workload being empty.";
+551;closed;NEG. FUNC.;TFN11001;N;B;HOST;mars_task_create;"Check if mars_task_create returns MARS_ERROR_NULL when passed a NULL pointer for each individual argument: mars_context, mars_task_id, elf_image";
+552;assigned;NEG. FUNC.;TFN11002;N;B;HOST;mars_task_create;"Check if mars_task_create returns MARS_ERROR_PARAMS when argument name is not null and points to a c-string longer than MARS_TASK_NAME_LEN_MAX.";
+553;assigned;NEG. FUNC.;TFN11003;N;B;HOST;mars_task_create;"Check if mars_task_create returns MARS_ERROR_PARAMS when the argument context_save_size is larger than MARS_TASK_CONTEXT_SAVE_SIZE_MAX.";
+554;assigned;NEG. FUNC.;TFN12001;N;B;HOST;mars_task_destroy;"Check if mars_task_destroy returns MARS_ERROR_NULL when mars_task_id is NULL.";
+555;assigned;NEG. FUNC.;TFN12002;N;B;HOST;mars_task_destroy;"Check if mars_task_destroy returns MARS_ERROR_PARAMS when mars_task_id is an id of a task previously being destroyed.";
+556;new;NEG. FUNC.;TFN13001;N;B;HOST;mars_task_schedule;"Check if mars_task_schedule returns MARS_ERROR_NULL when a NULL pointer is passed for each argument individually: mars_task_id";
+559;new;NEG. FUNC.;TFN21001;N;B;HOST;mars_task_create;"Check if mars_task_barrier_create returns MARS_ERROR_NULL when passed a NULL pointer for each individual argument: mars_context, mars_task_barrier, max_barriers";
+560;new;NEG. FUNC.;TFN21002;N;B;HOST;mars_task_create;"Check if mars_task_barrier_create returns MARS_ERROR_PARAMS when passed > MARS_TASK_BARRIER_WAIT_MAX argument: barrier count";
+44;closed;INTER. FUNC.;TFI11001;N;A;HOST;mars_mutex_create;"Check if mars_mutex_create works correctly.";"Call mars_mutex_create and check if the return value is MARS_SUCCESS."
+46;closed;INTER. FUNC.;TFI11003;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 simultaneously by multiple PPE threads."
+49;closed;INTER. FUNC.;TFI14001;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;INTER. FUNC.;TFI14002;Y;A;MPU;mars_mutex_lock;"Check if only one MARS task can get a lock.";"Check if one mutex isn't acquired by multiple MARS tasks at the same time."
+51;closed;INTER. FUNC.;TFI14003;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;INTER. FUNC.;TFI15001;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;INTER. FUNC.;TFI15002;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;INTER. FUNC.;TFI15003;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;INTER. FUNC.;TFI15004;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."
+550;new;INTER. FUNC.;TFI01002;N;B;HOST;mars_context_destroy;"Check if mars_context_destroy is resilient against an uninitialized context.";"Call mars_context_destroy and check if the return value is MARS_ERROR_PARAMS."
+332;closed;INTER. PERF.;TPI10001;N;A;;;"Measure performance of mutex with single host thread. Sample implementation:";
+333;closed;INTER. PERF.;TPI10002;N;A;;;"Measure performance of mutex with single task. Sample implementation:";
+334;closed;INTER. PERF.;TPI10003;N;A;;;"Measure performance of mutex with two host threads with intentional contention. Sample implementation:";
+335;closed;INTER. PERF.;TPI10004;N;A;;;"Measure performance of mutex with two tasks with intentional contention. Sample implementation:";
+336;closed;INTER. PERF.;TPI10005;N;A;;;"Measure performance of mutex with single host thread and single task with intentional contention. Sample implementation:";