X-Git-Url: http://developer.intra2net.com/git/?p=libftdi;a=blobdiff_plain;f=test%2Fbaudrate.cpp;h=fe6c63a006b52616b341466571ee18481a062da7;hp=8bd04ebfbdefb04543e48201d188059917a95f5b;hb=46ed84b384e8cf1d7ae9a9b0758a08419d282a27;hpb=0d119163cc334fcc4063e85f39c964c6ed4a3679 diff --git a/test/baudrate.cpp b/test/baudrate.cpp index 8bd04eb..fe6c63a 100644 --- a/test/baudrate.cpp +++ b/test/baudrate.cpp @@ -1,7 +1,7 @@ /**@file @brief Test baudrate calculator code -@author Thomas Jarosch +@author Thomas Jarosch and Uwe Bonnes */ /*************************************************************************** @@ -39,7 +39,7 @@ public: ftdi = ftdi_new(); } - ~BaseFTDIFixture() + virtual ~BaseFTDIFixture() { delete ftdi; ftdi = NULL; @@ -102,10 +102,12 @@ static void test_baudrates(ftdi_context *ftdi, const map &baud case TYPE_R: case TYPE_2232C: case TYPE_BM: + case TYPE_230X: fractional_bits |= (calc_index & 0x001) ? 4 : 0; break; default:; } + // Aid debugging since this test is a generic function BOOST_CHECK_MESSAGE(res->actual_baudrate == calc_baudrate && res->divisor == divisor && res->fractional_bits == fractional_bits && res->clock == clock, @@ -123,7 +125,7 @@ BOOST_AUTO_TEST_CASE(TypeAMFixedBaudrates) ftdi->type = TYPE_AM; map baudrates; - baudrates[183] = calc_result(183, 16383, 3, 48); + baudrates[183] = calc_result(183, 16383, 0, 48); baudrates[300] = calc_result(300, 10000, 0, 48); baudrates[600] = calc_result(600, 5000, 0, 48); baudrates[1200] = calc_result(1200, 2500, 0, 48); @@ -140,12 +142,12 @@ BOOST_AUTO_TEST_CASE(TypeAMFixedBaudrates) baudrates[1000000] = calc_result(1000000, 3, 0, 48); baudrates[1090512] = calc_result(1000000, 3, 0, 48); baudrates[1090909] = calc_result(1000000, 3, 0, 48); - baudrates[1090910] = calc_result(1200000, 2, 1, 48); + baudrates[1090910] = calc_result(1000000, 3, 0, 48); baudrates[1200000] = calc_result(1200000, 2, 1, 48); baudrates[1333333] = calc_result(1333333, 2, 2, 48); baudrates[1411764] = calc_result(1411765, 2, 3, 48); baudrates[1500000] = calc_result(1500000, 2, 0, 48); - baudrates[2000000] = calc_result(2000000, 1, 0, 48); + baudrates[2000000] = calc_result(1500000, 2, 0, 48); baudrates[3000000] = calc_result(3000000, 0, 0, 48); test_baudrates(ftdi, baudrates); @@ -158,6 +160,7 @@ BOOST_AUTO_TEST_CASE(TypeBMFixedBaudrates) test_types.push_back(TYPE_BM); test_types.push_back(TYPE_2232C); test_types.push_back(TYPE_R); + test_types.push_back(TYPE_230X); map baudrates; baudrates[183] = calc_result(183, 16383, 7, 48); @@ -199,6 +202,7 @@ BOOST_AUTO_TEST_CASE(TypeBMFixedBaudrates) baudrates[(3000000*16/(2*16+ 3))+1] = calc_result(round(3000000/2.125), 2, 3, 48); baudrates[ 3000000*16/(2*16+ 1) ] = calc_result(round(3000000/2.125), 2, 3, 48); baudrates[(3000000*16/(2*16+ 1))+1] = calc_result(round(3000000/2.000), 2, 0, 48); + BOOST_FOREACH(const enum ftdi_chip_type &test_chip_type, test_types) { ftdi->type = test_chip_type;