Update repo

This commit is contained in:
2026-08-30 23:04:35 -07:00
parent 749dab5721
commit ce65a0f59a
14950 changed files with 4408250 additions and 1 deletions
@@ -0,0 +1,161 @@
//###########################################################################
//
// FILE: pmbus_stack_assert.h
//
// TITLE: Defines the PMBUS_STACK_ASSERT function macro
//
// Work in this file is based on the article:
// http://www.embedded.com/electronics-blogs/other/4023329/Assert-Yourself
//
//#############################################################################
//!
//! Copyright: Copyright (C) 2023 Texas Instruments Incorporated -
//! All rights reserved not granted herein.
//! Limited License.
//!
//! Texas Instruments Incorporated grants a world-wide, royalty-free,
//! non-exclusive license under copyrights and patents it now or hereafter
//! owns or controls to make, have made, use, import, offer to sell and sell
//! ("Utilize") this software subject to the terms herein. With respect to the
//! foregoing patent license, such license is granted solely to the extent that
//! any such patent is necessary to Utilize the software alone. The patent
//! license shall not apply to any combinations which include this software,
//! other than combinations with devices manufactured by or for TI
//! ("TI Devices").
//! No hardware patent is licensed hereunder.
//!
//! Redistributions must preserve existing copyright notices and reproduce this
//! license (including the above copyright notice and the disclaimer and
//! (if applicable) source code license limitations below) in the documentation
//! and/or other materials provided with the distribution.
//!
//! Redistribution and use in binary form, without modification, are permitted
//! provided that the following conditions are met:
//!
//! * No reverse engineering, decompilation, or disassembly of this software is
//! permitted with respect to any software provided in binary form.
//! * Any redistribution and use are licensed by TI for use only
//! with TI Devices.
//! * Nothing shall obligate TI to provide you with source code for the
//! software licensed and provided to you in object code.
//!
//! If software source code is provided to you, modification and redistribution
//! of the source code are permitted provided that the following conditions
//! are met:
//!
//! * any redistribution and use of the source code, including any resulting
//! derivative works, are licensed by TI for use only with TI Devices.
//! * any redistribution and use of any object code compiled from the source
//! code and any resulting derivative works, are licensed by TI for use
//! only with TI Devices.
//!
//! Neither the name of Texas Instruments Incorporated nor the names of its
//! suppliers may be used to endorse or promote products derived from this
//! software without specific prior written permission.
//#############################################################################
#ifndef PMBUS_STACK_ASSERT_H
#define PMBUS_STACK_ASSERT_H
//*****************************************************************************
//
// If building with a C++ compiler, make all of the definitions in this header
// have a C binding.
//
//*****************************************************************************
#ifdef __cplusplus
extern "C"
{
#endif
//*****************************************************************************
//
//!
//! \defgroup PMBUS_STACK_ASSERT Code Development with Assertion
//
//!
//! \ingroup PMBUS_STACK_ASSERT
// @{
//
//*****************************************************************************
//
// Includes
//
#include <stdint.h>
#include <stdbool.h>
//
// Defines
//
//! Assign a "unique" number to each file, compiler error
//! on duplicates
#define PMBUS_STACK_FILENUM(number) \
enum{FILE_NUM = number}; \
void _nullFunction##number(void){}
//! The assert() for the PMBus communications stack
#define PMBUS_STACK_ASSERT(expr) \
if (expr) \
{} \
else \
PMBusStack_assertionFailed(FILE_NUM, __LINE__)
//*****************************************************************************
//
//! Error Handler Function Pointer
//!
//! In the \e Release Mode, the user must define an error handler, and assign
//! it to this function pointer which gets called when PMBUS_STACK_ASSERT
//! fails in the state machine.
//!
//! \note If the library was built in debug mode, i.e. the macro \b _DEBUG
//! defined then it is unnecessary for the user to define this function in
//! their project. It is only required when using the release version of the
//! library; failure to define this will result in a linker error
//!
//! \return none
//
//*****************************************************************************
extern void (*PMBusStack_errorHandler)(void);
//*****************************************************************************
//
//! Handles failed assertions
//!
//! \param file is the file number where the assertion failed
//! \param line is the line number where the assertion failed
//!
//! This function handles any failed assertions within the stack library.
//!
//! \return None.
//
//*****************************************************************************
static inline void
PMBusStack_assertionFailed(int16_t file, int16_t line)
{
#if defined(_DEBUG)
__asm(" ESTOP0");
#else
PMBusStack_errorHandler();
#endif //defined(_DEBUG)
}
//*****************************************************************************
//
// Close the Doxygen group.
// @}
//
//*****************************************************************************
//*****************************************************************************
//
// Mark the end of the C bindings section for C++ compilers.
//
//*****************************************************************************
#ifdef __cplusplus
}
#endif // extern "C"
#endif // PMBUS_STACK_ASSERT_H
@@ -0,0 +1,124 @@
//###########################################################################
//
// FILE: pmbus_stack_compatibility.h
//
// TITLE: PMBus Stack Library Compatibility Header
//
// IMPORTANT: This re-maps the legacy F28004x PMBus stack library API, ENUM,
// Struct, etc names to the new names of the PMBus library
// (Legacy PMBus library refers to the version released in
// C2000Ware v2.00.00.03 and older)
//
// Legacy Users: If you've previously developed using the legacy PMBus library,
// include this header in your project to map the legacy names
// to the new library names
//
// New Users: If this is your first time developing with this library,
// DON'T include this file.
//
//#############################################################################
//!
//! Copyright: Copyright (C) 2023 Texas Instruments Incorporated -
//! All rights reserved not granted herein.
//! Limited License.
//!
//! Texas Instruments Incorporated grants a world-wide, royalty-free,
//! non-exclusive license under copyrights and patents it now or hereafter
//! owns or controls to make, have made, use, import, offer to sell and sell
//! ("Utilize") this software subject to the terms herein. With respect to the
//! foregoing patent license, such license is granted solely to the extent that
//! any such patent is necessary to Utilize the software alone. The patent
//! license shall not apply to any combinations which include this software,
//! other than combinations with devices manufactured by or for TI
//! ("TI Devices").
//! No hardware patent is licensed hereunder.
//!
//! Redistributions must preserve existing copyright notices and reproduce this
//! license (including the above copyright notice and the disclaimer and
//! (if applicable) source code license limitations below) in the documentation
//! and/or other materials provided with the distribution.
//!
//! Redistribution and use in binary form, without modification, are permitted
//! provided that the following conditions are met:
//!
//! * No reverse engineering, decompilation, or disassembly of this software is
//! permitted with respect to any software provided in binary form.
//! * Any redistribution and use are licensed by TI for use only
//! with TI Devices.
//! * Nothing shall obligate TI to provide you with source code for the
//! software licensed and provided to you in object code.
//!
//! If software source code is provided to you, modification and redistribution
//! of the source code are permitted provided that the following conditions
//! are met:
//!
//! * any redistribution and use of the source code, including any resulting
//! derivative works, are licensed by TI for use only with TI Devices.
//! * any redistribution and use of any object code compiled from the source
//! code and any resulting derivative works, are licensed by TI for use
//! only with TI Devices.
//!
//! Neither the name of Texas Instruments Incorporated nor the names of its
//! suppliers may be used to endorse or promote products derived from this
//! software without specific prior written permission.
//#############################################################################
#ifndef PMBUS_STACK_COMPATIBILITY_H
#define PMBUS_STACK_COMPATIBILITY_H
//
// Library API re-defining
//
#define PMBus_Stack_assertionFailed PMBusStack_assertionFailed
#define PMBus_Stack_errorHandler PMBusStack_errorHandler
#define PMBus_Stack_initModule PMBusStack_initModule
#define PMBus_Stack_defaultTransactionHandler PMBusStack_defaultTransactionHandler
#define PMBus_Stack_Obj_setModuleBase PMBusStackObject_setModuleBase
#define PMBus_Stack_Obj_getModuleBase PMBusStackObject_getModuleBase
#define PMBus_Stack_Obj_setModuleStatus PMBusStackObject_setModuleStatus
#define PMBus_Stack_Obj_getModuleStatus PMBusStackObject_getModuleStatus
#define PMBus_Stack_Obj_setMode PMBusStackObject_setMode
#define PMBus_Stack_Obj_getMode PMBusStackObject_getMode
#define PMBus_Stack_Obj_setAddress PMBusStackObject_setTargetAddress
#define PMBus_Stack_Obj_getAddress PMBusStackObject_getTargetAddress
#define PMBus_Stack_Obj_setAddressMask PMBusStackObject_setTargetAddressMask
#define PMBus_Stack_Obj_getAddressMask PMBusStackObject_getTargetAddressMask
#define PMBus_Stack_Obj_setCurrentState PMBusStackObject_setCurrentState
#define PMBus_Stack_Obj_getCurrentState PMBusStackObject_getCurrentState
#define PMBus_Stack_Obj_setNextState PMBusStackObject_setNextState
#define PMBus_Stack_Obj_getNextState PMBusStackObject_getNextState
#define PMBus_Stack_Obj_setPtrBuffer PMBusStackObject_setBufferPointer
#define PMBus_Stack_Obj_getPtrBuffer PMBusStackObject_getBufferPointer
#define PMBus_Stack_Obj_setCurrPtr PMBusStackObject_setCurrentPositionPointer
#define PMBus_Stack_Obj_getCurrPtr PMBusStackObject_getCurrentPositionPointer
#define PMBus_Stack_Obj_setNBytes PMBusStackObject_setNumOfBytes
#define PMBus_Stack_Obj_getNBytes PMBusStackObject_getNumOfBytes
#define PMBus_Stack_Obj_setPECValid PMBusStackObject_setPECValidity
#define PMBus_Stack_Obj_getPECValid PMBusStackObject_isPECValid
#define PMBus_Stack_Obj_setTransaction PMBusStackObject_setTransactionType
#define PMBus_Stack_Obj_getTransaction PMBusStackObject_getTransactionType
#define PMBus_Stack_Obj_setTransactionHandler PMBusStackObject_setTransactionHandler
#define PMBus_Stack_Obj_getTransactionHandler PMBusStackObject_getTransactionHandler
#define PMBus_Stack_doesCommandMatchTransaction PMBusStackObject_isCommandAndTransactionValid
#define PMBus_Stack_targetHandler PMBusStack_targetStateHandler
#define PMBus_Stack_targetIdleHandler PMBusStack_targetIdleStateHandler
#define PMBus_Stack_targetReceiveByteWaitForEomHandler PMBusStack_targetReceiveByteWaitForEOMStateHandler
#define PMBus_Stack_targetReadBlockHandler PMBusStack_targetReadBlockStateHandler
#define PMBus_Stack_targetReadWaitForEOMHandler PMBusStack_targetReadWaitForEOMStateHandler
#define PMBus_Stack_targetBlockWriteOrProcessCallHandler PMBusStack_targetBlockWriteOrProcessCallStateHandler
#define PMBUS_STACK_extendedCommandHandler PMBusStack_targetExtendedCommandStateHandler
//
// ENUM, Structs, etc re-defining
//
#define PMBus_Stack_mode PMBus_StackMode
#define PMBus_Stack_State PMBus_StackState
#define PMBus_Stack_Obj PMBus_StackObject
#define PMBus_Transaction_Obj PMBus_TransactionObject
#define PMBus_Stack_Handle PMBus_StackHandle
#define PMBus_Transaction_Obj_u PMBus_TransactionObjectUnion
#define PMBus_Stack_commandTransactionMap PMBusStack_commandTransactionMap
#define PMBUS_STACK_Target PMBusStackTarget
#endif // PMBUS_STACK_COMPATIBILITY_H
File diff suppressed because it is too large Load Diff
@@ -0,0 +1,241 @@
//###########################################################################
//
// FILE: pmbus_stack_Handler.h
//
// TITLE: PMBUS Communications State Machine
//
//#############################################################################
//!
//! Copyright: Copyright (C) 2023 Texas Instruments Incorporated -
//! All rights reserved not granted herein.
//! Limited License.
//!
//! Texas Instruments Incorporated grants a world-wide, royalty-free,
//! non-exclusive license under copyrights and patents it now or hereafter
//! owns or controls to make, have made, use, import, offer to sell and sell
//! ("Utilize") this software subject to the terms herein. With respect to the
//! foregoing patent license, such license is granted solely to the extent that
//! any such patent is necessary to Utilize the software alone. The patent
//! license shall not apply to any combinations which include this software,
//! other than combinations with devices manufactured by or for TI
//! ("TI Devices").
//! No hardware patent is licensed hereunder.
//!
//! Redistributions must preserve existing copyright notices and reproduce this
//! license (including the above copyright notice and the disclaimer and
//! (if applicable) source code license limitations below) in the documentation
//! and/or other materials provided with the distribution.
//!
//! Redistribution and use in binary form, without modification, are permitted
//! provided that the following conditions are met:
//!
//! * No reverse engineering, decompilation, or disassembly of this software is
//! permitted with respect to any software provided in binary form.
//! * Any redistribution and use are licensed by TI for use only
//! with TI Devices.
//! * Nothing shall obligate TI to provide you with source code for the
//! software licensed and provided to you in object code.
//!
//! If software source code is provided to you, modification and redistribution
//! of the source code are permitted provided that the following conditions
//! are met:
//!
//! * any redistribution and use of the source code, including any resulting
//! derivative works, are licensed by TI for use only with TI Devices.
//! * any redistribution and use of any object code compiled from the source
//! code and any resulting derivative works, are licensed by TI for use
//! only with TI Devices.
//!
//! Neither the name of Texas Instruments Incorporated nor the names of its
//! suppliers may be used to endorse or promote products derived from this
//! software without specific prior written permission.
//#############################################################################
#ifndef PMBUS_STACK_HANDLER_H
#define PMBUS_STACK_HANDLER_H
//*****************************************************************************
//
// If building with a C++ compiler, make all of the definitions in this header
// have a C binding.
//
//*****************************************************************************
#ifdef __cplusplus
extern "C"
{
#endif
//*****************************************************************************
//
//!
//! \defgroup PMBUS_STACK_HANDLER PMBus State Machine Handler
//
//!
//! \ingroup PMBUS_STACK_HANDLER
// @{
//
//*****************************************************************************
//
// Includes
//
#include "pmbus_stack_assert.h"
#ifndef PMBUS_OVER_I2C
#include "pmbus_stack_config.h"
#else
#include "pmbus_over_i2c_stack_config.h"
#define TARGET_RECEIVER (I2C_getStatus(base) & I2C_STS_TARGET_DIR) == 0
#define TARGET_TRANSMITTER (I2C_getStatus(base) & I2C_STS_TARGET_DIR) == I2C_STS_TARGET_DIR
#define STOP_CONDITION_DETECTED (I2C_getStatus(base) & I2C_STS_STOP_CONDITION) == I2C_STS_STOP_CONDITION
#define STOP_CONDITION_NOT_DETECTED (I2C_getStatus(base) & I2C_STS_STOP_CONDITION) == 0
#define WAIT_TILL_TX_FIFO_IS_EMPTY I2C_getTxFIFOStatus(base)
#define WAIT_TILL_RX_FIFO_IS_FULL !(I2C_getRxFIFOStatus(base) == I2C_FIFO_RXFULL)
#define WAIT_TILL_RX_FIFO_HAS(x) !(I2C_getRxFIFOStatus(base) == x)
#endif
#ifdef TIMEOUT
#include "driverlib.h"
#endif
//*****************************************************************************
//
//! PMBus Target Stack State Machine Handler
//!
//! \param handle is the handle to the PMBus stack object
//!
//! This function implements the state machine of the PMBus in target mode.
//! This handler is designed to operate within the PMBus interrupt service
//! routine (ISR) triggered by the following interrupts:
//! - Data Ready (Read buffer is full)
//! - Data Request (Controller has requested data) / SDIR bit in I2C
//! - EOM (Controller signals an end of a block message)
//!
//! \note The handler must be called in the PMBus ISR only
//!
//! \return None.
//
//*****************************************************************************
extern void
PMBusStack_targetStateHandler(PMBus_StackHandle handle);
//*****************************************************************************
//
//! PMBus Target Idle State Handler
//!
//! \param handle is the handle to the PMBus stack object
//!
//! This function handles the idle state in the target state machine.
//!
//! \return None.
//
//*****************************************************************************
extern void
PMBusStack_targetIdleStateHandler(PMBus_StackHandle handle);
//*****************************************************************************
//
//! PMBus Target Receive Byte Wait-for-EOM State Handler
//!
//! \param handle is the handle to the PMBus stack object
//!
//! This function handles the state in the target state machine that is entered
//! when a receive byte request is active and target is waiting for
//! end-of-message.
//!
//! \return None.
//
//*****************************************************************************
extern void
PMBusStack_targetReceiveByteWaitForEOMStateHandler(PMBus_StackHandle handle);
//*****************************************************************************
//
//! PMBus Target Read Block State Handler
//!
//! \param handle is the handle to the PMBus stack object
//!
//! This function handles the state in the target state machine that is entered
//! when a read block command is used.
//!
//! \return None.
//
//*****************************************************************************
extern void
PMBusStack_targetReadBlockStateHandler(PMBus_StackHandle handle);
//*****************************************************************************
//
//! PMBus Target Read/Wait for EOM State Handler
//!
//! \param handle is the handle to the PMBus stack object
//!
//! This function handles the state in the target state machine that is entered
//! when reading/waiting for the end-of-message.
//!
//! \return None.
//
//*****************************************************************************
extern void
PMBusStack_targetReadWaitForEOMStateHandler(PMBus_StackHandle handle);
//*****************************************************************************
//
//! PMBus Target Block Write or Process Call State Handler
//!
//! \param handle is the handle to the PMBus stack object
//!
//! This function handles the state in the target state machine that is entered
//! when a block write or process call commands are used.
//!
//! \return None.
//
//*****************************************************************************
extern void
PMBusStack_targetBlockWriteOrProcessCallStateHandler(PMBus_StackHandle handle);
//*****************************************************************************
//
//! PMBus Target Extended Read/Write Byte/Word State Handler
//!
//! \param handle is the handle to the PMBus stack object
//!
//! This function handles the state in the target state machine that is entered
//! when extended commands are used. These include extended read byte,
//! read word, write byte, and write word transactions.
//!
//! \return None.
//
//*****************************************************************************
extern void
PMBusStack_targetExtendedCommandStateHandler(PMBus_StackHandle handle);
extern void
PMBusStack_targetRxFIFOHandler(PMBus_StackHandle handle);
extern void
PMBusStack_targetTimeoutHandler(PMBus_StackHandle handle);
//*****************************************************************************
//
// Close the Doxygen group.
// @}
//
//*****************************************************************************
//*****************************************************************************
//
// Mark the end of the C bindings section for C++ compilers.
//
//*****************************************************************************
#ifdef __cplusplus
}
#endif // extern "C"
#endif // PMBUS_STACK_HANDLER_H