60 #if (defined(PDL_PERIPHERAL_MFS_ACTIVE))
62 #if (PDL_MFS_USE_HL == PDL_ON)
73 #define MFS_HL_RELOADVAL_MIN4UART (4u)
74 #define MFS_HL_RELOADVAL_MIN4CSIO (3u)
75 #define MFS_HL_RELOADVAL_MIN4LIN (3u)
76 #define MFS_HL_BGR_MASK (0x7FFFu)
79 #define MFS_HL_NUM_1 (1u)
80 #define MFS_HL_NUM_2 (2u)
81 #define MFS_HL_NUM_3 (3u)
82 #define MFS_HL_NUM_4 (4u)
83 #define MFS_HL_NUM_5 (5u)
84 #define MFS_HL_NUM_6 (6u)
85 #define MFS_HL_NUM_7 (7u)
86 #define MFS_HL_NUM_8 (8u)
87 #define MFS_HL_NUM_9 (9u)
88 #define MFS_HL_NUM_10 (10u)
91 #define MFS_HL_MASK_0 (0x01u)
92 #define MFS_HL_MASK_1 (0x02u)
93 #define MFS_HL_MASK_2 (0x04u)
94 #define MFS_HL_MASK_3 (0x08u)
95 #define MFS_HL_MASK_4 (0x10u)
96 #define MFS_HL_MASK_5 (0x20u)
97 #define MFS_HL_MASK_6 (0x40u)
98 #define MFS_HL_MASK_7 (0x80u)
99 #define MFS_HL_MASK_0_2 (0x07u)
100 #define MFS_HL_MASK_0_3 (0x0Fu)
101 #define MFS_HL_MASK_0_6 (0x7Fu)
102 #define MFS_HL_MASK_4_7 (0xF0u)
104 #define MFS_HL_MASK_0_7 (0x000000FFu)
105 #define MFS_HL_MASK_8_15 (0x0000FF00u)
106 #define MFS_HL_MASK_16_23 (0x00FF0000u)
107 #define MFS_HL_MASK_24_31 (0xFF000000u)
108 #define MFS_HL_MASK_0_15 (0x0000FFFFu)
109 #define MFS_HL_MASK_16_31 (0xFFFF0000u)
118 #if (PDL_PERIPHERAL_ENABLE_MFS0 == PDL_ON)
124 #if (PDL_PERIPHERAL_ENABLE_MFS1 == PDL_ON)
130 #if (PDL_PERIPHERAL_ENABLE_MFS2 == PDL_ON)
136 #if (PDL_PERIPHERAL_ENABLE_MFS3 == PDL_ON)
142 #if (PDL_PERIPHERAL_ENABLE_MFS4 == PDL_ON)
148 #if (PDL_PERIPHERAL_ENABLE_MFS5 == PDL_ON)
154 #if (PDL_PERIPHERAL_ENABLE_MFS6 == PDL_ON)
160 #if (PDL_PERIPHERAL_ENABLE_MFS7 == PDL_ON)
166 #if (PDL_PERIPHERAL_ENABLE_MFS8 == PDL_ON)
172 #if (PDL_PERIPHERAL_ENABLE_MFS9 == PDL_ON)
178 #if (PDL_PERIPHERAL_ENABLE_MFS10 == PDL_ON)
184 #if (PDL_PERIPHERAL_ENABLE_MFS11 == PDL_ON)
190 #if (PDL_PERIPHERAL_ENABLE_MFS12 == PDL_ON)
196 #if (PDL_PERIPHERAL_ENABLE_MFS13 == PDL_ON)
202 #if (PDL_PERIPHERAL_ENABLE_MFS14 == PDL_ON)
208 #if (PDL_PERIPHERAL_ENABLE_MFS15 == PDL_ON)
250 uint16_t u16BufFillLvl
314 uint32_t u32Instance;
320 if (pstcMfs == m_astcMfsHlInstanceDataLut[u32Instance].pstcInstance)
322 pstcMfsInternDataPtr = &m_astcMfsHlInstanceDataLut[u32Instance].
stcInternData;
328 return (pstcMfsInternDataPtr);
349 if (u16Num1 < u16Num2)
375 uint_fast16_t fu16Loop;
376 uint_fast16_t fu16Cnt;
393 while (0u != fu16Loop)
412 while ((0u != fu16Cnt) && (0u != fu16Loop))
427 pstcMfs->TDR = (uint16_t)u32Data;
432 pstcMfs->TDR32 = u32Data;
460 uint8_t u8End =
FALSE;
461 volatile uint16_t u16DummyData;
470 pstcMfs->SCR_f.TBIE =
FALSE;
472 pstcMfs->SCR_f.TXE =
FALSE;
473 pstcMfs->SACSR_f.TMRE =
FALSE;
474 pstcMfs->SCR_f.TXE =
TRUE;
498 pstcMfs->FCR1_f.FTIE =
FALSE;
503 pstcMfs->SCR_f.TIE =
FALSE;
514 pstcMfs->SCR_f.TBIE =
TRUE;
548 volatile uint32_t u32Data;
575 while (0u != pstcMfs->FBYTE2)
579 u32Data = (uint32_t)pstcMfs->RDR;
583 u32Data = pstcMfs->RDR32;
616 u32Data = (uint32_t)pstcMfs->RDR;
620 u32Data = pstcMfs->RDR32;
668 volatile uint8_t u8Ssr;
672 u8Ssr = pstcMfs->SSR;
699 pstcMfs->SSR_f.REC =
TRUE;
728 volatile uint16_t u16DummyData;
736 if (pstcMfs->SSR_f.LBD == 1)
738 u16DummyData = pstcMfs->RDR;
739 pstcMfs->SSR_f.LBD =
FALSE;
740 pstcMfs->SSR_f.REC =
TRUE;
761 uint16_t u16BufFillLvl
764 stc_mfs_fcr0_field_t stcFCR0 = { 0 };
765 stc_mfs_fcr1_field_t stcFCR1 = { 0 };
772 stcFCR0.FSET =
FALSE;
783 stcFCR1.FTST0 =
FALSE;
784 stcFCR1.FTST1 =
FALSE;
786 stcFCR1.FLSTE =
FALSE;
787 stcFCR1.FRIIE =
FALSE;
788 stcFCR1.FDRQ =
FALSE;
789 stcFCR1.FTIE =
FALSE;
790 stcFCR1.FSEL =
FALSE;
793 pstcMfs->FCR0_f = stcFCR0;
794 pstcMfs->FCR1_f = stcFCR1;
813 stc_mfs_smr_field_t stcSMR;
814 stc_mfs_fcr1_field_t stcFCR1 = { 0 };
815 stc_mfs_ssr_field_t stcSSR;
816 stc_mfs_i2c_ibsr_field_t stcIBSR;
817 stc_mfs_i2c_ibcr_field_t stcIBCR;
818 stc_mfs_i2c_ismk_field_t stcISMK;
820 stcIBSR = pstcI2c->IBSR_f;
821 stcIBCR = pstcI2c->IBCR_f;
827 if (
TRUE == stcIBSR.SPC)
831 pstcI2c->IBSR_f = stcIBSR;
834 stcIBCR.CNDE =
FALSE;
835 stcIBCR.ACT_SCC =
FALSE;
836 pstcI2c->IBCR_f = stcIBCR;
839 stcISMK = pstcI2c->ISMK_f;
841 pstcI2c->ISMK_f = stcISMK;
845 pstcI2c->ISMK_f = stcISMK;
856 && (
TRUE == stcIBCR.INT))
857 || (
TRUE == stcIBSR.RACK))
861 stcIBCR.ACT_SCC =
FALSE;
863 stcIBCR.INTE =
FALSE;
868 pstcI2c->IBCR_f = stcIBCR;
872 stcSSR = pstcI2c->SSR_f;
875 stcFCR1 = pstcI2c->FCR1_f;
877 if ((
TRUE == stcSSR.TDRE) || (
TRUE == stcFCR1.FDRQ))
885 for (u16Cnt = 0u; u16Cnt < u16Num; u16Cnt++)
891 stcFCR1 = pstcI2c->FCR1_f;
892 stcFCR1.FDRQ =
FALSE;
896 stcFCR1.FTIE =
FALSE;
898 pstcI2c->FCR1_f = stcFCR1;
908 stcSMR = pstcI2c->SMR_f;
910 pstcI2c->SMR_f = stcSMR;
916 stcIBCR.ACT_SCC =
FALSE;
918 pstcI2c->IBCR_f = stcIBCR;
935 stc_mfs_ssr_field_t stcSSR;
936 stc_mfs_i2c_ibsr_field_t stcIBSR;
937 stc_mfs_i2c_ibcr_field_t stcIBCR;
938 stc_mfs_i2c_ismk_field_t stcISMK;
940 stcIBSR = pstcI2c->IBSR_f;
941 stcIBCR = pstcI2c->IBCR_f;
942 stcSSR = pstcI2c->SSR_f;
948 if (
TRUE == stcIBSR.SPC)
952 pstcI2c->IBSR_f = stcIBSR;
955 stcIBCR.CNDE =
FALSE;
957 stcIBCR.INTE =
FALSE;
960 stcISMK = pstcI2c->ISMK_f;
962 pstcI2c->ISMK_f = stcISMK;
966 pstcI2c->ISMK_f = stcISMK;
977 else if ((
TRUE == stcSSR.RDRF) && (
FALSE == stcIBSR.FBT))
982 stcSSR = pstcI2c->SSR_f;
983 if (
TRUE == stcSSR.RDRF)
1000 stcIBCR.ACKE =
FALSE;
1002 stcIBCR.CNDE =
TRUE;
1005 if (
TRUE == stcIBSR.RSC)
1008 stcIBSR.RSC =
FALSE;
1009 pstcI2c->IBSR_f = stcIBSR;
1014 else if (
TRUE == stcSSR.ORE)
1018 pstcI2c->SSR_f = stcSSR;
1026 stcIBCR.ACT_SCC =
FALSE;
1027 stcIBCR.INT =
FALSE;
1028 pstcI2c->IBCR_f = stcIBCR;
1043 stc_mfs_smr_field_t stcSMR;
1044 stc_mfs_i2c_ibcr_field_t stcIBCR;
1045 stc_mfs_i2c_ibsr_field_t stcIBSR;
1046 stc_mfs_i2c_ismk_field_t stcISMK;
1049 stcIBCR = pstcI2c->IBCR_f;
1050 stcIBSR = pstcI2c->IBSR_f;
1052 if ((
FALSE == stcIBCR.MSS) && (
TRUE == stcIBCR.ACT_SCC) && (
TRUE == stcIBSR.FBT))
1054 stcSMR = pstcI2c->SMR_f;
1057 if (
TRUE == stcIBSR.TRX)
1069 pstcI2c->TDR = (uint16_t)u8Data;
1072 stcIBCR.WSEL =
FALSE;
1077 stcIBCR.ACKE =
TRUE;
1080 stcIBCR.WSEL =
TRUE;
1087 pstcI2c->SMR_f = stcSMR;
1091 stcIBCR.ACT_SCC =
FALSE;
1092 stcIBCR.INT =
FALSE;
1093 pstcI2c->IBCR_f = stcIBCR;
1109 stc_mfs_ssr_field_t stcSSR;
1110 stc_mfs_i2c_ibcr_field_t stcIBCR;
1111 stc_mfs_i2c_ibsr_field_t stcIBSR;
1112 stc_mfs_i2c_ismk_field_t stcISMK;
1114 stcIBSR = pstcI2c->IBSR_f;
1115 stcSSR = pstcI2c->SSR_f;
1121 if (
TRUE == stcIBSR.SPC)
1124 stcIBSR.SPC =
FALSE;
1125 pstcI2c->IBSR_f = stcIBSR;
1128 stcISMK = pstcI2c->ISMK_f;
1130 pstcI2c->ISMK_f = stcISMK;
1134 pstcI2c->ISMK_f = stcISMK;
1145 else if (
TRUE == stcIBSR.RACK)
1148 stcIBCR = pstcI2c->IBCR_f;
1149 stcIBCR.ACT_SCC =
FALSE;
1150 stcIBCR.INT =
FALSE;
1151 pstcI2c->IBCR_f = stcIBCR;
1156 stcIBCR = pstcI2c->IBCR_f;
1158 if ((
TRUE == stcSSR.RDRF) && (
FALSE == stcIBSR.FBT))
1163 stcSSR = pstcI2c->SSR_f;
1164 if (
TRUE == stcSSR.RDRF)
1179 stcIBCR.ACKE =
FALSE;
1184 stcIBCR.ACKE =
TRUE;
1188 stcIBCR.ACT_SCC =
FALSE;
1189 stcIBCR.INT =
FALSE;
1190 pstcI2c->IBCR_f = stcIBCR;
1193 if (
TRUE == stcSSR.ORE)
1197 pstcI2c->SSR_f = stcSSR;
1214 stc_mfs_smr_field_t stcSMR;
1215 stc_mfs_fcr1_field_t stcFCR1 = { 0 };
1216 stc_mfs_ssr_field_t stcSSR;
1217 stc_mfs_i2c_ibcr_field_t stcIBCR;
1218 stc_mfs_i2c_ibsr_field_t stcIBSR;
1219 stc_mfs_i2c_ismk_field_t stcISMK;
1223 stcIBSR = pstcI2c->IBSR_f;
1231 || (
TRUE == stcIBSR.SPC))
1237 stcFCR1 = pstcI2c->FCR1_f;
1238 stcFCR1.FTIE =
FALSE;
1239 pstcI2c->FCR1_f = stcFCR1;
1245 stcSMR = pstcI2c->SMR_f;
1247 pstcI2c->SMR_f = stcSMR;
1250 if (
TRUE == stcIBSR.SPC)
1253 stcISMK = pstcI2c->ISMK_f;
1255 pstcI2c->ISMK_f = stcISMK;
1259 pstcI2c->ISMK_f = stcISMK;
1262 stcIBSR.SPC =
FALSE;
1263 pstcI2c->IBSR_f = stcIBSR;
1275 stcIBCR = pstcI2c->IBCR_f;
1276 stcIBCR.ACT_SCC =
FALSE;
1277 stcIBCR.INT =
FALSE;
1278 pstcI2c->IBCR_f = stcIBCR;
1281 stcIBSR.RSC =
FALSE;
1282 pstcI2c->IBSR_f = stcIBSR;
1286 stcSSR = pstcI2c->SSR_f;
1290 stcFCR1 = pstcI2c->FCR1_f;
1292 if ((
TRUE == stcSSR.TDRE) || (
TRUE == stcFCR1.FDRQ))
1300 for (u16Cnt = 0u; u16Cnt < u16Num; u16Cnt++)
1307 stcFCR1 = pstcI2c->FCR1_f;
1308 stcFCR1.FDRQ =
FALSE;
1309 pstcI2c->FCR1_f = stcFCR1;
1320 stcIBCR = pstcI2c->IBCR_f;
1321 stcIBCR.ACT_SCC =
FALSE;
1322 stcIBCR.INT =
FALSE;
1323 pstcI2c->IBCR_f = stcIBCR;
1325 if (
TRUE == stcIBSR.RACK)
1328 stcIBSR.RSC =
FALSE;
1329 pstcI2c->IBSR_f = stcIBSR;
1437 switch (pstcMfsHlInternData->
u8Exec)
1480 uint32_t u32ReloadValue;
1483 stc_mfs_smr_field_t stcSMR = { 0 };
1484 stc_mfs_scr_field_t stcSCR = { 0 };
1485 stc_mfs_escr_field_t stcESCR = { 0 };
1490 if ((NULL == pstcMfsHlInternData)
1491 || (NULL == pstcConfig)
1513 if (((NULL == pstcConfig->
pu8TxBuf)
1529 pstcUart->SCR_f.UPCL =
TRUE;
1575 pstcUart->SMR_f = stcSMR;
1596 pstcUart->SMR_f = stcSMR;
1602 pstcUart->SCR_f = stcSCR;
1614 stcESCR.PEN =
FALSE;
1634 stcESCR.ESBL =
FALSE;
1638 stcESCR.ESBL =
TRUE;
1647 stcESCR.FLWEN =
TRUE;
1651 stcESCR.FLWEN =
FALSE;
1661 stcESCR.INV =
FALSE;
1687 pstcUart->ESCR_f = stcESCR;
1693 pstcUart->SSR_f.REC =
TRUE;
1756 pstcUart->SCR_f.TXE =
TRUE;
1757 pstcUart->SCR_f.RXE =
TRUE;
1760 if (NULL != pstcConfig->
pfnRxCb)
1763 pstcUart->SCR_f.RIE =
TRUE;
1799 if (NULL == pstcMfsHlInternData)
1806 pstcUart->SCR_f.TXE =
FALSE;
1807 pstcUart->SCR_f.RXE =
FALSE;
1822 pstcUart->SSR_f.REC =
TRUE;
1826 pstcUart->ESCR = 0u;
1827 pstcUart->FCR0 = 0u;
1828 pstcUart->FCR1 = 0u;
1831 pstcUart->SCR_f.UPCL =
TRUE;
1885 uint32_t u32ReloadValue;
1888 stc_mfs_smr_field_t stcSMR = { 0 };
1889 stc_mfs_scr_field_t stcSCR = { 0 };
1890 stc_mfs_escr_field_t stcESCR = { 0 };
1891 stc_mfs_ssr_field_t stcSSR = { 0 };
1892 stc_mfs_csio_sacsr_field_t stcSACSR = { 0 };
1893 stc_mfs_csio_scscr_field_t stcSCSCR = { 0 };
1894 uint16_t u16STMCR = 0u;
1895 uint16_t u16SCSTR32 = 0u;
1896 uint8_t u8SCSTR0 = 0u;
1897 uint8_t u8SCSTR1 = 0u;
1898 uint8_t u8TBYTE0 = 0u;
1903 if ((NULL == pstcMfsHlInternData)
1904 || (NULL == pstcConfig)
1917 if (((NULL == pstcConfig->
pu8TxBuf)
1942 pstcCsio->SCR_f.UPCL =
TRUE;
2004 pstcCsio->SMR_f = stcSMR;
2015 stcSMR.SCKE =
FALSE;
2022 stcSMR.SCINV =
TRUE;
2027 stcSMR.SCINV =
FALSE;
2052 stcESCR.SOP =
FALSE;
2119 pstcCsio->SMR_f = stcSMR;
2122 pstcCsio->SCR_f = stcSCR;
2125 pstcCsio->ESCR_f = stcESCR;
2126 pstcCsio->SSR_f = stcSSR;
2130 pstcCsio->SSR_f.REC =
TRUE;
2167 && ((pstcCsio == &
MFS6) || (pstcCsio == &
MFS7))
2171 stcSCSCR.CSEN0 =
TRUE;
2175 stcSCSCR.CSOE =
TRUE;
2192 stcSCSCR.CSLVL =
TRUE;
2197 pstcCsio->SCSCR_f = stcSCSCR;
2198 pstcCsio->SCSTR32 = u16SCSTR32;
2199 pstcCsio->SCSTR0 = u8SCSTR0;
2200 pstcCsio->SCSTR1 = u8SCSTR1;
2218 stcSACSR.TSYNE =
TRUE;
2222 pstcCsio->SACSR_f = stcSACSR;
2223 pstcCsio->STMCR = u16STMCR;
2224 pstcCsio->TBYTE0 = u8TBYTE0;
2282 pstcCsio->SCR_f.TXE =
TRUE;
2283 pstcCsio->SCR_f.RXE =
TRUE;
2286 if (NULL != pstcConfig->
pfnRxCb)
2289 pstcCsio->SCR_f.RIE =
TRUE;
2325 if (NULL == pstcMfsHlInternData)
2332 pstcCsio->SCR_f.TXE =
FALSE;
2333 pstcCsio->SCR_f.RXE =
FALSE;
2348 pstcCsio->SSR_f.REC =
TRUE;
2352 pstcCsio->ESCR = 0u;
2353 pstcCsio->FCR0 = 0u;
2354 pstcCsio->FCR1 = 0u;
2355 pstcCsio->SACSR = 0u;
2356 pstcCsio->SCSCR = 0u;
2357 pstcCsio->STMCR = 0u;
2358 pstcCsio->SCSTR10 = 0u;
2359 pstcCsio->SCSTR32 = 0u;
2360 pstcCsio->TBYTE0 = 0u;
2363 pstcCsio->SCR_f.UPCL =
TRUE;
2451 const uint8_t* pu8TxData,
2453 uint16_t u16TransferSize,
2458 uint16_t u16DataToSendCounter;
2459 uint16_t u16DataReceivedCounter;
2461 volatile uint8_t u8Reg;
2466 if ((NULL == pstcMfsHlInternData)
2467 || ((NULL == pu8TxData) && (NULL == pu8RxData))
2469 || (0u == u16TransferSize)
2482 if (MfsEightBits < pstcMfsHlInternData->u8DataWidth)
2495 pstcCsio->SCR_f.TXE =
FALSE;
2497 pstcCsio->TBYTE0 = (uint8_t)u16TransferSize;
2498 if (
TRUE == bCsHolding)
2501 pstcCsio->SCSCR_f.SCAM =
TRUE;
2506 pstcCsio->SCSCR_f.SCAM =
FALSE;
2508 pstcCsio->SCR_f.TXE =
TRUE;
2514 pstcCsio->SCR_f.TXE =
FALSE;
2515 pstcCsio->SACSR_f.TMRE =
TRUE;
2516 pstcCsio->SCR_f.TXE =
TRUE;
2527 pstcCsio->SCR_f.RIE =
FALSE;
2530 u16DataToSendCounter = 0u;
2531 u16DataReceivedCounter = 0u;
2533 while (u16DataReceivedCounter != u16TransferSize)
2535 if (u16DataToSendCounter < u16TransferSize)
2538 while(
FALSE == pstcCsio->SSR_f.TDRE)
2544 if (NULL != pu8TxData)
2546 u8Data = pu8TxData[u16DataToSendCounter];
2549 pstcCsio->TDR = (uint16_t)u8Data;
2550 u16DataToSendCounter++;
2558 while(
FALSE == pstcCsio->SSR_f.TDRE)
2564 if (NULL != pu8TxData)
2566 u8Data = pu8TxData[u16DataToSendCounter];
2568 pstcCsio->TDR = (uint16_t)u8Data;
2569 u16DataToSendCounter++;
2575 u8Reg = pstcCsio->SSR;
2581 pstcCsio->SSR_f.REC =
TRUE;
2584 u8Data = (uint8_t)pstcCsio->RDR;
2585 if (NULL != pu8RxData)
2587 pu8RxData[u16DataReceivedCounter] = u8Data;
2589 u16DataReceivedCounter++;
2596 while (
FALSE == pstcCsio->SSR_f.TBI)
2599 pstcCsio->SCR_f.TXE =
FALSE;
2600 pstcCsio->SACSR_f.TMRE =
FALSE;
2601 pstcCsio->SCR_f.TXE =
TRUE;
2609 pstcCsio->SCR_f.RIE =
TRUE;
2642 uint32_t u32ReloadValue;
2645 stc_mfs_smr_field_t stcSMR = { 0 };
2646 stc_mfs_scr_field_t stcSCR = { 0 };
2647 stc_mfs_escr_field_t stcESCR = { 0 };
2652 if ((NULL == pstcMfsHlInternData)
2653 || (NULL == pstcConfig)
2669 if (((NULL == pstcConfig->
pu8TxBuf)
2696 pstcLin->SCR_f.UPCL =
TRUE;
2727 stcESCR.ESBL =
FALSE;
2731 stcESCR.ESBL =
FALSE;
2735 stcESCR.ESBL =
TRUE;
2739 stcESCR.ESBL =
TRUE;
2785 stcESCR.LBIE =
TRUE;
2789 stcESCR.LBIE =
FALSE;
2854 pstcLin->SMR_f = stcSMR;
2855 pstcLin->SCR_f = stcSCR;
2856 pstcLin->ESCR_f = stcESCR;
2859 pstcLin->SCR_f.TXE =
TRUE;
2860 pstcLin->SCR_f.RXE =
TRUE;
2863 if (NULL != pstcConfig->
pfnRxCb)
2866 pstcLin->SCR_f.RIE =
TRUE;
2940 if (NULL == pstcMfsHlInternData)
2947 || (
TRUE == pstcLin->SCR_f.MS) )
2953 else if (
FALSE == pstcLin->SSR_f.TBI)
2961 pstcLin->SCR_f.LBR =
TRUE;
2994 uint16_t u16BaudDivisor
3003 if (NULL == pstcMfsHlInternData)
3010 || (
FALSE == pstcLin->SCR_f.MS) )
3018 pstcLin->BGR = u16BaudDivisor;
3043 uint16_t u16ReadCount)
3048 int32_t i32BufferCount;
3053 if ((NULL == pstcMfsHlInternData)
3054 || (NULL == pu8Data)
3064 if (0u != u16ReadCount)
3070 if (0 > i32BufferCount)
3075 for (u16Count = 0u; u16Count < u16ReadCount; u16Count++)
3110 if (NULL == pstcMfsHlInternData)
3117 pstcLin->SCR_f.RIE =
FALSE;
3152 uint32_t u32ReloadValue;
3153 uint32_t u32BusClock;
3156 stc_mfs_smr_field_t stcSMR = { 0 };
3157 stc_mfs_i2c_ibcr_field_t stcIBCR = { 0 };
3158 stc_mfs_i2c_isba_field_t stcISBA = { 0 };
3159 stc_mfs_i2c_ismk_field_t stcISMK = { 0 };
3165 if ((NULL == pstcMfsHlInternData)
3166 || (NULL == pstcConfig)
3176 if (0u == u32ReloadValue)
3303 FM4_GPIO->EPFR16_f.SFMPAC =
FALSE;
3307 FM4_GPIO->EPFR16_f.SFMPBC =
FALSE;
3314 FM4_GPIO->EPFR16_f.SFMPAC =
TRUE;
3318 FM4_GPIO->EPFR16_f.SFMPBC =
TRUE;
3327 stcIBCR.ACKE =
TRUE;
3333 stcIBCR.CNDE =
TRUE;
3335 stcIBCR.INTE =
TRUE;
3339 stcISBA.SAEN =
TRUE;
3348 pstcI2c->SMR_f = stcSMR;
3416 pstcI2c->NFCR = u8NFCR;
3418 pstcI2c->IBCR_f = stcIBCR;
3419 pstcI2c->ISBA_f = stcISBA;
3420 pstcI2c->ISMK_f = stcISMK;
3454 if (NULL == pstcMfsHlInternData)
3461 pstcI2c->ISMK_f.EN =
FALSE;
3473 pstcI2c->SSR_f.REC =
TRUE;
3524 stc_mfs_smr_field_t stcSMR;
3525 stc_mfs_i2c_ibcr_field_t stcIBCR;
3526 stc_mfs_i2c_ibsr_field_t stcIBSR;
3527 stc_mfs_fcr1_field_t stcFCR1;
3529 stcIBCR = pstcI2c->IBCR_f;
3531 if ((
TRUE == stcIBCR.ACT_SCC) && (
FALSE == stcIBCR.MSS))
3534 stcIBCR.ACKE =
TRUE;
3535 stcIBCR.ACT_SCC =
FALSE;
3536 pstcI2c->IBCR_f = stcIBCR;
3538 stcIBSR = pstcI2c->IBSR_f;
3541 if (
TRUE == stcIBSR.TRX)
3547 stcFCR1 = pstcI2c->FCR1_f;
3548 stcFCR1.FTIE =
TRUE;
3549 pstcI2c->FCR1_f = stcFCR1;
3555 stcSMR = pstcI2c->SMR_f;
3557 pstcI2c->SMR_f = stcSMR;
3564 stcSMR = pstcI2c->SMR_f;
3566 pstcI2c->SMR_f = stcSMR;
3594 volatile uint32_t u32Count;
3599 while (u32Count < u32MaxCnt)
3644 if (u32MaxCnt <= pstcMfsHlInternData->u32I2cProcCnt)
3697 uint8_t u8SlaveAddr,
3699 uint16_t* pu16WriteCnt,
3706 stc_mfs_smr_field_t stcSMR;
3707 stc_mfs_i2c_ibcr_field_t stcIBCR;
3708 stc_mfs_fcr1_field_t stcFCR1;
3713 if ((NULL == pstcMfsHlInternData)
3714 || (NULL == pu8Data)
3715 || (NULL == pu16WriteCnt)
3731 if (0u != *pu16WriteCnt)
3751 pstcI2c->TDR = (uint16_t)(u8SlaveAddr);
3753 stcIBCR = pstcI2c->IBCR_f;
3757 stcIBCR.ACKE =
TRUE;
3759 stcIBCR.INTE =
TRUE;
3760 stcIBCR.ACT_SCC =
FALSE;
3762 stcIBCR.WSEL =
FALSE;
3763 pstcI2c->IBCR_f = stcIBCR;
3769 stcFCR1 = pstcI2c->FCR1_f;
3770 stcFCR1.FTIE =
TRUE;
3771 pstcI2c->FCR1_f = stcFCR1;
3777 stcSMR = pstcI2c->SMR_f;
3779 pstcI2c->SMR_f = stcSMR;
3792 if (
FALSE == bBlocking)
3857 uint8_t u8SlaveAddr,
3859 uint16_t* pu16ReadCnt,
3866 stc_mfs_i2c_ibcr_field_t stcIBCR;
3873 if ((NULL == pstcMfsHlInternData)
3874 || (NULL == pu8Data)
3875 || (NULL == pu16ReadCnt)
3910 pstcI2c->FBYTE2 = (uint8_t)u16Count;
3921 pstcI2c->TDR = (uint16_t)(u8SlaveAddr);
3924 for (u16Cnt = 0u; u16Cnt < u16Count; u16Cnt++)
3926 pstcI2c->TDR = 0x00u;
3929 stcIBCR = pstcI2c->IBCR_f;
3931 stcIBCR.ACKE =
TRUE;
3933 stcIBCR.WSEL =
TRUE;
3935 stcIBCR.INTE =
TRUE;
3937 stcIBCR.ACT_SCC =
FALSE;
3938 stcIBCR.INT =
FALSE;
3941 pstcI2c->IBCR_f = stcIBCR;
3954 if (
FALSE == bBlocking)
3965 if ((
Ok != enResult)
4015 if (NULL == pstcMfsHlInternData)
4083 if (NULL == pstcMfsHlInternData)
4107 if ((
Ok != enResult)
4174 uint16_t u16WriteCnt,
4181 uint_fast16_t fu16DataSent;
4182 uint_fast16_t fu16Idx;
4188 if ((NULL == pstcMfsHlInternData)
4189 || (NULL == pu8Data)
4196 if (0u == u16WriteCnt)
4211 if ((
FALSE == bBlocking) &&
4231 pstcMfs->SCR_f.TXE =
FALSE;
4232 pstcMfs->SACSR_f.TMRE =
TRUE;
4233 pstcMfs->SCR_f.TXE =
TRUE;
4238 while (0u < u16WriteCnt)
4244 bTxInProgress = pstcMfs->SSR_f.TDRE;
4247 if (
TRUE == bTxInProgress)
4252 pstcMfs->FCR1_f.FTIE =
FALSE;
4257 pstcMfs->SCR_f.TIE =
FALSE;
4277 for (fu16Idx = 0u; fu16Idx < fu16DataSent; fu16Idx++)
4290 u16WriteCnt -= (uint16_t)fu16DataSent;
4295 pstcMfs->SCR_f.TXE =
FALSE;
4297 pstcMfs->TBYTE0 = (uint8_t)fu16DataSent;
4298 if ((0u != u16WriteCnt) || (
TRUE == bCsHolding))
4301 pstcMfs->SCSCR_f.SCAM =
TRUE;
4306 pstcMfs->SCSCR_f.SCAM =
FALSE;
4308 pstcMfs->SCR_f.TXE =
TRUE;
4316 pstcMfs->FCR1_f.FTIE =
TRUE;
4321 pstcMfs->SCR_f.TIE =
TRUE;
4331 if (
TRUE == pstcMfs->SSR_f.TDRE)
4337 if (0u == u16WriteCnt)
4343 while (
FALSE == pstcMfs->SSR_f.TBI)
4349 pstcMfs->SCR_f.TXE =
FALSE;
4350 pstcMfs->SACSR_f.TMRE =
FALSE;
4351 pstcMfs->SCR_f.TXE =
TRUE;
4359 if (
TRUE == bBlocking)
4421 uint16_t* pu16DataCnt,
4422 uint16_t u16ReadCnt,
4428 uint_fast16_t fu16Idx;
4429 uint_fast16_t fu16Length;
4430 uint16_t u16BytesToReadLeft;
4431 volatile uint8_t u8Ssr;
4432 volatile uint8_t u8SsrErr;
4434 if (NULL != pu16DataCnt)
4442 if ((NULL == pstcMfsHlInternData)
4443 || (NULL == pu8Data)
4444 || (NULL == pu16DataCnt)
4457 u16BytesToReadLeft = u16ReadCnt;
4460 if (0u == u16ReadCnt)
4473 pstcMfs->FBYTE2 = (uint8_t)u16ReadCnt;
4484 if (
FALSE == pstcMfs->SCR_f.RIE)
4487 pstcMfs->SCR_f.RIE =
TRUE;
4492 while (0u < u16BytesToReadLeft)
4495 if (
TRUE == bBlocking)
4503 u8Ssr = u8SsrErr = pstcMfs->SSR;
4530 pstcMfs->SSR_f.REC =
TRUE;
4555 u8Ssr = u8SsrErr = pstcMfs->SSR;
4582 pstcMfs->SSR_f.REC =
TRUE;
4600 pstcMfs->SCR_f.RIE =
FALSE;
4607 if (0u != fu16Length)
4610 for (fu16Idx = *pu16DataCnt; fu16Idx < (fu16Length + *pu16DataCnt); fu16Idx++)
4623 *pu16DataCnt += (uint16_t)fu16Length;
4624 u16BytesToReadLeft -= (uint16_t)fu16Length;
4631 if (0u == u16BytesToReadLeft)
4637 pstcMfs->FBYTE2 = (uint8_t)u16BytesToReadLeft;
4645 pstcMfs->SCR_f.RIE =
TRUE;
4680 if (NULL == pstcMfsHlInternData)