SMBusLibrary  1.0
smbus.h
1 /* --COPYRIGHT--,BSD
2  * Copyright (c) 2023, Texas Instruments Incorporated
3  * All rights reserved.
4  *
5  * Redistribution and use in source and binary forms, with or without
6  * modification, are permitted provided that the following conditions
7  * are met:
8  *
9  * * Redistributions of source code must retain the above copyright
10  * notice, this list of conditions and the following disclaimer.
11  *
12  * * Redistributions in binary form must reproduce the above copyright
13  * notice, this list of conditions and the following disclaimer in the
14  * documentation and/or other materials provided with the distribution.
15  *
16  * * Neither the name of Texas Instruments Incorporated nor the names of
17  * its contributors may be used to endorse or promote products derived
18  * from this software without specific prior written permission.
19  *
20  * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
21  * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
22  * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
23  * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
24  * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
25  * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
26  * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;
27  * OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
28  * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
29  * OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE,
30  * EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
31  * --/COPYRIGHT--*/
32 #ifndef __SMBUS_H__
33 #define __SMBUS_H__
34 
35 //*****************************************************************************
36 //
39 //
40 //*****************************************************************************
41 
42 //*****************************************************************************
43 //
44 // If building with a C++ compiler, make all of the definitions in this header
45 // have a C binding.
46 //
47 //*****************************************************************************
48 #ifdef __cplusplus
49 extern "C"
50 {
51 #endif
52 
53 //
54 // Include files
55 //
56 #include <stdlib.h>
57 #include <stdint.h>
58 #include <stdbool.h>
59 
60 #include <ti/devices/msp/msp.h>
61 #include <ti/driverlib/driverlib.h>
62 #include <ti/driverlib/m0p/dl_core.h>
63 
64 //*****************************************************************************
65 // defines
66 //*****************************************************************************
67 
68 
69 //*****************************************************************************
70 // Configuration
71 //*****************************************************************************
72 
73 //*****************************************************************************
74 //
76 //
77 //*****************************************************************************
78 #ifndef SMB_TARGET_SUPPORTS_HOST_NOTIFY
79 #define SMB_TARGET_SUPPORTS_HOST_NOTIFY (true)
80 #endif
81 
82 //*****************************************************************************
83 //
85 //
86 //*****************************************************************************
87 #ifndef SMB_CONTROLLER_SUPPORTS_HOST_NOTIFY
88 #define SMB_CONTROLLER_SUPPORTS_HOST_NOTIFY (true)
89 #endif
90 
91 //*****************************************************************************
92 // Constant definitions
93 //*****************************************************************************
94 
95 //*****************************************************************************
96 //
98 //
99 //*****************************************************************************
100 #define SMB_MAX_PAYLOAD_SIZE (255)
101 
102 //*****************************************************************************
103 //
105 //
106 //*****************************************************************************
107 #define SMB_MAX_PACKET_SIZE (SMB_MAX_PAYLOAD_SIZE + 3)
108 
109 //*****************************************************************************
110 //
112 //
113 //*****************************************************************************
114 #define SMB_HOST_ALERT_PACKET_SIZE (3)
115 
116 //*****************************************************************************
117 //
119 //
120 //*****************************************************************************
121 #define SMB_HOST_DEFAULT_ADDRESS (0x08)
122 
123 //*****************************************************************************
124 //
126 //
127 //*****************************************************************************
128 #define RESPONSE_NTR 0xFF
129 
130 //*****************************************************************************
131 //
133 //
134 //*****************************************************************************
135 #define SMBUS_RET_OK (1)
136 //*****************************************************************************
137 //
139 //
140 //*****************************************************************************
141 #define SMBUS_RET_OK_FIXED (2)
142 //*****************************************************************************
143 //
145 //
146 //*****************************************************************************
147 #define SMBUS_RET_OK_BLOCK (3)
148 
149 
150 //*****************************************************************************
151 //
153 //
154 //*****************************************************************************
155 #define SMBUS_RET_ERROR (-1)
156 
157 //*****************************************************************************
158 //
160 //
161 //*****************************************************************************
162 #define SMBUS_BLOCK_LENGTH (0xFFFF)
163 
164 //*****************************************************************************
165 //
167 //
168 //*****************************************************************************
169 #define SMBUS_CMD_PREPARE_TO_ARP 0x01
170 //*****************************************************************************
171 //
173 //
174 //*****************************************************************************
175 #define SMBUS_CMD_ARP_RESET_DEVICE 0x02
176 //*****************************************************************************
177 //
179 //
180 //*****************************************************************************
181 #define SMBUS_CMD_ARP_GET_UDID 0x03
182 //*****************************************************************************
183 //
185 //
186 //*****************************************************************************
187 #define SMBUS_CMD_ARP_ASSIGN_ADDRESS 0x04
188 
189 //*****************************************************************************
190 //
191 // Fixed addresses defined by the SMBus specification.
192 //
193 //*****************************************************************************
194 //*****************************************************************************
195 //
197 //
198 //*****************************************************************************
199 #define SMBUS_ADR_HOST 0x08
200 //*****************************************************************************
201 //
203 //
204 //*****************************************************************************
205 #define SMBUS_ADR_SMART_BATTERY_CHARGER 0x09
206 //*****************************************************************************
207 //
209 //
210 //*****************************************************************************
211 #define SMBUS_ADR_SMART_BATTERY_SELECTOR 0x0A
212 //*****************************************************************************
213 //
215 //
216 //*****************************************************************************
217 #define SMBUS_ADR_SMART_BATTERY 0x0B
218 //*****************************************************************************
219 //
221 //
222 //*****************************************************************************
223 #define SMBUS_ADR_DEFAULT_DEVICE 0x61
224 //*****************************************************************************
225 //
227 //
228 //*****************************************************************************
229 #define SMBUS_TARGET_OWN_ADDRESS SMBUS_ADR_SMART_BATTERY_CHARGER
230 //*****************************************************************************
231 //
233 //
234 //*****************************************************************************
235 #define SMBUS_ARP_UDID_LEN 0x11
236 
237 //*****************************************************************************
238 //
240 //*****************************************************************************
241 #define ARP_ADD_RESOLVED 0x00
242 //*****************************************************************************
243 //
245 //*****************************************************************************
246 #define ARP_ADD_VALID 0x00
247 //*****************************************************************************
248 //
250 //*****************************************************************************
251 #define ARP_ADD_TYPE 0x00
252 
253 //*****************************************************************************
254 // typedefs
255 //*****************************************************************************
256 
257 //*****************************************************************************
258 //
260 //
261 //*****************************************************************************
262 typedef enum
263 {
264  SMBus_Stop_After_Transfer = 0,
265  SMBus_No_Stop_After_Transfer
266 } SMBus_Stop;
267 
268 //*****************************************************************************
269 //
271 //
272 //*****************************************************************************
273 typedef enum
274 {
279 } SMBus_Start;
280 
281 //*****************************************************************************
282 //
284 //
285 //*****************************************************************************
286 typedef enum
287 {
293 
294 //*****************************************************************************
295 //
297 //
298 //*****************************************************************************
299 typedef union
300 {
301  //*****************************************************************************
302  //
304  //
305  //*****************************************************************************
306  struct
307  {
309  uint8_t pecEn : 1;
311  uint8_t hostNotifyEn : 1;
313  uint8_t swackEn : 1;
315  uint8_t intEn : 1;
317  uint8_t phyEn : 1;
319  uint8_t controller : 1;
321  uint8_t reserved2 : 2;
322  } bits;
323  //*****************************************************************************
324  //
326  //
327  //*****************************************************************************
328  struct
329  {
331  uint8_t writeBits : 2;
333  uint8_t reserved : 6;
334  } writeableBits;
336  uint8_t u8byte;
337 } SMBus_Ctrl;
338 
339 //*****************************************************************************
340 //
342 //
343 //*****************************************************************************
344 typedef struct
345 {
347  I2C_Regs* SMBus_Phy_i2cBase;
349  SMBus_Stop SMBus_Phy_stop;
352 } SMBus_Phy;
353 
354 //*****************************************************************************
355 //
357 //
358 //*****************************************************************************
359 typedef enum
360 {
384 
385 //*****************************************************************************
386 //
389 //
390 //*****************************************************************************
391 typedef struct
392 {
396 
398 
403 
404  uint8_t ui8Version;
405 
409 
410  uint16_t ui16VendorID;
411 
415 
416  uint16_t ui16DeviceID;
417 
421 
422  uint16_t ui16Interface;
423 
427 
429 
433 
435 
439 
441 }
442 tSMBusUDID;
443 
444 /****************************************************************************** */
445 
446 //
448 //
449 //*****************************************************************************
450 typedef struct
451 {
453  volatile SMBus_NwkState eState;
455  uint8_t currentAddr;
457  uint8_t currentCmd;
459  uint16_t rxIndex;
461  uint16_t rxLen;
463  uint16_t rxSize;
465  uint8_t *rxBuffPtr;
467  uint16_t txIndex;
469  uint16_t txLen;
471  uint8_t *txBuffPtr;
473  uint8_t *recByteTxPtr;
475  uint16_t txSize;
480 
489 
490 } SMBus_Nwk;
491 
492 //*****************************************************************************
493 //
495 //
496 //*****************************************************************************
497 typedef enum
498 {
506 
507 //*****************************************************************************
508 //
510 //
511 //*****************************************************************************
512 typedef enum
513 {
548 } SMBus_State;
549 
550 /****************************************************************************** */
551 
552 //
554 //
555 //*****************************************************************************
556 typedef union
557 {
558  //*****************************************************************************
559  //
561  //
562  //*****************************************************************************
563  struct
564  {
566  uint8_t pecErr : 1;
568  uint8_t toErr : 1;
570  uint8_t packErr : 1;
572  uint8_t packOvrErr : 1;
574  uint8_t byteOvrErr : 1;
576  uint8_t cmdErr : 1;
578  uint8_t reserved : 2;
579  } bits;
581  uint8_t u8byte;
582 } SMBus_Status;
583 
584 /****************************************************************************** */
585 //
587 //
588 //*****************************************************************************
589 typedef struct
590 {
592  uint8_t arpAddResolved;
596  uint8_t arpInProgress;
598  uint8_t arpCommand;
600  uint16_t arpDataLength;
602  uint8_t arpRxData;
604  SMBus_State errorState;
606  uint8_t arpUDIDNacked;
610  uint32_t arpWriteState;
612 //*****************************************************************************
613 //
615 //
616 //*****************************************************************************
617 typedef struct
618 {
630  SMBus_State state;
632  uint8_t ownTargetAddr;
634  uint8_t arpUDIDNacked;
635 } SMBus;
636 
637 //*****************************************************************************
638 // globals
639 //*****************************************************************************
640 
641 //*****************************************************************************
642 // Public functions called by applications
643 //*****************************************************************************
644 //*****************************************************************************
645 //
647 //
650 //
652 //
653 // \return None
654 //
655 //*****************************************************************************
656 extern void SMBus_processDone(SMBus *smbus);
657 
658 //*****************************************************************************
659 //
661 //
663 //
665 //
666 //*****************************************************************************
667 extern uint16_t SMBus_getRxPayloadAvailable(SMBus *smbus);
668 
669 //*****************************************************************************
670 //
672 //
674 //
676 //
677 //*****************************************************************************
678 extern SMBus_State SMBus_getState(SMBus *smbus);
679 
680 //*****************************************************************************
681 //
683 //
685 //
686 // \return None
687 //
688 //*****************************************************************************
689 extern void SMBus_enablePEC(SMBus *smbus);
690 //*****************************************************************************
691 //
693 //
695 //
696 // \return None
697 //
698 //*****************************************************************************
699 extern void SMBus_disablePEC(SMBus *smbus);
700 
701 //*****************************************************************************
702 //
704 //
706 //
709 //
710 // \return None
711 //
712 //*****************************************************************************
713 extern void SMBus_targetInit(SMBus *smbus, I2C_Regs *i2cAddr);
714 
715 //*****************************************************************************
716 //
718 //
720 //
722 //
723 // \return None
724 //
725 //*****************************************************************************
726 extern void SMBus_targetEnableInt(SMBus *smbus);
727 
728 //*****************************************************************************
729 //
731 //
733 //
735 //
736 // \return None
737 //
738 //*****************************************************************************
739 extern void SMBus_targetDisableInt(SMBus *smbus);
740 
741 //*****************************************************************************
742 //
744 //
747 //
749 //
759 //
760 //*****************************************************************************
761 extern SMBus_State SMBus_targetProcessInt(SMBus *smbus);
762 
763 //*****************************************************************************
764 //
766 //
768 //
770 //
771 // \return None
772 //
773 //*****************************************************************************
774 extern void SMBus_controllerReset(SMBus *smbus);
775 
776 //*****************************************************************************
777 //
779 //
782 //
783 // \return None
784 //
785 //*****************************************************************************
786 extern void SMBus_targetSetAddress(SMBus *smbus,
787  uint8_t targetAddr);
788 
789 //*****************************************************************************
790 //
792 //
796 //
797 // \return None
798 //
799 //*****************************************************************************
800 extern void SMBus_targetSetRxBuffer(SMBus *smbus,
801  uint8_t *data,
802  uint16_t size);
803 
804 //*****************************************************************************
805 //
807 //
811 //
812 // \return None
813 //
814 //*****************************************************************************
815 extern void SMBus_targetSetTxBuffer(SMBus *smbus,
816  uint8_t *data,
817  uint16_t size);
818 
819 //*****************************************************************************
820 //
822 //
824 //
827 //
828 // \return None
829 //
830 //*****************************************************************************
831 extern void SMBus_targetReportError(SMBus *smbus,
832  SMBus_ErrorCode errorCode);
833 
834 //*****************************************************************************
835 //
837 //
839 //
841 //
842 //*****************************************************************************
843 extern uint8_t SMBus_targetGetCommand(SMBus *smbus);
844 
845 //*****************************************************************************
846 //
848 //
850 //
851 //*****************************************************************************
852 extern void SMBus_targetReportBlock(SMBus *smbus);
853 
854 //*****************************************************************************
855 //
857 //
860 //
861 //*****************************************************************************
862 extern void SMBus_targetReportLength(SMBus *smbus, uint16_t length);
863 
864 //*****************************************************************************
865 //
867 //
870 //
872 //
873 //*****************************************************************************
874 extern uint8_t SMBus_targetClearStatusReg(SMBus *smbus,
875  uint8_t val);
876 
877 //*****************************************************************************
878 //
880 //
883 //
885 //
886 //*****************************************************************************
887 extern uint8_t SMBus_targetWriteCtrlReg(SMBus *smbus,
888  uint8_t val);
889 
890 //*****************************************************************************
891 //
893 //
913 //
917 //
919 //
920 //*****************************************************************************
921 extern int8_t SMBus_targetHostAlert(SMBus *smbus,
922  uint8_t deviceAddress,
923  uint8_t *txData);
924 
925 //*****************************************************************************
926 //
928 //
930 //
934 //
935 // \return None
936 //
937 //*****************************************************************************
938 extern void SMBus_controllerInit(SMBus *smbus,
939  I2C_Regs *i2cAddr,
940  uint32_t busClk);
941 
942 //*****************************************************************************
943 //
945 //
948 //
950 //
951 // \return None
952 //
953 //*****************************************************************************
954 extern void SMBus_controllerEnableInt(SMBus *smbus);
955 
956 //*****************************************************************************
957 //
959 //
961 //
963 //
964 // \return None
965 //
966 //*****************************************************************************
967 extern void SMBus_controllerDisableInt(SMBus *smbus);
968 
969 
970 //*****************************************************************************
971 //
973 //
976 //
978 //
980 //
981 //*****************************************************************************
982 extern SMBus_State SMBus_controllerProcessInt(SMBus *smbus);
983 
984 
985 //*****************************************************************************
986 //
988 //
1025 //
1031 //
1033 //
1034 //*****************************************************************************
1035 extern int8_t SMBus_controllerProcessCall(SMBus *smbus,
1036  uint8_t targetAddr,
1037  uint8_t command,
1038  uint8_t *txData,
1039  uint8_t *rxData);
1040 
1041 //*****************************************************************************
1042 //
1044 //
1048 //
1100 //
1107 //
1109 //
1110 //*****************************************************************************
1111 extern int8_t SMBus_controllerProcessCallBlock(SMBus *smbus,
1112  uint8_t targetAddr,
1113  uint8_t command,
1114  uint8_t *txData,
1115  uint8_t txSize,
1116  uint8_t *rxData);
1117 
1118 //*****************************************************************************
1119 //
1121 //
1145 //
1149 //
1151 //
1152 //*****************************************************************************
1153 extern int8_t SMBus_controllerSendByte(SMBus *smbus,
1154  uint8_t targetAddr,
1155  uint8_t txData);
1156 
1157 //*****************************************************************************
1158 //
1160 //
1183 //
1187 //
1189 //
1190 //*****************************************************************************
1191 extern int8_t SMBus_controllerReceiveByte(SMBus *smbus,
1192  uint8_t targetAddr,
1193  uint8_t *rxData);
1194 
1195 //*****************************************************************************
1196 //
1198 //
1202 //
1242 //
1247 //
1249 //
1250 //*****************************************************************************
1251 extern int8_t SMBus_controllerReadBlock(SMBus *smbus,
1252  uint8_t targetAddr,
1253  uint8_t command,
1254  uint8_t *rxData);
1255 
1256 //*****************************************************************************
1257 //
1259 //
1262 //
1296 //
1302 //
1304 //
1305 //*****************************************************************************
1306 extern int8_t SMBus_controllerWriteBlock(SMBus *smbus,
1307  uint8_t targetAddr,
1308  uint8_t command,
1309  uint8_t *txData,
1310  uint16_t txSize);
1311 
1312 //*****************************************************************************
1313 //
1315 //
1316 //
1365 //
1371 //
1373 //
1374 //*****************************************************************************
1375 extern int8_t SMBus_controllerReadByteWord(SMBus *smbus,
1376  uint8_t targetAddr,
1377  uint8_t command,
1378  uint8_t *rxData,
1379  uint8_t rxSize);
1380 
1381 //*****************************************************************************
1382 //
1420 //
1426 //
1428 //
1429 //*****************************************************************************
1430 extern int8_t SMBus_controllerWriteByteWord(SMBus *smbus,
1431  uint8_t targetAddr,
1432  uint8_t command,
1433  uint8_t *txData,
1434  uint8_t txSize);
1435 
1436 //*****************************************************************************
1437 //
1439 //
1455 //
1459 //
1461 //
1462 //*****************************************************************************
1463 extern int8_t SMBus_controllerQuickCommand(SMBus *smbus,
1464  uint8_t targetAddr,
1465  bool write);
1466 
1467 //*****************************************************************************
1468 //
1470 //
1473 //
1475 //
1476 //*****************************************************************************
1477 extern int8_t SMBus_controllerWaitUntilDone(SMBus *smbus,
1478  int32_t timeout);
1479 
1480 //*****************************************************************************
1481 //
1483 //
1486 //
1489 //
1490 // \return None
1491 //
1492 //*****************************************************************************
1493 extern void SMBus_controllerEnableHostNotify(SMBus *smbus, uint8_t *hostAlertBuffer);
1494 
1495 //*****************************************************************************
1496 //
1498 //
1501 //
1503 //
1504 // \return None
1505 //
1506 //*****************************************************************************
1507 extern void SMBus_controllerDisableHostNotify(SMBus *smbus);
1508 //*****************************************************************************
1509 //
1511 //
1513 //
1515 //
1516 //*****************************************************************************
1517 extern uint8_t SMBus_targetGetAddress(SMBus *smbus);
1518 //*****************************************************************************
1519 //
1521 //
1524 //
1528 // \return None.
1529 //
1530 //*****************************************************************************
1531 extern void SMBusARPAssignAddress(SMBus *smbus);
1532 //*****************************************************************************
1533 //
1543 //
1544 //*****************************************************************************
1545 extern int8_t SMBusARPUDIDByteValidate(SMBus *smbus);
1546 
1547 //*****************************************************************************
1548 //
1557 // \return None.
1558 //
1559 //*****************************************************************************
1560 extern void SMBusARPGetUDIDPacket(SMBus *smbus);
1561 
1562 //*****************************************************************************
1563 //
1572 // \return None.
1573 //
1574 //*****************************************************************************
1575 extern void SMBusARPGetUDIDPacketDirect(SMBus *smbus);
1576 //*****************************************************************************
1577 //
1586 // \return None.
1587 //
1588 //*****************************************************************************
1589 extern void SMBusARP_RESET(SMBus *smbus);
1590 //*****************************************************************************
1591 //
1598 // \return None.
1599 //
1600 //*****************************************************************************
1601 extern void SMBusARPUDIDPacketDecode(tSMBusUDID *pUDID, uint8_t *pui8Data);
1602 //*****************************************************************************
1603 //
1611 //
1612 // *****************************************************************************
1613 extern uint8_t SMBus_targetGetARPInProgress(SMBus *smbus);
1614 //*****************************************************************************
1615 //
1623 //
1624 // *****************************************************************************
1625 extern uint8_t SMBus_targetGetARStatus(SMBus *smbus);
1626 //*****************************************************************************
1627 //
1634 // \return None
1636 //
1637 // *****************************************************************************
1638 extern void SMBus_targetSetARStatus(SMBus *smbus , uint8_t val);
1639 //*****************************************************************************
1640 //
1647 // \return None
1649 //
1650 // *****************************************************************************
1651 extern void SMBus_targetSetAVStatus(SMBus *smbus, uint8_t val);
1652 //*****************************************************************************
1653 //
1661 //
1662 // *****************************************************************************
1663 extern uint8_t SMBus_targetGetAVStatus(SMBus *smbus);
1664 //*****************************************************************************
1665 //
1673 //
1674 // *****************************************************************************
1675 extern uint8_t SMBus_targetGetAddressDirect(SMBus *smbus);
1676 
1677 //*****************************************************************************
1678 //
1686 //
1687 // *****************************************************************************
1688 extern uint8_t SMBus_targetGetDirectCmd(SMBus *smbus);
1689 
1690 //*****************************************************************************
1691 //
1700 //
1701 // *****************************************************************************
1702 extern int8_t ARP_UDIDValidate(SMBus *smbus);
1703 //*****************************************************************************
1704 //
1711 // *****************************************************************************
1712 extern void ARP_invalidCMD(SMBus *smbus);
1713 
1714 //*****************************************************************************
1715 //
1725 //
1726 // *****************************************************************************
1727 extern int8_t ARP_isCmdValid(SMBus *smbus);
1728 //*****************************************************************************
1729 //*****************************************************************************
1730 //
1740 //
1741 // *****************************************************************************
1742 extern int8_t ARP_CmdComplete(SMBus *smbus);
1743 //*****************************************************************************
1744 //
1745 // Mark the end of the C bindings section for C++ compilers.
1746 //
1747 //*****************************************************************************
1748 #ifdef __cplusplus
1749 }
1750 #endif
1751 
1752 //*****************************************************************************
1753 //
1754 // Close the Doxygen group.
1756 //
1757 //*****************************************************************************
1758 
1759 #endif //__SMBUS_H__
void SMBus_targetReportBlock(SMBus *smbus)
Report to hardware that the command type is a block command.
Definition: smbus.c:186
Definition: smbus.h:541
uint8_t ownTargetAddr
Definition: smbus.h:632
uint8_t SMBus_targetGetAddress(SMBus *smbus)
Get the target&#39;s own I2C address.
Definition: smbus.c:540
SMBus_Auto_Ack
List of auto ack codes used within the NWK and PHY layers.
Definition: smbus.h:286
void SMBus_controllerReset(SMBus *smbus)
Force reset to SMBus controller interface.
Definition: smbus.c:279
uint8_t SMBus_targetGetARPInProgress(SMBus *smbus)
Get ARP Address Progress Status.
Definition: smbus.c:792
uint16_t ui16VendorID
Definition: smbus.h:410
Definition: smbus.h:523
uint8_t SMBus_targetClearStatusReg(SMBus *smbus, uint8_t val)
Clear the target&#39;s status register.
Definition: smbus.c:203
Definition: smbus.h:366
uint16_t rxLen
Definition: smbus.h:461
int8_t SMBus_controllerProcessCallBlock(SMBus *smbus, uint8_t targetAddr, uint8_t command, uint8_t *txData, uint8_t txSize, uint8_t *rxData)
Sends a block write-block read process call.
Definition: smbus.c:308
Definition: smbus.h:531
int8_t SMBus_controllerQuickCommand(SMBus *smbus, uint8_t targetAddr, bool write)
Send a SMBus "quick command".
Definition: smbus.c:482
uint8_t currentCmd
Definition: smbus.h:457
uint16_t ui16Interface
Definition: smbus.h:422
SMBus_State SMBus_controllerProcessInt(SMBus *smbus)
I2C Interrupt Service routine for a controller.
Definition: smbus.c:274
Definition: smbus.h:517
uint8_t SMBus_targetGetAddressDirect(SMBus *smbus)
Get Target Direct Address in ARP Direct Address Call.
Definition: smbus.c:817
uint8_t arpAddResolved
Definition: smbus.h:592
SMBus_Nwk nwk
Definition: smbus.h:622
bool SMBus_Phy_AckPending
Definition: smbus.h:351
uint16_t txIndex
Definition: smbus.h:467
uint8_t arpInProgress
Definition: smbus.h:596
Definition: smbus.h:521
Definition: smbus.h:543
SMBus_Ctrl ctrl
Definition: smbus.h:624
SMBus_Stop SMBus_Phy_stop
Definition: smbus.h:349
uint8_t arpCommand
Definition: smbus.h:598
SMBus_Phy phy
Definition: smbus.h:620
uint8_t ui8DeviceCapabilities
Definition: smbus.h:397
uint8_t ui8Version
Definition: smbus.h:404
SMBus_ErrorCode
List of error codes used by the application to indicate an error to the library.
Definition: smbus.h:497
void SMBus_targetSetARStatus(SMBus *smbus, uint8_t val)
Set ARP Address Resolved Status.
Definition: smbus.c:802
uint8_t u8byte
Definition: smbus.h:581
Definition: smbus.h:525
void SMBus_targetReportError(SMBus *smbus, SMBus_ErrorCode errorCode)
Reports an error to SMBus driver from the target.
Definition: smbus.c:161
SMBus control register.
Definition: smbus.h:299
Definition: smbus.h:500
void SMBus_controllerDisableHostNotify(SMBus *smbus)
Disable support for Host Notify Protocol.
Definition: smbus.c:534
volatile SMBus_NwkState eState
Definition: smbus.h:453
uint8_t * txBuffPtr
Definition: smbus.h:471
uint8_t arpAddressValid
Definition: smbus.h:594
uint8_t * hostNotifyRxBuffPtr
Definition: smbus.h:479
SMBus_State SMBus_targetProcessInt(SMBus *smbus)
I2C Interrupt Service routine for a target.
Definition: smbus.c:123
Definition: smbus.h:547
SMBus_State state
Definition: smbus.h:630
void SMBus_controllerInit(SMBus *smbus, I2C_Regs *i2cAddr, uint32_t busClk)
Initialize the SMBus Interface for a controller.
Definition: smbus.c:239
Definition: smbus.h:533
Definition: smbus.h:535
void SMBus_disablePEC(SMBus *smbus)
Disables PEC support.
Definition: smbus.c:83
void SMBus_targetSetRxBuffer(SMBus *smbus, uint8_t *data, uint16_t size)
Initialize the reception buffer for target.
Definition: smbus.c:143
uint8_t arpUDIDNacked
Definition: smbus.h:606
int8_t SMBus_controllerSendByte(SMBus *smbus, uint8_t targetAddr, uint8_t txData)
Sends byte to the target.
Definition: smbus.c:338
uint16_t rxIndex
Definition: smbus.h:459
uint16_t ui16SubSystemDeviceID
Definition: smbus.h:434
SMBus_ARP_Status arpStatus
Definition: smbus.h:628
Definition: smbus.h:376
Definition: smbus.h:370
uint8_t SMBus_targetGetARStatus(SMBus *smbus)
Get ARP Address Valid Status.
Definition: smbus.c:797
void SMBus_processDone(SMBus *smbus)
Clears the current state of SMBus.
Definition: smbus.c:41
Definition: smbus.h:539
int8_t SMBus_controllerReadByteWord(SMBus *smbus, uint8_t targetAddr, uint8_t command, uint8_t *rxData, uint8_t rxSize)
Receive a byte from the target.
Definition: smbus.c:426
void ARP_invalidCMD(SMBus *smbus)
ARP Invalid Command Routine.
Definition: smbus.c:914
Definition: smbus.h:278
uint8_t arpUDIDTransmit
Definition: smbus.h:608
int8_t SMBus_controllerWaitUntilDone(SMBus *smbus, int32_t timeout)
Wait until the previous SMBus command is executed.
Definition: smbus.c:509
void SMBusARPGetUDIDPacketDirect(SMBus *smbus)
Encodes a UDID structure and address into SMBus-transferable byte order.
Definition: smbus.c:677
uint8_t arpRxData
Definition: smbus.h:602
int8_t SMBus_controllerProcessCall(SMBus *smbus, uint8_t targetAddr, uint8_t command, uint8_t *txData, uint8_t *rxData)
Sends a process call to a target.
Definition: smbus.c:284
Definition: smbus.h:368
uint32_t ui32VendorSpecificID
Definition: smbus.h:440
void SMBus_targetSetTxBuffer(SMBus *smbus, uint8_t *data, uint16_t size)
Initialize the transmission buffer for target.
Definition: smbus.c:152
uint8_t u8byte
Definition: smbus.h:336
void SMBus_enablePEC(SMBus *smbus)
Enables PEC support.
Definition: smbus.c:78
void SMBusARP_RESET(SMBus *smbus)
Resets the States of the AR Flag and AV flag based on POR status.
Definition: smbus.c:735
Definition: smbus.h:527
uint16_t txSize
Definition: smbus.h:475
uint8_t * recByteTxPtr
Definition: smbus.h:473
SMBus_State SMBus_getState(SMBus *smbus)
Returns the state of the SMBus module.
Definition: smbus.c:72
uint8_t SMBus_targetGetCommand(SMBus *smbus)
Return the current command (Rxbuffer[0]) received by the target.
Definition: smbus.c:181
Definition: smbus.h:519
void SMBus_controllerEnableInt(SMBus *smbus)
Enables the I2C interrupts for a controller.
Definition: smbus.c:263
Definition: smbus.h:276
Definition: smbus.h:372
void SMBus_targetSetAVStatus(SMBus *smbus, uint8_t val)
Set ARP Address Valid Status.
Definition: smbus.c:807
SMBus_NwkState
SMBus network layer states.
Definition: smbus.h:359
Definition: smbus.h:289
uint8_t * rxBuffPtr
Definition: smbus.h:465
SMBus_State errorState
Definition: smbus.h:604
tSMBusUDID * pUDID
Definition: smbus.h:488
SMBus_Status status
Definition: smbus.h:626
SMBus_State
SMBus state sent to application layer.
Definition: smbus.h:512
void SMBus_controllerDisableInt(SMBus *smbus)
Disables the I2C interrupts for a controller.
Definition: smbus.c:268
Definition: smbus.h:291
int8_t SMBus_targetHostAlert(SMBus *smbus, uint8_t deviceAddress, uint8_t *txData)
Send a Host Alert from the target.
Definition: smbus.c:218
SMBus ARP Status Register.
Definition: smbus.h:589
void SMBus_targetSetAddress(SMBus *smbus, uint8_t targetAddr)
Set the target&#39;s own I2C address.
Definition: smbus.c:136
uint8_t pecBlockLenOverride
Definition: smbus.h:477
int8_t ARP_CmdComplete(SMBus *smbus)
ARP Command complete callback.
Definition: smbus.c:931
Physical and Data Link Layer object.
Definition: smbus.h:344
void SMBusARPGetUDIDPacket(SMBus *smbus)
Encodes a UDID structure and address into SMBus-transferable byte order.
Definition: smbus.c:717
Definition: smbus.h:537
uint8_t currentAddr
Definition: smbus.h:455
int8_t ARP_UDIDValidate(SMBus *smbus)
ARP_UDIDValidate.
Definition: smbus.c:905
int8_t ARP_isCmdValid(SMBus *smbus)
Validates a command for ARP.
Definition: smbus.c:827
Definition: smbus.h:378
void SMBus_targetInit(SMBus *smbus, I2C_Regs *i2cAddr)
Initialize the SMBus interface as a target.
Definition: smbus.c:89
Definition: smbus.h:504
Definition: smbus.h:362
Main SMBus object.
Definition: smbus.h:617
void SMBus_targetEnableInt(SMBus *smbus)
Enables the I2C interrupts for a target.
Definition: smbus.c:112
Definition: smbus.h:364
SMBus_Stop
List of stop codes used within the NWK and PHY layers.
Definition: smbus.h:262
uint8_t arpUDIDNacked
Definition: smbus.h:634
uint8_t SMBus_targetGetDirectCmd(SMBus *smbus)
Get Target Direct Command with Direct Address Call.
Definition: smbus.c:822
I2C_Regs * SMBus_Phy_i2cBase
Definition: smbus.h:347
Definition: smbus.h:374
int8_t SMBus_controllerWriteByteWord(SMBus *smbus, uint8_t targetAddr, uint8_t command, uint8_t *txData, uint8_t txSize)
Send a command transmitting a byte or word of data from the target.
Definition: smbus.c:454
void SMBusARPUDIDPacketDecode(tSMBusUDID *pUDID, uint8_t *pui8Data)
Decodes an SMBus packet into a UDID structure and address.
Definition: smbus.c:771
uint8_t SMBus_targetWriteCtrlReg(SMBus *smbus, uint8_t val)
Write a value to the target&#39;s control register.
Definition: smbus.c:210
uint16_t txLen
Definition: smbus.h:469
void SMBus_targetDisableInt(SMBus *smbus)
Disables the I2C interrupts for a target.
Definition: smbus.c:117
SMBus Status Register.
Definition: smbus.h:556
uint16_t arpDataLength
Definition: smbus.h:600
Definition: smbus.h:545
Definition: smbus.h:515
void SMBus_targetReportLength(SMBus *smbus, uint16_t length)
Report to hardware the fixed length of a given command.
Definition: smbus.c:196
Definition: smbus.h:380
uint32_t arpWriteState
Definition: smbus.h:610
Definition of SMBus Network structure.
Definition: smbus.h:450
uint16_t ui16SubSystemVendorID
Definition: smbus.h:428
void SMBus_controllerEnableHostNotify(SMBus *smbus, uint8_t *hostAlertBuffer)
Enable support for Host Notify Protocol.
Definition: smbus.c:527
Definition: smbus.h:502
void SMBusARPAssignAddress(SMBus *smbus)
Validates the Received Address into SMBus-transferable byte order.
Definition: smbus.c:547
uint16_t rxSize
Definition: smbus.h:463
uint16_t ui16DeviceID
Definition: smbus.h:416
Definition: smbus.h:529
int8_t SMBusARPUDIDByteValidate(SMBus *smbus)
Validates the Received UDID Byte and address into SMBus-transferable byte order.
Definition: smbus.c:557
Definition: smbus.h:382
Definition: smbus.h:391
SMBus_Start
List of start codes used within the NWK and PHY layers.
Definition: smbus.h:273
uint8_t SMBus_targetGetAVStatus(SMBus *smbus)
Get ARP Address Valid Status.
Definition: smbus.c:812
uint16_t SMBus_getRxPayloadAvailable(SMBus *smbus)
Returns the number of received bytes from last transaction.
Definition: smbus.c:67
© Copyright 1995-2025, Texas Instruments Incorporated. All rights reserved.
Trademarks | Privacy policy | Terms of use | Terms of sale