f2838x_cm_cia402_solution/device/cm.h

86 lines
2.9 KiB
C

//#############################################################################
//
// FILE: cm.h
//
// TITLE: Communication manager setup for examples.
//
//#############################################################################
//
//
// $Copyright:
// Copyright (C) 2022 Texas Instruments Incorporated - http://www.ti.com
//
// $
//#############################################################################
//
// Included Files
//
#include "driverlib_cm.h"
//*****************************************************************************
//
// Defines related to clock configuration. This frequency will be the CM clock
// frequency driven by c28x.
//
//*****************************************************************************
#define CM_CLK_FREQ 125000000U
//*****************************************************************************
//
// Macro to call SysCtl_delay() to achieve a delay in microseconds. The macro
// will convert the desired delay in microseconds to the count value expected
// by the function. \b x is the number of microseconds to delay.
// The SysCtl_delay() function takes around 3 cycles per iteration plus 9
// cycles of overhead which needs to be accounted for when converting the
// microseconds delay into the number of delay loop iterations passed to the
// SysCtl_delay() function.
//
// Note that 3 cycles per iteration is valid if SysCtl_delay function resides
// in CxRAM. SxRAM is 2x slower than CxRAM and hence will consume 6 cycles per
// iteration.
//
//*****************************************************************************
#define DEVICE_DELAY_US(x) SysCtl_delay(((((long double)(x)) / (1000000.0L / \
(long double)CM_CLK_FREQ)) - 9.0L) / 3.0L)
//*****************************************************************************
//
// Defines, Globals, and Header Includes related to Flash Support
//
//*****************************************************************************
#ifdef _FLASH
#include <stddef.h>
extern uint16_t RamfuncsLoadStart;
extern uint16_t RamfuncsLoadEnd;
extern uint16_t RamfuncsLoadSize;
extern uint16_t RamfuncsRunStart;
extern uint16_t RamfuncsRunEnd;
extern uint16_t RamfuncsRunSize;
#define DEVICE_FLASH_WAITSTATES 2
#endif
//*****************************************************************************
//
// Defines for pin numbers and other GPIO configuration
//
//*****************************************************************************
//
// LEDs
//
#define DEVICE_GPIO_PIN_LED1 31U // GPIO number for LD2
#define DEVICE_GPIO_PIN_LED2 34U // GPIO number for LD3
//*****************************************************************************
//
// Function Prototypes
//
//*****************************************************************************
extern void CM_init(void);
extern void CM_enableAllPeripherals(void);
extern void __error__(const char *filename, uint32_t line);