Update repo
This commit is contained in:
1 parent
749dab5721
commit
ce65a0f59a
14950 files changed
+4408250
-1
No files matched your search
+241
@@ -0,0 +1,241 @@
|
||||
//###########################################################################
|
||||
//
|
||||
// FILE: cmbootrom.h
|
||||
//
|
||||
// TITLE: CM BootROM Definitions.
|
||||
//
|
||||
//###########################################################################
|
||||
// $TI Release: $
|
||||
// $Release Date: $
|
||||
//###########################################################################
|
||||
|
||||
#ifndef CM_BOOTROM_H_
|
||||
#define CM_BOOTROM_H_
|
||||
|
||||
//
|
||||
// Included Files
|
||||
//
|
||||
#include <stdint.h>
|
||||
#include "hw_nvic.h"
|
||||
#include "hw_types.h"
|
||||
#include "hw_memmap.h"
|
||||
#include "hw_sysctl.h"
|
||||
#include "hw_nmi.h"
|
||||
#include "sysctl.h"
|
||||
#include "hw_ipc.h"
|
||||
#include "flash.h"
|
||||
|
||||
//
|
||||
// Init Boot Defines
|
||||
//
|
||||
#define CM_SYSCTL_RESC_REG (CMSYSCTL_BASE + SYSCTL_O_CMRESC)
|
||||
|
||||
//
|
||||
// Read IPCBOOTMODE Bit Fields
|
||||
//
|
||||
#define HWREAD_IPCBOOTMODE_BOOTMODE (HWREG(IPC_CMTOCPU1_BASE + IPC_O_CPU1TOCMIPCBOOTMODE) & 0xFFU)
|
||||
#define HWREAD_IPCBOOTMODE_DEVICE_FREQ ((HWREG(IPC_CMTOCPU1_BASE + IPC_O_CPU1TOCMIPCBOOTMODE) & 0xFF00U) >> 0x8U)
|
||||
#define HWREAD_IPCBOOTMODE_COPY_LENGTH ((HWREG(IPC_CMTOCPU1_BASE + IPC_O_CPU1TOCMIPCBOOTMODE) & 0xF0000UL) >> 0x10U)
|
||||
#define HWREAD_IPCBOOTMODE_KEY ((HWREG(IPC_CMTOCPU1_BASE + IPC_O_CPU1TOCMIPCBOOTMODE) & 0xFF000000UL) >> 0x18U)
|
||||
#define IPCBOOTMODE_KEY 0x5AU
|
||||
#define IPCBOOTMODE_COPY_LENGTH_MAX 0xAU //Represents 1000 words
|
||||
#define IPCBOOTMODE_DEVICE_FREQ_MIN 0xAU //Represents 10MHz
|
||||
#define IPCBOOTMODE_DEVICE_FREQ_MAX 0x7DU //Represents 125MHz
|
||||
|
||||
//
|
||||
// CM Boot States
|
||||
//
|
||||
#define CMBROM_READBOOTMODE 0xA5F0U
|
||||
#define CMBROM_WAITFORCOMMAND 0xA5F3U
|
||||
#define CMBROM_RUNBOOTMODE 0xA5FCU
|
||||
#define CMBROM_BRANCHTOAPPLICATION 0xA5F9U
|
||||
|
||||
//
|
||||
// Boot Mode Options
|
||||
//
|
||||
|
||||
//
|
||||
// Wait Boot Option
|
||||
//
|
||||
#define WAIT_FOR_COMMAND 0x0U
|
||||
#define CMBROM_RETURN_TO_WAITFORCOMMAND 0xFFFFFFFFUL
|
||||
|
||||
//
|
||||
// Flash Boot Options
|
||||
//
|
||||
#define FLASH_BOOT 0x03U //Start of BANK 0 Sector 0
|
||||
#define FLASH_BOOT_ALT1 0x23U //Start of BANK 0 Sector 4
|
||||
#define FLASH_BOOT_ALT2 0x43U //Start of BANK 0 Sector 8
|
||||
#define FLASH_BOOT_ALT3 0x63U //Start of BANK 0 Sector 13
|
||||
|
||||
//
|
||||
// RAM Boot Options
|
||||
//
|
||||
#define RAM_BOOT 0x05U //Start of S0 RAM
|
||||
|
||||
//
|
||||
// Secure Flash Boot Options
|
||||
//
|
||||
#define SECURE_FLASH_BOOT 0x0AU //Start of BANK 0 Sector 0
|
||||
#define SECURE_FLASH_BOOT_ALT1 0x2AU //Start of BANK 0 Sector 4
|
||||
#define SECURE_FLASH_BOOT_ALT2 0x4AU //Start of BANK 0 Sector 8
|
||||
#define SECURE_FLASH_BOOT_ALT3 0x6AU //Start of BANK 0 Sector 13
|
||||
#define SECURE_FLASH_BOOT_PASS 0x0U
|
||||
#define SECURE_FLASH_BOOT_FAIL 0xFFFFFFFFUL
|
||||
|
||||
//
|
||||
// User OTP Boot Option
|
||||
//
|
||||
#define USER_OTP_BOOT 0x0BU
|
||||
|
||||
//
|
||||
// CPU1-to-CM IPC Msg Copy to RAM and Boot
|
||||
//
|
||||
#define IPC_MSG_COPY_BOOT 0x0CU //Copies to S0RAM
|
||||
#define IPC_MSG_COPY_BOOT_MIN_LENGTH 0x0U
|
||||
#define IPC_MSG_COPY_BOOT_MAX_LENGTH 0xAU
|
||||
|
||||
//
|
||||
// Fixed Boot Entry Points (Addresses)
|
||||
//
|
||||
|
||||
//
|
||||
// Flash (secure and unsecure) Entry Points
|
||||
//
|
||||
#define FLASH_ENTRY_POINT 0x00200000UL //BANK0 Sector 0
|
||||
#define FLASH_ENTRY_POINT_ALT1 0x00210000UL //BANK0 Sector 4
|
||||
#define FLASH_ENTRY_POINT_ALT2 0x00250000UL //BANK0 sector 8
|
||||
#define FLASH_ENTRY_POINT_ALT3 0x0027C000UL //BANK0 sector 13
|
||||
|
||||
//
|
||||
// S0 RAM Entry Point
|
||||
//
|
||||
#define S0RAM_ENTRY_POINT (S0RAM_BASE + 0x800UL) //S0 start address + 2KB offset to avoid stack
|
||||
|
||||
//
|
||||
// CPU1-to-CM Message RAM 1 Address
|
||||
//
|
||||
#define CPU1_TO_CM_MESSAGE_RAM CPU1TOCMMSGRAM1_BASE
|
||||
|
||||
//
|
||||
// User OTP Entry Point
|
||||
//
|
||||
#define USER_OTP_ENTRY_POINT 0x003C0000UL
|
||||
|
||||
//
|
||||
// CM Boot ROM Boot Status Bit Fields
|
||||
//
|
||||
#define CM_BOOTROM_BOOTSTS_MASK 0x000000FFUL
|
||||
#define CM_BOOTROM_BOOTSTS_SYSTEM_START_BOOT 0x00000001UL
|
||||
#define CM_BOOTROM_BOOTSTS_IN_FLASH_BOOT 0x00000002UL
|
||||
#define CM_BOOTROM_BOOTSTS_IN_SECURE_FLASH_BOOT 0x00000003UL
|
||||
#define CM_BOOTROM_BOOTSTS_IN_IPC_MSG_RAM_BOOT 0x00000004UL
|
||||
#define CM_BOOTROM_BOOTSTS_IN_RAM_BOOT 0x00000005UL
|
||||
#define CM_BOOTROM_BOOTSTS_IN_OTP_BOOT 0x00000006UL
|
||||
#define CM_BOOTROM_BOOTSTS_IN_WAIT_BOOT 0x00000007UL
|
||||
#define CM_BOOTROM_BOOTSTS_WAITING_FOR_FLAG 0x00000008UL
|
||||
|
||||
//
|
||||
// CM Boot ROM Health Status Bit Fields
|
||||
//
|
||||
#define CM_BOOTROM_HEALTH_STATUS_MASK 0xFFFFFF00UL
|
||||
#define CM_BOOTROM_RESC_HANDLED 0x00001000UL
|
||||
#define CM_BOOTROM_HANDLED_POR 0x00004000UL
|
||||
|
||||
#define CM_BOOTROM_RAM_INIT_COMPLETE 0x00020000UL
|
||||
#define CM_BOOTROM_GOT_AN_INVALID_IPC_BOOT_VALUE 0x00040000UL
|
||||
#define CM_BOOTROM_MSG_RAM_COPY_LENGTH_INVALID 0x00080000UL
|
||||
|
||||
#define CM_BOOTROM_FAILED_SECURE_FLASH_CMAC 0x00200000UL
|
||||
#define CM_BOOTROM_GOT_UNASSIGNED_INTERRUPT 0x00400000UL
|
||||
#define CM_BOOTROM_GOT_HARD_FAULT 0x00800000UL
|
||||
|
||||
#define CM_BOOTROM_GOT_A_ECAT_NMI 0x02000000UL
|
||||
#define CM_BOOTROM_GOT_A_WWD_NMI 0x04000000UL
|
||||
#define CM_BOOTROM_GOT_A_MCAN_UNCERR_NMI 0x08000000UL
|
||||
#define CM_BOOTROM_GOT_A_FLASH_UNCERR_NMI 0x10000000UL
|
||||
#define CM_BOOTROM_GOT_A_RAM_UNCERR_NMI 0x20000000UL
|
||||
#define CM_BOOTROM_GOT_A_MCLK_NMI 0x40000000UL
|
||||
|
||||
#define CM_BOOTROM_BOOT_COMPLETE 0x80000000UL
|
||||
|
||||
//
|
||||
// CM to CPU1 Error IPC Commands
|
||||
//
|
||||
#define CMTOCPU1_BOOTROM_COMMAND_ILLEGAL 0x00000000UL
|
||||
#define CMTOCPU1_BOOTROM_BOOT_CMD_INVALID 0xFFFFFFFFUL
|
||||
#define CMTOCPU1_BOOTROM_HARD_FAULT 0xFFFFFFFEUL
|
||||
#define CMTOCPU1_BOOTROM_UNASSIGNED_INTERRUPT 0xFFFFFFFBUL
|
||||
#define CMTOCPU1_BOOTROM_NMI 0xFFFFFFFAUL
|
||||
#define CMTOCPU1_BOOTROM_FAILED_CMAC 0xFFFFFFF9UL
|
||||
|
||||
//
|
||||
// Boot Escape/Patch Point OTP Addresses
|
||||
//
|
||||
#define OTP_BOOT_ESCAPE_TABLE_END 0x3807D8UL
|
||||
|
||||
#define CMBROM_TI_OTP_ESCAPE_POINT_15 (HWREG((OTP_BOOT_ESCAPE_TABLE_END)-56))
|
||||
#define CMBROM_TI_OTP_ESCAPE_POINT_14 (HWREG((OTP_BOOT_ESCAPE_TABLE_END)-52))
|
||||
#define CMBROM_TI_OTP_ESCAPE_POINT_13 (HWREG((OTP_BOOT_ESCAPE_TABLE_END)-48))
|
||||
#define CMBROM_TI_OTP_ESCAPE_POINT_12 (HWREG((OTP_BOOT_ESCAPE_TABLE_END)-44))
|
||||
#define CMBROM_TI_OTP_ESCAPE_POINT_11 (HWREG((OTP_BOOT_ESCAPE_TABLE_END)-40))
|
||||
#define CMBROM_TI_OTP_ESCAPE_POINT_10 (HWREG((OTP_BOOT_ESCAPE_TABLE_END)-36))
|
||||
#define CMBROM_TI_OTP_ESCAPE_POINT_9 (HWREG((OTP_BOOT_ESCAPE_TABLE_END)-32))
|
||||
#define CMBROM_TI_OTP_ESCAPE_POINT_8 (HWREG((OTP_BOOT_ESCAPE_TABLE_END)-28))
|
||||
#define CMBROM_TI_OTP_ESCAPE_POINT_7 (HWREG((OTP_BOOT_ESCAPE_TABLE_END)-24))
|
||||
#define CMBROM_TI_OTP_ESCAPE_POINT_6 (HWREG((OTP_BOOT_ESCAPE_TABLE_END)-20))
|
||||
#define CMBROM_TI_OTP_ESCAPE_POINT_5 (HWREG((OTP_BOOT_ESCAPE_TABLE_END)-16))
|
||||
#define CMBROM_TI_OTP_ESCAPE_POINT_4 (HWREG((OTP_BOOT_ESCAPE_TABLE_END)-12))
|
||||
#define CMBROM_TI_OTP_ESCAPE_POINT_3 (HWREG((OTP_BOOT_ESCAPE_TABLE_END)-8))
|
||||
#define CMBROM_TI_OTP_ESCAPE_POINT_2 (HWREG((OTP_BOOT_ESCAPE_TABLE_END)-4))
|
||||
#define CMBROM_TI_OTP_ESCAPE_POINT_1 (HWREG((OTP_BOOT_ESCAPE_TABLE_END)-0))
|
||||
|
||||
//
|
||||
// Flash Configuration
|
||||
//
|
||||
#define CM_FLASH_PSLEEP_25MHZ_TIMEOUT_VALUE 73U //Loop = ~24 cycles @ 25MHz (Loop timeout value = (70us * freq)/28)
|
||||
#define CM_FLASH_PSLEEP_50MHZ_TIMEOUT_VALUE 104U //Loop = ~24 cycles @ 50MHz (Loop timeout value = (50us * freq)/28)
|
||||
#define CM_FLASH_PSLEEP_100MHZ_TIMEOUT_VALUE 208U //Loop = ~24 cycles @ 100MHz(Loop timeout value = (50us * freq)/28)
|
||||
#define CM_FLASH_PSLEEP_125MHZ_TIMEOUT_VALUE 260U //Loop = ~24 cycles @ 125MHz(Loop timeout value = (50us * freq)/28)
|
||||
#define CM_FLASH_PSLEEP_25MHZ_VALUE (0x138U * 2U)
|
||||
#define CM_FLASH_PSLEEP_50MHZ_VALUE (0x271U * 2U)
|
||||
#define CM_FLASH_PSLEEP_100MHZ_VALUE (0x4E2U * 2U)
|
||||
#define CM_FLASH_PSLEEP_125MHZ_VALUE (0x61AU * 2U)
|
||||
#define CM_FLASH_DEFAULT_PSLEEP (0x61AU * 2U)
|
||||
#define CM_FLASH_DEFAULT_RWAIT 0x2U
|
||||
|
||||
//
|
||||
// Misc
|
||||
//
|
||||
#define CM_IPC_SUCCESS 0x0U
|
||||
#define CM_IPC_FAILURE 0x1U
|
||||
#define CM_NO_IPC_MSG 0x0U
|
||||
#define NO_ADDRESS_DATA 0x0U
|
||||
#define CM_NMI_CLEAR_KEY 0x56740000UL
|
||||
#define CM_NMI_ENABLE_KEY 0x67890000UL
|
||||
|
||||
//
|
||||
// Function prototypes
|
||||
//
|
||||
extern __interrupt void CMBROM_nmiHandler(void);
|
||||
extern __interrupt void CMBROM_hardFaultISR(void);
|
||||
extern __interrupt void CMBROM_defaultHandler(void);
|
||||
extern void CMBROM_verifyBootCommand(void);
|
||||
extern void CMBROM_setupDeviceSystems(void);
|
||||
|
||||
extern uint32_t CMBROM_startSystemBoot(void);
|
||||
extern uint16_t CMBROM_selectBootMode(void);
|
||||
extern void CMBROM_performCopyToRAM(uint32_t entryAddress, uint16_t copyLength);
|
||||
|
||||
extern uint32_t CMBROM_sendErrorIPC(uint32_t errorCommand, uint32_t address);
|
||||
extern void CMBROM_setIPCBootStatus(void);
|
||||
|
||||
extern uint32_t CMBROM_calculateCMAC(volatile uint32_t startAddress,
|
||||
volatile uint32_t endAddress,
|
||||
volatile uint32_t signatureAddress);
|
||||
|
||||
#endif //CM_BOOTROM_H_
|
||||
|
||||
//
|
||||
// End of file
|
||||
//
|
||||
+752
@@ -0,0 +1,752 @@
|
||||
//###########################################################################
|
||||
//
|
||||
// FILE: cmbrom_checksum.c
|
||||
//
|
||||
// TITLE: CM boot ROM checksum calculation
|
||||
//
|
||||
// Calculate and verify the boot ROM checksum against the calculated checksum
|
||||
// as calculated during development
|
||||
//
|
||||
//###########################################################################
|
||||
// $TI Release: $
|
||||
// $Release Date: $
|
||||
//###########################################################################
|
||||
|
||||
//
|
||||
// Included Files
|
||||
//
|
||||
#include "cmbootrom.h"
|
||||
|
||||
//
|
||||
// Globals
|
||||
//
|
||||
|
||||
//
|
||||
// Struct to configure memory blocks to be included in the checksum
|
||||
//
|
||||
typedef struct {
|
||||
unsigned long firstAddr;
|
||||
unsigned long lastAddr;
|
||||
unsigned short mem_attribute;
|
||||
} memblock;
|
||||
|
||||
//
|
||||
// Use 4 32-bit values to represent the 64-bit checksum.
|
||||
// This is done such that overflow can be monitored at
|
||||
// each step in the summation. If overflow from the lower
|
||||
// 16-bits occurs, then the overflow is added to the next
|
||||
// significant word.
|
||||
//
|
||||
typedef struct {
|
||||
unsigned long highHalfMSW;
|
||||
unsigned long highHalfLSW;
|
||||
unsigned long lowHalfMSW;
|
||||
unsigned long lowHalfLSW;
|
||||
} ui64;
|
||||
|
||||
//
|
||||
// Struct to store checksum calculation data
|
||||
//
|
||||
typedef struct checksum_data
|
||||
{
|
||||
unsigned long total_ones;
|
||||
unsigned long bit_column_cksum[8][3];
|
||||
ui64 row_weight_sum;
|
||||
ui64 fact_weight_sum;
|
||||
}composite_checksum_t;
|
||||
|
||||
//
|
||||
// Boot ROM checksum calculation
|
||||
//
|
||||
#pragma DATA_SECTION(boot_csum_rom, ".BOOT_CKSUMLOC");
|
||||
const composite_checksum_t boot_csum_rom = {
|
||||
0x000056B9UL, //total_ones
|
||||
0x000082F6UL, 0x00000053UL, 0x00000000UL, //bit_column_cksum[0][3];
|
||||
0x00009509UL, 0x0000004EUL, 0x00000000UL, //bit_column_cksum[1][3];
|
||||
0x0000BC47UL, 0x00000045UL, 0x00000000UL, //bit_column_cksum[2][3];
|
||||
0x0000E66AUL, 0x0000005AUL, 0x00000000UL, //bit_column_cksum[3][3];
|
||||
0x0000DD37UL, 0x0000005FUL, 0x00000000UL, //bit_column_cksum[4][3];
|
||||
0x00002C78UL, 0x0000005EUL, 0x00000000UL, //bit_column_cksum[5][3];
|
||||
0x00002401UL, 0x0000006DUL, 0x00000000UL, //bit_column_cksum[6][3];
|
||||
0x000069B6UL, 0x00000064UL, 0x00000000UL, //bit_column_cksum[7][3];
|
||||
0x00000000UL, 0x00000000UL, 0x00001691UL, 0x00001E2BUL, //row_weight_sum
|
||||
0x00000000UL, 0x00000029UL, 0x000080E9UL, 0x00000928U //fact_weight_sum
|
||||
};
|
||||
|
||||
//
|
||||
// Complete ROM checksum calculation
|
||||
//
|
||||
#pragma DATA_SECTION(composite_checksum_in_rom, ".CKSUMLOC");
|
||||
const composite_checksum_t composite_checksum_in_rom = {
|
||||
0x000AB504UL, //total_ones
|
||||
0x0000F5D4UL, 0x00008033UL, 0x00000000UL, //bit_column_cksum[0][3];
|
||||
0x000004E3UL, 0x00007F56UL, 0x00000000UL, //bit_column_cksum[1][3];
|
||||
0x00006D4AUL, 0x00007F84UL, 0x00000000UL, //bit_column_cksum[2][3];
|
||||
0x000086BEUL, 0x00008123UL, 0x00000000UL, //bit_column_cksum[3][3];
|
||||
0x0000A1BAUL, 0x000082ECUL, 0x00000000UL, //bit_column_cksum[4][3];
|
||||
0x00009B0FUL, 0x00008216UL, 0x00000000UL, //bit_column_cksum[5][3];
|
||||
0x000091C7UL, 0x000081D0UL, 0x00000000UL, //bit_column_cksum[6][3];
|
||||
0x00000F31UL, 0x0000824DUL, 0x00000000UL, //bit_column_cksum[7][3];
|
||||
0x00000000UL, 0x00000020UL, 0x00004A66UL,0x00006473UL, //row_weight_sum
|
||||
0x00000000UL, 0x00000C76UL, 0x00000F76UL,0x000093B1UL //fact_weight_sum
|
||||
};
|
||||
|
||||
#pragma CODE_SECTION(verify_checksum_onROM, ".checksumfuncs");
|
||||
unsigned short verify_checksum_onROM(void);
|
||||
|
||||
#pragma CODE_SECTION(calculate_composite_checksum_on_rom, ".checksumfuncs");
|
||||
unsigned short calculate_composite_checksum_on_rom(composite_checksum_t *cksum, memblock *mblock, unsigned int total_mblocks);
|
||||
|
||||
#pragma CODE_SECTION(add_to_factorial_sum, ".checksumfuncs");
|
||||
void add_to_factorial_sum(unsigned long fact_weight, composite_checksum_t *cksum);
|
||||
|
||||
#pragma CODE_SECTION(add_to_row_weight_sum, ".checksumfuncs");
|
||||
void add_to_row_weight_sum(unsigned long ones_weight, composite_checksum_t *cksum);
|
||||
|
||||
#pragma CODE_SECTION(add_to_bitcolumn_checksum, ".checksumfuncs");
|
||||
unsigned long add_to_bitcolumn_checksum(unsigned long bitcolumn, unsigned long bit_weight, composite_checksum_t *cksum);
|
||||
|
||||
#pragma CODE_SECTION(compare_two_composite_checksums, ".checksumfuncs");
|
||||
unsigned short compare_two_composite_checksums(const composite_checksum_t *goldsum, composite_checksum_t *compsum);
|
||||
|
||||
#pragma CODE_SECTION(calculate_checksum, ".checksumfuncs");
|
||||
unsigned long calculate_checksum(unsigned long start, unsigned long end, unsigned long offset, composite_checksum_t *cksum);
|
||||
|
||||
#pragma CODE_SECTION(test_reserved_memory, ".checksumfuncs");
|
||||
unsigned short test_reserved_memory(unsigned long start, unsigned long end);
|
||||
|
||||
//
|
||||
// test_reserved_memory - Verify that reserved memory is all 1's, else
|
||||
// return error.
|
||||
//
|
||||
unsigned short test_reserved_memory(unsigned long start, unsigned long end)
|
||||
{
|
||||
//
|
||||
// Read addresses for specified range and check value
|
||||
//
|
||||
while(start <= end)
|
||||
{
|
||||
if(* (volatile unsigned short *)start != (unsigned long)0xFFFFUL)
|
||||
{
|
||||
return 0xFFFFU; //error
|
||||
}
|
||||
start +=2U;
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
//
|
||||
// This main function performs a very simple 64 bit checksum routine.
|
||||
// 4 32-bit values are used to calculate the checksum. This is done so that
|
||||
// no overflow is lost. After each addition, the value is checked to see if
|
||||
// it has overflowed the lower 16-bits. If it has, then the overflow portion
|
||||
// in the upper 16-bits is added to the next most significant portion of the
|
||||
// checksum.
|
||||
//
|
||||
// When the routine completes, the upper 16-bits of each portion of the checksum
|
||||
// will be 0x000 - this portion should be discarded as it was only used to check
|
||||
// for overflow and the checksum is then formed from the lower 16-bits.
|
||||
//
|
||||
// For example:
|
||||
// lowHalfLSW = 0x00001111
|
||||
// lowHalfMSW = 0x00002222
|
||||
// highHalfLSW = 0x00003333
|
||||
// highHalfMSW = 0x00004444
|
||||
//
|
||||
// would result in a 64-bit checksum of 0x44443333 22221111
|
||||
//
|
||||
unsigned short calculate_composite_checksum_on_rom(composite_checksum_t *cksum,
|
||||
memblock *mblock,
|
||||
unsigned int total_mblocks)
|
||||
{
|
||||
unsigned short i;
|
||||
unsigned long offset = 0U;
|
||||
memblock *lmblock = (void *)0U;
|
||||
unsigned short result = 0U;
|
||||
|
||||
cksum->row_weight_sum.highHalfMSW = 0U;
|
||||
cksum->row_weight_sum.highHalfLSW = 0U;
|
||||
cksum->row_weight_sum.lowHalfLSW = 0U;
|
||||
cksum->row_weight_sum.lowHalfMSW = 0U;
|
||||
|
||||
cksum->fact_weight_sum.highHalfMSW = 0U;
|
||||
cksum->fact_weight_sum.highHalfLSW = 0U;
|
||||
cksum->fact_weight_sum.lowHalfLSW = 0U;
|
||||
cksum->fact_weight_sum.lowHalfMSW = 0U;
|
||||
|
||||
cksum->total_ones = 0U;
|
||||
|
||||
cksum->bit_column_cksum[0][0] = 0U;
|
||||
cksum->bit_column_cksum[1][0] = 0U;
|
||||
cksum->bit_column_cksum[2][0] = 0U;
|
||||
cksum->bit_column_cksum[3][0] = 0U;
|
||||
cksum->bit_column_cksum[4][0] = 0U;
|
||||
cksum->bit_column_cksum[5][0] = 0U;
|
||||
cksum->bit_column_cksum[6][0] = 0U;
|
||||
cksum->bit_column_cksum[7][0] = 0U;
|
||||
|
||||
cksum->bit_column_cksum[0][1] = 0U;
|
||||
cksum->bit_column_cksum[1][1] = 0U;
|
||||
cksum->bit_column_cksum[2][1] = 0U;
|
||||
cksum->bit_column_cksum[3][1] = 0U;
|
||||
cksum->bit_column_cksum[4][1] = 0U;
|
||||
cksum->bit_column_cksum[5][1] = 0U;
|
||||
cksum->bit_column_cksum[6][1] = 0U;
|
||||
cksum->bit_column_cksum[7][1] = 0U;
|
||||
|
||||
cksum->bit_column_cksum[0][2] = 0U;
|
||||
cksum->bit_column_cksum[1][2] = 0U;
|
||||
cksum->bit_column_cksum[2][2] = 0U;
|
||||
cksum->bit_column_cksum[3][2] = 0U;
|
||||
cksum->bit_column_cksum[4][2] = 0U;
|
||||
cksum->bit_column_cksum[5][2] = 0U;
|
||||
cksum->bit_column_cksum[6][2] = 0U;
|
||||
cksum->bit_column_cksum[7][2] = 0U;
|
||||
|
||||
for(i = 0U; i < total_mblocks; i++)
|
||||
{
|
||||
lmblock = (memblock *)(&mblock[i]);
|
||||
|
||||
if(lmblock->mem_attribute == 0U)
|
||||
{
|
||||
result = test_reserved_memory((unsigned long)(lmblock->firstAddr),
|
||||
(unsigned long)(lmblock->lastAddr));
|
||||
|
||||
if(result == 0xFFFFU)
|
||||
{
|
||||
return 0xFFFFU;
|
||||
}
|
||||
}
|
||||
else if(lmblock->mem_attribute == 1U)
|
||||
{
|
||||
offset = calculate_checksum((unsigned long)(lmblock->firstAddr),
|
||||
(unsigned long)(lmblock->lastAddr),
|
||||
offset, cksum);
|
||||
}
|
||||
else
|
||||
{
|
||||
// Do nothing
|
||||
}
|
||||
}
|
||||
|
||||
return 0U;
|
||||
}
|
||||
|
||||
//
|
||||
// add_to_factorial_sum - Perform a factorial summation on the checksum and
|
||||
// handle any overflow
|
||||
//
|
||||
void add_to_factorial_sum(unsigned long fact_weight, composite_checksum_t *cksum)
|
||||
{
|
||||
// Add in LSW
|
||||
cksum->fact_weight_sum.lowHalfLSW += (fact_weight & (unsigned long)0x0000FFFFUL);
|
||||
|
||||
// Check for overflow
|
||||
if(cksum->fact_weight_sum.lowHalfLSW >= (unsigned long)0x0000FFFFUL)
|
||||
{
|
||||
cksum->fact_weight_sum.lowHalfMSW += cksum->fact_weight_sum.lowHalfLSW >> 16;
|
||||
cksum->fact_weight_sum.lowHalfLSW &= (unsigned long)0x0000FFFFUL;
|
||||
}
|
||||
|
||||
if(cksum->fact_weight_sum.lowHalfMSW >= (unsigned long)0x0000FFFFUL)
|
||||
{
|
||||
cksum->fact_weight_sum.highHalfLSW += cksum->fact_weight_sum.lowHalfMSW >> 16;
|
||||
cksum->fact_weight_sum.lowHalfMSW &= (unsigned long)0x0000FFFFUL;
|
||||
}
|
||||
|
||||
if(cksum->fact_weight_sum.highHalfLSW >= (unsigned long)0x0000FFFFUL)
|
||||
{
|
||||
cksum->fact_weight_sum.highHalfMSW += cksum->fact_weight_sum.lowHalfLSW >> 16;
|
||||
cksum->fact_weight_sum.highHalfLSW &= (unsigned long)0x0000FFFFUL;
|
||||
}
|
||||
|
||||
// Add in MSW
|
||||
cksum->fact_weight_sum.lowHalfMSW += (fact_weight >> 16);
|
||||
// Check for overflow
|
||||
if(cksum->fact_weight_sum.lowHalfMSW >= (unsigned long)0x0000FFFFUL)
|
||||
{
|
||||
cksum->fact_weight_sum.highHalfLSW += cksum->fact_weight_sum.lowHalfMSW >> 16;
|
||||
cksum->fact_weight_sum.lowHalfMSW &= (unsigned long)0x0000FFFFUL;
|
||||
}
|
||||
|
||||
if(cksum->fact_weight_sum.highHalfLSW >= (unsigned long)0x0000FFFFUL)
|
||||
{
|
||||
cksum->fact_weight_sum.highHalfMSW += cksum->fact_weight_sum.lowHalfLSW >> 16;
|
||||
cksum->fact_weight_sum.highHalfLSW &= (unsigned long)0x0000FFFFUL;
|
||||
}
|
||||
}
|
||||
|
||||
//
|
||||
// add_to_row_weight_sum - Perform sum on checksum row weight and handle any
|
||||
// overflow
|
||||
//
|
||||
void add_to_row_weight_sum(unsigned long ones_weight, composite_checksum_t *cksum)
|
||||
{
|
||||
// Add in LSW
|
||||
cksum->row_weight_sum.lowHalfLSW += (ones_weight & (unsigned long)0x0000FFFFUL);
|
||||
|
||||
// Check for overflow
|
||||
if(cksum->row_weight_sum.lowHalfLSW >= (unsigned long)0x0000FFFFUL)
|
||||
{
|
||||
cksum->row_weight_sum.lowHalfMSW += cksum->row_weight_sum.lowHalfLSW >> 16;
|
||||
cksum->row_weight_sum.lowHalfLSW &= (unsigned long)0x0000FFFFUL;
|
||||
}
|
||||
|
||||
if(cksum->row_weight_sum.lowHalfMSW >= (unsigned long)0x0000FFFFUL)
|
||||
{
|
||||
cksum->row_weight_sum.highHalfLSW += cksum->row_weight_sum.lowHalfMSW >> 16;
|
||||
cksum->row_weight_sum.lowHalfMSW &= (unsigned long)0x0000FFFFUL;
|
||||
}
|
||||
|
||||
if(cksum->row_weight_sum.highHalfLSW >= (unsigned long)0x0000FFFFUL)
|
||||
{
|
||||
cksum->row_weight_sum.highHalfMSW += cksum->row_weight_sum.lowHalfLSW >> 16;
|
||||
cksum->row_weight_sum.highHalfLSW &= (unsigned long)0x0000FFFFUL;
|
||||
}
|
||||
|
||||
// Add in MSW
|
||||
cksum->row_weight_sum.lowHalfMSW += (ones_weight >> 16);
|
||||
// Check for overflow
|
||||
if(cksum->row_weight_sum.lowHalfMSW >= (unsigned long)0x0000FFFFUL)
|
||||
{
|
||||
cksum->row_weight_sum.highHalfLSW += cksum->row_weight_sum.lowHalfMSW >> 16;
|
||||
cksum->row_weight_sum.lowHalfMSW &= (unsigned long)0x0000FFFFUL;
|
||||
}
|
||||
|
||||
if(cksum->row_weight_sum.highHalfLSW >= (unsigned long)0x0000FFFFUL)
|
||||
{
|
||||
cksum->row_weight_sum.highHalfMSW += cksum->row_weight_sum.lowHalfLSW >> 16;
|
||||
cksum->row_weight_sum.highHalfLSW &= (unsigned long)0x0000FFFFUL;
|
||||
}
|
||||
}
|
||||
|
||||
//
|
||||
// add_to_bitcolumn_checksum - Perform a bit column sum. Returns ones weight of
|
||||
// the bit just added.
|
||||
// ones weight = 8*(bitweight-1)+bitcolumn.
|
||||
//
|
||||
unsigned long add_to_bitcolumn_checksum(unsigned long bitcolumn, unsigned long bit_weight,
|
||||
composite_checksum_t *cksum)
|
||||
{
|
||||
// Add in LSW
|
||||
cksum->bit_column_cksum[bitcolumn][0] += (bit_weight & (unsigned long)0x0000FFFFUL);
|
||||
|
||||
// Check for overflow
|
||||
if(cksum->bit_column_cksum[bitcolumn][0] >= (unsigned long)0x0000FFFFUL)
|
||||
{
|
||||
cksum->bit_column_cksum[bitcolumn][1] += cksum->bit_column_cksum[bitcolumn][0] >> 16;
|
||||
cksum->bit_column_cksum[bitcolumn][0] &= (unsigned long)0x0000FFFFUL;
|
||||
}
|
||||
|
||||
if(cksum->bit_column_cksum[bitcolumn][1] >= (unsigned long)0x0000FFFFUL)
|
||||
{
|
||||
cksum->bit_column_cksum[bitcolumn][2] += cksum->bit_column_cksum[bitcolumn][1] >> 16;
|
||||
cksum->bit_column_cksum[bitcolumn][1] &= (unsigned long)0x0000FFFFUL;
|
||||
}
|
||||
|
||||
// Add in MSW
|
||||
cksum->bit_column_cksum[bitcolumn][1] += (bit_weight >> 16);
|
||||
// Check for overflow
|
||||
if(cksum->bit_column_cksum[bitcolumn][1] >= (unsigned long)0x0000FFFFUL)
|
||||
{
|
||||
cksum->bit_column_cksum[bitcolumn][2] += cksum->bit_column_cksum[bitcolumn][1] >> 16;
|
||||
cksum->bit_column_cksum[bitcolumn][1] &= (unsigned long)0x0000FFFFUL;
|
||||
}
|
||||
|
||||
return((unsigned long)((8U*(bit_weight-1)) + bitcolumn));
|
||||
}
|
||||
|
||||
//
|
||||
// calculate_checksum - Main checksum algorithm
|
||||
//
|
||||
unsigned long calculate_checksum(unsigned long start, unsigned long end, unsigned long offset,
|
||||
composite_checksum_t *cksum)
|
||||
{
|
||||
unsigned short data = 0x0000U;
|
||||
unsigned short byte_value = 0U;
|
||||
unsigned short byte_count = 0U;
|
||||
unsigned long byte_offset = 0UL;
|
||||
unsigned long ones_weight = 0UL;
|
||||
unsigned long ones_fact_weight = 0UL;
|
||||
unsigned long nibble_count = 0UL;
|
||||
unsigned int nibble_offset = 0U;
|
||||
|
||||
while(start <= end)
|
||||
{
|
||||
data = *(volatile unsigned short *)start; //pointer to a 16 bit value
|
||||
start += 2U;
|
||||
|
||||
//
|
||||
// Each offset has 2 bytes of data on C28x CPUs
|
||||
//
|
||||
for(byte_count = 1U; byte_count < 3U; byte_count++)
|
||||
{
|
||||
byte_offset = byte_count+(offset);
|
||||
ones_fact_weight = 1U;
|
||||
|
||||
//
|
||||
// Get the byte from word
|
||||
//
|
||||
byte_value = (data & (0xFFU));
|
||||
data = (data >> 8);
|
||||
ones_weight = 0U;
|
||||
|
||||
//
|
||||
// Separate the byte into two nibbles
|
||||
//
|
||||
for(nibble_offset = 0U; nibble_offset <= 4U; nibble_offset+=4U)
|
||||
{
|
||||
nibble_count+=1U;;
|
||||
|
||||
if((byte_value & 0xFU) == 0U)
|
||||
{
|
||||
; // Do nothing
|
||||
}
|
||||
else if((byte_value & 0xFU) == 1U)
|
||||
{
|
||||
cksum->total_ones += 1U;
|
||||
ones_weight += add_to_bitcolumn_checksum((unsigned int)0U + nibble_offset,
|
||||
byte_offset, cksum);
|
||||
ones_fact_weight = (nibble_count - 1U)*(nibble_count + 1U);
|
||||
}
|
||||
else if((byte_value & 0xFU) == 2U)
|
||||
{
|
||||
cksum->total_ones += 1U;
|
||||
ones_weight += add_to_bitcolumn_checksum((unsigned int)1U + nibble_offset,
|
||||
byte_offset, cksum);
|
||||
ones_fact_weight = (nibble_count - 1U)*(nibble_count + 2U) ;
|
||||
}
|
||||
else if((byte_value & 0xFU) == 3U)
|
||||
{
|
||||
cksum->total_ones += 2U;
|
||||
ones_weight += add_to_bitcolumn_checksum((unsigned int)0U + nibble_offset,
|
||||
byte_offset, cksum);
|
||||
ones_weight += add_to_bitcolumn_checksum((unsigned int)1U + nibble_offset,
|
||||
byte_offset, cksum);
|
||||
|
||||
ones_fact_weight = ones_fact_weight *(nibble_count + 1U);
|
||||
ones_fact_weight = ones_fact_weight *((nibble_count%2U) + 2U);
|
||||
}
|
||||
else if((byte_value & 0xFU) == 4U)
|
||||
{
|
||||
cksum->total_ones += 1U;
|
||||
ones_weight += add_to_bitcolumn_checksum((unsigned int)2U + nibble_offset,
|
||||
byte_offset, cksum);
|
||||
|
||||
ones_fact_weight = (nibble_count - 1U)*(nibble_count + 3U);
|
||||
|
||||
}
|
||||
else if((byte_value & 0xFU) == 5U)
|
||||
{
|
||||
cksum->total_ones += 2U;
|
||||
ones_weight += add_to_bitcolumn_checksum((unsigned int)0U + nibble_offset,
|
||||
byte_offset, cksum);
|
||||
ones_weight += add_to_bitcolumn_checksum((unsigned int)2U + nibble_offset,
|
||||
byte_offset, cksum);
|
||||
|
||||
ones_fact_weight = ones_fact_weight *(nibble_count + 1U);
|
||||
ones_fact_weight = ones_fact_weight *((nibble_count%2U) + 3U);
|
||||
}
|
||||
else if((byte_value & 0xFU) == 6U)
|
||||
{
|
||||
cksum->total_ones += 2U;
|
||||
ones_weight += add_to_bitcolumn_checksum((unsigned int)1U + nibble_offset,
|
||||
byte_offset, cksum);
|
||||
ones_weight += add_to_bitcolumn_checksum((unsigned int)2U + nibble_offset,
|
||||
byte_offset, cksum);
|
||||
|
||||
ones_fact_weight = ones_fact_weight *(nibble_count + 2U);
|
||||
ones_fact_weight = ones_fact_weight *((nibble_count%2U) + 3U);
|
||||
}
|
||||
else if((byte_value & 0xFU) == 7U)
|
||||
{
|
||||
cksum->total_ones += 3U;
|
||||
ones_weight += add_to_bitcolumn_checksum((unsigned int)0U + nibble_offset,
|
||||
byte_offset, cksum);
|
||||
ones_weight += add_to_bitcolumn_checksum((unsigned int)1U + nibble_offset,
|
||||
byte_offset, cksum);
|
||||
ones_weight += add_to_bitcolumn_checksum((unsigned int)2U + nibble_offset,
|
||||
byte_offset, cksum);
|
||||
|
||||
ones_fact_weight = ones_fact_weight * (nibble_count + 1U);
|
||||
ones_fact_weight = ones_fact_weight * ((nibble_count%2U) + 2U);
|
||||
ones_fact_weight = ones_fact_weight * ((nibble_count%2U) + 3U);
|
||||
}
|
||||
else if((byte_value & 0xFU) == 8U)
|
||||
{
|
||||
cksum->total_ones += 1U;
|
||||
ones_weight += add_to_bitcolumn_checksum((unsigned int)3U + nibble_offset,
|
||||
byte_offset, cksum);
|
||||
|
||||
ones_fact_weight = (nibble_count - 1U) * (nibble_count + 4U);
|
||||
}
|
||||
else if((byte_value & 0xFU) == 9U)
|
||||
{
|
||||
cksum->total_ones += 2U;
|
||||
ones_weight += add_to_bitcolumn_checksum((unsigned int)0U + nibble_offset,
|
||||
byte_offset, cksum);
|
||||
ones_weight += add_to_bitcolumn_checksum((unsigned int)3U + nibble_offset,
|
||||
byte_offset, cksum);
|
||||
|
||||
ones_fact_weight = ones_fact_weight * (nibble_count + 1U);
|
||||
ones_fact_weight = ones_fact_weight * ((nibble_count%2U) + 4U);
|
||||
}
|
||||
else if((byte_value & 0xFU) == 10U)
|
||||
{
|
||||
cksum->total_ones += 2U;
|
||||
ones_weight += add_to_bitcolumn_checksum((unsigned int)1U + nibble_offset,
|
||||
byte_offset, cksum);
|
||||
ones_weight += add_to_bitcolumn_checksum((unsigned int)3U + nibble_offset,
|
||||
byte_offset, cksum);
|
||||
|
||||
ones_fact_weight = ones_fact_weight * (nibble_count + 2U);
|
||||
ones_fact_weight = ones_fact_weight * ((nibble_count%2U) + 4U);
|
||||
}
|
||||
else if((byte_value & 0xFU) == 11U)
|
||||
{
|
||||
cksum->total_ones += 3U;
|
||||
ones_weight += add_to_bitcolumn_checksum((unsigned int)0U + nibble_offset,
|
||||
byte_offset, cksum);
|
||||
ones_weight += add_to_bitcolumn_checksum((unsigned int)1U + nibble_offset,
|
||||
byte_offset, cksum);
|
||||
ones_weight += add_to_bitcolumn_checksum((unsigned int)3U + nibble_offset,
|
||||
byte_offset, cksum);
|
||||
|
||||
ones_fact_weight = ones_fact_weight * (nibble_count + 1U);
|
||||
ones_fact_weight = ones_fact_weight * ((nibble_count%2U) + 2U);
|
||||
ones_fact_weight = ones_fact_weight * ((nibble_count%2U) + 4U);
|
||||
}
|
||||
else if((byte_value & 0xFU) == 12U)
|
||||
{
|
||||
cksum->total_ones += 2U;
|
||||
ones_weight += add_to_bitcolumn_checksum((unsigned int)2U + nibble_offset,
|
||||
byte_offset, cksum);
|
||||
ones_weight += add_to_bitcolumn_checksum((unsigned int)3U + nibble_offset,
|
||||
byte_offset, cksum);
|
||||
|
||||
ones_fact_weight = ones_fact_weight * (nibble_count + 3U);
|
||||
ones_fact_weight = ones_fact_weight * ((nibble_count%2U) + 4U);
|
||||
}
|
||||
else if((byte_value & 0xFU) == 13U)
|
||||
{
|
||||
cksum->total_ones += 3U;
|
||||
ones_weight += add_to_bitcolumn_checksum((unsigned int)0U + nibble_offset,
|
||||
byte_offset, cksum);
|
||||
ones_weight += add_to_bitcolumn_checksum((unsigned int)2U + nibble_offset,
|
||||
byte_offset, cksum);
|
||||
ones_weight += add_to_bitcolumn_checksum((unsigned int)3U + nibble_offset,
|
||||
byte_offset, cksum);
|
||||
|
||||
ones_fact_weight = ones_fact_weight * (nibble_count + 1U);
|
||||
ones_fact_weight = ones_fact_weight * ((nibble_count%2U) + 3U);
|
||||
ones_fact_weight = ones_fact_weight * ((nibble_count%2U) + 4U);
|
||||
}
|
||||
else if((byte_value & 0xFU) == 14U)
|
||||
{
|
||||
cksum->total_ones += 3U;
|
||||
ones_weight += add_to_bitcolumn_checksum((unsigned int)1U + nibble_offset,
|
||||
byte_offset, cksum);
|
||||
ones_weight += add_to_bitcolumn_checksum((unsigned int)2U + nibble_offset,
|
||||
byte_offset, cksum);
|
||||
ones_weight += add_to_bitcolumn_checksum((unsigned int)3U + nibble_offset,
|
||||
byte_offset, cksum);
|
||||
|
||||
ones_fact_weight = ones_fact_weight * (nibble_count + 2U);
|
||||
ones_fact_weight = ones_fact_weight * ((nibble_count%2U) + 3U);
|
||||
ones_fact_weight = ones_fact_weight * ((nibble_count%2U) + 4U);
|
||||
|
||||
}
|
||||
else if((byte_value & 0xFU) == 15U)
|
||||
{
|
||||
cksum->total_ones += 4U;
|
||||
ones_weight += add_to_bitcolumn_checksum((unsigned int)0U + nibble_offset,
|
||||
byte_offset, cksum);
|
||||
ones_weight += add_to_bitcolumn_checksum((unsigned int)1U + nibble_offset,
|
||||
byte_offset, cksum);
|
||||
ones_weight += add_to_bitcolumn_checksum((unsigned int)2U + nibble_offset,
|
||||
byte_offset, cksum);
|
||||
ones_weight += add_to_bitcolumn_checksum((unsigned int)3U + nibble_offset,
|
||||
byte_offset, cksum);
|
||||
|
||||
ones_fact_weight = ones_fact_weight * (nibble_count + 1U);
|
||||
ones_fact_weight = ones_fact_weight * ((nibble_count%2U) + 2U);
|
||||
ones_fact_weight = ones_fact_weight * ((nibble_count%2U) + 3U);
|
||||
ones_fact_weight = ones_fact_weight * ((nibble_count%2U) + 4U);
|
||||
|
||||
}
|
||||
else
|
||||
{
|
||||
// Do nothing
|
||||
}
|
||||
|
||||
add_to_factorial_sum(ones_fact_weight, cksum);
|
||||
ones_fact_weight = 1U;
|
||||
|
||||
//
|
||||
// Get the next nibble from byte
|
||||
//
|
||||
byte_value = byte_value >> 4U;
|
||||
}//for loop on nibble.
|
||||
|
||||
add_to_row_weight_sum(ones_weight, cksum);
|
||||
} // for loop on bytes in word.
|
||||
|
||||
offset++;
|
||||
}// start-end while loop
|
||||
|
||||
return offset;
|
||||
}
|
||||
|
||||
//
|
||||
// compare_two_composite_checksums - Compare two checksums and return 0 if they
|
||||
// match
|
||||
//
|
||||
unsigned short compare_two_composite_checksums(const composite_checksum_t *goldsum,
|
||||
composite_checksum_t *compsum)
|
||||
{
|
||||
if((goldsum == (void *)0) || (compsum == (void *)0))
|
||||
{
|
||||
return 0xFFFFU;
|
||||
}
|
||||
|
||||
if(goldsum->total_ones != compsum->total_ones)
|
||||
{
|
||||
return 0xFFFEU;
|
||||
}
|
||||
|
||||
if((goldsum->fact_weight_sum.highHalfMSW != compsum->fact_weight_sum.highHalfMSW) ||
|
||||
(goldsum->fact_weight_sum.highHalfLSW != compsum->fact_weight_sum.highHalfLSW) ||
|
||||
(goldsum->fact_weight_sum.lowHalfMSW != compsum->fact_weight_sum.lowHalfMSW) ||
|
||||
(goldsum->fact_weight_sum.lowHalfLSW != compsum->fact_weight_sum.lowHalfLSW))
|
||||
{
|
||||
return 0xFFFDU;
|
||||
}
|
||||
|
||||
if((goldsum->row_weight_sum.highHalfMSW != compsum->row_weight_sum.highHalfMSW) ||
|
||||
(goldsum->row_weight_sum.highHalfLSW != compsum->row_weight_sum.highHalfLSW) ||
|
||||
(goldsum->row_weight_sum.lowHalfMSW != compsum->row_weight_sum.lowHalfMSW) ||
|
||||
(goldsum->row_weight_sum.lowHalfLSW != compsum->row_weight_sum.lowHalfLSW))
|
||||
{
|
||||
return 0xFFFCU;
|
||||
}
|
||||
|
||||
if((goldsum->bit_column_cksum[7][2] != compsum->bit_column_cksum[7][2]) ||
|
||||
(goldsum->bit_column_cksum[7][1] != compsum->bit_column_cksum[7][1]) ||
|
||||
(goldsum->bit_column_cksum[7][0] != compsum->bit_column_cksum[7][0]))
|
||||
{
|
||||
return 0xFFFBU;
|
||||
}
|
||||
|
||||
if((goldsum->bit_column_cksum[6][2] != compsum->bit_column_cksum[6][2]) ||
|
||||
(goldsum->bit_column_cksum[6][1] != compsum->bit_column_cksum[6][1]) ||
|
||||
(goldsum->bit_column_cksum[6][0] != compsum->bit_column_cksum[6][0]))
|
||||
{
|
||||
return 0xFFFAU;
|
||||
}
|
||||
|
||||
if((goldsum->bit_column_cksum[5][2] != compsum->bit_column_cksum[5][2]) ||
|
||||
(goldsum->bit_column_cksum[5][1] != compsum->bit_column_cksum[5][1]) ||
|
||||
(goldsum->bit_column_cksum[5][0] != compsum->bit_column_cksum[5][0]))
|
||||
{
|
||||
return 0xFFF9U;
|
||||
}
|
||||
|
||||
if((goldsum->bit_column_cksum[4][2] != compsum->bit_column_cksum[4][2]) ||
|
||||
(goldsum->bit_column_cksum[4][1] != compsum->bit_column_cksum[4][1]) ||
|
||||
(goldsum->bit_column_cksum[4][0] != compsum->bit_column_cksum[4][0]))
|
||||
{
|
||||
return 0xFFF8U;
|
||||
}
|
||||
|
||||
if((goldsum->bit_column_cksum[3][2] != compsum->bit_column_cksum[3][2]) ||
|
||||
(goldsum->bit_column_cksum[3][1] != compsum->bit_column_cksum[3][1]) ||
|
||||
(goldsum->bit_column_cksum[3][0] != compsum->bit_column_cksum[3][0]))
|
||||
{
|
||||
return 0xFFF7U;
|
||||
}
|
||||
|
||||
if((goldsum->bit_column_cksum[2][2] != compsum->bit_column_cksum[2][2]) ||
|
||||
(goldsum->bit_column_cksum[2][1] != compsum->bit_column_cksum[2][1]) ||
|
||||
(goldsum->bit_column_cksum[2][0] != compsum->bit_column_cksum[2][0]))
|
||||
{
|
||||
return 0xFFF6U;
|
||||
}
|
||||
|
||||
if((goldsum->bit_column_cksum[1][2] != compsum->bit_column_cksum[1][2]) ||
|
||||
(goldsum->bit_column_cksum[1][1] != compsum->bit_column_cksum[1][1]) ||
|
||||
(goldsum->bit_column_cksum[1][0] != compsum->bit_column_cksum[1][0]))
|
||||
{
|
||||
return 0xFFF5U;
|
||||
}
|
||||
|
||||
if((goldsum->bit_column_cksum[0][2] != compsum->bit_column_cksum[0][2]) ||
|
||||
(goldsum->bit_column_cksum[0][1] != compsum->bit_column_cksum[0][1]) ||
|
||||
(goldsum->bit_column_cksum[0][0] != compsum->bit_column_cksum[0][0]))
|
||||
{
|
||||
return 0xFFF4U;
|
||||
}
|
||||
|
||||
return 0U;
|
||||
}
|
||||
|
||||
//
|
||||
// verify_checksum_onROM - Perform checksum on boot ROM on the specified
|
||||
// memory blocks and return whether the calculated
|
||||
// checksum matches the golden value in ROM
|
||||
//
|
||||
unsigned short verify_checksum_onROM(void)
|
||||
{
|
||||
composite_checksum_t rom_cksum;
|
||||
memblock mblock_rom[5];
|
||||
|
||||
//
|
||||
// Disable watchdog
|
||||
//
|
||||
SysCtl_disableWatchdog();
|
||||
|
||||
mblock_rom[0].firstAddr = 0x00000000UL;
|
||||
mblock_rom[0].lastAddr = 0x00000143UL;
|
||||
mblock_rom[0].mem_attribute = 1U; //data is present
|
||||
|
||||
//
|
||||
// 0x144 to 0x24C (Not used or reserved)
|
||||
//
|
||||
|
||||
mblock_rom[1].firstAddr = 0x0000024CUL;
|
||||
mblock_rom[1].lastAddr = 0x00001A1BUL;
|
||||
mblock_rom[1].mem_attribute = 1U; //data is present
|
||||
|
||||
|
||||
mblock_rom[2].firstAddr = 0x00001A1CUL;
|
||||
mblock_rom[2].lastAddr = 0x00004017UL;
|
||||
mblock_rom[2].mem_attribute = 0U; //data is no present - reserved
|
||||
|
||||
mblock_rom[3].firstAddr = 0x00004018UL;
|
||||
mblock_rom[3].lastAddr = 0x00000421BUL;
|
||||
mblock_rom[3].mem_attribute = 1U; //data is present
|
||||
|
||||
//
|
||||
// 0x421C to 0xFBFC (Not used or reserved)
|
||||
//
|
||||
|
||||
mblock_rom[4].firstAddr = 0x0000FBFCUL;
|
||||
mblock_rom[4].lastAddr = 0x0000FFFFUL;
|
||||
mblock_rom[4].mem_attribute = 1U; //data is present
|
||||
|
||||
//
|
||||
// Secure ROM 0x10000 to 0x18000
|
||||
//
|
||||
|
||||
if ( 0xFFFF == calculate_composite_checksum_on_rom(&rom_cksum, &mblock_rom[0], 5))
|
||||
{
|
||||
return 0xFFF2U;
|
||||
}
|
||||
|
||||
return (compare_two_composite_checksums(&boot_csum_rom, &rom_cksum));
|
||||
|
||||
}
|
||||
|
||||
//
|
||||
// End of File
|
||||
//
|
||||
+250
@@ -0,0 +1,250 @@
|
||||
;;###########################################################################
|
||||
;;
|
||||
;; FILE: cmbrom_init_boot.s
|
||||
;;
|
||||
;; TITLE: Boot loader startup code for CM
|
||||
;;
|
||||
;;###########################################################################
|
||||
;; $TI Release: $
|
||||
;; $Release Date: $
|
||||
;;###########################################################################
|
||||
|
||||
;
|
||||
; Included Files
|
||||
;
|
||||
.cdecls C, NOLIST, WARN
|
||||
%{
|
||||
#include "cmbootrom.h"
|
||||
%}
|
||||
|
||||
;
|
||||
; Globals
|
||||
;
|
||||
.global CM_resetISR, CM_performDelay
|
||||
.ref CMBROM_startSystemBoot ; Declared in cmbrom_system_boot
|
||||
.ref CMBROM_verifyBootCommand ; Declared in cmbrom_system_boot
|
||||
.ref CMBROM_setupDeviceSystems ; Declared in cmbrom_system_boot
|
||||
|
||||
;
|
||||
; Put the assembler into the correct configuration.
|
||||
;
|
||||
.thumb
|
||||
|
||||
;
|
||||
; Test Signature
|
||||
;
|
||||
.sect ".test_signature1" ; The 1's complement of the value at the first address of ROM
|
||||
.word 0xDFFFF7FF ;~(*(0x00000000)) - used for production testing
|
||||
|
||||
;
|
||||
; CM Boot Revision and Release date
|
||||
;
|
||||
.sect ".CMVersion"
|
||||
.global cmbrom_version
|
||||
cmbrom_version:
|
||||
.short 0x0100 ; CM Boot ROM Version v1.0
|
||||
.short 0x0418 ; Month/Year: (ex: 0x0418 = 4/18 = April 2018)
|
||||
|
||||
;
|
||||
; This portion of the file goes into the text section.
|
||||
;
|
||||
.text
|
||||
|
||||
;
|
||||
; Function: CM_resetISR
|
||||
;
|
||||
; The reset handler, which gets called when the processor starts.
|
||||
;
|
||||
.thumbfunc CM_resetISR
|
||||
.def CM_resetISR
|
||||
CM_resetISR: .asmfunc
|
||||
|
||||
;
|
||||
; Disable Watchdog (On reset, WDOVERRIDE is 1 allowing setting of WDDIS)
|
||||
; 0x4008000CU = WDCR register
|
||||
;
|
||||
movw r0, #0x000C
|
||||
movt r0, #0x4008
|
||||
movw r1, #0x0068
|
||||
str r1, [r0], #0
|
||||
|
||||
;
|
||||
; Check IPCBOOTMODE for valid values
|
||||
; Note: Make sure RAM isn't accessed in this function since RAM isn't
|
||||
; initialized and available yet
|
||||
;
|
||||
bl CMBROM_verifyBootCommand
|
||||
|
||||
;
|
||||
; Read SysCtl.CMRESC and check if VECTRESET
|
||||
;
|
||||
movw r0, #(CM_SYSCTL_RESC_REG & 0xffff)
|
||||
movt r0, #(CM_SYSCTL_RESC_REG >> 16)
|
||||
ldr r1, [r0], #0
|
||||
LSR r1, r1, #16 ; Move upper word to lower word
|
||||
TST r1, #0x0001 ; Test if VECTRESET is set
|
||||
bne skip_device_setup ; Skip device setup (flash power up, RAM init) on VECTRESET
|
||||
|
||||
;
|
||||
; Zero fill the first 64 bytes of S0RAM stack (0x200007C0 - 0x20000800) to use before RAM init or stack init.
|
||||
; (Doesn't clear 0x20000800)
|
||||
;
|
||||
movw r0, #0x07c0
|
||||
movt r0, #0x2000
|
||||
movw r1, #0x0040
|
||||
movt r1, #0x0000
|
||||
movs r2, #0x00000000
|
||||
small_stack_zero_loop:
|
||||
str r2, [r0], #4
|
||||
subs r1, r1, #4
|
||||
bne small_stack_zero_loop
|
||||
|
||||
;
|
||||
; Set SP to the top of the allocated stack
|
||||
;
|
||||
mov sp, r0
|
||||
|
||||
;
|
||||
; Setup Device Systems - Power up flash
|
||||
;
|
||||
bl CMBROM_setupDeviceSystems
|
||||
|
||||
;
|
||||
; Read SysCtl.CMRESC and check if POR
|
||||
;
|
||||
movw r0, #(CM_SYSCTL_RESC_REG & 0xffff)
|
||||
movt r0, #(CM_SYSCTL_RESC_REG >> 16)
|
||||
ldr r1, [r0], #0
|
||||
TST r1, #SYSCTL_CMRESC_POR ; Test if bit 1 (POR) is set
|
||||
beq skip_ram_init ; Branch if POR not set
|
||||
|
||||
;
|
||||
; POR Only - Peform RAM init (Split into two groups)
|
||||
;
|
||||
; Group 1 - S0-S3
|
||||
; Group 2 - C0-C1, MSG RAMs, E0
|
||||
;
|
||||
|
||||
;
|
||||
; Group 1 - S0-S3
|
||||
;
|
||||
; SxInit address = 0x400FE048
|
||||
;
|
||||
movw r0, #0xE048
|
||||
movt r0, #0x400F
|
||||
movw r1, #0x000F ; S0,S1,S2,S3
|
||||
str r1, [r0], #0
|
||||
|
||||
;
|
||||
; Delay 4128 cycles (4096 cycles + 32 buffer) for Sx RAMS (16KB each) to complete
|
||||
;
|
||||
movw r0, #0x0560
|
||||
bl CM_performDelay
|
||||
|
||||
;
|
||||
; Group 2 - C0-C1, E0, MSG RAMs
|
||||
;
|
||||
; CxInit address = 0x400FE008
|
||||
; ExInit address = 0x400FE048
|
||||
; CMMSGxInit address = 0x400FE028
|
||||
;
|
||||
movw r0, #0xE008
|
||||
movt r0, #0x400F
|
||||
movw r1, #0x0003 ; C0, C1
|
||||
str r1, [r0], #0
|
||||
|
||||
movw r0, #0xE048
|
||||
movt r0, #0x400F
|
||||
movw r1, #0x0010 ; E0
|
||||
str r1, [r0], #0
|
||||
|
||||
movw r0, #0xE028
|
||||
movt r0, #0x400F
|
||||
movw r1, #0x000F ; CMTOCPU1MSGRAM0/1, CMTOCPU2MSGRAM0/1
|
||||
str r1, [r0], #0
|
||||
|
||||
;
|
||||
; Delay 4128 cycles (4096 cycles + 32 buffer) for Ex RAM (16KB) to complete
|
||||
;
|
||||
movw r0, #0x0560
|
||||
bl CM_performDelay
|
||||
|
||||
;
|
||||
; CM Patch/Escape Point 2
|
||||
;
|
||||
movw r0, #0x07D4
|
||||
movt r0, #0x0038
|
||||
ldr r1, [r0], #0 ; r1 contains address specified at OTP escape point
|
||||
|
||||
movw r0, #0xFFFF
|
||||
movt r0, #0xFFFF
|
||||
|
||||
cmp r0, r1
|
||||
beq continue_booting
|
||||
|
||||
movw r0, #0x0
|
||||
movt r0, #0x0
|
||||
|
||||
cmp r0, r1
|
||||
beq continue_booting
|
||||
|
||||
ORR r1, #0x1 ; Make sure thumb mode bit is set
|
||||
blx r1 ; ((void (*)(void))EntryAddr)();
|
||||
|
||||
|
||||
continue_booting:
|
||||
b skip_stack_init
|
||||
|
||||
skip_device_setup:
|
||||
skip_ram_init:
|
||||
|
||||
;
|
||||
; Non-POR Reset: Zero fill ~2 KB of S0RAM for stack (0x2000000C-0x20000800)
|
||||
; (Doesn't clear 0x20000800)
|
||||
;
|
||||
movw r0, #0x000C
|
||||
movt r0, #0x2000
|
||||
movw r1, #0x07F4
|
||||
movt r1, #0x0000
|
||||
movs r2, #0x00000000
|
||||
stack_zero_loop:
|
||||
str r2, [r0], #4
|
||||
subs r1, r1, #4
|
||||
bne stack_zero_loop
|
||||
|
||||
skip_stack_init:
|
||||
|
||||
;
|
||||
; Set SP to top of the allocated stack
|
||||
;
|
||||
movw r0, #0x0800
|
||||
movt r0, #0x2000
|
||||
mov sp, r0
|
||||
|
||||
;
|
||||
; Branch to system initialization to run final initializations and execute boot mode
|
||||
;
|
||||
b CMBROM_startSystemBoot
|
||||
|
||||
error_loop:
|
||||
b error_loop
|
||||
.endasmfunc
|
||||
|
||||
|
||||
;
|
||||
; Function: CM_performDelay
|
||||
;
|
||||
; Provides a small delay. The loop below takes 3 cycles/loop.
|
||||
;
|
||||
.thumbfunc CM_performDelay
|
||||
.def CM_performDelay
|
||||
CM_performDelay: .asmfunc
|
||||
subs r0, #1
|
||||
bne CM_performDelay
|
||||
bx lr
|
||||
.endasmfunc
|
||||
|
||||
;
|
||||
; End of file
|
||||
;
|
||||
.end
|
||||
+243
@@ -0,0 +1,243 @@
|
||||
//###########################################################################
|
||||
//
|
||||
// FILE: cmbrom_interrupts.c
|
||||
//
|
||||
// TITLE: CM Boot ROM interrupt handlers
|
||||
//
|
||||
// Interrupt handlers to handle hard fault, NMI, and unexpected interrupts
|
||||
//
|
||||
//###########################################################################
|
||||
// $TI Release: $
|
||||
// $Release Date: $
|
||||
//###########################################################################
|
||||
|
||||
//
|
||||
// Included Files
|
||||
//
|
||||
#include "cmbootrom.h"
|
||||
|
||||
//
|
||||
// Globals
|
||||
//
|
||||
extern uint32_t CMBROM_bootStatus;
|
||||
uint32_t CMBROM_nmiStatus;
|
||||
|
||||
//
|
||||
// CMBROM_nmiHandler - Function to handle NMI interrupts during CM boot
|
||||
//
|
||||
#pragma CODE_SECTION(CMBROM_nmiHandler, "CMBROM_NMI_HANDLER")
|
||||
__interrupt void CMBROM_nmiHandler(void)
|
||||
{
|
||||
uint32_t entryAddress = 0xFFFFFFFFUL;
|
||||
|
||||
//
|
||||
// CM Patch/Escape Point 9
|
||||
//
|
||||
entryAddress = CMBROM_TI_OTP_ESCAPE_POINT_9;
|
||||
if((entryAddress != 0xFFFFFFFFUL) &&
|
||||
(entryAddress != 0x00000000UL))
|
||||
{
|
||||
entryAddress |= 0x1U; // BLX instruction result in a UsageFault exception
|
||||
// if bit[0] of Rm is 0, where Rm holds the branch
|
||||
// address.
|
||||
//
|
||||
// If OTP is programmed, then call OTP patch function
|
||||
//
|
||||
((void (*)(void))entryAddress)();
|
||||
}
|
||||
|
||||
//
|
||||
// Check to see if NMI is triggered
|
||||
//
|
||||
CMBROM_nmiStatus = HWREG(NMI_BASE + NMI_O_CMNMIFLG);
|
||||
do
|
||||
{
|
||||
//
|
||||
// Check for Clock Fail NMI
|
||||
//
|
||||
if((CMBROM_nmiStatus & NMI_CMNMIFLG_CLOCKFAIL) == NMI_CMNMIFLG_CLOCKFAIL)
|
||||
{
|
||||
//
|
||||
// Update boot status
|
||||
//
|
||||
CMBROM_bootStatus |= CM_BOOTROM_GOT_A_MCLK_NMI;
|
||||
|
||||
//
|
||||
// Clear NMI flag
|
||||
//
|
||||
HWREG(NMI_BASE + NMI_O_CMNMIFLGCLR) = (CM_NMI_CLEAR_KEY |
|
||||
NMI_CMNMIFLGCLR_CLOCKFAIL);
|
||||
}
|
||||
//
|
||||
// Check for RAM/ROM (includes parity error) Uncorrectable Error NMI
|
||||
//
|
||||
if((CMBROM_nmiStatus & NMI_CMNMIFLG_MEMUNCERR) == NMI_CMNMIFLG_MEMUNCERR)
|
||||
{
|
||||
//
|
||||
// Update boot status
|
||||
//
|
||||
CMBROM_bootStatus |= CM_BOOTROM_GOT_A_RAM_UNCERR_NMI;
|
||||
|
||||
//
|
||||
// Clear NMI flag
|
||||
//
|
||||
HWREG(NMI_BASE + NMI_O_CMNMIFLGCLR) = (CM_NMI_CLEAR_KEY |
|
||||
NMI_CMNMIFLGCLR_MEMUNCERR);
|
||||
}
|
||||
//
|
||||
// Check for Flash Uncorrectable Error NMI
|
||||
//
|
||||
if((CMBROM_nmiStatus & NMI_CMNMIFLG_FLUNCERR) == NMI_CMNMIFLG_FLUNCERR)
|
||||
{
|
||||
//
|
||||
// Update boot status
|
||||
//
|
||||
CMBROM_bootStatus |= CM_BOOTROM_GOT_A_FLASH_UNCERR_NMI;
|
||||
|
||||
//
|
||||
// Clear NMI flag
|
||||
//
|
||||
HWREG(NMI_BASE + NMI_O_CMNMIFLGCLR) = (CM_NMI_CLEAR_KEY |
|
||||
NMI_CMNMIFLGCLR_FLUNCERR);
|
||||
}
|
||||
//
|
||||
// Check for MCAN NMI
|
||||
//
|
||||
if((CMBROM_nmiStatus & NMI_CMNMIFLG_MCANUNCERR) == NMI_CMNMIFLG_MCANUNCERR)
|
||||
{
|
||||
//
|
||||
// Update boot status
|
||||
//
|
||||
CMBROM_bootStatus |= CM_BOOTROM_GOT_A_MCAN_UNCERR_NMI;
|
||||
|
||||
//
|
||||
// Clear NMI flag
|
||||
//
|
||||
HWREG(NMI_BASE + NMI_O_CMNMIFLGCLR) = (CM_NMI_CLEAR_KEY |
|
||||
NMI_CMNMIFLG_MCANUNCERR);
|
||||
}
|
||||
//
|
||||
// Check for WWDNMI
|
||||
//
|
||||
if((CMBROM_nmiStatus & NMI_CMNMIFLG_WWDNMI) == NMI_CMNMIFLG_WWDNMI)
|
||||
{
|
||||
//
|
||||
// Update boot status
|
||||
//
|
||||
CMBROM_bootStatus |= CM_BOOTROM_GOT_A_WWD_NMI;
|
||||
|
||||
//
|
||||
// Clear NMI flag
|
||||
//
|
||||
HWREG(NMI_BASE + NMI_O_CMNMIFLGCLR) = (CM_NMI_CLEAR_KEY |
|
||||
NMI_CMNMIFLG_WWDNMI);
|
||||
}
|
||||
//
|
||||
// Check for ECAT NMI
|
||||
//
|
||||
if((CMBROM_nmiStatus & NMI_CMNMIFLG_ECATNMI) == NMI_CMNMIFLG_ECATNMI)
|
||||
{
|
||||
//
|
||||
// Update boot status
|
||||
//
|
||||
CMBROM_bootStatus |= CM_BOOTROM_GOT_A_ECAT_NMI;
|
||||
|
||||
//
|
||||
// Clear NMI flag
|
||||
//
|
||||
HWREG(NMI_BASE + NMI_O_CMNMIFLGCLR) = (CM_NMI_CLEAR_KEY |
|
||||
NMI_CMNMIFLG_ECATNMI);
|
||||
}
|
||||
|
||||
//
|
||||
// Clear Global NMI flag
|
||||
//
|
||||
CMBROM_nmiStatus &= ~(NMI_CMNMIFLG_NMIINT);
|
||||
|
||||
HWREG(NMI_BASE + NMI_O_CMNMIFLGCLR) = (CM_NMI_CLEAR_KEY |
|
||||
NMI_CMNMIFLGCLR_NMIINT);
|
||||
|
||||
//
|
||||
// Read NMI status to determine if more NMIs present
|
||||
//
|
||||
CMBROM_nmiStatus = HWREG(NMI_BASE + NMI_O_CMNMIFLG);
|
||||
|
||||
}while((CMBROM_nmiStatus & NMI_CMNMIFLG_NMIINT) == NMI_CMNMIFLG_NMIINT);
|
||||
|
||||
//
|
||||
// Update boot status
|
||||
//
|
||||
CMBROM_setIPCBootStatus();
|
||||
|
||||
//
|
||||
// Send Error IPC to CPU1
|
||||
//
|
||||
(void)CMBROM_sendErrorIPC(CMTOCPU1_BOOTROM_NMI,
|
||||
NO_ADDRESS_DATA);
|
||||
|
||||
//
|
||||
// Wait to be reset by CPU1
|
||||
//
|
||||
while(1)
|
||||
{
|
||||
}
|
||||
}
|
||||
|
||||
//
|
||||
// CMBROM_hardFaultISR - Function to handle any hard fault interrupts
|
||||
//
|
||||
#pragma CODE_SECTION(CMBROM_hardFaultISR, "CMBROM_HARDFAULT_HANDLER")
|
||||
__interrupt void CMBROM_hardFaultISR(void)
|
||||
{
|
||||
//
|
||||
// Update boot status
|
||||
//
|
||||
CMBROM_bootStatus |= CM_BOOTROM_GOT_HARD_FAULT;
|
||||
|
||||
//
|
||||
// Update boot status health and send IPC to CPU1
|
||||
//
|
||||
CMBROM_setIPCBootStatus();
|
||||
(void)CMBROM_sendErrorIPC(CMTOCPU1_BOOTROM_HARD_FAULT,
|
||||
NO_ADDRESS_DATA);
|
||||
|
||||
//
|
||||
// Wait for CPU1 to reset CM
|
||||
//
|
||||
while(1)
|
||||
{
|
||||
}
|
||||
}
|
||||
|
||||
//
|
||||
// CMBROM_defaultHandler - Default interrupt handler for any unassigned interrupts
|
||||
//
|
||||
#pragma CODE_SECTION(CMBROM_defaultHandler, "CMBROM_DEFAULT_HANDLER")
|
||||
__interrupt void CMBROM_defaultHandler(void)
|
||||
{
|
||||
//
|
||||
// Update boot status
|
||||
//
|
||||
CMBROM_bootStatus |= CM_BOOTROM_GOT_UNASSIGNED_INTERRUPT;
|
||||
|
||||
//
|
||||
// Update boot status health and send IPC to CPU1 with
|
||||
// active exception number
|
||||
//
|
||||
CMBROM_setIPCBootStatus();
|
||||
(void)CMBROM_sendErrorIPC(CMTOCPU1_BOOTROM_UNASSIGNED_INTERRUPT,
|
||||
(HWREGH(NVIC_BASE + NVIC_O_ICSR) &
|
||||
NVIC_ICSR_VECTACTIVE_M));
|
||||
|
||||
//
|
||||
// Wait for CPU1 to reset CM
|
||||
//
|
||||
while(1)
|
||||
{
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
//
|
||||
// End of file
|
||||
//
|
||||
+66
@@ -0,0 +1,66 @@
|
||||
//###########################################################################
|
||||
//
|
||||
// FILE: cmbrom_ipc.c
|
||||
//
|
||||
// TITLE: CM IPC Functions
|
||||
//
|
||||
// CM IPC functions used to communicate to and from CPU1
|
||||
//
|
||||
//###########################################################################
|
||||
// $TI Release: $
|
||||
// $Release Date: $
|
||||
//###########################################################################
|
||||
|
||||
//
|
||||
// Included Files
|
||||
//
|
||||
#include "cmbootrom.h"
|
||||
|
||||
//
|
||||
// Globals
|
||||
//
|
||||
extern uint32_t CMBROM_bootStatus;
|
||||
|
||||
//
|
||||
// CMBROM_setIPCBootStatus - Set IPCBOOTSTS for CPU1 to read status info
|
||||
//
|
||||
void CMBROM_setIPCBootStatus(void)
|
||||
{
|
||||
HWREG(IPC_CMTOCPU1_BASE + IPC_O_CMTOCPU1IPCBOOTSTS) = CMBROM_bootStatus;
|
||||
}
|
||||
|
||||
//
|
||||
// CMBROM_sendErrorIPC - Send IPC command to CPU1 when error occurs
|
||||
//
|
||||
uint32_t CMBROM_sendErrorIPC(uint32_t errorCommand, uint32_t address)
|
||||
{
|
||||
//
|
||||
// Important: Don't use local variables in this function
|
||||
//
|
||||
|
||||
//
|
||||
// Don't send IPC command if previous IPC hasn't been addressed.
|
||||
// (IPC Flags 0 not cleared by CPU1)
|
||||
//
|
||||
if((HWREG(IPC_CMTOCPU1_BASE + IPC_O_CMTOCPU1IPCFLG) & IPC_CMTOCPU1IPCFLG_IPC0) == IPC_CMTOCPU1IPCFLG_IPC0)
|
||||
{
|
||||
return(CM_IPC_FAILURE);
|
||||
}
|
||||
|
||||
//
|
||||
// Set IPC command with error and IPC address (if applicable)
|
||||
//
|
||||
HWREG(IPC_CMTOCPU1_BASE + IPC_O_CMTOCPU1IPCSENDCOM) = errorCommand;
|
||||
HWREG(IPC_CMTOCPU1_BASE + IPC_O_CMTOCPU1IPCSENDADDR) = address;
|
||||
|
||||
//
|
||||
// Set IPC Flags 0
|
||||
//
|
||||
HWREG(IPC_CMTOCPU1_BASE + IPC_O_CMTOCPU1IPCSET) = IPC_CMTOCPU1IPCSET_IPC0;
|
||||
|
||||
return(CM_IPC_SUCCESS);
|
||||
}
|
||||
|
||||
//
|
||||
// End of file
|
||||
//
|
||||
+71
@@ -0,0 +1,71 @@
|
||||
//###########################################################################
|
||||
//
|
||||
// FILE: cmbrom_ipc_msg_copy.c
|
||||
//
|
||||
// TITLE: CM IPC Message Copy to RAM Boot Mode
|
||||
//
|
||||
// Function to copy from the CPU1 IPC message RAM into CM S0RAM
|
||||
//
|
||||
//###########################################################################
|
||||
// $TI Release: $
|
||||
// $Release Date: $
|
||||
//###########################################################################
|
||||
|
||||
//
|
||||
// Included Files
|
||||
//
|
||||
#include "cmbootrom.h"
|
||||
|
||||
//
|
||||
// Defines
|
||||
//
|
||||
#define IPC_LENGTH_TO_BYTES (2UL * 100UL)
|
||||
|
||||
//
|
||||
// Globals
|
||||
//
|
||||
extern uint32_t CMBROM_bootStatus;
|
||||
|
||||
//
|
||||
// CMBROM_performCopyToRAM - Copy from CPU1-to-CM Message RAM 1 to
|
||||
// destination RAM
|
||||
//
|
||||
// copyLength is value that represents 100*x words
|
||||
// (Ex: 0x2 = 200 words or 400 bytes)
|
||||
//
|
||||
void CMBROM_performCopyToRAM(uint32_t entryAddress, uint16_t copyLength)
|
||||
{
|
||||
uint32_t i;
|
||||
uint32_t escapeEntryAddress = 0xFFFFFFFFUL;
|
||||
uint16_t offset = 0U;
|
||||
|
||||
//
|
||||
// CM Patch/Escape Point 11
|
||||
//
|
||||
escapeEntryAddress = CMBROM_TI_OTP_ESCAPE_POINT_11;
|
||||
if((escapeEntryAddress != 0xFFFFFFFFUL) &&
|
||||
(escapeEntryAddress != 0x00000000UL))
|
||||
{
|
||||
escapeEntryAddress |= 0x1U; // BLX instruction result in a UsageFault exception
|
||||
// if bit[0] of Rm is 0, where Rm holds the branch
|
||||
// address.
|
||||
//
|
||||
// If OTP is programmed, then call OTP patch function
|
||||
//
|
||||
((void (*)(void))escapeEntryAddress)();
|
||||
}
|
||||
|
||||
//
|
||||
// Copy from message RAM to destination RAM (adjusting copyLength to words
|
||||
// then x2 for byte addressing)
|
||||
//
|
||||
for(i = entryAddress; i<(entryAddress + (uint32_t)(IPC_LENGTH_TO_BYTES * copyLength)); i+=4U)
|
||||
{
|
||||
HWREG(i) = HWREG(CPU1_TO_CM_MESSAGE_RAM + offset);
|
||||
offset+=4U;
|
||||
}
|
||||
}
|
||||
|
||||
//
|
||||
// End of file
|
||||
//
|
||||
+791
@@ -0,0 +1,791 @@
|
||||
//###########################################################################
|
||||
//
|
||||
// FILE: cmbrom_system_boot.c
|
||||
//
|
||||
// TITLE: CM System Boot
|
||||
//
|
||||
// CM System Initialization and associated functions
|
||||
//
|
||||
//###########################################################################
|
||||
// $TI Release: $
|
||||
// $Release Date: $
|
||||
//###########################################################################
|
||||
|
||||
//
|
||||
// Included Files
|
||||
//
|
||||
#include "cmbootrom.h"
|
||||
|
||||
//
|
||||
// Globals
|
||||
//
|
||||
#pragma DATA_SECTION(CMBROM_bootMode, "UserBootModeVariable");
|
||||
uint32_t CMBROM_bootMode;
|
||||
|
||||
#pragma DATA_SECTION(CMBROM_bootStatus, "BootStatusVariable");
|
||||
uint32_t CMBROM_bootStatus;
|
||||
|
||||
//
|
||||
// Function Prototypes
|
||||
//
|
||||
void CMBROM_waitForCommand(void);
|
||||
uint32_t CMBROM_runSelectedBootMode(void);
|
||||
uint32_t CMBROM_verifySecureFlash(uint32_t entryAddress);
|
||||
|
||||
//
|
||||
// CMBROM_verifyBootCommand - Verify that the IPCBOOTMODE values for key,
|
||||
// IPC message RAM copy length, and device
|
||||
// frequency are set appropriately.
|
||||
//
|
||||
// If values are invalid, IPC is sent to CPU1 and
|
||||
// CM waits for reset.
|
||||
//
|
||||
void CMBROM_verifyBootCommand(void)
|
||||
{
|
||||
//
|
||||
// Important: Don't use local variables in this function
|
||||
//
|
||||
|
||||
//
|
||||
// Wait for CPU1 to set flag 0 to signal the IPCBOOTMODE is ready.
|
||||
// Set status to indicate CM is waiting and clear after IPCFLG set.
|
||||
//
|
||||
HWREG(IPC_CMTOCPU1_BASE + IPC_O_CMTOCPU1IPCBOOTSTS) = CM_BOOTROM_BOOTSTS_WAITING_FOR_FLAG;
|
||||
while((HWREG(IPC_CMTOCPU1_BASE + IPC_O_CPU1TOCMIPCSTS) & IPC_CPU1TOCMIPCSTS_IPC0) != IPC_CPU1TOCMIPCSTS_IPC0);
|
||||
HWREG(IPC_CMTOCPU1_BASE + IPC_O_CMTOCPU1IPCBOOTSTS) = 0x0UL;
|
||||
|
||||
//
|
||||
// ACK CPU1 Flag
|
||||
//
|
||||
HWREG(IPC_CMTOCPU1_BASE + IPC_O_CMTOCPU1IPCACK) |= IPC_CMTOCPU1IPCACK_IPC0;
|
||||
|
||||
|
||||
//
|
||||
// Check the IPCBOOTMODE Key, IPC message copy length, and device frequency
|
||||
//
|
||||
if((HWREAD_IPCBOOTMODE_KEY != IPCBOOTMODE_KEY) ||
|
||||
(HWREAD_IPCBOOTMODE_COPY_LENGTH > IPCBOOTMODE_COPY_LENGTH_MAX) ||
|
||||
(HWREAD_IPCBOOTMODE_DEVICE_FREQ > IPCBOOTMODE_DEVICE_FREQ_MAX) ||
|
||||
(HWREAD_IPCBOOTMODE_DEVICE_FREQ < IPCBOOTMODE_DEVICE_FREQ_MIN))
|
||||
{
|
||||
//
|
||||
// IPCBOOTMODE Values aren't correct, send IPC to CPU1, and
|
||||
// wait for CPU1 to reset CM
|
||||
//
|
||||
|
||||
//
|
||||
// Set IPC command with error and IPC address (if applicable)
|
||||
//
|
||||
HWREG(IPC_CMTOCPU1_BASE + IPC_O_CMTOCPU1IPCSENDCOM) = CMTOCPU1_BOOTROM_BOOT_CMD_INVALID;
|
||||
HWREG(IPC_CMTOCPU1_BASE + IPC_O_CMTOCPU1IPCSENDADDR) = NO_ADDRESS_DATA;
|
||||
|
||||
//
|
||||
// Set IPC Flags 0
|
||||
//
|
||||
HWREG(IPC_CMTOCPU1_BASE + IPC_O_CMTOCPU1IPCSET) = IPC_CMTOCPU1IPCSET_IPC0;
|
||||
|
||||
while(1)
|
||||
{
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
//
|
||||
// CMBROM_setupDeviceSystems - Setup flash configurations and power up
|
||||
//
|
||||
void CMBROM_setupDeviceSystems(void)
|
||||
{
|
||||
uint32_t entryAddress = 0xFFFFFFFFUL;
|
||||
uint16_t deviceClockFrequency = 0x0U;
|
||||
uint16_t flashPSLEEP;
|
||||
uint16_t flashRWAIT;
|
||||
uint16_t flashPowerUpTimeOut;
|
||||
|
||||
//
|
||||
// Get device clock frequency (MHz)
|
||||
//
|
||||
deviceClockFrequency = HWREAD_IPCBOOTMODE_DEVICE_FREQ;
|
||||
|
||||
//
|
||||
// Set flash power up values
|
||||
//
|
||||
if(deviceClockFrequency > 100U)
|
||||
{
|
||||
//
|
||||
// Set flash timeout variable
|
||||
//
|
||||
flashPowerUpTimeOut = CM_FLASH_PSLEEP_125MHZ_TIMEOUT_VALUE;
|
||||
|
||||
//
|
||||
// Set flash PSLEEP
|
||||
//
|
||||
flashPSLEEP = CM_FLASH_PSLEEP_125MHZ_VALUE;
|
||||
|
||||
//
|
||||
// Set flash wait state to 2 (for frequencies between 101MHz and 150MHz)
|
||||
//
|
||||
flashRWAIT = 0x2U;
|
||||
}
|
||||
else if(deviceClockFrequency > 50U)
|
||||
{
|
||||
//
|
||||
// Set flash timeout variable
|
||||
//
|
||||
flashPowerUpTimeOut = CM_FLASH_PSLEEP_100MHZ_TIMEOUT_VALUE;
|
||||
|
||||
//
|
||||
// Set flash PSLEEP
|
||||
//
|
||||
flashPSLEEP = CM_FLASH_PSLEEP_100MHZ_VALUE;
|
||||
|
||||
//
|
||||
// Set flash wait state to 1 (for frequencies between 51MHz and 100MHz)
|
||||
//
|
||||
flashRWAIT = 0x1U;
|
||||
}
|
||||
else if(deviceClockFrequency > 25U)
|
||||
{
|
||||
//
|
||||
// Set flash timeout variable
|
||||
//
|
||||
flashPowerUpTimeOut = CM_FLASH_PSLEEP_50MHZ_TIMEOUT_VALUE;
|
||||
|
||||
//
|
||||
// Set flash PSLEEP
|
||||
//
|
||||
flashPSLEEP = CM_FLASH_PSLEEP_50MHZ_VALUE;
|
||||
|
||||
//
|
||||
// Set flash wait state to 0 (for frequencies less than 50MHz)
|
||||
//
|
||||
flashRWAIT = 0x0U;
|
||||
}
|
||||
else
|
||||
{
|
||||
//
|
||||
// Less than or equal to 25MHz
|
||||
//
|
||||
|
||||
//
|
||||
// Set flash timeout variable
|
||||
//
|
||||
flashPowerUpTimeOut = CM_FLASH_PSLEEP_25MHZ_TIMEOUT_VALUE;
|
||||
|
||||
//
|
||||
// Set flash PSLEEP
|
||||
//
|
||||
flashPSLEEP = CM_FLASH_PSLEEP_25MHZ_VALUE;
|
||||
|
||||
//
|
||||
// Set flash wait state to 0 (for frequencies less than 50MHz)
|
||||
//
|
||||
flashRWAIT = 0x0U;
|
||||
}
|
||||
|
||||
//
|
||||
// Unlock Flash control register
|
||||
//
|
||||
Flash_unlockCtrlRegisters(FLASH0CTRL_BASE);
|
||||
|
||||
//
|
||||
// Set flash PSLEEP
|
||||
//
|
||||
Flash_setPumpWakeupTime(FLASH0CTRL_BASE, flashPSLEEP);
|
||||
|
||||
//
|
||||
// Set flash wait state
|
||||
//
|
||||
Flash_setWaitstates(FLASH0CTRL_BASE, flashRWAIT);
|
||||
|
||||
//
|
||||
// Set flash bank power modes to active
|
||||
//
|
||||
Flash_setPumpPowerMode(FLASH0CTRL_BASE, FLASH_PUMP_PWR_ACTIVE);
|
||||
Flash_setBankPowerMode(FLASH0CTRL_BASE, FLASH_BANK, FLASH_BANK_PWR_ACTIVE);
|
||||
|
||||
//
|
||||
// Wait until Flash Bank and Pump are ready
|
||||
//
|
||||
while((HWREGH(FLASH0CTRL_BASE + FLASH_O_FBPRDY) & (FLASH_FBPRDY_PUMPRDY | FLASH_FBPRDY_BANKRDY)) !=
|
||||
(FLASH_FBPRDY_PUMPRDY | FLASH_FBPRDY_BANKRDY))
|
||||
{
|
||||
//
|
||||
// If ready status is never set, a timeout
|
||||
// will break loop and continue with boot
|
||||
//
|
||||
if(flashPowerUpTimeOut == 0U)
|
||||
{
|
||||
break;
|
||||
}
|
||||
else
|
||||
{
|
||||
__asm(" nop");
|
||||
|
||||
flashPowerUpTimeOut-=1U;
|
||||
}
|
||||
}
|
||||
|
||||
//
|
||||
// Adjust the PSLEEP back to default reset value
|
||||
//
|
||||
Flash_setPumpWakeupTime(FLASH0CTRL_BASE, CM_FLASH_DEFAULT_PSLEEP);
|
||||
|
||||
//
|
||||
// Set back the Flash wait states
|
||||
//
|
||||
Flash_setWaitstates(FLASH0CTRL_BASE, CM_FLASH_DEFAULT_RWAIT);
|
||||
|
||||
//
|
||||
// CM Patch/Escape Point 1
|
||||
//
|
||||
entryAddress = CMBROM_TI_OTP_ESCAPE_POINT_1;
|
||||
if((entryAddress != 0xFFFFFFFFUL) &&
|
||||
(entryAddress != 0x00000000UL))
|
||||
{
|
||||
entryAddress |= 0x1U; // BLX instruction result in a UsageFault exception
|
||||
// if bit[0] of Rm is 0, where Rm holds the branch
|
||||
// address.
|
||||
//
|
||||
// If OTP is programmed, then call OTP patch function
|
||||
//
|
||||
((void (*)(void))entryAddress)();
|
||||
}
|
||||
}
|
||||
|
||||
//
|
||||
// CMBROM_startSystemBoot - CM System Initialization procedure and boot
|
||||
// selection
|
||||
//
|
||||
uint32_t CMBROM_startSystemBoot(void)
|
||||
{
|
||||
uint32_t entryAddress = 0xFFFFFFFFUL;
|
||||
uint32_t bootEntryAddress = 0xFFFFFFFFUL;
|
||||
uint16_t bootState = CMBROM_READBOOTMODE;
|
||||
|
||||
//
|
||||
// Init boot mode selection
|
||||
//
|
||||
CMBROM_bootMode = 0xFFFFFFFFUL;
|
||||
|
||||
//
|
||||
// Update boot status - Boot has started
|
||||
//
|
||||
CMBROM_bootStatus = CM_BOOTROM_BOOTSTS_SYSTEM_START_BOOT;
|
||||
|
||||
//
|
||||
// Update CM boot health status for CPU1
|
||||
//
|
||||
CMBROM_setIPCBootStatus();
|
||||
|
||||
//
|
||||
// CM Patch/Escape Point 3
|
||||
//
|
||||
entryAddress = CMBROM_TI_OTP_ESCAPE_POINT_3;
|
||||
if((entryAddress != 0xFFFFFFFFUL) &&
|
||||
(entryAddress != 0x00000000UL))
|
||||
{
|
||||
entryAddress |= 0x1U; // BLX instruction result in a UsageFault exception
|
||||
// if bit[0] of Rm is 0, where Rm holds the branch
|
||||
// address.
|
||||
//
|
||||
// If OTP is programmed, then call OTP patch function
|
||||
//
|
||||
((void (*)(void))entryAddress)();
|
||||
}
|
||||
|
||||
//
|
||||
// Enable NMI
|
||||
//
|
||||
HWREG(NMI_BASE + NMI_O_CMNMICFG) = CM_NMI_ENABLE_KEY | NMI_CMNMICFG_NMIE;
|
||||
|
||||
//
|
||||
// CM Patch/Escape Point 4
|
||||
//
|
||||
entryAddress = CMBROM_TI_OTP_ESCAPE_POINT_4;
|
||||
if((entryAddress != 0xFFFFFFFFUL) &&
|
||||
(entryAddress != 0x00000000UL))
|
||||
{
|
||||
entryAddress |= 0x1U; // BLX instruction result in a UsageFault exception
|
||||
// if bit[0] of Rm is 0, where Rm holds the branch
|
||||
// address.
|
||||
//
|
||||
// If OTP is programmed, then call OTP patch function
|
||||
//
|
||||
((void (*)(void))entryAddress)();
|
||||
}
|
||||
|
||||
//
|
||||
// Update status that RAM init is complete.
|
||||
//
|
||||
// Clear RESC bits so that bootROM would not go into
|
||||
// a unwanted reset handling if it got reset for some reason
|
||||
//
|
||||
if((HWREG(CMSYSCTL_BASE + SYSCTL_O_CMRESC) &
|
||||
((uint32_t)SYSCTL_CMRESC_POR)) == SYSCTL_CMRESC_POR)
|
||||
{
|
||||
//
|
||||
// Update boot status - RAM Init complete
|
||||
//
|
||||
CMBROM_bootStatus |= CM_BOOTROM_RAM_INIT_COMPLETE;
|
||||
|
||||
//
|
||||
// Clear POR and XRSn
|
||||
//
|
||||
SysCtl_clearResetCause(SYSCTL_CMRESC_POR);
|
||||
CMBROM_bootStatus |= ((uint32_t)CM_BOOTROM_HANDLED_POR);
|
||||
}
|
||||
|
||||
//
|
||||
// Update boot status - Reset cause clearing complete
|
||||
//
|
||||
CMBROM_bootStatus |= CM_BOOTROM_RESC_HANDLED;
|
||||
|
||||
//
|
||||
// Update CM boot health status for CPU1
|
||||
//
|
||||
CMBROM_setIPCBootStatus();
|
||||
|
||||
//
|
||||
// CM Patch/Escape Point 5
|
||||
//
|
||||
entryAddress = CMBROM_TI_OTP_ESCAPE_POINT_5;
|
||||
if((entryAddress != 0xFFFFFFFFUL) &&
|
||||
(entryAddress != 0x00000000UL))
|
||||
{
|
||||
entryAddress |= 0x1U; // BLX instruction result in a UsageFault exception
|
||||
// if bit[0] of Rm is 0, where Rm holds the branch
|
||||
// address.
|
||||
//
|
||||
// If OTP is programmed, then call OTP patch function
|
||||
//
|
||||
((void (*)(void))entryAddress)();
|
||||
}
|
||||
|
||||
//
|
||||
// CM Boot State Machine
|
||||
//
|
||||
while(1)
|
||||
{
|
||||
switch(bootState)
|
||||
{
|
||||
case CMBROM_READBOOTMODE:
|
||||
//
|
||||
// Get boot mode selected
|
||||
//
|
||||
CMBROM_bootMode = HWREAD_IPCBOOTMODE_BOOTMODE;
|
||||
|
||||
//
|
||||
// Go to wait for command mode or run specified boot mode
|
||||
//
|
||||
if(CMBROM_bootMode == WAIT_FOR_COMMAND)
|
||||
{
|
||||
bootState = CMBROM_WAITFORCOMMAND;
|
||||
}
|
||||
else
|
||||
{
|
||||
bootState = CMBROM_RUNBOOTMODE;
|
||||
}
|
||||
break;
|
||||
case CMBROM_WAITFORCOMMAND:
|
||||
//
|
||||
// Enter wait loop until CPU1 sets IPCFLG0
|
||||
//
|
||||
CMBROM_waitForCommand();
|
||||
|
||||
//
|
||||
// Go read requested boot mode
|
||||
//
|
||||
bootState = CMBROM_READBOOTMODE;
|
||||
break;
|
||||
case CMBROM_RUNBOOTMODE:
|
||||
//
|
||||
// Run selected boot mode
|
||||
// Returns - Either return to wait or branch to app states
|
||||
//
|
||||
bootEntryAddress = CMBROM_runSelectedBootMode();
|
||||
|
||||
if(bootEntryAddress == CMBROM_RETURN_TO_WAITFORCOMMAND)
|
||||
{
|
||||
bootState = CMBROM_WAITFORCOMMAND;
|
||||
}
|
||||
else
|
||||
{
|
||||
bootState = CMBROM_BRANCHTOAPPLICATION;
|
||||
}
|
||||
break;
|
||||
default:
|
||||
//
|
||||
// Should never get here - Return to wait-for-command
|
||||
//
|
||||
bootState = CMBROM_WAITFORCOMMAND;
|
||||
break;
|
||||
}
|
||||
|
||||
if(bootState == CMBROM_BRANCHTOAPPLICATION)
|
||||
{
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
//
|
||||
// CM Patch/Escape Point 10
|
||||
//
|
||||
entryAddress = CMBROM_TI_OTP_ESCAPE_POINT_10;
|
||||
if((entryAddress != 0xFFFFFFFFUL) &&
|
||||
(entryAddress != 0x00000000UL))
|
||||
{
|
||||
entryAddress |= 0x1U; // BLX instruction result in a UsageFault exception
|
||||
// if bit[0] of Rm is 0, where Rm holds the branch
|
||||
// address.
|
||||
//
|
||||
// If OTP is programmed, then call OTP patch function
|
||||
//
|
||||
((void (*)(void))entryAddress)();
|
||||
}
|
||||
|
||||
//
|
||||
// Update boot status - Boot Complete
|
||||
//
|
||||
CMBROM_bootStatus |= CM_BOOTROM_BOOT_COMPLETE;
|
||||
|
||||
//
|
||||
// Update CM boot health status for CPU1
|
||||
//
|
||||
CMBROM_setIPCBootStatus();
|
||||
|
||||
//
|
||||
// Branch to application
|
||||
//
|
||||
bootEntryAddress |= 0x1U; // BLX instruction result in a UsageFault exception
|
||||
// if bit[0] of Rm is 0, where Rm holds the branch
|
||||
// address.
|
||||
((void (*)(void))bootEntryAddress)();
|
||||
|
||||
//
|
||||
// Enable Watchdog
|
||||
//
|
||||
SysCtl_enableWatchdog();
|
||||
|
||||
//
|
||||
// Should never be reached - if so, CM should be reset by watchdog
|
||||
//
|
||||
while(1)
|
||||
{
|
||||
}
|
||||
}
|
||||
|
||||
//
|
||||
// CMBROM_runSelectedBootMode - Run specified boot process for boot mode
|
||||
//
|
||||
uint32_t CMBROM_runSelectedBootMode(void)
|
||||
{
|
||||
uint32_t entryAddress = 0xFFFFFFFFUL;
|
||||
|
||||
//
|
||||
// Update boot status - Clear boot start before setting boot mode status
|
||||
//
|
||||
CMBROM_bootStatus &= ~CM_BOOTROM_BOOTSTS_MASK;
|
||||
|
||||
//
|
||||
// Clear previous status errors
|
||||
//
|
||||
CMBROM_bootStatus &= ~(CM_BOOTROM_FAILED_SECURE_FLASH_CMAC |
|
||||
CM_BOOTROM_GOT_AN_INVALID_IPC_BOOT_VALUE |
|
||||
CM_BOOTROM_MSG_RAM_COPY_LENGTH_INVALID);
|
||||
|
||||
//
|
||||
// CM Patch/Escape Point 6
|
||||
//
|
||||
entryAddress = CMBROM_TI_OTP_ESCAPE_POINT_6;
|
||||
if((entryAddress != 0xFFFFFFFFUL) &&
|
||||
(entryAddress != 0x00000000UL))
|
||||
{
|
||||
entryAddress |= 0x1U; // BLX instruction result in a UsageFault exception
|
||||
// if bit[0] of Rm is 0, where Rm holds the branch
|
||||
// address.
|
||||
//
|
||||
// If OTP is programmed, then call OTP patch function
|
||||
//
|
||||
((void (*)(void))entryAddress)();
|
||||
}
|
||||
|
||||
//
|
||||
// Run selected boot mode
|
||||
//
|
||||
switch(CMBROM_bootMode)
|
||||
{
|
||||
case WAIT_FOR_COMMAND:
|
||||
entryAddress = CMBROM_RETURN_TO_WAITFORCOMMAND;
|
||||
break;
|
||||
|
||||
case FLASH_BOOT:
|
||||
entryAddress = FLASH_ENTRY_POINT;
|
||||
CMBROM_bootStatus |= CM_BOOTROM_BOOTSTS_IN_FLASH_BOOT;
|
||||
break;
|
||||
|
||||
case FLASH_BOOT_ALT1:
|
||||
entryAddress = FLASH_ENTRY_POINT_ALT1;
|
||||
CMBROM_bootStatus |= CM_BOOTROM_BOOTSTS_IN_FLASH_BOOT;
|
||||
break;
|
||||
|
||||
case FLASH_BOOT_ALT2:
|
||||
entryAddress = FLASH_ENTRY_POINT_ALT2;
|
||||
CMBROM_bootStatus |= CM_BOOTROM_BOOTSTS_IN_FLASH_BOOT;
|
||||
break;
|
||||
|
||||
case FLASH_BOOT_ALT3:
|
||||
entryAddress = FLASH_ENTRY_POINT_ALT3;
|
||||
CMBROM_bootStatus |= CM_BOOTROM_BOOTSTS_IN_FLASH_BOOT;
|
||||
break;
|
||||
|
||||
case SECURE_FLASH_BOOT:
|
||||
entryAddress = FLASH_ENTRY_POINT;
|
||||
CMBROM_bootStatus |= CM_BOOTROM_BOOTSTS_IN_SECURE_FLASH_BOOT;
|
||||
//
|
||||
// Calculate CMAC and verify flash status based on CMAC.
|
||||
//
|
||||
if(CMBROM_verifySecureFlash(entryAddress) == SECURE_FLASH_BOOT_FAIL)
|
||||
{
|
||||
//
|
||||
// On CMAC failure, return to wait-for-command loop
|
||||
//
|
||||
entryAddress = CMBROM_RETURN_TO_WAITFORCOMMAND;
|
||||
}
|
||||
break;
|
||||
|
||||
case SECURE_FLASH_BOOT_ALT1:
|
||||
entryAddress = FLASH_ENTRY_POINT_ALT1;
|
||||
CMBROM_bootStatus |= CM_BOOTROM_BOOTSTS_IN_SECURE_FLASH_BOOT;
|
||||
//
|
||||
// Calculate CMAC and verify flash status based on CMAC.
|
||||
//
|
||||
if(CMBROM_verifySecureFlash(entryAddress) == SECURE_FLASH_BOOT_FAIL)
|
||||
{
|
||||
//
|
||||
// On CMAC failure, return to wait-for-command loop
|
||||
//
|
||||
entryAddress = CMBROM_RETURN_TO_WAITFORCOMMAND;
|
||||
}
|
||||
break;
|
||||
|
||||
case SECURE_FLASH_BOOT_ALT2:
|
||||
entryAddress = FLASH_ENTRY_POINT_ALT2;
|
||||
CMBROM_bootStatus |= CM_BOOTROM_BOOTSTS_IN_SECURE_FLASH_BOOT;
|
||||
//
|
||||
// Calculate CMAC and verify flash status based on CMAC.
|
||||
//
|
||||
if(CMBROM_verifySecureFlash(entryAddress) == SECURE_FLASH_BOOT_FAIL)
|
||||
{
|
||||
//
|
||||
// On CMAC failure, return to wait-for-command loop
|
||||
//
|
||||
entryAddress = CMBROM_RETURN_TO_WAITFORCOMMAND;
|
||||
}
|
||||
break;
|
||||
|
||||
case SECURE_FLASH_BOOT_ALT3:
|
||||
entryAddress = FLASH_ENTRY_POINT_ALT3;
|
||||
CMBROM_bootStatus |= CM_BOOTROM_BOOTSTS_IN_SECURE_FLASH_BOOT;
|
||||
//
|
||||
// Calculate CMAC and verify flash status based on CMAC.
|
||||
//
|
||||
if(CMBROM_verifySecureFlash(entryAddress) == SECURE_FLASH_BOOT_FAIL)
|
||||
{
|
||||
//
|
||||
// On CMAC failure, return to wait-for-command loop
|
||||
//
|
||||
entryAddress = CMBROM_RETURN_TO_WAITFORCOMMAND;
|
||||
}
|
||||
break;
|
||||
|
||||
case RAM_BOOT:
|
||||
entryAddress = S0RAM_ENTRY_POINT;
|
||||
CMBROM_bootStatus |= CM_BOOTROM_BOOTSTS_IN_RAM_BOOT;
|
||||
break;
|
||||
|
||||
case USER_OTP_BOOT:
|
||||
entryAddress = USER_OTP_ENTRY_POINT;
|
||||
CMBROM_bootStatus |= CM_BOOTROM_BOOTSTS_IN_OTP_BOOT;
|
||||
break;
|
||||
|
||||
case IPC_MSG_COPY_BOOT:
|
||||
entryAddress = S0RAM_ENTRY_POINT;
|
||||
CMBROM_bootStatus |= CM_BOOTROM_BOOTSTS_IN_IPC_MSG_RAM_BOOT;
|
||||
|
||||
//
|
||||
// Determine if IPC MSG RAM Copy length is valid before running
|
||||
// boot mode
|
||||
//
|
||||
if((HWREAD_IPCBOOTMODE_COPY_LENGTH > IPC_MSG_COPY_BOOT_MIN_LENGTH) &&
|
||||
(HWREAD_IPCBOOTMODE_COPY_LENGTH <= IPC_MSG_COPY_BOOT_MAX_LENGTH))
|
||||
{
|
||||
//
|
||||
// Copy from CPU1-to-CM Message RAM 1 to S0RAM
|
||||
//
|
||||
CMBROM_performCopyToRAM(entryAddress,
|
||||
HWREAD_IPCBOOTMODE_COPY_LENGTH);
|
||||
}
|
||||
else
|
||||
{
|
||||
//
|
||||
// Copy length set incorrectly, notify CPU1 and return to
|
||||
// wait-for-command mode
|
||||
//
|
||||
(void)CMBROM_sendErrorIPC(CMTOCPU1_BOOTROM_BOOT_CMD_INVALID,
|
||||
NO_ADDRESS_DATA);
|
||||
CMBROM_bootStatus |= CM_BOOTROM_MSG_RAM_COPY_LENGTH_INVALID;
|
||||
|
||||
entryAddress = CMBROM_RETURN_TO_WAITFORCOMMAND;
|
||||
}
|
||||
break;
|
||||
|
||||
default:
|
||||
//
|
||||
// Incorrect value - Notify CPU1 and return to wait-for-command mode
|
||||
//
|
||||
entryAddress = CMBROM_RETURN_TO_WAITFORCOMMAND;
|
||||
(void)CMBROM_sendErrorIPC(CMTOCPU1_BOOTROM_BOOT_CMD_INVALID,
|
||||
NO_ADDRESS_DATA);
|
||||
CMBROM_bootStatus |= CM_BOOTROM_GOT_AN_INVALID_IPC_BOOT_VALUE;
|
||||
break;
|
||||
}
|
||||
|
||||
//
|
||||
// Update latest CM boot status for CPU1
|
||||
//
|
||||
CMBROM_setIPCBootStatus();
|
||||
|
||||
return(entryAddress);
|
||||
}
|
||||
|
||||
//
|
||||
// CMBROM_waitForCommand - Loop indefinitely until CPU1 sets IPCFLG0
|
||||
//
|
||||
void CMBROM_waitForCommand(void)
|
||||
{
|
||||
uint32_t entryAddress = 0xFFFFFFFFUL;
|
||||
|
||||
//
|
||||
// Update boot status - Clear boot start before setting boot mode status
|
||||
//
|
||||
CMBROM_bootStatus &= ~CM_BOOTROM_BOOTSTS_MASK;
|
||||
CMBROM_bootStatus |= CM_BOOTROM_BOOTSTS_IN_WAIT_BOOT;
|
||||
CMBROM_setIPCBootStatus();
|
||||
|
||||
//
|
||||
// CM Patch/Escape Point 7
|
||||
//
|
||||
entryAddress = CMBROM_TI_OTP_ESCAPE_POINT_7;
|
||||
if((entryAddress != 0xFFFFFFFFUL) &&
|
||||
(entryAddress != 0x00000000UL))
|
||||
{
|
||||
entryAddress |= 0x1U; // BLX instruction result in a UsageFault exception
|
||||
// if bit[0] of Rm is 0, where Rm holds the branch
|
||||
// address.
|
||||
//
|
||||
// If OTP is programmed, then call OTP patch function
|
||||
//
|
||||
((void (*)(void))entryAddress)();
|
||||
}
|
||||
|
||||
while(1)
|
||||
{
|
||||
//
|
||||
// Wait for CPU1 to set flag 0 to signal the IPCBOOTMODE is ready
|
||||
//
|
||||
if((HWREG(IPC_CMTOCPU1_BASE + IPC_O_CPU1TOCMIPCSTS) & IPC_CPU1TOCMIPCSTS_IPC0) == IPC_CPU1TOCMIPCSTS_IPC0)
|
||||
{
|
||||
//
|
||||
// ACK CPU1 Flag
|
||||
//
|
||||
HWREG(IPC_CMTOCPU1_BASE + IPC_O_CMTOCPU1IPCACK) |= IPC_CMTOCPU1IPCACK_IPC0;
|
||||
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
//
|
||||
// Verify Secure Flash for Boot
|
||||
//
|
||||
// Param - entryAddress is the flash memory entry address that
|
||||
// will be branched to
|
||||
//
|
||||
// This function runs the secure flash verification procedure.
|
||||
// A CMAC calculation is run on the 16KB of flash, starting at the
|
||||
// entry address provided. If the CMAC calculation passes, this function
|
||||
// returns and the boot process continues to branch to entry point.
|
||||
// If the CMAC calculation fails, this function sends an IPC message
|
||||
// notifying CPU1 and returns .
|
||||
//
|
||||
// Return -
|
||||
// 0x00000000UL - secure flash is verified and ready to be booted
|
||||
// 0xFFFFFFFFUL - secure flash failed to verify
|
||||
//
|
||||
|
||||
uint32_t CMBROM_verifySecureFlash(uint32_t entryAddress)
|
||||
{
|
||||
uint32_t escapeEntryAddress = 0xFFFFFFFFUL;
|
||||
|
||||
//
|
||||
// CM Patch/Escape Point 8
|
||||
//
|
||||
escapeEntryAddress = CMBROM_TI_OTP_ESCAPE_POINT_8;
|
||||
if((escapeEntryAddress != 0xFFFFFFFFUL) &&
|
||||
(escapeEntryAddress != 0x00000000UL))
|
||||
{
|
||||
escapeEntryAddress |= 0x1U; // BLX instruction result in a UsageFault exception
|
||||
// if bit[0] of Rm is 0, where Rm holds the branch
|
||||
// address.
|
||||
//
|
||||
// If OTP is programmed, then call OTP patch function
|
||||
//
|
||||
((void (*)(void))escapeEntryAddress)();
|
||||
}
|
||||
|
||||
//
|
||||
// Calculate CMAC on entry pointer address + 16KB
|
||||
//
|
||||
|
||||
//
|
||||
// Calculate CMAC
|
||||
// - Calculation starts at entryAddress
|
||||
// - End address of calculation is entryAddress + 16KB (16384 bytes)
|
||||
// (CMAC is calculated from start address to (end address - 3)
|
||||
// - Golden CMAC signature is always stored at entryAddress + 4 bytes
|
||||
// (Signature will be considered all 1s in calculation)
|
||||
//
|
||||
|
||||
//
|
||||
// DEBUG ONLY - Using standard test vectors/cases (1 to 10)
|
||||
//
|
||||
//if(CMBROM_calculateCMAC(entryAddress, (entryAddress + HWREG(entryAddress - 0x14)),(entryAddress - 0x10)) != 0x0U)
|
||||
|
||||
//
|
||||
// DEBUG ONLY - Using embedded golden sig test vectors/cases (1 to 4)
|
||||
//
|
||||
//if(CMBROM_calculateCMAC(entryAddress, (entryAddress + HWREG(entryAddress - 0x4)),(entryAddress + HWREG(entryAddress - 0x8))) != 0x0U)
|
||||
|
||||
if(CMBROM_calculateCMAC(entryAddress, (entryAddress + 0x4000U),(entryAddress + 0x4U)) != 0x0U)
|
||||
{
|
||||
//
|
||||
// CMAC failed, send IPC to CPU1
|
||||
//
|
||||
(void)CMBROM_sendErrorIPC(CMTOCPU1_BOOTROM_FAILED_CMAC, NO_ADDRESS_DATA);
|
||||
CMBROM_bootStatus |= CM_BOOTROM_FAILED_SECURE_FLASH_CMAC;
|
||||
|
||||
return(SECURE_FLASH_BOOT_FAIL);
|
||||
}
|
||||
else
|
||||
{
|
||||
//
|
||||
// CMAC passed
|
||||
//
|
||||
return(SECURE_FLASH_BOOT_PASS);
|
||||
}
|
||||
}
|
||||
|
||||
//
|
||||
// End of file
|
||||
//
|
||||
|
||||
+113
@@ -0,0 +1,113 @@
|
||||
;;###########################################################################
|
||||
;;
|
||||
;; FILE: cmbrom_vector_table.s
|
||||
;;
|
||||
;; TITLE: CM Boot ROM vector table.
|
||||
;;
|
||||
;; This section of code populates the vector table in the boot ROM.
|
||||
;;
|
||||
;;###########################################################################
|
||||
;; $TI Release: $
|
||||
;; $Release Date: $
|
||||
;;###########################################################################
|
||||
|
||||
;
|
||||
; Globals
|
||||
;
|
||||
.global Vectors
|
||||
.ref CM_resetISR
|
||||
.ref CMBROM_nmiHandler
|
||||
.ref CMBROM_hardFaultISR
|
||||
.ref CMBROM_defaultHandler
|
||||
|
||||
.sect ".BootVecs"
|
||||
|
||||
;
|
||||
; The minimal vector table for a Cortex-M4 processor.
|
||||
;
|
||||
Vectors:
|
||||
.word 0x20000800 ;; Offset 00: Initial stack pointer -0 = vector no
|
||||
.word CM_resetISR ;; Offset 04: Reset handler -1
|
||||
.word CMBROM_nmiHandler ;; Offset 08: NMI handler -2
|
||||
.word CMBROM_hardFaultISR ;; Offset 0C: Hard fault handler -3
|
||||
.word CMBROM_defaultHandler ;; Offset 10: MemManage fault handler -4
|
||||
.word CMBROM_defaultHandler ;; Offset 14: Bus fault handler -5
|
||||
.word CMBROM_defaultHandler ;; Offset 18: Usage fault handler -6
|
||||
.word 0 ;; Offset 1C: Reserved -7
|
||||
.word 0 ;; Offset 20: Reserved -8
|
||||
.word 0 ;; Offset 24: Reserved -9
|
||||
.word 0 ;; Offset 28: Reserved -10
|
||||
.word CMBROM_defaultHandler ;; Offset 2C: SVCall handler -11
|
||||
.word CMBROM_defaultHandler ;; Offset 30: Debug monitor handler -12
|
||||
.word 0 ;; Offset 34: Reserved -13
|
||||
.word CMBROM_defaultHandler ;; Offset 38: PendSV handler -14
|
||||
.word CMBROM_defaultHandler ;; Offset 3C: SysTick handler -15
|
||||
.word CMBROM_defaultHandler ;; Offset 40: MCAN INT0 -16
|
||||
.word CMBROM_defaultHandler ;; Offset 44: MCAN INT1 -17
|
||||
.word CMBROM_defaultHandler ;; Offset 48: MCAN WAKE and TS PLS INT -18
|
||||
.word CMBROM_defaultHandler ;; Offset 4C: MCAN ECC CORR LVL INT -19
|
||||
.word CMBROM_defaultHandler ;; Offset 50: reserved -20
|
||||
.word CMBROM_defaultHandler ;; Offset 54: ECAT INT -21
|
||||
.word CMBROM_defaultHandler ;; Offset 58: ECAT SYNC0 INT -22
|
||||
.word CMBROM_defaultHandler ;; Offset 5C: ECAT SYNC1 INT -23
|
||||
.word CMBROM_defaultHandler ;; Offset 60: ECAT RST INT -24
|
||||
.word CMBROM_defaultHandler ;; Offset 64: CANA INT0 -25
|
||||
.word CMBROM_defaultHandler ;; Offset 68: CANA INT1 -26
|
||||
.word CMBROM_defaultHandler ;; Offset 6C: CANB INT0 -27
|
||||
.word CMBROM_defaultHandler ;; Offset 70: CANB INT1 -28
|
||||
.word CMBROM_defaultHandler ;; Offset 74: EMAC INT -29
|
||||
.word CMBROM_defaultHandler ;; Offset 78: EMAC TX INT0 -30
|
||||
.word CMBROM_defaultHandler ;; Offset 7C: EMAC TX INT1 -31
|
||||
.word CMBROM_defaultHandler ;; Offset 80: EMAC RX INT0 -32
|
||||
.word CMBROM_defaultHandler ;; Offset 84: EMAC RX INT1 -33
|
||||
.word CMBROM_defaultHandler ;; Offset 88: UART0 INT -34
|
||||
.word CMBROM_defaultHandler ;; Offset 8C: reserved -35
|
||||
.word CMBROM_defaultHandler ;; Offset 90: SSI0 INT -36
|
||||
.word CMBROM_defaultHandler ;; Offset 94: reserved -37
|
||||
.word CMBROM_defaultHandler ;; Offset 98: I2C0 INT -38
|
||||
.word CMBROM_defaultHandler ;; Offset 9C: reserved -39
|
||||
.word CMBROM_defaultHandler ;; Offset A0: USB INT -40
|
||||
.word CMBROM_defaultHandler ;; Offset A4: UDMA SW INT -41
|
||||
.word CMBROM_defaultHandler ;; Offset A8: UDMA ERR INT -42
|
||||
.word CMBROM_defaultHandler ;; Offset AC: reserved -43
|
||||
.word CMBROM_defaultHandler ;; Offset B0: reserved -44
|
||||
.word CMBROM_defaultHandler ;; Offset B4: CPU1 to CM IPC INT0 -45
|
||||
.word CMBROM_defaultHandler ;; Offset B8: CPU1 to CM IPC INT1 -46
|
||||
.word CMBROM_defaultHandler ;; Offset BC: CPU1 to CM IPC INT2 -47
|
||||
.word CMBROM_defaultHandler ;; Offset C0: CPU1 to CM IPC INT3 -48
|
||||
.word CMBROM_defaultHandler ;; Offset C4: CPU1 to CM IPC INT4 -49
|
||||
.word CMBROM_defaultHandler ;; Offset C8: CPU1 to CM IPC INT5 -50
|
||||
.word CMBROM_defaultHandler ;; Offset CC: CPU1 to CM IPC INT6 -51
|
||||
.word CMBROM_defaultHandler ;; Offset D0: CPU1 to CM IPC INT7 -52
|
||||
.word CMBROM_defaultHandler ;; Offset D4: CPU2 to CM IPC INT0 -53
|
||||
.word CMBROM_defaultHandler ;; Offset D8: CPU2 to CM IPC INT1 -54
|
||||
.word CMBROM_defaultHandler ;; Offset DC: CPU2 to CM IPC INT2 -55
|
||||
.word CMBROM_defaultHandler ;; Offset E0: CPU2 to CM IPC INT3 -56
|
||||
.word CMBROM_defaultHandler ;; Offset E4: CPU2 to CM IPC INT4 -56
|
||||
.word CMBROM_defaultHandler ;; Offset E8: CPU2 to CM IPC INT5 -58
|
||||
.word CMBROM_defaultHandler ;; Offset EC: CPU2 to CM IPC INT6 -59
|
||||
.word CMBROM_defaultHandler ;; Offset F0: CPU2 to CM IPC INT7 -60
|
||||
.word CMBROM_defaultHandler ;; Offset F4: FMC INT -61
|
||||
.word CMBROM_defaultHandler ;; Offset F8: FMC Correctable Error INT -62
|
||||
.word CMBROM_defaultHandler ;; Offset FC: AES INT -63
|
||||
.word CMBROM_defaultHandler ;; Offset 100: CPU Timer 1 -64
|
||||
.word CMBROM_defaultHandler ;; Offset 104: CPU Timer 2 -65
|
||||
.word CMBROM_defaultHandler ;; Offset 108: CPU Timer 3 -66
|
||||
.word CMBROM_defaultHandler ;; Offset 10C: CM RAM TEST ERROR LOG -67
|
||||
.word CMBROM_defaultHandler ;; Offset 110: reserved -68
|
||||
.word CMBROM_defaultHandler ;; Offset 114: reserved -69
|
||||
.word CMBROM_defaultHandler ;; Offset 118: reserved -70
|
||||
.word CMBROM_defaultHandler ;; Offset 11C: reserved -71
|
||||
.word CMBROM_defaultHandler ;; Offset 120: reserved -72
|
||||
.word CMBROM_defaultHandler ;; Offset 124: reserved -73
|
||||
.word CMBROM_defaultHandler ;; Offset 128: reserved -74
|
||||
.word CMBROM_defaultHandler ;; Offset 12C: reserved -75
|
||||
.word CMBROM_defaultHandler ;; Offset 130: reserved -76
|
||||
.word CMBROM_defaultHandler ;; Offset 134: reserved -77
|
||||
.word CMBROM_defaultHandler ;; Offset 138: reserved -78
|
||||
.word CMBROM_defaultHandler ;; Offset 13C: reserved -79
|
||||
|
||||
;
|
||||
; End of file
|
||||
;
|
||||
.end
|
||||
+574
@@ -0,0 +1,574 @@
|
||||
//###########################################################################
|
||||
//
|
||||
// FILE: aes.c
|
||||
//
|
||||
// TITLE: Driver for the AES module.
|
||||
//
|
||||
//###########################################################################
|
||||
// $TI Release: $
|
||||
// $Release Date: $
|
||||
//
|
||||
// C2000Ware v5.04.00.00
|
||||
//
|
||||
// Copyright (C) 2024 Texas Instruments Incorporated - http://www.ti.com
|
||||
//
|
||||
// Redistribution and use in source and binary forms, with or without
|
||||
// modification, are permitted provided that the following conditions
|
||||
// are met:
|
||||
//
|
||||
// Redistributions of source code must retain the above copyright
|
||||
// notice, this list of conditions and the following disclaimer.
|
||||
//
|
||||
// Redistributions in binary form must reproduce the above copyright
|
||||
// notice, this list of conditions and the following disclaimer in the
|
||||
// documentation and/or other materials provided with the
|
||||
// distribution.
|
||||
//
|
||||
// Neither the name of Texas Instruments Incorporated nor the names of
|
||||
// its contributors may be used to endorse or promote products derived
|
||||
// from this software without specific prior written permission.
|
||||
//
|
||||
// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
|
||||
// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
|
||||
// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
|
||||
// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
|
||||
// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
|
||||
// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
|
||||
// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
|
||||
// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
|
||||
// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
||||
// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
|
||||
// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
// $
|
||||
//###########################################################################
|
||||
|
||||
#include "aes.h"
|
||||
|
||||
//*****************************************************************************
|
||||
//
|
||||
// AES_configureModule
|
||||
//
|
||||
//*****************************************************************************
|
||||
void
|
||||
AES_configureModule(uint32_t base, const AES_ConfigParams* config)
|
||||
{
|
||||
//
|
||||
// Check the arguments.
|
||||
//
|
||||
ASSERT(AES_isBaseValid(base));
|
||||
|
||||
//
|
||||
// Write the ctrl register with new value and backup the save context field
|
||||
//
|
||||
HWREG(base + AES_O_S_AES_CTRL) = ((HWREG(base + AES_O_S_AES_CTRL) &
|
||||
~AES_CONFIG_M) | (config->direction |
|
||||
config->keySize | config-> opMode |
|
||||
config->ctrWidth | config->ccmLenWidth |
|
||||
config->ccmAuthLenWidth));
|
||||
}
|
||||
|
||||
//*****************************************************************************
|
||||
//
|
||||
// AES_setKey1
|
||||
//
|
||||
//*****************************************************************************
|
||||
void
|
||||
AES_setKey1(uint32_t base, const uint32_t key[], AES_KeySize keySize)
|
||||
{
|
||||
//
|
||||
// Check the arguments.
|
||||
//
|
||||
ASSERT(AES_isBaseValid(base));
|
||||
|
||||
//
|
||||
// With all key sizes, the first 4 words are written.
|
||||
//
|
||||
HWREG(base + AES_O_S_AES_KEY1_0) = key[0U];
|
||||
HWREG(base + AES_O_S_AES_KEY1_1) = key[1U];
|
||||
HWREG(base + AES_O_S_AES_KEY1_2) = key[2U];
|
||||
HWREG(base + AES_O_S_AES_KEY1_3) = key[3U];
|
||||
|
||||
//
|
||||
// The key is 192 or 256 bits. Write the next 2 words.
|
||||
//
|
||||
if(keySize != AES_KEY_SIZE_128BIT)
|
||||
{
|
||||
HWREG(base + AES_O_S_AES_KEY1_4) = key[4U];
|
||||
HWREG(base + AES_O_S_AES_KEY1_5) = key[5U];
|
||||
}
|
||||
|
||||
//
|
||||
// The key is 256 bits. Write the last 2 words.
|
||||
//
|
||||
if(keySize == AES_KEY_SIZE_256BIT)
|
||||
{
|
||||
HWREG(base + AES_O_S_AES_KEY1_6) = key[6U];
|
||||
HWREG(base + AES_O_S_AES_KEY1_7) = key[7U];
|
||||
}
|
||||
}
|
||||
|
||||
//*****************************************************************************
|
||||
//
|
||||
// AES_setKey2
|
||||
//
|
||||
//*****************************************************************************
|
||||
void
|
||||
AES_setKey2(uint32_t base, const uint32_t key[], AES_KeySize keySize)
|
||||
{
|
||||
//
|
||||
// Check the arguments.
|
||||
//
|
||||
ASSERT(AES_isBaseValid(base));
|
||||
|
||||
//
|
||||
// With all key sizes, the first 4 words are written.
|
||||
//
|
||||
HWREG(base + AES_O_S_AES_KEY2_0) = key[0U];
|
||||
HWREG(base + AES_O_S_AES_KEY2_1) = key[1U];
|
||||
HWREG(base + AES_O_S_AES_KEY2_2) = key[2U];
|
||||
HWREG(base + AES_O_S_AES_KEY2_3) = key[3U];
|
||||
|
||||
//
|
||||
// The key is 192 or 256 bits. Write the next 2 words.
|
||||
//
|
||||
if(keySize != AES_KEY_SIZE_128BIT)
|
||||
{
|
||||
HWREG(base + AES_O_S_AES_KEY2_4) = key[4U];
|
||||
HWREG(base + AES_O_S_AES_KEY2_5) = key[5U];
|
||||
}
|
||||
|
||||
//
|
||||
// The key is 256 bits. Write the last 2 words.
|
||||
//
|
||||
if(keySize == AES_KEY_SIZE_256BIT)
|
||||
{
|
||||
HWREG(base + AES_O_S_AES_KEY2_6) = key[6U];
|
||||
HWREG(base + AES_O_S_AES_KEY2_7) = key[7U];
|
||||
}
|
||||
}
|
||||
|
||||
//*****************************************************************************
|
||||
//
|
||||
// AES_setKey3
|
||||
//
|
||||
//*****************************************************************************
|
||||
void
|
||||
AES_setKey3(uint32_t base, const uint32_t key[])
|
||||
{
|
||||
//
|
||||
// Check the arguments.
|
||||
//
|
||||
ASSERT(AES_isBaseValid(base));
|
||||
|
||||
//
|
||||
// With all key sizes, the first 4 words are written.
|
||||
//
|
||||
HWREG(base + AES_O_S_AES_KEY2_4) = key[0U];
|
||||
HWREG(base + AES_O_S_AES_KEY2_5) = key[1U];
|
||||
HWREG(base + AES_O_S_AES_KEY2_6) = key[2U];
|
||||
HWREG(base + AES_O_S_AES_KEY2_7) = key[3U];
|
||||
}
|
||||
|
||||
//*****************************************************************************
|
||||
//
|
||||
// AES_setInitializationVector
|
||||
//
|
||||
//*****************************************************************************
|
||||
void
|
||||
AES_setInitializationVector(uint32_t base, const uint32_t iniVector[])
|
||||
{
|
||||
//
|
||||
// Check the arguments.
|
||||
//
|
||||
ASSERT(AES_isBaseValid(base));
|
||||
|
||||
//
|
||||
// Set Initialization vector.
|
||||
//
|
||||
HWREG(base + AES_O_S_AES_IV_IN_OUT_0) = iniVector[0U];
|
||||
HWREG(base + AES_O_S_AES_IV_IN_OUT_1) = iniVector[1U];
|
||||
HWREG(base + AES_O_S_AES_IV_IN_OUT_2) = iniVector[2U];
|
||||
HWREG(base + AES_O_S_AES_IV_IN_OUT_3) = iniVector[3U];
|
||||
}
|
||||
|
||||
//*****************************************************************************
|
||||
//
|
||||
// AES_readInitializationVector
|
||||
//
|
||||
//*****************************************************************************
|
||||
void
|
||||
AES_readInitializationVector(uint32_t base, uint32_t iniVector[])
|
||||
{
|
||||
//
|
||||
// Check the arguments.
|
||||
//
|
||||
ASSERT(AES_isBaseValid(base));
|
||||
|
||||
//
|
||||
// Read the initialization vector
|
||||
//
|
||||
iniVector[0U] = HWREG(base + AES_O_S_AES_IV_IN_OUT_0);
|
||||
iniVector[1U] = HWREG(base + AES_O_S_AES_IV_IN_OUT_1);
|
||||
iniVector[2U] = HWREG(base + AES_O_S_AES_IV_IN_OUT_2);
|
||||
iniVector[3U] = HWREG(base + AES_O_S_AES_IV_IN_OUT_3);
|
||||
|
||||
}
|
||||
|
||||
//*****************************************************************************
|
||||
//
|
||||
// AES_readTag
|
||||
//
|
||||
//*****************************************************************************
|
||||
void
|
||||
AES_readTag(uint32_t base, uint32_t tagData[])
|
||||
{
|
||||
//
|
||||
// Check the arguments.
|
||||
//
|
||||
ASSERT(AES_isBaseValid(base));
|
||||
|
||||
//
|
||||
// Wait for the output context to be ready.
|
||||
//
|
||||
while((AES_S_AES_CTRL_SVCTXTRDY & (HWREG(base + AES_O_S_AES_CTRL))) !=
|
||||
AES_S_AES_CTRL_SVCTXTRDY)
|
||||
{
|
||||
}
|
||||
|
||||
//
|
||||
// Read the tag data.
|
||||
//
|
||||
tagData[0U] = HWREG(base + AES_O_S_AES_TAG_OUT_0);
|
||||
tagData[1U] = HWREG(base + AES_O_S_AES_TAG_OUT_1);
|
||||
tagData[2U] = HWREG(base + AES_O_S_AES_TAG_OUT_2);
|
||||
tagData[3U] = HWREG(base + AES_O_S_AES_TAG_OUT_3);
|
||||
}
|
||||
|
||||
//*****************************************************************************
|
||||
//
|
||||
// AES_readDataNonBlocking
|
||||
//
|
||||
//*****************************************************************************
|
||||
bool
|
||||
AES_readDataNonBlocking(uint32_t base, uint32_t destArray[])
|
||||
{
|
||||
bool temp;
|
||||
//
|
||||
// Check the arguments.
|
||||
//
|
||||
ASSERT(AES_isBaseValid(base));
|
||||
|
||||
//
|
||||
// Check if the output is ready before reading the data. If it is not
|
||||
// ready, return false.
|
||||
//
|
||||
if((AES_S_AES_CTRL_OUTPUT_READY & (HWREG(base + AES_O_S_AES_CTRL))) !=
|
||||
AES_S_AES_CTRL_OUTPUT_READY)
|
||||
{
|
||||
temp = false;
|
||||
}
|
||||
else
|
||||
{
|
||||
//
|
||||
// Read a block of data from the data registers
|
||||
//
|
||||
destArray[0U] = HWREG(base + AES_O_S_AES_DATA_IN_OUT_3);
|
||||
destArray[1U] = HWREG(base + AES_O_S_AES_DATA_IN_OUT_2);
|
||||
destArray[2U] = HWREG(base + AES_O_S_AES_DATA_IN_OUT_1);
|
||||
destArray[3U] = HWREG(base + AES_O_S_AES_DATA_IN_OUT_0);
|
||||
//
|
||||
// Read successful, return true.
|
||||
//
|
||||
temp = true;
|
||||
}
|
||||
return(temp);
|
||||
}
|
||||
|
||||
//*****************************************************************************
|
||||
//
|
||||
// AES_readDataBlocking
|
||||
//
|
||||
//*****************************************************************************
|
||||
void
|
||||
AES_readDataBlocking(uint32_t base, uint32_t *destArray)
|
||||
{
|
||||
//
|
||||
// Check the arguments.
|
||||
//
|
||||
ASSERT(AES_isBaseValid(base));
|
||||
|
||||
//
|
||||
// Wait for the output to be ready before reading the data.
|
||||
//
|
||||
while((AES_S_AES_CTRL_OUTPUT_READY & (HWREG(base + AES_O_S_AES_CTRL))) !=
|
||||
AES_S_AES_CTRL_OUTPUT_READY)
|
||||
{
|
||||
}
|
||||
|
||||
//
|
||||
// Read a block of data from the data registers
|
||||
//
|
||||
destArray[0U] = HWREG(base + AES_O_S_AES_DATA_IN_OUT_3);
|
||||
destArray[1U] = HWREG(base + AES_O_S_AES_DATA_IN_OUT_2);
|
||||
destArray[2U] = HWREG(base + AES_O_S_AES_DATA_IN_OUT_1);
|
||||
destArray[3U] = HWREG(base + AES_O_S_AES_DATA_IN_OUT_0);
|
||||
}
|
||||
|
||||
//*****************************************************************************
|
||||
//
|
||||
// AES_writeDataNonBlocking
|
||||
//
|
||||
//*****************************************************************************
|
||||
bool
|
||||
AES_writeDataNonBlocking(uint32_t base, const uint32_t srcArray[])
|
||||
{
|
||||
bool temp;
|
||||
//
|
||||
// Check the arguments.
|
||||
//
|
||||
ASSERT(AES_isBaseValid(base));
|
||||
|
||||
//
|
||||
// Check if the input is ready. If not, then return false.
|
||||
//
|
||||
if((AES_S_AES_CTRL_INPUT_READY & (HWREG(base + AES_O_S_AES_CTRL))) !=
|
||||
AES_S_AES_CTRL_INPUT_READY)
|
||||
{
|
||||
temp = false;
|
||||
}
|
||||
else
|
||||
{
|
||||
//
|
||||
// Write a block of data into the data registers.
|
||||
//
|
||||
HWREG(base + AES_O_S_AES_DATA_IN_OUT_3) = srcArray[0U];
|
||||
HWREG(base + AES_O_S_AES_DATA_IN_OUT_2) = srcArray[1U];
|
||||
HWREG(base + AES_O_S_AES_DATA_IN_OUT_1) = srcArray[2U];
|
||||
HWREG(base + AES_O_S_AES_DATA_IN_OUT_0) = srcArray[3U];
|
||||
|
||||
//
|
||||
// Write successful, return true.
|
||||
//
|
||||
temp = true;
|
||||
}
|
||||
return(temp);
|
||||
}
|
||||
|
||||
//*****************************************************************************
|
||||
//
|
||||
// AES_writeDataBlocking
|
||||
//
|
||||
//*****************************************************************************
|
||||
void
|
||||
AES_writeDataBlocking(uint32_t base, const uint32_t srcArray[])
|
||||
{
|
||||
//
|
||||
// Check the arguments.
|
||||
//
|
||||
ASSERT(AES_isBaseValid(base));
|
||||
|
||||
//
|
||||
// Wait for input ready.
|
||||
//
|
||||
while((AES_S_AES_CTRL_INPUT_READY & (HWREG(base + AES_O_S_AES_CTRL))) !=
|
||||
AES_S_AES_CTRL_INPUT_READY)
|
||||
{
|
||||
}
|
||||
|
||||
//
|
||||
// Write a block of data into the data registers.
|
||||
//
|
||||
HWREG(base + AES_O_S_AES_DATA_IN_OUT_3) = srcArray[0U];
|
||||
HWREG(base + AES_O_S_AES_DATA_IN_OUT_2) = srcArray[1U];
|
||||
HWREG(base + AES_O_S_AES_DATA_IN_OUT_1) = srcArray[2U];
|
||||
HWREG(base + AES_O_S_AES_DATA_IN_OUT_0) = srcArray[3U];
|
||||
}
|
||||
|
||||
//*****************************************************************************
|
||||
//
|
||||
// AES_processData
|
||||
//
|
||||
//*****************************************************************************
|
||||
bool
|
||||
AES_processData(uint32_t base, const uint32_t srcArray[], uint32_t destArray[],
|
||||
uint64_t dataLength)
|
||||
{
|
||||
uint32_t count;
|
||||
|
||||
//
|
||||
// Check the arguments.
|
||||
//
|
||||
ASSERT(AES_isBaseValid(base));
|
||||
|
||||
//
|
||||
// Write the length register first, which triggers the engine to start
|
||||
// using this context.
|
||||
//
|
||||
AES_setDataLength(base, dataLength);
|
||||
|
||||
//
|
||||
// Now loop until the blocks are written.
|
||||
//
|
||||
for(count = 0U; count < dataLength; count += 16U)
|
||||
{
|
||||
//
|
||||
// Write the data registers.
|
||||
//
|
||||
AES_writeDataBlocking(base, srcArray + (count / 4U));
|
||||
|
||||
//
|
||||
// Read the data registers.
|
||||
//
|
||||
AES_readDataBlocking(base, destArray + (count / 4U));
|
||||
}
|
||||
|
||||
//
|
||||
// Return true to indicate successful completion of the function.
|
||||
//
|
||||
return(true);
|
||||
}
|
||||
|
||||
//*****************************************************************************
|
||||
//
|
||||
// AES_authenticateData
|
||||
//
|
||||
//*****************************************************************************
|
||||
bool
|
||||
AES_authenticateData(uint32_t base, const uint32_t srcArray[],
|
||||
uint64_t dataLength, uint32_t tagArray[])
|
||||
{
|
||||
uint32_t count;
|
||||
|
||||
//
|
||||
// Check the arguments.
|
||||
//
|
||||
ASSERT(AES_isBaseValid(base));
|
||||
|
||||
//
|
||||
// Write the length register first, which triggers the engine to start
|
||||
// using this context.
|
||||
//
|
||||
AES_setDataLength(base, dataLength);
|
||||
|
||||
//
|
||||
// Now loop until the blocks are written.
|
||||
//
|
||||
for(count = 0U; count < dataLength; count += 16U)
|
||||
{
|
||||
//
|
||||
// Write the data registers.
|
||||
//
|
||||
AES_writeDataBlocking(base, srcArray + (count / 4U));
|
||||
}
|
||||
|
||||
//
|
||||
// Read the hash tag value.
|
||||
//
|
||||
AES_readTag(base, tagArray);
|
||||
|
||||
//
|
||||
// Return true to indicate successful completion of the function.
|
||||
//
|
||||
return(true);
|
||||
}
|
||||
|
||||
//*****************************************************************************
|
||||
//
|
||||
// AES_processDatainAuthMode
|
||||
//
|
||||
//*****************************************************************************
|
||||
bool
|
||||
AES_processDatainAuthMode(uint32_t base, const uint32_t srcArray[],
|
||||
uint32_t destArray[], uint64_t dataLength,
|
||||
const uint32_t authDataArray[],
|
||||
uint32_t authDataLength, uint32_t tagArray[])
|
||||
{
|
||||
uint32_t count;
|
||||
|
||||
//
|
||||
// Check the arguments.
|
||||
//
|
||||
ASSERT(AES_isBaseValid(base));
|
||||
|
||||
//
|
||||
// Set the data length.
|
||||
//
|
||||
AES_setDataLength(base, dataLength);
|
||||
|
||||
//
|
||||
// Set the additional authentication data length.
|
||||
//
|
||||
AES_setAuthDataLength(base, authDataLength);
|
||||
|
||||
//
|
||||
// Now loop until the authentication data blocks are written.
|
||||
//
|
||||
for(count = 0U; count < authDataLength; count += 16U)
|
||||
{
|
||||
//
|
||||
// Write the data registers.
|
||||
//
|
||||
AES_writeDataBlocking(base, authDataArray + (count / 4U));
|
||||
}
|
||||
|
||||
//
|
||||
// Now loop until the data blocks are written.
|
||||
//
|
||||
for(count = 0U; count < dataLength; count += 16U)
|
||||
{
|
||||
//
|
||||
// Write the data registers.
|
||||
//
|
||||
AES_writeDataBlocking(base, srcArray + (count / 4U));
|
||||
|
||||
//
|
||||
//
|
||||
// Read the data registers.
|
||||
//
|
||||
AES_readDataBlocking(base, destArray + (count / 4U));
|
||||
}
|
||||
|
||||
//
|
||||
// Read the hash tag value.
|
||||
//
|
||||
AES_readTag(base, tagArray);
|
||||
|
||||
//
|
||||
// Return true to indicate successful completion of the function.
|
||||
//
|
||||
return(true);
|
||||
}
|
||||
|
||||
//*****************************************************************************
|
||||
//
|
||||
// AES_getInterruptStatus
|
||||
//
|
||||
//*****************************************************************************
|
||||
uint32_t
|
||||
AES_getInterruptStatus(uint32_t base, uint32_t wrapperBase, bool intMask)
|
||||
{
|
||||
uint32_t intStatus, intEnable, temp;
|
||||
//
|
||||
// Check the arguments.
|
||||
//
|
||||
ASSERT(AES_isBaseValid(base));
|
||||
ASSERT(AES_isWrapperBaseValid(wrapperBase));
|
||||
|
||||
//
|
||||
// Read the IRQ status register and return the value.
|
||||
//
|
||||
intStatus = HWREG(base + AES_O_S_AES_IRQSTATUS) |
|
||||
(HWREG(wrapperBase + AES_SS_O_AESDMASTATUS) << 16U);
|
||||
if(intMask)
|
||||
{
|
||||
intEnable = HWREG(base + AES_O_S_AES_IRQENABLE) |
|
||||
(HWREG(wrapperBase + AES_SS_O_AESDMAINTEN) << 16U);
|
||||
temp = intStatus & intEnable;
|
||||
}
|
||||
else
|
||||
{
|
||||
temp = intStatus;
|
||||
}
|
||||
return(temp);
|
||||
}
|
||||
|
||||
+1102
File diff suppressed because it is too large.
Load diff
+737
@@ -0,0 +1,737 @@
|
||||
//###########################################################################
|
||||
//
|
||||
// FILE: can.c
|
||||
//
|
||||
// TITLE: CM CAN driver.
|
||||
//
|
||||
//###########################################################################
|
||||
// $TI Release: $
|
||||
// $Release Date: $
|
||||
//
|
||||
// C2000Ware v5.04.00.00
|
||||
//
|
||||
// Copyright (C) 2024 Texas Instruments Incorporated - http://www.ti.com
|
||||
//
|
||||
// Redistribution and use in source and binary forms, with or without
|
||||
// modification, are permitted provided that the following conditions
|
||||
// are met:
|
||||
//
|
||||
// Redistributions of source code must retain the above copyright
|
||||
// notice, this list of conditions and the following disclaimer.
|
||||
//
|
||||
// Redistributions in binary form must reproduce the above copyright
|
||||
// notice, this list of conditions and the following disclaimer in the
|
||||
// documentation and/or other materials provided with the
|
||||
// distribution.
|
||||
//
|
||||
// Neither the name of Texas Instruments Incorporated nor the names of
|
||||
// its contributors may be used to endorse or promote products derived
|
||||
// from this software without specific prior written permission.
|
||||
//
|
||||
// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
|
||||
// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
|
||||
// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
|
||||
// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
|
||||
// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
|
||||
// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
|
||||
// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
|
||||
// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
|
||||
// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
||||
// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
|
||||
// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
// $
|
||||
//###########################################################################
|
||||
#include "can.h"
|
||||
|
||||
//*****************************************************************************
|
||||
//
|
||||
// CAN_initModule
|
||||
//
|
||||
//*****************************************************************************
|
||||
void
|
||||
CAN_initModule(uint32_t base)
|
||||
{
|
||||
//
|
||||
// Check the arguments.
|
||||
//
|
||||
ASSERT(CAN_isBaseValid(base));
|
||||
|
||||
//
|
||||
// Place CAN controller in init state, regardless of previous state. This
|
||||
// will put controller in idle, and allow the message object RAM to be
|
||||
// programmed.
|
||||
//
|
||||
HWREGH(base + CAN_O_CTL) |= ((uint16_t)CAN_CTL_INIT |
|
||||
(uint16_t)CAN_INIT_PARITY_DISABLE);
|
||||
|
||||
//
|
||||
// Initialize the message RAM before using it.
|
||||
//
|
||||
CAN_initRAM(base);
|
||||
|
||||
//
|
||||
// Force module to reset state
|
||||
//
|
||||
|
||||
HWREGH(base + CAN_O_CTL) |= CAN_CTL_SWR;
|
||||
|
||||
//
|
||||
// Delay for 14 cycles
|
||||
//
|
||||
SysCtl_delay(1U);
|
||||
|
||||
//
|
||||
// Enable write access to the configuration registers
|
||||
//
|
||||
HWREGH(base + CAN_O_CTL) |= CAN_CTL_CCE;
|
||||
}
|
||||
|
||||
//*****************************************************************************
|
||||
//
|
||||
// CAN_setBitRate
|
||||
//
|
||||
//*****************************************************************************
|
||||
void
|
||||
CAN_setBitRate(uint32_t base, uint32_t clock, uint32_t bitRate,
|
||||
uint16_t bitTime)
|
||||
{
|
||||
uint16_t brp;
|
||||
uint16_t tPhase;
|
||||
uint16_t phaseSeg2;
|
||||
uint16_t tSync = 1U;
|
||||
uint16_t tProp = 2U;
|
||||
uint16_t tSeg1;
|
||||
uint16_t tSeg2;
|
||||
uint16_t sjw;
|
||||
uint16_t prescaler;
|
||||
uint16_t prescalerExtension;
|
||||
|
||||
//
|
||||
// Check the arguments.
|
||||
//
|
||||
ASSERT(CAN_isBaseValid(base));
|
||||
ASSERT((bitTime > 7U) && (bitTime < 26U));
|
||||
ASSERT(bitRate <= 1000000U);
|
||||
|
||||
//
|
||||
// Calculate bit timing values
|
||||
//
|
||||
brp = (uint16_t)(clock / (bitRate * bitTime));
|
||||
tPhase = bitTime - (tSync + tProp);
|
||||
if((tPhase / 2U) <= 8U)
|
||||
{
|
||||
phaseSeg2 = tPhase / 2U;
|
||||
}
|
||||
else
|
||||
{
|
||||
phaseSeg2 = 8U;
|
||||
}
|
||||
tSeg1 = ((tPhase - phaseSeg2) + tProp) - 1U;
|
||||
tSeg2 = phaseSeg2 - 1U;
|
||||
if(phaseSeg2 > 4U)
|
||||
{
|
||||
sjw = 3U;
|
||||
}
|
||||
else
|
||||
{
|
||||
sjw = tSeg2;
|
||||
}
|
||||
prescalerExtension = ((brp - 1U) / 64U);
|
||||
prescaler = ((brp - 1U) % 64U);
|
||||
|
||||
//
|
||||
// Set the calculated timing parameters
|
||||
//
|
||||
CAN_setBitTiming(base, prescaler, prescalerExtension, tSeg1, tSeg2, sjw);
|
||||
}
|
||||
|
||||
//*****************************************************************************
|
||||
//
|
||||
// CAN_setBitTiming
|
||||
//
|
||||
//*****************************************************************************
|
||||
void
|
||||
CAN_setBitTiming(uint32_t base, uint16_t prescaler,
|
||||
uint16_t prescalerExtension, uint16_t tSeg1, uint16_t tSeg2,
|
||||
uint16_t sjw)
|
||||
{
|
||||
uint16_t savedInit;
|
||||
uint32_t bitReg;
|
||||
|
||||
//
|
||||
// Check the arguments.
|
||||
//
|
||||
ASSERT(CAN_isBaseValid(base));
|
||||
ASSERT(prescaler < 64U);
|
||||
ASSERT((tSeg1 > 0U) && (tSeg1 < 16U));
|
||||
ASSERT(tSeg2 < 8U);
|
||||
ASSERT(sjw < 4U);
|
||||
ASSERT(prescalerExtension < 16U);
|
||||
|
||||
//
|
||||
// To set the bit timing register, the controller must be placed in init
|
||||
// mode (if not already), and also configuration change bit enabled.
|
||||
// State of the init bit should be saved so it can be restored at the end.
|
||||
//
|
||||
savedInit = HWREGH(base + CAN_O_CTL);
|
||||
HWREGH(base + CAN_O_CTL) = savedInit | CAN_CTL_INIT | CAN_CTL_CCE;
|
||||
|
||||
//
|
||||
// Set the bit fields of the bit timing register
|
||||
//
|
||||
bitReg = (uint32_t)((uint32_t)prescaler & CAN_BTR_BRP_M);
|
||||
bitReg |= (uint32_t)(((uint32_t)sjw << CAN_BTR_SJW_S) & CAN_BTR_SJW_M);
|
||||
bitReg |= (uint32_t)(((uint32_t)tSeg1 << CAN_BTR_TSEG1_S) &
|
||||
CAN_BTR_TSEG1_M);
|
||||
bitReg |= (uint32_t)(((uint32_t)tSeg2 << CAN_BTR_TSEG2_S) &
|
||||
CAN_BTR_TSEG2_M);
|
||||
bitReg |= (uint32_t)(((uint32_t)prescalerExtension << CAN_BTR_BRPE_S) &
|
||||
CAN_BTR_BRPE_M);
|
||||
|
||||
HWREG_BP(base + CAN_O_BTR) = bitReg;
|
||||
|
||||
//
|
||||
// Clear the config change bit, and restore the init bit.
|
||||
//
|
||||
savedInit &= ~((uint16_t)CAN_CTL_CCE);
|
||||
|
||||
//
|
||||
// If Init was not set before, then clear it.
|
||||
//
|
||||
if((savedInit & CAN_CTL_INIT) == CAN_CTL_INIT)
|
||||
{
|
||||
savedInit &= ~((uint16_t)CAN_CTL_INIT);
|
||||
}
|
||||
HWREGH(base + CAN_O_CTL) = savedInit;
|
||||
}
|
||||
|
||||
//*****************************************************************************
|
||||
//
|
||||
// CAN_registerInterrupt
|
||||
//
|
||||
//*****************************************************************************
|
||||
void
|
||||
CAN_registerInterrupt(uint32_t base, CAN_IntNumber canIntNum,
|
||||
void (*handler)(void))
|
||||
{
|
||||
uint32_t number;
|
||||
|
||||
//
|
||||
// Check the arguments.
|
||||
//
|
||||
ASSERT(CAN_isBaseValid(base));
|
||||
|
||||
//
|
||||
// Get the actual interrupt number for this CAN controller.
|
||||
//
|
||||
number = CAN_getIntNumber(base, canIntNum);
|
||||
|
||||
//
|
||||
// Register the interrupt handler.
|
||||
//
|
||||
Interrupt_registerHandler(number, handler);
|
||||
|
||||
//
|
||||
// Enable the CAN interrupt.
|
||||
//
|
||||
Interrupt_enable(number);
|
||||
}
|
||||
|
||||
//*****************************************************************************
|
||||
//
|
||||
// CAN_unregisterInterrupt
|
||||
//
|
||||
//*****************************************************************************
|
||||
void
|
||||
CAN_unregisterInterrupt(uint32_t base, CAN_IntNumber canIntNum)
|
||||
{
|
||||
uint32_t number;
|
||||
|
||||
//
|
||||
// Check the arguments.
|
||||
//
|
||||
ASSERT(CAN_isBaseValid(base));
|
||||
|
||||
//
|
||||
// Get the actual interrupt number for this CAN controller.
|
||||
//
|
||||
number = CAN_getIntNumber(base, canIntNum);
|
||||
|
||||
//
|
||||
// Register the interrupt handler.
|
||||
//
|
||||
Interrupt_unregisterHandler(number);
|
||||
|
||||
//
|
||||
// Disable the CAN interrupt.
|
||||
//
|
||||
Interrupt_disable(number);
|
||||
}
|
||||
|
||||
//*****************************************************************************
|
||||
//
|
||||
// CAN_clearInterruptStatus
|
||||
//
|
||||
//*****************************************************************************
|
||||
void
|
||||
CAN_clearInterruptStatus(uint32_t base, uint32_t intClr)
|
||||
{
|
||||
//
|
||||
// Check the arguments.
|
||||
//
|
||||
ASSERT(CAN_isBaseValid(base));
|
||||
ASSERT((intClr == CAN_INT_INT0ID_STATUS) ||
|
||||
((intClr >= 1U) && (intClr <= 32U)));
|
||||
|
||||
if(intClr == (uint32_t)CAN_INT_INT0ID_STATUS)
|
||||
{
|
||||
//
|
||||
// Simply read and discard the status to clear the interrupt.
|
||||
//
|
||||
HWREGH(base + CAN_O_ES);
|
||||
}
|
||||
else
|
||||
{
|
||||
//
|
||||
// Wait to be sure that this interface is not busy.
|
||||
//
|
||||
while((HWREGH(base + CAN_O_IF1CMD) & CAN_IF1CMD_BUSY) ==
|
||||
CAN_IF1CMD_BUSY)
|
||||
{
|
||||
}
|
||||
|
||||
//
|
||||
// Only change the interrupt pending state by setting only the
|
||||
// CAN_IF1CMD_CLRINTPND bit.
|
||||
//
|
||||
// Send the clear pending interrupt command to the CAN controller.
|
||||
//
|
||||
HWREG_BP(base + CAN_O_IF1CMD) = CAN_IF1CMD_CLRINTPND |
|
||||
(intClr & CAN_IF1CMD_MSG_NUM_M);
|
||||
|
||||
//
|
||||
// Wait to be sure that this interface is not busy.
|
||||
//
|
||||
while((HWREGH(base + CAN_O_IF1CMD) & CAN_IF1CMD_BUSY) ==
|
||||
CAN_IF1CMD_BUSY)
|
||||
{
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
//*****************************************************************************
|
||||
//
|
||||
// CAN_setupMessageObject
|
||||
//
|
||||
//*****************************************************************************
|
||||
void
|
||||
CAN_setupMessageObject(uint32_t base, uint32_t objID, uint32_t msgID,
|
||||
CAN_MsgFrameType frame, CAN_MsgObjType msgType,
|
||||
uint32_t msgIDMask, uint32_t flags, uint16_t msgLen)
|
||||
{
|
||||
uint32_t cmdMaskReg = 0U;
|
||||
uint32_t maskReg = 0U;
|
||||
uint32_t arbReg = 0U;
|
||||
uint32_t msgCtrl = 0U;
|
||||
|
||||
//
|
||||
// Check the arguments.
|
||||
//
|
||||
ASSERT(CAN_isBaseValid(base));
|
||||
ASSERT((objID <= 32U) && (objID > 0U));
|
||||
ASSERT(msgLen <= 8U);
|
||||
|
||||
//
|
||||
// Wait for busy bit to clear
|
||||
//
|
||||
while((HWREGH(base + CAN_O_IF1CMD) & CAN_IF1CMD_BUSY) == CAN_IF1CMD_BUSY)
|
||||
{
|
||||
}
|
||||
|
||||
switch(msgType)
|
||||
{
|
||||
//
|
||||
// Transmit message object.
|
||||
//
|
||||
case CAN_MSG_OBJ_TYPE_TX:
|
||||
{
|
||||
//
|
||||
// Set message direction to transmit.
|
||||
//
|
||||
arbReg = CAN_IF1ARB_DIR;
|
||||
break;
|
||||
}
|
||||
|
||||
//
|
||||
// Remote frame receive remote, with auto-transmit message object.
|
||||
//
|
||||
case CAN_MSG_OBJ_TYPE_RXTX_REMOTE:
|
||||
{
|
||||
//
|
||||
// Set message direction to Tx for remote receivers.
|
||||
//
|
||||
arbReg = CAN_IF1ARB_DIR;
|
||||
|
||||
//
|
||||
// Set this object to auto answer if a matching identifier is seen.
|
||||
//
|
||||
msgCtrl = (uint32_t)((uint32_t)CAN_IF1MCTL_RMTEN |
|
||||
(uint32_t)CAN_IF1MCTL_UMASK);
|
||||
|
||||
break;
|
||||
}
|
||||
|
||||
//
|
||||
// Transmit remote request message object (CAN_MSG_OBJ_TYPE_TX_REMOTE)
|
||||
// or Receive message object (CAN_MSG_OBJ_TYPE_RX).
|
||||
//
|
||||
default:
|
||||
{
|
||||
//
|
||||
// Set message direction to read.
|
||||
//
|
||||
arbReg = 0U;
|
||||
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
//
|
||||
// Set values based on Extended Frame or Standard Frame
|
||||
//
|
||||
if(frame == CAN_MSG_FRAME_EXT)
|
||||
{
|
||||
//
|
||||
// Configure the Mask Registers for 29 bit Identifier mask.
|
||||
//
|
||||
if((flags & CAN_MSG_OBJ_USE_ID_FILTER) == CAN_MSG_OBJ_USE_ID_FILTER)
|
||||
{
|
||||
maskReg = msgIDMask & CAN_IF1MSK_MSK_M;
|
||||
}
|
||||
|
||||
//
|
||||
// Set the 29 bit version of the Identifier for this message
|
||||
// object. Mark the message as valid and set the extended ID bit.
|
||||
//
|
||||
arbReg |= (msgID & CAN_IF1ARB_ID_M) | CAN_IF1ARB_MSGVAL |
|
||||
CAN_IF1ARB_XTD;
|
||||
}
|
||||
else
|
||||
{
|
||||
//
|
||||
// Configure the Mask Registers for 11 bit Identifier mask.
|
||||
//
|
||||
if((flags & CAN_MSG_OBJ_USE_ID_FILTER) == CAN_MSG_OBJ_USE_ID_FILTER)
|
||||
{
|
||||
maskReg = ((msgIDMask << CAN_IF1ARB_STD_ID_S) &
|
||||
CAN_IF1ARB_STD_ID_M);
|
||||
}
|
||||
|
||||
//
|
||||
// Set the 11 bit version of the Identifier for this message
|
||||
// object. The lower 18 bits are set to zero. Mark the message as
|
||||
// valid.
|
||||
//
|
||||
arbReg |= ((msgID << CAN_IF1ARB_STD_ID_S) & CAN_IF1ARB_STD_ID_M) |
|
||||
CAN_IF1ARB_MSGVAL;
|
||||
}
|
||||
|
||||
//
|
||||
// If the caller wants to filter on the extended ID bit then set it.
|
||||
//
|
||||
maskReg |= (flags & CAN_MSG_OBJ_USE_EXT_FILTER);
|
||||
|
||||
//
|
||||
// The caller wants to filter on the message direction field.
|
||||
//
|
||||
maskReg |= (flags & CAN_MSG_OBJ_USE_DIR_FILTER);
|
||||
|
||||
//
|
||||
// If any filtering is requested, set the UMASK bit to use mask register
|
||||
//
|
||||
if(((flags & CAN_MSG_OBJ_USE_ID_FILTER) |
|
||||
(flags & CAN_MSG_OBJ_USE_DIR_FILTER) |
|
||||
(flags & CAN_MSG_OBJ_USE_EXT_FILTER)) != 0U)
|
||||
{
|
||||
msgCtrl |= CAN_IF1MCTL_UMASK;
|
||||
}
|
||||
|
||||
//
|
||||
// Set the data length since this is set for all transfers. This is
|
||||
// also a single transfer and not a FIFO transfer so set EOB bit.
|
||||
//
|
||||
msgCtrl |= ((uint32_t)msgLen & CAN_IF1MCTL_DLC_M);
|
||||
|
||||
//
|
||||
// Mark this as the last entry if this is not the last entry in a FIFO.
|
||||
//
|
||||
if((flags & CAN_MSG_OBJ_FIFO) == 0U)
|
||||
{
|
||||
msgCtrl |= CAN_IF1MCTL_EOB;
|
||||
}
|
||||
|
||||
//
|
||||
// Enable transmit interrupts if they should be enabled.
|
||||
//
|
||||
msgCtrl |= (flags & CAN_MSG_OBJ_TX_INT_ENABLE);
|
||||
|
||||
//
|
||||
// Enable receive interrupts if they should be enabled.
|
||||
//
|
||||
msgCtrl |= (flags & CAN_MSG_OBJ_RX_INT_ENABLE);
|
||||
|
||||
//
|
||||
// Set the Control, Arb, and Mask bit so that they get transferred to the
|
||||
// Message object.
|
||||
//
|
||||
cmdMaskReg |= CAN_IF1CMD_ARB;
|
||||
cmdMaskReg |= CAN_IF1CMD_CONTROL;
|
||||
cmdMaskReg |= CAN_IF1CMD_MASK;
|
||||
cmdMaskReg |= CAN_IF1CMD_DIR;
|
||||
|
||||
//
|
||||
// Write out the registers to program the message object.
|
||||
//
|
||||
HWREG_BP(base + CAN_O_IF1MSK) = maskReg;
|
||||
HWREG_BP(base + CAN_O_IF1ARB) = arbReg;
|
||||
HWREG_BP(base + CAN_O_IF1MCTL) = msgCtrl;
|
||||
|
||||
//
|
||||
// Transfer data to message object RAM
|
||||
//
|
||||
HWREG_BP(base + CAN_O_IF1CMD) = cmdMaskReg | (objID & CAN_IF1CMD_MSG_NUM_M);
|
||||
}
|
||||
|
||||
//*****************************************************************************
|
||||
//
|
||||
// CAN_sendMessage
|
||||
//
|
||||
//*****************************************************************************
|
||||
void
|
||||
CAN_sendMessage(uint32_t base, uint32_t objID, uint16_t msgLen,
|
||||
const uint16_t *msgData)
|
||||
{
|
||||
uint32_t msgCtrl = 0U;
|
||||
|
||||
//
|
||||
// Check the arguments.
|
||||
//
|
||||
ASSERT(CAN_isBaseValid(base));
|
||||
ASSERT((objID <= 32U) && (objID > 0U));
|
||||
ASSERT(msgLen <= 8U);
|
||||
|
||||
//
|
||||
// Set IF command to read message object control value
|
||||
//
|
||||
// Set up the request for data from the message object.
|
||||
// Transfer the message object to the IF register.
|
||||
//
|
||||
HWREG_BP(base + CAN_O_IF1CMD) = CAN_IF1CMD_CONTROL |
|
||||
(objID & CAN_IF1CMD_MSG_NUM_M);
|
||||
|
||||
//
|
||||
// Wait for busy bit to clear
|
||||
//
|
||||
while((HWREGH(base + CAN_O_IF1CMD) & CAN_IF1CMD_BUSY) == CAN_IF1CMD_BUSY)
|
||||
{
|
||||
}
|
||||
|
||||
//
|
||||
// Read IF message control
|
||||
//
|
||||
msgCtrl = HWREGH(base + CAN_O_IF1MCTL);
|
||||
|
||||
//
|
||||
// Check provided DLC size with actual Message DLC size
|
||||
//
|
||||
ASSERT((msgCtrl & CAN_IF1MCTL_DLC_M) == msgLen);
|
||||
|
||||
//
|
||||
// Write the data out to the CAN Data registers.
|
||||
//
|
||||
CAN_writeDataReg(msgData, (int16_t *)(base + CAN_O_IF1DATA),
|
||||
(msgCtrl & CAN_IF1MCTL_DLC_M));
|
||||
|
||||
//
|
||||
// Set Data to be transferred from IF
|
||||
//
|
||||
if(msgLen > 0U)
|
||||
{
|
||||
msgCtrl = CAN_IF1CMD_DATA_B | CAN_IF1CMD_DATA_A;
|
||||
}
|
||||
else
|
||||
{
|
||||
msgCtrl = 0U;
|
||||
}
|
||||
|
||||
//
|
||||
// Set Direction to write
|
||||
//
|
||||
// Set Tx Request Bit
|
||||
//
|
||||
// Transfer the message object to the message object specified by
|
||||
// objID.
|
||||
//
|
||||
HWREG_BP(base + CAN_O_IF1CMD) = (msgCtrl | CAN_IF1CMD_DIR |
|
||||
CAN_IF1CMD_TXRQST |
|
||||
(objID & CAN_IF1CMD_MSG_NUM_M));
|
||||
}
|
||||
|
||||
//*****************************************************************************
|
||||
//
|
||||
// CAN_readMessage
|
||||
//
|
||||
//*****************************************************************************
|
||||
bool
|
||||
CAN_readMessage(uint32_t base, uint32_t objID, uint16_t *msgData)
|
||||
{
|
||||
bool status;
|
||||
uint16_t msgCtrl = 0U;
|
||||
|
||||
//
|
||||
// Check the arguments.
|
||||
//
|
||||
ASSERT(CAN_isBaseValid(base));
|
||||
ASSERT((objID <= 32U) && (objID != 0U));
|
||||
|
||||
//
|
||||
// Set the Message Data A, Data B, and control values to be read
|
||||
// on request for data from the message object.
|
||||
//
|
||||
// Transfer the message object to the message object IF register.
|
||||
//
|
||||
HWREG_BP(base + CAN_O_IF2CMD) = (CAN_IF2CMD_DATA_A | CAN_IF2CMD_DATA_B |
|
||||
CAN_IF2CMD_CONTROL |
|
||||
(objID & CAN_IF2CMD_MSG_NUM_M));
|
||||
|
||||
//
|
||||
// Wait for busy bit to clear
|
||||
//
|
||||
while((HWREGH(base + CAN_O_IF2CMD) & CAN_IF2CMD_BUSY) == CAN_IF2CMD_BUSY)
|
||||
{
|
||||
}
|
||||
|
||||
//
|
||||
// Read out the IF control Register.
|
||||
//
|
||||
msgCtrl = HWREGH(base + CAN_O_IF2MCTL);
|
||||
|
||||
//
|
||||
// See if there is new data available.
|
||||
//
|
||||
if((msgCtrl & CAN_IF2MCTL_NEWDAT) == CAN_IF2MCTL_NEWDAT)
|
||||
{
|
||||
//
|
||||
// Read out the data from the CAN registers.
|
||||
//
|
||||
CAN_readDataReg(msgData, (int16_t *)(base + CAN_O_IF2DATA),
|
||||
(msgCtrl & CAN_IF2MCTL_DLC_M));
|
||||
|
||||
status = true;
|
||||
|
||||
//
|
||||
// Now clear out the new data flag
|
||||
//
|
||||
// Transfer the message object to the message object specified by
|
||||
// objID.
|
||||
//
|
||||
HWREG_BP(CANA_BASE + CAN_O_IF2CMD) = CAN_IF2CMD_TXRQST |
|
||||
(objID & CAN_IF2CMD_MSG_NUM_M);
|
||||
|
||||
//
|
||||
// Wait for busy bit to clear
|
||||
//
|
||||
while((HWREGH(CANA_BASE + CAN_O_IF2CMD) & CAN_IF2CMD_BUSY) ==
|
||||
CAN_IF2CMD_BUSY)
|
||||
{
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
status = false;
|
||||
}
|
||||
|
||||
return(status);
|
||||
}
|
||||
|
||||
//*****************************************************************************
|
||||
//
|
||||
// CAN_transferMessage
|
||||
//
|
||||
//*****************************************************************************
|
||||
void
|
||||
CAN_transferMessage(uint32_t base, uint16_t interface, uint32_t objID,
|
||||
bool direction, bool dmaRequest)
|
||||
{
|
||||
uint32_t cmdMaskReg;
|
||||
|
||||
ASSERT(CAN_isBaseValid(base));
|
||||
ASSERT((objID >= 1U) && (objID <= 32U));
|
||||
ASSERT((interface == 1U) || (interface == 2U));
|
||||
|
||||
//
|
||||
// This is always a read to the Message object as this call is setting a
|
||||
// message object.
|
||||
//
|
||||
cmdMaskReg = (CAN_IF1CMD_DATA_A | CAN_IF1CMD_DATA_B | CAN_IF1CMD_TXRQST |
|
||||
CAN_IF1CMD_CONTROL | CAN_IF1CMD_MASK | CAN_IF1CMD_ARB) |
|
||||
(direction ? CAN_IF1CMD_DIR : 0U) |
|
||||
(dmaRequest ? CAN_IF1CMD_DMAACTIVE : 0U);
|
||||
|
||||
//
|
||||
// Ensure this IF isn't busy
|
||||
//
|
||||
while((HWREGH(base + ((interface == 2U) ? CAN_O_IF2CMD : CAN_O_IF1CMD)) &
|
||||
CAN_IF1CMD_BUSY) == CAN_IF1CMD_BUSY)
|
||||
{
|
||||
}
|
||||
|
||||
//
|
||||
// Set up the request for data from the message object. Transfer the
|
||||
// message object to the message object specified by objID.
|
||||
//
|
||||
HWREG_BP(base + ((interface == 2U) ? CAN_O_IF2CMD : CAN_O_IF1CMD)) =
|
||||
(cmdMaskReg | (objID & CAN_IF1CMD_MSG_NUM_M));
|
||||
|
||||
//
|
||||
// Wait for busy bit to clear
|
||||
//
|
||||
while((HWREGH(base + ((interface == 2U) ? CAN_O_IF2CMD : CAN_O_IF1CMD)) &
|
||||
CAN_IF1CMD_BUSY) == CAN_IF1CMD_BUSY)
|
||||
{
|
||||
}
|
||||
}
|
||||
|
||||
//*****************************************************************************
|
||||
//
|
||||
// CAN_clearMessage
|
||||
//
|
||||
//*****************************************************************************
|
||||
void
|
||||
CAN_clearMessage(uint32_t base, uint32_t objID)
|
||||
{
|
||||
//
|
||||
// Check the arguments.
|
||||
//
|
||||
ASSERT(CAN_isBaseValid(base));
|
||||
ASSERT((objID >= 1U) && (objID <= 32U));
|
||||
|
||||
//
|
||||
// Wait for busy bit to clear
|
||||
//
|
||||
while((HWREGH(base + CAN_O_IF1CMD) & CAN_IF1CMD_BUSY) == CAN_IF1CMD_BUSY)
|
||||
{
|
||||
}
|
||||
|
||||
//
|
||||
// Clear the message valid bit in the arbitration register. This indicates
|
||||
// the message is not valid.
|
||||
//
|
||||
HWREG_BP(base + CAN_O_IF1ARB) = 0U;
|
||||
|
||||
//
|
||||
// Initiate programming the message object
|
||||
//
|
||||
HWREG_BP(base + CAN_O_IF1CMD) = (CAN_IF1CMD_DIR | CAN_IF1CMD_ARB) |
|
||||
(objID & CAN_IF1CMD_MSG_NUM_M);
|
||||
}
|
||||
+1796
File diff suppressed because it is too large.
Load diff
+46
@@ -0,0 +1,46 @@
|
||||
//###########################################################################
|
||||
//
|
||||
// FILE: cmmpu.c
|
||||
//
|
||||
// TITLE: Driver for the uDMA & EMAC memory protection unit (MPU).
|
||||
//
|
||||
//###########################################################################
|
||||
// $TI Release: $
|
||||
// $Release Date: $
|
||||
//
|
||||
// C2000Ware v5.04.00.00
|
||||
//
|
||||
// Copyright (C) 2024 Texas Instruments Incorporated - http://www.ti.com
|
||||
//
|
||||
// Redistribution and use in source and binary forms, with or without
|
||||
// modification, are permitted provided that the following conditions
|
||||
// are met:
|
||||
//
|
||||
// Redistributions of source code must retain the above copyright
|
||||
// notice, this list of conditions and the following disclaimer.
|
||||
//
|
||||
// Redistributions in binary form must reproduce the above copyright
|
||||
// notice, this list of conditions and the following disclaimer in the
|
||||
// documentation and/or other materials provided with the
|
||||
// distribution.
|
||||
//
|
||||
// Neither the name of Texas Instruments Incorporated nor the names of
|
||||
// its contributors may be used to endorse or promote products derived
|
||||
// from this software without specific prior written permission.
|
||||
//
|
||||
// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
|
||||
// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
|
||||
// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
|
||||
// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
|
||||
// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
|
||||
// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
|
||||
// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
|
||||
// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
|
||||
// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
||||
// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
|
||||
// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
// $
|
||||
//###########################################################################
|
||||
|
||||
#include "cmmpu.h"
|
||||
|
||||
+744
@@ -0,0 +1,744 @@
|
||||
//###########################################################################
|
||||
//
|
||||
// FILE: cmmpu.h
|
||||
//
|
||||
// TITLE: Driver for the uDMA & EMAC memory protection unit (MPU).
|
||||
//
|
||||
//###########################################################################
|
||||
// $TI Release: $
|
||||
// $Release Date: $
|
||||
//
|
||||
// C2000Ware v5.04.00.00
|
||||
//
|
||||
// Copyright (C) 2024 Texas Instruments Incorporated - http://www.ti.com
|
||||
//
|
||||
// Redistribution and use in source and binary forms, with or without
|
||||
// modification, are permitted provided that the following conditions
|
||||
// are met:
|
||||
//
|
||||
// Redistributions of source code must retain the above copyright
|
||||
// notice, this list of conditions and the following disclaimer.
|
||||
//
|
||||
// Redistributions in binary form must reproduce the above copyright
|
||||
// notice, this list of conditions and the following disclaimer in the
|
||||
// documentation and/or other materials provided with the
|
||||
// distribution.
|
||||
//
|
||||
// Neither the name of Texas Instruments Incorporated nor the names of
|
||||
// its contributors may be used to endorse or promote products derived
|
||||
// from this software without specific prior written permission.
|
||||
//
|
||||
// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
|
||||
// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
|
||||
// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
|
||||
// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
|
||||
// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
|
||||
// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
|
||||
// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
|
||||
// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
|
||||
// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
||||
// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
|
||||
// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
// $
|
||||
//###########################################################################
|
||||
|
||||
#ifndef CMMPU_H
|
||||
#define CMMPU_H
|
||||
|
||||
//*****************************************************************************
|
||||
//
|
||||
// If building with a C++ compiler, make all of the definitions in this header
|
||||
// have a C binding.
|
||||
//
|
||||
//*****************************************************************************
|
||||
#ifdef __cplusplus
|
||||
extern "C"
|
||||
{
|
||||
#endif
|
||||
|
||||
//*****************************************************************************
|
||||
//
|
||||
//! \addtogroup cmmpu_api CMMPU
|
||||
//! @{
|
||||
//
|
||||
//*****************************************************************************
|
||||
|
||||
#include <stdbool.h>
|
||||
#include <stdint.h>
|
||||
#include "debug.h"
|
||||
#include "interrupt.h"
|
||||
#include "inc_cm/hw_cmmpu.h"
|
||||
#include "inc_cm/hw_ints.h"
|
||||
#include "inc_cm/hw_memmap.h"
|
||||
#include "inc_cm/hw_types.h"
|
||||
|
||||
//*****************************************************************************
|
||||
//
|
||||
// Defines for the API.
|
||||
//
|
||||
//*****************************************************************************
|
||||
//*****************************************************************************
|
||||
//
|
||||
// Key for accessing Access Violation related registers.
|
||||
//
|
||||
//*****************************************************************************
|
||||
#define CMMPU_ACC_VIO_KEY 0xA5A50000U //!< Key for ACC VIO Registers
|
||||
|
||||
//*****************************************************************************
|
||||
//
|
||||
// Flags for setting/clearing/returning the access violation interrupt flag
|
||||
// status, to be passed to CMMPU_setAccessViolationFlags() &
|
||||
// CMMPU_setAccessViolationFlags() as flags parameter & returned by
|
||||
// CMMPU_getAccessViolationFlags().
|
||||
//
|
||||
//*****************************************************************************
|
||||
#define CMMPU_ACC_VIO_FLAGS_READ CMMPU_ACC_VIO_FLAGS_RD //!< Read Violation
|
||||
#define CMMPU_ACC_VIO_FLAGS_WRITE CMMPU_ACC_VIO_FLAGS_WR //!< Write Violation
|
||||
|
||||
//*****************************************************************************
|
||||
//
|
||||
// Values that can be passed to CMMPU_setRegionAttributes() and
|
||||
// CMMPU_getRegionAttributes() as regionNum parameter.
|
||||
//
|
||||
//*****************************************************************************
|
||||
#define CMMPU_RGN_0 0x0U //!< Select uDMA/EMAC MPU Region 0
|
||||
#define CMMPU_RGN_1 0x1U //!< Select uDMA/EMAC MPU Region 1
|
||||
#define CMMPU_RGN_2 0x2U //!< Select uDMA/EMAC MPU Region 2
|
||||
#define CMMPU_RGN_3 0x3U //!< Select uDMA/EMAC MPU Region 3
|
||||
#define CMMPU_RGN_4 0x4U //!< Select uDMA/EMAC MPU Region 4
|
||||
#define CMMPU_RGN_5 0x5U //!< Select uDMA/EMAC MPU Region 5
|
||||
#define CMMPU_RGN_6 0x6U //!< Select uDMA/EMAC MPU Region 6
|
||||
#define CMMPU_RGN_7 0x7U //!< Select uDMA/EMAC MPU Region 7
|
||||
|
||||
//*****************************************************************************
|
||||
//
|
||||
// Flags to enable or disable a region, to be passed to
|
||||
// CMMPU_setRegionAttributes().
|
||||
//
|
||||
//*****************************************************************************
|
||||
#define CMMPU_RGN_ENABLE 0x1U //!< Enable MPU Region
|
||||
#define CMMPU_RGN_DISABLE 0x0U //!< Disable MPU Region
|
||||
|
||||
//*****************************************************************************
|
||||
//
|
||||
// Flags for the access permissions to be passed to CMMPU_setRegionAttributes().
|
||||
//
|
||||
//*****************************************************************************
|
||||
#define CMMPU_RGN_PERM_READ_ONLY 0x00U //!< Read Only Access
|
||||
#define CMMPU_RGN_PERM_NO_ACCESS 0x20U //!< No Access(R/W)
|
||||
#define CMMPU_RGN_PERM_FULL_ACCESS 0x10U //!< Full Access(R/W)
|
||||
|
||||
//*****************************************************************************
|
||||
//
|
||||
// Flags for the region size to be passed to CMMPU_setRegionAttributes().
|
||||
//
|
||||
//*****************************************************************************
|
||||
#define CMMPU_RGN_SIZE_1K (0x0U << 8U) //!< Region Size is 1K-bytes
|
||||
#define CMMPU_RGN_SIZE_2K (0x1U << 8U) //!< Region Size is 2K-bytes
|
||||
#define CMMPU_RGN_SIZE_4K (0x2U << 8U) //!< Region Size is 4K-bytes
|
||||
#define CMMPU_RGN_SIZE_8K (0x3U << 8U) //!< Region Size is 8K-bytes
|
||||
#define CMMPU_RGN_SIZE_16K (0x4U << 8U) //!< Region Size is 16K-bytes
|
||||
#define CMMPU_RGN_SIZE_32K (0x5U << 8U) //!< Region Size is 32K-bytes
|
||||
#define CMMPU_RGN_SIZE_64K (0x6U << 8U) //!< Region Size is 64K-bytes
|
||||
#define CMMPU_RGN_SIZE_128K (0x7U << 8U) //!< Region Size is 128K-bytes
|
||||
#define CMMPU_RGN_SIZE_256K (0x8U << 8U) //!< Region Size is 256K-bytes
|
||||
#define CMMPU_RGN_SIZE_512K (0x9U << 8U) //!< Region Size is 512K-bytes
|
||||
#define CMMPU_RGN_SIZE_1M (0xAU << 8U) //!< Region Size is 1M-bytes
|
||||
#define CMMPU_RGN_SIZE_2M (0xBU << 8U) //!< Region Size is 2M-bytes
|
||||
#define CMMPU_RGN_SIZE_4M (0xCU << 8U) //!< Region Size is 4M-bytes
|
||||
#define CMMPU_RGN_SIZE_8M (0xDU << 8U) //!< Region Size is 8M-bytes
|
||||
#define CMMPU_RGN_SIZE_16M (0xEU << 8U) //!< Region Size is 16M-bytes
|
||||
#define CMMPU_RGN_SIZE_32M (0xFU << 8U) //!< Region Size is 32M-bytes
|
||||
#define CMMPU_RGN_SIZE_64M (0x10U << 8U) //!< Region Size is 64M-bytes
|
||||
#define CMMPU_RGN_SIZE_128M (0x11U << 8U) //!< Region Size is 128M-bytes
|
||||
#define CMMPU_RGN_SIZE_256M (0x12U << 8U) //!< Region Size is 256M-bytes
|
||||
#define CMMPU_RGN_SIZE_512M (0x13U << 8U) //!< Region Size is 512M-bytes
|
||||
#define CMMPU_RGN_SIZE_1G (0x14U << 8U) //!< Region Size is 1G-bytes
|
||||
#define CMMPU_RGN_SIZE_2G (0x15U << 8U) //!< Region Size is 2G-bytes
|
||||
#define CMMPU_RGN_SIZE_4G (0x16U << 8U) //!< Region Size is 4G-bytes
|
||||
|
||||
//*****************************************************************************
|
||||
//
|
||||
// Flags for the sub-region to be passed to CMMPU_setRegionAttributes().
|
||||
//
|
||||
//*****************************************************************************
|
||||
#define CMMPU_SUB_RGN_DISABLE_0 0x00010000U //!< Disable sub-region 0
|
||||
#define CMMPU_SUB_RGN_DISABLE_1 0x00020000U //!< Disable sub-region 1
|
||||
#define CMMPU_SUB_RGN_DISABLE_2 0x00040000U //!< Disable sub-region 2
|
||||
#define CMMPU_SUB_RGN_DISABLE_3 0x00080000U //!< Disable sub-region 3
|
||||
#define CMMPU_SUB_RGN_DISABLE_4 0x00100000U //!< Disable sub-region 4
|
||||
#define CMMPU_SUB_RGN_DISABLE_5 0x00200000U //!< Disable sub-region 5
|
||||
#define CMMPU_SUB_RGN_DISABLE_6 0x00400000U //!< Disable sub-region 6
|
||||
#define CMMPU_SUB_RGN_DISABLE_7 0x00800000U //!< Disable sub-region 7
|
||||
|
||||
//*****************************************************************************
|
||||
//
|
||||
// Mask for MPU region attributes to be used by CMMPU_setRegionAttributes().
|
||||
//
|
||||
//*****************************************************************************
|
||||
|
||||
#define CMMPU_RGN_CONFIG_M ((uint32_t)CMMPU_REGION0_CONFIG_ENABLE | \
|
||||
(uint32_t)CMMPU_REGION0_CONFIG_PROT_TYPE_M | \
|
||||
(uint32_t)CMMPU_REGION0_CONFIG_SIZE_M | \
|
||||
(uint32_t)0xFF0000U)
|
||||
|
||||
//*****************************************************************************
|
||||
//
|
||||
// API Function prototypes
|
||||
//
|
||||
//*****************************************************************************
|
||||
//*****************************************************************************
|
||||
//
|
||||
//! \internal
|
||||
//! Checks the MPU module base address.
|
||||
//!
|
||||
//! \param base is the base address of the MPU instance used.
|
||||
//!
|
||||
//! This function determines if MPU module base address is valid. The paramater
|
||||
//! \b base can take following values: DMPU_BASE, or EMPU_BASE.
|
||||
//!
|
||||
//! \return Returns \b true if the base address is valid and \b false
|
||||
//! otherwise.
|
||||
//
|
||||
//*****************************************************************************
|
||||
#ifdef DEBUG
|
||||
static inline bool
|
||||
CMMPU_isBaseValid(uint32_t base)
|
||||
{
|
||||
return((base == DMPU_BASE) || (base == EMPU_BASE));
|
||||
}
|
||||
#endif
|
||||
|
||||
//*****************************************************************************
|
||||
//
|
||||
//! Enables and configures the MPU for use.
|
||||
//!
|
||||
//! \param base is the base address of the MPU instance used.
|
||||
//!
|
||||
//! This function enables either the DMA or EMAC memory protection unit.
|
||||
//! Prior to enabling the MPU, at least one region must be set by calling
|
||||
//! CMMPU_setRegionAttributes(). Once the MPU is enabled, access violation
|
||||
//! interrupts are generated if enabled.
|
||||
//!
|
||||
//! \return None.
|
||||
//
|
||||
//*****************************************************************************
|
||||
static inline void
|
||||
CMMPU_enable(uint32_t base)
|
||||
{
|
||||
//
|
||||
// Check the arguments.
|
||||
//
|
||||
ASSERT(CMMPU_isBaseValid(base));
|
||||
|
||||
//
|
||||
// Enable the MPU.
|
||||
//
|
||||
HWREG(base + CMMPU_O_MPU_CONTROL_REG) |= CMMPU_MPU_CONTROL_REG_ENABLE;
|
||||
}
|
||||
|
||||
//*****************************************************************************
|
||||
//
|
||||
//! Disables the MPU for use.
|
||||
//!
|
||||
//! \param base is the base address of the MPU instance used.
|
||||
//!
|
||||
//! This function disables either the DMA or EMAC memory protection unit.
|
||||
//! When the MPU is disabled, the default memory map is used and access
|
||||
//! violation interrupts are not generated.
|
||||
//!
|
||||
//! \return None.
|
||||
//
|
||||
//*****************************************************************************
|
||||
static inline void
|
||||
CMMPU_disable(uint32_t base)
|
||||
{
|
||||
//
|
||||
// Check the arguments.
|
||||
//
|
||||
ASSERT(CMMPU_isBaseValid(base));
|
||||
|
||||
//
|
||||
// Turn off the MPU enable bit.
|
||||
//
|
||||
HWREG(base + CMMPU_O_MPU_CONTROL_REG) &= ~CMMPU_MPU_CONTROL_REG_ENABLE;
|
||||
}
|
||||
|
||||
//*****************************************************************************
|
||||
//
|
||||
//! Enables the MPU RD/WR Access Violation Interrupts.
|
||||
//!
|
||||
//! \param base is the base address of the MPU instance used.
|
||||
//!
|
||||
//! This function enables either the DMA or EMAC MPU read/write access
|
||||
//! violation interrupts.
|
||||
//!
|
||||
//! \return None.
|
||||
//
|
||||
//*****************************************************************************
|
||||
static inline void
|
||||
CMMPU_enableAccessViolationInterrupt(uint32_t base)
|
||||
{
|
||||
//
|
||||
// Check the arguments.
|
||||
//
|
||||
ASSERT(CMMPU_isBaseValid(base));
|
||||
|
||||
//
|
||||
// Enable the interrupts.
|
||||
//
|
||||
HWREG(base + CMMPU_O_ACC_VIO_INTEN) = (CMMPU_ACC_VIO_INTEN_INTEN |
|
||||
CMMPU_ACC_VIO_KEY);
|
||||
}
|
||||
|
||||
//*****************************************************************************
|
||||
//
|
||||
//! Disables the MPU RD/WR Access Violation Interrupts.
|
||||
//!
|
||||
//! \param base is the base address of the MPU instance used.
|
||||
//!
|
||||
//! This function enables either the DMA or EMAC MPU read/write access
|
||||
//! violation interrupts.
|
||||
//!
|
||||
//! \return None.
|
||||
//
|
||||
//*****************************************************************************
|
||||
static inline void
|
||||
CMMPU_disableAccessViolationInterrupt(uint32_t base)
|
||||
{
|
||||
//
|
||||
// Check the arguments.
|
||||
//
|
||||
ASSERT(CMMPU_isBaseValid(base));
|
||||
|
||||
//
|
||||
// Disable the interrupts.
|
||||
//
|
||||
HWREG(base + CMMPU_O_ACC_VIO_INTEN) = (~CMMPU_ACC_VIO_INTEN_INTEN |
|
||||
CMMPU_ACC_VIO_KEY);
|
||||
}
|
||||
|
||||
//*****************************************************************************
|
||||
//
|
||||
//! Gets the status of MPU RD/WR Access Violation Interrupts.
|
||||
//!
|
||||
//! \param base is the base address of the MPU instance used.
|
||||
//!
|
||||
//! This function return the status of either the DMA or EMAC MPU read/write
|
||||
//! access violation interrupts.
|
||||
//!
|
||||
//! \return Returns the access violation interupt status. It can return
|
||||
//! following values: CMMPU_ACC_VIO_FLAGS_READ, CMMPU_ACC_VIO_FLAGS_WRITE
|
||||
//
|
||||
//*****************************************************************************
|
||||
static inline uint32_t
|
||||
CMMPU_getAccessViolationFlags(uint32_t base)
|
||||
{
|
||||
//
|
||||
// Check the arguments.
|
||||
//
|
||||
ASSERT(CMMPU_isBaseValid(base));
|
||||
|
||||
//
|
||||
// Return the access violation interrupts flag status.
|
||||
//
|
||||
return(HWREG(base + CMMPU_O_ACC_VIO_FLAGS));
|
||||
}
|
||||
|
||||
//*****************************************************************************
|
||||
//
|
||||
//! Sets the MPU RD/WR Access Violation Interrupts.
|
||||
//!
|
||||
//! \param base is the base address of the MPU instance used.
|
||||
//! \param flags is the flag for rd/wr violation.
|
||||
//!
|
||||
//! This function sets either the DMA or EMAC MPU read/write access
|
||||
//! violation interrupts. The parameter \b flags can take following values:
|
||||
//! CMMPU_ACC_VIO_FLAGS_READ, or CMMPU_ACC_VIO_FLAGS_WRITE.
|
||||
//!
|
||||
//! \return None.
|
||||
//
|
||||
//*****************************************************************************
|
||||
static inline void
|
||||
CMMPU_setAccessViolationFlags(uint32_t base, uint32_t flags)
|
||||
{
|
||||
//
|
||||
// Check the arguments.
|
||||
//
|
||||
ASSERT(CMMPU_isBaseValid(base));
|
||||
|
||||
//
|
||||
// Return the access violation interrupts flag status.
|
||||
//
|
||||
HWREG(base + CMMPU_O_ACC_VIO_FLAGS_SET) = (flags | CMMPU_ACC_VIO_KEY);
|
||||
}
|
||||
|
||||
//*****************************************************************************
|
||||
//
|
||||
//! Clears the MPU RD/WR Access Violation Interrupt Status.
|
||||
//!
|
||||
//! \param base is the base address of the MPU instance used.
|
||||
//!
|
||||
//! This function clears either the DMA or EMAC MPU read/write access
|
||||
//! violation interrupt status.The parameter \e flags can take following values:
|
||||
//! CMMPU_ACC_VIO_FLAGS_READ, or CMMPU_ACC_VIO_FLAGS_WRITE.
|
||||
//!
|
||||
//! \return None.
|
||||
//
|
||||
//*****************************************************************************
|
||||
static inline void
|
||||
CMMPU_clearAccessViolationFlags(uint32_t base, uint32_t flags)
|
||||
{
|
||||
//
|
||||
// Check the arguments.
|
||||
//
|
||||
ASSERT(CMMPU_isBaseValid(base));
|
||||
|
||||
//
|
||||
// Clear the access violation interrupts flag status.
|
||||
//
|
||||
HWREG(base + CMMPU_O_ACC_VIO_FLAGS_CLR) = (flags | CMMPU_ACC_VIO_KEY);
|
||||
}
|
||||
|
||||
//*****************************************************************************
|
||||
//
|
||||
//! Gets the MPU RD/WR Access Violation Address.
|
||||
//!
|
||||
//! \param base is the base address of the MPU instance used.
|
||||
//!
|
||||
//! This function enables either the DMA or EMAC MPU read/write access
|
||||
//! violation interrupts.
|
||||
//!
|
||||
//! \return Returns the MPU RD/WR access violation address.
|
||||
//
|
||||
//*****************************************************************************
|
||||
static inline uint32_t
|
||||
CMMPU_getAccessViolationAddr(uint32_t base)
|
||||
{
|
||||
//
|
||||
// Check the arguments.
|
||||
//
|
||||
ASSERT(CMMPU_isBaseValid(base));
|
||||
|
||||
//
|
||||
// Return the access violation address.
|
||||
//
|
||||
return(HWREG(base + CMMPU_O_ACC_VIO_ADDR_REG));
|
||||
}
|
||||
|
||||
//*****************************************************************************
|
||||
//
|
||||
//! Sets up the access rules for a specific region.
|
||||
//!
|
||||
//! \param regionNum is the region number to set up.
|
||||
//! \param baseAddr is the base address of the region. It must be aligned
|
||||
//! according to the size of the region specified in attrFlags.
|
||||
//! \param attrFlags is a set of flags to define the attributes of the region.
|
||||
//!
|
||||
//! This function sets up the protection rules for a region. The region has
|
||||
//! a base address and a set of attributes including the size.
|
||||
//!
|
||||
//! The region number parameter, \e regionNum specifies region number to setup.
|
||||
//! Valid values for \e regionNum paramter are:
|
||||
//! - \b CMMPU_RGN_0
|
||||
//! - \b CMMPU_RGN_1
|
||||
//! - \b CMMPU_RGN_2
|
||||
//! - \b CMMPU_RGN_3
|
||||
//! - \b CMMPU_RGN_4
|
||||
//! - \b CMMPU_RGN_5
|
||||
//! - \b CMMPU_RGN_6
|
||||
//! - \b CMMPU_RGN_7
|
||||
//!
|
||||
//! The base address parameter, \e baseAddr, must be aligned according to the
|
||||
//! size, and the size must be a power of 2.
|
||||
//!
|
||||
//! The \e attrFlags parameter is the logical OR of all of the attributes
|
||||
//! of the region. It is a combination of choices for region size, read/write
|
||||
//! permissions, disabled sub-regions, and a flag to determine if the region is
|
||||
//! enabled.
|
||||
//!
|
||||
//! The size flag determines the size of a region and must be one of the
|
||||
//! following:
|
||||
//! - \b CMMPU_RGN_SIZE_1K
|
||||
//! - \b CMMPU_RGN_SIZE_2K
|
||||
//! - \b CMMPU_RGN_SIZE_4K
|
||||
//! - \b CMMPU_RGN_SIZE_8K
|
||||
//! - \b CMMPU_RGN_SIZE_16K
|
||||
//! - \b CMMPU_RGN_SIZE_32K
|
||||
//! - \b CMMPU_RGN_SIZE_64K
|
||||
//! - \b CMMPU_RGN_SIZE_128K
|
||||
//! - \b CMMPU_RGN_SIZE_256K
|
||||
//! - \b CMMPU_RGN_SIZE_512K
|
||||
//! - \b CMMPU_RGN_SIZE_1M
|
||||
//! - \b CMMPU_RGN_SIZE_2M
|
||||
//! - \b CMMPU_RGN_SIZE_4M
|
||||
//! - \b CMMPU_RGN_SIZE_8M
|
||||
//! - \b CMMPU_RGN_SIZE_16M
|
||||
//! - \b CMMPU_RGN_SIZE_32M
|
||||
//! - \b CMMPU_RGN_SIZE_64M
|
||||
//! - \b CMMPU_RGN_SIZE_128M
|
||||
//! - \b CMMPU_RGN_SIZE_256M
|
||||
//! - \b CMMPU_RGN_SIZE_512M
|
||||
//! - \b CMMPU_RGN_SIZE_1G
|
||||
//! - \b CMMPU_RGN_SIZE_2G
|
||||
//! - \b CMMPU_RGN_SIZE_4G
|
||||
//!
|
||||
//! The read/write access permission flag must be one of the following:
|
||||
//! - \b CMMPU_RGN_PERM_READ_ONLY- read only permission to MPU region
|
||||
//! - \b CMMPU_RGN_PERM_NO_ACCESS- disables read/write permission to MPU region
|
||||
//! - \b CMMPU_RGN_PERM_FULL_ACCESS- read/write permission to MPU region
|
||||
//!
|
||||
//! The region is automatically divided into 8 equally-sized sub-regions by
|
||||
//! the MPU. Sub-regions can only be used in regions of size 256 bytes
|
||||
//! or larger. Any of these 8 sub-regions can be disabled, allowing for
|
||||
//! creation of "holes" in a region which can be left open, or overlaid
|
||||
//! by another region with different attributes. Any of the 8 sub-regions
|
||||
//! can be disabled with a logical OR of any of the following flags:
|
||||
//! - \b CMMPU_SUB_RGN_DISABLE_0
|
||||
//! - \b CMMPU_SUB_RGN_DISABLE_1
|
||||
//! - \b CMMPU_SUB_RGN_DISABLE_2
|
||||
//! - \b CMMPU_SUB_RGN_DISABLE_3
|
||||
//! - \b CMMPU_SUB_RGN_DISABLE_4
|
||||
//! - \b CMMPU_SUB_RGN_DISABLE_5
|
||||
//! - \b CMMPU_SUB_RGN_DISABLE_6
|
||||
//! - \b CMMPU_SUB_RGN_DISABLE_7
|
||||
//!
|
||||
//! Finally, the region can be initially enabled or disabled with one of
|
||||
//! the following flags:
|
||||
//! - \b CMMPU_RGN_ENABLE
|
||||
//! - \b CMMPU_RGN_DISABLE
|
||||
//!
|
||||
//! As an example, to set a region with the following attributes: size of
|
||||
//! 32 KB, read-only access, one sub-region disabled, and initially enabled,
|
||||
//! the \e attrFlags parameter would have the following value:
|
||||
//! <code>
|
||||
//! (CMMPU_RGN_SIZE_32K | CMMPU_RGN_PERM_READ_ONLY |
|
||||
//! CMMPU_SUB_RGN_DISABLE_2 | CMMPU_RGN_ENABLE)
|
||||
//! </code>
|
||||
//!
|
||||
//! \note This function writes to multiple registers and is not protected
|
||||
//! from interrupts. It is possible that an interrupt which accesses a
|
||||
//! region may occur while that region is in the process of being changed.
|
||||
//! The safest way to handle this is to disable a region before changing it.
|
||||
//! Refer to the discussion of this in the API Detailed Description section.
|
||||
//!
|
||||
//! \return None.
|
||||
//
|
||||
//*****************************************************************************
|
||||
static inline void
|
||||
CMMPU_setRegionAttributes(uint32_t base, uint32_t regionNum, uint32_t baseAddr,
|
||||
uint32_t attrFlags)
|
||||
{
|
||||
uint32_t temp;
|
||||
//
|
||||
// Check the arguments.
|
||||
//
|
||||
ASSERT(CMMPU_isBaseValid(base));
|
||||
ASSERT(regionNum < 8U);
|
||||
|
||||
//
|
||||
// Checking whether the region base address is aligned according to the
|
||||
// desired region size.
|
||||
//
|
||||
ASSERT(baseAddr == (baseAddr & (~(uint32_t)0U << (((attrFlags &
|
||||
CMMPU_REGION0_CONFIG_SIZE_M) >>
|
||||
CMMPU_REGION0_CONFIG_SIZE_S) + 1U))));
|
||||
|
||||
//
|
||||
// Program the region start address.
|
||||
//
|
||||
HWREG(base + CMMPU_O_REGION0_STARTADDRESSS + (regionNum * 8U)) = baseAddr;
|
||||
|
||||
//
|
||||
// Program the region attributes.
|
||||
//
|
||||
temp = CMMPU_RGN_CONFIG_M;
|
||||
HWREG(base + CMMPU_O_REGION0_CONFIG + (regionNum * 8U)) =
|
||||
(HWREG(base + CMMPU_O_REGION0_CONFIG + (regionNum * 8U)) &
|
||||
~(temp)) | attrFlags;
|
||||
}
|
||||
|
||||
//*****************************************************************************
|
||||
//
|
||||
//! Gets the current settings for a specific region.
|
||||
//!
|
||||
//! \param regionNum is the region number to get.
|
||||
//! \param baseAddr points to storage for the base address of the region.
|
||||
//! \param attrFlags points to the attribute flags for the region.
|
||||
//!
|
||||
//! This function retrieves the configuration of a specific region. The
|
||||
//! meanings and format of the parameters is the same as that of the
|
||||
//! CMMPU_setRegionAttributes() function.
|
||||
//!
|
||||
//! This function can be used to save the configuration of a region for later
|
||||
//! use with the CMMPU_setRegionAttributes() function. The region's enable state
|
||||
//! is preserved in the attributes that are saved.
|
||||
//!
|
||||
//! \return None.
|
||||
//
|
||||
//*****************************************************************************
|
||||
static inline void
|
||||
CMMPU_getRegionAttributes(uint32_t base, uint32_t regionNum, uint32_t *baseAddr,
|
||||
uint32_t *attrFlags)
|
||||
{
|
||||
//
|
||||
// Check the arguments.
|
||||
//
|
||||
ASSERT(CMMPU_isBaseValid(base));
|
||||
ASSERT(regionNum < 8U);
|
||||
ASSERT(baseAddr != 0x0U);
|
||||
ASSERT(attrFlags != 0x0U);
|
||||
|
||||
//
|
||||
// Read and store the start address for the region.
|
||||
//
|
||||
*baseAddr = HWREG(base + CMMPU_O_REGION0_STARTADDRESSS + (regionNum * 8U));
|
||||
|
||||
//
|
||||
// Read and store the region attributes.
|
||||
//
|
||||
*attrFlags = HWREG(base + CMMPU_O_REGION0_CONFIG + (regionNum * 8U));
|
||||
}
|
||||
|
||||
//*****************************************************************************
|
||||
//
|
||||
//! Enables a specific region.
|
||||
//!
|
||||
//! \param regionNum is the region number to enable.
|
||||
//!
|
||||
//! This function is used to enable a memory protection region. The region
|
||||
//! should already be configured with the CMMPU_setRegionAttributes() function.
|
||||
//! Once enabled, the memory protection rules of the region are applied and
|
||||
//! access violations cause a bus fault.
|
||||
//!
|
||||
//! \return None.
|
||||
//
|
||||
//*****************************************************************************
|
||||
static inline void
|
||||
CMMPU_enableRegion(uint32_t base, uint32_t regionNum)
|
||||
{
|
||||
//
|
||||
// Check the arguments.
|
||||
//
|
||||
ASSERT(CMMPU_isBaseValid(base));
|
||||
ASSERT(regionNum < 8U);
|
||||
|
||||
//
|
||||
// Enable the region.
|
||||
//
|
||||
HWREG(base + CMMPU_O_REGION0_CONFIG + (regionNum * 8U)) |=
|
||||
CMMPU_REGION0_CONFIG_ENABLE;
|
||||
}
|
||||
|
||||
//*****************************************************************************
|
||||
//
|
||||
//! Disables a specific region.
|
||||
//!
|
||||
//! \param regionNum is the region number to disable.
|
||||
//!
|
||||
//! This function is used to disable a previously enabled memory protection
|
||||
//! region. The region remains configured if it is not overwritten with
|
||||
//! another call to CMMPU_setRegionAttributes(), and can be enabled again by
|
||||
//! calling CMMPU_enableRegion().
|
||||
//!
|
||||
//! \return None.
|
||||
//
|
||||
//*****************************************************************************
|
||||
static inline void
|
||||
CMMPU_disableRegion(uint32_t base, uint32_t regionNum)
|
||||
{
|
||||
//
|
||||
// Check the arguments.
|
||||
//
|
||||
ASSERT(CMMPU_isBaseValid(base));
|
||||
ASSERT(regionNum < 8U);
|
||||
|
||||
//
|
||||
// Modify the enable bit in the region attributes.
|
||||
//
|
||||
HWREG(base + CMMPU_O_REGION0_CONFIG + (regionNum * 8U)) &=
|
||||
~CMMPU_REGION0_CONFIG_ENABLE;
|
||||
}
|
||||
|
||||
//*****************************************************************************
|
||||
//
|
||||
//! Registers an interrupt handler for the memory management fault.
|
||||
//!
|
||||
//! \param intNum is the interrupt number to be registered.
|
||||
//! \param fnHandler is a pointer to the function to be called when the
|
||||
//! memory management fault occurs.
|
||||
//!
|
||||
//! This function sets and enables the handler to be called when the MPU
|
||||
//! generates a bus fault due to a protection region access violation.
|
||||
//!
|
||||
//! \sa Interrupt_registerHandler() for important information about registering
|
||||
//! interrupt handlers.
|
||||
//!
|
||||
//! \return None.
|
||||
//
|
||||
//*****************************************************************************
|
||||
static inline void
|
||||
CMMPU_registerHandler(uint32_t intNum, void (*fnHandler)(void))
|
||||
{
|
||||
//
|
||||
// Check the arguments.
|
||||
//
|
||||
ASSERT(fnHandler);
|
||||
|
||||
//
|
||||
// Register the interrupt handler.
|
||||
//
|
||||
Interrupt_registerHandler(intNum, fnHandler);
|
||||
|
||||
//
|
||||
// Enable the memory management fault.
|
||||
//
|
||||
Interrupt_enable(intNum);
|
||||
}
|
||||
|
||||
//*****************************************************************************
|
||||
//
|
||||
//! Unregisters an interrupt handler for the memory management fault.
|
||||
//!
|
||||
//! \param intNum is the interrupt number to be unregistered.
|
||||
//!
|
||||
//! This function disables and clears the handler to be called when a
|
||||
//! memory management fault occurs.
|
||||
//!
|
||||
//! \sa Interrupt_registerHandler() for important information about registering
|
||||
//! interrupt handlers.
|
||||
//!
|
||||
//! \return None.
|
||||
//
|
||||
//*****************************************************************************
|
||||
static inline void
|
||||
CMMPU_unregisterHandler(uint32_t intNum)
|
||||
{
|
||||
//
|
||||
// Disable the interrupt.
|
||||
//
|
||||
Interrupt_disable(intNum);
|
||||
|
||||
//
|
||||
// Unregister the interrupt handler.
|
||||
//
|
||||
Interrupt_unregisterHandler(intNum);
|
||||
}
|
||||
|
||||
//*****************************************************************************
|
||||
//
|
||||
// Close the Doxygen group.
|
||||
//! @}
|
||||
//
|
||||
//*****************************************************************************
|
||||
|
||||
//*****************************************************************************
|
||||
//
|
||||
// Mark the end of the C bindings section for C++ compilers.
|
||||
//
|
||||
//*****************************************************************************
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif // CMMPU_H
|
||||
+313
@@ -0,0 +1,313 @@
|
||||
//###########################################################################
|
||||
//
|
||||
// FILE: cpu.h
|
||||
//
|
||||
// TITLE: Instruction wrappers for special CPU instructions needed by the
|
||||
// drivers.
|
||||
//
|
||||
//###########################################################################
|
||||
// $TI Release: $
|
||||
// $Release Date: $
|
||||
//
|
||||
// C2000Ware v5.04.00.00
|
||||
//
|
||||
// Copyright (C) 2024 Texas Instruments Incorporated - http://www.ti.com
|
||||
//
|
||||
// Redistribution and use in source and binary forms, with or without
|
||||
// modification, are permitted provided that the following conditions
|
||||
// are met:
|
||||
//
|
||||
// Redistributions of source code must retain the above copyright
|
||||
// notice, this list of conditions and the following disclaimer.
|
||||
//
|
||||
// Redistributions in binary form must reproduce the above copyright
|
||||
// notice, this list of conditions and the following disclaimer in the
|
||||
// documentation and/or other materials provided with the
|
||||
// distribution.
|
||||
//
|
||||
// Neither the name of Texas Instruments Incorporated nor the names of
|
||||
// its contributors may be used to endorse or promote products derived
|
||||
// from this software without specific prior written permission.
|
||||
//
|
||||
// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
|
||||
// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
|
||||
// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
|
||||
// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
|
||||
// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
|
||||
// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
|
||||
// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
|
||||
// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
|
||||
// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
||||
// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
|
||||
// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
// $
|
||||
//###########################################################################
|
||||
|
||||
#ifndef CPU_H
|
||||
#define CPU_H
|
||||
|
||||
//*****************************************************************************
|
||||
//
|
||||
// If building with a C++ compiler, make all of the definitions in this header
|
||||
// have a C binding.
|
||||
//
|
||||
//*****************************************************************************
|
||||
#ifdef __cplusplus
|
||||
extern "C"
|
||||
{
|
||||
#endif
|
||||
|
||||
//*****************************************************************************
|
||||
//
|
||||
//! \addtogroup cpu_api
|
||||
//! @{
|
||||
//
|
||||
//*****************************************************************************
|
||||
#include <stdint.h>
|
||||
|
||||
//
|
||||
// Define for no operation
|
||||
//
|
||||
#ifndef NOP
|
||||
#define NOP __asm(" NOP")
|
||||
#endif
|
||||
|
||||
//*****************************************************************************
|
||||
//
|
||||
//! Returns the state of FAULTMASK register on entry and disable all
|
||||
//! interrupts except NMI.
|
||||
//!
|
||||
//! \param None
|
||||
//!
|
||||
//! This function is wrapper function for the CPSID instruction. It returns
|
||||
//! the state of FAULTMASK on entry and disable all interrupts except NMI.
|
||||
//!
|
||||
//! \return Returns the state of FAULTMASK register.
|
||||
//
|
||||
//*****************************************************************************
|
||||
static inline uint32_t
|
||||
CPU_setFAULTMASK(void)
|
||||
{
|
||||
//
|
||||
// Disable interrupts and return previous FAULTMASK.
|
||||
//
|
||||
return(_disable_interrupts());
|
||||
}
|
||||
|
||||
//*****************************************************************************
|
||||
//
|
||||
//! Returns the state of FAULTMASK register
|
||||
//!
|
||||
//! \param None
|
||||
//!
|
||||
//! This function is wrapper function for returning the state of FAULTMASK
|
||||
//! register(indicating whether interrupts except NMI are enabled or disabled).
|
||||
//!
|
||||
//! \return Returns the state of FAULTMASK register.
|
||||
//
|
||||
//*****************************************************************************
|
||||
static inline uint32_t
|
||||
CPU_getFAULTMASK(void)
|
||||
{
|
||||
//
|
||||
// Read FAULTMASK register.
|
||||
//
|
||||
__asm(" mrs r0, FAULTMASK\n"
|
||||
" bx lr\n");
|
||||
|
||||
//
|
||||
// The following keeps the compiler happy, because it wants to see a
|
||||
// return value from this function. It will generate code to return
|
||||
// a zero. However, the real return is the "bx lr" above, so the
|
||||
// return(0) is never executed and the function returns with the value
|
||||
// you expect in R0.
|
||||
//
|
||||
return(0U);
|
||||
}
|
||||
|
||||
//*****************************************************************************
|
||||
//
|
||||
//! Returns the state of FAULTMASK register and enable the interrupts
|
||||
//!
|
||||
//! \param None
|
||||
//!
|
||||
//! This function is wrapper function for returning the state of FAULTMASK
|
||||
//! register and enabling the interrupts.
|
||||
//!
|
||||
//! \return Returns the state of FAULTMASK register.
|
||||
//
|
||||
//*****************************************************************************
|
||||
static inline uint32_t
|
||||
CPU_clearFAULTMASK(void)
|
||||
{
|
||||
//
|
||||
// Enable interrupts and return previous FAULTMASK status.
|
||||
//
|
||||
return(_enable_interrupts());
|
||||
}
|
||||
|
||||
//*****************************************************************************
|
||||
//
|
||||
//! Returns the state of PRIMASK register on entry and disable interrupts
|
||||
//!
|
||||
//! \param None
|
||||
//!
|
||||
//! This function is wrapper function for the CPSID instruction. It returns
|
||||
//! the state of PRIMASK on entry and disable interrupts.
|
||||
//!
|
||||
//! \return Returns the state of PRIMASK register.
|
||||
//
|
||||
//*****************************************************************************
|
||||
static inline uint32_t
|
||||
CPU_setPRIMASK(void)
|
||||
{
|
||||
//
|
||||
// Read PRIMASK and Disable interrupts.
|
||||
//
|
||||
return(_disable_IRQ());
|
||||
}
|
||||
|
||||
//*****************************************************************************
|
||||
//
|
||||
//! Returns the state of PRIMASK register
|
||||
//!
|
||||
//! \param None
|
||||
//!
|
||||
//! This function is wrapper function for returning the state of PRIMASK
|
||||
//! register(indicating whether interrupts are enabled or disabled).
|
||||
//!
|
||||
//! \return Returns the state of PRIMASK register.
|
||||
//
|
||||
//*****************************************************************************
|
||||
static inline uint32_t
|
||||
CPU_getPRIMASK(void)
|
||||
{
|
||||
//
|
||||
// Return PRIMASK register status.
|
||||
//
|
||||
return(__get_PRIMASK());
|
||||
}
|
||||
|
||||
//*****************************************************************************
|
||||
//
|
||||
//! Returns the state of PRIMASK register and enable the interrupts
|
||||
//!
|
||||
//! \param None
|
||||
//!
|
||||
//! This function is wrapper function for returning the state of PRIMASK
|
||||
//! register and enabling the interrupts.
|
||||
//!
|
||||
//! \return Returns the state of PRIMASK register.
|
||||
//
|
||||
//*****************************************************************************
|
||||
static inline uint32_t
|
||||
CPU_clearPRIMASK(void)
|
||||
{
|
||||
//
|
||||
// Enable interrupts and return previous PRIMASK setting.
|
||||
//
|
||||
return(_enable_IRQ());
|
||||
}
|
||||
|
||||
//*****************************************************************************
|
||||
//
|
||||
//! Wrapper function for the WFI instruction
|
||||
//!
|
||||
//! \param None
|
||||
//!
|
||||
//! This function is wrapper function for the WFI instruction.
|
||||
//!
|
||||
//! \return None
|
||||
//
|
||||
//*****************************************************************************
|
||||
static inline void
|
||||
CPU_wfi(void)
|
||||
{
|
||||
//
|
||||
// Wait for the next interrupt.
|
||||
//
|
||||
__asm(" wfi\n");
|
||||
}
|
||||
|
||||
//*****************************************************************************
|
||||
//
|
||||
//! Writes the BASEPRI register
|
||||
//!
|
||||
//! \param None
|
||||
//!
|
||||
//! This function is wrapper function for writing the BASEPRI register. MSB
|
||||
//! 3-bits are enabled for setting the priority and non-implemented low-order
|
||||
//! bits read as zero and ignore writes. To set the base priority of 0x2U,
|
||||
//! the param \e basePriority to be passed should be 0x20U.
|
||||
//!
|
||||
//! \return None.
|
||||
//
|
||||
//*****************************************************************************
|
||||
static inline void
|
||||
CPU_setBASEPRI(uint32_t basePriority)
|
||||
{
|
||||
//
|
||||
// Set the BASEPRI register
|
||||
//
|
||||
_set_interrupt_priority(basePriority);
|
||||
}
|
||||
|
||||
//*****************************************************************************
|
||||
//
|
||||
//! Returns the state of BASEPRI register
|
||||
//!
|
||||
//! \param None
|
||||
//!
|
||||
//! This function is wrapper function for reading the BASEPRI register.
|
||||
//!
|
||||
//! \return Returns the state of BASEPRI register
|
||||
//
|
||||
//*****************************************************************************
|
||||
static inline uint32_t
|
||||
CPU_getBASEPRI(void)
|
||||
{
|
||||
//
|
||||
// Read BASEPRI register.
|
||||
//
|
||||
__asm(" mrs r0, BASEPRI\n"
|
||||
" bx lr\n");
|
||||
|
||||
//
|
||||
// The following keeps the compiler happy, because it wants to see a
|
||||
// return value from this function. It will generate code to return
|
||||
// a zero. However, the real return is the "bx lr" above, so the
|
||||
// return(0) is never executed and the function returns with the value
|
||||
// you expect in R0.
|
||||
//
|
||||
return(0U);
|
||||
}
|
||||
|
||||
//*****************************************************************************
|
||||
//
|
||||
// Extern compiler intrinsic prototypes. See compiler User's Guide for details.
|
||||
//
|
||||
//*****************************************************************************
|
||||
extern uint32_t __get_PRIMASK(void);
|
||||
extern uint32_t _disable_interrupts(void);
|
||||
extern uint32_t _enable_interrupts();
|
||||
extern uint32_t _disable_IRQ();
|
||||
extern uint32_t _enable_IRQ();
|
||||
extern uint32_t _set_interrupt_priority(uint32_t priority);
|
||||
|
||||
//*****************************************************************************
|
||||
//
|
||||
// Close the Doxygen group.
|
||||
//! @}
|
||||
//
|
||||
//*****************************************************************************
|
||||
|
||||
//*****************************************************************************
|
||||
//
|
||||
// Mark the end of the C bindings section for C++ compilers.
|
||||
//
|
||||
//*****************************************************************************
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif // CPU_H
|
||||
+372
@@ -0,0 +1,372 @@
|
||||
//#############################################################################
|
||||
//
|
||||
// FILE: dcsm.c
|
||||
//
|
||||
// TITLE: C28x Driver for the DCSM security module.
|
||||
//
|
||||
//#############################################################################
|
||||
// $TI Release: $
|
||||
// $Release Date: $
|
||||
//
|
||||
// C2000Ware v5.04.00.00
|
||||
//
|
||||
// Copyright (C) 2024 Texas Instruments Incorporated - http://www.ti.com
|
||||
//
|
||||
// Redistribution and use in source and binary forms, with or without
|
||||
// modification, are permitted provided that the following conditions
|
||||
// are met:
|
||||
//
|
||||
// Redistributions of source code must retain the above copyright
|
||||
// notice, this list of conditions and the following disclaimer.
|
||||
//
|
||||
// Redistributions in binary form must reproduce the above copyright
|
||||
// notice, this list of conditions and the following disclaimer in the
|
||||
// documentation and/or other materials provided with the
|
||||
// distribution.
|
||||
//
|
||||
// Neither the name of Texas Instruments Incorporated nor the names of
|
||||
// its contributors may be used to endorse or promote products derived
|
||||
// from this software without specific prior written permission.
|
||||
//
|
||||
// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
|
||||
// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
|
||||
// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
|
||||
// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
|
||||
// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
|
||||
// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
|
||||
// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
|
||||
// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
|
||||
// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
||||
// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
|
||||
// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
// $
|
||||
//#############################################################################
|
||||
|
||||
#include "dcsm.h"
|
||||
|
||||
//*****************************************************************************
|
||||
//
|
||||
// DCSM_writeZone1CSM
|
||||
//
|
||||
//*****************************************************************************
|
||||
void
|
||||
DCSM_writeZone1CSM(const DCSM_CSMPasswordKey * const psCMDKey)
|
||||
{
|
||||
//
|
||||
// Check the arguments.
|
||||
//
|
||||
ASSERT(psCMDKey != NULL);
|
||||
|
||||
HWREG(DCSM_Z1_BASE + DCSM_O_Z1_CSMKEY0) = psCMDKey->csmKey0;
|
||||
HWREG(DCSM_Z1_BASE + DCSM_O_Z1_CSMKEY1) = psCMDKey->csmKey1;
|
||||
HWREG(DCSM_Z1_BASE + DCSM_O_Z1_CSMKEY2) = psCMDKey->csmKey2;
|
||||
HWREG(DCSM_Z1_BASE + DCSM_O_Z1_CSMKEY3) = psCMDKey->csmKey3;
|
||||
|
||||
}
|
||||
|
||||
//*****************************************************************************
|
||||
//
|
||||
// DCSM_writeZone2CSM
|
||||
//
|
||||
//*****************************************************************************
|
||||
void
|
||||
DCSM_writeZone2CSM(const DCSM_CSMPasswordKey * const psCMDKey)
|
||||
{
|
||||
//
|
||||
// Check the arguments.
|
||||
//
|
||||
ASSERT(psCMDKey != NULL);
|
||||
|
||||
HWREG(DCSM_Z2_BASE + DCSM_O_Z2_CSMKEY0) = psCMDKey->csmKey0;
|
||||
HWREG(DCSM_Z2_BASE + DCSM_O_Z2_CSMKEY1) = psCMDKey->csmKey1;
|
||||
HWREG(DCSM_Z2_BASE + DCSM_O_Z2_CSMKEY2) = psCMDKey->csmKey2;
|
||||
HWREG(DCSM_Z2_BASE + DCSM_O_Z2_CSMKEY3) = psCMDKey->csmKey3;
|
||||
|
||||
}
|
||||
//*****************************************************************************
|
||||
//
|
||||
// DCSM_getZone1FlashEXEStatus
|
||||
//
|
||||
//*****************************************************************************
|
||||
DCSM_EXEOnlyStatus
|
||||
DCSM_getZone1FlashEXEStatus(DCSM_Sector sector, DCSM_CPUSel cpuInst)
|
||||
{
|
||||
uint16_t regValue;
|
||||
uint32_t regintValue;
|
||||
DCSM_EXEOnlyStatus status;
|
||||
|
||||
//
|
||||
// Check if sector belongs to this zone
|
||||
//
|
||||
if(DCSM_getFlashSectorZone(sector, cpuInst) != DCSM_MEMORY_ZONE1)
|
||||
{
|
||||
status = DCSM_INCORRECT_ZONE;
|
||||
}
|
||||
else
|
||||
{
|
||||
//
|
||||
// Get the EXE status register
|
||||
//
|
||||
if(cpuInst == DCSM_CPUSEL_CPU1)
|
||||
{
|
||||
regintValue = ((HWREG(DCSM_Z1_BASE +
|
||||
DCSM_O_Z1_EXEONLYSECT1R)) &
|
||||
DCSM_EXEONLYSECTR_M);
|
||||
|
||||
regValue = (uint16_t)regintValue;
|
||||
}
|
||||
else if(cpuInst == DCSM_CPUSEL_CM)
|
||||
{
|
||||
regintValue = ((HWREG(DCSM_Z1_BASE + DCSM_O_Z1_EXEONLYSECT1R))
|
||||
>> DCSM_EXEONLYSECTR_S);
|
||||
|
||||
regValue = (uint16_t)regintValue;
|
||||
}
|
||||
else
|
||||
{
|
||||
regValue = (HWREGH(DCSM_Z1_BASE + DCSM_O_Z1_EXEONLYSECT2R));
|
||||
|
||||
}
|
||||
|
||||
//
|
||||
// Get the EXE status of the Flash Sector
|
||||
//
|
||||
status = (DCSM_EXEOnlyStatus)((regValue >> (uint16_t)sector) &
|
||||
(uint16_t)0x01U);
|
||||
}
|
||||
return(status);
|
||||
}
|
||||
|
||||
//*****************************************************************************
|
||||
//
|
||||
// DCSM_getZone1RAMEXEStatus
|
||||
//
|
||||
//*****************************************************************************
|
||||
DCSM_EXEOnlyStatus
|
||||
DCSM_getZone1RAMEXEStatus(DCSM_RAMModule module, DCSM_CPUSel cpuInst)
|
||||
{
|
||||
DCSM_EXEOnlyStatus status;
|
||||
DCSM_RAMModule moduleCM = (DCSM_RAMModule)0U;
|
||||
|
||||
ASSERT(cpuInst <= DCSM_CPUSEL_CPU2);
|
||||
|
||||
if((cpuInst == DCSM_CPUSEL_CPU1) || (cpuInst == DCSM_CPUSEL_CPU2))
|
||||
ASSERT(module < DCSM_C28_RAM_END);
|
||||
|
||||
if(cpuInst == DCSM_CPUSEL_CM)
|
||||
{
|
||||
ASSERT((module > DCSM_C28_RAM_END) &&
|
||||
(module < DCSM_CM_RAM_END));
|
||||
|
||||
moduleCM = (DCSM_RAMModule)(module - (DCSM_C28_RAM_END + 1U));
|
||||
}
|
||||
|
||||
//
|
||||
// Check if module belongs to this zone
|
||||
//
|
||||
if(DCSM_getRAMZone(module, cpuInst) != DCSM_MEMORY_ZONE1)
|
||||
{
|
||||
status = DCSM_INCORRECT_ZONE;
|
||||
}
|
||||
else
|
||||
{
|
||||
//
|
||||
// Get the EXE status of the RAM Module
|
||||
//
|
||||
if(cpuInst == DCSM_CPUSEL_CPU1)
|
||||
{
|
||||
status = (DCSM_EXEOnlyStatus)((HWREGH(DCSM_Z1_BASE +
|
||||
DCSM_O_Z1_EXEONLYRAM1R) >>
|
||||
(uint16_t)module) & (uint16_t)0x01U);
|
||||
}
|
||||
else if(cpuInst == DCSM_CPUSEL_CM)
|
||||
{
|
||||
status = (DCSM_EXEOnlyStatus)(((uint32_t)HWREG(DCSM_Z1_BASE +
|
||||
DCSM_O_Z1_EXEONLYRAM1R) >>
|
||||
(DCSM_Z1_EXEONLYRAM1R_CM +
|
||||
(uint16_t)moduleCM)) &
|
||||
(uint32_t)0x01U);
|
||||
}
|
||||
else
|
||||
{
|
||||
status = (DCSM_EXEOnlyStatus)((HWREG(DCSM_Z1_BASE +
|
||||
DCSM_O_Z1_EXEONLYRAM1R) >>
|
||||
(DCSM_Z1_EXEONLYRAM1R_CPU2 -
|
||||
(uint16_t)module)) &
|
||||
(uint16_t)0x01U);
|
||||
}
|
||||
|
||||
}
|
||||
return(status);
|
||||
}
|
||||
|
||||
//*****************************************************************************
|
||||
//
|
||||
// DCSM_getZone2FlashEXEStatus
|
||||
//
|
||||
//*****************************************************************************
|
||||
DCSM_EXEOnlyStatus
|
||||
DCSM_getZone2FlashEXEStatus(DCSM_Sector sector, DCSM_CPUSel cpuInst)
|
||||
{
|
||||
uint16_t regValue;
|
||||
uint32_t regintValue;
|
||||
DCSM_EXEOnlyStatus status;
|
||||
|
||||
//
|
||||
// Check if sector belongs to this zone
|
||||
//
|
||||
if(DCSM_getFlashSectorZone(sector, cpuInst) != DCSM_MEMORY_ZONE2)
|
||||
{
|
||||
status = DCSM_INCORRECT_ZONE;
|
||||
}
|
||||
else
|
||||
{
|
||||
//
|
||||
// Get the EXE status register
|
||||
//
|
||||
if(cpuInst == DCSM_CPUSEL_CPU1)
|
||||
{
|
||||
regintValue = ((HWREG(DCSM_Z2_BASE +
|
||||
DCSM_O_Z2_EXEONLYSECT1R)) &
|
||||
DCSM_EXEONLYSECTR_M);
|
||||
|
||||
regValue = (uint16_t)regintValue;
|
||||
}
|
||||
else if(cpuInst == DCSM_CPUSEL_CM)
|
||||
{
|
||||
regintValue = ((HWREG(DCSM_Z2_BASE + DCSM_O_Z2_EXEONLYSECT1R))
|
||||
>> DCSM_EXEONLYSECTR_S);
|
||||
|
||||
regValue = (uint16_t)regintValue;
|
||||
}
|
||||
else
|
||||
{
|
||||
regValue = HWREGH(DCSM_Z2_BASE + DCSM_O_Z2_EXEONLYSECT2R);
|
||||
|
||||
}
|
||||
|
||||
//
|
||||
// Get the EXE status of the Flash Sector
|
||||
//
|
||||
status = (DCSM_EXEOnlyStatus)((regValue >> (uint16_t)sector) &
|
||||
(uint16_t)0x01U);
|
||||
}
|
||||
|
||||
return(status);
|
||||
}
|
||||
|
||||
//*****************************************************************************
|
||||
//
|
||||
// DCSM_getZone2RAMEXEStatus
|
||||
//
|
||||
//*****************************************************************************
|
||||
DCSM_EXEOnlyStatus
|
||||
DCSM_getZone2RAMEXEStatus(DCSM_RAMModule module, DCSM_CPUSel cpuInst)
|
||||
{
|
||||
DCSM_EXEOnlyStatus status;
|
||||
DCSM_RAMModule moduleCM = (DCSM_RAMModule)0U;
|
||||
|
||||
ASSERT(cpuInst <= DCSM_CPUSEL_CPU2);
|
||||
|
||||
if((cpuInst == DCSM_CPUSEL_CPU1) || (cpuInst == DCSM_CPUSEL_CPU2))
|
||||
ASSERT(module < DCSM_C28_RAM_END);
|
||||
|
||||
if(cpuInst == DCSM_CPUSEL_CM)
|
||||
{
|
||||
ASSERT((module > DCSM_C28_RAM_END) &&
|
||||
(module < DCSM_CM_RAM_END));
|
||||
|
||||
moduleCM = (DCSM_RAMModule)(module - (DCSM_C28_RAM_END + 1U));
|
||||
}
|
||||
|
||||
//
|
||||
// Check if module belongs to this zone
|
||||
//
|
||||
if(DCSM_getRAMZone(module, cpuInst) != DCSM_MEMORY_ZONE2)
|
||||
{
|
||||
status = DCSM_INCORRECT_ZONE;
|
||||
}
|
||||
else
|
||||
{
|
||||
//
|
||||
// Get the EXE status of the RAM Module
|
||||
//
|
||||
if(cpuInst == DCSM_CPUSEL_CPU1)
|
||||
{
|
||||
status = (DCSM_EXEOnlyStatus)((HWREGH(DCSM_Z2_BASE +
|
||||
DCSM_O_Z2_EXEONLYRAM1R) >>
|
||||
(uint16_t)module) & (uint16_t)0x01U);
|
||||
}
|
||||
else if(cpuInst == DCSM_CPUSEL_CM)
|
||||
{
|
||||
status = (DCSM_EXEOnlyStatus)((HWREG(DCSM_Z2_BASE +
|
||||
DCSM_O_Z2_EXEONLYRAM1R) >>
|
||||
(DCSM_Z2_EXEONLYRAM1R_CM +
|
||||
(uint16_t)moduleCM)) &
|
||||
(uint16_t)0x01U);
|
||||
}
|
||||
else
|
||||
{
|
||||
status = (DCSM_EXEOnlyStatus)((HWREG(DCSM_Z2_BASE +
|
||||
DCSM_O_Z2_EXEONLYRAM1R) >>
|
||||
(DCSM_Z2_EXEONLYRAM1R_CPU2 -
|
||||
(uint16_t)module)) &
|
||||
(uint16_t)0x01U);
|
||||
}
|
||||
}
|
||||
return(status);
|
||||
}
|
||||
|
||||
//*****************************************************************************
|
||||
//
|
||||
// DCSM_claimZoneSemaphore
|
||||
//
|
||||
//*****************************************************************************
|
||||
bool
|
||||
DCSM_claimZoneSemaphore(DCSM_SemaphoreZone zone)
|
||||
{
|
||||
//
|
||||
// FLSEM register address.
|
||||
//
|
||||
uint32_t regAddress = DCSMCOMMON_BASE + DCSM_O_FLSEM;
|
||||
|
||||
//
|
||||
// Write 0xA5 to the key and write the zone that is attempting to claim the
|
||||
// Flash Pump Semaphore to the semaphore bits.
|
||||
//
|
||||
HWREGH(regAddress) = ((uint16_t)FLSEM_KEY << DCSM_FLSEM_KEY_S) |
|
||||
(uint16_t)zone;
|
||||
|
||||
//
|
||||
// If the calling function was unable to claim the zone semaphore, then
|
||||
// return false
|
||||
//
|
||||
return(((HWREGH(regAddress) & DCSM_FLSEM_SEM_M) == (uint16_t)zone) ?
|
||||
true : false);
|
||||
}
|
||||
|
||||
//*****************************************************************************
|
||||
//
|
||||
// DCSM_releaseZoneSemaphore
|
||||
//
|
||||
//*****************************************************************************
|
||||
bool
|
||||
DCSM_releaseZoneSemaphore(void)
|
||||
{
|
||||
//
|
||||
// FLSEM register address.
|
||||
//
|
||||
uint32_t regAddress = DCSMCOMMON_BASE + DCSM_O_FLSEM;
|
||||
|
||||
//
|
||||
// Write 0xA5 to the key and write the zone that is attempting to claim the
|
||||
// Flash Pump Semaphore to the semaphore bits.
|
||||
//
|
||||
HWREGH(regAddress) = ((uint16_t)FLSEM_KEY << DCSM_FLSEM_KEY_S);
|
||||
|
||||
//
|
||||
// If the calling function was unable to release the zone semaphore, then
|
||||
// return false
|
||||
//
|
||||
return(((HWREGH(regAddress) & DCSM_FLSEM_SEM_M) == 0x0U) ? true : false);
|
||||
}
|
||||
+892
@@ -0,0 +1,892 @@
|
||||
//#############################################################################
|
||||
//
|
||||
// FILE: dcsm.h
|
||||
//
|
||||
// TITLE: C28x Driver for the DCSM security module.
|
||||
//
|
||||
//#############################################################################
|
||||
// $TI Release: $
|
||||
// $Release Date: $
|
||||
//
|
||||
// C2000Ware v5.04.00.00
|
||||
//
|
||||
// Copyright (C) 2024 Texas Instruments Incorporated - http://www.ti.com
|
||||
//
|
||||
// Redistribution and use in source and binary forms, with or without
|
||||
// modification, are permitted provided that the following conditions
|
||||
// are met:
|
||||
//
|
||||
// Redistributions of source code must retain the above copyright
|
||||
// notice, this list of conditions and the following disclaimer.
|
||||
//
|
||||
// Redistributions in binary form must reproduce the above copyright
|
||||
// notice, this list of conditions and the following disclaimer in the
|
||||
// documentation and/or other materials provided with the
|
||||
// distribution.
|
||||
//
|
||||
// Neither the name of Texas Instruments Incorporated nor the names of
|
||||
// its contributors may be used to endorse or promote products derived
|
||||
// from this software without specific prior written permission.
|
||||
//
|
||||
// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
|
||||
// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
|
||||
// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
|
||||
// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
|
||||
// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
|
||||
// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
|
||||
// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
|
||||
// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
|
||||
// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
||||
// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
|
||||
// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
// $
|
||||
//#############################################################################
|
||||
|
||||
#ifndef DCSM_H
|
||||
#define DCSM_H
|
||||
|
||||
//*****************************************************************************
|
||||
//
|
||||
// If building with a C++ compiler, make all of the definitions in this header
|
||||
// have a C binding.
|
||||
//
|
||||
//*****************************************************************************
|
||||
#ifdef __cplusplus
|
||||
extern "C"
|
||||
{
|
||||
#endif
|
||||
|
||||
//*****************************************************************************
|
||||
//
|
||||
//! \addtogroup dcsm_api DCSM
|
||||
//! @{
|
||||
//
|
||||
//*****************************************************************************
|
||||
|
||||
#include <stdbool.h>
|
||||
#include <stdint.h>
|
||||
#include "inc_cm/hw_dcsm.h"
|
||||
#include "inc_cm/hw_types.h"
|
||||
#include "inc_cm/hw_memmap.h"
|
||||
#include "inc_cm/hw_sysctl.h"
|
||||
#include "cpu.h"
|
||||
#include "debug.h"
|
||||
|
||||
|
||||
//*****************************************************************************
|
||||
//
|
||||
// Register key defines.
|
||||
//
|
||||
//*****************************************************************************
|
||||
#define FLSEM_KEY 0xA5U //!< Zone semaphore key
|
||||
|
||||
//*****************************************************************************
|
||||
//
|
||||
//! Data structures to hold password keys.
|
||||
//
|
||||
//*****************************************************************************
|
||||
typedef struct
|
||||
{
|
||||
uint32_t csmKey0;
|
||||
uint32_t csmKey1;
|
||||
uint32_t csmKey2;
|
||||
uint32_t csmKey3;
|
||||
} DCSM_CSMPasswordKey;
|
||||
|
||||
//*****************************************************************************
|
||||
//
|
||||
//! Values to distinguish the status of RAM or FLASH sectors. These values
|
||||
//! describe which zone the memory location belongs too.
|
||||
//! These values can be returned from DCSM_getRAMZone(),
|
||||
//! DCSM_getFlashSectorZone().
|
||||
//
|
||||
//*****************************************************************************
|
||||
typedef enum
|
||||
{
|
||||
DCSM_MEMORY_INACCESSIBLE, //!< Inaccessible
|
||||
DCSM_MEMORY_ZONE1, //!< Zone 1
|
||||
DCSM_MEMORY_ZONE2, //!< Zone 2
|
||||
DCSM_MEMORY_FULL_ACCESS //!< Full access
|
||||
} DCSM_MemoryStatus;
|
||||
|
||||
//*****************************************************************************
|
||||
//
|
||||
//! Values to pass to DCSM_claimZoneSemaphore(). These values are used
|
||||
//! to describe the zone that can write to Flash Wrapper registers.
|
||||
//
|
||||
//*****************************************************************************
|
||||
typedef enum
|
||||
{
|
||||
DCSM_FLSEM_ZONE1 = 0x01U, //!< Flash semaphore Zone 1
|
||||
DCSM_FLSEM_ZONE2 = 0x02U //!< Flash semaphore Zone 2
|
||||
} DCSM_SemaphoreZone;
|
||||
|
||||
//*****************************************************************************
|
||||
//
|
||||
//! Values to distinguish the security status of the zones.
|
||||
//! These values can be returned from DCSM_getZone1CSMSecurityStatus(),
|
||||
//! DCSM_getZone2CSMSecurityStatus().
|
||||
//
|
||||
//*****************************************************************************
|
||||
typedef enum
|
||||
{
|
||||
DCSM_STATUS_SECURE, //!< Secure
|
||||
DCSM_STATUS_UNSECURE, //!< Unsecure
|
||||
DCSM_STATUS_LOCKED, //!< Locked
|
||||
DCSM_STATUS_BLOCKED //!< Blocked
|
||||
} DCSM_SecurityStatus;
|
||||
|
||||
//*****************************************************************************
|
||||
//
|
||||
// Values to distinguish the status of the Control Registers. These values
|
||||
// describe can be used with the return values of
|
||||
// DCSM_getZone1ControlStatus(), and DCSM_getZone2ControlStatus().
|
||||
//
|
||||
//*****************************************************************************
|
||||
#define DCSM_ALLZERO 0x08U //!< CSM Passwords all zeros
|
||||
#define DCSM_ALLONE 0x10U //!< CSM Passwords all ones
|
||||
#define DCSM_UNSECURE 0x20U //!< Zone is secure/unsecure
|
||||
#define DCSM_ARMED 0x40U //!< CSM is armed
|
||||
|
||||
//*****************************************************************************
|
||||
//
|
||||
//! Values to decribe the EXEONLY Status.
|
||||
//! These values are returned from to DCSM_getZone1RAMEXEStatus(),
|
||||
//! DCSM_getZone2RAMEXEStatus(), DCSM_getZone1FlashEXEStatus(),
|
||||
//! DCSM_getZone2FlashEXEStatus().
|
||||
//
|
||||
//*****************************************************************************
|
||||
typedef enum
|
||||
{
|
||||
DCSM_PROTECTED, //!< Protected
|
||||
DCSM_UNPROTECTED, //!< Unprotected
|
||||
DCSM_INCORRECT_ZONE //!< Incorrect Zone
|
||||
}DCSM_EXEOnlyStatus;
|
||||
|
||||
//*****************************************************************************
|
||||
//
|
||||
//! Values to distinguish RAM Module.
|
||||
//! These values can be passed to DCSM_getZone1RAMEXEStatus()
|
||||
//! DCSM_getZone2RAMEXEStatus(), DCSM_getRAMZone().
|
||||
//
|
||||
//*****************************************************************************
|
||||
typedef enum
|
||||
{
|
||||
//C28x RAMs
|
||||
DCSM_RAMLS0, //!< RAMLS0
|
||||
DCSM_RAMLS1, //!< RAMLS1
|
||||
DCSM_RAMLS2, //!< RAMLS2
|
||||
DCSM_RAMLS3, //!< RAMLS3
|
||||
DCSM_RAMLS4, //!< RAMLS4
|
||||
DCSM_RAMLS5, //!< RAMLS5
|
||||
DCSM_RAMLS6, //!< RAMLS6
|
||||
DCSM_RAMLS7, //!< RAMLS7
|
||||
DCSM_RAMD0, //!< RAMD0
|
||||
DCSM_RAMD1, //!< RAMD1
|
||||
DCSM_C28_RAM_END,
|
||||
//CM RAMs
|
||||
DCSM_RAM_CM_C0 , //!< RAM CM C0
|
||||
DCSM_RAM_CM_C1 , //!< RAM CM C1
|
||||
DCSM_RAM1_CPU1_CM , //!< CPU1 to CM Message RAM 1
|
||||
DCSM_RAM2_CPU1_CM , //!< CPU1 to CM Message RAM 2
|
||||
DCSM_RAM1_CM_CPU1 , //!< CM to CPU1 Message RAM 1
|
||||
DCSM_RAM2_CM_CPU1 , //!< CM to CPU1 Message RAM 2
|
||||
DCSM_RAM1_CPU2_CM , //!< CPU2 to CM Message RAM 1
|
||||
DCSM_RAM2_CPU2_CM , //!< CPU2 to CM Message RAM 2
|
||||
DCSM_RAM1_CM_CPU2 , //!< CM to CPU2 Message RAM 1
|
||||
DCSM_RAM2_CM_CPU2 , //!< CM to CPU2 Message RAM 2
|
||||
DCSM_RAM1_CPU1_CPU2, //!< CPU1 to CPU2 Message RAM 1
|
||||
DCSM_RAM2_CPU1_CPU2, //!< CPU1 to CPU2 Message RAM 2
|
||||
DCSM_RAM1_CPU2_CPU1, //!< CPU2 to CPU1 Message RAM 1
|
||||
DCSM_RAM2_CPU2_CPU1, //!< CPU2 to CPU1 Message RAM 2
|
||||
DCSM_CM_RAM_END,
|
||||
} DCSM_RAMModule;
|
||||
|
||||
//*****************************************************************************
|
||||
//
|
||||
//! Values to distinguish Flash Sector.
|
||||
//! These values can be passed to DCSM_getZone1FlashEXEStatus()
|
||||
//! DCSM_getZone2FlashEXEStatus(), DCSM_getFlashSectorZone().
|
||||
//
|
||||
//*****************************************************************************
|
||||
typedef enum
|
||||
{
|
||||
DCSM_SECTOR_0, //!< Sector 0
|
||||
DCSM_SECTOR_1, //!< Sector 1
|
||||
DCSM_SECTOR_2, //!< Sector 2
|
||||
DCSM_SECTOR_3, //!< Sector 3
|
||||
DCSM_SECTOR_4, //!< Sector 4
|
||||
DCSM_SECTOR_5, //!< Sector 5
|
||||
DCSM_SECTOR_6, //!< Sector 6
|
||||
DCSM_SECTOR_7, //!< Sector 7
|
||||
DCSM_SECTOR_8, //!< Sector 8
|
||||
DCSM_SECTOR_9, //!< Sector 9
|
||||
DCSM_SECTOR_10, //!< Sector 10
|
||||
DCSM_SECTOR_11, //!< Sector 11
|
||||
DCSM_SECTOR_12, //!< Sector 12
|
||||
DCSM_SECTOR_13 //!< Sector 13
|
||||
} DCSM_Sector;
|
||||
|
||||
//*****************************************************************************
|
||||
//
|
||||
//! The following are values that can be passed to
|
||||
//! DCSM_getRAMZone() as \e cpuInst parameter.
|
||||
//
|
||||
//*****************************************************************************
|
||||
typedef enum
|
||||
{
|
||||
//! To access CPU1 RAM
|
||||
DCSM_CPUSEL_CPU1 = 0x0U,
|
||||
//! To access CPU2 RAM
|
||||
DCSM_CPUSEL_CPU2 = 0x2U,
|
||||
//! To access CM RAM
|
||||
DCSM_CPUSEL_CM = 0x1U
|
||||
|
||||
} DCSM_CPUSel;
|
||||
|
||||
//*****************************************************************************
|
||||
//
|
||||
// Defines for the FLSEM register.
|
||||
// These values can be passed to the DCSM_setFlashSemaphore().
|
||||
//
|
||||
//*****************************************************************************
|
||||
#define DCSM_FLSEM_ALLACCESS_1 0x00000000 //!< No restriction
|
||||
#define DCSM_FLSEM_Z1ACCESS 0x00000001 //!< Zone 1 Access
|
||||
#define DCSM_FLSEM_Z2ACCESS 0x00000002 //!< Zone 2 Access
|
||||
#define DCSM_FLSEM_ALLACCESS_2 0x00000003 //!< No restriction
|
||||
|
||||
//*****************************************************************************
|
||||
//
|
||||
// Defines for the EXEONLYSECTxR register.
|
||||
// These values can be used in the DCSM_getZone1FlashEXEStatus() &
|
||||
// DCSM_getZone2FlashEXEStatus().
|
||||
//
|
||||
//*****************************************************************************
|
||||
|
||||
#define DCSM_EXEONLYSECTR_M 0x0000FFFFU
|
||||
#define DCSM_EXEONLYSECTR_S 16U
|
||||
|
||||
//*****************************************************************************
|
||||
//
|
||||
// Defines for the Z1_CR & Z2_CR register.
|
||||
// These values can be used in the DCSM_getZone1ControlStatus() &
|
||||
// DCSM_getZone2ControlStatus().
|
||||
//
|
||||
//*****************************************************************************
|
||||
|
||||
#define DCSM_ZX_CR_S 16U
|
||||
|
||||
//*****************************************************************************
|
||||
//
|
||||
// Defines for the EXEONLYRAM1R register for Zone 1 and Zone 2.
|
||||
// These values can be used in the DCSM_getZone1RAMEXEStatus(),
|
||||
// DCSM_getZone1RAMEXEStatus().
|
||||
//
|
||||
//*****************************************************************************
|
||||
#define DCSM_Z1_EXEONLYRAM1R_CM 16U
|
||||
#define DCSM_Z1_EXEONLYRAM1R_CPU2 31U
|
||||
#define DCSM_Z2_EXEONLYRAM1R_CM 16U
|
||||
#define DCSM_Z2_EXEONLYRAM1R_CPU2 31U
|
||||
|
||||
//*****************************************************************************
|
||||
//
|
||||
// DCSM functions
|
||||
//
|
||||
//*****************************************************************************
|
||||
|
||||
//*****************************************************************************
|
||||
//
|
||||
//! Secures zone 1 by setting the FORCESEC bit of Z1_CR register
|
||||
//!
|
||||
//! This function resets the state of the zone. If the zone is unlocked,
|
||||
//! it will lock(secure) the zone and also reset all the bits in the
|
||||
//! Control Register.
|
||||
//!
|
||||
//! \return None.
|
||||
//
|
||||
//*****************************************************************************
|
||||
static inline void
|
||||
DCSM_secureZone1(void)
|
||||
{
|
||||
//
|
||||
// Write to the FORCESEC bit.
|
||||
//
|
||||
HWREG(DCSM_Z1_BASE + DCSM_O_Z1_CR)|= DCSM_Z1_CR_FORCESEC;
|
||||
}
|
||||
|
||||
//*****************************************************************************
|
||||
//
|
||||
//! Secures zone 2 by setting the FORCESEC bit of Z2_CR register
|
||||
//!
|
||||
//! This function resets the state of the zone. If the zone is unlocked,
|
||||
//! it will lock(secure) the zone and also reset all the bits in the
|
||||
//! Control Register.
|
||||
//!
|
||||
//! \return None.
|
||||
//
|
||||
//*****************************************************************************
|
||||
static inline void
|
||||
DCSM_secureZone2(void)
|
||||
{
|
||||
//
|
||||
// Write to the FORCESEC bit.
|
||||
//
|
||||
HWREG(DCSM_Z2_BASE + DCSM_O_Z2_CR)|= DCSM_Z2_CR_FORCESEC;
|
||||
}
|
||||
|
||||
//*****************************************************************************
|
||||
//
|
||||
//! Enable Zone 1 EXEONLY protection
|
||||
//!
|
||||
//! \return None.
|
||||
//
|
||||
//*****************************************************************************
|
||||
static inline void
|
||||
DCSM_enableZone1EXEONLY(void)
|
||||
{
|
||||
HWREGH(DCSM_Z1_BASE + DCSM_O_Z1_EXEONLYDIS) &= ~DCSM_Z1_EXEONLYDIS_DIS;
|
||||
}
|
||||
|
||||
//*****************************************************************************
|
||||
//
|
||||
//! Disable Zone 1 EXEONLY protection
|
||||
//!
|
||||
//! \return None.
|
||||
//
|
||||
//*****************************************************************************
|
||||
static inline void
|
||||
DCSM_disableZone1EXEONLY(void)
|
||||
{
|
||||
HWREGH(DCSM_Z1_BASE + DCSM_O_Z1_EXEONLYDIS) |= DCSM_Z1_EXEONLYDIS_DIS;
|
||||
}
|
||||
|
||||
//*****************************************************************************
|
||||
//
|
||||
//! Enable Zone 2 EXEONLY protection
|
||||
//!
|
||||
//! \return None.
|
||||
//
|
||||
//*****************************************************************************
|
||||
static inline void
|
||||
DCSM_enableZone2EXEONLY(void)
|
||||
{
|
||||
HWREGH(DCSM_Z2_BASE + DCSM_O_Z2_EXEONLYDIS) &= ~DCSM_Z2_EXEONLYDIS_DIS;
|
||||
}
|
||||
|
||||
//*****************************************************************************
|
||||
//
|
||||
//! Disable Zone 2 EXEONLY protection
|
||||
//!
|
||||
//! \return None.
|
||||
//
|
||||
//*****************************************************************************
|
||||
static inline void
|
||||
DCSM_disableZone2EXEONLY(void)
|
||||
{
|
||||
HWREGH(DCSM_Z2_BASE + DCSM_O_Z2_EXEONLYDIS) |= DCSM_Z2_EXEONLYDIS_DIS;
|
||||
}
|
||||
|
||||
//*****************************************************************************
|
||||
//
|
||||
//! Returns the CSM security status of zone 1
|
||||
//!
|
||||
//! This function returns the security status of zone 1 CSM
|
||||
//!
|
||||
//! \return Returns security status as an enumerated type DCSM_SecurityStatus.
|
||||
//
|
||||
//*****************************************************************************
|
||||
static inline DCSM_SecurityStatus
|
||||
DCSM_getZone1CSMSecurityStatus(void)
|
||||
{
|
||||
uint32_t status;
|
||||
DCSM_SecurityStatus returnStatus;
|
||||
status = HWREG(DCSM_Z1_BASE + DCSM_O_Z1_CR);
|
||||
|
||||
//
|
||||
// if ARMED bit is set and UNSECURED bit is set then CSM is unsecured.
|
||||
// Else it is secure.
|
||||
//
|
||||
if(((status & DCSM_Z1_CR_ARMED) != 0U) &&
|
||||
((status & DCSM_Z1_CR_UNSECURE) != 0U))
|
||||
{
|
||||
returnStatus = DCSM_STATUS_UNSECURE;
|
||||
}
|
||||
else if((status & DCSM_Z1_CR_ALLONE) == DCSM_Z1_CR_ALLONE)
|
||||
{
|
||||
returnStatus = DCSM_STATUS_BLOCKED;
|
||||
}
|
||||
else if((status & DCSM_Z1_CR_ALLZERO) == DCSM_Z1_CR_ALLZERO)
|
||||
{
|
||||
returnStatus = DCSM_STATUS_LOCKED;
|
||||
}
|
||||
else
|
||||
{
|
||||
returnStatus = DCSM_STATUS_SECURE;
|
||||
}
|
||||
|
||||
return(returnStatus);
|
||||
}
|
||||
|
||||
//*****************************************************************************
|
||||
//
|
||||
//! Returns the CSM security status of zone 2
|
||||
//!
|
||||
//! This function returns the security status of zone 2 CSM
|
||||
//!
|
||||
//! \return Returns security status as an enumerated type DCSM_SecurityStatus.
|
||||
//
|
||||
//*****************************************************************************
|
||||
static inline DCSM_SecurityStatus
|
||||
DCSM_getZone2CSMSecurityStatus(void)
|
||||
{
|
||||
uint32_t status;
|
||||
DCSM_SecurityStatus returnStatus;
|
||||
status = HWREG(DCSM_Z2_BASE + DCSM_O_Z2_CR);
|
||||
|
||||
//
|
||||
// if ARMED bit is set and UNSECURED bit is set then CSM is unsecured.
|
||||
// Else it is secure.
|
||||
//
|
||||
if(((status & DCSM_Z2_CR_ARMED) != 0U) &&
|
||||
((status & DCSM_Z2_CR_UNSECURE) != 0U))
|
||||
{
|
||||
returnStatus = DCSM_STATUS_UNSECURE;
|
||||
}
|
||||
else if((status & DCSM_Z2_CR_ALLONE) == DCSM_Z2_CR_ALLONE)
|
||||
{
|
||||
returnStatus = DCSM_STATUS_BLOCKED;
|
||||
}
|
||||
else if((status & DCSM_Z2_CR_ALLZERO) == DCSM_Z2_CR_ALLZERO)
|
||||
{
|
||||
returnStatus = DCSM_STATUS_LOCKED;
|
||||
}
|
||||
else
|
||||
{
|
||||
returnStatus = DCSM_STATUS_SECURE;
|
||||
}
|
||||
|
||||
return(returnStatus);
|
||||
}
|
||||
|
||||
//*****************************************************************************
|
||||
//
|
||||
//! Returns the Control Status of zone 1
|
||||
//!
|
||||
//! This function returns the Control Status of zone 1 CSM
|
||||
//!
|
||||
//! \return Returns the contents of the Control Register which can be
|
||||
//! used with provided defines.
|
||||
//
|
||||
//*****************************************************************************
|
||||
static inline uint16_t
|
||||
DCSM_getZone1ControlStatus(void)
|
||||
{
|
||||
uint32_t stat;
|
||||
//
|
||||
// Return the contents of the CR register.
|
||||
//
|
||||
|
||||
stat = ((HWREG(DCSM_Z1_BASE + DCSM_O_Z1_CR)) >> DCSM_ZX_CR_S);
|
||||
|
||||
return((uint16_t)stat);
|
||||
|
||||
}
|
||||
|
||||
//*****************************************************************************
|
||||
//
|
||||
//! Returns the Control Status of zone 2
|
||||
//!
|
||||
//! This function returns the Control Status of zone 2 CSM
|
||||
//!
|
||||
//! \return Returns the contents of the Control Register which can be
|
||||
//! used with the provided defines.
|
||||
//
|
||||
//*****************************************************************************
|
||||
static inline uint16_t
|
||||
DCSM_getZone2ControlStatus(void)
|
||||
{
|
||||
uint32_t stat;
|
||||
//
|
||||
// Return the contents of the CR register.
|
||||
//
|
||||
stat = ((HWREG(DCSM_Z2_BASE + DCSM_O_Z2_CR)) >> DCSM_ZX_CR_S);
|
||||
|
||||
return((uint16_t)stat);
|
||||
}
|
||||
|
||||
//*****************************************************************************
|
||||
//
|
||||
//! Returns the security zone a RAM section belongs to
|
||||
//!
|
||||
//! \param module is the RAM module value. Valid values are type DCSM_RAMModule
|
||||
//! C28x RAMs :
|
||||
//! - \b DCSM_RAMLS0
|
||||
//! - \b DCSM_RAMLS1
|
||||
//! - \b DCSM_RAMLS2
|
||||
//! - \b DCSM_RAMLS3
|
||||
//! - \b DCSM_RAMLS4
|
||||
//! - \b DCSM_RAMLS5
|
||||
//! - \b DCSM_RAMLS6
|
||||
//! - \b DCSM_RAMLS7
|
||||
//! - \b DCSM_RAMD0
|
||||
//! - \b DCSM_RAMD1
|
||||
//! CM RAMs :
|
||||
//! - \b DCSM_RAM_CM_C0
|
||||
//! - \b DCSM_RAM_CM_C1
|
||||
//! - \b DCSM_RAM1_CPU1_CM
|
||||
//! - \b DCSM_RAM2_CPU1_CM
|
||||
//! - \b DCSM_RAM1_CM_CPU1
|
||||
//! - \b DCSM_RAM2_CM_CPU1
|
||||
//! - \b DCSM_RAM1_CPU2_CM
|
||||
//! - \b DCSM_RAM2_CPU2_CM
|
||||
//! - \b DCSM_RAM1_CM_CPU2
|
||||
//! - \b DCSM_RAM2_CM_CPU2
|
||||
//! - \b DCSM_RAM1_CPU1_CPU2
|
||||
//! - \b DCSM_RAM2_CPU1_CPU2
|
||||
//! - \b DCSM_RAM1_CPU2_CPU1
|
||||
//! - \b DCSM_RAM2_CPU2_CPU1
|
||||
//!
|
||||
//! \param cpuInst is the CPU whose RAM Section needs to be accessed .
|
||||
//!
|
||||
//! The \e cpuInst parameter can have one the following values:
|
||||
//! - \b DCSM_CPUSEL_CPU1 - To access CPU1 RAM
|
||||
//! - \b DCSM_CPUSEL_CPU2 - To access CPU2 RAM
|
||||
//! - \b DCSM_CPUSEL_CM - To access CM RAM
|
||||
//!
|
||||
//! \note DCSM_CPUSEL_CPU1 & DCSM_CPUSEL_CPU2 can only be used with
|
||||
//! C28x RAMs (in DCSM_RAMModule) & DCSM_CPUSEL_CM can only be used with
|
||||
//! CM RAMs(in DCSM_RAMModule)
|
||||
//!
|
||||
//!
|
||||
//! This function returns the security zone a RAM section belongs to.
|
||||
//!
|
||||
//! \return Returns DCSM_MEMORY_INACCESSIBLE if the section is inaccessible,
|
||||
//! DCSM_MEMORY_ZONE1 if the section belongs to zone 1, DCSM_MEMORY_ZONE2 if
|
||||
//! the section belongs to zone 2 and DCSM_MEMORY_FULL_ACCESS if the section
|
||||
//! doesn't belong to any zone (or if the section is unsecure).
|
||||
//
|
||||
//*****************************************************************************
|
||||
static inline DCSM_MemoryStatus
|
||||
DCSM_getRAMZone(DCSM_RAMModule module, DCSM_CPUSel cpuInst)
|
||||
{
|
||||
uint16_t shift = (uint16_t)module * 2U;
|
||||
DCSM_RAMModule moduleCM;
|
||||
|
||||
//
|
||||
// Check the arguments.
|
||||
//
|
||||
if((cpuInst == DCSM_CPUSEL_CPU1) || (cpuInst == DCSM_CPUSEL_CPU2))
|
||||
ASSERT(module < DCSM_C28_RAM_END);
|
||||
|
||||
if(cpuInst == DCSM_CPUSEL_CM)
|
||||
{
|
||||
ASSERT((module > DCSM_C28_RAM_END) &&
|
||||
(module < DCSM_CM_RAM_END));
|
||||
|
||||
moduleCM = (DCSM_RAMModule)(module - (DCSM_C28_RAM_END + 1U));
|
||||
shift = (uint16_t)moduleCM * 2U;
|
||||
}
|
||||
|
||||
//
|
||||
//Read the RAMSTAT register for the specific RAM Module.
|
||||
//
|
||||
|
||||
return((DCSM_MemoryStatus)((HWREG(DCSMCOMMON_BASE + DCSM_O_RAMSTAT1
|
||||
+ (4U * (uint16_t)cpuInst)) >> shift)
|
||||
& 0x03U));
|
||||
|
||||
|
||||
}
|
||||
|
||||
//*****************************************************************************
|
||||
//
|
||||
//! Returns the security zone a flash sector belongs to
|
||||
//!
|
||||
//! \param sector is the flash sector value. Use DCSM_Sector type.
|
||||
//!
|
||||
//! This function returns the security zone a flash sector belongs to.
|
||||
//!
|
||||
//! \return Returns DCSM_MEMORY_INACCESSIBLE if the section is inaccessible ,
|
||||
//! DCSM_MEMORY_ZONE1 if the section belongs to zone 1, DCSM_MEMORY_ZONE2 if
|
||||
//! the section belongs to zone 2 and DCSM_MEMORY_FULL_ACCESS if the section
|
||||
//! doesn't belong to any zone (or if the section is unsecure)..
|
||||
//
|
||||
//*****************************************************************************
|
||||
static inline DCSM_MemoryStatus
|
||||
DCSM_getFlashSectorZone(DCSM_Sector sector, DCSM_CPUSel cpuInst)
|
||||
{
|
||||
uint32_t sectStat;
|
||||
uint16_t shift;
|
||||
|
||||
//
|
||||
// Get the Sector status register for the specific bank
|
||||
//
|
||||
sectStat = HWREG(DCSMCOMMON_BASE + DCSM_O_SECTSTAT1 +
|
||||
(4U*(uint16_t)cpuInst));
|
||||
shift = (uint16_t)sector * 2U;
|
||||
|
||||
//
|
||||
//Read the SECTSTAT register for the specific Flash Sector.
|
||||
//
|
||||
return((DCSM_MemoryStatus)((sectStat >> shift) & 0x3U));
|
||||
}
|
||||
|
||||
//*****************************************************************************
|
||||
//
|
||||
//! Read Zone 1 Link Pointer Error
|
||||
//!
|
||||
//! A non-zero value indicates an error on the bit position that is set to 1.
|
||||
//!
|
||||
//! \return Returns the value of the Zone 1 Link Pointer error.
|
||||
//
|
||||
//*****************************************************************************
|
||||
static inline uint32_t
|
||||
DCSM_getZone1LinkPointerError(void)
|
||||
{
|
||||
//
|
||||
// Return the LinkPointer Error for specific bank
|
||||
//
|
||||
return(HWREG(DCSM_Z1_BASE + DCSM_O_Z1_LINKPOINTERERR));
|
||||
}
|
||||
|
||||
//*****************************************************************************
|
||||
//
|
||||
//! Read Zone 2 Link Pointer Error
|
||||
//!
|
||||
//! A non-zero value indicates an error on the bit position that is set to 1.
|
||||
//!
|
||||
//! \return Returns the value of the Zone 2 Link Pointer error.
|
||||
//
|
||||
//*****************************************************************************
|
||||
static inline uint32_t
|
||||
DCSM_getZone2LinkPointerError(void)
|
||||
{
|
||||
//
|
||||
// Return the LinkPointer Error for specific bank
|
||||
//
|
||||
return(HWREG(DCSM_Z2_BASE + DCSM_O_Z2_LINKPOINTERERR));
|
||||
}
|
||||
|
||||
//*****************************************************************************
|
||||
//
|
||||
//! Unlocks Zone 2 CSM.
|
||||
//!
|
||||
//! \param psCMDKey is a pointer to the CSMPSWDKEY that has the CSM
|
||||
//! password for zone 2.
|
||||
//!
|
||||
//! This function unlocks the CSM password. It first reads
|
||||
//! the four password locations in the User OTP. If any of the password values
|
||||
//! is different from 0xFFFFFFFF, it unlocks the device by writing the
|
||||
//! provided passwords into CSM Key registers
|
||||
//!
|
||||
//! \return None.
|
||||
//
|
||||
//*****************************************************************************
|
||||
extern void
|
||||
DCSM_writeZone1CSM(const DCSM_CSMPasswordKey * const psCMDKey);
|
||||
|
||||
//*****************************************************************************
|
||||
//
|
||||
//! Unlocks Zone 2 CSM.
|
||||
//!
|
||||
//! \param psCMDKey is a pointer to the CSMPSWDKEY that has the CSM
|
||||
//! password for zone 2.
|
||||
//!
|
||||
//! This function unlocks the CSM password. It first reads
|
||||
//! the four password locations in the User OTP. If any of the password values
|
||||
//! is different from 0xFFFFFFFF, it unlocks the device by writing the
|
||||
//! provided passwords into CSM Key registers
|
||||
//!
|
||||
//! \return None.
|
||||
//
|
||||
//*****************************************************************************
|
||||
extern void
|
||||
DCSM_writeZone2CSM(const DCSM_CSMPasswordKey * const psCMDKey);
|
||||
//*****************************************************************************
|
||||
//
|
||||
//! Returns the EXE-ONLY status of zone 1 for a flash sector
|
||||
//!
|
||||
//! \param sector is the flash sector value. Use DCSM_Sector type.
|
||||
//!
|
||||
//! This function takes in a valid sector value and returns the status of EXE
|
||||
//! ONLY security protection for the sector.
|
||||
//!
|
||||
//! \return Returns DCSM_PROTECTED if the sector is EXE-ONLY protected,
|
||||
//! DCSM_UNPROTECTED if the sector is not EXE-ONLY protected,
|
||||
//! DCSM_INCORRECT_ZONE if sector does not belong to this zone.
|
||||
//
|
||||
//*****************************************************************************
|
||||
extern DCSM_EXEOnlyStatus
|
||||
DCSM_getZone1FlashEXEStatus(DCSM_Sector sector, DCSM_CPUSel cpuInst);
|
||||
|
||||
//*****************************************************************************
|
||||
//
|
||||
//! Returns the EXE-ONLY status of zone 1 for a RAM module
|
||||
//!
|
||||
//! \param module is the RAM module value. Valid values are type DCSM_RAMModule
|
||||
//! C28x RAMs :
|
||||
//! - \b DCSM_RAMLS0
|
||||
//! - \b DCSM_RAMLS1
|
||||
//! - \b DCSM_RAMLS2
|
||||
//! - \b DCSM_RAMLS3
|
||||
//! - \b DCSM_RAMLS4
|
||||
//! - \b DCSM_RAMLS5
|
||||
//! - \b DCSM_RAMLS6
|
||||
//! - \b DCSM_RAMLS7
|
||||
//! - \b DCSM_RAMD0
|
||||
//! - \b DCSM_RAMD1
|
||||
//! CM RAMs :
|
||||
//! - \b DCSM_RAM_CM_C0
|
||||
//! - \b DCSM_RAM_CM_C1
|
||||
//! - \b DCSM_RAM1_CPU1_CM
|
||||
//! - \b DCSM_RAM2_CPU1_CM
|
||||
//! - \b DCSM_RAM1_CM_CPU1
|
||||
//! - \b DCSM_RAM2_CM_CPU1
|
||||
//! - \b DCSM_RAM1_CPU2_CM
|
||||
//! - \b DCSM_RAM2_CPU2_CM
|
||||
//! - \b DCSM_RAM1_CM_CPU2
|
||||
//! - \b DCSM_RAM2_CM_CPU2
|
||||
//! - \b DCSM_RAM1_CPU1_CPU2
|
||||
//! - \b DCSM_RAM2_CPU1_CPU2
|
||||
//! - \b DCSM_RAM1_CPU2_CPU1
|
||||
//! - \b DCSM_RAM2_CPU2_CPU1
|
||||
//!
|
||||
//! This function takes in a valid module value and returns the status of EXE
|
||||
//! ONLY security protection for that module.
|
||||
//!
|
||||
//! \param cpuInst is the CPU whose RAM Section needs to be accessed .
|
||||
//!
|
||||
//! The \e cpuInst parameter can have one the following values:
|
||||
//! - \b DCSM_CPUSEL_CPU1 - To access CPU1 RAM
|
||||
//! - \b DCSM_CPUSEL_CPU2 - To access CPU2 RAM
|
||||
//! - \b DCSM_CPUSEL_CM - To access CM RAM
|
||||
//!
|
||||
//! \note DCSM_CPUSEL_CPU1 & DCSM_CPUSEL_CPU2 can only be used with
|
||||
//! C28x RAMs (in DCSM_RAMModule) & DCSM_CPUSEL_CM can only be used with
|
||||
//! CM RAMs(in DCSM_RAMModule)
|
||||
//!
|
||||
//! \return Returns DCSM_PROTECTED if the module is EXE-ONLY protected,
|
||||
//! DCSM_UNPROTECTED if the module is not EXE-ONLY protected,
|
||||
//! DCSM_INCORRECT_ZONE if module does not belong to this zone.
|
||||
//
|
||||
//*****************************************************************************
|
||||
extern DCSM_EXEOnlyStatus
|
||||
DCSM_getZone1RAMEXEStatus(DCSM_RAMModule module, DCSM_CPUSel cpuInst);
|
||||
|
||||
//*****************************************************************************
|
||||
//
|
||||
//! Returns the EXE-ONLY status of zone 2 for a flash sector
|
||||
//!
|
||||
//! \param sector is the flash sector value. Use DCSM_Sector type.
|
||||
//!
|
||||
//! This function takes in a valid sector value and returns the status of EXE
|
||||
//! ONLY security protection for the sector.
|
||||
//!
|
||||
//! \return Returns DCSM_PROTECTED if the sector is EXE-ONLY protected,
|
||||
//! DCSM_UNPROTECTED if the sector is not EXE-ONLY protected,
|
||||
//! DCSM_INCORRECT_ZONE if sector does not belong to this zone.
|
||||
//
|
||||
//*****************************************************************************
|
||||
extern DCSM_EXEOnlyStatus
|
||||
DCSM_getZone2FlashEXEStatus(DCSM_Sector sector, DCSM_CPUSel cpuInst);
|
||||
|
||||
//*****************************************************************************
|
||||
//
|
||||
//! Returns the EXE-ONLY status of zone 2 for a RAM module
|
||||
//!
|
||||
//! \param module is the RAM module value. Valid values are type DCSM_RAMModule
|
||||
//! C28x RAMs :
|
||||
//! - \b DCSM_RAMLS0
|
||||
//! - \b DCSM_RAMLS1
|
||||
//! - \b DCSM_RAMLS2
|
||||
//! - \b DCSM_RAMLS3
|
||||
//! - \b DCSM_RAMLS4
|
||||
//! - \b DCSM_RAMLS5
|
||||
//! - \b DCSM_RAMLS6
|
||||
//! - \b DCSM_RAMLS7
|
||||
//! - \b DCSM_RAMD0
|
||||
//! - \b DCSM_RAMD1
|
||||
//! CM RAMs :
|
||||
//! - \b DCSM_RAM_CM_C0
|
||||
//! - \b DCSM_RAM_CM_C1
|
||||
//! - \b DCSM_RAM1_CPU1_CM
|
||||
//! - \b DCSM_RAM2_CPU1_CM
|
||||
//! - \b DCSM_RAM1_CM_CPU1
|
||||
//! - \b DCSM_RAM2_CM_CPU1
|
||||
//! - \b DCSM_RAM1_CPU2_CM
|
||||
//! - \b DCSM_RAM2_CPU2_CM
|
||||
//! - \b DCSM_RAM1_CM_CPU2
|
||||
//! - \b DCSM_RAM2_CM_CPU2
|
||||
//! - \b DCSM_RAM1_CPU1_CPU2
|
||||
//! - \b DCSM_RAM2_CPU1_CPU2
|
||||
//! - \b DCSM_RAM1_CPU2_CPU1
|
||||
//! - \b DCSM_RAM2_CPU2_CPU1
|
||||
//!
|
||||
//! This function takes in a valid module value and returns the status of EXE
|
||||
//! ONLY security protection for that module.
|
||||
//!
|
||||
//! \param cpuInst is the CPU whose RAM Section needs to be accessed .
|
||||
//!
|
||||
//! The \e cpuInst parameter can have one the following values:
|
||||
//! - \b DCSM_CPUSEL_CPU1 - To access CPU1 RAM
|
||||
//! - \b DCSM_CPUSEL_CPU2 - To access CPU2 RAM
|
||||
//! - \b DCSM_CPUSEL_CM - To access CM RAM
|
||||
//!
|
||||
//! \note DCSM_CPUSEL_CPU1 & DCSM_CPUSEL_CPU2 can only be used with
|
||||
//! C28x RAMs (in DCSM_RAMModule) & DCSM_CPUSEL_CM can only be used with
|
||||
//! CM RAMs(in DCSM_RAMModule).
|
||||
//!
|
||||
//! \return Returns DCSM_PROTECTED if the module is EXE-ONLY protected,
|
||||
//! DCSM_UNPROTECTED if the module is not EXE-ONLY protected,
|
||||
//! DCSM_INCORRECT_ZONE if module does not belong to this zone.
|
||||
//
|
||||
//*****************************************************************************
|
||||
extern DCSM_EXEOnlyStatus
|
||||
DCSM_getZone2RAMEXEStatus(DCSM_RAMModule module, DCSM_CPUSel cpuInst);
|
||||
|
||||
//*****************************************************************************
|
||||
//
|
||||
//! Claims the zone semaphore which allows access to the Flash Wrapper register
|
||||
//! for that zone.
|
||||
//!
|
||||
//! \param zone is the zone which is trying to claim the semaphore which allows
|
||||
//! access to the Flash Wrapper registers.
|
||||
//!
|
||||
//! \return Returns true for a successful semaphore capture, false if it was
|
||||
//! unable to capture the semaphore.
|
||||
//
|
||||
//*****************************************************************************
|
||||
extern bool
|
||||
DCSM_claimZoneSemaphore(DCSM_SemaphoreZone zone);
|
||||
|
||||
//*****************************************************************************
|
||||
//
|
||||
//! Releases the zone semaphore.
|
||||
//!
|
||||
//! \return Returns true if it was successful in releasing the zone semaphore
|
||||
//! and false if it was unsuccessful in releasing the zone semaphore.
|
||||
//!
|
||||
//! \note If the calling function is not in the right zone to be able
|
||||
//! to access this register, it will return a false.
|
||||
//
|
||||
//*****************************************************************************
|
||||
extern bool
|
||||
DCSM_releaseZoneSemaphore(void);
|
||||
|
||||
//*****************************************************************************
|
||||
//
|
||||
// Close the Doxygen group.
|
||||
//! @}
|
||||
//
|
||||
//*****************************************************************************
|
||||
|
||||
//*****************************************************************************
|
||||
//
|
||||
// Mark the end of the C bindings section for C++ compilers.
|
||||
//
|
||||
//*****************************************************************************
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif // DCSM_H
|
||||
+76
@@ -0,0 +1,76 @@
|
||||
//###########################################################################
|
||||
//
|
||||
// FILE: debug.h
|
||||
//
|
||||
// TITLE: Assert definition macro for debug.
|
||||
//
|
||||
//###########################################################################
|
||||
// $TI Release: $
|
||||
// $Release Date: $
|
||||
//
|
||||
// C2000Ware v5.04.00.00
|
||||
//
|
||||
// Copyright (C) 2024 Texas Instruments Incorporated - http://www.ti.com
|
||||
//
|
||||
// Redistribution and use in source and binary forms, with or without
|
||||
// modification, are permitted provided that the following conditions
|
||||
// are met:
|
||||
//
|
||||
// Redistributions of source code must retain the above copyright
|
||||
// notice, this list of conditions and the following disclaimer.
|
||||
//
|
||||
// Redistributions in binary form must reproduce the above copyright
|
||||
// notice, this list of conditions and the following disclaimer in the
|
||||
// documentation and/or other materials provided with the
|
||||
// distribution.
|
||||
//
|
||||
// Neither the name of Texas Instruments Incorporated nor the names of
|
||||
// its contributors may be used to endorse or promote products derived
|
||||
// from this software without specific prior written permission.
|
||||
//
|
||||
// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
|
||||
// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
|
||||
// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
|
||||
// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
|
||||
// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
|
||||
// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
|
||||
// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
|
||||
// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
|
||||
// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
||||
// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
|
||||
// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
// $
|
||||
//###########################################################################
|
||||
|
||||
#ifndef __DEBUG_H__
|
||||
#define __DEBUG_H__
|
||||
|
||||
//*****************************************************************************
|
||||
//
|
||||
// Prototype for the function that is called when an invalid argument is passed
|
||||
// to an API. This is only used when doing a DEBUG build. It is the
|
||||
// application's responsibility to define the __error__ function.
|
||||
//
|
||||
//*****************************************************************************
|
||||
extern void __error__(char *filename, uint32_t line);
|
||||
|
||||
//*****************************************************************************
|
||||
//
|
||||
// The ASSERT macro, which does the actual assertion checking. Typically, this
|
||||
// will be for procedure arguments.
|
||||
//
|
||||
//*****************************************************************************
|
||||
#ifdef DEBUG
|
||||
#define ASSERT(expr) do \
|
||||
{ \
|
||||
if(!(expr)) \
|
||||
{ \
|
||||
__error__(__FILE__, __LINE__); \
|
||||
} \
|
||||
} \
|
||||
while(0)
|
||||
#else
|
||||
#define ASSERT(expr)
|
||||
#endif
|
||||
|
||||
#endif // __DEBUG_H__
|
||||
+3734
File diff suppressed because it is too large.
Load diff
+1626
File diff suppressed because it is too large.
Load diff
+148
@@ -0,0 +1,148 @@
|
||||
//###########################################################################
|
||||
//
|
||||
// FILE: flash.c
|
||||
//
|
||||
// TITLE: CM Flash driver.
|
||||
//
|
||||
//###########################################################################
|
||||
// $TI Release: $
|
||||
// $Release Date: $
|
||||
//
|
||||
// C2000Ware v5.04.00.00
|
||||
//
|
||||
// Copyright (C) 2024 Texas Instruments Incorporated - http://www.ti.com
|
||||
//
|
||||
// Redistribution and use in source and binary forms, with or without
|
||||
// modification, are permitted provided that the following conditions
|
||||
// are met:
|
||||
//
|
||||
// Redistributions of source code must retain the above copyright
|
||||
// notice, this list of conditions and the following disclaimer.
|
||||
//
|
||||
// Redistributions in binary form must reproduce the above copyright
|
||||
// notice, this list of conditions and the following disclaimer in the
|
||||
// documentation and/or other materials provided with the
|
||||
// distribution.
|
||||
//
|
||||
// Neither the name of Texas Instruments Incorporated nor the names of
|
||||
// its contributors may be used to endorse or promote products derived
|
||||
// from this software without specific prior written permission.
|
||||
//
|
||||
// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
|
||||
// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
|
||||
// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
|
||||
// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
|
||||
// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
|
||||
// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
|
||||
// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
|
||||
// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
|
||||
// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
||||
// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
|
||||
// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
// $
|
||||
//###########################################################################
|
||||
|
||||
#include "flash.h"
|
||||
|
||||
//#ifndef __cplusplus
|
||||
//#pragma CODE_SECTION(Flash_initModule, ".TI.ramfunc");
|
||||
//#endif
|
||||
|
||||
//*****************************************************************************
|
||||
//
|
||||
// Flash_initModule
|
||||
//
|
||||
//*****************************************************************************
|
||||
#ifdef __cplusplus
|
||||
#pragma CODE_SECTION(".TI.ramfunc");
|
||||
#endif
|
||||
void
|
||||
Flash_initModule(uint32_t ctrlBase, uint32_t eccBase, uint16_t waitstates)
|
||||
{
|
||||
volatile uint32_t count;
|
||||
//
|
||||
// Check the arguments.
|
||||
//
|
||||
ASSERT(Flash_isCtrlBaseValid(ctrlBase));
|
||||
ASSERT(Flash_isECCBaseValid(eccBase));
|
||||
ASSERT(waitstates <= 0xFU);
|
||||
|
||||
//
|
||||
// Unlock to enable the writes to the flash control and ECC registers.
|
||||
//
|
||||
Flash_unlockCtrlRegisters(ctrlBase);
|
||||
Flash_unlockECCRegisters(eccBase);
|
||||
|
||||
//
|
||||
// Set the bank fallback power mode to active.
|
||||
//
|
||||
Flash_setBankPowerMode(ctrlBase, FLASH_BANK, FLASH_BANK_PWR_ACTIVE);
|
||||
|
||||
//
|
||||
// Power up flash bank and pump and this also sets the fall back mode of
|
||||
// flash and pump as active
|
||||
//
|
||||
Flash_setPumpPowerMode(ctrlBase, FLASH_PUMP_PWR_ACTIVE);
|
||||
|
||||
//
|
||||
// Disable cache and prefetch mechanism before changing wait states
|
||||
//
|
||||
Flash_disableDataCache(ctrlBase);
|
||||
Flash_disableProgramCache(ctrlBase);
|
||||
|
||||
//
|
||||
// Set waitstates according to frequency.
|
||||
//
|
||||
Flash_setWaitstates(ctrlBase, waitstates);
|
||||
|
||||
//
|
||||
// Enable cache and prefetch mechanism to improve performance of code
|
||||
// executed from flash.
|
||||
//
|
||||
Flash_enableDataCache(ctrlBase);
|
||||
Flash_enableProgramCache(ctrlBase);
|
||||
|
||||
//
|
||||
// At reset, ECC is enabled. If it is disabled by application software and
|
||||
// if application again wants to enable ECC.
|
||||
//
|
||||
Flash_enableECC(eccBase);
|
||||
|
||||
//
|
||||
// Force a pipeline flush to ensure that the write to the last register
|
||||
// configured occurs before returning.
|
||||
//
|
||||
for(count = 0U; count < 8U; count++)
|
||||
{
|
||||
NOP;
|
||||
}
|
||||
}
|
||||
|
||||
//*****************************************************************************
|
||||
//
|
||||
// Flash_powerDown
|
||||
//
|
||||
//*****************************************************************************
|
||||
void
|
||||
Flash_powerDown(uint32_t ctrlBase)
|
||||
{
|
||||
//
|
||||
// Check the arguments.
|
||||
//
|
||||
ASSERT(Flash_isCtrlBaseValid(ctrlBase));
|
||||
|
||||
//
|
||||
// Unlock to enable the writes to the flash control registers.
|
||||
//
|
||||
Flash_unlockCtrlRegisters(ctrlBase);
|
||||
|
||||
//
|
||||
// Power down the flash bank.
|
||||
//
|
||||
Flash_setBankPowerMode(ctrlBase, FLASH_BANK, FLASH_BANK_PWR_SLEEP);
|
||||
|
||||
//
|
||||
// Power down the flash pump.
|
||||
//
|
||||
Flash_setPumpPowerMode(ctrlBase, FLASH_PUMP_PWR_SLEEP);
|
||||
}
|
||||
+1826
File diff suppressed because it is too large.
Load diff
+431
@@ -0,0 +1,431 @@
|
||||
//###########################################################################
|
||||
//
|
||||
// FILE: gcrc.c
|
||||
//
|
||||
// TITLE: Driver for the GCRC module.
|
||||
//
|
||||
//###########################################################################
|
||||
// $TI Release: $
|
||||
// $Release Date: $
|
||||
//
|
||||
// C2000Ware v5.04.00.00
|
||||
//
|
||||
// Copyright (C) 2024 Texas Instruments Incorporated - http://www.ti.com
|
||||
//
|
||||
// Redistribution and use in source and binary forms, with or without
|
||||
// modification, are permitted provided that the following conditions
|
||||
// are met:
|
||||
//
|
||||
// Redistributions of source code must retain the above copyright
|
||||
// notice, this list of conditions and the following disclaimer.
|
||||
//
|
||||
// Redistributions in binary form must reproduce the above copyright
|
||||
// notice, this list of conditions and the following disclaimer in the
|
||||
// documentation and/or other materials provided with the
|
||||
// distribution.
|
||||
//
|
||||
// Neither the name of Texas Instruments Incorporated nor the names of
|
||||
// its contributors may be used to endorse or promote products derived
|
||||
// from this software without specific prior written permission.
|
||||
//
|
||||
// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
|
||||
// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
|
||||
// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
|
||||
// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
|
||||
// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
|
||||
// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
|
||||
// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
|
||||
// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
|
||||
// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
||||
// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
|
||||
// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
// $
|
||||
//###########################################################################
|
||||
|
||||
#include "gcrc.h"
|
||||
|
||||
|
||||
//*****************************************************************************
|
||||
//
|
||||
// GCRC_setFixedPolynomialDataPath()
|
||||
//
|
||||
//*****************************************************************************
|
||||
void
|
||||
GCRC_setFixedPolynomialDataPath(uint32_t base)
|
||||
{
|
||||
//
|
||||
// Check the arguments
|
||||
//
|
||||
ASSERT(GCRC_isBaseValid(base));
|
||||
|
||||
//
|
||||
// Set the polynomial size, Endianness, dataType and Bitreverse fields
|
||||
//
|
||||
HWREG(base + GCRC_O_CRCCTRL) = ((uint32_t)GCRC_FIXEDPATH_POLYSIZE <<
|
||||
GCRC_CRCCTRL_POLYSIZE_S) |
|
||||
GCRC_FIXEDPATH_ENDIANNESS |
|
||||
GCRC_FIXEDPATH_DATATYPE |
|
||||
GCRC_FIXEDPATH_BITREVERSE;
|
||||
|
||||
//
|
||||
// Set the 32-bit polynomial
|
||||
//
|
||||
HWREG(base + GCRC_O_CRCPOLY) = GCRC_FIXEDPATH_POLY;
|
||||
|
||||
//
|
||||
// Disable data masking
|
||||
//
|
||||
HWREG(base + GCRC_O_CRCDATAMASK) = GCRC_FIXEDPATH_DATAMASK;
|
||||
}
|
||||
|
||||
//*****************************************************************************
|
||||
//
|
||||
// GCRC_writeData()
|
||||
//
|
||||
//*****************************************************************************
|
||||
void
|
||||
GCRC_writeData(uint32_t base, uint32_t data, uint32_t dataSize)
|
||||
{
|
||||
//
|
||||
// Check the arguments
|
||||
//
|
||||
ASSERT(GCRC_isBaseValid(base));
|
||||
ASSERT((dataSize == GCRC_DATATYPE_8BIT) ||
|
||||
(dataSize == GCRC_DATATYPE_16BIT) ||
|
||||
(dataSize == GCRC_DATATYPE_32BIT));
|
||||
|
||||
if(dataSize == GCRC_DATATYPE_8BIT)
|
||||
{
|
||||
//
|
||||
// Perform a 8-bit write
|
||||
//
|
||||
HWREGB(base + GCRC_O_CRCDATAIN) = (uint8_t)data;
|
||||
}
|
||||
else if(dataSize == GCRC_DATATYPE_16BIT)
|
||||
{
|
||||
//
|
||||
// Perform a 16-bit write
|
||||
//
|
||||
HWREGH(base + GCRC_O_CRCDATAIN) = (uint16_t)data;
|
||||
}
|
||||
else
|
||||
{ //
|
||||
// Perform a 32-bit write
|
||||
//
|
||||
HWREG(base + GCRC_O_CRCDATAIN) = data;
|
||||
}
|
||||
}
|
||||
|
||||
//*****************************************************************************
|
||||
//
|
||||
// GCRC_compute()
|
||||
//
|
||||
//*****************************************************************************
|
||||
uint32_t
|
||||
GCRC_compute(uint32_t base, void* pData, uint32_t dataType,
|
||||
uint32_t dataCount, uint32_t seedVal)
|
||||
{
|
||||
bool bigEndian;
|
||||
uint32_t count;
|
||||
|
||||
//
|
||||
// Check the arguments
|
||||
//
|
||||
ASSERT(GCRC_isBaseValid(base));
|
||||
|
||||
//
|
||||
// Configure the data type
|
||||
//
|
||||
GCRC_setDataType(base, dataType);
|
||||
|
||||
//
|
||||
// Set the seed Value
|
||||
//
|
||||
GCRC_setSeedValue(base, seedVal);
|
||||
|
||||
//
|
||||
// Check the endianness.
|
||||
// If data is stored in little endian format, pData points to the LSB.
|
||||
// If data is stored in big endian format, pData points to MSB.
|
||||
//
|
||||
bigEndian = (HWREG(GCRC_BASE + GCRC_O_CRCCTRL) &
|
||||
GCRC_CRCCTRL_ENDIANNESS) == GCRC_ENDIANNESS_BIG;
|
||||
|
||||
count = dataCount;
|
||||
|
||||
switch(dataType)
|
||||
{
|
||||
case GCRC_DATATYPE_8BIT:
|
||||
{
|
||||
//
|
||||
// Check for 32-bit alignment. For big endian data, check whether
|
||||
// the start address is aligned. For a little endian data, check
|
||||
// whether the address next to last address is aligned
|
||||
//
|
||||
uint32_t *addr;
|
||||
uint8_t *addr8 = bigEndian ? (uint8_t*)pData :
|
||||
(uint8_t*)pData + count;
|
||||
|
||||
while(((uint32_t)addr8 & 0x3U) != 0U)
|
||||
{
|
||||
if(bigEndian)
|
||||
{
|
||||
HWREGB(base + GCRC_O_CRCDATAIN) = *addr8;
|
||||
addr8 = addr8 + 1U;
|
||||
count--;
|
||||
}
|
||||
else
|
||||
{
|
||||
addr8 = addr8 - 1U;
|
||||
HWREGB(base + GCRC_O_CRCDATAIN) = *addr8;
|
||||
count--;
|
||||
}
|
||||
}
|
||||
|
||||
//
|
||||
// addr8 is now a 32-bit aligned address. Do 32-bit writes for
|
||||
// faster execution
|
||||
//
|
||||
addr = bigEndian ? (uint32_t *)addr8 : (uint32_t *)(addr8 - 4U);
|
||||
|
||||
while(count >= 4U)
|
||||
{
|
||||
HWREG(base + GCRC_O_CRCDATAIN) = *addr;
|
||||
addr = bigEndian ? addr + 1U : addr - 1U;
|
||||
count -= 4U;
|
||||
}
|
||||
|
||||
//
|
||||
// Fill in the last unaligned data if any
|
||||
//
|
||||
addr8 = bigEndian ? (uint8_t *)addr : (uint8_t *)addr + 3U;
|
||||
|
||||
while(count > 0U)
|
||||
{
|
||||
HWREGB(base + GCRC_O_CRCDATAIN) = *addr8;
|
||||
addr8 = bigEndian ? addr8 + 1U : addr8 - 1U;
|
||||
count--;
|
||||
}
|
||||
break;
|
||||
}
|
||||
|
||||
case GCRC_DATATYPE_16BIT:
|
||||
{
|
||||
//
|
||||
// Check for 32-bit alignment. For big endian data, check whether
|
||||
// the start address is aligned. For a little endian data, check
|
||||
// whether the second last address is aligned
|
||||
//
|
||||
uint32_t *addr;
|
||||
uint16_t *addr16 = bigEndian ? (uint16_t*)pData :
|
||||
(uint16_t*)pData + count - 2U;
|
||||
|
||||
if(((uint32_t)addr16 & 0x3U) != 0U)
|
||||
{
|
||||
if(bigEndian)
|
||||
{
|
||||
HWREGH(base + GCRC_O_CRCDATAIN) = *addr16;
|
||||
addr16 = addr16 + 1U;
|
||||
}
|
||||
else
|
||||
{
|
||||
HWREGH(base + GCRC_O_CRCDATAIN) = *(addr16 + 1U);
|
||||
addr16 = addr16 - 1U;
|
||||
}
|
||||
count--;
|
||||
}
|
||||
|
||||
//
|
||||
// addr16 is now a 32-bit aligned address. Do 32-bit writes for
|
||||
// faster execution
|
||||
//
|
||||
addr = (uint32_t *)addr16;
|
||||
|
||||
while(count >= 2U)
|
||||
{
|
||||
HWREG(base + GCRC_O_CRCDATAIN) = *addr;
|
||||
addr = bigEndian ? addr + 1U : addr - 1U;
|
||||
count -= 2U;
|
||||
}
|
||||
|
||||
//
|
||||
// Fill in the last unaligned data if any
|
||||
//
|
||||
if(count > 0U)
|
||||
{
|
||||
addr16 = bigEndian ? (uint16_t *)addr :
|
||||
(uint16_t *)addr + 1U;
|
||||
HWREGH(base + GCRC_O_CRCDATAIN) = *addr16;
|
||||
}
|
||||
break;
|
||||
}
|
||||
|
||||
case GCRC_DATATYPE_32BIT:
|
||||
{
|
||||
uint32_t* addr;
|
||||
if(bigEndian)
|
||||
{
|
||||
addr = (uint32_t*)pData;
|
||||
while(count > 0U)
|
||||
{
|
||||
HWREG(base + GCRC_O_CRCDATAIN) = *addr;
|
||||
addr = addr + 1U;
|
||||
count--;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
addr = (uint32_t*)pData + count - 1U;
|
||||
while(count > 0U)
|
||||
{
|
||||
HWREG(base + GCRC_O_CRCDATAIN) = *addr;
|
||||
addr = addr - 1U;
|
||||
count--;
|
||||
}
|
||||
}
|
||||
break;
|
||||
}
|
||||
|
||||
default:
|
||||
//
|
||||
// Empty
|
||||
//
|
||||
break;
|
||||
}
|
||||
//
|
||||
// Return the final CRC value
|
||||
//
|
||||
return(HWREG(base + GCRC_O_CRCDATAOUT));
|
||||
}
|
||||
|
||||
|
||||
//*****************************************************************************
|
||||
//
|
||||
// GCRC_compute_pc1()
|
||||
//
|
||||
//*****************************************************************************
|
||||
uint32_t
|
||||
GCRC_compute_pc1(uint32_t base, void* pData, uint32_t dataType,
|
||||
uint32_t dataCount, uint32_t seedVal)
|
||||
{
|
||||
bool bigEndian;
|
||||
uint32_t count;
|
||||
|
||||
//
|
||||
// Check the arguments
|
||||
//
|
||||
ASSERT(GCRC_isBaseValid(base));
|
||||
|
||||
//
|
||||
// Configure the data type
|
||||
//
|
||||
GCRC_setDataType(base, dataType);
|
||||
|
||||
//
|
||||
// Set the seed Value
|
||||
//
|
||||
GCRC_setSeedValue(base, seedVal);
|
||||
|
||||
//
|
||||
// Check the endianness.
|
||||
// If data is stored in little endian format, pData points to the LSB.
|
||||
// If data is stored in big endian format, pData points to MSB.
|
||||
//
|
||||
bigEndian = (HWREG(GCRC_BASE + GCRC_O_CRCCTRL) &
|
||||
GCRC_CRCCTRL_ENDIANNESS) == GCRC_ENDIANNESS_BIG;
|
||||
|
||||
count = dataCount;
|
||||
|
||||
switch(dataType)
|
||||
{
|
||||
case GCRC_DATATYPE_8BIT:
|
||||
{
|
||||
uint8_t* addr8;
|
||||
if(bigEndian)
|
||||
{
|
||||
addr8 = (uint8_t*)pData;
|
||||
while(count > 0U)
|
||||
{
|
||||
HWREGB(base + GCRC_O_CRCDATAIN) = *addr8;
|
||||
addr8 = addr8 + 1U;
|
||||
count--;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
addr8 = (uint8_t*)pData + count - 1U;
|
||||
while(count > 0U)
|
||||
{
|
||||
HWREGB(base + GCRC_O_CRCDATAIN) = *addr8;
|
||||
addr8 = addr8 - 1U;
|
||||
count--;
|
||||
}
|
||||
}
|
||||
break;
|
||||
}
|
||||
|
||||
case GCRC_DATATYPE_16BIT:
|
||||
{
|
||||
uint16_t* addr16;
|
||||
if(bigEndian)
|
||||
{
|
||||
addr16 = (uint16_t*)pData;
|
||||
while(count > 0U)
|
||||
{
|
||||
HWREGH(base + GCRC_O_CRCDATAIN) = *addr16;
|
||||
addr16 = addr16 + 1U;
|
||||
count--;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
addr16 = (uint16_t*)pData + count - 1U;
|
||||
while(count > 0U)
|
||||
{
|
||||
HWREGH(base + GCRC_O_CRCDATAIN) = *addr16;
|
||||
addr16 = addr16 - 1U;
|
||||
count--;
|
||||
}
|
||||
}
|
||||
break;
|
||||
}
|
||||
|
||||
case GCRC_DATATYPE_32BIT:
|
||||
{
|
||||
uint32_t* addr;
|
||||
if(bigEndian)
|
||||
{
|
||||
addr = (uint32_t*)pData;
|
||||
while(count > 0U)
|
||||
{
|
||||
HWREG(base + GCRC_O_CRCDATAIN) = *addr;
|
||||
addr = addr + 1U;
|
||||
count--;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
addr = (uint32_t*)pData + count - 1U;
|
||||
while(count > 0U)
|
||||
{
|
||||
HWREG(base + GCRC_O_CRCDATAIN) = *addr;
|
||||
addr = addr - 1U;
|
||||
count--;
|
||||
}
|
||||
}
|
||||
break;
|
||||
}
|
||||
|
||||
default:
|
||||
//
|
||||
// Empty
|
||||
//
|
||||
break;
|
||||
}
|
||||
//
|
||||
// Return the final CRC value
|
||||
//
|
||||
return(HWREG(base + GCRC_O_CRCDATAOUT));
|
||||
}
|
||||
|
||||
|
||||
+489
@@ -0,0 +1,489 @@
|
||||
//###########################################################################
|
||||
//
|
||||
// FILE: gcrc.h
|
||||
//
|
||||
// TITLE: Driver for the GCRC module.
|
||||
//
|
||||
//###########################################################################
|
||||
// $TI Release: $
|
||||
// $Release Date: $
|
||||
//
|
||||
// C2000Ware v5.04.00.00
|
||||
//
|
||||
// Copyright (C) 2024 Texas Instruments Incorporated - http://www.ti.com
|
||||
//
|
||||
// Redistribution and use in source and binary forms, with or without
|
||||
// modification, are permitted provided that the following conditions
|
||||
// are met:
|
||||
//
|
||||
// Redistributions of source code must retain the above copyright
|
||||
// notice, this list of conditions and the following disclaimer.
|
||||
//
|
||||
// Redistributions in binary form must reproduce the above copyright
|
||||
// notice, this list of conditions and the following disclaimer in the
|
||||
// documentation and/or other materials provided with the
|
||||
// distribution.
|
||||
//
|
||||
// Neither the name of Texas Instruments Incorporated nor the names of
|
||||
// its contributors may be used to endorse or promote products derived
|
||||
// from this software without specific prior written permission.
|
||||
//
|
||||
// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
|
||||
// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
|
||||
// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
|
||||
// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
|
||||
// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
|
||||
// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
|
||||
// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
|
||||
// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
|
||||
// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
||||
// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
|
||||
// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
// $
|
||||
//###########################################################################
|
||||
|
||||
#ifndef GCRC_H
|
||||
#define GCRC_H
|
||||
|
||||
//*****************************************************************************
|
||||
//
|
||||
// If building with a C++ compiler, make all of the definitions in this header
|
||||
// have a C binding.
|
||||
//
|
||||
//*****************************************************************************
|
||||
#ifdef __cplusplus
|
||||
extern "C"
|
||||
{
|
||||
#endif
|
||||
|
||||
//*****************************************************************************
|
||||
//
|
||||
//! \addtogroup gcrc_api GCRC
|
||||
//! @{
|
||||
//
|
||||
//*****************************************************************************
|
||||
|
||||
#include <stdbool.h>
|
||||
#include <stdint.h>
|
||||
#include "debug.h"
|
||||
#include "inc_cm/hw_memmap.h"
|
||||
#include "inc_cm/hw_types.h"
|
||||
#include "inc_cm/hw_gcrc.h"
|
||||
|
||||
//*****************************************************************************
|
||||
//
|
||||
// Defines for the API.
|
||||
//
|
||||
//*****************************************************************************
|
||||
//*****************************************************************************
|
||||
//
|
||||
// GCRC endianness values that can be passed to GCRC_setDataEndianness()
|
||||
// Endianness applies to word and half word writes.
|
||||
//
|
||||
//*****************************************************************************
|
||||
#define GCRC_ENDIANNESS_LITTLE 0x00000000U //!< Little Endian
|
||||
#define GCRC_ENDIANNESS_BIG 0x00000040U //!< Big Endian
|
||||
|
||||
//*****************************************************************************
|
||||
//
|
||||
// GCRC data types that can be passed as datatype param to GCRC_setDataType()
|
||||
// and datasize param to GCRC_writeData()
|
||||
//
|
||||
//*****************************************************************************
|
||||
#define GCRC_DATATYPE_8BIT 0x00000000U //!< Byte data type
|
||||
#define GCRC_DATATYPE_16BIT 0x00000100U //!< 16-bit data type
|
||||
#define GCRC_DATATYPE_32BIT 0x00000200U //!< 32 bit data type
|
||||
|
||||
//*****************************************************************************
|
||||
//
|
||||
// GCRC configuration for fixed polynomial path
|
||||
//
|
||||
//*****************************************************************************
|
||||
#define GCRC_FIXEDPATH_POLY 0x04c11db7U //!< 32 bit polynomial
|
||||
#define GCRC_FIXEDPATH_POLYSIZE 0x00000020U //!< 32 bit polynomial
|
||||
#define GCRC_FIXEDPATH_ENDIANNESS GCRC_ENDIANNESS_LITTLE //!< Little Endian
|
||||
#define GCRC_FIXEDPATH_BITREVERSE 0U //!< No bit reversal
|
||||
#define GCRC_FIXEDPATH_DATATYPE GCRC_DATATYPE_32BIT //!< 32 bit datatype
|
||||
#define GCRC_FIXEDPATH_DATAMASK 0U //!< No masking
|
||||
|
||||
#define GCRC_POLYSIZE_MAXVALUE 0x20U //!< Max value possible for POLYSIZE
|
||||
//!< field in CRCCTRL register
|
||||
|
||||
//*****************************************************************************
|
||||
//
|
||||
// API Function prototypes
|
||||
//
|
||||
//*****************************************************************************
|
||||
//*****************************************************************************
|
||||
//
|
||||
//! \internal
|
||||
//! Checks GCRC base address.
|
||||
//!
|
||||
//! \param base is the base address of the GCRC instance used.
|
||||
//!
|
||||
//! This function determines if GCRC module base address is valid.
|
||||
//!
|
||||
//! \return Returns \b true if the base address is valid and \b false
|
||||
//! otherwise.
|
||||
//
|
||||
//*****************************************************************************
|
||||
#ifdef DEBUG
|
||||
static inline bool
|
||||
GCRC_isBaseValid(uint32_t base)
|
||||
{
|
||||
return(base == GCRC_BASE);
|
||||
}
|
||||
#endif
|
||||
|
||||
//*****************************************************************************
|
||||
//
|
||||
//! Sets the generator polynomial.
|
||||
//!
|
||||
//! \param base is the base address of the GCRC instance used
|
||||
//! \param poly is the generator polynomial
|
||||
//! \param polySize is the order of the polynomial (1 - 32)
|
||||
//!
|
||||
//! This function sets the generator polynomial for computing CRC.
|
||||
//!
|
||||
//! \return None.
|
||||
//
|
||||
//*****************************************************************************
|
||||
static inline void
|
||||
GCRC_setPolynomial(uint32_t base, uint32_t poly, uint32_t polySize)
|
||||
{
|
||||
//
|
||||
// Check the arguments
|
||||
//
|
||||
ASSERT(GCRC_isBaseValid(base));
|
||||
ASSERT((polySize != 0U) && (polySize <= GCRC_POLYSIZE_MAXVALUE));
|
||||
|
||||
//
|
||||
// Set the polynomial size
|
||||
//
|
||||
HWREG(base + GCRC_O_CRCCTRL) = (polySize << GCRC_CRCCTRL_POLYSIZE_S) |
|
||||
(HWREG(base + GCRC_O_CRCCTRL) &
|
||||
~(uint32_t)GCRC_CRCCTRL_POLYSIZE_M);
|
||||
|
||||
//
|
||||
// Set the polynomial
|
||||
//
|
||||
HWREG(base + GCRC_O_CRCPOLY) = poly;
|
||||
}
|
||||
|
||||
//*****************************************************************************
|
||||
//
|
||||
//! Sets the endianness of the data.
|
||||
//!
|
||||
//! \param base is the base address of the GCRC instance used
|
||||
//! \param endianness is the data endianness. Use macros
|
||||
//! GCRC_ENDIANNESS_LITTLE or GCRC_ENDIANNESS_BIG
|
||||
//!
|
||||
//! This function sets the endianness of the data.
|
||||
//!
|
||||
//! \return None.
|
||||
//
|
||||
//*****************************************************************************
|
||||
static inline void
|
||||
GCRC_setDataEndianness(uint32_t base, uint32_t endianness)
|
||||
{
|
||||
//
|
||||
// Check the arguments
|
||||
//
|
||||
ASSERT(GCRC_isBaseValid(base));
|
||||
ASSERT((endianness == GCRC_ENDIANNESS_LITTLE) ||
|
||||
(endianness == GCRC_ENDIANNESS_BIG));
|
||||
|
||||
//
|
||||
// Set the endianness in the control register
|
||||
//
|
||||
HWREG(base + GCRC_O_CRCCTRL) = (HWREG(base + GCRC_O_CRCCTRL) &
|
||||
~(uint32_t)GCRC_CRCCTRL_ENDIANNESS) |
|
||||
endianness;
|
||||
|
||||
}
|
||||
|
||||
//*****************************************************************************
|
||||
//
|
||||
//! Sets the datatype of the data.
|
||||
//!
|
||||
//! \param base is the base address of the GCRC instance used
|
||||
//! \param dataType is the data type of the input data. Use macros
|
||||
//! GCRC_DATATYPE_8BIT, GCRC_DATATYPE_16BIT, GCRC_DATATYPE_32BIT
|
||||
//!
|
||||
//! This function set the data type of the element of the data array,
|
||||
//! on which CRC is to be computed..
|
||||
//!
|
||||
//! \return None.
|
||||
//
|
||||
//*****************************************************************************
|
||||
static inline void
|
||||
GCRC_setDataType(uint32_t base, uint32_t dataType)
|
||||
{
|
||||
//
|
||||
// Check the arguments
|
||||
//
|
||||
ASSERT(GCRC_isBaseValid(base));
|
||||
ASSERT((dataType == GCRC_DATATYPE_8BIT) ||
|
||||
(dataType == GCRC_DATATYPE_16BIT) ||
|
||||
(dataType == GCRC_DATATYPE_32BIT));
|
||||
|
||||
//
|
||||
// Set the data type in the control register
|
||||
//
|
||||
HWREG(base + GCRC_O_CRCCTRL) = (HWREG(base + GCRC_O_CRCCTRL) &
|
||||
~(uint32_t)GCRC_CRCCTRL_DATATYPE_M) |
|
||||
dataType;
|
||||
}
|
||||
|
||||
//*****************************************************************************
|
||||
//
|
||||
//! Enable/Disable bit reverse feature.
|
||||
//!
|
||||
//! \param base is the base address of the GCRC instance used
|
||||
//! \param enable : TRUE if bit reverse needs to be enabled.
|
||||
//! : FALSE if bit reverse needs to be disabled
|
||||
//!
|
||||
//! This function enables/disables the bit reverse of the input data
|
||||
//!
|
||||
//! \return None.
|
||||
//
|
||||
//*****************************************************************************
|
||||
static inline void
|
||||
GCRC_enableBitReverse(uint32_t base, bool enable)
|
||||
{
|
||||
//
|
||||
// Check the arguments
|
||||
//
|
||||
ASSERT(GCRC_isBaseValid(base));
|
||||
|
||||
if(enable)
|
||||
{
|
||||
//
|
||||
// Set the bit reverse bit in control register
|
||||
//
|
||||
HWREG(base + GCRC_O_CRCCTRL) |= GCRC_CRCCTRL_BITREVERSE;
|
||||
}
|
||||
else
|
||||
{
|
||||
//
|
||||
// Clear the bit reverse bit in the control register
|
||||
//
|
||||
HWREG(base + GCRC_O_CRCCTRL) &= ~GCRC_CRCCTRL_BITREVERSE;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
//*****************************************************************************
|
||||
//
|
||||
//! Sets the data mask for the input data.
|
||||
//!
|
||||
//! \param base is the base address of the GCRC instance used
|
||||
//! \param dataMask is the number of bits to be masked.
|
||||
//!
|
||||
//! This function set the data mask for the input data.
|
||||
//! For example, dataMask equals 0x3, 3 most significant bits of data will
|
||||
//! be masked.
|
||||
//!
|
||||
//! \return None.
|
||||
//
|
||||
//*****************************************************************************
|
||||
static inline void
|
||||
GCRC_setDataMask(uint32_t base, uint32_t dataMask)
|
||||
{
|
||||
#ifdef DEBUG
|
||||
uint32_t dataType = HWREG(base + GCRC_O_CRCCTRL) & GCRC_CRCCTRL_DATATYPE_M;
|
||||
#endif
|
||||
//
|
||||
// Check the arguments
|
||||
//
|
||||
ASSERT(GCRC_isBaseValid(base));
|
||||
ASSERT(((dataType == GCRC_DATATYPE_8BIT) && (dataMask < 8U)) ||
|
||||
((dataType == GCRC_DATATYPE_16BIT) && (dataMask < 16U)) ||
|
||||
((dataType == GCRC_DATATYPE_32BIT) && (dataMask < 32U)));
|
||||
|
||||
//
|
||||
// Set the DATAMASK register
|
||||
//
|
||||
HWREG(base + GCRC_O_CRCDATAMASK) = dataMask;
|
||||
}
|
||||
|
||||
//*****************************************************************************
|
||||
//
|
||||
//! Sets the seed value.
|
||||
//!
|
||||
//! \param base is the base address of the GCRC instance used
|
||||
//! \param value is the seed value that needs to be set.
|
||||
//!
|
||||
//! This function sets the seed value for CRC computation.
|
||||
//!
|
||||
//! \return None.
|
||||
//
|
||||
//*****************************************************************************
|
||||
static inline void
|
||||
GCRC_setSeedValue(uint32_t base, uint32_t value)
|
||||
{
|
||||
//
|
||||
// Check the arguments
|
||||
//
|
||||
ASSERT(GCRC_isBaseValid(base));
|
||||
|
||||
//
|
||||
// Set the DATAOUT register with seed value
|
||||
//
|
||||
HWREG(base + GCRC_O_CRCDATAOUT) = value;
|
||||
}
|
||||
|
||||
|
||||
//*****************************************************************************
|
||||
//
|
||||
//! Reads the computed CRC value.
|
||||
//!
|
||||
//! \param base is the base address of the GCRC instance used
|
||||
//!
|
||||
//! This function read the computed CRC value.
|
||||
//!
|
||||
//! \note Reads from CRCDATAOUT register will be stalled if CRC engine is
|
||||
//! busy computing CRC
|
||||
//!
|
||||
//! \return None.
|
||||
//
|
||||
//*****************************************************************************
|
||||
static inline uint32_t
|
||||
GCRC_readResult(uint32_t base)
|
||||
{
|
||||
//
|
||||
// Check the arguments
|
||||
//
|
||||
ASSERT(GCRC_isBaseValid(base));
|
||||
|
||||
return(HWREG(base + GCRC_O_CRCDATAOUT));
|
||||
}
|
||||
|
||||
//*****************************************************************************
|
||||
//
|
||||
//! Reads the transformed data
|
||||
//!
|
||||
//! \param base is the base address of the GCRC instance used
|
||||
//!
|
||||
//! This function returns the data value as seen by the core CRC engine after
|
||||
//! endianess, bit reversal and masking transformation
|
||||
//!
|
||||
//! \return None.
|
||||
//
|
||||
//*****************************************************************************
|
||||
static inline uint32_t
|
||||
GCRC_getTransData(uint32_t base)
|
||||
{
|
||||
//
|
||||
// Check the arguments
|
||||
//
|
||||
ASSERT(GCRC_isBaseValid(base));
|
||||
|
||||
return(HWREG(base + GCRC_O_CRCDATATRANS));
|
||||
}
|
||||
|
||||
//*****************************************************************************
|
||||
//
|
||||
//! Sets the fixed polynomial data path.
|
||||
//!
|
||||
//! \param base is the base address of the GCRC instance used
|
||||
//!
|
||||
//! This function sets the fixed polynomial data path which computes
|
||||
//! the CRC in a single cycle.
|
||||
//!
|
||||
//! \note Only 32-bit writes. Byte and halfword accesses would take the
|
||||
//! generic CRC data path.
|
||||
//!
|
||||
//! \return None.
|
||||
//
|
||||
//*****************************************************************************
|
||||
extern void
|
||||
GCRC_setFixedPolynomialDataPath(uint32_t base);
|
||||
|
||||
|
||||
//*****************************************************************************
|
||||
//
|
||||
//! Writes the input data.
|
||||
//!
|
||||
//! \param base is the base address of the GCRC instance used
|
||||
//! \param data is value that needs to be written.
|
||||
//! \param dataSize is the size of the data. Use macros GCRC_DATATYPE_8BIT,
|
||||
//! GCRC_DATATYPE_16BIT, GCRC_DATATYPE_32BIT
|
||||
//!
|
||||
//! This function writes the input data for the CRC computation.
|
||||
//!
|
||||
//! \note Writes to CRCDATAIN register will be stalled if CRC engine is
|
||||
//! busy computing CRC
|
||||
//!
|
||||
//! \return None.
|
||||
//
|
||||
//*****************************************************************************
|
||||
extern void
|
||||
GCRC_writeData(uint32_t base, uint32_t data, uint32_t dataSize);
|
||||
|
||||
//*****************************************************************************
|
||||
//
|
||||
//! Computes CRC on the input data array.
|
||||
//!
|
||||
//! \param base is the base address of the GCRC instance used
|
||||
//! \param pData is pointer to the data array
|
||||
//! \param dataType is the data type of the input data. Use macros
|
||||
//! GCRC_DATATYPE_8BIT, GCRC_DATATYPE_16BIT, GCRC_DATATYPE_32BIT
|
||||
//! \param dataCount is the total number of data items in the array
|
||||
//! \param seedVal is the seed value
|
||||
//!
|
||||
//! This function is used to compute CRC on the given array of data.
|
||||
//!
|
||||
//! \note Writes to CRCDATAIN register and reads from CRCDATAOUT register
|
||||
//! will be stalled if CRC engine is busy computing CRC
|
||||
//!
|
||||
//! \return Returns the computed CRC value.
|
||||
//
|
||||
//*****************************************************************************
|
||||
extern uint32_t
|
||||
GCRC_compute(uint32_t base, void* pData, uint32_t dataType,
|
||||
uint32_t dataCount, uint32_t seedVal);
|
||||
|
||||
//*****************************************************************************
|
||||
//
|
||||
//! Computes CRC on the input data array.
|
||||
//!
|
||||
//! \param base is the base address of the GCRC instance used
|
||||
//! \param pData is pointer to the data array
|
||||
//! \param dataType is the data type of the input data. Use macros
|
||||
//! GCRC_DATATYPE_8BIT, GCRC_DATATYPE_16BIT, GCRC_DATATYPE_32BIT
|
||||
//! \param dataCount is the total number of data items in the array
|
||||
//! \param seedVal is the seed value
|
||||
//!
|
||||
//! This function is used to compute CRC on the given array of data. This
|
||||
//! function writes the data one by one to register. It does not use the
|
||||
//! endianness feature of the IP. Use GCRC_compute for faster computation.
|
||||
//!
|
||||
//! \note Writes to CRCDATAIN register and reads from CRCDATAOUT register
|
||||
//! will be stalled if CRC engine is busy computing CRC
|
||||
//!
|
||||
//! \return Returns the computed CRC value.
|
||||
//
|
||||
//*****************************************************************************
|
||||
extern uint32_t
|
||||
GCRC_compute_pc1(uint32_t base, void* pData, uint32_t dataType,
|
||||
uint32_t dataCount, uint32_t seedVal);
|
||||
|
||||
|
||||
//*****************************************************************************
|
||||
//
|
||||
// Close the Doxygen group.
|
||||
//! @}
|
||||
//
|
||||
//*****************************************************************************
|
||||
|
||||
//*****************************************************************************
|
||||
//
|
||||
// Mark the end of the C bindings section for C++ compilers.
|
||||
//
|
||||
//*****************************************************************************
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif // GCRC_H
|
||||
+208
@@ -0,0 +1,208 @@
|
||||
//###########################################################################
|
||||
//
|
||||
// FILE: i2c.c
|
||||
//
|
||||
// TITLE: CM I2C driver.
|
||||
//
|
||||
//###########################################################################
|
||||
// $TI Release: $
|
||||
// $Release Date: $
|
||||
//
|
||||
// C2000Ware v5.04.00.00
|
||||
//
|
||||
// Copyright (C) 2024 Texas Instruments Incorporated - http://www.ti.com
|
||||
//
|
||||
// Redistribution and use in source and binary forms, with or without
|
||||
// modification, are permitted provided that the following conditions
|
||||
// are met:
|
||||
//
|
||||
// Redistributions of source code must retain the above copyright
|
||||
// notice, this list of conditions and the following disclaimer.
|
||||
//
|
||||
// Redistributions in binary form must reproduce the above copyright
|
||||
// notice, this list of conditions and the following disclaimer in the
|
||||
// documentation and/or other materials provided with the
|
||||
// distribution.
|
||||
//
|
||||
// Neither the name of Texas Instruments Incorporated nor the names of
|
||||
// its contributors may be used to endorse or promote products derived
|
||||
// from this software without specific prior written permission.
|
||||
//
|
||||
// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
|
||||
// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
|
||||
// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
|
||||
// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
|
||||
// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
|
||||
// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
|
||||
// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
|
||||
// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
|
||||
// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
||||
// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
|
||||
// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
// $
|
||||
//###########################################################################
|
||||
|
||||
#include <stdbool.h>
|
||||
#include <stdint.h>
|
||||
#include "inc_cm/hw_i2c.h"
|
||||
#include "inc_cm/hw_memmap.h"
|
||||
#include "inc_cm/hw_types.h"
|
||||
#include "debug.h"
|
||||
#include "i2c.h"
|
||||
|
||||
//*****************************************************************************
|
||||
//
|
||||
// I2C_initMaster()
|
||||
//
|
||||
//*****************************************************************************
|
||||
|
||||
void
|
||||
I2C_initMaster(uint32_t base, uint32_t i2cClk,
|
||||
bool fast)
|
||||
{
|
||||
uint32_t sclFreq;
|
||||
uint32_t tPr;
|
||||
|
||||
//
|
||||
// Check the arguments.
|
||||
//
|
||||
ASSERT(I2C_isBaseValid(base));
|
||||
|
||||
//
|
||||
// Must enable the device before doing anything else.
|
||||
//
|
||||
I2C_enableMaster(base);
|
||||
|
||||
//
|
||||
// Get the desired SCL speed.
|
||||
//
|
||||
if(fast == true)
|
||||
{
|
||||
sclFreq = I2C_SCL_FREQ_FAST_MODE;
|
||||
}
|
||||
else
|
||||
{
|
||||
sclFreq = I2C_SCL_FREQ_STD_MODE;
|
||||
}
|
||||
|
||||
//
|
||||
// Compute the clock divider that achieves the fastest speed less than or
|
||||
// equal to the desired speed. The numerator is biased to favor a larger
|
||||
// clock divider so that the resulting clock is always less than or equal
|
||||
// to the desired clock, never greater.
|
||||
// SCL_PERIOD = 2 X (1 + TPR) X ( SCL_LP + SCL_HP) X CLK_PRD
|
||||
//
|
||||
//SCL_PRD is the SCL line period (I2C clock). TPR is the Timer Period
|
||||
//register value (range of 1 to 127).SCL_LP is the SCL Low period
|
||||
//(fixed at 6). SCL_HP is the SCL High period (fixed at 4).
|
||||
//CLK_PRD is the system clock period in ns.
|
||||
//
|
||||
|
||||
tPr = ((i2cClk + (2U * 10U * sclFreq) - 1U) /
|
||||
(2U * 10U * sclFreq)) - 1U;
|
||||
HWREG(base + I2C_O_MTPR) = tPr;
|
||||
|
||||
//
|
||||
// Check to see if this I2C peripheral is High-Speed enabled. If yes, also
|
||||
// choose the fastest speed that is less than or equal to 3.4 Mbps.
|
||||
// ( SCL_LP + SCL_HP) fixed at 3
|
||||
//
|
||||
if((HWREG(base + I2C_O_PP) & I2C_PP_HS) == I2C_PP_HS)
|
||||
{
|
||||
tPr = ((i2cClk + (2U * 3U * I2C_SCL_FREQ_HS_MODE) - 1U) /
|
||||
(2U * 3U * I2C_SCL_FREQ_HS_MODE)) - 1U;
|
||||
HWREG(base + I2C_O_MTPR) = I2C_MTPR_HS | tPr;
|
||||
}
|
||||
}
|
||||
|
||||
//*****************************************************************************
|
||||
//
|
||||
// I2C_setSlaveAddress()
|
||||
//
|
||||
//*****************************************************************************
|
||||
void
|
||||
I2C_setOwnSlaveAddress(uint32_t base, I2C_SlaveAddrmode addrNum,
|
||||
uint8_t slaveAddr)
|
||||
{
|
||||
//
|
||||
// Check the arguments.
|
||||
//
|
||||
ASSERT(I2C_isBaseValid(base));
|
||||
ASSERT(!(addrNum > 1U));
|
||||
ASSERT(!(slaveAddr & I2C_SA_A6_0_MASK));
|
||||
|
||||
//
|
||||
// Determine which slave address is being set.
|
||||
//
|
||||
switch((uint8_t)addrNum)
|
||||
{
|
||||
//
|
||||
// Set up the primary slave address.
|
||||
//
|
||||
case I2C_SLAVE_ADDR_PRIMARY:
|
||||
{
|
||||
HWREG(base + I2C_O_SOAR) = slaveAddr;
|
||||
break;
|
||||
}
|
||||
|
||||
//
|
||||
// Set up and enable the secondary slave address.
|
||||
//
|
||||
case I2C_SLAVE_ADDR_SECONDARY:
|
||||
{
|
||||
HWREG(base + I2C_O_SOAR2) = I2C_SOAR2_OAR2EN | slaveAddr;
|
||||
break;
|
||||
}
|
||||
//
|
||||
//default case
|
||||
//
|
||||
default:
|
||||
{
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
//*****************************************************************************
|
||||
//
|
||||
// I2C_getMasterErr()
|
||||
//
|
||||
//*****************************************************************************
|
||||
uint32_t
|
||||
I2C_getMasterErr(uint32_t base)
|
||||
{
|
||||
uint32_t err, ret;
|
||||
|
||||
//
|
||||
// Check the arguments.
|
||||
//
|
||||
ASSERT(I2C_isBaseValid(base));
|
||||
|
||||
//
|
||||
// Get the raw error state
|
||||
//
|
||||
err = HWREG(base + I2C_O_MCS);
|
||||
|
||||
//
|
||||
// If the I2C master is busy, then all the other bit are invalid, and
|
||||
// don't have an error to report.
|
||||
//
|
||||
if((err & I2C_MCS_BUSY) == I2C_MCS_BUSY)
|
||||
{
|
||||
ret = I2C_MASTER_ERR_NONE;
|
||||
}
|
||||
|
||||
//
|
||||
// Check for errors.
|
||||
//
|
||||
if((err & (I2C_MCS_ERROR | I2C_MCS_ARBLST))!= 0U)
|
||||
{
|
||||
ret = (err & (I2C_MCS_ARBLST | I2C_MCS_DATACK |
|
||||
I2C_MCS_ADRACK | I2C_MCS_CLKTO));
|
||||
}
|
||||
else
|
||||
{
|
||||
ret = I2C_MASTER_ERR_NONE;
|
||||
}
|
||||
return(ret);
|
||||
}
|
||||
+2288
File diff suppressed because it is too large.
Load diff
+190
@@ -0,0 +1,190 @@
|
||||
//###########################################################################
|
||||
//
|
||||
// FILE: hw_aes.h
|
||||
//
|
||||
// TITLE: Definitions for the AES registers.
|
||||
//
|
||||
//###########################################################################
|
||||
// $TI Release: $
|
||||
// $Release Date: $
|
||||
//
|
||||
// C2000Ware v5.04.00.00
|
||||
//
|
||||
// Copyright (C) 2024 Texas Instruments Incorporated - http://www.ti.com
|
||||
//
|
||||
// Redistribution and use in source and binary forms, with or without
|
||||
// modification, are permitted provided that the following conditions
|
||||
// are met:
|
||||
//
|
||||
// Redistributions of source code must retain the above copyright
|
||||
// notice, this list of conditions and the following disclaimer.
|
||||
//
|
||||
// Redistributions in binary form must reproduce the above copyright
|
||||
// notice, this list of conditions and the following disclaimer in the
|
||||
// documentation and/or other materials provided with the
|
||||
// distribution.
|
||||
//
|
||||
// Neither the name of Texas Instruments Incorporated nor the names of
|
||||
// its contributors may be used to endorse or promote products derived
|
||||
// from this software without specific prior written permission.
|
||||
//
|
||||
// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
|
||||
// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
|
||||
// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
|
||||
// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
|
||||
// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
|
||||
// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
|
||||
// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
|
||||
// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
|
||||
// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
||||
// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
|
||||
// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
// $
|
||||
//###########################################################################
|
||||
|
||||
#ifndef HW_AES_H
|
||||
#define HW_AES_H
|
||||
|
||||
//*****************************************************************************
|
||||
//
|
||||
// The following are defines for the AES register offsets
|
||||
//
|
||||
//*****************************************************************************
|
||||
#define AES_O_S_AES_KEY2_6 0x0U // XTS Second Key or CBC-MAC
|
||||
// Third Key
|
||||
#define AES_O_S_AES_KEY2_7 0x4U // XTS Second Key or CBC-MAC
|
||||
// Third Key
|
||||
#define AES_O_S_AES_KEY2_4 0x8U // XTS/CCM Second Key or CBC-MAC
|
||||
// Third Key
|
||||
#define AES_O_S_AES_KEY2_5 0xCU // XTS Second Key or CBC-MAC
|
||||
// Third Key
|
||||
#define AES_O_S_AES_KEY2_2 0x10U // XTS/CCM/CBC-MAC Second Key or
|
||||
// Hash Key Input
|
||||
#define AES_O_S_AES_KEY2_3 0x14U // XTS/CCM/CBC-MAC Second Key or
|
||||
// Hash Key Input
|
||||
#define AES_O_S_AES_KEY2_0 0x18U // XTS/CCM/CBC-MAC Second Key or
|
||||
// Hash Key Input
|
||||
#define AES_O_S_AES_KEY2_1 0x1CU // XTS/CCM/CBC-MAC Second Key or
|
||||
// Hash Key Input
|
||||
#define AES_O_S_AES_KEY1_6 0x20U // Key
|
||||
#define AES_O_S_AES_KEY1_7 0x24U // Key
|
||||
#define AES_O_S_AES_KEY1_4 0x28U // Key
|
||||
#define AES_O_S_AES_KEY1_5 0x2CU // Key
|
||||
#define AES_O_S_AES_KEY1_2 0x30U // Key
|
||||
#define AES_O_S_AES_KEY1_3 0x34U // Key
|
||||
#define AES_O_S_AES_KEY1_0 0x38U // Key
|
||||
#define AES_O_S_AES_KEY1_1 0x3CU // Key
|
||||
#define AES_O_S_AES_IV_IN_OUT_0 0x40U // Initialization Vector 0
|
||||
#define AES_O_S_AES_IV_IN_OUT_1 0x44U // Initialization Vector 1
|
||||
#define AES_O_S_AES_IV_IN_OUT_2 0x48U // Initialization Vector 2
|
||||
#define AES_O_S_AES_IV_IN_OUT_3 0x4CU // Initialization Vector 3
|
||||
#define AES_O_S_AES_CTRL 0x50U // Input/Output Buffer Control
|
||||
// and Mode Selection
|
||||
#define AES_O_S_AES_C_LENGTH_0 0x54U // Crypto Data Length 0
|
||||
#define AES_O_S_AES_C_LENGTH_1 0x58U // Crypto Data Length 1
|
||||
#define AES_O_S_AES_AUTH_LENGTH 0x5CU // AAD Data Length
|
||||
#define AES_O_S_AES_DATA_IN_OUT_0 0x60U // Data Word 0
|
||||
#define AES_O_S_AES_DATA_IN_OUT_1 0x64U // Data Word 1
|
||||
#define AES_O_S_AES_DATA_IN_OUT_2 0x68U // Data Word 2
|
||||
#define AES_O_S_AES_DATA_IN_OUT_3 0x6CU // Data Word 3
|
||||
#define AES_O_S_AES_TAG_OUT_0 0x70U // Hash Result 0
|
||||
#define AES_O_S_AES_TAG_OUT_1 0x74U // Hash Result 1
|
||||
#define AES_O_S_AES_TAG_OUT_2 0x78U // Hash Result 2
|
||||
#define AES_O_S_AES_TAG_OUT_3 0x7CU // Hash Result 3
|
||||
#define AES_O_S_AES_REV 0x80U // Module Revision Number
|
||||
#define AES_O_S_AES_SYSCONFIG 0x84U // System Configuration
|
||||
#define AES_O_S_AES_SYSSTATUS 0x88U // Reset Status
|
||||
#define AES_O_S_AES_IRQSTATUS 0x8CU // Interrupt Status
|
||||
#define AES_O_S_AES_IRQENABLE 0x90U // Interrupt Enable
|
||||
#define AES_O_S_AES_DIRTY_BITS 0x94U // Accessed / Dirty Bits
|
||||
|
||||
//*****************************************************************************
|
||||
//
|
||||
// The following are defines for the bit fields in the S_AES_CTRL register
|
||||
//
|
||||
//*****************************************************************************
|
||||
#define AES_S_AES_CTRL_OUTPUT_READY 0x1U // Output Ready Status
|
||||
#define AES_S_AES_CTRL_INPUT_READY 0x2U // Input Ready Status
|
||||
#define AES_S_AES_CTRL_DIRECTION 0x4U // Encryption/Decryption
|
||||
// Selection
|
||||
#define AES_S_AES_CTRL_KEY_SIZE_S 3U
|
||||
#define AES_S_AES_CTRL_KEY_SIZE_M 0x18U // Key Size
|
||||
#define AES_S_AES_CTRL_MODE 0x20U // ECB/CBC Mode
|
||||
#define AES_S_AES_CTRL_CTR 0x40U // Counter Mode
|
||||
#define AES_S_AES_CTRL_CTR_WIDTH_S 7U
|
||||
#define AES_S_AES_CTRL_CTR_WIDTH_M 0x180U // AES-CTR Mode Counter Width
|
||||
#define AES_S_AES_CTRL_ICM 0x200U // AES Integer Counter Mode
|
||||
// (ICM) Enable
|
||||
#define AES_S_AES_CTRL_CFB 0x400U // Full block AES cipher
|
||||
// feedback mode (CFB128) Enable
|
||||
#define AES_S_AES_CTRL_XTS_S 11U
|
||||
#define AES_S_AES_CTRL_XTS_M 0x1800U // AES-XTS Operation Enable
|
||||
#define AES_S_AES_CTRL_F8 0x2000U // AES f8 Mode Enable
|
||||
#define AES_S_AES_CTRL_F9 0x4000U // AES f9 Mode Enable
|
||||
#define AES_S_AES_CTRL_CBCMAC 0x8000U // AES-CBC MAC Enable
|
||||
#define AES_S_AES_CTRL_GCM_S 16U
|
||||
#define AES_S_AES_CTRL_GCM_M 0x30000U // AES-GCM Mode Enable
|
||||
#define AES_S_AES_CTRL_CCM 0x40000U // AES-CCM Mode Enable
|
||||
#define AES_S_AES_CTRL_CCM_L_S 19U
|
||||
#define AES_S_AES_CTRL_CCM_L_M 0x380000U // Width of the length field for
|
||||
// CCM operations
|
||||
#define AES_S_AES_CTRL_CCM_M_S 22U
|
||||
#define AES_S_AES_CTRL_CCM_M_M 0x1C00000U // Length of the authentication
|
||||
// field for CCM operations
|
||||
#define AES_S_AES_CTRL_SAVE_CONTEXT 0x20000000U // TAG or Result IV Save
|
||||
#define AES_S_AES_CTRL_SVCTXTRDY 0x40000000U // AES TAG/IV Block(s) Ready
|
||||
#define AES_S_AES_CTRL_CTXTRDY 0x80000000U // Context Data Registers Ready
|
||||
|
||||
//*****************************************************************************
|
||||
//
|
||||
// The following are defines for the bit fields in the S_AES_SYSCONFIG register
|
||||
//
|
||||
//*****************************************************************************
|
||||
#define AES_S_AES_SYSCONFIG_AUTOIDLE 0x1U // autoidle
|
||||
#define AES_S_AES_SYSCONFIG_SOFTRESET 0x2U // Soft Reset
|
||||
#define AES_S_AES_SYSCONFIG_SIDLE_S 2U
|
||||
#define AES_S_AES_SYSCONFIG_SIDLE_M 0xCU // Slave Idle Mode
|
||||
#define AES_S_AES_SYSCONFIG_DMA_REQ_DATA_IN_EN 0x20U // DMA Request Data In Enable
|
||||
#define AES_S_AES_SYSCONFIG_DMA_REQ_DATA_OUT_EN 0x40U // DMA Request Data Out Enable
|
||||
#define AES_S_AES_SYSCONFIG_DMA_REQ_CONTEXT_IN_EN 0x80U // DMA Request Context In Enable
|
||||
#define AES_S_AES_SYSCONFIG_DMA_REQ_CONTEXT_OUT_EN 0x100U // DMA Request Context Out
|
||||
// Enable
|
||||
#define AES_S_AES_SYSCONFIG_MAP_CONTEXT_OUT_ON_DATA_OUT 0x200U // Map Context Out on Data Out
|
||||
// Enable
|
||||
|
||||
//*****************************************************************************
|
||||
//
|
||||
// The following are defines for the bit fields in the S_AES_SYSSTATUS register
|
||||
//
|
||||
//*****************************************************************************
|
||||
#define AES_S_AES_SYSSTATUS_RESETDONE 0x1U // Reset Done
|
||||
|
||||
//*****************************************************************************
|
||||
//
|
||||
// The following are defines for the bit fields in the S_AES_IRQSTATUS register
|
||||
//
|
||||
//*****************************************************************************
|
||||
#define AES_S_AES_IRQSTATUS_CONTEXT_IN 0x1U // Context In Interrupt Status
|
||||
#define AES_S_AES_IRQSTATUS_DATA_IN 0x2U // Data In Interrupt Status
|
||||
#define AES_S_AES_IRQSTATUS_DATA_OUT 0x4U // Data Out Interrupt Status
|
||||
#define AES_S_AES_IRQSTATUS_CONTEXT_OUT 0x8U // Context Output Interrupt
|
||||
// Status
|
||||
|
||||
//*****************************************************************************
|
||||
//
|
||||
// The following are defines for the bit fields in the S_AES_IRQENABLE register
|
||||
//
|
||||
//*****************************************************************************
|
||||
#define AES_S_AES_IRQENABLE_CONTEXT_IN 0x1U // Context In Interrupt Enable
|
||||
#define AES_S_AES_IRQENABLE_DATA_IN 0x2U // Data In Interrupt Enable
|
||||
#define AES_S_AES_IRQENABLE_DATA_OUT 0x4U // Data Out Interrupt Enable
|
||||
#define AES_S_AES_IRQENABLE_CONTEXT_OUT 0x8U // Context Out Interrupt Enable
|
||||
|
||||
//*****************************************************************************
|
||||
//
|
||||
// The following are defines for the bit fields in the S_AES_DIRTY_BITS register
|
||||
//
|
||||
//*****************************************************************************
|
||||
#define AES_S_AES_DIRTY_BITS_S_ACCESS 0x1U // AES Access Bit
|
||||
#define AES_S_AES_DIRTY_BITS_S_DIRTY 0x2U // AES Dirty Bit
|
||||
#endif
|
||||
+93
@@ -0,0 +1,93 @@
|
||||
//###########################################################################
|
||||
//
|
||||
// FILE: hw_aes_ss.h
|
||||
//
|
||||
// TITLE: Definitions for the AES_SS registers.
|
||||
//
|
||||
//###########################################################################
|
||||
// $TI Release: $
|
||||
// $Release Date: $
|
||||
//
|
||||
// C2000Ware v5.04.00.00
|
||||
//
|
||||
// Copyright (C) 2024 Texas Instruments Incorporated - http://www.ti.com
|
||||
//
|
||||
// Redistribution and use in source and binary forms, with or without
|
||||
// modification, are permitted provided that the following conditions
|
||||
// are met:
|
||||
//
|
||||
// Redistributions of source code must retain the above copyright
|
||||
// notice, this list of conditions and the following disclaimer.
|
||||
//
|
||||
// Redistributions in binary form must reproduce the above copyright
|
||||
// notice, this list of conditions and the following disclaimer in the
|
||||
// documentation and/or other materials provided with the
|
||||
// distribution.
|
||||
//
|
||||
// Neither the name of Texas Instruments Incorporated nor the names of
|
||||
// its contributors may be used to endorse or promote products derived
|
||||
// from this software without specific prior written permission.
|
||||
//
|
||||
// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
|
||||
// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
|
||||
// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
|
||||
// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
|
||||
// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
|
||||
// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
|
||||
// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
|
||||
// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
|
||||
// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
||||
// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
|
||||
// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
// $
|
||||
//###########################################################################
|
||||
|
||||
#ifndef HW_AES_SS_H
|
||||
#define HW_AES_SS_H
|
||||
|
||||
//*****************************************************************************
|
||||
//
|
||||
// The following are defines for the AES_SS register offsets
|
||||
//
|
||||
//*****************************************************************************
|
||||
#define AES_SS_O_AESDMAINTEN 0x0U // DMA Done Interrupt enable
|
||||
// register
|
||||
#define AES_SS_O_AESDMASTATUS 0x4U // DMA Done Interrupt status
|
||||
// register
|
||||
#define AES_SS_O_AESDMASTATUSCLR 0x8U // DMA Done Interrupt status
|
||||
// clear register
|
||||
|
||||
//*****************************************************************************
|
||||
//
|
||||
// The following are defines for the bit fields in the AESDMAINTEN register
|
||||
//
|
||||
//*****************************************************************************
|
||||
#define AES_SS_AESDMAINTEN_DMADONECTXIN 0x1U // Enable bit for DMADONECTXIN
|
||||
#define AES_SS_AESDMAINTEN_DMADONEDIN 0x2U // Enable bit for DMADONEDIN
|
||||
#define AES_SS_AESDMAINTEN_DMADONEDOUT 0x4U // Enable bit for DMADONEDOUT
|
||||
#define AES_SS_AESDMAINTEN_DMADONECTXOUT 0x8U // Enable bit for DMADONECTXOUT
|
||||
|
||||
//*****************************************************************************
|
||||
//
|
||||
// The following are defines for the bit fields in the AESDMASTATUS register
|
||||
//
|
||||
//*****************************************************************************
|
||||
#define AES_SS_AESDMASTATUS_DMADONECTXIN 0x1U // Status bit for DMADONECTXIN
|
||||
#define AES_SS_AESDMASTATUS_DMADONEDIN 0x2U // Status bit for DMADONEDIN
|
||||
#define AES_SS_AESDMASTATUS_DMADONEDOUT 0x4U // Status bit for DMADONEDOUT
|
||||
#define AES_SS_AESDMASTATUS_DMADONECTXOUT 0x8U // Status bit for DMADONECTXOUT
|
||||
|
||||
//*****************************************************************************
|
||||
//
|
||||
// The following are defines for the bit fields in the AESDMASTATUSCLR register
|
||||
//
|
||||
//*****************************************************************************
|
||||
#define AES_SS_AESDMASTATUSCLR_DMADONECTXIN 0x1U // Clear bit for
|
||||
// AESDMASTSTAUS.DMADONECTXIN
|
||||
#define AES_SS_AESDMASTATUSCLR_DMADONEDIN 0x2U // Clear bit for
|
||||
// AESDMASTSTAUS.DMADONEDIN
|
||||
#define AES_SS_AESDMASTATUSCLR_DMADONEDOUT 0x4U // Clear bit for
|
||||
// AESDMASTSTAUS.DMADONEDOUT
|
||||
#define AES_SS_AESDMASTATUSCLR_DMADONECTXOUT 0x8U // Clear bit for
|
||||
// AESDMASTSTAUS.DMADONECTXOUT
|
||||
#endif
|
||||
+603
@@ -0,0 +1,603 @@
|
||||
//###########################################################################
|
||||
//
|
||||
// FILE: hw_can.h
|
||||
//
|
||||
// TITLE: Definitions for the CAN registers.
|
||||
//
|
||||
//###########################################################################
|
||||
// $TI Release: $
|
||||
// $Release Date: $
|
||||
//
|
||||
// C2000Ware v5.04.00.00
|
||||
//
|
||||
// Copyright (C) 2024 Texas Instruments Incorporated - http://www.ti.com
|
||||
//
|
||||
// Redistribution and use in source and binary forms, with or without
|
||||
// modification, are permitted provided that the following conditions
|
||||
// are met:
|
||||
//
|
||||
// Redistributions of source code must retain the above copyright
|
||||
// notice, this list of conditions and the following disclaimer.
|
||||
//
|
||||
// Redistributions in binary form must reproduce the above copyright
|
||||
// notice, this list of conditions and the following disclaimer in the
|
||||
// documentation and/or other materials provided with the
|
||||
// distribution.
|
||||
//
|
||||
// Neither the name of Texas Instruments Incorporated nor the names of
|
||||
// its contributors may be used to endorse or promote products derived
|
||||
// from this software without specific prior written permission.
|
||||
//
|
||||
// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
|
||||
// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
|
||||
// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
|
||||
// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
|
||||
// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
|
||||
// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
|
||||
// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
|
||||
// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
|
||||
// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
||||
// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
|
||||
// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
// $
|
||||
//###########################################################################
|
||||
|
||||
#ifndef HW_CAN_H
|
||||
#define HW_CAN_H
|
||||
|
||||
//*****************************************************************************
|
||||
//
|
||||
// The following are defines for the CAN register offsets
|
||||
//
|
||||
//*****************************************************************************
|
||||
#define CAN_O_CTL 0x0U // CAN Control Register
|
||||
#define CAN_O_ES 0x4U // Error and Status Register
|
||||
#define CAN_O_ERRC 0x8U // Error Counter Register
|
||||
#define CAN_O_BTR 0xCU // Bit Timing Register
|
||||
#define CAN_O_INT 0x10U // Interrupt Register
|
||||
#define CAN_O_TEST 0x14U // Test Register
|
||||
#define CAN_O_PERR 0x1CU // CAN Parity Error Code
|
||||
// Register
|
||||
#define CAN_O_REL 0x20U // CAN Core Release Register
|
||||
#define CAN_O_ECCDIAG 0x24U // CAN ECC Diagnostic Register
|
||||
#define CAN_O_ECCDIAG_STAT 0x28U // CAN ECC Diagnostic Status
|
||||
// Register
|
||||
#define CAN_O_RAM_INIT 0x40U // CAN RAM Initialization
|
||||
// Register
|
||||
#define CAN_O_GLB_INT_EN 0x50U // CAN Global Interrupt Enable
|
||||
// Register
|
||||
#define CAN_O_GLB_INT_FLG 0x54U // CAN Global Interrupt Flag
|
||||
// Register
|
||||
#define CAN_O_GLB_INT_CLR 0x58U // CAN Global Interrupt Clear
|
||||
// Register
|
||||
#define CAN_O_ABOTR 0x80U // Auto-Bus-On Time Register
|
||||
#define CAN_O_TXRQ_X 0x84U // CAN Transmission Request
|
||||
// Register
|
||||
#define CAN_O_TXRQ_21 0x88U // CAN Transmission Request 2_1
|
||||
// Register
|
||||
#define CAN_O_NDAT_X 0x98U // CAN New Data Register
|
||||
#define CAN_O_NDAT_21 0x9CU // CAN New Data 2_1 Register
|
||||
#define CAN_O_IPEN_X 0xACU // CAN Interrupt Pending
|
||||
// Register
|
||||
#define CAN_O_IPEN_21 0xB0U // CAN Interrupt Pending 2_1
|
||||
// Register
|
||||
#define CAN_O_MVAL_X 0xC0U // CAN Message Valid Register
|
||||
#define CAN_O_MVAL_21 0xC4U // CAN Message Valid 2_1
|
||||
// Register
|
||||
#define CAN_O_IP_MUX21 0xD8U // CAN Interrupt Multiplexer 2_1
|
||||
// Register
|
||||
#define CAN_O_IF1CMD 0x100U // IF1 Command Register
|
||||
#define CAN_O_IF1MSK 0x104U // IF1 Mask Register
|
||||
#define CAN_O_IF1ARB 0x108U // IF1 Arbitration Register
|
||||
#define CAN_O_IF1MCTL 0x10CU // IF1 Message Control Register
|
||||
#define CAN_O_IF1DATA 0x110U // IF1 Data A Register
|
||||
#define CAN_O_IF1DATB 0x114U // IF1 Data B Register
|
||||
#define CAN_O_IF2CMD 0x120U // IF2 Command Register
|
||||
#define CAN_O_IF2MSK 0x124U // IF2 Mask Register
|
||||
#define CAN_O_IF2ARB 0x128U // IF2 Arbitration Register
|
||||
#define CAN_O_IF2MCTL 0x12CU // IF2 Message Control Register
|
||||
#define CAN_O_IF2DATA 0x130U // IF2 Data A Register
|
||||
#define CAN_O_IF2DATB 0x134U // IF2 Data B Register
|
||||
#define CAN_O_IF3OBS 0x140U // IF3 Observation Register
|
||||
#define CAN_O_IF3MSK 0x144U // IF3 Mask Register
|
||||
#define CAN_O_IF3ARB 0x148U // IF3 Arbitration Register
|
||||
#define CAN_O_IF3MCTL 0x14CU // IF3 Message Control Register
|
||||
#define CAN_O_IF3DATA 0x150U // IF3 Data A Register
|
||||
#define CAN_O_IF3DATB 0x154U // IF3 Data B Register
|
||||
#define CAN_O_IF3UPD 0x160U // IF3 Update Enable Register
|
||||
#define CAN_O_IO_CTL_TX 0x1E0U // CAN TX I/O Control Register
|
||||
#define CAN_O_IO_CTL_RX 0x1E4U // CAN RX I/O Control Register
|
||||
|
||||
//*****************************************************************************
|
||||
//
|
||||
// The following are defines for the bit fields in the CAN_CTL register
|
||||
//
|
||||
//*****************************************************************************
|
||||
#define CAN_CTL_INIT 0x1U // Initialization
|
||||
#define CAN_CTL_IE0 0x2U // Interrupt line 0 Enable
|
||||
#define CAN_CTL_SIE 0x4U // Status Change Interrupt
|
||||
// Enable
|
||||
#define CAN_CTL_EIE 0x8U // Error Interrupt Enable
|
||||
#define CAN_CTL_DAR 0x20U // Disable Automatic
|
||||
// Retransmission
|
||||
#define CAN_CTL_CCE 0x40U // Configuration Change Enable
|
||||
#define CAN_CTL_TEST 0x80U // Test Mode Enable
|
||||
#define CAN_CTL_IDS 0x100U // Interruption Debug Support
|
||||
// Enable
|
||||
#define CAN_CTL_ABO 0x200U // Auto-Bus-On Enable
|
||||
#define CAN_CTL_PMD_S 10U
|
||||
#define CAN_CTL_PMD_M 0x3C00U // Parity on/off
|
||||
#define CAN_CTL_SWR 0x8000U // SW Reset Enable
|
||||
#define CAN_CTL_INITDBG 0x10000U // Debug Mode Status
|
||||
#define CAN_CTL_IE1 0x20000U // Interrupt line 1 Enable
|
||||
// Disabled
|
||||
#define CAN_CTL_DE1 0x40000U // Enable DMA request line
|
||||
#define CAN_CTL_DE2 0x80000U // Enable DMA request line
|
||||
#define CAN_CTL_DE3 0x100000U // Enable DMA request line
|
||||
|
||||
//*****************************************************************************
|
||||
//
|
||||
// The following are defines for the bit fields in the CAN_ES register
|
||||
//
|
||||
//*****************************************************************************
|
||||
#define CAN_ES_LEC_S 0U
|
||||
#define CAN_ES_LEC_M 0x7U // Last Error Code
|
||||
#define CAN_ES_TXOK 0x8U // Transmission status
|
||||
#define CAN_ES_RXOK 0x10U // Reception status
|
||||
#define CAN_ES_EPASS 0x20U // Error Passive State
|
||||
#define CAN_ES_EWARN 0x40U // Warning State
|
||||
#define CAN_ES_BOFF 0x80U // Bus-Off State
|
||||
#define CAN_ES_PER 0x100U // Parity Error Detected
|
||||
|
||||
//*****************************************************************************
|
||||
//
|
||||
// The following are defines for the bit fields in the CAN_ERRC register
|
||||
//
|
||||
//*****************************************************************************
|
||||
#define CAN_ERRC_TEC_S 0U
|
||||
#define CAN_ERRC_TEC_M 0xFFU // Transmit Error Counter
|
||||
#define CAN_ERRC_REC_S 8U
|
||||
#define CAN_ERRC_REC_M 0x7F00U // Receive Error Counter
|
||||
#define CAN_ERRC_RP 0x8000U // Receive Error Passive
|
||||
|
||||
//*****************************************************************************
|
||||
//
|
||||
// The following are defines for the bit fields in the CAN_BTR register
|
||||
//
|
||||
//*****************************************************************************
|
||||
#define CAN_BTR_BRP_S 0U
|
||||
#define CAN_BTR_BRP_M 0x3FU // Baud Rate Prescaler
|
||||
#define CAN_BTR_SJW_S 6U
|
||||
#define CAN_BTR_SJW_M 0xC0U // Synchronization Jump Width
|
||||
#define CAN_BTR_TSEG1_S 8U
|
||||
#define CAN_BTR_TSEG1_M 0xF00U // Time segment
|
||||
#define CAN_BTR_TSEG2_S 12U
|
||||
#define CAN_BTR_TSEG2_M 0x7000U // Time segment
|
||||
#define CAN_BTR_BRPE_S 16U
|
||||
#define CAN_BTR_BRPE_M 0xF0000U // Baud Rate Prescaler Extension
|
||||
|
||||
//*****************************************************************************
|
||||
//
|
||||
// The following are defines for the bit fields in the CAN_INT register
|
||||
//
|
||||
//*****************************************************************************
|
||||
#define CAN_INT_INT0ID_S 0U
|
||||
#define CAN_INT_INT0ID_M 0xFFFFU // Interrupt Identifier
|
||||
#define CAN_INT_INT1ID_S 16U
|
||||
#define CAN_INT_INT1ID_M 0xFF0000U // Interrupt 1 Identifier
|
||||
|
||||
//*****************************************************************************
|
||||
//
|
||||
// The following are defines for the bit fields in the CAN_TEST register
|
||||
//
|
||||
//*****************************************************************************
|
||||
#define CAN_TEST_SILENT 0x8U // Silent Mode
|
||||
#define CAN_TEST_LBACK 0x10U // Loopback Mode
|
||||
#define CAN_TEST_TX_S 5U
|
||||
#define CAN_TEST_TX_M 0x60U // CANTX Pin Control
|
||||
#define CAN_TEST_RX 0x80U // CANRX Pin Status
|
||||
#define CAN_TEST_EXL 0x100U // External Loopback Mode
|
||||
#define CAN_TEST_RDA 0x200U // RAM Direct Access Enable:
|
||||
|
||||
//*****************************************************************************
|
||||
//
|
||||
// The following are defines for the bit fields in the CAN_PERR register
|
||||
//
|
||||
//*****************************************************************************
|
||||
#define CAN_PERR_MSG_NUM_S 0U
|
||||
#define CAN_PERR_MSG_NUM_M 0xFFU // Message Number
|
||||
#define CAN_PERR_WORD_NUM_S 8U
|
||||
#define CAN_PERR_WORD_NUM_M 0x700U // Word Number
|
||||
|
||||
//*****************************************************************************
|
||||
//
|
||||
// The following are defines for the bit fields in the CAN_REL register
|
||||
//
|
||||
//*****************************************************************************
|
||||
#define CAN_REL_DAY_S 0U
|
||||
#define CAN_REL_DAY_M 0xFFU // Day
|
||||
#define CAN_REL_MON_S 8U
|
||||
#define CAN_REL_MON_M 0xFF00U // Month
|
||||
#define CAN_REL_YEAR_S 16U
|
||||
#define CAN_REL_YEAR_M 0xF0000U // Year
|
||||
#define CAN_REL_SUBSTEP_S 20U
|
||||
#define CAN_REL_SUBSTEP_M 0xF00000U // Substep
|
||||
#define CAN_REL_STEP_S 24U
|
||||
#define CAN_REL_STEP_M 0xF000000U // Step
|
||||
#define CAN_REL_REL_S 28U
|
||||
#define CAN_REL_REL_M 0xF0000000U // Release
|
||||
|
||||
//*****************************************************************************
|
||||
//
|
||||
// The following are defines for the bit fields in the CAN_ECCDIAG register
|
||||
//
|
||||
//*****************************************************************************
|
||||
#define CAN_ECCDIAG_ECCDIAG_S 0U
|
||||
#define CAN_ECCDIAG_ECCDIAG_M 0xFU // Diagnostic Enable
|
||||
|
||||
//*****************************************************************************
|
||||
//
|
||||
// The following are defines for the bit fields in the CAN_ECCDIAG_STAT register
|
||||
//
|
||||
//*****************************************************************************
|
||||
#define CAN_ECCDIAG_STAT_SEFLG 0x1U // Single bit error flag
|
||||
#define CAN_ECCDIAG_STAT_DEFLG 0x100U // Double bit error flag
|
||||
|
||||
//*****************************************************************************
|
||||
//
|
||||
// The following are defines for the bit fields in the CAN_RAM_INIT register
|
||||
//
|
||||
//*****************************************************************************
|
||||
#define CAN_RAM_INIT_KEY0 0x1U // KEY0
|
||||
#define CAN_RAM_INIT_KEY1 0x2U // KEY1
|
||||
#define CAN_RAM_INIT_KEY2 0x4U // KEY2
|
||||
#define CAN_RAM_INIT_KEY3 0x8U // KEY3
|
||||
#define CAN_RAM_INIT_CAN_RAM_INIT 0x10U // Initialize CAN Mailbox RAM
|
||||
#define CAN_RAM_INIT_RAM_INIT_DONE 0x20U // CAN RAM initialization
|
||||
// complete
|
||||
|
||||
//*****************************************************************************
|
||||
//
|
||||
// The following are defines for the bit fields in the CAN_GLB_INT_EN register
|
||||
//
|
||||
//*****************************************************************************
|
||||
#define CAN_GLB_INT_EN_GLBINT0_EN 0x1U // Global Interrupt Enable for
|
||||
// CANINT0
|
||||
#define CAN_GLB_INT_EN_GLBINT1_EN 0x2U // Global Interrupt Enable for
|
||||
// CANINT1
|
||||
|
||||
//*****************************************************************************
|
||||
//
|
||||
// The following are defines for the bit fields in the CAN_GLB_INT_FLG register
|
||||
//
|
||||
//*****************************************************************************
|
||||
#define CAN_GLB_INT_FLG_INT0_FLG 0x1U // Global Interrupt Flag for
|
||||
// CANINT0
|
||||
#define CAN_GLB_INT_FLG_INT1_FLG 0x2U // Global Interrupt Flag for
|
||||
// CANINT1
|
||||
|
||||
//*****************************************************************************
|
||||
//
|
||||
// The following are defines for the bit fields in the CAN_GLB_INT_CLR register
|
||||
//
|
||||
//*****************************************************************************
|
||||
#define CAN_GLB_INT_CLR_INT0_FLG_CLR 0x1U // Global Interrupt flag clear
|
||||
// for CANINT0
|
||||
#define CAN_GLB_INT_CLR_INT1_FLG_CLR 0x2U // Global Interrupt flag clear
|
||||
// for CANINT1
|
||||
|
||||
//*****************************************************************************
|
||||
//
|
||||
// The following are defines for the bit fields in the CAN_TXRQ_X register
|
||||
//
|
||||
//*****************************************************************************
|
||||
#define CAN_TXRQ_X_TXRQSTREG1_S 0U
|
||||
#define CAN_TXRQ_X_TXRQSTREG1_M 0x3U // Transmit Request Register 1
|
||||
#define CAN_TXRQ_X_TXRQSTREG2_S 2U
|
||||
#define CAN_TXRQ_X_TXRQSTREG2_M 0xCU // Transmit Request Register 2
|
||||
|
||||
//*****************************************************************************
|
||||
//
|
||||
// The following are defines for the bit fields in the CAN_NDAT_X register
|
||||
//
|
||||
//*****************************************************************************
|
||||
#define CAN_NDAT_X_NEWDATREG1_S 0U
|
||||
#define CAN_NDAT_X_NEWDATREG1_M 0x3U // New Data Register 1
|
||||
#define CAN_NDAT_X_NEWDATREG2_S 2U
|
||||
#define CAN_NDAT_X_NEWDATREG2_M 0xCU // New Data Register 2
|
||||
|
||||
//*****************************************************************************
|
||||
//
|
||||
// The following are defines for the bit fields in the CAN_IPEN_X register
|
||||
//
|
||||
//*****************************************************************************
|
||||
#define CAN_IPEN_X_INTPNDREG1_S 0U
|
||||
#define CAN_IPEN_X_INTPNDREG1_M 0x3U // Interrupt Pending Register 1
|
||||
#define CAN_IPEN_X_INTPNDREG2_S 2U
|
||||
#define CAN_IPEN_X_INTPNDREG2_M 0xCU // Interrupt Pending Register 2
|
||||
|
||||
//*****************************************************************************
|
||||
//
|
||||
// The following are defines for the bit fields in the CAN_MVAL_X register
|
||||
//
|
||||
//*****************************************************************************
|
||||
#define CAN_MVAL_X_MSGVALREG1_S 0U
|
||||
#define CAN_MVAL_X_MSGVALREG1_M 0x3U // Message Valid Register 1
|
||||
#define CAN_MVAL_X_MSGVALREG2_S 2U
|
||||
#define CAN_MVAL_X_MSGVALREG2_M 0xCU // Message Valid Register 2
|
||||
|
||||
//*****************************************************************************
|
||||
//
|
||||
// The following are defines for the bit fields in the CAN_IF1CMD register
|
||||
//
|
||||
//*****************************************************************************
|
||||
#define CAN_IF1CMD_MSG_NUM_S 0U
|
||||
#define CAN_IF1CMD_MSG_NUM_M 0xFFU // Message Number
|
||||
#define CAN_IF1CMD_DMAACTIVE 0x4000U // DMA Status
|
||||
#define CAN_IF1CMD_BUSY 0x8000U // Busy Flag
|
||||
#define CAN_IF1CMD_DATA_B 0x10000U // Access Data Bytes 4-7
|
||||
#define CAN_IF1CMD_DATA_A 0x20000U // Access Data Bytes 0-3
|
||||
#define CAN_IF1CMD_TXRQST 0x40000U // Access Transmission Request
|
||||
// Bit
|
||||
#define CAN_IF1CMD_CLRINTPND 0x80000U // Clear Interrupt Pending Bit
|
||||
#define CAN_IF1CMD_CONTROL 0x100000U // Access Control Bits
|
||||
#define CAN_IF1CMD_ARB 0x200000U // Access Arbitration Bits
|
||||
#define CAN_IF1CMD_MASK 0x400000U // Access Mask Bits
|
||||
#define CAN_IF1CMD_DIR 0x800000U // Write/Read Direction
|
||||
|
||||
//*****************************************************************************
|
||||
//
|
||||
// The following are defines for the bit fields in the CAN_IF1MSK register
|
||||
//
|
||||
//*****************************************************************************
|
||||
#define CAN_IF1MSK_MSK_S 0U
|
||||
#define CAN_IF1MSK_MSK_M 0x1FFFFFFFU // Identifier Mask
|
||||
#define CAN_IF1MSK_MDIR 0x40000000U // Mask Message Direction
|
||||
#define CAN_IF1MSK_MXTD 0x80000000U // Mask Extended Identifier
|
||||
|
||||
//*****************************************************************************
|
||||
//
|
||||
// The following are defines for the bit fields in the CAN_IF1ARB register
|
||||
//
|
||||
//*****************************************************************************
|
||||
#define CAN_IF1ARB_ID_S 0U
|
||||
#define CAN_IF1ARB_ID_M 0x1FFFFFFFU // `
|
||||
#define CAN_IF1ARB_DIR 0x20000000U // Message Direction
|
||||
#define CAN_IF1ARB_XTD 0x40000000U // Extended Identifier
|
||||
#define CAN_IF1ARB_MSGVAL 0x80000000U // Message Valid
|
||||
|
||||
//*****************************************************************************
|
||||
//
|
||||
// The following are defines for the bit fields in the CAN_IF1MCTL register
|
||||
//
|
||||
//*****************************************************************************
|
||||
#define CAN_IF1MCTL_DLC_S 0U
|
||||
#define CAN_IF1MCTL_DLC_M 0xFU // Data length code
|
||||
#define CAN_IF1MCTL_EOB 0x80U // End of Block
|
||||
#define CAN_IF1MCTL_TXRQST 0x100U // Transmit Request
|
||||
#define CAN_IF1MCTL_RMTEN 0x200U // Remote Enable
|
||||
#define CAN_IF1MCTL_RXIE 0x400U // Receive Interrupt Enable
|
||||
#define CAN_IF1MCTL_TXIE 0x800U // Transmit Interrupt Enable
|
||||
#define CAN_IF1MCTL_UMASK 0x1000U // Use Acceptance Mask
|
||||
#define CAN_IF1MCTL_INTPND 0x2000U // Interrupt Pending
|
||||
#define CAN_IF1MCTL_MSGLST 0x4000U // Message Lost
|
||||
#define CAN_IF1MCTL_NEWDAT 0x8000U // New Data
|
||||
|
||||
//*****************************************************************************
|
||||
//
|
||||
// The following are defines for the bit fields in the CAN_IF1DATA register
|
||||
//
|
||||
//*****************************************************************************
|
||||
#define CAN_IF1DATA_DATA_0_S 0U
|
||||
#define CAN_IF1DATA_DATA_0_M 0xFFU // Data Byte 0
|
||||
#define CAN_IF1DATA_DATA_1_S 8U
|
||||
#define CAN_IF1DATA_DATA_1_M 0xFF00U // Data Byte 1
|
||||
#define CAN_IF1DATA_DATA_2_S 16U
|
||||
#define CAN_IF1DATA_DATA_2_M 0xFF0000U // Data Byte 2
|
||||
#define CAN_IF1DATA_DATA_3_S 24U
|
||||
#define CAN_IF1DATA_DATA_3_M 0xFF000000U // Data Byte 3
|
||||
|
||||
//*****************************************************************************
|
||||
//
|
||||
// The following are defines for the bit fields in the CAN_IF1DATB register
|
||||
//
|
||||
//*****************************************************************************
|
||||
#define CAN_IF1DATB_DATA_4_S 0U
|
||||
#define CAN_IF1DATB_DATA_4_M 0xFFU // Data Byte 4
|
||||
#define CAN_IF1DATB_DATA_5_S 8U
|
||||
#define CAN_IF1DATB_DATA_5_M 0xFF00U // Data Byte 5
|
||||
#define CAN_IF1DATB_DATA_6_S 16U
|
||||
#define CAN_IF1DATB_DATA_6_M 0xFF0000U // Data Byte 6
|
||||
#define CAN_IF1DATB_DATA_7_S 24U
|
||||
#define CAN_IF1DATB_DATA_7_M 0xFF000000U // Data Byte 7
|
||||
|
||||
//*****************************************************************************
|
||||
//
|
||||
// The following are defines for the bit fields in the CAN_IF2CMD register
|
||||
//
|
||||
//*****************************************************************************
|
||||
#define CAN_IF2CMD_MSG_NUM_S 0U
|
||||
#define CAN_IF2CMD_MSG_NUM_M 0xFFU // Message Number
|
||||
#define CAN_IF2CMD_DMAACTIVE 0x4000U // DMA Status
|
||||
#define CAN_IF2CMD_BUSY 0x8000U // Busy Flag
|
||||
#define CAN_IF2CMD_DATA_B 0x10000U // Access Data Bytes 4-7
|
||||
#define CAN_IF2CMD_DATA_A 0x20000U // Access Data Bytes 0-3
|
||||
#define CAN_IF2CMD_TXRQST 0x40000U // Access Transmission Request
|
||||
// Bit
|
||||
#define CAN_IF2CMD_CLRINTPND 0x80000U // Clear Interrupt Pending Bit
|
||||
#define CAN_IF2CMD_CONTROL 0x100000U // Access Control Bits
|
||||
#define CAN_IF2CMD_ARB 0x200000U // Access Arbitration Bits
|
||||
#define CAN_IF2CMD_MASK 0x400000U // Access Mask Bits
|
||||
#define CAN_IF2CMD_DIR 0x800000U // Write/Read Direction
|
||||
|
||||
//*****************************************************************************
|
||||
//
|
||||
// The following are defines for the bit fields in the CAN_IF2MSK register
|
||||
//
|
||||
//*****************************************************************************
|
||||
#define CAN_IF2MSK_MSK_S 0U
|
||||
#define CAN_IF2MSK_MSK_M 0x1FFFFFFFU // Identifier Mask
|
||||
#define CAN_IF2MSK_MDIR 0x40000000U // Mask Message Direction
|
||||
#define CAN_IF2MSK_MXTD 0x80000000U // Mask Extended Identifier
|
||||
|
||||
//*****************************************************************************
|
||||
//
|
||||
// The following are defines for the bit fields in the CAN_IF2ARB register
|
||||
//
|
||||
//*****************************************************************************
|
||||
#define CAN_IF2ARB_ID_S 0U
|
||||
#define CAN_IF2ARB_ID_M 0x1FFFFFFFU // Message Identifier
|
||||
#define CAN_IF2ARB_DIR 0x20000000U // Message Direction
|
||||
#define CAN_IF2ARB_XTD 0x40000000U // Extended Identifier
|
||||
#define CAN_IF2ARB_MSGVAL 0x80000000U // Message Valid
|
||||
|
||||
//*****************************************************************************
|
||||
//
|
||||
// The following are defines for the bit fields in the CAN_IF2MCTL register
|
||||
//
|
||||
//*****************************************************************************
|
||||
#define CAN_IF2MCTL_DLC_S 0U
|
||||
#define CAN_IF2MCTL_DLC_M 0xFU // Data length code
|
||||
#define CAN_IF2MCTL_EOB 0x80U // End of Block
|
||||
#define CAN_IF2MCTL_TXRQST 0x100U // Transmit Request
|
||||
#define CAN_IF2MCTL_RMTEN 0x200U // Remote Enable
|
||||
#define CAN_IF2MCTL_RXIE 0x400U // Receive Interrupt Enable
|
||||
#define CAN_IF2MCTL_TXIE 0x800U // Transmit Interrupt Enable
|
||||
#define CAN_IF2MCTL_UMASK 0x1000U // Use Acceptance Mask
|
||||
#define CAN_IF2MCTL_INTPND 0x2000U // Interrupt Pending
|
||||
#define CAN_IF2MCTL_MSGLST 0x4000U // Message Lost
|
||||
#define CAN_IF2MCTL_NEWDAT 0x8000U // New Data
|
||||
|
||||
//*****************************************************************************
|
||||
//
|
||||
// The following are defines for the bit fields in the CAN_IF2DATA register
|
||||
//
|
||||
//*****************************************************************************
|
||||
#define CAN_IF2DATA_DATA_0_S 0U
|
||||
#define CAN_IF2DATA_DATA_0_M 0xFFU // Data Byte 0
|
||||
#define CAN_IF2DATA_DATA_1_S 8U
|
||||
#define CAN_IF2DATA_DATA_1_M 0xFF00U // Data Byte 1
|
||||
#define CAN_IF2DATA_DATA_2_S 16U
|
||||
#define CAN_IF2DATA_DATA_2_M 0xFF0000U // Data Byte 2
|
||||
#define CAN_IF2DATA_DATA_3_S 24U
|
||||
#define CAN_IF2DATA_DATA_3_M 0xFF000000U // Data Byte 3
|
||||
|
||||
//*****************************************************************************
|
||||
//
|
||||
// The following are defines for the bit fields in the CAN_IF2DATB register
|
||||
//
|
||||
//*****************************************************************************
|
||||
#define CAN_IF2DATB_DATA_4_S 0U
|
||||
#define CAN_IF2DATB_DATA_4_M 0xFFU // Data Byte 4
|
||||
#define CAN_IF2DATB_DATA_5_S 8U
|
||||
#define CAN_IF2DATB_DATA_5_M 0xFF00U // Data Byte 5
|
||||
#define CAN_IF2DATB_DATA_6_S 16U
|
||||
#define CAN_IF2DATB_DATA_6_M 0xFF0000U // Data Byte 6
|
||||
#define CAN_IF2DATB_DATA_7_S 24U
|
||||
#define CAN_IF2DATB_DATA_7_M 0xFF000000U // Data Byte 7
|
||||
|
||||
//*****************************************************************************
|
||||
//
|
||||
// The following are defines for the bit fields in the CAN_IF3OBS register
|
||||
//
|
||||
//*****************************************************************************
|
||||
#define CAN_IF3OBS_MASK 0x1U // Mask data read observation
|
||||
#define CAN_IF3OBS_ARB 0x2U // Arbitration data read
|
||||
// observation
|
||||
#define CAN_IF3OBS_CTRL 0x4U // Ctrl read observation
|
||||
#define CAN_IF3OBS_DATA_A 0x8U // Data A read observation
|
||||
#define CAN_IF3OBS_DATA_B 0x10U // Data B read observation
|
||||
#define CAN_IF3OBS_IF3SM 0x100U // IF3 Status of Mask data read
|
||||
// access
|
||||
#define CAN_IF3OBS_IF3SA 0x200U // IF3 Status of Arbitration
|
||||
// data read access
|
||||
#define CAN_IF3OBS_IF3SC 0x400U // IF3 Status of Control bits
|
||||
// read access
|
||||
#define CAN_IF3OBS_IF3SDA 0x800U // IF3 Status of Data A read
|
||||
// access
|
||||
#define CAN_IF3OBS_IF3SDB 0x1000U // IF3 Status of Data B read
|
||||
// access
|
||||
#define CAN_IF3OBS_IF3UPD 0x8000U // IF3 Update Data
|
||||
|
||||
//*****************************************************************************
|
||||
//
|
||||
// The following are defines for the bit fields in the CAN_IF3MSK register
|
||||
//
|
||||
//*****************************************************************************
|
||||
#define CAN_IF3MSK_MSK_S 0U
|
||||
#define CAN_IF3MSK_MSK_M 0x1FFFFFFFU // Mask
|
||||
#define CAN_IF3MSK_MDIR 0x40000000U // Mask Message Direction
|
||||
#define CAN_IF3MSK_MXTD 0x80000000U // Mask Extended Identifier
|
||||
|
||||
//*****************************************************************************
|
||||
//
|
||||
// The following are defines for the bit fields in the CAN_IF3ARB register
|
||||
//
|
||||
//*****************************************************************************
|
||||
#define CAN_IF3ARB_ID_S 0U
|
||||
#define CAN_IF3ARB_ID_M 0x1FFFFFFFU // Message Identifier
|
||||
#define CAN_IF3ARB_DIR 0x20000000U // Message Direction
|
||||
#define CAN_IF3ARB_XTD 0x40000000U // Extended Identifier
|
||||
#define CAN_IF3ARB_MSGVAL 0x80000000U // Message Valid
|
||||
|
||||
//*****************************************************************************
|
||||
//
|
||||
// The following are defines for the bit fields in the CAN_IF3MCTL register
|
||||
//
|
||||
//*****************************************************************************
|
||||
#define CAN_IF3MCTL_DLC_S 0U
|
||||
#define CAN_IF3MCTL_DLC_M 0xFU // Data length code
|
||||
#define CAN_IF3MCTL_EOB 0x80U // End of Block
|
||||
#define CAN_IF3MCTL_TXRQST 0x100U // Transmit Request
|
||||
#define CAN_IF3MCTL_RMTEN 0x200U // Remote Enable
|
||||
#define CAN_IF3MCTL_RXIE 0x400U // Receive Interrupt Enable
|
||||
#define CAN_IF3MCTL_TXIE 0x800U // Transmit Interrupt Enable
|
||||
#define CAN_IF3MCTL_UMASK 0x1000U // Use Acceptance Mask
|
||||
#define CAN_IF3MCTL_INTPND 0x2000U // Interrupt Pending
|
||||
#define CAN_IF3MCTL_MSGLST 0x4000U // Message Lost
|
||||
#define CAN_IF3MCTL_NEWDAT 0x8000U // New Data
|
||||
|
||||
//*****************************************************************************
|
||||
//
|
||||
// The following are defines for the bit fields in the CAN_IF3DATA register
|
||||
//
|
||||
//*****************************************************************************
|
||||
#define CAN_IF3DATA_DATA_0_S 0U
|
||||
#define CAN_IF3DATA_DATA_0_M 0xFFU // Data Byte 0
|
||||
#define CAN_IF3DATA_DATA_1_S 8U
|
||||
#define CAN_IF3DATA_DATA_1_M 0xFF00U // Data Byte 1
|
||||
#define CAN_IF3DATA_DATA_2_S 16U
|
||||
#define CAN_IF3DATA_DATA_2_M 0xFF0000U // Data Byte 2
|
||||
#define CAN_IF3DATA_DATA_3_S 24U
|
||||
#define CAN_IF3DATA_DATA_3_M 0xFF000000U // Data Byte 3
|
||||
|
||||
//*****************************************************************************
|
||||
//
|
||||
// The following are defines for the bit fields in the CAN_IF3DATB register
|
||||
//
|
||||
//*****************************************************************************
|
||||
#define CAN_IF3DATB_DATA_4_S 0U
|
||||
#define CAN_IF3DATB_DATA_4_M 0xFFU // Data Byte 4
|
||||
#define CAN_IF3DATB_DATA_5_S 8U
|
||||
#define CAN_IF3DATB_DATA_5_M 0xFF00U // Data Byte 5
|
||||
#define CAN_IF3DATB_DATA_6_S 16U
|
||||
#define CAN_IF3DATB_DATA_6_M 0xFF0000U // Data Byte 6
|
||||
#define CAN_IF3DATB_DATA_7_S 24U
|
||||
#define CAN_IF3DATB_DATA_7_M 0xFF000000U // Data Byte 7
|
||||
|
||||
//*****************************************************************************
|
||||
//
|
||||
// The following are defines for the bit fields in the CAN_IO_CTL_TX register
|
||||
//
|
||||
//*****************************************************************************
|
||||
#define CAN_IO_CTL_TX_IN 0x1U // Input value of CAN_TX pin
|
||||
#define CAN_IO_CTL_TX_FUNC 0x8U // Functionality of CAN_TX pin
|
||||
|
||||
//*****************************************************************************
|
||||
//
|
||||
// The following are defines for the bit fields in the CAN_IO_CTL_RX register
|
||||
//
|
||||
//*****************************************************************************
|
||||
#define CAN_IO_CTL_RX_IN 0x1U // Input value of CAN_RX pin
|
||||
#define CAN_IO_CTL_RX_FUNC 0x8U // Functionality of CAN_RX pin
|
||||
#endif
|
||||
+303
@@ -0,0 +1,303 @@
|
||||
//###########################################################################
|
||||
//
|
||||
// FILE: hw_cmmpu.h
|
||||
//
|
||||
// TITLE: Definitions for the CMMPU registers.
|
||||
//
|
||||
//###########################################################################
|
||||
// $TI Release: $
|
||||
// $Release Date: $
|
||||
//
|
||||
// C2000Ware v5.04.00.00
|
||||
//
|
||||
// Copyright (C) 2024 Texas Instruments Incorporated - http://www.ti.com
|
||||
//
|
||||
// Redistribution and use in source and binary forms, with or without
|
||||
// modification, are permitted provided that the following conditions
|
||||
// are met:
|
||||
//
|
||||
// Redistributions of source code must retain the above copyright
|
||||
// notice, this list of conditions and the following disclaimer.
|
||||
//
|
||||
// Redistributions in binary form must reproduce the above copyright
|
||||
// notice, this list of conditions and the following disclaimer in the
|
||||
// documentation and/or other materials provided with the
|
||||
// distribution.
|
||||
//
|
||||
// Neither the name of Texas Instruments Incorporated nor the names of
|
||||
// its contributors may be used to endorse or promote products derived
|
||||
// from this software without specific prior written permission.
|
||||
//
|
||||
// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
|
||||
// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
|
||||
// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
|
||||
// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
|
||||
// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
|
||||
// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
|
||||
// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
|
||||
// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
|
||||
// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
||||
// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
|
||||
// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
// $
|
||||
//###########################################################################
|
||||
|
||||
#ifndef HW_CMMPU_H
|
||||
#define HW_CMMPU_H
|
||||
|
||||
//*****************************************************************************
|
||||
//
|
||||
// The following are defines for the CMMPU register offsets
|
||||
//
|
||||
//*****************************************************************************
|
||||
#define CMMPU_O_MPU_CONTROL_REG 0x0U // MPU control regster
|
||||
#define CMMPU_O_ACC_VIO_INTEN 0x20U // Access violation interrupt
|
||||
// enable
|
||||
#define CMMPU_O_ACC_VIO_FLAGS 0x24U // Access violation flag
|
||||
// register
|
||||
#define CMMPU_O_ACC_VIO_FLAGS_SET 0x28U // Acesss violation set register
|
||||
#define CMMPU_O_ACC_VIO_FLAGS_CLR 0x2CU // Access violation clear
|
||||
// register
|
||||
#define CMMPU_O_ACC_VIO_ADDR_REG 0x30U // Access violation address
|
||||
// register
|
||||
#define CMMPU_O_REGION0_STARTADDRESSS 0x40U // Region 0 start address
|
||||
// register
|
||||
#define CMMPU_O_REGION0_CONFIG 0x44U // Region 0 configuration
|
||||
// register
|
||||
#define CMMPU_O_REGION1_STARTADDRESSS 0x48U // Region 1 start address
|
||||
// register
|
||||
#define CMMPU_O_REGION1_CONFIG 0x4CU // Region 1 configuration
|
||||
// register
|
||||
#define CMMPU_O_REGION2_STARTADDRESSS 0x50U // Region 2 start address
|
||||
// register
|
||||
#define CMMPU_O_REGION2_CONFIG 0x54U // Region 2 configuration
|
||||
// register
|
||||
#define CMMPU_O_REGION3_STARTADDRESSS 0x58U // Region 3 start address
|
||||
// register
|
||||
#define CMMPU_O_REGION3_CONFIG 0x5CU // Region 3 configuration
|
||||
// register
|
||||
#define CMMPU_O_REGION4_STARTADDRESSS 0x60U // Region 4 start address
|
||||
// register
|
||||
#define CMMPU_O_REGION4_CONFIG 0x64U // Region 4 configuration
|
||||
// register
|
||||
#define CMMPU_O_REGION5_STARTADDRESSS 0x68U // Region 5 start address
|
||||
// register
|
||||
#define CMMPU_O_REGION5_CONFIG 0x6CU // Region 5 configuration
|
||||
// register
|
||||
#define CMMPU_O_REGION6_STARTADDRESSS 0x70U // Region 6 start address
|
||||
// register
|
||||
#define CMMPU_O_REGION6_CONFIG 0x74U // Region 6 configuration
|
||||
// register
|
||||
#define CMMPU_O_REGION7_STARTADDRESSS 0x78U // Region 7 start address
|
||||
// register
|
||||
#define CMMPU_O_REGION7_CONFIG 0x7CU // Region 7 configuration
|
||||
// register
|
||||
|
||||
//*****************************************************************************
|
||||
//
|
||||
// The following are defines for the bit fields in the MPU_CONTROL_REG register
|
||||
//
|
||||
//*****************************************************************************
|
||||
#define CMMPU_MPU_CONTROL_REG_ENABLE 0x1U // Global Enable register
|
||||
|
||||
//*****************************************************************************
|
||||
//
|
||||
// The following are defines for the bit fields in the ACC_VIO_INTEN register
|
||||
//
|
||||
//*****************************************************************************
|
||||
#define CMMPU_ACC_VIO_INTEN_INTEN 0x1U // Interrupt enable register
|
||||
#define CMMPU_ACC_VIO_INTEN_KEY_S 16U
|
||||
#define CMMPU_ACC_VIO_INTEN_KEY_M 0xFFFF0000U // KEY to allow write access
|
||||
|
||||
//*****************************************************************************
|
||||
//
|
||||
// The following are defines for the bit fields in the ACC_VIO_FLAGS register
|
||||
//
|
||||
//*****************************************************************************
|
||||
#define CMMPU_ACC_VIO_FLAGS_RD 0x1U // Read access violation flag
|
||||
#define CMMPU_ACC_VIO_FLAGS_WR 0x2U // Write access violation flag
|
||||
|
||||
//*****************************************************************************
|
||||
//
|
||||
// The following are defines for the bit fields in the ACC_VIO_FLAGS_SET register
|
||||
//
|
||||
//*****************************************************************************
|
||||
#define CMMPU_ACC_VIO_FLAGS_SET_RD 0x1U // Read access violation flag
|
||||
// set
|
||||
#define CMMPU_ACC_VIO_FLAGS_SET_WR 0x2U // Write access violation flag
|
||||
// set
|
||||
#define CMMPU_ACC_VIO_FLAGS_SET_KEY_S 16U
|
||||
#define CMMPU_ACC_VIO_FLAGS_SET_KEY_M 0xFFFF0000U // KEY to allow write access
|
||||
|
||||
//*****************************************************************************
|
||||
//
|
||||
// The following are defines for the bit fields in the ACC_VIO_FLAGS_CLR register
|
||||
//
|
||||
//*****************************************************************************
|
||||
#define CMMPU_ACC_VIO_FLAGS_CLR_RD 0x1U // Read access violation flag
|
||||
// clear
|
||||
#define CMMPU_ACC_VIO_FLAGS_CLR_WR 0x2U // Write access violation flag
|
||||
// clear
|
||||
#define CMMPU_ACC_VIO_FLAGS_CLR_KEY_S 16U
|
||||
#define CMMPU_ACC_VIO_FLAGS_CLR_KEY_M 0xFFFF0000U // KEY to allow write access
|
||||
|
||||
//*****************************************************************************
|
||||
//
|
||||
// The following are defines for the bit fields in the REGION0_CONFIG register
|
||||
//
|
||||
//*****************************************************************************
|
||||
#define CMMPU_REGION0_CONFIG_ENABLE 0x1U // Region Enable bit
|
||||
#define CMMPU_REGION0_CONFIG_PROT_TYPE_S 4U
|
||||
#define CMMPU_REGION0_CONFIG_PROT_TYPE_M 0x30U // Access permission
|
||||
// configuration bits
|
||||
#define CMMPU_REGION0_CONFIG_SIZE_S 8U
|
||||
#define CMMPU_REGION0_CONFIG_SIZE_M 0x1F00U // Size of the region 0
|
||||
#define CMMPU_REGION0_CONFIG_SUBREGION0_DISABLE 0x10000U // Sub region 0 disable bit
|
||||
#define CMMPU_REGION0_CONFIG_SUBREGION1_DISABLE 0x20000U // Sub region 1 disable bit
|
||||
#define CMMPU_REGION0_CONFIG_SUBREGION2_DISABLE 0x40000U // Sub region 2 disable bit
|
||||
#define CMMPU_REGION0_CONFIG_SUBREGION3_DISABLE 0x80000U // Sub region 3 disable bit
|
||||
#define CMMPU_REGION0_CONFIG_SUBREGION4_DISABLE 0x100000U // Sub region 4 disable bit
|
||||
#define CMMPU_REGION0_CONFIG_SUBREGION5_DISABLE 0x200000U // Sub region 5 disable bit
|
||||
#define CMMPU_REGION0_CONFIG_SUBREGION6_DISABLE 0x400000U // Sub region 6 disable bit
|
||||
#define CMMPU_REGION0_CONFIG_SUBREGION7_DISABLE 0x800000U // Sub region 7 disable bit
|
||||
|
||||
//*****************************************************************************
|
||||
//
|
||||
// The following are defines for the bit fields in the REGION1_CONFIG register
|
||||
//
|
||||
//*****************************************************************************
|
||||
#define CMMPU_REGION1_CONFIG_ENABLE 0x1U // Region Enable bit
|
||||
#define CMMPU_REGION1_CONFIG_PROT_TYPE_S 4U
|
||||
#define CMMPU_REGION1_CONFIG_PROT_TYPE_M 0x30U // Access permission
|
||||
// configuration bits
|
||||
#define CMMPU_REGION1_CONFIG_SIZE_S 8U
|
||||
#define CMMPU_REGION1_CONFIG_SIZE_M 0x1F00U // Size of the region 1
|
||||
#define CMMPU_REGION1_CONFIG_SUBREGION0_DISABLE 0x10000U // Sub region 0 disable bit
|
||||
#define CMMPU_REGION1_CONFIG_SUBREGION1_DISABLE 0x20000U // Sub region 1 disable bit
|
||||
#define CMMPU_REGION1_CONFIG_SUBREGION2_DISABLE 0x40000U // Sub region 2 disable bit
|
||||
#define CMMPU_REGION1_CONFIG_SUBREGION3_DISABLE 0x80000U // Sub region 3 disable bit
|
||||
#define CMMPU_REGION1_CONFIG_SUBREGION4_DISABLE 0x100000U // Sub region 4 disable bit
|
||||
#define CMMPU_REGION1_CONFIG_SUBREGION5_DISABLE 0x200000U // Sub region 5 disable bit
|
||||
#define CMMPU_REGION1_CONFIG_SUBREGION6_DISABLE 0x400000U // Sub region 6 disable bit
|
||||
#define CMMPU_REGION1_CONFIG_SUBREGION7_DISABLE 0x800000U // Sub region 7 disable bit
|
||||
|
||||
//*****************************************************************************
|
||||
//
|
||||
// The following are defines for the bit fields in the REGION2_CONFIG register
|
||||
//
|
||||
//*****************************************************************************
|
||||
#define CMMPU_REGION2_CONFIG_ENABLE 0x1U // Region Enable bit
|
||||
#define CMMPU_REGION2_CONFIG_PROT_TYPE_S 4U
|
||||
#define CMMPU_REGION2_CONFIG_PROT_TYPE_M 0x30U // Access permission
|
||||
// configuration bits
|
||||
#define CMMPU_REGION2_CONFIG_SIZE_S 8U
|
||||
#define CMMPU_REGION2_CONFIG_SIZE_M 0x1F00U // Size of the region 2
|
||||
#define CMMPU_REGION2_CONFIG_SUBREGION0_DISABLE 0x10000U // Sub region 0 disable bit
|
||||
#define CMMPU_REGION2_CONFIG_SUBREGION1_DISABLE 0x20000U // Sub region 1 disable bit
|
||||
#define CMMPU_REGION2_CONFIG_SUBREGION2_DISABLE 0x40000U // Sub region 2 disable bit
|
||||
#define CMMPU_REGION2_CONFIG_SUBREGION3_DISABLE 0x80000U // Sub region 3 disable bit
|
||||
#define CMMPU_REGION2_CONFIG_SUBREGION4_DISABLE 0x100000U // Sub region 4 disable bit
|
||||
#define CMMPU_REGION2_CONFIG_SUBREGION5_DISABLE 0x200000U // Sub region 5 disable bit
|
||||
#define CMMPU_REGION2_CONFIG_SUBREGION6_DISABLE 0x400000U // Sub region 6 disable bit
|
||||
#define CMMPU_REGION2_CONFIG_SUBREGION7_DISABLE 0x800000U // Sub region 7 disable bit
|
||||
|
||||
//*****************************************************************************
|
||||
//
|
||||
// The following are defines for the bit fields in the REGION3_CONFIG register
|
||||
//
|
||||
//*****************************************************************************
|
||||
#define CMMPU_REGION3_CONFIG_ENABLE 0x1U // Region Enable bit
|
||||
#define CMMPU_REGION3_CONFIG_PROT_TYPE_S 4U
|
||||
#define CMMPU_REGION3_CONFIG_PROT_TYPE_M 0x30U // Access permission
|
||||
// configuration bits
|
||||
#define CMMPU_REGION3_CONFIG_SIZE_S 8U
|
||||
#define CMMPU_REGION3_CONFIG_SIZE_M 0x1F00U // Size of the region 3
|
||||
#define CMMPU_REGION3_CONFIG_SUBREGION0_DISABLE 0x10000U // Sub region 0 disable bit
|
||||
#define CMMPU_REGION3_CONFIG_SUBREGION1_DISABLE 0x20000U // Sub region 1 disable bit
|
||||
#define CMMPU_REGION3_CONFIG_SUBREGION2_DISABLE 0x40000U // Sub region 2 disable bit
|
||||
#define CMMPU_REGION3_CONFIG_SUBREGION3_DISABLE 0x80000U // Sub region 3 disable bit
|
||||
#define CMMPU_REGION3_CONFIG_SUBREGION4_DISABLE 0x100000U // Sub region 4 disable bit
|
||||
#define CMMPU_REGION3_CONFIG_SUBREGION5_DISABLE 0x200000U // Sub region 5 disable bit
|
||||
#define CMMPU_REGION3_CONFIG_SUBREGION6_DISABLE 0x400000U // Sub region 6 disable bit
|
||||
#define CMMPU_REGION3_CONFIG_SUBREGION7_DISABLE 0x800000U // Sub region 7 disable bit
|
||||
|
||||
//*****************************************************************************
|
||||
//
|
||||
// The following are defines for the bit fields in the REGION4_CONFIG register
|
||||
//
|
||||
//*****************************************************************************
|
||||
#define CMMPU_REGION4_CONFIG_ENABLE 0x1U // Region Enable bit
|
||||
#define CMMPU_REGION4_CONFIG_PROT_TYPE_S 4U
|
||||
#define CMMPU_REGION4_CONFIG_PROT_TYPE_M 0x30U // Access permission
|
||||
// configuration bits
|
||||
#define CMMPU_REGION4_CONFIG_SIZE_S 8U
|
||||
#define CMMPU_REGION4_CONFIG_SIZE_M 0x1F00U // Size of the region 4
|
||||
#define CMMPU_REGION4_CONFIG_SUBREGION0_DISABLE 0x10000U // Sub region 0 disable bit
|
||||
#define CMMPU_REGION4_CONFIG_SUBREGION1_DISABLE 0x20000U // Sub region 1 disable bit
|
||||
#define CMMPU_REGION4_CONFIG_SUBREGION2_DISABLE 0x40000U // Sub region 2 disable bit
|
||||
#define CMMPU_REGION4_CONFIG_SUBREGION3_DISABLE 0x80000U // Sub region 3 disable bit
|
||||
#define CMMPU_REGION4_CONFIG_SUBREGION4_DISABLE 0x100000U // Sub region 4 disable bit
|
||||
#define CMMPU_REGION4_CONFIG_SUBREGION5_DISABLE 0x200000U // Sub region 5 disable bit
|
||||
#define CMMPU_REGION4_CONFIG_SUBREGION6_DISABLE 0x400000U // Sub region 6 disable bit
|
||||
#define CMMPU_REGION4_CONFIG_SUBREGION7_DISABLE 0x800000U // Sub region 7 disable bit
|
||||
|
||||
//*****************************************************************************
|
||||
//
|
||||
// The following are defines for the bit fields in the REGION5_CONFIG register
|
||||
//
|
||||
//*****************************************************************************
|
||||
#define CMMPU_REGION5_CONFIG_ENABLE 0x1U // Region Enable bit
|
||||
#define CMMPU_REGION5_CONFIG_PROT_TYPE_S 4U
|
||||
#define CMMPU_REGION5_CONFIG_PROT_TYPE_M 0x30U // Access permission
|
||||
// configuration bits
|
||||
#define CMMPU_REGION5_CONFIG_SIZE_S 8U
|
||||
#define CMMPU_REGION5_CONFIG_SIZE_M 0x1F00U // Size of the region 5
|
||||
#define CMMPU_REGION5_CONFIG_SUBREGION0_DISABLE 0x10000U // Sub region 0 disable bit
|
||||
#define CMMPU_REGION5_CONFIG_SUBREGION1_DISABLE 0x20000U // Sub region 1 disable bit
|
||||
#define CMMPU_REGION5_CONFIG_SUBREGION2_DISABLE 0x40000U // Sub region 2 disable bit
|
||||
#define CMMPU_REGION5_CONFIG_SUBREGION3_DISABLE 0x80000U // Sub region 3 disable bit
|
||||
#define CMMPU_REGION5_CONFIG_SUBREGION4_DISABLE 0x100000U // Sub region 4 disable bit
|
||||
#define CMMPU_REGION5_CONFIG_SUBREGION5_DISABLE 0x200000U // Sub region 5 disable bit
|
||||
#define CMMPU_REGION5_CONFIG_SUBREGION6_DISABLE 0x400000U // Sub region 6 disable bit
|
||||
#define CMMPU_REGION5_CONFIG_SUBREGION7_DISABLE 0x800000U // Sub region 7 disable bit
|
||||
|
||||
//*****************************************************************************
|
||||
//
|
||||
// The following are defines for the bit fields in the REGION6_CONFIG register
|
||||
//
|
||||
//*****************************************************************************
|
||||
#define CMMPU_REGION6_CONFIG_ENABLE 0x1U // Region Enable bit
|
||||
#define CMMPU_REGION6_CONFIG_PROT_TYPE_S 4U
|
||||
#define CMMPU_REGION6_CONFIG_PROT_TYPE_M 0x30U // Access permission
|
||||
// configuration bits
|
||||
#define CMMPU_REGION6_CONFIG_SIZE_S 8U
|
||||
#define CMMPU_REGION6_CONFIG_SIZE_M 0x1F00U // Size of the region 6
|
||||
#define CMMPU_REGION6_CONFIG_SUBREGION0_DISABLE 0x10000U // Sub region 0 disable bit
|
||||
#define CMMPU_REGION6_CONFIG_SUBREGION1_DISABLE 0x20000U // Sub region 1 disable bit
|
||||
#define CMMPU_REGION6_CONFIG_SUBREGION2_DISABLE 0x40000U // Sub region 2 disable bit
|
||||
#define CMMPU_REGION6_CONFIG_SUBREGION3_DISABLE 0x80000U // Sub region 3 disable bit
|
||||
#define CMMPU_REGION6_CONFIG_SUBREGION4_DISABLE 0x100000U // Sub region 4 disable bit
|
||||
#define CMMPU_REGION6_CONFIG_SUBREGION5_DISABLE 0x200000U // Sub region 5 disable bit
|
||||
#define CMMPU_REGION6_CONFIG_SUBREGION6_DISABLE 0x400000U // Sub region 6 disable bit
|
||||
#define CMMPU_REGION6_CONFIG_SUBREGION7_DISABLE 0x800000U // Sub region 7 disable bit
|
||||
|
||||
//*****************************************************************************
|
||||
//
|
||||
// The following are defines for the bit fields in the REGION7_CONFIG register
|
||||
//
|
||||
//*****************************************************************************
|
||||
#define CMMPU_REGION7_CONFIG_ENABLE 0x1U // Region Enable bit
|
||||
#define CMMPU_REGION7_CONFIG_PROT_TYPE_S 4U
|
||||
#define CMMPU_REGION7_CONFIG_PROT_TYPE_M 0x30U // Access permission
|
||||
// configuration bits
|
||||
#define CMMPU_REGION7_CONFIG_SIZE_S 8U
|
||||
#define CMMPU_REGION7_CONFIG_SIZE_M 0x1F00U // Size of the region 7
|
||||
#define CMMPU_REGION7_CONFIG_SUBREGION0_DISABLE 0x10000U // Sub region 0 disable bit
|
||||
#define CMMPU_REGION7_CONFIG_SUBREGION1_DISABLE 0x20000U // Sub region 1 disable bit
|
||||
#define CMMPU_REGION7_CONFIG_SUBREGION2_DISABLE 0x40000U // Sub region 2 disable bit
|
||||
#define CMMPU_REGION7_CONFIG_SUBREGION3_DISABLE 0x80000U // Sub region 3 disable bit
|
||||
#define CMMPU_REGION7_CONFIG_SUBREGION4_DISABLE 0x100000U // Sub region 4 disable bit
|
||||
#define CMMPU_REGION7_CONFIG_SUBREGION5_DISABLE 0x200000U // Sub region 5 disable bit
|
||||
#define CMMPU_REGION7_CONFIG_SUBREGION6_DISABLE 0x400000U // Sub region 6 disable bit
|
||||
#define CMMPU_REGION7_CONFIG_SUBREGION7_DISABLE 0x800000U // Sub region 7 disable bit
|
||||
#endif
|
||||
+85
@@ -0,0 +1,85 @@
|
||||
//###########################################################################
|
||||
//
|
||||
// FILE: hw_cputimer.h
|
||||
//
|
||||
// TITLE: Definitions for the CPUTIMER registers.
|
||||
//
|
||||
//###########################################################################
|
||||
// $TI Release: $
|
||||
// $Release Date: $
|
||||
//
|
||||
// C2000Ware v5.04.00.00
|
||||
//
|
||||
// Copyright (C) 2024 Texas Instruments Incorporated - http://www.ti.com
|
||||
//
|
||||
// Redistribution and use in source and binary forms, with or without
|
||||
// modification, are permitted provided that the following conditions
|
||||
// are met:
|
||||
//
|
||||
// Redistributions of source code must retain the above copyright
|
||||
// notice, this list of conditions and the following disclaimer.
|
||||
//
|
||||
// Redistributions in binary form must reproduce the above copyright
|
||||
// notice, this list of conditions and the following disclaimer in the
|
||||
// documentation and/or other materials provided with the
|
||||
// distribution.
|
||||
//
|
||||
// Neither the name of Texas Instruments Incorporated nor the names of
|
||||
// its contributors may be used to endorse or promote products derived
|
||||
// from this software without specific prior written permission.
|
||||
//
|
||||
// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
|
||||
// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
|
||||
// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
|
||||
// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
|
||||
// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
|
||||
// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
|
||||
// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
|
||||
// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
|
||||
// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
||||
// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
|
||||
// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
// $
|
||||
//###########################################################################
|
||||
|
||||
#ifndef HW_CPUTIMER_H
|
||||
#define HW_CPUTIMER_H
|
||||
|
||||
//*****************************************************************************
|
||||
//
|
||||
// The following are defines for the CPUTIMER register offsets
|
||||
//
|
||||
//*****************************************************************************
|
||||
#define CPUTIMER_O_TIM 0x0U // Timer counter register
|
||||
#define CPUTIMER_O_PRD 0x4U // Timer period register
|
||||
#define CPUTIMER_O_TCR 0x8U // Timer control register
|
||||
#define CPUTIMER_O_TPR 0xCU // Timer prescaler register
|
||||
|
||||
//*****************************************************************************
|
||||
//
|
||||
// The following are defines for the bit fields in the TCR register
|
||||
//
|
||||
//*****************************************************************************
|
||||
#define CPUTIMER_TCR_TSS 0x10U // Timer Stop Status
|
||||
#define CPUTIMER_TCR_TRB 0x20U // Timer Reload Bit
|
||||
#define CPUTIMER_TCR_SOFT 0x400U // SOFT stop enable
|
||||
#define CPUTIMER_TCR_FREE 0x800U // Free run enable
|
||||
#define CPUTIMER_TCR_TIE 0x4000U // Timer Interrupt Enable
|
||||
#define CPUTIMER_TCR_TIF 0x8000U // Timer Intrerrupt Flag
|
||||
|
||||
//*****************************************************************************
|
||||
//
|
||||
// The following are defines for the bit fields in the TPR register
|
||||
//
|
||||
//*****************************************************************************
|
||||
#define CPUTIMER_TPR_TDDRL_S 0U
|
||||
#define CPUTIMER_TPR_TDDRL_M 0xFFU // Timer Divide Down Register
|
||||
// Low
|
||||
#define CPUTIMER_TPR_PSCL_S 8U
|
||||
#define CPUTIMER_TPR_PSCL_M 0xFF00U // Prescaler Counter low
|
||||
#define CPUTIMER_TPR_TDDRH_S 16U
|
||||
#define CPUTIMER_TPR_TDDRH_M 0xFF0000U // Timer Divide Down Register
|
||||
// High
|
||||
#define CPUTIMER_TPR_PSCH_S 24U
|
||||
#define CPUTIMER_TPR_PSCH_M 0xFF000000U // Prescaler Counter high
|
||||
#endif
|
||||
+1234
File diff suppressed because it is too large.
Load diff
+395
@@ -0,0 +1,395 @@
|
||||
//###########################################################################
|
||||
//
|
||||
// FILE: hw_ecat_ss.h
|
||||
//
|
||||
// TITLE: Definitions for the ECAT_SS registers.
|
||||
//
|
||||
//###########################################################################
|
||||
// $TI Release: $
|
||||
// $Release Date: $
|
||||
//
|
||||
// C2000Ware v5.04.00.00
|
||||
//
|
||||
// Copyright (C) 2024 Texas Instruments Incorporated - http://www.ti.com
|
||||
//
|
||||
// Redistribution and use in source and binary forms, with or without
|
||||
// modification, are permitted provided that the following conditions
|
||||
// are met:
|
||||
//
|
||||
// Redistributions of source code must retain the above copyright
|
||||
// notice, this list of conditions and the following disclaimer.
|
||||
//
|
||||
// Redistributions in binary form must reproduce the above copyright
|
||||
// notice, this list of conditions and the following disclaimer in the
|
||||
// documentation and/or other materials provided with the
|
||||
// distribution.
|
||||
//
|
||||
// Neither the name of Texas Instruments Incorporated nor the names of
|
||||
// its contributors may be used to endorse or promote products derived
|
||||
// from this software without specific prior written permission.
|
||||
//
|
||||
// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
|
||||
// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
|
||||
// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
|
||||
// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
|
||||
// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
|
||||
// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
|
||||
// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
|
||||
// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
|
||||
// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
||||
// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
|
||||
// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
// $
|
||||
//###########################################################################
|
||||
|
||||
#ifndef HW_ECAT_SS_H
|
||||
#define HW_ECAT_SS_H
|
||||
|
||||
//*****************************************************************************
|
||||
//
|
||||
// The following are defines for the ECAT_SS register offsets
|
||||
//
|
||||
//*****************************************************************************
|
||||
#define ECAT_SS_O_ECATSS_IPREVNUM 0x0U // IP Revision Number
|
||||
#define ECAT_SS_O_ECAT_INTR_RIS 0x4U // EtherCATSS Interrupt Raw
|
||||
// Status
|
||||
#define ECAT_SS_O_ECAT_INTR_MASK 0x8U // EtherCATSS Interrupt Mask
|
||||
#define ECAT_SS_O_ECAT_INTR_MIS 0xCU // EtherCATSS Masked Interrupt
|
||||
// Status
|
||||
#define ECAT_SS_O_ECAT_INTR_CLR 0x10U // EtherCATSS Interrupt Clear
|
||||
#define ECAT_SS_O_ECAT_INTR_SET 0x14U // EtherCATSS Interrupt Set to
|
||||
// emulate
|
||||
#define ECAT_SS_O_ECAT_LATCH_SEL 0x18U // Select for Latch0/1 inputs
|
||||
// and LATCHIN input
|
||||
#define ECAT_SS_O_ECAT_ACCESS_CTRL 0x1CU // PDI interface access control
|
||||
// config.
|
||||
#define ECAT_SS_O_ECAT_GPIN_DAT 0x20U // GPIN data capture for debug &
|
||||
// override
|
||||
#define ECAT_SS_O_ECAT_GPIN_PIPE 0x24U // GPIN pipeline select
|
||||
#define ECAT_SS_O_ECAT_GPIN_GRP_CAP_SEL 0x28U // GPIN pipe group capture
|
||||
// trigger
|
||||
#define ECAT_SS_O_ECAT_GPOUT_DAT 0x2CU // GPOUT data capture for debug
|
||||
// & override
|
||||
#define ECAT_SS_O_ECAT_GPOUT_PIPE 0x30U // GPOUT pipeline select
|
||||
#define ECAT_SS_O_ECAT_GPOUT_GRP_CAP_SEL 0x34U // GPOUT pipe group capture
|
||||
// trigger
|
||||
#define ECAT_SS_O_ECAT_MEM_TEST 0x38U // Memory Test Control
|
||||
#define ECAT_SS_O_ECAT_RESET_DEST_CONFIG 0x3CU // ResetOut impact or
|
||||
// destination config
|
||||
#define ECAT_SS_O_ECAT_SYNC0_CONFIG 0x40U // SYNC0 Configuration for
|
||||
// various triggers
|
||||
#define ECAT_SS_O_ECAT_SYNC1_CONFIG 0x44U // SYNC1 Configuration for
|
||||
// various triggers
|
||||
#define ECAT_SS_O_ECAT_CONFIG_LOCK 0x0U // EtherCATSS Configuration Lock
|
||||
#define ECAT_SS_O_ECAT_MISC_IO_CONFIG 0x4U // RESET_IN, EEPROM IO
|
||||
// connections select
|
||||
#define ECAT_SS_O_ECAT_PHY_IO_CONFIG 0x8U // Control Register of ECATSS
|
||||
#define ECAT_SS_O_ECAT_SYNC_IO_CONFIG 0xCU // SYNC Signals IO
|
||||
// configurations
|
||||
#define ECAT_SS_O_ECAT_LATCH_IO_CONFIG 0x10U // LATCH inputs IO pad select
|
||||
#define ECAT_SS_O_ECAT_GPIN_SEL 0x14U // GPIN Select between IO PAD &
|
||||
// tieoff
|
||||
#define ECAT_SS_O_ECAT_GPIN_IOPAD_SEL 0x18U // GPIN IO pad Select
|
||||
#define ECAT_SS_O_ECAT_GPOUT_SEL 0x1CU // GPOUT IO pad connect select
|
||||
#define ECAT_SS_O_ECAT_GPOUT_IOPAD_SEL 0x20U // GPOUT IO pad select
|
||||
#define ECAT_SS_O_ECAT_LED_CONFIG 0x24U // Selection of LED o/p connect
|
||||
// to IO pad
|
||||
#define ECAT_SS_O_ECAT_MISC_CONFIG 0x28U // Miscelleneous Configuration
|
||||
|
||||
//*****************************************************************************
|
||||
//
|
||||
// The following are defines for the bit fields in the ECATSS_IPREVNUM register
|
||||
//
|
||||
//*****************************************************************************
|
||||
#define ECAT_SS_ECATSS_IPREVNUM_IP_REV_MINOR_S 0U
|
||||
#define ECAT_SS_ECATSS_IPREVNUM_IP_REV_MINOR_M 0xFU // Minor IP Revision Number
|
||||
#define ECAT_SS_ECATSS_IPREVNUM_IP_REV_MAJOR_S 4U
|
||||
#define ECAT_SS_ECATSS_IPREVNUM_IP_REV_MAJOR_M 0xF0U // Major IP Revision Number
|
||||
|
||||
//*****************************************************************************
|
||||
//
|
||||
// The following are defines for the bit fields in the ECAT_INTR_RIS register
|
||||
//
|
||||
//*****************************************************************************
|
||||
#define ECAT_SS_ECAT_INTR_RIS_SYNC0_RIS 0x1U // SYNC0 feature RIS
|
||||
#define ECAT_SS_ECAT_INTR_RIS_SYNC1_RIS 0x2U // SYNC1 feature RIS
|
||||
#define ECAT_SS_ECAT_INTR_RIS_ECATSS_IRQ_RIS 0x4U // EtherCATSS IRQ RIS
|
||||
#define ECAT_SS_ECAT_INTR_RIS_DMA_DONE_RIS 0x8U // DMA Done RIS
|
||||
#define ECAT_SS_ECAT_INTR_RIS_TIMEOUT_ERR_RIS 0x10U // PDI bus Timeout Error RIS
|
||||
#define ECAT_SS_ECAT_INTR_RIS_ECAT_MASTER_RESET_RIS 0x20U // ECAT RESET RIS
|
||||
|
||||
//*****************************************************************************
|
||||
//
|
||||
// The following are defines for the bit fields in the ECAT_INTR_MASK register
|
||||
//
|
||||
//*****************************************************************************
|
||||
#define ECAT_SS_ECAT_INTR_MASK_SYNC0_MASK 0x1U // SYNC0 feature Mask
|
||||
#define ECAT_SS_ECAT_INTR_MASK_SYNC1_MASK 0x2U // SYNC1 feature Mask
|
||||
#define ECAT_SS_ECAT_INTR_MASK_ECATSS_IRQ_MASK 0x4U // EtherCATSS IRQ Mask
|
||||
#define ECAT_SS_ECAT_INTR_MASK_DMA_DONE_MASK 0x8U // DMA Done Mask
|
||||
#define ECAT_SS_ECAT_INTR_MASK_TIMEOUT_ERR_MASK 0x10U // PDI Access Timeout Error Mask
|
||||
#define ECAT_SS_ECAT_INTR_MASK_ECAT_MASTER_RESET_MASK 0x20U // EtherCAT Master Reset Mask
|
||||
|
||||
//*****************************************************************************
|
||||
//
|
||||
// The following are defines for the bit fields in the ECAT_INTR_MIS register
|
||||
//
|
||||
//*****************************************************************************
|
||||
#define ECAT_SS_ECAT_INTR_MIS_SYNC0_MIS 0x1U // SYNC0 feature MIS
|
||||
#define ECAT_SS_ECAT_INTR_MIS_SYNC1_MIS 0x2U // SYNC1 feature MIS
|
||||
#define ECAT_SS_ECAT_INTR_MIS_ECATSS_IRQ_MIS 0x4U // EtherCATSS IRQ MIS
|
||||
#define ECAT_SS_ECAT_INTR_MIS_DMA_DONE_MIS 0x8U // DMA Done MIS
|
||||
#define ECAT_SS_ECAT_INTR_MIS_TIMEOUT_ERR_MIS 0x10U // PDI bus Timeout Error MIS
|
||||
#define ECAT_SS_ECAT_INTR_MIS_ECAT_MASTER_RESET_MIS 0x20U // EtherCAT Master Reset MIS
|
||||
|
||||
//*****************************************************************************
|
||||
//
|
||||
// The following are defines for the bit fields in the ECAT_INTR_CLR register
|
||||
//
|
||||
//*****************************************************************************
|
||||
#define ECAT_SS_ECAT_INTR_CLR_SYNC0_CLR 0x1U // SYNC0 feature Clear
|
||||
#define ECAT_SS_ECAT_INTR_CLR_SYNC1_CLR 0x2U // SYNC1 feature Clear
|
||||
#define ECAT_SS_ECAT_INTR_CLR_ECATSS_IRQ_CLR 0x4U // EtherCATSS IRQ Clear
|
||||
#define ECAT_SS_ECAT_INTR_CLR_DMA_DONE_CLR 0x8U // DMA Done Clear
|
||||
#define ECAT_SS_ECAT_INTR_CLR_TIMEOUT_ERR_CLR 0x10U // PDI Access Timeout Error
|
||||
// Clear
|
||||
#define ECAT_SS_ECAT_INTR_CLR_ECAT_MASTER_RESET_CLR 0x20U // EtherCAT Master Reset Clear
|
||||
|
||||
//*****************************************************************************
|
||||
//
|
||||
// The following are defines for the bit fields in the ECAT_INTR_SET register
|
||||
//
|
||||
//*****************************************************************************
|
||||
#define ECAT_SS_ECAT_INTR_SET_SYNC0_SET 0x1U // SYNC0 Set Emulate
|
||||
#define ECAT_SS_ECAT_INTR_SET_SYNC1_SET 0x2U // SYNC1 Set Emulate
|
||||
#define ECAT_SS_ECAT_INTR_SET_ECATSS_IRQ_SET 0x4U // EtherCATSS IRQ Set Emulate
|
||||
#define ECAT_SS_ECAT_INTR_SET_DMA_DONE_SET 0x8U // DMA Done Set Emulate
|
||||
#define ECAT_SS_ECAT_INTR_SET_TIMEOUT_ERR_SET 0x10U // PDI Access Timeout Error Set
|
||||
// Emulate
|
||||
#define ECAT_SS_ECAT_INTR_SET_ECAT_MASTER_RESET_SET 0x20U // EtherCAT Master Reset Emulate
|
||||
#define ECAT_SS_ECAT_INTR_SET_WRITE_KEY_S 8U
|
||||
#define ECAT_SS_ECAT_INTR_SET_WRITE_KEY_M 0xFF00U // Key to enable writing lock
|
||||
|
||||
//*****************************************************************************
|
||||
//
|
||||
// The following are defines for the bit fields in the ECAT_LATCH_SEL register
|
||||
//
|
||||
//*****************************************************************************
|
||||
#define ECAT_SS_ECAT_LATCH_SEL_LATCH0_SELECT_S 0U
|
||||
#define ECAT_SS_ECAT_LATCH_SEL_LATCH0_SELECT_M 0x1FU // LATCH0 Inputs mux select
|
||||
#define ECAT_SS_ECAT_LATCH_SEL_LATCH1_SELECT_S 8U
|
||||
#define ECAT_SS_ECAT_LATCH_SEL_LATCH1_SELECT_M 0x1F00U // LATCH1 Inputs mux select
|
||||
|
||||
//*****************************************************************************
|
||||
//
|
||||
// The following are defines for the bit fields in the ECAT_ACCESS_CTRL register
|
||||
//
|
||||
//*****************************************************************************
|
||||
#define ECAT_SS_ECAT_ACCESS_CTRL_WAIT_STATES_S 0U
|
||||
#define ECAT_SS_ECAT_ACCESS_CTRL_WAIT_STATES_M 0x7FU // Minimum Wait States for VBUS
|
||||
// Bridge
|
||||
#define ECAT_SS_ECAT_ACCESS_CTRL_EN_TIMEOUT 0x80U // PDI Timeout enable
|
||||
#define ECAT_SS_ECAT_ACCESS_CTRL_ADDRESS_MODE_2 0x100U // Address translation method
|
||||
// select
|
||||
#define ECAT_SS_ECAT_ACCESS_CTRL_ENABLE_DEBUG_ACCESS 0x200U // Debug access enable
|
||||
#define ECAT_SS_ECAT_ACCESS_CTRL_TIMEOUT_COUNT_S 16U
|
||||
#define ECAT_SS_ECAT_ACCESS_CTRL_TIMEOUT_COUNT_M 0xFFF0000U // Max timecount programmed and
|
||||
// count while enabled.
|
||||
|
||||
//*****************************************************************************
|
||||
//
|
||||
// The following are defines for the bit fields in the ECAT_GPIN_GRP_CAP_SEL register
|
||||
//
|
||||
//*****************************************************************************
|
||||
#define ECAT_SS_ECAT_GPIN_GRP_CAP_SEL_GPI_GRP_CAP_SEL0_S 0U
|
||||
#define ECAT_SS_ECAT_GPIN_GRP_CAP_SEL_GPI_GRP_CAP_SEL0_M 0x7U // GPI7-0 capture trigger select
|
||||
#define ECAT_SS_ECAT_GPIN_GRP_CAP_SEL_GPI_GRP_CAP_SEL1_S 4U
|
||||
#define ECAT_SS_ECAT_GPIN_GRP_CAP_SEL_GPI_GRP_CAP_SEL1_M 0x70U // GPI15-8 capture trigger
|
||||
// select
|
||||
#define ECAT_SS_ECAT_GPIN_GRP_CAP_SEL_GPI_GRP_CAP_SEL2_S 8U
|
||||
#define ECAT_SS_ECAT_GPIN_GRP_CAP_SEL_GPI_GRP_CAP_SEL2_M 0x700U // GPI23-16 capture trigger
|
||||
// select
|
||||
#define ECAT_SS_ECAT_GPIN_GRP_CAP_SEL_GPI_GRP_CAP_SEL3_S 12U
|
||||
#define ECAT_SS_ECAT_GPIN_GRP_CAP_SEL_GPI_GRP_CAP_SEL3_M 0x7000U // GPI31-24 capture trigger
|
||||
// select
|
||||
|
||||
//*****************************************************************************
|
||||
//
|
||||
// The following are defines for the bit fields in the ECAT_GPOUT_GRP_CAP_SEL register
|
||||
//
|
||||
//*****************************************************************************
|
||||
#define ECAT_SS_ECAT_GPOUT_GRP_CAP_SEL_GPO_GRP_CAP_SEL0_S 0U
|
||||
#define ECAT_SS_ECAT_GPOUT_GRP_CAP_SEL_GPO_GRP_CAP_SEL0_M 0x3U // GPO7-0 capture trigger select
|
||||
#define ECAT_SS_ECAT_GPOUT_GRP_CAP_SEL_GPO_GRP_CAP_SEL1_S 4U
|
||||
#define ECAT_SS_ECAT_GPOUT_GRP_CAP_SEL_GPO_GRP_CAP_SEL1_M 0x30U // GPO15-8 capture trigger
|
||||
// select
|
||||
#define ECAT_SS_ECAT_GPOUT_GRP_CAP_SEL_GPO_GRP_CAP_SEL2_S 8U
|
||||
#define ECAT_SS_ECAT_GPOUT_GRP_CAP_SEL_GPO_GRP_CAP_SEL2_M 0x300U // GPO23-16 capture trigger
|
||||
// select
|
||||
#define ECAT_SS_ECAT_GPOUT_GRP_CAP_SEL_GPO_GRP_CAP_SEL3_S 12U
|
||||
#define ECAT_SS_ECAT_GPOUT_GRP_CAP_SEL_GPO_GRP_CAP_SEL3_M 0x3000U // GPO31-24 capture trigger
|
||||
// select
|
||||
|
||||
//*****************************************************************************
|
||||
//
|
||||
// The following are defines for the bit fields in the ECAT_MEM_TEST register
|
||||
//
|
||||
//*****************************************************************************
|
||||
#define ECAT_SS_ECAT_MEM_TEST_INITIATE_MEM_INIT 0x1U // Initialize memory init
|
||||
#define ECAT_SS_ECAT_MEM_TEST_MEM_INIT_DONE 0x2U // Memory Init done status
|
||||
|
||||
//*****************************************************************************
|
||||
//
|
||||
// The following are defines for the bit fields in the ECAT_RESET_DEST_CONFIG register
|
||||
//
|
||||
//*****************************************************************************
|
||||
#define ECAT_SS_ECAT_RESET_DEST_CONFIG_CPU_RESET_EN 0x1U // CPU reset enable for ResetOut
|
||||
#define ECAT_SS_ECAT_RESET_DEST_CONFIG_CPU_NMI_EN 0x2U // CPU NMI enable for ResetOut
|
||||
#define ECAT_SS_ECAT_RESET_DEST_CONFIG_CPU_INT_EN 0x4U // CPU Interrupt enable for
|
||||
// ResetOut
|
||||
#define ECAT_SS_ECAT_RESET_DEST_CONFIG_DEVICE_RESET_EN 0x80U // Enables RESET_OUT to impact
|
||||
// the device reset
|
||||
#define ECAT_SS_ECAT_RESET_DEST_CONFIG_WRITE_KEY_S 8U
|
||||
#define ECAT_SS_ECAT_RESET_DEST_CONFIG_WRITE_KEY_M 0xFF00U // Key to enable writing lock
|
||||
|
||||
//*****************************************************************************
|
||||
//
|
||||
// The following are defines for the bit fields in the ECAT_SYNC0_CONFIG register
|
||||
//
|
||||
//*****************************************************************************
|
||||
#define ECAT_SS_ECAT_SYNC0_CONFIG_C28X_PIE_EN 0x1U // Connects the SYNC0 to C28x
|
||||
// PIE Interrupt
|
||||
#define ECAT_SS_ECAT_SYNC0_CONFIG_CLA_INT_EN 0x2U // Connects the SYNC0 to CLA
|
||||
// Interrupt
|
||||
#define ECAT_SS_ECAT_SYNC0_CONFIG_C28X_DMA_EN 0x4U // Connects the SYNC0 to C28x
|
||||
// DMA Trigger
|
||||
#define ECAT_SS_ECAT_SYNC0_CONFIG_CM4_NVIC_EN 0x8U // Connects the SYNC0 to CM4
|
||||
// NVIC Interrupt
|
||||
#define ECAT_SS_ECAT_SYNC0_CONFIG_UDMA_TRIG_EN 0x10U // Connects the SYNC0 to uDMA
|
||||
// Trigger
|
||||
#define ECAT_SS_ECAT_SYNC0_CONFIG_WRITE_KEY_S 8U
|
||||
#define ECAT_SS_ECAT_SYNC0_CONFIG_WRITE_KEY_M 0xFF00U // Key to enable writing lock
|
||||
|
||||
//*****************************************************************************
|
||||
//
|
||||
// The following are defines for the bit fields in the ECAT_SYNC1_CONFIG register
|
||||
//
|
||||
//*****************************************************************************
|
||||
#define ECAT_SS_ECAT_SYNC1_CONFIG_C28X_PIE_EN 0x1U // Connects the SYNC1 to C28x
|
||||
// PIE Interrupt
|
||||
#define ECAT_SS_ECAT_SYNC1_CONFIG_CLA_INT_EN 0x2U // Connects the SYNC1 to CLA
|
||||
// Interrupt
|
||||
#define ECAT_SS_ECAT_SYNC1_CONFIG_C28X_DMA_EN 0x4U // Connects the SYNC1 to C28x
|
||||
// DMA Trigger
|
||||
#define ECAT_SS_ECAT_SYNC1_CONFIG_CM4_NVIC_EN 0x8U // Connects the SYNC1 to CM4
|
||||
// NVIC Interrupt
|
||||
#define ECAT_SS_ECAT_SYNC1_CONFIG_UDMA_TRIG_EN 0x10U // Connects the SYNC1 to uDMA
|
||||
// Trigger
|
||||
#define ECAT_SS_ECAT_SYNC1_CONFIG_WRITE_KEY_S 8U
|
||||
#define ECAT_SS_ECAT_SYNC1_CONFIG_WRITE_KEY_M 0xFF00U // Key to enable writing lock
|
||||
|
||||
//*****************************************************************************
|
||||
//
|
||||
// The following are defines for the bit fields in the ECAT_CONFIG_LOCK register
|
||||
//
|
||||
//*****************************************************************************
|
||||
#define ECAT_SS_ECAT_CONFIG_LOCK_LOCK_ENABLE 0x1U // Locking writes to ECATSS
|
||||
#define ECAT_SS_ECAT_CONFIG_LOCK_IO_CONFIG_ENABLE 0x10U // Locking the IO Configuration
|
||||
#define ECAT_SS_ECAT_CONFIG_LOCK_WRITE_KEY_S 8U
|
||||
#define ECAT_SS_ECAT_CONFIG_LOCK_WRITE_KEY_M 0xFF00U // Key to enable writing lock
|
||||
|
||||
//*****************************************************************************
|
||||
//
|
||||
// The following are defines for the bit fields in the ECAT_MISC_IO_CONFIG register
|
||||
//
|
||||
//*****************************************************************************
|
||||
#define ECAT_SS_ECAT_MISC_IO_CONFIG_RESETIN_GPIO_EN 0x1U // Enabled ResetIN from GPIO
|
||||
#define ECAT_SS_ECAT_MISC_IO_CONFIG_EEPROM_I2C_IO_EN 0x2U // Enables the EEPROM I2C IOPAD
|
||||
// connection
|
||||
#define ECAT_SS_ECAT_MISC_IO_CONFIG_WRITE_KEY_S 8U
|
||||
#define ECAT_SS_ECAT_MISC_IO_CONFIG_WRITE_KEY_M 0xFF00U // Key to enable writing lock
|
||||
|
||||
//*****************************************************************************
|
||||
//
|
||||
// The following are defines for the bit fields in the ECAT_PHY_IO_CONFIG register
|
||||
//
|
||||
//*****************************************************************************
|
||||
#define ECAT_SS_ECAT_PHY_IO_CONFIG_PHY_PORT_CNT_S 2U
|
||||
#define ECAT_SS_ECAT_PHY_IO_CONFIG_PHY_PORT_CNT_M 0xCU // Number of PHY port counts
|
||||
#define ECAT_SS_ECAT_PHY_IO_CONFIG_PHY_INTF_IOPAD_SEL_S 4U
|
||||
#define ECAT_SS_ECAT_PHY_IO_CONFIG_PHY_INTF_IOPAD_SEL_M 0x30U // IO Combination select for PHY
|
||||
// Interface
|
||||
#define ECAT_SS_ECAT_PHY_IO_CONFIG_TX_CLK_AUTO_COMP 0x40U // Selects TX_CLK IO to do Auto
|
||||
// compensation
|
||||
#define ECAT_SS_ECAT_PHY_IO_CONFIG_WRITE_KEY_S 8U
|
||||
#define ECAT_SS_ECAT_PHY_IO_CONFIG_WRITE_KEY_M 0xFF00U // Key to enable writing lock
|
||||
|
||||
//*****************************************************************************
|
||||
//
|
||||
// The following are defines for the bit fields in the ECAT_SYNC_IO_CONFIG register
|
||||
//
|
||||
//*****************************************************************************
|
||||
#define ECAT_SS_ECAT_SYNC_IO_CONFIG_SYNC0_IOPAD_SEL_S 0U
|
||||
#define ECAT_SS_ECAT_SYNC_IO_CONFIG_SYNC0_IOPAD_SEL_M 0x3U // SYNC0 IO PAD select option
|
||||
#define ECAT_SS_ECAT_SYNC_IO_CONFIG_SYNC0_GPIO_EN 0x8U // SYNC0 connection to OUT pad
|
||||
// enabled
|
||||
#define ECAT_SS_ECAT_SYNC_IO_CONFIG_SYNC1_IOPAD_SEL_S 4U
|
||||
#define ECAT_SS_ECAT_SYNC_IO_CONFIG_SYNC1_IOPAD_SEL_M 0x30U // SYNC1 IO PAD select option
|
||||
#define ECAT_SS_ECAT_SYNC_IO_CONFIG_SYNC1_GPIO_EN 0x80U // SYNC1 connection to OUT pad
|
||||
// enabled
|
||||
#define ECAT_SS_ECAT_SYNC_IO_CONFIG_WRITE_KEY_S 8U
|
||||
#define ECAT_SS_ECAT_SYNC_IO_CONFIG_WRITE_KEY_M 0xFF00U // Key to enable writing lock
|
||||
|
||||
//*****************************************************************************
|
||||
//
|
||||
// The following are defines for the bit fields in the ECAT_LATCH_IO_CONFIG register
|
||||
//
|
||||
//*****************************************************************************
|
||||
#define ECAT_SS_ECAT_LATCH_IO_CONFIG_LATCH0_IOPAD_SEL_S 0U
|
||||
#define ECAT_SS_ECAT_LATCH_IO_CONFIG_LATCH0_IOPAD_SEL_M 0x3U // LATCH0 IO PAD select option
|
||||
#define ECAT_SS_ECAT_LATCH_IO_CONFIG_LATCH0_GPIO_EN 0x8U // LATCH0 connection to IN pad
|
||||
// enabled
|
||||
#define ECAT_SS_ECAT_LATCH_IO_CONFIG_LATCH1_IOPAD_SEL_S 4U
|
||||
#define ECAT_SS_ECAT_LATCH_IO_CONFIG_LATCH1_IOPAD_SEL_M 0x30U // LATCH1 IO PAD select option
|
||||
#define ECAT_SS_ECAT_LATCH_IO_CONFIG_LATCH1_GPIO_EN 0x80U // LATCH1 connection to IN pad
|
||||
// enabled
|
||||
#define ECAT_SS_ECAT_LATCH_IO_CONFIG_WRITE_KEY_S 8U
|
||||
#define ECAT_SS_ECAT_LATCH_IO_CONFIG_WRITE_KEY_M 0xFF00U // Key to enable writing lock
|
||||
|
||||
//*****************************************************************************
|
||||
//
|
||||
// The following are defines for the bit fields in the ECAT_LED_CONFIG register
|
||||
//
|
||||
//*****************************************************************************
|
||||
#define ECAT_SS_ECAT_LED_CONFIG_LINKACT0 0x1U // GPIO enable for LINKACT0 LED
|
||||
#define ECAT_SS_ECAT_LED_CONFIG_LINKACT1 0x2U // GPIO enable for LINKACT1 LED
|
||||
#define ECAT_SS_ECAT_LED_CONFIG_STATE 0x4U // GPIO enable for STATE LED
|
||||
#define ECAT_SS_ECAT_LED_CONFIG_ERR 0x8U // GPIO enable for ERR LED
|
||||
#define ECAT_SS_ECAT_LED_CONFIG_RUN 0x10U // GPIO enable for RUN LED
|
||||
#define ECAT_SS_ECAT_LED_CONFIG_LINKACT0_IOPAD_SEL_S 6U
|
||||
#define ECAT_SS_ECAT_LED_CONFIG_LINKACT0_IOPAD_SEL_M 0xC0U // LINKACT0 LED IO PAD select
|
||||
#define ECAT_SS_ECAT_LED_CONFIG_LINKACT1_IOPAD_SEL_S 8U
|
||||
#define ECAT_SS_ECAT_LED_CONFIG_LINKACT1_IOPAD_SEL_M 0x300U // LINKACT1 LED IO PAD select
|
||||
#define ECAT_SS_ECAT_LED_CONFIG_STATE_IOPAD_SEL_S 10U
|
||||
#define ECAT_SS_ECAT_LED_CONFIG_STATE_IOPAD_SEL_M 0xC00U // STATE LED IO PAD select
|
||||
#define ECAT_SS_ECAT_LED_CONFIG_ERR_IOPAD_SEL_S 12U
|
||||
#define ECAT_SS_ECAT_LED_CONFIG_ERR_IOPAD_SEL_M 0x3000U // ERROR LED IO PAD select
|
||||
#define ECAT_SS_ECAT_LED_CONFIG_RUN_IOPAD_SEL_S 14U
|
||||
#define ECAT_SS_ECAT_LED_CONFIG_RUN_IOPAD_SEL_M 0xC000U // RUN LED IO PAD select
|
||||
|
||||
//*****************************************************************************
|
||||
//
|
||||
// The following are defines for the bit fields in the ECAT_MISC_CONFIG register
|
||||
//
|
||||
//*****************************************************************************
|
||||
#define ECAT_SS_ECAT_MISC_CONFIG_TX0_SHIFT_CONFIG_S 0U
|
||||
#define ECAT_SS_ECAT_MISC_CONFIG_TX0_SHIFT_CONFIG_M 0x3U // TX Shift configuration for
|
||||
// Port0
|
||||
#define ECAT_SS_ECAT_MISC_CONFIG_TX1_SHIFT_CONFIG_S 2U
|
||||
#define ECAT_SS_ECAT_MISC_CONFIG_TX1_SHIFT_CONFIG_M 0xCU // TX Shift configuration for
|
||||
// Port1
|
||||
#define ECAT_SS_ECAT_MISC_CONFIG_EEPROM_SIZE 0x10U // EEPROM Size bound select
|
||||
#define ECAT_SS_ECAT_MISC_CONFIG_PDI_EMULATION 0x20U // PDI Emulation enable
|
||||
#define ECAT_SS_ECAT_MISC_CONFIG_PHY_ADDR_S 6U
|
||||
#define ECAT_SS_ECAT_MISC_CONFIG_PHY_ADDR_M 0x7C0U // PHY Address Offset
|
||||
#endif
|
||||
+2463
File diff suppressed because it is too large.
Load diff
+164
@@ -0,0 +1,164 @@
|
||||
//###########################################################################
|
||||
//
|
||||
// FILE: emac_ss_hw.h
|
||||
//
|
||||
// TITLE: Definitions for the EMAC_SS registers.
|
||||
//
|
||||
//###########################################################################
|
||||
// $TI Release: $
|
||||
// $Release Date: $
|
||||
//
|
||||
// C2000Ware v5.04.00.00
|
||||
//
|
||||
// Copyright (C) 2024 Texas Instruments Incorporated - http://www.ti.com
|
||||
//
|
||||
// Redistribution and use in source and binary forms, with or without
|
||||
// modification, are permitted provided that the following conditions
|
||||
// are met:
|
||||
//
|
||||
// Redistributions of source code must retain the above copyright
|
||||
// notice, this list of conditions and the following disclaimer.
|
||||
//
|
||||
// Redistributions in binary form must reproduce the above copyright
|
||||
// notice, this list of conditions and the following disclaimer in the
|
||||
// documentation and/or other materials provided with the
|
||||
// distribution.
|
||||
//
|
||||
// Neither the name of Texas Instruments Incorporated nor the names of
|
||||
// its contributors may be used to endorse or promote products derived
|
||||
// from this software without specific prior written permission.
|
||||
//
|
||||
// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
|
||||
// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
|
||||
// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
|
||||
// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
|
||||
// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
|
||||
// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
|
||||
// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
|
||||
// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
|
||||
// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
||||
// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
|
||||
// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
// $
|
||||
//###########################################################################
|
||||
|
||||
#ifndef EMAC_SS_HW_H
|
||||
#define EMAC_SS_HW_H
|
||||
|
||||
//*****************************************************************************
|
||||
//
|
||||
// The following are defines for the EMAC_SS register offsets
|
||||
//
|
||||
//*****************************************************************************
|
||||
#define ETHERNETSS_O_IPREVNUM 0x0U // IP Revision Number
|
||||
#define ETHERNETSS_O_CTRLSTS 0x4U // Control Register
|
||||
#define ETHERNETSS_O_PTPTSTRIGSEL0 0x8U // PTP Trigger-0 select
|
||||
#define ETHERNETSS_O_PTPTSTRIGSEL1 0xCU // PTP Trigger-1 select
|
||||
#define ETHERNETSS_O_PTPTSSWTRIG0 0x10U // PTP SW Trigger-0
|
||||
#define ETHERNETSS_O_PTPTSSWTRIG1 0x14U // PTP SW Trigger-1
|
||||
#define ETHERNETSS_O_PTPPPSR0 0x18U // PTP PPS-0 Read
|
||||
#define ETHERNETSS_O_PTPPPSR1 0x1CU // PTP PPS-1 Read
|
||||
#define ETHERNETSS_O_PTP_TSRL 0x20U // PTP timestamp read lower 32
|
||||
// bits
|
||||
#define ETHERNETSS_O_PTP_TSRH 0x24U // PTP timestamp read upper 32
|
||||
// bits
|
||||
#define ETHERNETSS_O_PTP_TSWL 0x28U // External Timestamp write
|
||||
// lower 32 bits
|
||||
#define ETHERNETSS_O_PTP_TSWH 0x2CU // External Timestamp write
|
||||
// upper 32 bits
|
||||
#define ETHERNETSS_O_REVMII_CTRL 0x30U // RevMII Phy Address controls
|
||||
|
||||
//*****************************************************************************
|
||||
//
|
||||
// The following are defines for the bit fields in the EMACSS_IPREVNUM register
|
||||
//
|
||||
//*****************************************************************************
|
||||
#define ETHERNETSS_IPREVNUM_IP_REV_MINOR_S 0U
|
||||
#define ETHERNETSS_IPREVNUM_IP_REV_MINOR_M 0xFU // Minor IP Revision Number
|
||||
#define ETHERNETSS_IPREVNUM_IP_REV_MAJOR_S 4U
|
||||
#define ETHERNETSS_IPREVNUM_IP_REV_MAJOR_M 0xF0U // Major IP Revision Number
|
||||
|
||||
//*****************************************************************************
|
||||
//
|
||||
// The following are defines for the bit fields in the EMACSS_CTRLSTS register
|
||||
//
|
||||
//*****************************************************************************
|
||||
#define ETHERNETSS_CTRLSTS_PHY_INTF_SEL_S 0U
|
||||
#define ETHERNETSS_CTRLSTS_PHY_INTF_SEL_M 0x7U // PHY Type Selection
|
||||
#define ETHERNETSS_CTRLSTS_CLK_LM 0x10U // MII Loop-back mode clock
|
||||
// select
|
||||
#define ETHERNETSS_CTRLSTS_CLK_SRC_SEL 0x80U // Internal Clock Selection
|
||||
#define ETHERNETSS_CTRLSTS_FLOW_CTRL_EN_S 8U
|
||||
#define ETHERNETSS_CTRLSTS_FLOW_CTRL_EN_M 0x300U // Back-pressure enable per
|
||||
// receive queue.
|
||||
#define ETHERNETSS_CTRLSTS_WRITE_KEY_S 16U
|
||||
#define ETHERNETSS_CTRLSTS_WRITE_KEY_M 0xFF0000U // Key to enable writing lock
|
||||
|
||||
//*****************************************************************************
|
||||
//
|
||||
// The following are defines for the bit fields in the EMACSS_PTPTSTRIGSEL0 register
|
||||
//
|
||||
//*****************************************************************************
|
||||
#define ETHERNETSS_PTPTSTRIGSEL0_PTP_AUX_TS_TRIG_SEL0_S 0U
|
||||
#define ETHERNETSS_PTPTSTRIGSEL0_PTP_AUX_TS_TRIG_SEL0_M 0x1FU // Trigger select for Auxillary
|
||||
// TS capture - 0
|
||||
#define ETHERNETSS_PTPTSTRIGSEL0_WRITE_KEY_S 16U
|
||||
#define ETHERNETSS_PTPTSTRIGSEL0_WRITE_KEY_M 0xFF0000U // Key to enable writing lock
|
||||
|
||||
//*****************************************************************************
|
||||
//
|
||||
// The following are defines for the bit fields in the EMACSS_PTPTSTRIGSEL1 register
|
||||
//
|
||||
//*****************************************************************************
|
||||
#define ETHERNETSS_PTPTSTRIGSEL1_PTP_AUX_TS_TRIG_SEL1_S 0U
|
||||
#define ETHERNETSS_PTPTSTRIGSEL1_PTP_AUX_TS_TRIG_SEL1_M 0x1FU // Trigger select for Auxillary
|
||||
// TS capture - 1
|
||||
#define ETHERNETSS_PTPTSTRIGSEL1_WRITE_KEY_S 16U
|
||||
#define ETHERNETSS_PTPTSTRIGSEL1_WRITE_KEY_M 0xFF0000U // Key to enable writing lock
|
||||
|
||||
//*****************************************************************************
|
||||
//
|
||||
// The following are defines for the bit fields in the EMACSS_PTPTSSWTRIG0 register
|
||||
//
|
||||
//*****************************************************************************
|
||||
#define ETHERNETSS_PTPTSSWTRIG0_PTP_AUX_TS_SW_TRIG0 0x1U // SW trigger for AUX TS capture
|
||||
// for trigger-0
|
||||
|
||||
//*****************************************************************************
|
||||
//
|
||||
// The following are defines for the bit fields in the EMACSS_PTPTSSWTRIG1 register
|
||||
//
|
||||
//*****************************************************************************
|
||||
#define ETHERNETSS_PTPTSSWTRIG1_PTP_AUX_TS_SW_TRIG1 0x1U // SW trigger for AUX TS capture
|
||||
// for trigger-1
|
||||
|
||||
//*****************************************************************************
|
||||
//
|
||||
// The following are defines for the bit fields in the EMACSS_PTPPPSR0 register
|
||||
//
|
||||
//*****************************************************************************
|
||||
#define ETHERNETSS_PTPPPSR0_PTP_PPS_R0 0x1U // Registered value of Pulse Per
|
||||
// Second-0
|
||||
|
||||
//*****************************************************************************
|
||||
//
|
||||
// The following are defines for the bit fields in the EMACSS_PTPPPSR1 register
|
||||
//
|
||||
//*****************************************************************************
|
||||
#define ETHERNETSS_PTPPPSR1_PTP_PPS_R1 0x1U // Registered value of Pulse Per
|
||||
// Second-1
|
||||
|
||||
//*****************************************************************************
|
||||
//
|
||||
// The following are defines for the bit fields in the EMACSS_REVMII_CTRL register
|
||||
//
|
||||
//*****************************************************************************
|
||||
#define ETHERNETSS_REVMII_CTRL_REVMII_CORE_PHY_ADDR_S 0U
|
||||
#define ETHERNETSS_REVMII_CTRL_REVMII_CORE_PHY_ADDR_M 0x1FU // RevMII Core Register Space
|
||||
// offset
|
||||
#define ETHERNETSS_REVMII_CTRL_REVMII_REMOTE_PHY_ADDR_S 8U
|
||||
#define ETHERNETSS_REVMII_CTRL_REVMII_REMOTE_PHY_ADDR_M 0x1F00U // RevMII Remote Register Space
|
||||
// offset
|
||||
#define ETHERNETSS_REVMII_CTRL_WRITE_KEY_S 16U
|
||||
#define ETHERNETSS_REVMII_CTRL_WRITE_KEY_M 0xFF0000U // Key to enable writing lock
|
||||
#endif
|
||||
+372
@@ -0,0 +1,372 @@
|
||||
//###########################################################################
|
||||
//
|
||||
// FILE: hw_flash.h
|
||||
//
|
||||
// TITLE: Definitions for the FLASH registers.
|
||||
//
|
||||
//###########################################################################
|
||||
// $TI Release: $
|
||||
// $Release Date: $
|
||||
//
|
||||
// C2000Ware v5.04.00.00
|
||||
//
|
||||
// Copyright (C) 2024 Texas Instruments Incorporated - http://www.ti.com
|
||||
//
|
||||
// Redistribution and use in source and binary forms, with or without
|
||||
// modification, are permitted provided that the following conditions
|
||||
// are met:
|
||||
//
|
||||
// Redistributions of source code must retain the above copyright
|
||||
// notice, this list of conditions and the following disclaimer.
|
||||
//
|
||||
// Redistributions in binary form must reproduce the above copyright
|
||||
// notice, this list of conditions and the following disclaimer in the
|
||||
// documentation and/or other materials provided with the
|
||||
// distribution.
|
||||
//
|
||||
// Neither the name of Texas Instruments Incorporated nor the names of
|
||||
// its contributors may be used to endorse or promote products derived
|
||||
// from this software without specific prior written permission.
|
||||
//
|
||||
// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
|
||||
// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
|
||||
// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
|
||||
// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
|
||||
// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
|
||||
// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
|
||||
// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
|
||||
// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
|
||||
// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
||||
// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
|
||||
// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
// $
|
||||
//###########################################################################
|
||||
|
||||
#ifndef HW_FLASH_H
|
||||
#define HW_FLASH_H
|
||||
|
||||
//*****************************************************************************
|
||||
//
|
||||
// The following are defines for the FLASH register offsets
|
||||
//
|
||||
//*****************************************************************************
|
||||
#define FLASH_O_FRDCNTL 0x0U // Flash Read Control Register
|
||||
#define FLASH_O_FSPRD 0x4U // Flash Read Margin Control
|
||||
// Register
|
||||
#define FLASH_O_FEDACSTATUS 0x1CU // Flash Error Status Register
|
||||
#define FLASH_O_FBBUSY 0x38U // Bank Busy Register
|
||||
#define FLASH_O_FBAC 0x3CU // Flash Bank Access Control
|
||||
// Register
|
||||
#define FLASH_O_FBFALLBACK 0x40U // Flash Bank Fallback Power
|
||||
// Register
|
||||
#define FLASH_O_FBPRDY 0x44U // Flash Bank Pump Ready
|
||||
// Register
|
||||
#define FLASH_O_FPAC1 0x48U // Flash Pump Access Control
|
||||
// Register 1
|
||||
#define FLASH_O_FPAC2 0x4CU // Flash Pump Access Control
|
||||
// Register 2
|
||||
#define FLASH_O_FMSTAT 0x54U // Flash Module Status Register
|
||||
#define FLASH_O_FEMU_DMSW 0x58U // EEPROM Emulation Data MSW
|
||||
// Register
|
||||
#define FLASH_O_FEMU_DLSW 0x5CU // EEPROM Emulation Data LSW
|
||||
// Register
|
||||
#define FLASH_O_FEMU_ECC 0x60U // EEPROM Emulation ECC Register
|
||||
#define FLASH_O_FLOCK 0x64U // Flash Lock Register
|
||||
#define FLASH_O_FEMU_ADDR 0x68U // EEPROM Emulation Address
|
||||
#define FLASH_O_FRD_INTF_CTRL_LOCK 0x2FCU // Lock register for
|
||||
// FLASH_CTRL_REGS (Not including
|
||||
// FRD_INTF_CTRL_LOCK ).
|
||||
#define FLASH_O_FRD_INTF_CTRL 0x300U // Flash Read Interface Control
|
||||
// Register
|
||||
#define FLASH_O_ECC_ENABLE 0x0U // ECC Enable
|
||||
#define FLASH_O_SINGLE_ERR_ADDR_LOW 0x4U // Single Error Address Low
|
||||
#define FLASH_O_SINGLE_ERR_ADDR_HIGH 0x8U // Single Error Address High
|
||||
#define FLASH_O_UNC_ERR_ADDR_LOW 0xCU // Uncorrectable Error Address
|
||||
// Low
|
||||
#define FLASH_O_UNC_ERR_ADDR_HIGH 0x10U // Uncorrectable Error Address
|
||||
// High
|
||||
#define FLASH_O_ERR_STATUS 0x14U // Error Status
|
||||
#define FLASH_O_ERR_POS 0x18U // Error Position
|
||||
#define FLASH_O_ERR_STATUS_CLR 0x1CU // Error Status Clear
|
||||
#define FLASH_O_ERR_CNT 0x20U // Error Control
|
||||
#define FLASH_O_ERR_THRESHOLD 0x24U // Error Threshold
|
||||
#define FLASH_O_ERR_INTFLG 0x28U // Error Interrupt Flag
|
||||
#define FLASH_O_ERR_INTCLR 0x2CU // Error Interrupt Flag Clear
|
||||
#define FLASH_O_FDATAH_TEST 0x30U // Data High Test
|
||||
#define FLASH_O_FDATAL_TEST 0x34U // Data Low Test
|
||||
#define FLASH_O_FADDR_TEST 0x38U // ECC Test Address
|
||||
#define FLASH_O_FECC_TEST 0x3CU // ECC Test Address
|
||||
#define FLASH_O_FECC_CTRL 0x40U // ECC Control
|
||||
#define FLASH_O_FOUTH_TEST 0x44U // Test Data Out High
|
||||
#define FLASH_O_FOUTL_TEST 0x48U // Test Data Out Low
|
||||
#define FLASH_O_FECC_STATUS 0x4CU // ECC Status
|
||||
#define FLASH_O_ECC_REGS_LOCK 0x7CU // Lock register for
|
||||
// FLASH_ECC_REGS (Not including
|
||||
// FLASH_ECC_REGS_LOCK ).
|
||||
|
||||
//*****************************************************************************
|
||||
//
|
||||
// The following are defines for the bit fields in the FRDCNTL register
|
||||
//
|
||||
//*****************************************************************************
|
||||
#define FLASH_FRDCNTL_RWAIT_S 8U
|
||||
#define FLASH_FRDCNTL_RWAIT_M 0xF00U // Random Read Waitstate
|
||||
|
||||
//*****************************************************************************
|
||||
//
|
||||
// The following are defines for the bit fields in the FSPRD register
|
||||
//
|
||||
//*****************************************************************************
|
||||
#define FLASH_FSPRD_RM0 0x1U // ReadMargin0 Configuration
|
||||
#define FLASH_FSPRD_RM1 0x2U // Readmargin1 Configuration
|
||||
|
||||
//*****************************************************************************
|
||||
//
|
||||
// The following are defines for the bit fields in the FEDACSTATUS register
|
||||
//
|
||||
//*****************************************************************************
|
||||
#define FLASH_FEDACSTATUS_FSM_DONE 0x1000000U // FSM_DONE : FSM is finished
|
||||
#define FLASH_FEDACSTATUS_RVF_EVT 0x2000000U // FSM command Read_verify
|
||||
// failed error event
|
||||
|
||||
//*****************************************************************************
|
||||
//
|
||||
// The following are defines for the bit fields in the FBBUSY register
|
||||
//
|
||||
//*****************************************************************************
|
||||
#define FLASH_FBBUSY_BUSY 0x1U // Bank Busy
|
||||
|
||||
//*****************************************************************************
|
||||
//
|
||||
// The following are defines for the bit fields in the FBAC register
|
||||
//
|
||||
//*****************************************************************************
|
||||
#define FLASH_FBAC_VREADST_S 0U
|
||||
#define FLASH_FBAC_VREADST_M 0xFFU // VREAD Setup Time Count
|
||||
#define FLASH_FBAC_BAGP_S 8U
|
||||
#define FLASH_FBAC_BAGP_M 0xFF00U // Bank Active Grace Period
|
||||
|
||||
//*****************************************************************************
|
||||
//
|
||||
// The following are defines for the bit fields in the FBFALLBACK register
|
||||
//
|
||||
//*****************************************************************************
|
||||
#define FLASH_FBFALLBACK_BNKPWR0_S 0U
|
||||
#define FLASH_FBFALLBACK_BNKPWR0_M 0x3U // Bank Power Mode of BANK0
|
||||
|
||||
//*****************************************************************************
|
||||
//
|
||||
// The following are defines for the bit fields in the FBPRDY register
|
||||
//
|
||||
//*****************************************************************************
|
||||
#define FLASH_FBPRDY_BANKRDY 0x1U // Flash Bank Active Power State
|
||||
#define FLASH_FBPRDY_PUMPRDY 0x8000U // Flash Pump Active Power Mode
|
||||
|
||||
//*****************************************************************************
|
||||
//
|
||||
// The following are defines for the bit fields in the FPAC1 register
|
||||
//
|
||||
//*****************************************************************************
|
||||
#define FLASH_FPAC1_PMPPWR 0x1U // Charge Pump Fallback Power
|
||||
// Mode
|
||||
#define FLASH_FPAC1_PSLEEP_S 16U
|
||||
#define FLASH_FPAC1_PSLEEP_M 0xFFF0000U // Pump Sleep Down Count
|
||||
|
||||
//*****************************************************************************
|
||||
//
|
||||
// The following are defines for the bit fields in the FPAC2 register
|
||||
//
|
||||
//*****************************************************************************
|
||||
#define FLASH_FPAC2_PAGP_S 0U
|
||||
#define FLASH_FPAC2_PAGP_M 0xFFFFU // Pump Active Grace Period
|
||||
|
||||
//*****************************************************************************
|
||||
//
|
||||
// The following are defines for the bit fields in the FMSTAT register
|
||||
//
|
||||
//*****************************************************************************
|
||||
#define FLASH_FMSTAT_SLOCK 0x1U // Sector Lock Status.
|
||||
#define FLASH_FMSTAT_PSUSP 0x2U // Program Suspend.
|
||||
#define FLASH_FMSTAT_ESUSP 0x4U // Erase Suspend.
|
||||
#define FLASH_FMSTAT_VOLTSTAT 0x8U // Core Voltage Status.
|
||||
#define FLASH_FMSTAT_CSTAT 0x10U // Command Status.
|
||||
#define FLASH_FMSTAT_INVDAT 0x20U // Invalid Data.
|
||||
#define FLASH_FMSTAT_PGM 0x40U // Program Active.
|
||||
#define FLASH_FMSTAT_ERS 0x80U // Erase Active.
|
||||
#define FLASH_FMSTAT_BUSY 0x100U // Busy Bit.
|
||||
#define FLASH_FMSTAT_CV 0x200U // Compact Verify
|
||||
#define FLASH_FMSTAT_EV 0x400U // Erase verify
|
||||
#define FLASH_FMSTAT_PCV 0x800U // Precondition verify
|
||||
#define FLASH_FMSTAT_PGV 0x1000U // Program verify
|
||||
#define FLASH_FMSTAT_DBF 0x2000U // Disturbance Test Fail
|
||||
#define FLASH_FMSTAT_ILA 0x4000U // Illegal Address
|
||||
#define FLASH_FMSTAT_RVF 0x8000U // Read Verify Failure
|
||||
#define FLASH_FMSTAT_RDVER 0x10000U // Read verify command currently
|
||||
// underway.
|
||||
#define FLASH_FMSTAT_RVSUSP 0x20000U // Read Verify Suspend.
|
||||
|
||||
//*****************************************************************************
|
||||
//
|
||||
// The following are defines for the bit fields in the FEMU_ECC register
|
||||
//
|
||||
//*****************************************************************************
|
||||
#define FLASH_FEMU_ECC_EMU_ECC_S 0U
|
||||
#define FLASH_FEMU_ECC_EMU_ECC_M 0xFFU // EEPROM Emulation ECC Register
|
||||
|
||||
//*****************************************************************************
|
||||
//
|
||||
// The following are defines for the bit fields in the FLOCK register
|
||||
//
|
||||
//*****************************************************************************
|
||||
#define FLASH_FLOCK_ENCOM_S 16U
|
||||
#define FLASH_FLOCK_ENCOM_M 0xFFFF0000U // Enable Command Registers
|
||||
|
||||
//*****************************************************************************
|
||||
//
|
||||
// The following are defines for the bit fields in the FEMU_ADDR register
|
||||
//
|
||||
//*****************************************************************************
|
||||
#define FLASH_FEMU_ADDR_EMU_ADDR_S 3U
|
||||
#define FLASH_FEMU_ADDR_EMU_ADDR_M 0x3FFFF8U // EEPROM Emulation Address
|
||||
|
||||
//*****************************************************************************
|
||||
//
|
||||
// The following are defines for the bit fields in the FRD_INTF_CTRL register
|
||||
//
|
||||
//*****************************************************************************
|
||||
#define FLASH_FRD_INTF_CTRL_PROG_CACHE_EN 0x1U // Program Cache Enable
|
||||
#define FLASH_FRD_INTF_CTRL_DATA_CACHE_EN 0x2U // Data Cache Enable
|
||||
|
||||
//*****************************************************************************
|
||||
//
|
||||
// The following are defines for the bit fields in the ECC_ENABLE register
|
||||
//
|
||||
//*****************************************************************************
|
||||
#define FLASH_ECC_ENABLE_ENABLE_S 0U
|
||||
#define FLASH_ECC_ENABLE_ENABLE_M 0xFU // Enable ECC
|
||||
|
||||
//*****************************************************************************
|
||||
//
|
||||
// The following are defines for the bit fields in the ERR_STATUS register
|
||||
//
|
||||
//*****************************************************************************
|
||||
#define FLASH_ERR_STATUS_FAIL_0_L 0x1U // Lower 64bits Single Bit Error
|
||||
// Corrected Value 0
|
||||
#define FLASH_ERR_STATUS_FAIL_1_L 0x2U // Lower 64bits Single Bit Error
|
||||
// Corrected Value 1
|
||||
#define FLASH_ERR_STATUS_UNC_ERR_L 0x4U // Lower 64 bits Uncorrectable
|
||||
// error occurred
|
||||
#define FLASH_ERR_STATUS_FAIL_0_H 0x10000U // Upper 64bits Single Bit Error
|
||||
// Corrected Value 0
|
||||
#define FLASH_ERR_STATUS_FAIL_1_H 0x20000U // Upper 64bits Single Bit Error
|
||||
// Corrected Value 1
|
||||
#define FLASH_ERR_STATUS_UNC_ERR_H 0x40000U // Upper 64 bits Uncorrectable
|
||||
// error occurred
|
||||
|
||||
//*****************************************************************************
|
||||
//
|
||||
// The following are defines for the bit fields in the ERR_POS register
|
||||
//
|
||||
//*****************************************************************************
|
||||
#define FLASH_ERR_POS_ERR_POS_L_S 0U
|
||||
#define FLASH_ERR_POS_ERR_POS_L_M 0x3FU // Bit Position of Single bit
|
||||
// Error in lower 64 bits
|
||||
#define FLASH_ERR_POS_ERR_TYPE_L 0x100U // Error Type in lower 64 bits
|
||||
#define FLASH_ERR_POS_ERR_POS_H_S 16U
|
||||
#define FLASH_ERR_POS_ERR_POS_H_M 0x3F0000U // Bit Position of Single bit
|
||||
// Error in upper 64 bits
|
||||
#define FLASH_ERR_POS_ERR_TYPE_H 0x1000000U // Error Type in upper 64 bits
|
||||
|
||||
//*****************************************************************************
|
||||
//
|
||||
// The following are defines for the bit fields in the ERR_STATUS_CLR register
|
||||
//
|
||||
//*****************************************************************************
|
||||
#define FLASH_ERR_STATUS_CLR_FAIL_0_L_CLR 0x1U // Lower 64bits Single Bit Error
|
||||
// Corrected Value 0 Clear
|
||||
#define FLASH_ERR_STATUS_CLR_FAIL_1_L_CLR 0x2U // Lower 64bits Single Bit Error
|
||||
// Corrected Value 1 Clear
|
||||
#define FLASH_ERR_STATUS_CLR_UNC_ERR_L_CLR 0x4U // Lower 64 bits Uncorrectable
|
||||
// error occurred Clear
|
||||
#define FLASH_ERR_STATUS_CLR_FAIL_0_H_CLR 0x10000U // Upper 64bits Single Bit Error
|
||||
// Corrected Value 0 Clear
|
||||
#define FLASH_ERR_STATUS_CLR_FAIL_1_H_CLR 0x20000U // Upper 64bits Single Bit Error
|
||||
// Corrected Value 1 Clear
|
||||
#define FLASH_ERR_STATUS_CLR_UNC_ERR_H_CLR 0x40000U // Upper 64 bits Uncorrectable
|
||||
// error occurred Clear
|
||||
|
||||
//*****************************************************************************
|
||||
//
|
||||
// The following are defines for the bit fields in the ERR_CNT register
|
||||
//
|
||||
//*****************************************************************************
|
||||
#define FLASH_ERR_CNT_ERR_CNT_S 0U
|
||||
#define FLASH_ERR_CNT_ERR_CNT_M 0xFFFFU // Error counter
|
||||
|
||||
//*****************************************************************************
|
||||
//
|
||||
// The following are defines for the bit fields in the ERR_THRESHOLD register
|
||||
//
|
||||
//*****************************************************************************
|
||||
#define FLASH_ERR_THRESHOLD_ERR_THRESHOLD_S 0U
|
||||
#define FLASH_ERR_THRESHOLD_ERR_THRESHOLD_M 0xFFFFU // Error Threshold
|
||||
|
||||
//*****************************************************************************
|
||||
//
|
||||
// The following are defines for the bit fields in the ERR_INTFLG register
|
||||
//
|
||||
//*****************************************************************************
|
||||
#define FLASH_ERR_INTFLG_SINGLE_ERR_INTFLG 0x1U // Single Error Interrupt Flag
|
||||
#define FLASH_ERR_INTFLG_UNC_ERR_INTFLG 0x2U // Uncorrectable Interrupt Flag
|
||||
|
||||
//*****************************************************************************
|
||||
//
|
||||
// The following are defines for the bit fields in the ERR_INTCLR register
|
||||
//
|
||||
//*****************************************************************************
|
||||
#define FLASH_ERR_INTCLR_SINGLE_ERR_INTCLR 0x1U // Single Error Interrupt Flag
|
||||
// Clear
|
||||
#define FLASH_ERR_INTCLR_UNC_ERR_INTCLR 0x2U // Uncorrectable Interrupt Flag
|
||||
// Clear
|
||||
|
||||
//*****************************************************************************
|
||||
//
|
||||
// The following are defines for the bit fields in the FADDR_TEST register
|
||||
//
|
||||
//*****************************************************************************
|
||||
#define FLASH_FADDR_TEST_ADDRL_S 3U
|
||||
#define FLASH_FADDR_TEST_ADDRL_M 0xFFF8U // ECC Address Low
|
||||
#define FLASH_FADDR_TEST_ADDRH_S 16U
|
||||
#define FLASH_FADDR_TEST_ADDRH_M 0x3F0000U // ECC Address High
|
||||
|
||||
//*****************************************************************************
|
||||
//
|
||||
// The following are defines for the bit fields in the FECC_TEST register
|
||||
//
|
||||
//*****************************************************************************
|
||||
#define FLASH_FECC_TEST_ECC_S 0U
|
||||
#define FLASH_FECC_TEST_ECC_M 0xFFU // ECC Control Bits
|
||||
|
||||
//*****************************************************************************
|
||||
//
|
||||
// The following are defines for the bit fields in the FECC_CTRL register
|
||||
//
|
||||
//*****************************************************************************
|
||||
#define FLASH_FECC_CTRL_ECC_TEST_EN 0x1U // Enable ECC Test Logic
|
||||
#define FLASH_FECC_CTRL_ECC_SELECT 0x2U // ECC Bit Select
|
||||
#define FLASH_FECC_CTRL_DO_ECC_CALC 0x4U // Enable ECC Calculation
|
||||
|
||||
//*****************************************************************************
|
||||
//
|
||||
// The following are defines for the bit fields in the FECC_STATUS register
|
||||
//
|
||||
//*****************************************************************************
|
||||
#define FLASH_FECC_STATUS_SINGLE_ERR 0x1U // Test Result is Single Bit
|
||||
// Error
|
||||
#define FLASH_FECC_STATUS_UNC_ERR 0x2U // Test Result is Uncorrectable
|
||||
// Error
|
||||
#define FLASH_FECC_STATUS_DATA_ERR_POS_S 2U
|
||||
#define FLASH_FECC_STATUS_DATA_ERR_POS_M 0xFCU // Holds Bit Position of Error
|
||||
#define FLASH_FECC_STATUS_ERR_TYPE 0x100U // Holds Bit Position of 8 Check
|
||||
// Bits of Error
|
||||
#endif
|
||||
+83
@@ -0,0 +1,83 @@
|
||||
//###########################################################################
|
||||
//
|
||||
// FILE: hw_gcrc.h
|
||||
//
|
||||
// TITLE: Definitions for the GCRC registers.
|
||||
//
|
||||
//###########################################################################
|
||||
// $TI Release: $
|
||||
// $Release Date: $
|
||||
//
|
||||
// C2000Ware v5.04.00.00
|
||||
//
|
||||
// Copyright (C) 2024 Texas Instruments Incorporated - http://www.ti.com
|
||||
//
|
||||
// Redistribution and use in source and binary forms, with or without
|
||||
// modification, are permitted provided that the following conditions
|
||||
// are met:
|
||||
//
|
||||
// Redistributions of source code must retain the above copyright
|
||||
// notice, this list of conditions and the following disclaimer.
|
||||
//
|
||||
// Redistributions in binary form must reproduce the above copyright
|
||||
// notice, this list of conditions and the following disclaimer in the
|
||||
// documentation and/or other materials provided with the
|
||||
// distribution.
|
||||
//
|
||||
// Neither the name of Texas Instruments Incorporated nor the names of
|
||||
// its contributors may be used to endorse or promote products derived
|
||||
// from this software without specific prior written permission.
|
||||
//
|
||||
// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
|
||||
// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
|
||||
// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
|
||||
// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
|
||||
// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
|
||||
// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
|
||||
// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
|
||||
// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
|
||||
// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
||||
// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
|
||||
// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
// $
|
||||
//###########################################################################
|
||||
|
||||
#ifndef HW_GCRC_H
|
||||
#define HW_GCRC_H
|
||||
|
||||
//*****************************************************************************
|
||||
//
|
||||
// The following are defines for the GCRC register offsets
|
||||
//
|
||||
//*****************************************************************************
|
||||
#define GCRC_O_CRCCTRL 0x0U // CRC control register
|
||||
#define GCRC_O_CRCPOLY 0x4U // CRC polynomial register
|
||||
#define GCRC_O_CRCDATAMASK 0x8U // CRC data mask register
|
||||
#define GCRC_O_CRCDATAIN 0xCU // CRC DATA input register
|
||||
#define GCRC_O_CRCDATAOUT 0x10U // CRC data output register
|
||||
#define GCRC_O_CRCDATATRANS 0x14U // CRC data transformed register
|
||||
|
||||
//*****************************************************************************
|
||||
//
|
||||
// The following are defines for the bit fields in the CRCCTRL register
|
||||
//
|
||||
//*****************************************************************************
|
||||
#define GCRC_CRCCTRL_POLYSIZE_S 0U
|
||||
#define GCRC_CRCCTRL_POLYSIZE_M 0x3FU // CRC polynomial order
|
||||
#define GCRC_CRCCTRL_ENDIANNESS 0x40U // Defines the endianness of the
|
||||
// data stream.
|
||||
#define GCRC_CRCCTRL_BITREVERSE 0x80U // Enables the DATAIN bus to the
|
||||
// CRC engine to be bit
|
||||
// reversed.
|
||||
#define GCRC_CRCCTRL_DATATYPE_S 8U
|
||||
#define GCRC_CRCCTRL_DATATYPE_M 0x300U // Defines the DATATYPE of the
|
||||
// element of the data array.
|
||||
|
||||
//*****************************************************************************
|
||||
//
|
||||
// The following are defines for the bit fields in the CRCDATAMASK register
|
||||
//
|
||||
//*****************************************************************************
|
||||
#define GCRC_CRCDATAMASK_DATAMASK_S 0U
|
||||
#define GCRC_CRCDATAMASK_DATAMASK_M 0x1FU // Number of bits to be masked
|
||||
#endif
|
||||
+495
@@ -0,0 +1,495 @@
|
||||
//###########################################################################
|
||||
//
|
||||
// FILE: hw_i2c.h
|
||||
//
|
||||
// TITLE: Definitions for the I2C registers.
|
||||
//
|
||||
//###########################################################################
|
||||
// $TI Release: $
|
||||
// $Release Date: $
|
||||
//
|
||||
// C2000Ware v5.04.00.00
|
||||
//
|
||||
// Copyright (C) 2024 Texas Instruments Incorporated - http://www.ti.com
|
||||
//
|
||||
// Redistribution and use in source and binary forms, with or without
|
||||
// modification, are permitted provided that the following conditions
|
||||
// are met:
|
||||
//
|
||||
// Redistributions of source code must retain the above copyright
|
||||
// notice, this list of conditions and the following disclaimer.
|
||||
//
|
||||
// Redistributions in binary form must reproduce the above copyright
|
||||
// notice, this list of conditions and the following disclaimer in the
|
||||
// documentation and/or other materials provided with the
|
||||
// distribution.
|
||||
//
|
||||
// Neither the name of Texas Instruments Incorporated nor the names of
|
||||
// its contributors may be used to endorse or promote products derived
|
||||
// from this software without specific prior written permission.
|
||||
//
|
||||
// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
|
||||
// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
|
||||
// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
|
||||
// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
|
||||
// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
|
||||
// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
|
||||
// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
|
||||
// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
|
||||
// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
||||
// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
|
||||
// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
// $
|
||||
//###########################################################################
|
||||
|
||||
#ifndef HW_I2C_H
|
||||
#define HW_I2C_H
|
||||
|
||||
//*****************************************************************************
|
||||
//
|
||||
// The following are defines for the I2C register offsets
|
||||
//
|
||||
//*****************************************************************************
|
||||
#define I2C_O_MSA 0x0U // I2C Master Slave Address
|
||||
#define I2C_O_MCS 0x4U // I2C Master Control/Status
|
||||
#define I2C_O_MDR 0x8U // I2C Master Data
|
||||
#define I2C_O_MTPR 0xCU // I2C Master Timer Period
|
||||
#define I2C_O_MIMR 0x10U // I2C Master Interrupt Mask
|
||||
#define I2C_O_MRIS 0x14U // I2C Master Raw Interrupt
|
||||
// Status
|
||||
#define I2C_O_MMIS 0x18U // I2C Master Masked Interrupt
|
||||
// Status
|
||||
#define I2C_O_MICR 0x1CU // I2C Master Interrupt Clear
|
||||
#define I2C_O_MCR 0x20U // I2C Master Configuration
|
||||
#define I2C_O_MCLKOCNT 0x24U // I2C Master Clock Low Timeout
|
||||
// Count
|
||||
#define I2C_O_MBMON 0x2CU // I2C Master Bus Monitor
|
||||
#define I2C_O_MBLEN 0x30U // I2C Master Burst Length
|
||||
#define I2C_O_MBCNT 0x34U // I2C Master Burst Count
|
||||
#define I2C_O_SOAR 0x800U // I2C Slave Own Address
|
||||
#define I2C_O_SCSR 0x804U // I2C Slave Control/Status
|
||||
#define I2C_O_SDR 0x808U // I2C Slave Data
|
||||
#define I2C_O_SIMR 0x80CU // I2C Slave Interrupt Mask
|
||||
#define I2C_O_SRIS 0x810U // I2C Slave Raw Interrupt
|
||||
// Status
|
||||
#define I2C_O_SMIS 0x814U // I2C Slave Masked Interrupt
|
||||
// Status
|
||||
#define I2C_O_SICR 0x818U // I2C Slave Interrupt Clear
|
||||
#define I2C_O_SOAR2 0x81CU // I2C Slave Own Address 2
|
||||
#define I2C_O_SACKCTL 0x820U // I2C Slave ACK Control
|
||||
#define I2C_O_FIFODATARX 0xF00U // I2C FIFO Data RX
|
||||
#define I2C_O_FIFOCTL 0xF04U // I2C FIFO Control
|
||||
#define I2C_O_FIFOSTATUS 0xF08U // I2C FIFO Status
|
||||
#define I2C_O_PP 0xFC0U // I2C Peripheral Properties
|
||||
#define I2C_O_PC 0xFC4U // I2C Peripheral Configuration
|
||||
#define I2C_O_MCS_WRITE 0x4U // I2C Master Control/Status
|
||||
#define I2C_O_SCSR_WRITE 0x804U // I2C Slave Control/Status
|
||||
#define I2C_O_FIFODATATX 0xF00U // I2C FIFO Data TX
|
||||
|
||||
//*****************************************************************************
|
||||
//
|
||||
// The following are defines for the bit fields in the I2CMSA register
|
||||
//
|
||||
//*****************************************************************************
|
||||
#define I2C_MSA_RS 0x1U // Receive/Send
|
||||
#define I2C_MSA_SA_S 1U
|
||||
#define I2C_MSA_SA_M 0xFEU // I2C Slave Address
|
||||
|
||||
//*****************************************************************************
|
||||
//
|
||||
// The following are defines for the bit fields in the I2CMCS register
|
||||
//
|
||||
//*****************************************************************************
|
||||
#define I2C_MCS_BUSY 0x1U // I2C Busy
|
||||
#define I2C_MCS_ERROR 0x2U // Error
|
||||
#define I2C_MCS_ADRACK 0x4U // Acknowledge Address
|
||||
#define I2C_MCS_DATACK 0x8U // Acknowledge Data
|
||||
#define I2C_MCS_ARBLST 0x10U // Arbitration Lost
|
||||
#define I2C_MCS_IDLE 0x20U // I2C Idle
|
||||
#define I2C_MCS_BUSBSY 0x40U // Bus Busy
|
||||
#define I2C_MCS_CLKTO 0x80U // Clock Timeout Error
|
||||
#define I2C_MCS_ACTDMATX 0x40000000U // DMA TX Active Status
|
||||
#define I2C_MCS_ACTDMARX 0x80000000U // DMA RX Active Status
|
||||
|
||||
//*****************************************************************************
|
||||
//
|
||||
// The following are defines for the bit fields in the I2CMDR register
|
||||
//
|
||||
//*****************************************************************************
|
||||
#define I2C_MDR_DATA_S 0U
|
||||
#define I2C_MDR_DATA_M 0xFFU // Data transmitted/received
|
||||
|
||||
//*****************************************************************************
|
||||
//
|
||||
// The following are defines for the bit fields in the I2CMTPR register
|
||||
//
|
||||
//*****************************************************************************
|
||||
#define I2C_MTPR_TPR_S 0U
|
||||
#define I2C_MTPR_TPR_M 0x7FU // Timer Period
|
||||
#define I2C_MTPR_HS 0x80U // High-Speed Enable
|
||||
#define I2C_MTPR_PULSEL_S 16U
|
||||
#define I2C_MTPR_PULSEL_M 0x70000U // Glitch Suppression Pulse
|
||||
// Width
|
||||
|
||||
//*****************************************************************************
|
||||
//
|
||||
// The following are defines for the bit fields in the I2CMIMR register
|
||||
//
|
||||
//*****************************************************************************
|
||||
#define I2C_MIMR_IM 0x1U // Master Interrupt Mask
|
||||
#define I2C_MIMR_CLKIM 0x2U // Clock Timeout Interrupt Mask
|
||||
#define I2C_MIMR_DMARXIM 0x4U // Receive DMA Interrupt Mask
|
||||
#define I2C_MIMR_DMATXIM 0x8U // Transmit DMA Interrupt Mask
|
||||
#define I2C_MIMR_NACKIM 0x10U // Address/Data NACK Interrupt
|
||||
// Mask
|
||||
#define I2C_MIMR_STARTIM 0x20U // START Detection Interrupt
|
||||
// Mask
|
||||
#define I2C_MIMR_STOPIM 0x40U // STOP Detection Interrupt Mask
|
||||
#define I2C_MIMR_ARBLOSTIM 0x80U // Arbitration Lost Interrupt
|
||||
// Mask
|
||||
#define I2C_MIMR_TXIM 0x100U // Transmit FIFO Request
|
||||
// Interrupt Mask
|
||||
#define I2C_MIMR_RXIM 0x200U // Receive FIFO Request
|
||||
// Interrupt Mask
|
||||
#define I2C_MIMR_TXFEIM 0x400U // Transmit FIFO Empty Interrupt
|
||||
// Mask
|
||||
#define I2C_MIMR_RXFFIM 0x800U // Receive FIFO Full Interrupt
|
||||
// Mask
|
||||
|
||||
//*****************************************************************************
|
||||
//
|
||||
// The following are defines for the bit fields in the I2CMRIS register
|
||||
//
|
||||
//*****************************************************************************
|
||||
#define I2C_MRIS_RIS 0x1U // Master Raw Interrupt Status
|
||||
#define I2C_MRIS_CLKRIS 0x2U // Clock Timeout Raw Interrupt
|
||||
// Status
|
||||
#define I2C_MRIS_DMARXRIS 0x4U // Receive DMA Raw Interrupt
|
||||
// Status
|
||||
#define I2C_MRIS_DMATXRIS 0x8U // Transmit DMA Raw Interrupt
|
||||
// Status
|
||||
#define I2C_MRIS_NACKRIS 0x10U // Address/Data NACK Raw
|
||||
// Interrupt Status
|
||||
#define I2C_MRIS_STARTRIS 0x20U // START Detection Raw Interrupt
|
||||
// Status
|
||||
#define I2C_MRIS_STOPRIS 0x40U // STOP Detection Raw Interrupt
|
||||
// Status
|
||||
#define I2C_MRIS_ARBLOSTRIS 0x80U // Arbitration Lost Raw
|
||||
// Interrupt Status
|
||||
#define I2C_MRIS_TXRIS 0x100U // Transmit Request Raw
|
||||
// Interrupt Status
|
||||
#define I2C_MRIS_RXRIS 0x200U // Receive FIFO Request Raw
|
||||
// Interrupt Status
|
||||
#define I2C_MRIS_TXFERIS 0x400U // Transmit FIFO Empty Raw
|
||||
// Interrupt Status
|
||||
#define I2C_MRIS_RXFFRIS 0x800U // Receive FIFO Full Raw
|
||||
// Interrupt Status
|
||||
|
||||
//*****************************************************************************
|
||||
//
|
||||
// The following are defines for the bit fields in the I2CMMIS register
|
||||
//
|
||||
//*****************************************************************************
|
||||
#define I2C_MMIS_MIS 0x1U // Masked Interrupt Status
|
||||
#define I2C_MMIS_CLKMIS 0x2U // Clock Timeout Masked
|
||||
// Interrupt Status
|
||||
#define I2C_MMIS_DMARXMIS 0x4U // Receive DMA Interrupt Status
|
||||
#define I2C_MMIS_DMATXMIS 0x8U // Transmit DMA Interrupt Status
|
||||
#define I2C_MMIS_NACKMIS 0x10U // Address/Data NACK Interrupt
|
||||
// Mask
|
||||
#define I2C_MMIS_STARTMIS 0x20U // START Detection Interrupt
|
||||
// Mask
|
||||
#define I2C_MMIS_STOPMIS 0x40U // STOP Detection Interrupt Mask
|
||||
#define I2C_MMIS_ARBLOSTMIS 0x80U // Arbitration Lost Interrupt
|
||||
// Mask
|
||||
#define I2C_MMIS_TXMIS 0x100U // Transmit Request Interrupt
|
||||
// Mask
|
||||
#define I2C_MMIS_RXMIS 0x200U // Receive FIFO Request
|
||||
// Interrupt Mask
|
||||
#define I2C_MMIS_TXFEMIS 0x400U // Transmit FIFO Empty Interrupt
|
||||
// Mask
|
||||
#define I2C_MMIS_RXFFMIS 0x800U // Receive FIFO Full Interrupt
|
||||
// Mask
|
||||
|
||||
//*****************************************************************************
|
||||
//
|
||||
// The following are defines for the bit fields in the I2CMICR register
|
||||
//
|
||||
//*****************************************************************************
|
||||
#define I2C_MICR_IC 0x1U // Master Interrupt Clear
|
||||
#define I2C_MICR_CLKIC 0x2U // Clock Timeout Interrupt Clear
|
||||
#define I2C_MICR_DMARXIC 0x4U // Receive DMA Interrupt Clear
|
||||
#define I2C_MICR_DMATXIC 0x8U // Transmit DMA Interrupt Clear
|
||||
#define I2C_MICR_NACKIC 0x10U // Address/Data NACK Interrupt
|
||||
// Clear
|
||||
#define I2C_MICR_STARTIC 0x20U // START Detection Interrupt
|
||||
// Clear
|
||||
#define I2C_MICR_STOPIC 0x40U // STOP Detection Interrupt
|
||||
// Clear
|
||||
#define I2C_MICR_ARBLOSTIC 0x80U // Arbitration Lost Interrupt
|
||||
// Clear
|
||||
#define I2C_MICR_TXIC 0x100U // Transmit FIFO Request
|
||||
// Interrupt Clear
|
||||
#define I2C_MICR_RXIC 0x200U // Receive FIFO Request
|
||||
// Interrupt Clear
|
||||
#define I2C_MICR_TXFEIC 0x400U // Transmit FIFO Empty Interrupt
|
||||
// Clear
|
||||
#define I2C_MICR_RXFFIC 0x800U // Receive FIFO Full Interrupt
|
||||
// Clear
|
||||
|
||||
//*****************************************************************************
|
||||
//
|
||||
// The following are defines for the bit fields in the I2CMCR register
|
||||
//
|
||||
//*****************************************************************************
|
||||
#define I2C_MCR_LPBK 0x1U // I2C Loopback
|
||||
#define I2C_MCR_MFE 0x10U // I2C Master Function Enable
|
||||
#define I2C_MCR_SFE 0x20U // I2C Slave Function Enable
|
||||
|
||||
//*****************************************************************************
|
||||
//
|
||||
// The following are defines for the bit fields in the I2CMCLKOCNT register
|
||||
//
|
||||
//*****************************************************************************
|
||||
#define I2C_MCLKOCNT_CNTL_S 0U
|
||||
#define I2C_MCLKOCNT_CNTL_M 0xFFU // I2C Master Count
|
||||
|
||||
//*****************************************************************************
|
||||
//
|
||||
// The following are defines for the bit fields in the I2CMBMON register
|
||||
//
|
||||
//*****************************************************************************
|
||||
#define I2C_MBMON_SCL 0x1U // I2C SCL Status
|
||||
#define I2C_MBMON_SDA 0x2U // I2C SDA Status
|
||||
|
||||
//*****************************************************************************
|
||||
//
|
||||
// The following are defines for the bit fields in the I2CMBLEN register
|
||||
//
|
||||
//*****************************************************************************
|
||||
#define I2C_MBLEN_CNTL_S 0U
|
||||
#define I2C_MBLEN_CNTL_M 0xFFU // I2C Burst Length
|
||||
|
||||
//*****************************************************************************
|
||||
//
|
||||
// The following are defines for the bit fields in the I2CMBCNT register
|
||||
//
|
||||
//*****************************************************************************
|
||||
#define I2C_MBCNT_CNTL_S 0U
|
||||
#define I2C_MBCNT_CNTL_M 0xFFU // I2C Master Burst Count
|
||||
|
||||
//*****************************************************************************
|
||||
//
|
||||
// The following are defines for the bit fields in the I2CSOAR register
|
||||
//
|
||||
//*****************************************************************************
|
||||
#define I2C_SOAR_OAR_S 0U
|
||||
#define I2C_SOAR_OAR_M 0x7FU // I2C Slave Own Address
|
||||
|
||||
//*****************************************************************************
|
||||
//
|
||||
// The following are defines for the bit fields in the I2CSCSR register
|
||||
//
|
||||
//*****************************************************************************
|
||||
#define I2C_SCSR_RREQ 0x1U // Receive Request
|
||||
#define I2C_SCSR_TREQ 0x2U // Transmit Request
|
||||
#define I2C_SCSR_FBR 0x4U // First Byte Received
|
||||
#define I2C_SCSR_OAR2SEL 0x8U // OAR2 Address Matched
|
||||
#define I2C_SCSR_QCMDST 0x10U // Quick Command Status
|
||||
#define I2C_SCSR_QCMDRW 0x20U // Quick Command Read / Write
|
||||
#define I2C_SCSR_ACTDMATX 0x40000000U // DMA TX Active Status
|
||||
#define I2C_SCSR_ACTDMARX 0x80000000U // DMA RX Active Status
|
||||
|
||||
//*****************************************************************************
|
||||
//
|
||||
// The following are defines for the bit fields in the I2CSDR register
|
||||
//
|
||||
//*****************************************************************************
|
||||
#define I2C_SDR_DATA_S 0U
|
||||
#define I2C_SDR_DATA_M 0xFFU // Data for Transfer
|
||||
|
||||
//*****************************************************************************
|
||||
//
|
||||
// The following are defines for the bit fields in the I2CSIMR register
|
||||
//
|
||||
//*****************************************************************************
|
||||
#define I2C_SIMR_DATAIM 0x1U // Data Interrupt Mask
|
||||
#define I2C_SIMR_STARTIM 0x2U // Start Condition Interrupt
|
||||
// Mask
|
||||
#define I2C_SIMR_STOPIM 0x4U // Stop Condition Interrupt Mask
|
||||
#define I2C_SIMR_DMARXIM 0x8U // Receive DMA Interrupt Mask
|
||||
#define I2C_SIMR_DMATXIM 0x10U // Transmit DMA Interrupt Mask
|
||||
#define I2C_SIMR_TXIM 0x20U // Transmit FIFO Request
|
||||
// Interrupt Mask
|
||||
#define I2C_SIMR_RXIM 0x40U // Receive FIFO Request
|
||||
// Interrupt Mask
|
||||
#define I2C_SIMR_TXFEIM 0x80U // Transmit FIFO Empty Interrupt
|
||||
// Mask
|
||||
#define I2C_SIMR_RXFFIM 0x100U // Receive FIFO Full Interrupt
|
||||
// Mask
|
||||
|
||||
//*****************************************************************************
|
||||
//
|
||||
// The following are defines for the bit fields in the I2CSRIS register
|
||||
//
|
||||
//*****************************************************************************
|
||||
#define I2C_SRIS_DATARIS 0x1U // Data Raw Interrupt Status
|
||||
#define I2C_SRIS_STARTRIS 0x2U // Start Condition Raw Interrupt
|
||||
// Status
|
||||
#define I2C_SRIS_STOPRIS 0x4U // Stop Condition Raw Interrupt
|
||||
// Status
|
||||
#define I2C_SRIS_DMARXRIS 0x8U // Receive DMA Raw Interrupt
|
||||
// Status
|
||||
#define I2C_SRIS_DMATXRIS 0x10U // Transmit DMA Raw Interrupt
|
||||
// Status
|
||||
#define I2C_SRIS_TXRIS 0x20U // Transmit Request Raw
|
||||
// Interrupt Status
|
||||
#define I2C_SRIS_RXRIS 0x40U // Receive FIFO Request Raw
|
||||
// Interrupt Status
|
||||
#define I2C_SRIS_TXFERIS 0x80U // Transmit FIFO Empty Raw
|
||||
// Interrupt Status
|
||||
#define I2C_SRIS_RXFFRIS 0x100U // Receive FIFO Full Raw
|
||||
// Interrupt Status
|
||||
|
||||
//*****************************************************************************
|
||||
//
|
||||
// The following are defines for the bit fields in the I2CSMIS register
|
||||
//
|
||||
//*****************************************************************************
|
||||
#define I2C_SMIS_DATAMIS 0x1U // Data Masked Interrupt Status
|
||||
#define I2C_SMIS_STARTMIS 0x2U // Start Condition Masked
|
||||
// Interrupt Status
|
||||
#define I2C_SMIS_STOPMIS 0x4U // Stop Condition Masked
|
||||
// Interrupt Status
|
||||
#define I2C_SMIS_DMARXMIS 0x8U // Receive DMA Masked Interrupt
|
||||
// Status
|
||||
#define I2C_SMIS_DMATXMIS 0x10U // Transmit DMA Masked Interrupt
|
||||
// Status
|
||||
#define I2C_SMIS_TXMIS 0x20U // Transmit FIFO Request
|
||||
// Interrupt Mask
|
||||
#define I2C_SMIS_RXMIS 0x40U // Receive FIFO Request
|
||||
// Interrupt Mask
|
||||
#define I2C_SMIS_TXFEMIS 0x80U // Transmit FIFO Empty Interrupt
|
||||
// Mask
|
||||
#define I2C_SMIS_RXFFMIS 0x100U // Receive FIFO Full Interrupt
|
||||
// Mask
|
||||
|
||||
//*****************************************************************************
|
||||
//
|
||||
// The following are defines for the bit fields in the I2CSICR register
|
||||
//
|
||||
//*****************************************************************************
|
||||
#define I2C_SICR_DATAIC 0x1U // Data Interrupt Clear
|
||||
#define I2C_SICR_STARTIC 0x2U // Start Condition Interrupt
|
||||
// Clear
|
||||
#define I2C_SICR_STOPIC 0x4U // Stop Condition Interrupt
|
||||
// Clear
|
||||
#define I2C_SICR_DMARXIC 0x8U // Receive DMA Interrupt Clear
|
||||
#define I2C_SICR_DMATXIC 0x10U // Transmit DMA Interrupt Clear
|
||||
#define I2C_SICR_TXIC 0x20U // Transmit Request Interrupt
|
||||
// Mask
|
||||
#define I2C_SICR_RXIC 0x40U // Receive Request Interrupt
|
||||
// Mask
|
||||
#define I2C_SICR_TXFEIC 0x80U // Transmit FIFO Empty Interrupt
|
||||
// Mask
|
||||
#define I2C_SICR_RXFFIC 0x100U // Receive FIFO Full Interrupt
|
||||
// Mask
|
||||
|
||||
//*****************************************************************************
|
||||
//
|
||||
// The following are defines for the bit fields in the I2CSOAR2 register
|
||||
//
|
||||
//*****************************************************************************
|
||||
#define I2C_SOAR2_OAR2_S 0U
|
||||
#define I2C_SOAR2_OAR2_M 0x7FU // I2C Slave Own Address 2
|
||||
#define I2C_SOAR2_OAR2EN 0x80U // I2C Slave Own Address 2
|
||||
// Enable
|
||||
|
||||
//*****************************************************************************
|
||||
//
|
||||
// The following are defines for the bit fields in the I2CSACKCTL register
|
||||
//
|
||||
//*****************************************************************************
|
||||
#define I2C_SACKCTL_ACKOEN 0x1U // I2C Slave ACK Override Enable
|
||||
#define I2C_SACKCTL_ACKOVAL 0x2U // I2C Slave ACK Override Value
|
||||
|
||||
//*****************************************************************************
|
||||
//
|
||||
// The following are defines for the bit fields in the I2CFIFODATARX register
|
||||
//
|
||||
//*****************************************************************************
|
||||
#define I2C_FIFODATARX_DATA_S 0U
|
||||
#define I2C_FIFODATARX_DATA_M 0xFFU // I2C RX FIFO Read Data Byte
|
||||
|
||||
//*****************************************************************************
|
||||
//
|
||||
// The following are defines for the bit fields in the I2CFIFOCTL register
|
||||
//
|
||||
//*****************************************************************************
|
||||
#define I2C_FIFOCTL_TXTRIG_S 0U
|
||||
#define I2C_FIFOCTL_TXTRIG_M 0x7U // TX FIFO Trigger
|
||||
#define I2C_FIFOCTL_DMATXENA 0x2000U // DMA TX Channel Enable
|
||||
#define I2C_FIFOCTL_TXFLUSH 0x4000U // TX FIFO Flush
|
||||
#define I2C_FIFOCTL_TXASGNMT 0x8000U // TX Control Assignment
|
||||
#define I2C_FIFOCTL_RXTRIG_S 16U
|
||||
#define I2C_FIFOCTL_RXTRIG_M 0x70000U // RX FIFO Trigger
|
||||
#define I2C_FIFOCTL_DMARXENA 0x20000000U // DMA RX Channel Enable
|
||||
#define I2C_FIFOCTL_RXFLUSH 0x40000000U // RX FIFO Flush
|
||||
#define I2C_FIFOCTL_RXASGNMT 0x80000000U // RX Control Assignment
|
||||
|
||||
//*****************************************************************************
|
||||
//
|
||||
// The following are defines for the bit fields in the I2CFIFOSTATUS register
|
||||
//
|
||||
//*****************************************************************************
|
||||
#define I2C_FIFOSTATUS_TXFE 0x1U // TX FIFO Empty
|
||||
#define I2C_FIFOSTATUS_TXFF 0x2U // TX FIFO Full
|
||||
#define I2C_FIFOSTATUS_TXBLWTRIG 0x4U // TX FIFO Below Trigger Level
|
||||
#define I2C_FIFOSTATUS_RXFE 0x10000U // RX FIFO Empty
|
||||
#define I2C_FIFOSTATUS_RXFF 0x20000U // RX FIFO Full
|
||||
#define I2C_FIFOSTATUS_RXABVTRIG 0x40000U // RX FIFO Above Trigger Level
|
||||
|
||||
//*****************************************************************************
|
||||
//
|
||||
// The following are defines for the bit fields in the I2CPP register
|
||||
//
|
||||
//*****************************************************************************
|
||||
#define I2C_PP_HS 0x1U // High-Speed Capable
|
||||
|
||||
//*****************************************************************************
|
||||
//
|
||||
// The following are defines for the bit fields in the I2CPC register
|
||||
//
|
||||
//*****************************************************************************
|
||||
#define I2C_PC_HS 0x1U // High-Speed Capable
|
||||
|
||||
//*****************************************************************************
|
||||
//
|
||||
// The following are defines for the bit fields in the I2CMCS_WRITE register
|
||||
//
|
||||
//*****************************************************************************
|
||||
#define I2C_MCS_WRITE_RUN 0x1U // I2C Master Enable
|
||||
#define I2C_MCS_WRITE_START 0x2U // Generate START
|
||||
#define I2C_MCS_WRITE_STOP 0x4U // Generate STOP
|
||||
#define I2C_MCS_WRITE_ACK 0x8U // Data Acknowledge Enable
|
||||
#define I2C_MCS_WRITE_HS 0x10U // High-Speed Enable
|
||||
#define I2C_MCS_WRITE_QCMD 0x20U // Quick Command
|
||||
#define I2C_MCS_WRITE_BURST 0x40U // Burst Enable
|
||||
|
||||
//*****************************************************************************
|
||||
//
|
||||
// The following are defines for the bit fields in the I2CSCSR_WRITE register
|
||||
//
|
||||
//*****************************************************************************
|
||||
#define I2C_SCSR_WRITE_DA 0x1U // Device Active
|
||||
#define I2C_SCSR_WRITE_TXFIFO 0x2U // TX FIFO Enable
|
||||
#define I2C_SCSR_WRITE_RXFIFO 0x4U // RX FIFO Enable
|
||||
|
||||
//*****************************************************************************
|
||||
//
|
||||
// The following are defines for the bit fields in the I2CFIFODATATX register
|
||||
//
|
||||
//*****************************************************************************
|
||||
#define I2C_FIFODATATX_DATA_S 0U
|
||||
#define I2C_FIFODATATX_DATA_M 0xFFU // I2C TX FIFO Write Data Byte
|
||||
#endif
|
||||
+125
@@ -0,0 +1,125 @@
|
||||
//###########################################################################
|
||||
//
|
||||
// FILE: hw_ints.h
|
||||
//
|
||||
// TITLE: Macros that define the interrupt assignment.
|
||||
//
|
||||
//###########################################################################
|
||||
// $TI Release: $
|
||||
// $Release Date: $
|
||||
//
|
||||
// C2000Ware v5.04.00.00
|
||||
//
|
||||
// Copyright (C) 2024 Texas Instruments Incorporated - http://www.ti.com
|
||||
//
|
||||
// Redistribution and use in source and binary forms, with or without
|
||||
// modification, are permitted provided that the following conditions
|
||||
// are met:
|
||||
//
|
||||
// Redistributions of source code must retain the above copyright
|
||||
// notice, this list of conditions and the following disclaimer.
|
||||
//
|
||||
// Redistributions in binary form must reproduce the above copyright
|
||||
// notice, this list of conditions and the following disclaimer in the
|
||||
// documentation and/or other materials provided with the
|
||||
// distribution.
|
||||
//
|
||||
// Neither the name of Texas Instruments Incorporated nor the names of
|
||||
// its contributors may be used to endorse or promote products derived
|
||||
// from this software without specific prior written permission.
|
||||
//
|
||||
// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
|
||||
// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
|
||||
// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
|
||||
// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
|
||||
// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
|
||||
// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
|
||||
// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
|
||||
// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
|
||||
// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
||||
// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
|
||||
// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
// $
|
||||
//###########################################################################
|
||||
|
||||
#ifndef HW_INTS_H
|
||||
#define HW_INTS_H
|
||||
|
||||
//*****************************************************************************
|
||||
// The following are defines for the fault assignments.
|
||||
//*****************************************************************************
|
||||
#define FAULT_NMI 2U // NMI fault
|
||||
#define FAULT_HARD 3U // Hard fault
|
||||
#define FAULT_MPU 4U // MPU fault
|
||||
#define FAULT_BUS 5U // Bus fault
|
||||
#define FAULT_USAGE 6U // Usage fault
|
||||
#define FAULT_SVCALL 11U // SVCall
|
||||
#define FAULT_DEBUG 12U // Debug monitor
|
||||
#define FAULT_PENDSV 14U // PendSV
|
||||
#define FAULT_SYSTICK 15U // System Tick
|
||||
|
||||
//*****************************************************************************
|
||||
// The following are defines for the interrupt assignments.
|
||||
//*****************************************************************************
|
||||
#define INT_MCANSS_0 16U // MCANSS_INT[0]
|
||||
#define INT_MCANSS_1 17U // MCANSS_INT[1]
|
||||
#define INT_MCANSS_WAKE_AND_TS_PLS 18U // MCANSS_WAKE_AND_TS_PLS_INT
|
||||
#define INT_MCANSS_ECC_CORR_LVL 19U // MCANSS_ECC_CORR_LVL_INT
|
||||
#define INT_ECAT 21U // ECATINT
|
||||
#define INT_ECAT_SYNC0 22U // ECATSYNC0INT
|
||||
#define INT_ECAT_SYNC1 23U // ECATSYNC1INT
|
||||
#define INT_ECAT_RST 24U // ECATRSTINT
|
||||
#define INT_CANA0 25U // DCANA Interrupt 0
|
||||
#define INT_CANA1 26U // DCANA Interrupt 1
|
||||
#define INT_CANB0 27U // DCANB Interrupt 0
|
||||
#define INT_CANB1 28U // DCANB Interrupt 1
|
||||
#define INT_EMAC 29U // EMAC_INT
|
||||
#define INT_EMAC_TX0 30U // EMAC_TX_INT[0]
|
||||
#define INT_EMAC_TX1 31U // EMAC_TX_INT[1]
|
||||
#define INT_EMAC_RX0 32U // EMAC_RX_INT[0]
|
||||
#define INT_EMAC_RX1 33U // EMAC_RX_INT[1]
|
||||
#define INT_UART0 34U // UART0INT
|
||||
#define INT_SSI0 36U // SSI0INT
|
||||
#define INT_I2C0 38U // I2C0INT
|
||||
#define INT_USB 40U // USBINT
|
||||
#define INT_UDMA_SW 41U // UDMASWINT
|
||||
#define INT_UDMA_ERR 42U // UDMAERRINT
|
||||
#define INT_IPC_CPU1TOCM_0 45U // CPU1TOCMIPCINT0
|
||||
#define INT_IPC_CPU1TOCM_1 46U // CPU1TOCMIPCINT1
|
||||
#define INT_IPC_CPU1TOCM_2 47U // CPU1TOCMIPCINT2
|
||||
#define INT_IPC_CPU1TOCM_3 48U // CPU1TOCMIPCINT3
|
||||
#define INT_IPC_CPU1TOCM_4 49U // CPU1TOCMIPCINT4
|
||||
#define INT_IPC_CPU1TOCM_5 50U // CPU1TOCMIPCINT5
|
||||
#define INT_IPC_CPU1TOCM_6 51U // CPU1TOCMIPCINT6
|
||||
#define INT_IPC_CPU1TOCM_7 52U // CPU1TOCMIPCINT7
|
||||
#define INT_IPC_CPU2TOCM_0 53U // CPU2TOCMIPCINT0
|
||||
#define INT_IPC_CPU2TOCM_1 54U // CPU2TOCMIPCINT1
|
||||
#define INT_IPC_CPU2TOCM_2 55U // CPU2TOCMIPCINT2
|
||||
#define INT_IPC_CPU2TOCM_3 56U // CPU2TOCMIPCINT3
|
||||
#define INT_IPC_CPU2TOCM_4 57U // CPU2TOCMIPCINT4
|
||||
#define INT_IPC_CPU2TOCM_5 58U // CPU2TOCMIPCINT5
|
||||
#define INT_IPC_CPU2TOCM_6 59U // CPU2TOCMIPCINT6
|
||||
#define INT_IPC_CPU2TOCM_7 60U // CPU2TOCMIPCINT7
|
||||
#define INT_FMC_FSMDONE 61U // FMC_FSMDONE_INT
|
||||
#define INT_FMC_CORR 62U // FMC_CORR_INT
|
||||
#define INT_AES 63U // AESINT
|
||||
#define INT_TIMER0 64U // TINT0
|
||||
#define INT_TIMER1 65U // TINT1
|
||||
#define INT_TIMER2 66U // TINT2
|
||||
#define INT_CMRAM_TESTERROR_LOG 67U // CM_RAM_TESTERROR_LOG
|
||||
|
||||
//*****************************************************************************
|
||||
// The following are defines for the total number of interrupts.
|
||||
//*****************************************************************************
|
||||
#define NUM_INTERRUPTS 80U
|
||||
|
||||
//*****************************************************************************
|
||||
// The following are defines for the total number of priority levels.
|
||||
//*****************************************************************************
|
||||
#define NUM_PRIORITY 8U
|
||||
#define NUM_PRIORITY_BITS 3U
|
||||
|
||||
|
||||
#endif // HW_INTS_H
|
||||
|
||||
|
||||
+1937
File diff suppressed because it is too large.
Load diff
+1903
File diff suppressed because it is too large.
Load diff
+533
@@ -0,0 +1,533 @@
|
||||
//###########################################################################
|
||||
//
|
||||
// FILE: hw_memcfg.h
|
||||
//
|
||||
// TITLE: Definitions for the MEMCFG registers.
|
||||
//
|
||||
//###########################################################################
|
||||
// $TI Release: $
|
||||
// $Release Date: $
|
||||
//
|
||||
// C2000Ware v5.04.00.00
|
||||
//
|
||||
// Copyright (C) 2024 Texas Instruments Incorporated - http://www.ti.com
|
||||
//
|
||||
// Redistribution and use in source and binary forms, with or without
|
||||
// modification, are permitted provided that the following conditions
|
||||
// are met:
|
||||
//
|
||||
// Redistributions of source code must retain the above copyright
|
||||
// notice, this list of conditions and the following disclaimer.
|
||||
//
|
||||
// Redistributions in binary form must reproduce the above copyright
|
||||
// notice, this list of conditions and the following disclaimer in the
|
||||
// documentation and/or other materials provided with the
|
||||
// distribution.
|
||||
//
|
||||
// Neither the name of Texas Instruments Incorporated nor the names of
|
||||
// its contributors may be used to endorse or promote products derived
|
||||
// from this software without specific prior written permission.
|
||||
//
|
||||
// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
|
||||
// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
|
||||
// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
|
||||
// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
|
||||
// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
|
||||
// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
|
||||
// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
|
||||
// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
|
||||
// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
||||
// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
|
||||
// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
// $
|
||||
//###########################################################################
|
||||
|
||||
#ifndef HW_MEMCFG_H
|
||||
#define HW_MEMCFG_H
|
||||
|
||||
//*****************************************************************************
|
||||
//
|
||||
// The following are defines for the MEMCFG register offsets
|
||||
//
|
||||
//*****************************************************************************
|
||||
#define MEMCFG_O_CXLOCK 0x0U // C RAM Config Lock Register
|
||||
#define MEMCFG_O_CXTEST 0x4U // C RAM TEST Register
|
||||
#define MEMCFG_O_CXINIT 0x8U // C RAM Init Register
|
||||
#define MEMCFG_O_CXINITDONE 0xCU // C RAM Initialization Status
|
||||
// Register
|
||||
#define MEMCFG_O_CMMSGXLOCK 0x20U // CM Messae RAM Config Lock
|
||||
// Register
|
||||
#define MEMCFG_O_CMMSGXTEST 0x24U // CM Messae RAM TEST Register
|
||||
#define MEMCFG_O_CMMSGXINIT 0x28U // CM Messae RAM Init Register
|
||||
#define MEMCFG_O_CMMSGXINITDONE 0x2CU // CM Messae RAM Initialization
|
||||
// Status Register
|
||||
#define MEMCFG_O_SXGROUP1_LOCK 0x40U // S0-S15 RAM Config Lock
|
||||
// Register
|
||||
#define MEMCFG_O_SXGROUP1_TEST 0x44U // S0-S15 RAM TEST Register
|
||||
#define MEMCFG_O_SXGROUP1_INIT 0x48U // S0-S15 RAM Init Register
|
||||
#define MEMCFG_O_SXGROUP1_INITDONE 0x4CU // S0-S15 RAM Initialization
|
||||
// Status Register
|
||||
#define MEMCFG_O_ROM_LOCK 0x80U // ROM Config Lock Register
|
||||
#define MEMCFG_O_ROM_TEST 0x84U // ROM TEST Register
|
||||
#define MEMCFG_O_ROM_FORCE_ERROR 0x88U // ROM Force Error register
|
||||
#define MEMCFG_O_PERI_MEM_TEST_LOCK 0xA0U // Peripheral Memory Test Lock
|
||||
// Register
|
||||
#define MEMCFG_O_PERI_MEM_TEST_CONTROL 0xA4U // Peripheral Memory Test
|
||||
// control Register
|
||||
#define MEMCFG_O_UCERRFLG 0x0U // Uncorrectable Error Flag
|
||||
// Register
|
||||
#define MEMCFG_O_UCERRSET 0x4U // Uncorrectable Error Flag Set
|
||||
// Register
|
||||
#define MEMCFG_O_UCERRCLR 0x8U // Uncorrectable Error Flag
|
||||
// Clear Register
|
||||
#define MEMCFG_O_UCM4EADDR 0xCU // Uncorrectable M4 Error
|
||||
// Address
|
||||
#define MEMCFG_O_UCEMACEADDR 0x10U // Uncorrectable EMAC Error
|
||||
// Address
|
||||
#define MEMCFG_O_UCUDMAEADDR 0x14U // Uncorrectable uDMA Error
|
||||
// Address
|
||||
#define MEMCFG_O_UCETHERCATMEMREADDR 0x18U // Uncorrectable EtherCAT IP RAM
|
||||
// Read Error Address
|
||||
#define MEMCFG_O_UCEMACMEMREADDR 0x1CU // Uncorrectable EMAC IP RAM
|
||||
// Read Error Address
|
||||
#define MEMCFG_O_BUSFAULTFLG 0x50U // BusFault Flag register
|
||||
#define MEMCFG_O_BUSFAULTCLR 0x54U // BusFault Flag clear register
|
||||
#define MEMCFG_O_M4BUSFAULTADDR 0x58U // M4 busfault address
|
||||
#define MEMCFG_O_UDMABUSFAULTADDR 0x5CU // uDMA busfault address
|
||||
#define MEMCFG_O_EMACBUSFAULTADDR 0x60U // EMAC busfault address
|
||||
#define MEMCFG_O_CERRFLG 0x80U // Correctable Error Flag
|
||||
// Register
|
||||
#define MEMCFG_O_CERRSET 0x84U // Correctable Error Flag Set
|
||||
// Register
|
||||
#define MEMCFG_O_CERRCLR 0x88U // Correctable Error Flag Clear
|
||||
// Register
|
||||
#define MEMCFG_O_CM4EADDR 0x8CU // Correctable M4 Error Address
|
||||
#define MEMCFG_O_CEMACEADDR 0x90U // Correctable EMAC Error
|
||||
// Address
|
||||
#define MEMCFG_O_CUDMAEADDR 0x94U // Correctable uDMA Error
|
||||
// Address
|
||||
#define MEMCFG_O_CERRCNT 0xC0U // Correctable Error Count
|
||||
// Register
|
||||
#define MEMCFG_O_CERRTHRES 0xC4U // Correctable Error Threshold
|
||||
// Value Register
|
||||
#define MEMCFG_O_CEINTFLG 0xC8U // Correctable Error Interrupt
|
||||
// Flag Status Register
|
||||
#define MEMCFG_O_CEINTSET 0xCCU // Correctable Error Interrupt
|
||||
// Flag Set Register
|
||||
#define MEMCFG_O_CEINTCLR 0xD0U // Correctable Error Interrupt
|
||||
// Flag Clear Register
|
||||
#define MEMCFG_O_CEINTEN 0xD4U // Correctable Error Interrupt
|
||||
// Enable Register
|
||||
#define MEMCFG_O_DIAGERRFLG 0x0U // Error Flag Register
|
||||
#define MEMCFG_O_DIAGERRCLR 0x8U // Error Flag Clear Register
|
||||
#define MEMCFG_O_DIAGERRADDR 0xCU // Read Error Address
|
||||
|
||||
//*****************************************************************************
|
||||
//
|
||||
// The following are defines for the bit fields in the CXLOCK register
|
||||
//
|
||||
//*****************************************************************************
|
||||
#define MEMCFG_CXLOCK_LOCK_C0 0x1U // C0 RAM Lock bits
|
||||
#define MEMCFG_CXLOCK_LOCK_C1 0x2U // C1 RAM Lock bits
|
||||
|
||||
//*****************************************************************************
|
||||
//
|
||||
// The following are defines for the bit fields in the CXTEST register
|
||||
//
|
||||
//*****************************************************************************
|
||||
#define MEMCFG_CXTEST_TEST_C0_S 0U
|
||||
#define MEMCFG_CXTEST_TEST_C0_M 0x3U // Selects the different modes
|
||||
// for C0 RAM
|
||||
#define MEMCFG_CXTEST_TEST_C1_S 2U
|
||||
#define MEMCFG_CXTEST_TEST_C1_M 0xCU // Selects the different modes
|
||||
// for C1 RAM
|
||||
|
||||
//*****************************************************************************
|
||||
//
|
||||
// The following are defines for the bit fields in the CXINIT register
|
||||
//
|
||||
//*****************************************************************************
|
||||
#define MEMCFG_CXINIT_INIT_C0 0x1U // RAM Initialization control
|
||||
// for C0 RAM.
|
||||
#define MEMCFG_CXINIT_INIT_C1 0x2U // RAM Initialization control
|
||||
// for C1 RAM.
|
||||
|
||||
//*****************************************************************************
|
||||
//
|
||||
// The following are defines for the bit fields in the CXINITDONE register
|
||||
//
|
||||
//*****************************************************************************
|
||||
#define MEMCFG_CXINITDONE_INITDONE_C0 0x1U // RAM Initialization status for
|
||||
// C0 RAM.
|
||||
#define MEMCFG_CXINITDONE_INITDONE_C1 0x2U // RAM Initialization status for
|
||||
// C1 RAM.
|
||||
|
||||
//*****************************************************************************
|
||||
//
|
||||
// The following are defines for the bit fields in the CMMSGXLOCK register
|
||||
//
|
||||
//*****************************************************************************
|
||||
#define MEMCFG_CMMSGXLOCK_LOCK_CMTOCPU1MSGRAM0 0x1U // Message RAM CMTOCPU1MSGRAM0
|
||||
// Lock bits
|
||||
#define MEMCFG_CMMSGXLOCK_LOCK_CMTOCPU1MSGRAM1 0x2U // Message RAM CMTOCPU1MSGRAM1
|
||||
// Lock bits
|
||||
#define MEMCFG_CMMSGXLOCK_LOCK_CMTOCPU2MSGRAM0 0x4U // Message RAM CMTOCPU2MSGRAM0
|
||||
// Lock bits
|
||||
#define MEMCFG_CMMSGXLOCK_LOCK_CMTOCPU2MSGRAM1 0x8U // Message RAM CMTOCPU2MSGRAM1
|
||||
// Lock bits
|
||||
|
||||
//*****************************************************************************
|
||||
//
|
||||
// The following are defines for the bit fields in the CMMSGXTEST register
|
||||
//
|
||||
//*****************************************************************************
|
||||
#define MEMCFG_CMMSGXTEST_TEST_CMTOCPU1MSGRAM0_S 0U
|
||||
#define MEMCFG_CMMSGXTEST_TEST_CMTOCPU1MSGRAM0_M 0x3U // Selects the different modes
|
||||
// for Message RAM CMTOCPU1MSGRAM0
|
||||
#define MEMCFG_CMMSGXTEST_TEST_CMTOCPU1MSGRAM1_S 2U
|
||||
#define MEMCFG_CMMSGXTEST_TEST_CMTOCPU1MSGRAM1_M 0xCU // Selects the different modes
|
||||
// for Message RAM CMTOCPU1MSGRAM1
|
||||
#define MEMCFG_CMMSGXTEST_TEST_CMTOCPU2MSGRAM0_S 4U
|
||||
#define MEMCFG_CMMSGXTEST_TEST_CMTOCPU2MSGRAM0_M 0x30U // Selects the different modes
|
||||
// for Message RAM CMTOCPU2MSGRAM0
|
||||
#define MEMCFG_CMMSGXTEST_TEST_CMTOCPU2MSGRAM1_S 6U
|
||||
#define MEMCFG_CMMSGXTEST_TEST_CMTOCPU2MSGRAM1_M 0xC0U // Selects the different modes
|
||||
// for Message RAM CMTOCPU2MSGRAM1
|
||||
|
||||
//*****************************************************************************
|
||||
//
|
||||
// The following are defines for the bit fields in the CMMSGXINIT register
|
||||
//
|
||||
//*****************************************************************************
|
||||
#define MEMCFG_CMMSGXINIT_INIT_CMTOCPU1MSGRAM0 0x1U // RAM Initialization control
|
||||
// for Message RAM CMTOCPU1MSGRAM0
|
||||
#define MEMCFG_CMMSGXINIT_INIT_CMTOCPU1MSGRAM1 0x2U // RAM Initialization control
|
||||
// for Message RAM CMTOCPU1MSGRAM1
|
||||
#define MEMCFG_CMMSGXINIT_INIT_CMTOCPU2MSGRAM0 0x4U // RAM Initialization control
|
||||
// for Message RAM CMTOCPU2MSGRAM0
|
||||
#define MEMCFG_CMMSGXINIT_INIT_CMTOCPU2MSGRAM1 0x8U // RAM Initialization control
|
||||
// for Message RAM CMTOCPU2MSGRAM1
|
||||
|
||||
//*****************************************************************************
|
||||
//
|
||||
// The following are defines for the bit fields in the CMMSGXINITDONE register
|
||||
//
|
||||
//*****************************************************************************
|
||||
#define MEMCFG_CMMSGXINITDONE_INITDONE_CMTOCPU1MSGRAM0 0x1U // RAM Initialization status for
|
||||
// Message RAM CMTOCPU1MSGRAM0
|
||||
#define MEMCFG_CMMSGXINITDONE_INITDONE_CMTOCPU1MSGRAM1 0x2U // RAM Initialization status for
|
||||
// Message RAM CMTOCPU1MSGRAM1
|
||||
#define MEMCFG_CMMSGXINITDONE_INITDONE_CMTOCPU2MSGRAM0 0x4U // RAM Initialization status for
|
||||
// Message RAM CMTOCPU2MSGRAM0
|
||||
#define MEMCFG_CMMSGXINITDONE_INITDONE_CMTOCPU2MSGRAM1 0x8U // RAM Initialization status for
|
||||
// Message RAM CMTOCPU2MSGRAM1
|
||||
|
||||
//*****************************************************************************
|
||||
//
|
||||
// The following are defines for the bit fields in the SXGROUP1_LOCK register
|
||||
//
|
||||
//*****************************************************************************
|
||||
#define MEMCFG_SXGROUP1_LOCK_LOCK_S0 0x1U // S0 RAM Lock bits
|
||||
#define MEMCFG_SXGROUP1_LOCK_LOCK_S1 0x2U // S1 RAM Lock bits
|
||||
#define MEMCFG_SXGROUP1_LOCK_LOCK_S2 0x4U // S2 RAM Lock bits
|
||||
#define MEMCFG_SXGROUP1_LOCK_LOCK_S3 0x8U // S3 RAM Lock bits
|
||||
#define MEMCFG_SXGROUP1_LOCK_LOCK_S4 0x10U // S4 RAM Lock bits
|
||||
|
||||
//*****************************************************************************
|
||||
//
|
||||
// The following are defines for the bit fields in the SXGROUP1_TEST register
|
||||
//
|
||||
//*****************************************************************************
|
||||
#define MEMCFG_SXGROUP1_TEST_TEST_S0_S 0U
|
||||
#define MEMCFG_SXGROUP1_TEST_TEST_S0_M 0x3U // Selects the different modes
|
||||
// for S0 RAM
|
||||
#define MEMCFG_SXGROUP1_TEST_TEST_S1_S 2U
|
||||
#define MEMCFG_SXGROUP1_TEST_TEST_S1_M 0xCU // Selects the different modes
|
||||
// for S1 RAM
|
||||
#define MEMCFG_SXGROUP1_TEST_TEST_S2_S 4U
|
||||
#define MEMCFG_SXGROUP1_TEST_TEST_S2_M 0x30U // Selects the different modes
|
||||
// for S2 RAM
|
||||
#define MEMCFG_SXGROUP1_TEST_TEST_S3_S 6U
|
||||
#define MEMCFG_SXGROUP1_TEST_TEST_S3_M 0xC0U // Selects the different modes
|
||||
// for S3 RAM
|
||||
#define MEMCFG_SXGROUP1_TEST_TEST_S4_S 8U
|
||||
#define MEMCFG_SXGROUP1_TEST_TEST_S4_M 0x300U // Selects the different modes
|
||||
// for S4 RAM
|
||||
|
||||
//*****************************************************************************
|
||||
//
|
||||
// The following are defines for the bit fields in the SXGROUP1_INIT register
|
||||
//
|
||||
//*****************************************************************************
|
||||
#define MEMCFG_SXGROUP1_INIT_INIT_S0 0x1U // RAM Initialization control
|
||||
// for S0 RAM.
|
||||
#define MEMCFG_SXGROUP1_INIT_INIT_S1 0x2U // RAM Initialization control
|
||||
// for S1 RAM.
|
||||
#define MEMCFG_SXGROUP1_INIT_INIT_S2 0x4U // RAM Initialization control
|
||||
// for S2 RAM.
|
||||
#define MEMCFG_SXGROUP1_INIT_INIT_S3 0x8U // RAM Initialization control
|
||||
// for S3 RAM.
|
||||
#define MEMCFG_SXGROUP1_INIT_INIT_S4 0x10U // RAM Initialization control
|
||||
// for S4 RAM.
|
||||
|
||||
//*****************************************************************************
|
||||
//
|
||||
// The following are defines for the bit fields in the SXGROUP1_INITDONE register
|
||||
//
|
||||
//*****************************************************************************
|
||||
#define MEMCFG_SXGROUP1_INITDONE_INITDONE_S0 0x1U // RAM Initialization status for
|
||||
// S0 RAM.
|
||||
#define MEMCFG_SXGROUP1_INITDONE_INITDONE_S1 0x2U // RAM Initialization status for
|
||||
// S1 RAM.
|
||||
#define MEMCFG_SXGROUP1_INITDONE_INITDONE_S2 0x4U // RAM Initialization status for
|
||||
// S2 RAM.
|
||||
#define MEMCFG_SXGROUP1_INITDONE_INITDONE_S3 0x8U // RAM Initialization status for
|
||||
// S3 RAM.
|
||||
#define MEMCFG_SXGROUP1_INITDONE_INITDONE_S4 0x10U // RAM Initialization status for
|
||||
// S4 RAM.
|
||||
|
||||
//*****************************************************************************
|
||||
//
|
||||
// The following are defines for the bit fields in the ROM_LOCK register
|
||||
//
|
||||
//*****************************************************************************
|
||||
#define MEMCFG_ROM_LOCK_LOCK_BOOTROM 0x1U // BOOTROM Lock bits
|
||||
|
||||
//*****************************************************************************
|
||||
//
|
||||
// The following are defines for the bit fields in the ROM_TEST register
|
||||
//
|
||||
//*****************************************************************************
|
||||
#define MEMCFG_ROM_TEST_TEST_BOOTROM_S 0U
|
||||
#define MEMCFG_ROM_TEST_TEST_BOOTROM_M 0x3U // Selects the different modes
|
||||
// for BOOTROM
|
||||
|
||||
//*****************************************************************************
|
||||
//
|
||||
// The following are defines for the bit fields in the ROM_FORCE_ERROR register
|
||||
//
|
||||
//*****************************************************************************
|
||||
#define MEMCFG_ROM_FORCE_ERROR_FORCE_BOOTROM_ERROR 0x1U // Force Bootrom Parity Error
|
||||
|
||||
//*****************************************************************************
|
||||
//
|
||||
// The following are defines for the bit fields in the PERI_MEM_TEST_LOCK register
|
||||
//
|
||||
//*****************************************************************************
|
||||
#define MEMCFG_PERI_MEM_TEST_LOCK_LOCK_PERI_MEM_TEST_CONTROL 0x1U // PERI_MEM_TEST_CONTROL Lock
|
||||
// bit
|
||||
|
||||
//*****************************************************************************
|
||||
//
|
||||
// The following are defines for the bit fields in the PERI_MEM_TEST_CONTROL register
|
||||
//
|
||||
//*****************************************************************************
|
||||
#define MEMCFG_PERI_MEM_TEST_CONTROL_EMAC_TEST_ENABLE 0x1U // EMAC Test mode enable
|
||||
#define MEMCFG_PERI_MEM_TEST_CONTROL_EMAC_MEM_FORCE_ERROR 0x2U // Force Parity Error on EMAC
|
||||
// RAM
|
||||
#define MEMCFG_PERI_MEM_TEST_CONTROL_ETHERCAT_TEST_ENABLE 0x10U // EtherCAT Test mode enable
|
||||
#define MEMCFG_PERI_MEM_TEST_CONTROL_ETHERCAT_MEM_FORCE_ERROR 0x20U // Force Parity Error on
|
||||
// EtherCAT RAM
|
||||
|
||||
//*****************************************************************************
|
||||
//
|
||||
// The following are defines for the bit fields in the UCERRFLG register
|
||||
//
|
||||
//*****************************************************************************
|
||||
#define MEMCFG_UCERRFLG_M4RDERR 0x1U // M4 Uncorrectable Read Error
|
||||
// Flag
|
||||
#define MEMCFG_UCERRFLG_M4WRERR 0x2U // M4 Uncorrectable Write Error
|
||||
// Flag
|
||||
#define MEMCFG_UCERRFLG_EMACRDERR 0x4U // EMAC Uncorrectable Read Error
|
||||
// Flag
|
||||
#define MEMCFG_UCERRFLG_UDMARDERR 0x10U // uDMA Uncorrectable Read Error
|
||||
// Flag
|
||||
#define MEMCFG_UCERRFLG_UDMAWRERR 0x20U // uDMA Uncorrectable Write
|
||||
// Error Flag
|
||||
#define MEMCFG_UCERRFLG_ETHERCATMEMRDERR 0x40U // EtherCAT IP RAM Uncorrectable
|
||||
// Read Error Flag
|
||||
#define MEMCFG_UCERRFLG_EMACMEMRDERR 0x80U // EMAC IP RAM Uncorrectable
|
||||
// Read Error Flag
|
||||
|
||||
//*****************************************************************************
|
||||
//
|
||||
// The following are defines for the bit fields in the UCERRSET register
|
||||
//
|
||||
//*****************************************************************************
|
||||
#define MEMCFG_UCERRSET_M4RDERR 0x1U // M4 Uncorrectable Read Error
|
||||
// Flag Set
|
||||
#define MEMCFG_UCERRSET_M4WRERR 0x2U // M4 Uncorrectable Write Error
|
||||
// Flag Set
|
||||
#define MEMCFG_UCERRSET_EMACRDERR 0x4U // EMAC Uncorrectable Read Error
|
||||
// Flag Set
|
||||
#define MEMCFG_UCERRSET_UDMARDERR 0x10U // uDMA Uncorrectable Read Error
|
||||
// Flag Set
|
||||
#define MEMCFG_UCERRSET_UDMAWRERR 0x20U // uDMA Uncorrectable Write
|
||||
// Error Flag Set
|
||||
#define MEMCFG_UCERRSET_ETHERCATMEMRDERR 0x40U // EtherCAT IP RAM Uncorrectable
|
||||
// Read Error Flag set
|
||||
#define MEMCFG_UCERRSET_EMACMEMRDERR 0x80U // EMAC IP RAM Uncorrectable
|
||||
// Read Error Flag set
|
||||
#define MEMCFG_UCERRSET_KEY_S 16U
|
||||
#define MEMCFG_UCERRSET_KEY_M 0xFFFF0000U // KEY to allow write access
|
||||
|
||||
//*****************************************************************************
|
||||
//
|
||||
// The following are defines for the bit fields in the UCERRCLR register
|
||||
//
|
||||
//*****************************************************************************
|
||||
#define MEMCFG_UCERRCLR_M4RDERR 0x1U // M4 Uncorrectable Read Error
|
||||
// Flag Clear
|
||||
#define MEMCFG_UCERRCLR_M4WRERR 0x2U // M4 Uncorrectable Write Error
|
||||
// Flag Clear
|
||||
#define MEMCFG_UCERRCLR_EMACRDERR 0x4U // EMAC Uncorrectable Read Error
|
||||
// Flag Clear
|
||||
#define MEMCFG_UCERRCLR_UDMARDERR 0x10U // uDMA Uncorrectable Read Error
|
||||
// Flag Clear
|
||||
#define MEMCFG_UCERRCLR_UDMAWRERR 0x20U // uDMA Uncorrectable Write
|
||||
// Error Flag Clear
|
||||
#define MEMCFG_UCERRCLR_ETHERCATMEMRDERR 0x40U // EtherCAT IP RAM Uncorrectable
|
||||
// Read Error Flag Clear
|
||||
#define MEMCFG_UCERRCLR_EMACMEMRDERR 0x80U // EMAC IP RAM Uncorrectable
|
||||
// Read Error Flag Clear
|
||||
#define MEMCFG_UCERRCLR_KEY_S 16U
|
||||
#define MEMCFG_UCERRCLR_KEY_M 0xFFFF0000U // KEY to allow write access
|
||||
|
||||
//*****************************************************************************
|
||||
//
|
||||
// The following are defines for the bit fields in the BUSFAULTFLG register
|
||||
//
|
||||
//*****************************************************************************
|
||||
#define MEMCFG_BUSFAULTFLG_M4BUSFAULT 0x1U // M4 busfault Flag
|
||||
#define MEMCFG_BUSFAULTFLG_UDMABUSFAULT 0x2U // UDMA busfault Flag
|
||||
#define MEMCFG_BUSFAULTFLG_EMACBUSFAULT 0x4U // EMAC busfault Flag
|
||||
|
||||
//*****************************************************************************
|
||||
//
|
||||
// The following are defines for the bit fields in the BUSFAULTCLR register
|
||||
//
|
||||
//*****************************************************************************
|
||||
#define MEMCFG_BUSFAULTCLR_M4BUSFAULT 0x1U // M4 busfault Flag Clear
|
||||
#define MEMCFG_BUSFAULTCLR_UDMABUSFAULT 0x2U // UDMA busfault Flag Clear
|
||||
#define MEMCFG_BUSFAULTCLR_EMACBUSFAULT 0x4U // EMAC busfault Flag Clear
|
||||
#define MEMCFG_BUSFAULTCLR_KEY_S 16U
|
||||
#define MEMCFG_BUSFAULTCLR_KEY_M 0xFFFF0000U // KEY to allow write access
|
||||
|
||||
//*****************************************************************************
|
||||
//
|
||||
// The following are defines for the bit fields in the CERRFLG register
|
||||
//
|
||||
//*****************************************************************************
|
||||
#define MEMCFG_CERRFLG_M4RDERR 0x1U // M4 Correctable Read Error
|
||||
// Flag
|
||||
#define MEMCFG_CERRFLG_M4WRERR 0x2U // M4 Correctable Write Error
|
||||
// Flag
|
||||
#define MEMCFG_CERRFLG_EMACRDERR 0x4U // EMAC Correctable Read Error
|
||||
// Flag
|
||||
#define MEMCFG_CERRFLG_UDMARDERR 0x10U // uDMA Correctable Read Error
|
||||
// Flag
|
||||
#define MEMCFG_CERRFLG_UDMAWRERR 0x20U // uDMA Correctable Write Error
|
||||
// Flag
|
||||
|
||||
//*****************************************************************************
|
||||
//
|
||||
// The following are defines for the bit fields in the CERRSET register
|
||||
//
|
||||
//*****************************************************************************
|
||||
#define MEMCFG_CERRSET_M4RDERR 0x1U // M4 Correctable Read Error
|
||||
// Flag Set
|
||||
#define MEMCFG_CERRSET_M4WRERR 0x2U // M4 Correctable Write Error
|
||||
// Flag Set
|
||||
#define MEMCFG_CERRSET_EMACRDERR 0x4U // EMAC Correctable Read Error
|
||||
// Flag Set
|
||||
#define MEMCFG_CERRSET_UDMARDERR 0x10U // uDMA Correctable Read Error
|
||||
// Flag Set
|
||||
#define MEMCFG_CERRSET_UDMAWRERR 0x20U // uDMA Correctable Write Error
|
||||
// Flag Set
|
||||
#define MEMCFG_CERRSET_KEY_S 16U
|
||||
#define MEMCFG_CERRSET_KEY_M 0xFFFF0000U // KEY to allow write access
|
||||
|
||||
//*****************************************************************************
|
||||
//
|
||||
// The following are defines for the bit fields in the CERRCLR register
|
||||
//
|
||||
//*****************************************************************************
|
||||
#define MEMCFG_CERRCLR_M4RDERR 0x1U // M4 Correctable Read Error
|
||||
// Flag Clear
|
||||
#define MEMCFG_CERRCLR_M4WRERR 0x2U // M4 Correctable Write Error
|
||||
// Flag Clear
|
||||
#define MEMCFG_CERRCLR_EMACRDERR 0x4U // EMAC Correctable Read Error
|
||||
// Flag Clear
|
||||
#define MEMCFG_CERRCLR_UDMARDERR 0x10U // uDMA Correctable Read Error
|
||||
// Flag Clear
|
||||
#define MEMCFG_CERRCLR_UDMAWRERR 0x20U // uDMA Correctable Write Error
|
||||
// Flag Clear
|
||||
#define MEMCFG_CERRCLR_KEY_S 16U
|
||||
#define MEMCFG_CERRCLR_KEY_M 0xFFFF0000U // KEY to allow write access
|
||||
|
||||
//*****************************************************************************
|
||||
//
|
||||
// The following are defines for the bit fields in the CEINTFLG register
|
||||
//
|
||||
//*****************************************************************************
|
||||
#define MEMCFG_CEINTFLG_CEINTFLAG 0x1U // Total corrected error count
|
||||
// exceeded threshold flag.
|
||||
|
||||
//*****************************************************************************
|
||||
//
|
||||
// The following are defines for the bit fields in the CEINTSET register
|
||||
//
|
||||
//*****************************************************************************
|
||||
#define MEMCFG_CEINTSET_CEINTSET 0x1U // Total corrected error count
|
||||
// exceeded flag set.
|
||||
#define MEMCFG_CEINTSET_KEY_S 16U
|
||||
#define MEMCFG_CEINTSET_KEY_M 0xFFFF0000U // KEY to allow write access
|
||||
|
||||
//*****************************************************************************
|
||||
//
|
||||
// The following are defines for the bit fields in the CEINTCLR register
|
||||
//
|
||||
//*****************************************************************************
|
||||
#define MEMCFG_CEINTCLR_CEINTCLR 0x1U // M4 Corrected Error Threshold
|
||||
// Exceeded Error Clear.
|
||||
#define MEMCFG_CEINTCLR_KEY_S 16U
|
||||
#define MEMCFG_CEINTCLR_KEY_M 0xFFFF0000U // KEY to allow write access
|
||||
|
||||
//*****************************************************************************
|
||||
//
|
||||
// The following are defines for the bit fields in the CEINTEN register
|
||||
//
|
||||
//*****************************************************************************
|
||||
#define MEMCFG_CEINTEN_CEINTEN 0x1U // M4 Correctable Error
|
||||
// Interrupt Enable.
|
||||
#define MEMCFG_CEINTEN_KEY_S 16U
|
||||
#define MEMCFG_CEINTEN_KEY_M 0xFFFF0000U // KEY to allow write access
|
||||
|
||||
//*****************************************************************************
|
||||
//
|
||||
// The following are defines for the bit fields in the DIAGERRFLG register
|
||||
//
|
||||
//*****************************************************************************
|
||||
#define MEMCFG_DIAGERRFLG_UCRDERROR 0x1U // Diagnostics Uncorrectable
|
||||
// Read Error Flag
|
||||
#define MEMCFG_DIAGERRFLG_UCWRERROR 0x2U // Diagnostics Uncorrectable
|
||||
// Write Error Flag
|
||||
#define MEMCFG_DIAGERRFLG_CRDERROR 0x4U // Diagnostics Correctable Read
|
||||
// Error Flag
|
||||
#define MEMCFG_DIAGERRFLG_CWRERROR 0x8U // Diagnostics Correctable Write
|
||||
// Error Flag
|
||||
|
||||
//*****************************************************************************
|
||||
//
|
||||
// The following are defines for the bit fields in the DIAGERRCLR register
|
||||
//
|
||||
//*****************************************************************************
|
||||
#define MEMCFG_DIAGERRCLR_UCRDERROR 0x1U // Clear diagnostics
|
||||
// uncorrectable Read Error Flag
|
||||
#define MEMCFG_DIAGERRCLR_UCWRERROR 0x2U // Clear diagnostics
|
||||
// uncorrectable Write Error Flag
|
||||
#define MEMCFG_DIAGERRCLR_CRDERROR 0x4U // Clear diagnostics correctable
|
||||
// Read Error Flag
|
||||
#define MEMCFG_DIAGERRCLR_CWRERROR 0x8U // Clear diagnostics correctable
|
||||
// Write Error Flag
|
||||
#endif
|
||||
+96
@@ -0,0 +1,96 @@
|
||||
//###########################################################################
|
||||
//
|
||||
// FILE: hw_memmap.h
|
||||
//
|
||||
// TITLE: Macros defining the memory map of the CM4.
|
||||
//
|
||||
//###########################################################################
|
||||
// $Copyright:
|
||||
// Copyright (C) 2016 Texas Instruments Incorporated - http://www.ti.com/
|
||||
//
|
||||
// Redistribution and use in source and binary forms, with or without
|
||||
// modification, are permitted provided that the following conditions
|
||||
// are met:
|
||||
//
|
||||
// Redistributions of source code must retain the above copyright
|
||||
// notice, this list of conditions and the following disclaimer.
|
||||
//
|
||||
// Redistributions in binary form must reproduce the above copyright
|
||||
// notice, this list of conditions and the following disclaimer in the
|
||||
// documentation and/or other materials provided with the
|
||||
// distribution.
|
||||
//
|
||||
// Neither the name of Texas Instruments Incorporated nor the names of
|
||||
// its contributors may be used to endorse or promote products derived
|
||||
// from this software without specific prior written permission.
|
||||
//
|
||||
// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
|
||||
// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
|
||||
// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
|
||||
// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
|
||||
// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
|
||||
// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
|
||||
// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
|
||||
// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
|
||||
// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
||||
// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
|
||||
// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
// $
|
||||
//###########################################################################
|
||||
|
||||
#ifndef HW_MEMMAP_H
|
||||
#define HW_MEMMAP_H
|
||||
|
||||
#define WD_BASE 0x40080000U // Windowed Watchdog Registers
|
||||
#define NMI_BASE 0x40081000U // CMNMI Registers
|
||||
#define CMSYSCTL_BASE 0x400FC000U // CMSystem Config Registers
|
||||
#define NVIC_BASE 0xE000E000U // NVIC Registers
|
||||
#define UDMA_BASE 0x400FF000U // uDMA Registers
|
||||
#define UART0_BASE 0x4000C000U // UART0 Registers
|
||||
#define SSI0_BASE 0x40008000U // SSI0 Registers
|
||||
#define I2C0_BASE 0x40020000U // I2C0 Registers
|
||||
#define GCRC_BASE 0x40040000U // GCRC Registers
|
||||
#define AES_BASE 0x4004A000U // AES IP Registers
|
||||
#define AESW_BASE 0x4004AC00U // AES Wrapper Registers
|
||||
#define EMAC_BASE 0x400C0000U //EMAC
|
||||
#define EMAC_SS_BASE 0x400C2000U //EMACSS
|
||||
#define MCAN0_BASE 0x40078000U //MCAN0
|
||||
#define CMMEMCFG_BASE 0x400FE000U // CM Mem Init & Test Registers
|
||||
#define CMMEMORYERROR_BASE 0x400FE400U // CM Error Log Registers
|
||||
#define CMMEMORYDIAGERROR_BASE 0x400FE800U // CM Diag Error Log Registers
|
||||
#define C1RAM_BASE 0x1FFFC000U // C1RAM
|
||||
#define C0RAM_BASE 0x1FFFE000U // C0RAM
|
||||
#define S0RAM_BASE 0x20000000U // S0RAM
|
||||
#define S1RAM_BASE 0x20004000U // S1RAM
|
||||
#define S2RAM_BASE 0x20008000U // S2RAM
|
||||
#define S3RAM_BASE 0x2000C000U // S3RAM
|
||||
#define S4RAM_BASE 0x20010000U // S4RAM
|
||||
#define CPU1TOCMMSGRAM0_BASE 0x20080000U // CPU1TOCMMSGRAM0
|
||||
#define CPU1TOCMMSGRAM1_BASE 0x20080800U // CPU1TOCMMSGRAM1
|
||||
#define CMTOCPU1MSGRAM0_BASE 0x20082000U // CMTOCPU1MSGRAM0
|
||||
#define CMTOCPU1MSGRAM1_BASE 0x20082800U // CMTOCPU1MSGRAM1
|
||||
#define CPU2TOCMMSGRAM0_BASE 0x20084000U // CPU2TOCMMSGRAM0
|
||||
#define CPU2TOCMMSGRAM1_BASE 0x20084800U // CPU2TOCMMSGRAM1
|
||||
#define CMTOCPU2MSGRAM0_BASE 0x20086000U // CMTOCPU2MSGRAM0
|
||||
#define CMTOCPU2MSGRAM1_BASE 0x20086800U // CMTOCPU2MSGRAM1
|
||||
#define DMPU_BASE 0x400CC000U // uDMA MPU Registers
|
||||
#define EMPU_BASE 0x400CD000U // Ethernet MPU Registers
|
||||
#define CANA_BASE 0x40070000U // CAN-A Registers
|
||||
#define CANB_BASE 0x40074000U // CAN-B Registers
|
||||
#define IPC_CMTOCPU1_BASE 0x400FD000U
|
||||
#define IPC_CMTOCPU2_BASE 0x400FD080U
|
||||
#define DCSM_Z1_BASE 0x40085000U // Zone 1 DCSM Registers
|
||||
#define DCSM_Z2_BASE 0x40085100U // Zone 2 DCSM Registers
|
||||
#define DCSMCOMMON_BASE 0x40085180U // Security Registers
|
||||
#define ECAT_SS_BASE 0x400AFC00U // Ethercat Sub-System Registers
|
||||
#define ECAT_SS_CONFIG_BASE 0x400AFE00U // Ethercat Sub-System configuration Registers
|
||||
#define GPIODATA_BASE 0x40083000U // GPIO Data Registers
|
||||
#define GPIODATAREAD_BASE 0x40083100U // GPIO Data Registers
|
||||
#define CPUTIMER0_BASE 0x40084000U // CPUTIMER0 Registers
|
||||
#define CPUTIMER1_BASE 0x40084010U // CPUTIMER1 Registers
|
||||
#define CPUTIMER2_BASE 0x40084020U // CPUTIMER2 Registers
|
||||
#define FLASH0CTRL_BASE 0x400FA000U // Flash control registers
|
||||
#define FLASH0ECC_BASE 0x400FA600U // Flash ECC error log registers
|
||||
|
||||
#endif // HW_MEMMAP_H
|
||||
|
||||
+146
@@ -0,0 +1,146 @@
|
||||
//###########################################################################
|
||||
//
|
||||
// FILE: hw_nmi.h
|
||||
//
|
||||
// TITLE: Definitions for the NMI registers.
|
||||
//
|
||||
//###########################################################################
|
||||
// $TI Release: $
|
||||
// $Release Date: $
|
||||
//
|
||||
// C2000Ware v5.04.00.00
|
||||
//
|
||||
// Copyright (C) 2024 Texas Instruments Incorporated - http://www.ti.com
|
||||
//
|
||||
// Redistribution and use in source and binary forms, with or without
|
||||
// modification, are permitted provided that the following conditions
|
||||
// are met:
|
||||
//
|
||||
// Redistributions of source code must retain the above copyright
|
||||
// notice, this list of conditions and the following disclaimer.
|
||||
//
|
||||
// Redistributions in binary form must reproduce the above copyright
|
||||
// notice, this list of conditions and the following disclaimer in the
|
||||
// documentation and/or other materials provided with the
|
||||
// distribution.
|
||||
//
|
||||
// Neither the name of Texas Instruments Incorporated nor the names of
|
||||
// its contributors may be used to endorse or promote products derived
|
||||
// from this software without specific prior written permission.
|
||||
//
|
||||
// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
|
||||
// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
|
||||
// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
|
||||
// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
|
||||
// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
|
||||
// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
|
||||
// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
|
||||
// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
|
||||
// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
||||
// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
|
||||
// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
// $
|
||||
//###########################################################################
|
||||
|
||||
#ifndef HW_NMI_H
|
||||
#define HW_NMI_H
|
||||
|
||||
//*****************************************************************************
|
||||
//
|
||||
// The following are defines for the NMI register offsets
|
||||
//
|
||||
//*****************************************************************************
|
||||
#define NMI_O_CMNMICFG 0x0U // CM NMI Configuration Register
|
||||
#define NMI_O_CMNMIFLG 0x4U // CM NMI Flag Register
|
||||
#define NMI_O_CMNMIFLGCLR 0x8U // CMNMI Flag Clear Register
|
||||
#define NMI_O_CMNMIFLGFRC 0xCU // CMNMI Flag Force Register
|
||||
#define NMI_O_CMNMIWDCNT 0x10U // CMNMI Watchdog Counter
|
||||
// Register
|
||||
#define NMI_O_CMNMIWDPRD 0x14U // CMNMI Watchdog Period
|
||||
// Register
|
||||
#define NMI_O_CMNMISHDWFLG 0x18U // CMNMI Shadow Flag Register
|
||||
|
||||
//*****************************************************************************
|
||||
//
|
||||
// The following are defines for the bit fields in the CMNMICFG register
|
||||
//
|
||||
//*****************************************************************************
|
||||
#define NMI_CMNMICFG_NMIE 0x1U // Global NMI Enable
|
||||
#define NMI_CMNMICFG_KEY_S 16U
|
||||
#define NMI_CMNMICFG_KEY_M 0xFFFF0000U // Key protection
|
||||
|
||||
//*****************************************************************************
|
||||
//
|
||||
// The following are defines for the bit fields in the CMNMIFLG register
|
||||
//
|
||||
//*****************************************************************************
|
||||
#define NMI_CMNMIFLG_NMIINT 0x1U // NMI Interrupt Flag
|
||||
#define NMI_CMNMIFLG_CLOCKFAIL 0x2U // Clock Fail Interrupt Flag
|
||||
#define NMI_CMNMIFLG_MEMUNCERR 0x4U // RAM, ROM Uncorrectable Error
|
||||
// NMI Flag
|
||||
#define NMI_CMNMIFLG_FLUNCERR 0x8U // Flash Uncorrectable Error NMI
|
||||
// Flag
|
||||
#define NMI_CMNMIFLG_MCANUNCERR 0x10U // MCAN Uncorrectable Error NMI
|
||||
// Flag
|
||||
#define NMI_CMNMIFLG_WWDNMI 0x20U // CM WWD NMI flag
|
||||
#define NMI_CMNMIFLG_ECATNMI 0x40U // NMI from EtherCAT reset out
|
||||
|
||||
//*****************************************************************************
|
||||
//
|
||||
// The following are defines for the bit fields in the CMNMIFLGCLR register
|
||||
//
|
||||
//*****************************************************************************
|
||||
#define NMI_CMNMIFLGCLR_NMIINT 0x1U // NMIINT Flag Clear
|
||||
#define NMI_CMNMIFLGCLR_CLOCKFAIL 0x2U // CLOCKFAIL Flag Clear
|
||||
#define NMI_CMNMIFLGCLR_MEMUNCERR 0x4U // MEMUNCERR Flag Clear
|
||||
#define NMI_CMNMIFLGCLR_FLUNCERR 0x8U // FLUNCERR Flag Clear
|
||||
#define NMI_CMNMIFLGCLR_MCANUNCERR 0x10U // MCANUNCERR Flag Clear
|
||||
#define NMI_CMNMIFLGCLR_WWDNMI 0x20U // WWDNMI Flag Clear
|
||||
#define NMI_CMNMIFLGCLR_ECATNMI 0x40U // ECATNMI Flag Clear
|
||||
#define NMI_CMNMIFLGCLR_KEY_S 16U
|
||||
#define NMI_CMNMIFLGCLR_KEY_M 0xFFFF0000U // Key protection
|
||||
|
||||
//*****************************************************************************
|
||||
//
|
||||
// The following are defines for the bit fields in the CMNMIFLGFRC register
|
||||
//
|
||||
//*****************************************************************************
|
||||
#define NMI_CMNMIFLGFRC_CLOCKFAIL 0x2U // CLOCKFAIL Flag Force
|
||||
#define NMI_CMNMIFLGFRC_MEMUNCERR 0x4U // MEMUNCERR Flag Force
|
||||
#define NMI_CMNMIFLGFRC_FLUNCERR 0x8U // FLUNCERR Flag Force
|
||||
#define NMI_CMNMIFLGFRC_MCANUNCERR 0x10U // MCANUNCERR Flag Force
|
||||
#define NMI_CMNMIFLGFRC_WWDNMI 0x20U // WWDNMI Flag Force
|
||||
#define NMI_CMNMIFLGFRC_ECATNMI 0x40U // ECATNMI Flag Force
|
||||
#define NMI_CMNMIFLGFRC_KEY_S 16U
|
||||
#define NMI_CMNMIFLGFRC_KEY_M 0xFFFF0000U // Key protection
|
||||
|
||||
//*****************************************************************************
|
||||
//
|
||||
// The following are defines for the bit fields in the CMNMIWDCNT register
|
||||
//
|
||||
//*****************************************************************************
|
||||
#define NMI_CMNMIWDCNT_NMIWDCNT_S 0U
|
||||
#define NMI_CMNMIWDCNT_NMIWDCNT_M 0xFFFFU // NMI Watchdog Counter
|
||||
|
||||
//*****************************************************************************
|
||||
//
|
||||
// The following are defines for the bit fields in the CMNMIWDPRD register
|
||||
//
|
||||
//*****************************************************************************
|
||||
#define NMI_CMNMIWDPRD_NMIWDPRD_S 0U
|
||||
#define NMI_CMNMIWDPRD_NMIWDPRD_M 0xFFFFU // NMI Watchdog Period
|
||||
#define NMI_CMNMIWDPRD_KEY_S 16U
|
||||
#define NMI_CMNMIWDPRD_KEY_M 0xFFFF0000U // Key protection
|
||||
|
||||
//*****************************************************************************
|
||||
//
|
||||
// The following are defines for the bit fields in the CMNMISHDWFLG register
|
||||
//
|
||||
//*****************************************************************************
|
||||
#define NMI_CMNMISHDWFLG_CLOCKFAIL 0x2U // CLOCKFAIL Shadow flag
|
||||
#define NMI_CMNMISHDWFLG_MEMUNCERR 0x4U // MEMUNCERR Shadow flag
|
||||
#define NMI_CMNMISHDWFLG_FLUNCERR 0x8U // FLUNCERR Shadow flag
|
||||
#define NMI_CMNMISHDWFLG_MCANUNCERR 0x10U // MCANUNCERR Shadow flag
|
||||
#define NMI_CMNMISHDWFLG_WWDNMI 0x20U // WWDNMI Shadow flag
|
||||
#define NMI_CMNMISHDWFLG_ECATNMI 0x40U // ECATNMI Shadow flag
|
||||
#endif
|
||||
+1263
File diff suppressed because it is too large.
Load diff
+343
@@ -0,0 +1,343 @@
|
||||
//###########################################################################
|
||||
//
|
||||
// FILE: hw_ssi.h
|
||||
//
|
||||
// TITLE: Definitions for the SSI registers.
|
||||
//
|
||||
//###########################################################################
|
||||
// $TI Release: $
|
||||
// $Release Date: $
|
||||
//
|
||||
// C2000Ware v5.04.00.00
|
||||
//
|
||||
// Copyright (C) 2024 Texas Instruments Incorporated - http://www.ti.com
|
||||
//
|
||||
// Redistribution and use in source and binary forms, with or without
|
||||
// modification, are permitted provided that the following conditions
|
||||
// are met:
|
||||
//
|
||||
// Redistributions of source code must retain the above copyright
|
||||
// notice, this list of conditions and the following disclaimer.
|
||||
//
|
||||
// Redistributions in binary form must reproduce the above copyright
|
||||
// notice, this list of conditions and the following disclaimer in the
|
||||
// documentation and/or other materials provided with the
|
||||
// distribution.
|
||||
//
|
||||
// Neither the name of Texas Instruments Incorporated nor the names of
|
||||
// its contributors may be used to endorse or promote products derived
|
||||
// from this software without specific prior written permission.
|
||||
//
|
||||
// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
|
||||
// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
|
||||
// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
|
||||
// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
|
||||
// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
|
||||
// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
|
||||
// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
|
||||
// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
|
||||
// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
||||
// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
|
||||
// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
// $
|
||||
//###########################################################################
|
||||
|
||||
#ifndef HW_SSI_H
|
||||
#define HW_SSI_H
|
||||
|
||||
//*****************************************************************************
|
||||
//
|
||||
// The following are defines for the SSI register offsets
|
||||
//
|
||||
//*****************************************************************************
|
||||
#define SSI_O_CR0 0x0U // SSI Control 0
|
||||
#define SSI_O_CR1 0x4U // SSI Control 1
|
||||
#define SSI_O_DR 0x8U // SSI Data
|
||||
#define SSI_O_SR 0xCU // SSI Status
|
||||
#define SSI_O_CPSR 0x10U // SSI Clock Prescale
|
||||
#define SSI_O_IM 0x14U // SSI Interrupt Mask
|
||||
#define SSI_O_RIS 0x18U // SSI Raw Interrupt Status
|
||||
#define SSI_O_MIS 0x1CU // SSI Masked Interrupt
|
||||
// Status
|
||||
#define SSI_O_ICR 0x20U // SSI Interrupt Clear
|
||||
#define SSI_O_DMACTL 0x24U // SSI DMA Control
|
||||
#define SSI_O_PV 0xFB0U // SSI Peripheral Version
|
||||
#define SSI_O_PP 0xFC0U // SSI Peripheral Properties
|
||||
#define SSI_O_PERIPHID4 0xFD0U // SSI Peripheral
|
||||
// Identification 4
|
||||
#define SSI_O_PERIPHID5 0xFD4U // SSI Peripheral
|
||||
// Identification 5
|
||||
#define SSI_O_PERIPHID6 0xFD8U // SSI Peripheral
|
||||
// Identification 6
|
||||
#define SSI_O_PERIPHID7 0xFDCU // SSI Peripheral
|
||||
// Identification 7
|
||||
#define SSI_O_PERIPHID0 0xFE0U // SSI Peripheral
|
||||
// Identification 0
|
||||
#define SSI_O_PERIPHID1 0xFE4U // SSI Peripheral
|
||||
// Identification 1
|
||||
#define SSI_O_PERIPHID2 0xFE8U // SSI Peripheral
|
||||
// Identification 2
|
||||
#define SSI_O_PERIPHID3 0xFECU // SSI Peripheral
|
||||
// Identification 3
|
||||
#define SSI_O_PCELLID0 0xFF0U // SSI PrimeCell
|
||||
// Identification 0
|
||||
#define SSI_O_PCELLID1 0xFF4U // SSI PrimeCell
|
||||
// Identification 1
|
||||
#define SSI_O_PCELLID2 0xFF8U // SSI PrimeCell
|
||||
// Identification 2
|
||||
#define SSI_O_PCELLID3 0xFFCU // SSI PrimeCell
|
||||
// Identification 3
|
||||
|
||||
//*****************************************************************************
|
||||
//
|
||||
// The following are defines for the bit fields in the SSICR0 register
|
||||
//
|
||||
//*****************************************************************************
|
||||
#define SSI_CR0_DSS_S 0U
|
||||
#define SSI_CR0_DSS_M 0xFU // SSI Data Size Select
|
||||
#define SSI_CR0_FRF_S 4U
|
||||
#define SSI_CR0_FRF_M 0x30U // SSI FRame Format Select
|
||||
#define SSI_CR0_SPO 0x40U // SSI Serial clock POlarity
|
||||
#define SSI_CR0_SPH 0x80U // SSI Serial clock PHase
|
||||
#define SSI_CR0_SCR_S 8U
|
||||
#define SSI_CR0_SCR_M 0xFF00U // SSI Serial Clock Rate
|
||||
|
||||
//*****************************************************************************
|
||||
//
|
||||
// The following are defines for the bit fields in the SSICR1 register
|
||||
//
|
||||
//*****************************************************************************
|
||||
#define SSI_CR1_LBM 0x1U // SSI Loopback Mode
|
||||
#define SSI_CR1_SSE 0x2U // SSI Synchronous Serial Port
|
||||
// Enable
|
||||
#define SSI_CR1_MS 0x4U // SSI Master/Slave Select
|
||||
#define SSI_CR1_DIR 0x100U // SSI Direction of Operation
|
||||
#define SSI_CR1_FSSHLDFRM 0x400U // FSS Hold Frame
|
||||
|
||||
//*****************************************************************************
|
||||
//
|
||||
// The following are defines for the bit fields in the SSIDR register
|
||||
//
|
||||
//*****************************************************************************
|
||||
#define SSI_DR_DATA_S 0U
|
||||
#define SSI_DR_DATA_M 0xFFFFU // SSI Receive/Transmit Data
|
||||
|
||||
//*****************************************************************************
|
||||
//
|
||||
// The following are defines for the bit fields in the SSISR register
|
||||
//
|
||||
//*****************************************************************************
|
||||
#define SSI_SR_TFE 0x1U // SSI Transmit FIFO Empty
|
||||
#define SSI_SR_TNF 0x2U // SSI Transmit FIFO Not Full
|
||||
#define SSI_SR_RNE 0x4U // SSI Receive FIFO Not Empty
|
||||
#define SSI_SR_RFF 0x8U // SSI Receive FIFO Full
|
||||
#define SSI_SR_BSY 0x10U // SSI Busy Bit
|
||||
|
||||
//*****************************************************************************
|
||||
//
|
||||
// The following are defines for the bit fields in the SSICPSR register
|
||||
//
|
||||
//*****************************************************************************
|
||||
#define SSI_CPSR_CPSDVSR_S 0U
|
||||
#define SSI_CPSR_CPSDVSR_M 0xFFU // SSI Clock Prescale Divisor
|
||||
|
||||
//*****************************************************************************
|
||||
//
|
||||
// The following are defines for the bit fields in the SSIIM register
|
||||
//
|
||||
//*****************************************************************************
|
||||
#define SSI_IM_RORIM 0x1U // SSI Receive Overrun Interrupt
|
||||
// Mask
|
||||
#define SSI_IM_RTIM 0x2U // SSI Receive Time-Out
|
||||
// Interrupt Mask
|
||||
#define SSI_IM_RXIM 0x4U // SSI Receive FIFO Interrupt
|
||||
// Mask
|
||||
#define SSI_IM_TXIM 0x8U // SSI Transmit FIFO Interrupt
|
||||
// Mask
|
||||
#define SSI_IM_DMARXIM 0x10U // SSI Receive DMA Interrupt
|
||||
// Mask
|
||||
#define SSI_IM_DMATXIM 0x20U // SSI Transmit DMA Interrupt
|
||||
// Mask
|
||||
#define SSI_IM_EOTIM 0x40U // End of Transmit Interrupt
|
||||
// Mask
|
||||
|
||||
//*****************************************************************************
|
||||
//
|
||||
// The following are defines for the bit fields in the SSIRIS register
|
||||
//
|
||||
//*****************************************************************************
|
||||
#define SSI_RIS_RORRIS 0x1U // SSI Receive Overrun Raw
|
||||
// Interrupt Status
|
||||
#define SSI_RIS_RTRIS 0x2U // SSI Receive Time-Out Raw
|
||||
// Interrupt Status
|
||||
#define SSI_RIS_RXRIS 0x4U // SSI Receive FIFO Raw
|
||||
// Interrupt Status
|
||||
#define SSI_RIS_TXRIS 0x8U // SSI Transmit FIFO Raw
|
||||
// Interrupt Status
|
||||
#define SSI_RIS_DMARXRIS 0x10U // SSI Receive DMA Raw Interrupt
|
||||
// Status
|
||||
#define SSI_RIS_DMATXRIS 0x20U // SSI Transmit DMA Raw
|
||||
// Interrupt Status
|
||||
#define SSI_RIS_EOTRIS 0x40U // End of Transmit Raw Interrupt
|
||||
// Status
|
||||
|
||||
//*****************************************************************************
|
||||
//
|
||||
// The following are defines for the bit fields in the SSIMIS register
|
||||
//
|
||||
//*****************************************************************************
|
||||
#define SSI_MIS_RORMIS 0x1U // SSI Receive Overrun Masked
|
||||
// Interrupt Status
|
||||
#define SSI_MIS_RTMIS 0x2U // SSI Receive Time-Out Masked
|
||||
// Interrupt Status
|
||||
#define SSI_MIS_RXMIS 0x4U // SSI Receive FIFO Masked
|
||||
// Interrupt Status
|
||||
#define SSI_MIS_TXMIS 0x8U // SSI Transmit FIFO Masked
|
||||
// Interrupt Status
|
||||
#define SSI_MIS_DMARXMIS 0x10U // SSI Receive DMA Masked
|
||||
// Interrupt Status
|
||||
#define SSI_MIS_DMATXMIS 0x20U // SSI Transmit DMA Masked
|
||||
// Interrupt Status
|
||||
#define SSI_MIS_EOTMIS 0x40U // End of Transmit Masked
|
||||
// Interrupt Status
|
||||
|
||||
//*****************************************************************************
|
||||
//
|
||||
// The following are defines for the bit fields in the SSIICR register
|
||||
//
|
||||
//*****************************************************************************
|
||||
#define SSI_ICR_RORIC 0x1U // SSI Receive Overrun Interrupt
|
||||
// Clear
|
||||
#define SSI_ICR_RTIC 0x2U // SSI Receive Time-Out
|
||||
// Interrupt Clear
|
||||
#define SSI_ICR_DMARXIC 0x10U // SSI Receive DMA Interrupt
|
||||
// Clear
|
||||
#define SSI_ICR_DMATXIC 0x20U // SSI Transmit DMA Interrupt
|
||||
// Clear
|
||||
#define SSI_ICR_EOTIC 0x40U // End of Transmit Interrupt
|
||||
// Clear
|
||||
|
||||
//*****************************************************************************
|
||||
//
|
||||
// The following are defines for the bit fields in the SSIDMACTL register
|
||||
//
|
||||
//*****************************************************************************
|
||||
#define SSI_DMACTL_RXDMAE 0x1U // Receive DMA Enable
|
||||
#define SSI_DMACTL_TXDMAE 0x2U // Transmit DMA Enable
|
||||
|
||||
//*****************************************************************************
|
||||
//
|
||||
// The following are defines for the bit fields in the SSIPV register
|
||||
//
|
||||
//*****************************************************************************
|
||||
#define SSI_PV_MINOR_S 0U
|
||||
#define SSI_PV_MINOR_M 0xFFU // Minor Revision
|
||||
#define SSI_PV_MAJOR_S 8U
|
||||
#define SSI_PV_MAJOR_M 0xFF00U // Major Revision
|
||||
|
||||
//*****************************************************************************
|
||||
//
|
||||
// The following are defines for the bit fields in the SSIPP register
|
||||
//
|
||||
//*****************************************************************************
|
||||
#define SSI_PP_HSCLK 0x1U // High Speed Capability
|
||||
#define SSI_PP_MODE_S 1U
|
||||
#define SSI_PP_MODE_M 0x6U // Mode of Operation
|
||||
#define SSI_PP_FSSHLDFRM 0x8U // SSInFss Hold Frame Capability
|
||||
|
||||
//*****************************************************************************
|
||||
//
|
||||
// The following are defines for the bit fields in the SSIPERIPHID4 register
|
||||
//
|
||||
//*****************************************************************************
|
||||
#define SSI_PERIPHID4_PID4_S 0U
|
||||
#define SSI_PERIPHID4_PID4_M 0xFFU // SSI Peripheral ID Register
|
||||
|
||||
//*****************************************************************************
|
||||
//
|
||||
// The following are defines for the bit fields in the SSIPERIPHID5 register
|
||||
//
|
||||
//*****************************************************************************
|
||||
#define SSI_PERIPHID5_PID5_S 0U
|
||||
#define SSI_PERIPHID5_PID5_M 0xFFU // SSI Peripheral ID Register
|
||||
|
||||
//*****************************************************************************
|
||||
//
|
||||
// The following are defines for the bit fields in the SSIPERIPHID6 register
|
||||
//
|
||||
//*****************************************************************************
|
||||
#define SSI_PERIPHID6_PID6_S 0U
|
||||
#define SSI_PERIPHID6_PID6_M 0xFFU // SSI Peripheral ID Register
|
||||
|
||||
//*****************************************************************************
|
||||
//
|
||||
// The following are defines for the bit fields in the SSIPERIPHID7 register
|
||||
//
|
||||
//*****************************************************************************
|
||||
#define SSI_PERIPHID7_PID7_S 0U
|
||||
#define SSI_PERIPHID7_PID7_M 0xFFU // SSI Peripheral ID Register
|
||||
|
||||
//*****************************************************************************
|
||||
//
|
||||
// The following are defines for the bit fields in the SSIPERIPHID0 register
|
||||
//
|
||||
//*****************************************************************************
|
||||
#define SSI_PERIPHID0_PID0_S 0U
|
||||
#define SSI_PERIPHID0_PID0_M 0xFFU // SSI Peripheral ID Register
|
||||
|
||||
//*****************************************************************************
|
||||
//
|
||||
// The following are defines for the bit fields in the SSIPERIPHID1 register
|
||||
//
|
||||
//*****************************************************************************
|
||||
#define SSI_PERIPHID1_PID1_S 0U
|
||||
#define SSI_PERIPHID1_PID1_M 0xFFU // SSI Peripheral ID Register
|
||||
|
||||
//*****************************************************************************
|
||||
//
|
||||
// The following are defines for the bit fields in the SSIPERIPHID2 register
|
||||
//
|
||||
//*****************************************************************************
|
||||
#define SSI_PERIPHID2_PID2_S 0U
|
||||
#define SSI_PERIPHID2_PID2_M 0xFFU // SSI Peripheral ID Register
|
||||
|
||||
//*****************************************************************************
|
||||
//
|
||||
// The following are defines for the bit fields in the SSIPERIPHID3 register
|
||||
//
|
||||
//*****************************************************************************
|
||||
#define SSI_PERIPHID3_PID3_S 0U
|
||||
#define SSI_PERIPHID3_PID3_M 0xFFU // SSI Peripheral ID Register
|
||||
|
||||
//*****************************************************************************
|
||||
//
|
||||
// The following are defines for the bit fields in the SSIPCELLID0 register
|
||||
//
|
||||
//*****************************************************************************
|
||||
#define SSI_PCELLID0_CID0_S 0U
|
||||
#define SSI_PCELLID0_CID0_M 0xFFU // SSI PrimeCell ID Register
|
||||
|
||||
//*****************************************************************************
|
||||
//
|
||||
// The following are defines for the bit fields in the SSIPCELLID1 register
|
||||
//
|
||||
//*****************************************************************************
|
||||
#define SSI_PCELLID1_CID1_S 0U
|
||||
#define SSI_PCELLID1_CID1_M 0xFFU // SSI PrimeCell ID Register
|
||||
|
||||
//*****************************************************************************
|
||||
//
|
||||
// The following are defines for the bit fields in the SSIPCELLID2 register
|
||||
//
|
||||
//*****************************************************************************
|
||||
#define SSI_PCELLID2_CID2_S 0U
|
||||
#define SSI_PCELLID2_CID2_M 0xFFU // SSI PrimeCell ID Register
|
||||
|
||||
//*****************************************************************************
|
||||
//
|
||||
// The following are defines for the bit fields in the SSIPCELLID3 register
|
||||
//
|
||||
//*****************************************************************************
|
||||
#define SSI_PCELLID3_CID3_S 0U
|
||||
#define SSI_PCELLID3_CID3_M 0xFFU // SSI PrimeCell ID Register
|
||||
#endif
|
||||
+290
@@ -0,0 +1,290 @@
|
||||
//###########################################################################
|
||||
//
|
||||
// FILE: hw_sysctl.h
|
||||
//
|
||||
// TITLE: Definitions for the SYSCTL registers.
|
||||
//
|
||||
//###########################################################################
|
||||
// $TI Release: $
|
||||
// $Release Date: $
|
||||
//
|
||||
// C2000Ware v5.04.00.00
|
||||
//
|
||||
// Copyright (C) 2024 Texas Instruments Incorporated - http://www.ti.com
|
||||
//
|
||||
// Redistribution and use in source and binary forms, with or without
|
||||
// modification, are permitted provided that the following conditions
|
||||
// are met:
|
||||
//
|
||||
// Redistributions of source code must retain the above copyright
|
||||
// notice, this list of conditions and the following disclaimer.
|
||||
//
|
||||
// Redistributions in binary form must reproduce the above copyright
|
||||
// notice, this list of conditions and the following disclaimer in the
|
||||
// documentation and/or other materials provided with the
|
||||
// distribution.
|
||||
//
|
||||
// Neither the name of Texas Instruments Incorporated nor the names of
|
||||
// its contributors may be used to endorse or promote products derived
|
||||
// from this software without specific prior written permission.
|
||||
//
|
||||
// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
|
||||
// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
|
||||
// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
|
||||
// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
|
||||
// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
|
||||
// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
|
||||
// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
|
||||
// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
|
||||
// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
||||
// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
|
||||
// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
// $
|
||||
//###########################################################################
|
||||
|
||||
#ifndef HW_SYSCTL_H
|
||||
#define HW_SYSCTL_H
|
||||
|
||||
//*****************************************************************************
|
||||
//
|
||||
// The following are defines for the SYSCTL register offsets
|
||||
//
|
||||
//*****************************************************************************
|
||||
#define SYSCTL_O_CMPCLKCR0 0x0U // CM Peripheral clock gating
|
||||
// register 0.
|
||||
#define SYSCTL_O_CMPCLKCR1 0x4U // CM Peripheral clock gating
|
||||
// register 1.
|
||||
#define SYSCTL_O_CMPCLKCR2 0x8U // CM Peripheral clock gating
|
||||
// register 2.
|
||||
#define SYSCTL_O_CMSOFTPRESET0 0x20U // CM Software Peripheral Reset
|
||||
// register 0
|
||||
#define SYSCTL_O_CMSOFTPRESET1 0x24U // CM Software Peripheral Reset
|
||||
// register 1
|
||||
#define SYSCTL_O_CMSOFTPRESET2 0x28U // CM Software Peripheral Reset
|
||||
// register 2
|
||||
#define SYSCTL_O_CMCLKSTOPREQ0 0x40U // Peripheral Clock Stop Request
|
||||
// Register 0
|
||||
#define SYSCTL_O_CMCLKSTOPREQ1 0x44U // Peripheral Clock Stop Request
|
||||
// Register 1
|
||||
#define SYSCTL_O_CMCLKSTOPREQ2 0x48U // Peripheral Clock Stop Request
|
||||
// Register 2
|
||||
#define SYSCTL_O_CMCLKSTOPACK1 0x64U // Peripheral Clock Stop
|
||||
// Ackonwledge Register 1
|
||||
#define SYSCTL_O_MCANWAKESTATUS 0xE0U // MCAN Wake Status Register
|
||||
#define SYSCTL_O_MCANWAKESTATUSCLR 0xE4U // MCAN Wake Status Clear
|
||||
// Register
|
||||
#define SYSCTL_O_CMECATCTL 0x100U // CM etherCAT control register
|
||||
#define SYSCTL_O_PALLOCATESTS 0x1F4U // Status of PALLOCATE register.
|
||||
#define SYSCTL_O_CMRESCCLR 0x1F8U // CM Reset Cause Status Clear
|
||||
// Register
|
||||
#define SYSCTL_O_CMRESC 0x1FCU // CM Reset Cause Status
|
||||
// Register
|
||||
#define SYSCTL_O_CMSYSCTLLOCK 0x200U // Locks the configuration
|
||||
// registers of CM System control
|
||||
|
||||
//*****************************************************************************
|
||||
//
|
||||
// The following are defines for the bit fields in the CMPCLKCR0 register
|
||||
//
|
||||
//*****************************************************************************
|
||||
#define SYSCTL_CMPCLKCR0_UART0 0x1U // UART0 Clock gating Bit
|
||||
#define SYSCTL_CMPCLKCR0_SSI0 0x10U // SSI0 Clock gating Bit
|
||||
#define SYSCTL_CMPCLKCR0_I2C0 0x100U // I2C0 Clock gating Bit
|
||||
#define SYSCTL_CMPCLKCR0_USB 0x1000U // USB Clock gating Bit
|
||||
#define SYSCTL_CMPCLKCR0_KEY_S 16U
|
||||
#define SYSCTL_CMPCLKCR0_KEY_M 0xFFFF0000U // Key field
|
||||
|
||||
//*****************************************************************************
|
||||
//
|
||||
// The following are defines for the bit fields in the CMPCLKCR1 register
|
||||
//
|
||||
//*****************************************************************************
|
||||
#define SYSCTL_CMPCLKCR1_ETHERNET 0x1U // ETHERNET Clock gating Bit
|
||||
#define SYSCTL_CMPCLKCR1_ETHERCAT 0x4U // ETHERCAT Clock gating Bit
|
||||
#define SYSCTL_CMPCLKCR1_CAN_A 0x10U // CAN_A Clock gating Bit
|
||||
#define SYSCTL_CMPCLKCR1_CAN_B 0x20U // CAN_B Clock gating Bit
|
||||
#define SYSCTL_CMPCLKCR1_MCAN_A 0x100U // MCAN_A Clock gating Bit
|
||||
#define SYSCTL_CMPCLKCR1_KEY_S 16U
|
||||
#define SYSCTL_CMPCLKCR1_KEY_M 0xFFFF0000U // Key field
|
||||
|
||||
//*****************************************************************************
|
||||
//
|
||||
// The following are defines for the bit fields in the CMPCLKCR2 register
|
||||
//
|
||||
//*****************************************************************************
|
||||
#define SYSCTL_CMPCLKCR2_CPUTIMER1 0x1U // CPUTIMER1 Clock gating Bit
|
||||
#define SYSCTL_CMPCLKCR2_CPUTIMER2 0x2U // CPUTIMER2 Clock gating Bit
|
||||
#define SYSCTL_CMPCLKCR2_CPUTIMER3 0x4U // CPUTIMER3 Clock gating Bit
|
||||
#define SYSCTL_CMPCLKCR2_UDMA 0x10U // UDMA Clock gating Bit
|
||||
#define SYSCTL_CMPCLKCR2_AESIP 0x40U // AESIP Clock gating Bit
|
||||
#define SYSCTL_CMPCLKCR2_GCRC 0x100U // GCRC Clock gating Bit
|
||||
#define SYSCTL_CMPCLKCR2_KEY_S 16U
|
||||
#define SYSCTL_CMPCLKCR2_KEY_M 0xFFFF0000U // Key field
|
||||
|
||||
//*****************************************************************************
|
||||
//
|
||||
// The following are defines for the bit fields in the CMSOFTPRESET0 register
|
||||
//
|
||||
//*****************************************************************************
|
||||
#define SYSCTL_CMSOFTPRESET0_UART0 0x1U // UART0 Soft reset bit
|
||||
#define SYSCTL_CMSOFTPRESET0_SSI0 0x10U // SSI0 Soft reset bit
|
||||
#define SYSCTL_CMSOFTPRESET0_I2C0 0x100U // I2C0 Soft reset bit
|
||||
#define SYSCTL_CMSOFTPRESET0_USB 0x1000U // USB Soft reset bit
|
||||
#define SYSCTL_CMSOFTPRESET0_KEY_S 16U
|
||||
#define SYSCTL_CMSOFTPRESET0_KEY_M 0xFFFF0000U // Key field
|
||||
|
||||
//*****************************************************************************
|
||||
//
|
||||
// The following are defines for the bit fields in the CMSOFTPRESET1 register
|
||||
//
|
||||
//*****************************************************************************
|
||||
#define SYSCTL_CMSOFTPRESET1_ETHERNET 0x1U // ETHERNET Soft reset bit
|
||||
#define SYSCTL_CMSOFTPRESET1_ETHERCAT 0x4U // ETHERCAT Soft reset bit
|
||||
#define SYSCTL_CMSOFTPRESET1_CAN_A 0x10U // CAN_A Soft reset bit
|
||||
#define SYSCTL_CMSOFTPRESET1_CAN_B 0x20U // CAN_B Soft reset bit
|
||||
#define SYSCTL_CMSOFTPRESET1_MCAN_A 0x100U // MCAN_A Soft reset bit
|
||||
#define SYSCTL_CMSOFTPRESET1_KEY_S 16U
|
||||
#define SYSCTL_CMSOFTPRESET1_KEY_M 0xFFFF0000U // Key field
|
||||
|
||||
//*****************************************************************************
|
||||
//
|
||||
// The following are defines for the bit fields in the CMSOFTPRESET2 register
|
||||
//
|
||||
//*****************************************************************************
|
||||
#define SYSCTL_CMSOFTPRESET2_AESIP 0x40U // AESIP Soft reset bit
|
||||
#define SYSCTL_CMSOFTPRESET2_GCRC 0x100U // GCRC Soft reset bit
|
||||
#define SYSCTL_CMSOFTPRESET2_KEY_S 16U
|
||||
#define SYSCTL_CMSOFTPRESET2_KEY_M 0xFFFF0000U // Key field
|
||||
|
||||
//*****************************************************************************
|
||||
//
|
||||
// The following are defines for the bit fields in the CMCLKSTOPREQ0 register
|
||||
//
|
||||
//*****************************************************************************
|
||||
#define SYSCTL_CMCLKSTOPREQ0_KEY_S 16U
|
||||
#define SYSCTL_CMCLKSTOPREQ0_KEY_M 0xFFFF0000U // Key field
|
||||
|
||||
//*****************************************************************************
|
||||
//
|
||||
// The following are defines for the bit fields in the CMCLKSTOPREQ1 register
|
||||
//
|
||||
//*****************************************************************************
|
||||
#define SYSCTL_CMCLKSTOPREQ1_MCAN_A 0x100U // MCAN_A Clock Stop Request Bit
|
||||
#define SYSCTL_CMCLKSTOPREQ1_KEY_S 16U
|
||||
#define SYSCTL_CMCLKSTOPREQ1_KEY_M 0xFFFF0000U // Key field
|
||||
|
||||
//*****************************************************************************
|
||||
//
|
||||
// The following are defines for the bit fields in the CMCLKSTOPREQ2 register
|
||||
//
|
||||
//*****************************************************************************
|
||||
#define SYSCTL_CMCLKSTOPREQ2_KEY_S 16U
|
||||
#define SYSCTL_CMCLKSTOPREQ2_KEY_M 0xFFFF0000U // Key field
|
||||
|
||||
//*****************************************************************************
|
||||
//
|
||||
// The following are defines for the bit fields in the CMCLKSTOPACK1 register
|
||||
//
|
||||
//*****************************************************************************
|
||||
#define SYSCTL_CMCLKSTOPACK1_MCAN_A 0x100U // MCAN_A Clock Stop Ack Bit
|
||||
|
||||
//*****************************************************************************
|
||||
//
|
||||
// The following are defines for the bit fields in the MCANWAKESTATUS register
|
||||
//
|
||||
//*****************************************************************************
|
||||
#define SYSCTL_MCANWAKESTATUS_WAKE 0x1U // MCAN Wake Status
|
||||
|
||||
//*****************************************************************************
|
||||
//
|
||||
// The following are defines for the bit fields in the MCANWAKESTATUSCLR register
|
||||
//
|
||||
//*****************************************************************************
|
||||
#define SYSCTL_MCANWAKESTATUSCLR_WAKE 0x1U // Cear bit for
|
||||
// MCANWAKESTATUS.WAKE bit
|
||||
|
||||
//*****************************************************************************
|
||||
//
|
||||
// The following are defines for the bit fields in the CMECATCTL register
|
||||
//
|
||||
//*****************************************************************************
|
||||
#define SYSCTL_CMECATCTL_I2CLOOPBACK 0x1U // Loopback I2C port of etherCAT
|
||||
// IP to CM I2C.
|
||||
|
||||
//*****************************************************************************
|
||||
//
|
||||
// The following are defines for the bit fields in the PALLOCATESTS register
|
||||
//
|
||||
//*****************************************************************************
|
||||
#define SYSCTL_PALLOCATESTS_USB 0x1U // Status of PALLOCATE.USB bit
|
||||
#define SYSCTL_PALLOCATESTS_ETHERCAT 0x2U // Status of PALLOCATE.ETHERCAT
|
||||
// bit
|
||||
#define SYSCTL_PALLOCATESTS_CAN_A 0x4U // Status of PALLOCATE.CAN_A bit
|
||||
#define SYSCTL_PALLOCATESTS_CAN_B 0x8U // Status of PALLOCATE.CAN_B bit
|
||||
#define SYSCTL_PALLOCATESTS_MCAN_A 0x10U // Status of PALLOCATE.MCAN_A
|
||||
// bit
|
||||
|
||||
//*****************************************************************************
|
||||
//
|
||||
// The following are defines for the bit fields in the CMRESCCLR register
|
||||
//
|
||||
//*****************************************************************************
|
||||
#define SYSCTL_CMRESCCLR_PORN 0x1U // PORn status flag clear
|
||||
#define SYSCTL_CMRESCCLR_XRSN 0x2U // XRSn status flag clear
|
||||
#define SYSCTL_CMRESCCLR_CPU1WDRSN 0x4U // CPU1WDRSn status flag clear
|
||||
#define SYSCTL_CMRESCCLR_CPU1NMIWDRSN 0x8U // CPU1NMIWDRSn status flag
|
||||
// clear
|
||||
#define SYSCTL_CMRESCCLR_CPU1SYSRSN 0x10U // CPU1SYSRSN status flag clear
|
||||
#define SYSCTL_CMRESCCLR_CPU1SCCRESETN 0x20U // CPU1SCCRESETn status flag
|
||||
// clear
|
||||
#define SYSCTL_CMRESCCLR_ECAT_RESET_OUT 0x40U // ECAT_RESET_OUT status flag
|
||||
// clear
|
||||
#define SYSCTL_CMRESCCLR_CPU1SIMRESET_CPURSN 0x80U // CPU1SIMRESET_CPURSn status
|
||||
// flag clear
|
||||
#define SYSCTL_CMRESCCLR_CMRSTCTLRESETREQ 0x100U // CMRSTCTLRESETREQ status flag
|
||||
// clear
|
||||
#define SYSCTL_CMRESCCLR_CMVECTRESETN 0x10000U // CMVECTRESETn status flag
|
||||
// clear
|
||||
#define SYSCTL_CMRESCCLR_CMSYSRESETREQ 0x20000U // CMSYSRESETREQ status flag
|
||||
// clear
|
||||
#define SYSCTL_CMRESCCLR_CMNMIWDRSTN 0x40000U // CMNMIWDRSTn status flag clear
|
||||
#define SYSCTL_CMRESCCLR_CMEOLRESETN 0x80000U // CMEOLRESETn status flag clear
|
||||
|
||||
//*****************************************************************************
|
||||
//
|
||||
// The following are defines for the bit fields in the CMRESC register
|
||||
//
|
||||
//*****************************************************************************
|
||||
#define SYSCTL_CMRESC_POR 0x1U // PORn caused the reset of CM
|
||||
#define SYSCTL_CMRESC_XRSN 0x2U // XRSn caused the reset of CM
|
||||
#define SYSCTL_CMRESC_CPU1_WDRSN 0x4U // CPU1_WDRSn caused the reset
|
||||
// of CM
|
||||
#define SYSCTL_CMRESC_CPU1_NMIWDRSN 0x8U // CPU1_NMIWDRSn caused the
|
||||
// reset of CM
|
||||
#define SYSCTL_CMRESC_CPU1_SYSRSN 0x10U // CPU1_SYSRSN caused the reset
|
||||
// of CM
|
||||
#define SYSCTL_CMRESC_CPU1_SCCRESETN 0x20U // CPU1_SCCRESETn caused the
|
||||
// reset of CM
|
||||
#define SYSCTL_CMRESC_ECAT_RESET_OUT 0x40U // ECAT_RESET_OUT caused the
|
||||
// reset of CM
|
||||
#define SYSCTL_CMRESC_CPU1_SIMRESET_CPURSN 0x80U // CPU1_SIMRESET_CPURSn caused
|
||||
// the reset of CM
|
||||
#define SYSCTL_CMRESC_CMRSTCTL_RESETREQ 0x100U // CMRSTCTL_RESETREQ caused the
|
||||
// reset of CM
|
||||
#define SYSCTL_CMRESC_CMVECTRESETN 0x10000U // CMVECTRESETn caused the reset
|
||||
// of CM
|
||||
#define SYSCTL_CMRESC_CMSYSRESETREQ 0x20000U // CMSYSRESETREQ caused the
|
||||
// reset of CM
|
||||
#define SYSCTL_CMRESC_CMNMIWDRSTN 0x40000U // CMNMIWDRSTn caused the reset
|
||||
// of CM
|
||||
#define SYSCTL_CMRESC_CMEOLRESETN 0x80000U // CMEOLRESETn caused the reset
|
||||
// of CM
|
||||
|
||||
//*****************************************************************************
|
||||
//
|
||||
// The following are defines for the bit fields in the CMSYSCTLLOCK register
|
||||
//
|
||||
//*****************************************************************************
|
||||
#define SYSCTL_CMSYSCTLLOCK_LOCK 0x1U // Locks the configuration
|
||||
// registers of CM System Control
|
||||
#endif
|
||||
+75
@@ -0,0 +1,75 @@
|
||||
//*****************************************************************************
|
||||
//
|
||||
// hw_types.h - Common types and macros.
|
||||
//
|
||||
// Copyright (c) 2005-2016 Texas Instruments Incorporated. All rights reserved.
|
||||
// Software License Agreement
|
||||
//
|
||||
// Redistribution and use in source and binary forms, with or without
|
||||
// modification, are permitted provided that the following conditions
|
||||
// are met:
|
||||
//
|
||||
// Redistributions of source code must retain the above copyright
|
||||
// notice, this list of conditions and the following disclaimer.
|
||||
//
|
||||
// Redistributions in binary form must reproduce the above copyright
|
||||
// notice, this list of conditions and the following disclaimer in the
|
||||
// documentation and/or other materials provided with the
|
||||
// distribution.
|
||||
//
|
||||
// Neither the name of Texas Instruments Incorporated nor the names of
|
||||
// its contributors may be used to endorse or promote products derived
|
||||
// from this software without specific prior written permission.
|
||||
//
|
||||
// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
|
||||
// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
|
||||
// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
|
||||
// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
|
||||
// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
|
||||
// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
|
||||
// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
|
||||
// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
|
||||
// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
||||
// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
|
||||
// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
//
|
||||
// This is part of revision 2.1.3.156 of the Tiva Firmware Development Package.
|
||||
//
|
||||
//*****************************************************************************
|
||||
|
||||
#ifndef __HW_TYPES_H__
|
||||
#define __HW_TYPES_H__
|
||||
|
||||
//*****************************************************************************
|
||||
//
|
||||
// Macros for hardware access, both direct and via the bit-band region.
|
||||
//
|
||||
//*****************************************************************************
|
||||
#define HWREG(x) \
|
||||
(*((volatile uint32_t *)(x)))
|
||||
#define HWREGH(x) \
|
||||
(*((volatile uint16_t *)(x)))
|
||||
#define HWREGB(x) \
|
||||
(*((volatile uint8_t *)(x)))
|
||||
#define HWREGBITW(x, b) \
|
||||
HWREG(((uint32_t)(x) & 0xF0000000) | 0x02000000 | \
|
||||
(((uint32_t)(x) & 0x000FFFFF) << 5) | ((b) << 2))
|
||||
#define HWREGBITH(x, b) \
|
||||
HWREGH(((uint32_t)(x) & 0xF0000000) | 0x02000000 | \
|
||||
(((uint32_t)(x) & 0x000FFFFF) << 5) | ((b) << 2))
|
||||
#define HWREGBITB(x, b) \
|
||||
HWREGB(((uint32_t)(x) & 0xF0000000) | 0x02000000 | \
|
||||
(((uint32_t)(x) & 0x000FFFFF) << 5) | ((b) << 2))
|
||||
|
||||
//
|
||||
// The HWREG_BP Define uses __byte_peripheral_32 intrinsic which can be
|
||||
// used to access a 32-bit byte peripherals data address, preventing the
|
||||
// accesses from being broken up. The intrinsic returns a reference to an
|
||||
// unsigned long and can be used both to read and write data. This is
|
||||
// applicable for the C28x Driver and is not applicable for CM Driver. Thus
|
||||
// the define HWREG_BP has been mapped to HWREG.
|
||||
//
|
||||
#define HWREG_BP(x) \
|
||||
HWREG(x)
|
||||
|
||||
#endif // __HW_TYPES_H__
|
||||
+493
@@ -0,0 +1,493 @@
|
||||
/**
|
||||
* \file hw_types.h
|
||||
*
|
||||
* \brief This file contains the in-line functions required to read/write
|
||||
* values from/to the hardware registers. This file also contains field
|
||||
* manipulation macros to get and set field values.
|
||||
*
|
||||
* \copyright Copyright (C) 2013 Texas Instruments Incorporated - www.ti.com
|
||||
*/
|
||||
|
||||
/**
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions
|
||||
* are met:
|
||||
*
|
||||
* Redistributions of source code must retain the above copyright
|
||||
* notice, this list of conditions and the following disclaimer.
|
||||
*
|
||||
* Redistributions in binary form must reproduce the above copyright
|
||||
* notice, this list of conditions and the following disclaimer in the
|
||||
* documentation and/or other materials provided with the
|
||||
* distribution.
|
||||
*
|
||||
* Neither the name of Texas Instruments Incorporated nor the names of
|
||||
* its contributors may be used to endorse or promote products derived
|
||||
* from this software without specific prior written permission.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
|
||||
* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
|
||||
* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
|
||||
* A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
|
||||
* OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
|
||||
* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
|
||||
* LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
|
||||
* DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
|
||||
* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
||||
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
|
||||
* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
*
|
||||
*/
|
||||
|
||||
|
||||
#ifndef HW_TYPES_H_
|
||||
#define HW_TYPES_H_
|
||||
|
||||
/* ========================================================================== */
|
||||
/* Include Files */
|
||||
/* ========================================================================== */
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
/* ========================================================================== */
|
||||
/* Macros & Typedefs */
|
||||
/* ========================================================================== */
|
||||
|
||||
/**
|
||||
* \brief This macro reads a 32-bit value from a hardware register
|
||||
* and returns the value.
|
||||
*
|
||||
* \param addr Address of the memory mapped hardware register.
|
||||
*
|
||||
* \return Unsigned 32-bit value read from a register.
|
||||
*/
|
||||
#define HW_RD_REG32(addr) (uint32_t)(HW_RD_REG32_RAW((uint32_t) (addr)))
|
||||
|
||||
/**
|
||||
* \brief This macro writes a 32-bit value to a hardware register.
|
||||
*
|
||||
* \param addr Address of the memory mapped hardware register.
|
||||
* \param value unsigned 32-bit value which has to be written to the
|
||||
* register.
|
||||
*/
|
||||
#define HW_WR_REG32(addr, value) \
|
||||
(HW_WR_REG32_RAW((uint32_t) (addr), (uint32_t) (value)))
|
||||
|
||||
/**
|
||||
* \brief This macro reads a 16-bit value from a hardware register
|
||||
* and returns the value.
|
||||
*
|
||||
* \param addr Address of the memory mapped hardware register.
|
||||
*
|
||||
* \return Unsigned 16-bit value read from a register.
|
||||
*/
|
||||
#define HW_RD_REG16(addr) (HW_RD_REG16_RAW((uint32_t) (addr)))
|
||||
|
||||
/**
|
||||
* \brief This macro writes a 16-bit value to a hardware register.
|
||||
*
|
||||
* \param addr Address of the memory mapped hardware register.
|
||||
* \param value unsigned 16-bit value which has to be written to the
|
||||
* register.
|
||||
*/
|
||||
#define HW_WR_REG16(addr, value) \
|
||||
(HW_WR_REG16_RAW((uint32_t) (addr), (uint16_t) (value)))
|
||||
|
||||
|
||||
/**
|
||||
* \brief Macro to extract a field value. This macro extracts the field value
|
||||
* from a 32-bit variable (which contains the register value).
|
||||
* This macro does not read from actual register address, and only
|
||||
* extracts the field from a variable.
|
||||
*
|
||||
* \param regVal 32-bit variable containing the register value.
|
||||
* \param REG_FIELD Peripheral register bit field name, whose value has to
|
||||
* be extracted.
|
||||
*/
|
||||
/*TI_INSPECTED 76 S : MISRAC_2012_R.20.11
|
||||
* "The places in which order of evaluation has no side effects could be a
|
||||
waiver. This used in SHIFT and MASK to extract specified field value " */
|
||||
/*TI_INSPECTED 125 S : MISRAC_2012_R.20.12
|
||||
* "The places in which order of evaluation has no side effects could be a
|
||||
waiver. ## operator here used in SHIFT and MASK to extract specified field
|
||||
value " */
|
||||
#define HW_GET_FIELD(regVal, REG_FIELD) \
|
||||
(((regVal) & (uint32_t) REG_FIELD##_MASK) >> (uint32_t) REG_FIELD##_SHIFT)
|
||||
|
||||
/**
|
||||
* \brief Macro to write a specific field value. This macro first clears the
|
||||
* specified field value and then performs "OR" of the field value which
|
||||
* is shifted and masked. This will set the field value at its
|
||||
* desired position.
|
||||
*
|
||||
* \param regVal 32-bit variable containing the register value.
|
||||
* \param REG_FIELD Peripheral register bit field name, to which specified
|
||||
* value has to be set.
|
||||
* \param fieldVal Value of the field which has to be set.
|
||||
*/
|
||||
/*TI_INSPECTED 76 S : MISRAC_2012_R.20.11
|
||||
* "The places in which order of evaluation has no side effects could be a
|
||||
waiver. This used in SHIFT and MASK to extract specified field value " */
|
||||
/*TI_INSPECTED 125 S : MISRAC_2012_R.20.12
|
||||
* "The places in which order of evaluation has no side effects could be a
|
||||
waiver. ## operator here used in SHIFT and MASK to extract specified field
|
||||
value " */
|
||||
#define HW_SET_FIELD32(regVal, REG_FIELD, fieldVal) \
|
||||
((regVal) = ((regVal) & (uint32_t) (~(uint32_t) REG_FIELD##_MASK)) | \
|
||||
((((uint32_t) (fieldVal)) << (uint32_t) REG_FIELD##_SHIFT) \
|
||||
& (uint32_t) REG_FIELD##_MASK))
|
||||
|
||||
/**
|
||||
* \brief Macro to write a specific field value. This macro first clears the
|
||||
* specified field value and then performs "OR" of the field value which
|
||||
* is shifted and masked. This will set the field value at its
|
||||
* desired position.
|
||||
*
|
||||
* \param regVal 16-bit variable containing the register value.
|
||||
* \param REG_FIELD Peripheral register bit field name, to which specified
|
||||
* value has to be set.
|
||||
* \param fieldVal Value of the field which has to be set.
|
||||
*/
|
||||
/*TI_INSPECTED 76 S : MISRAC_2012_R.20.11
|
||||
* "The places in which order of evaluation has no side effects could be a
|
||||
waiver. This used in SHIFT and MASK to extract specified field value " */
|
||||
/*TI_INSPECTED 125 S : MISRAC_2012_R.20.12
|
||||
* "The places in which order of evaluation has no side effects could be a
|
||||
waiver. ## operator here used in SHIFT and MASK to extract specified field
|
||||
value " */
|
||||
#define HW_SET_FIELD16(regVal, REG_FIELD, fieldVal) \
|
||||
((regVal) = ((regVal) & (uint16_t) (~(uint16_t) REG_FIELD##_MASK)) | \
|
||||
((((uint16_t) (fieldVal)) << (uint16_t) REG_FIELD##_SHIFT) \
|
||||
& (uint16_t) REG_FIELD##_MASK))
|
||||
|
||||
/**
|
||||
* \brief This macro calls read-modify-write API for 32 bit register. It also
|
||||
* frames the mask and shift from register field macro.
|
||||
*
|
||||
* \param regAddr Register Address.
|
||||
* \param REG_FIELD Peripheral register bit field name, to which specified
|
||||
* value has to be set.
|
||||
* \param fieldVal Value of the field which has to be set.
|
||||
*/
|
||||
/*TI_INSPECTED 76 S : MISRAC_2012_R.20.11
|
||||
* "The places in which order of evaluation has no side effects could be a
|
||||
waiver. This used in SHIFT and MASK to extract specified field value " */
|
||||
/*TI_INSPECTED 125 S : MISRAC_2012_R.20.12
|
||||
* "The places in which order of evaluation has no side effects could be a
|
||||
waiver. ## operator here used in SHIFT and MASK to extract specified field
|
||||
value " */
|
||||
#define HW_WR_FIELD32(regAddr, REG_FIELD, fieldVal) \
|
||||
(HW_WR_FIELD32_RAW((uint32_t) (regAddr), (uint32_t) REG_FIELD##_MASK, \
|
||||
(uint32_t) REG_FIELD##_SHIFT, (uint32_t) (fieldVal)))
|
||||
|
||||
/**
|
||||
* \brief This macro calls read-modify-write API for 16 bit register. It also
|
||||
* frames the mask and shift from register field macro.
|
||||
*
|
||||
* \param regAddr Register Address.
|
||||
* \param REG_FIELD Peripheral register bit field name, to which specified
|
||||
* value has to be set.
|
||||
* \param fieldVal Value of the field which has to be set.
|
||||
*/
|
||||
/*TI_INSPECTED 76 S : MISRAC_2012_R.20.11
|
||||
* "The places in which order of evaluation has no side effects could be a
|
||||
waiver. This used in SHIFT and MASK to extract specified field value " */
|
||||
/*TI_INSPECTED 125 S : MISRAC_2012_R.20.12
|
||||
* "The places in which order of evaluation has no side effects could be a
|
||||
waiver. ## operator here used in SHIFT and MASK to extract specified field
|
||||
value " */
|
||||
#define HW_WR_FIELD16(regAddr, REG_FIELD, fieldVal) \
|
||||
(HW_WR_FIELD16_RAW((uint32_t) (regAddr), (uint16_t) REG_FIELD##_MASK, \
|
||||
(uint32_t) REG_FIELD##_SHIFT, (uint16_t) (fieldVal)))
|
||||
|
||||
/**
|
||||
* \brief This macro calls read field API for 32 bit register. It also
|
||||
* frames the mask and shift from register field macro.
|
||||
*
|
||||
* \param regAddr Register Address.
|
||||
* \param REG_FIELD Peripheral register bit field name, from which
|
||||
* specified bit-field value has to be read.
|
||||
* \return Value of the bit-field
|
||||
*/
|
||||
/*TI_INSPECTED 76 S : MISRAC_2012_R.20.11
|
||||
* "The places in which order of evaluation has no side effects could be a
|
||||
waiver. This used in SHIFT and MASK to extract specified field value " */
|
||||
/*TI_INSPECTED 125 S : MISRAC_2012_R.20.12
|
||||
* "The places in which order of evaluation has no side effects could be a
|
||||
waiver. ## operator here used in SHIFT and MASK to extract specified field
|
||||
value " */
|
||||
#define HW_RD_FIELD32(regAddr, REG_FIELD) \
|
||||
(HW_RD_FIELD32_RAW((uint32_t) (regAddr), (uint32_t) REG_FIELD##_MASK, \
|
||||
(uint32_t) REG_FIELD##_SHIFT))
|
||||
|
||||
/**
|
||||
* \brief This macro calls read field API for 16 bit register. It also
|
||||
* frames the mask and shift from register field macro.
|
||||
*
|
||||
* \param regAddr Register Address.
|
||||
* \param REG_FIELD Peripheral register bit field name, from which
|
||||
* specified bit-field value has to be read.
|
||||
* \return Value of the bit-field
|
||||
*/
|
||||
/*TI_INSPECTED 76 S : MISRAC_2012_R.20.11
|
||||
* "The places in which order of evaluation has no side effects could be a
|
||||
waiver. This used in SHIFT and MASK to extract specified field value " */
|
||||
/*TI_INSPECTED 125 S : MISRAC_2012_R.20.12
|
||||
* "The places in which order of evaluation has no side effects could be a
|
||||
waiver. ## operator here used in SHIFT and MASK to extract specified field
|
||||
value " */
|
||||
#define HW_RD_FIELD16(regAddr, REG_FIELD) \
|
||||
(HW_RD_FIELD16_RAW((uint32_t) (regAddr), (uint16_t) REG_FIELD##_MASK, \
|
||||
(uint32_t) REG_FIELD##_SHIFT))
|
||||
|
||||
/* ========================================================================== */
|
||||
/* Structures and Enums */
|
||||
/* ========================================================================== */
|
||||
|
||||
/* None */
|
||||
|
||||
/* ========================================================================== */
|
||||
/* Global Variables Declarations */
|
||||
/* ========================================================================== */
|
||||
|
||||
/* None */
|
||||
|
||||
/* ========================================================================== */
|
||||
/* Function Declarations */
|
||||
/* ========================================================================== */
|
||||
|
||||
/**
|
||||
* \brief This function reads a 32-bit value from a hardware register
|
||||
* and returns the value.
|
||||
*
|
||||
* \param addr Address of the memory mapped hardware register.
|
||||
*
|
||||
* \return Unsigned 32-bit value read from a register.
|
||||
*/
|
||||
static inline uint32_t HW_RD_REG32_RAW(uint32_t addr);
|
||||
|
||||
/**
|
||||
* \brief This function writes a 32-bit value to a hardware register.
|
||||
*
|
||||
* \param addr Address of the memory mapped hardware register.
|
||||
* \param value unsigned 32-bit value which has to be written to the
|
||||
* register.
|
||||
*/
|
||||
static inline void HW_WR_REG32_RAW(uint32_t addr, uint32_t value);
|
||||
|
||||
/**
|
||||
* \brief This function reads a 16-bit value from a hardware register
|
||||
* and returns the value.
|
||||
*
|
||||
* \param addr Address of the memory mapped hardware register.
|
||||
*
|
||||
* \return Unsigned 16-bit value read from a register.
|
||||
*/
|
||||
static inline uint16_t HW_RD_REG16_RAW(uint32_t addr);
|
||||
|
||||
/**
|
||||
* \brief This function writes a 16-bit value to a hardware register.
|
||||
*
|
||||
* \param addr Address of the memory mapped hardware register.
|
||||
* \param value unsigned 16-bit value which has to be written to the
|
||||
* register.
|
||||
*/
|
||||
static inline void HW_WR_REG16_RAW(uint32_t addr, uint16_t value);
|
||||
|
||||
/**
|
||||
* \brief This function reads a 32 bit register, modifies specific set of
|
||||
* bits and writes back to the register.
|
||||
*
|
||||
* \param addr Address of the memory mapped hardware register.
|
||||
* \param mask Mask for the bit field.
|
||||
* \param shift Bit field shift from LSB.
|
||||
* \param value Value to be written to bit-field.
|
||||
*/
|
||||
static inline void HW_WR_FIELD32_RAW(uint32_t addr,
|
||||
uint32_t mask,
|
||||
uint32_t shift,
|
||||
uint32_t value);
|
||||
|
||||
/**
|
||||
* \brief This function reads a 16 bit register, modifies specific set of
|
||||
* bits and writes back to the register.
|
||||
*
|
||||
* \param addr Address of the memory mapped hardware register.
|
||||
* \param mask Mask for the bit field.
|
||||
* \param shift Bit field shift from LSB.
|
||||
* \param value Value to be written to bit-field.
|
||||
*/
|
||||
static inline void HW_WR_FIELD16_RAW(uint32_t addr,
|
||||
uint16_t mask,
|
||||
uint32_t shift,
|
||||
uint16_t value);
|
||||
|
||||
/**
|
||||
* \brief This function reads a 32 bit register, masks specific set of bits
|
||||
* and the left shifted value.
|
||||
*
|
||||
* \param addr Address of the memory mapped hardware register.
|
||||
* \param mask Mask for the bit field.
|
||||
* \param shift Bit field shift from LSB.
|
||||
*
|
||||
* \return Bit-field value (absolute value - shifted to LSB position)
|
||||
*/
|
||||
static inline uint32_t HW_RD_FIELD32_RAW(uint32_t addr,
|
||||
uint32_t mask,
|
||||
uint32_t shift);
|
||||
|
||||
/**
|
||||
* \brief This function reads a 16 bit register, masks specific set of bits
|
||||
* and the left shifted value.
|
||||
*
|
||||
* \param addr Address of the memory mapped hardware register.
|
||||
* \param mask Mask for the bit field.
|
||||
* \param shift Bit field shift from LSB.
|
||||
*
|
||||
* \return Bit-field value (absolute value - shifted to LSB position)
|
||||
*/
|
||||
static inline uint16_t HW_RD_FIELD16_RAW(uint32_t addr,
|
||||
uint16_t mask,
|
||||
uint32_t shift);
|
||||
|
||||
/* ========================================================================== */
|
||||
/* Static Function Definitions */
|
||||
/* ========================================================================== */
|
||||
|
||||
/*TI_INSPECTED 35 S : MISRAC_2012_R.2.1
|
||||
* "Reason - This function is called using HW_RD_REG32 mcaro " */
|
||||
/*TI_INSPECTED 101 S : MISRAC_2012_R.10.3
|
||||
* "Reason - Tool Issue: Not able to understand Inline Function return type " */
|
||||
/*TI_INSPECTED 102 S : MISRAC_2012_R.8.4
|
||||
* "Reason - Tool Issue: Not able to understand Inline Function return type " */
|
||||
static inline uint32_t HW_RD_REG32_RAW(uint32_t addr)
|
||||
{
|
||||
/*TI_INSPECTED 440 S : MISRAC_2012_R.11.4
|
||||
* "Reason - Pointer typecast required here since addr variable holds
|
||||
* required register value" */
|
||||
uint32_t regVal = *(volatile uint32_t *) addr;
|
||||
return (regVal);
|
||||
}
|
||||
|
||||
/*TI_INSPECTED 35 S : MISRAC_2012_R.2.1
|
||||
* "Reason - This function is called using HW_WR_REG32 mcaro " */
|
||||
/*TI_INSPECTED 131 S : MISRAC_2012_R.5.3
|
||||
* "Tool Issue - argument 'value' used here is in same scope " */
|
||||
/*TI_INSPECTED 14 D 1: MISRAC_2012_R.5.8
|
||||
* "Tool Issue - Modifying the contents stored at address not the addr itself */
|
||||
static inline void HW_WR_REG32_RAW(uint32_t addr, uint32_t value)
|
||||
{
|
||||
/*TI_INSPECTED 18 D : MISRAC_2012_R.5.3
|
||||
* "Tool Issue - argument 'value' used here is in same scope " */
|
||||
*(volatile uint32_t *) addr = value;
|
||||
return;
|
||||
}
|
||||
|
||||
/*TI_INSPECTED 35 S : MISRAC_2012_R.2.1
|
||||
* "Reason - This function is called using HW_RD_REG16 mcaro " */
|
||||
static inline uint16_t HW_RD_REG16_RAW(uint32_t addr)
|
||||
{
|
||||
/*TI_INSPECTED 440 S : MISRAC_2012_R.11.4
|
||||
* "Reason - Pointer typecast required here since addr variable holds
|
||||
* required register value" */
|
||||
uint16_t regVal = *(volatile uint16_t *) addr;
|
||||
return (regVal);
|
||||
}
|
||||
|
||||
/*TI_INSPECTED 35 S : MISRAC_2012_R.2.1
|
||||
* "Reason - This function is called using HW_WR_REG16 mcaro " */
|
||||
/*TI_INSPECTED 131 S : MISRAC_2012_R.5.3
|
||||
* "Tool Issue - argument 'value' used here is in same scope " */
|
||||
/*TI_INSPECTED 14 D 1: MISRAC_2012_R.5.8
|
||||
* "Tool Issue - Modifying the contents stored at address not the addr itself */
|
||||
static inline void HW_WR_REG16_RAW(uint32_t addr, uint16_t value)
|
||||
{
|
||||
/*TI_INSPECTED 18 D : MISRAC_2012_R.5.3
|
||||
* "Tool Issue - argument 'value' used here is in same scope " */
|
||||
*(volatile uint16_t *) addr = value;
|
||||
return;
|
||||
}
|
||||
|
||||
/*TI_INSPECTED 35 S : MISRAC_2012_R.2.1
|
||||
* "Reason - This function is called using HW_WR_FIELD32 mcaro " */
|
||||
/*TI_INSPECTED 14 D 1: MISRAC_2012_R.5.8
|
||||
* "Tool Issue - Modifying the contents stored at address not the addr itself */
|
||||
static inline void HW_WR_FIELD32_RAW(uint32_t addr,
|
||||
uint32_t mask,
|
||||
uint32_t shift,
|
||||
uint32_t value)
|
||||
{
|
||||
/*TI_INSPECTED 440 S : MISRAC_2012_R.11.4
|
||||
* "Reason - Pointer typecast required here since addr variable holds
|
||||
* required register value" */
|
||||
uint32_t regVal = *(volatile uint32_t *) addr;
|
||||
regVal &= (~mask);
|
||||
regVal |= (value << shift) & mask;
|
||||
/*TI_INSPECTED 440 S : MISRAC_2012_R.11.4
|
||||
* "Reason - Pointer typecast required here since addr variable holds
|
||||
* required register value" */
|
||||
*(volatile uint32_t *) addr = regVal;
|
||||
return;
|
||||
}
|
||||
|
||||
/*TI_INSPECTED 35 S : MISRAC_2012_R.2.1
|
||||
* "Reason - This function is called using HW_WR_FIELD16 mcaro " */
|
||||
/*TI_INSPECTED 14 D 1: MISRAC_2012_R.5.8
|
||||
* "Tool Issue - Modifying the contents stored at address not the addr itself */
|
||||
static inline void HW_WR_FIELD16_RAW(uint32_t addr,
|
||||
uint16_t mask,
|
||||
uint32_t shift,
|
||||
uint16_t value)
|
||||
{
|
||||
uint32_t tempVal;
|
||||
/*TI_INSPECTED 440 S : MISRAC_2012_R.11.4
|
||||
* "Reason - Pointer typecast required here since addr variable holds
|
||||
* required register value" */
|
||||
uint16_t regVal = *(volatile uint16_t *) addr;
|
||||
tempVal = ((uint32_t) regVal);
|
||||
tempVal &= (~((uint32_t) mask));
|
||||
tempVal |= (((uint32_t) value) << shift) & ((uint32_t) mask);
|
||||
regVal = (uint16_t) tempVal;
|
||||
/*TI_INSPECTED 440 S : MISRAC_2012_R.11.4
|
||||
* "Reason - Pointer typecast required here since addr variable holds
|
||||
* required register value" */
|
||||
*(volatile uint16_t *) addr = regVal;
|
||||
return;
|
||||
}
|
||||
|
||||
/*TI_INSPECTED 35 S : MISRAC_2012_R.2.1
|
||||
* "Reason - This function is called using HW_RD_FIELD32 mcaro " */
|
||||
static inline uint32_t HW_RD_FIELD32_RAW(uint32_t addr,
|
||||
uint32_t mask,
|
||||
uint32_t shift)
|
||||
{
|
||||
/*TI_INSPECTED 440 S : MISRAC_2012_R.11.4
|
||||
* "Reason - Pointer typecast required here since addr variable holds
|
||||
* required register value" */
|
||||
uint32_t regVal = *(volatile uint32_t *) addr;
|
||||
regVal = (regVal & mask) >> shift;
|
||||
return (regVal);
|
||||
}
|
||||
|
||||
/*TI_INSPECTED 35 S : MISRAC_2012_R.2.1
|
||||
* "Reason - This function is called using HW_RD_FIELD16 mcaro " */
|
||||
static inline uint16_t HW_RD_FIELD16_RAW(uint32_t addr,
|
||||
uint16_t mask,
|
||||
uint32_t shift)
|
||||
{
|
||||
uint32_t tempVal;
|
||||
/*TI_INSPECTED 440 S : MISRAC_2012_R.11.4
|
||||
* "Reason - Pointer typecast required here since addr variable holds
|
||||
* required register value" */
|
||||
uint16_t regVal = *(volatile uint16_t *) addr;
|
||||
tempVal = (((uint32_t) regVal & (uint32_t) mask) >> shift);
|
||||
regVal = (uint16_t) tempVal;
|
||||
return (regVal);
|
||||
}
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif /* #ifndef HW_TYPES_H_ */
|
||||
+447
@@ -0,0 +1,447 @@
|
||||
//###########################################################################
|
||||
//
|
||||
// FILE: hw_uart.h
|
||||
//
|
||||
// TITLE: Definitions for the UART registers.
|
||||
//
|
||||
//###########################################################################
|
||||
// $TI Release: $
|
||||
// $Release Date: $
|
||||
//
|
||||
// C2000Ware v5.04.00.00
|
||||
//
|
||||
// Copyright (C) 2024 Texas Instruments Incorporated - http://www.ti.com
|
||||
//
|
||||
// Redistribution and use in source and binary forms, with or without
|
||||
// modification, are permitted provided that the following conditions
|
||||
// are met:
|
||||
//
|
||||
// Redistributions of source code must retain the above copyright
|
||||
// notice, this list of conditions and the following disclaimer.
|
||||
//
|
||||
// Redistributions in binary form must reproduce the above copyright
|
||||
// notice, this list of conditions and the following disclaimer in the
|
||||
// documentation and/or other materials provided with the
|
||||
// distribution.
|
||||
//
|
||||
// Neither the name of Texas Instruments Incorporated nor the names of
|
||||
// its contributors may be used to endorse or promote products derived
|
||||
// from this software without specific prior written permission.
|
||||
//
|
||||
// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
|
||||
// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
|
||||
// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
|
||||
// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
|
||||
// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
|
||||
// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
|
||||
// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
|
||||
// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
|
||||
// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
||||
// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
|
||||
// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
// $
|
||||
//###########################################################################
|
||||
|
||||
#ifndef HW_UART_H
|
||||
#define HW_UART_H
|
||||
|
||||
//*****************************************************************************
|
||||
//
|
||||
// The following are defines for the UART register offsets
|
||||
//
|
||||
//*****************************************************************************
|
||||
#define UART_O_DR 0x0U // UART Data
|
||||
#define UART_O_RSR 0x4U // UART Receive Status/Error
|
||||
// Clear
|
||||
#define UART_O_FR 0x18U // UART Flag
|
||||
#define UART_O_ILPR 0x20U // UART IrDA Low-Power Register
|
||||
#define UART_O_IBRD 0x24U // UART Integer Baud-Rate
|
||||
// Divisor
|
||||
#define UART_O_FBRD 0x28U // UART Fractional Baud-Rate
|
||||
// Divisor
|
||||
#define UART_O_LCRH 0x2CU // UART Line Control
|
||||
#define UART_O_CTL 0x30U // UART Control
|
||||
#define UART_O_IFLS 0x34U // UART Interrupt FIFO Level
|
||||
// Select
|
||||
#define UART_O_IM 0x38U // UART Interrupt Mask
|
||||
#define UART_O_RIS 0x3CU // UART Raw Interrupt Status
|
||||
#define UART_O_MIS 0x40U // UART Masked Interrupt Status
|
||||
#define UART_O_ICR 0x44U // UART Interrupt Clear
|
||||
#define UART_O_DMACTL 0x48U // UART DMA Control
|
||||
#define UART_O_9BITADDR 0xA4U // UART 9-Bit Self Address
|
||||
#define UART_O_9BITAMASK 0xA8U // UART 9-Bit Self Address Mask
|
||||
#define UART_O_PP 0xFC0U // UART Peripheral Properties
|
||||
#define UART_O_PERIPHID4 0xFD0U // UART Peripheral
|
||||
// Identification 4
|
||||
#define UART_O_PERIPHID5 0xFD4U // UART Peripheral
|
||||
// Identification 5
|
||||
#define UART_O_PERIPHID6 0xFD8U // UART Peripheral
|
||||
// Identification 6
|
||||
#define UART_O_PERIPHID7 0xFDCU // UART Peripheral
|
||||
// Identification 7
|
||||
#define UART_O_PERIPHID0 0xFE0U // UART Peripheral
|
||||
// Identification 0
|
||||
#define UART_O_PERIPHID1 0xFE4U // UART Peripheral
|
||||
// Identification 1
|
||||
#define UART_O_PERIPHID2 0xFE8U // UART Peripheral
|
||||
// Identification 2
|
||||
#define UART_O_PERIPHID3 0xFECU // UART Peripheral
|
||||
// Identification 3
|
||||
#define UART_O_PCELLID0 0xFF0U // UART PrimeCell Identification
|
||||
// 0
|
||||
#define UART_O_PCELLID1 0xFF4U // UART PrimeCell Identification
|
||||
// 1
|
||||
#define UART_O_PCELLID2 0xFF8U // UART PrimeCell Identification
|
||||
// 2
|
||||
#define UART_O_PCELLID3 0xFFCU // UART PrimeCell Identification
|
||||
// 3
|
||||
#define UART_O_ECR 0x4U // UART Error Clear
|
||||
|
||||
//*****************************************************************************
|
||||
//
|
||||
// The following are defines for the bit fields in the UARTDR register
|
||||
//
|
||||
//*****************************************************************************
|
||||
#define UART_DR_DATA_S 0U
|
||||
#define UART_DR_DATA_M 0xFFU // Data Transmitted or Received
|
||||
#define UART_DR_FE 0x100U // UART Framing Error
|
||||
#define UART_DR_PE 0x200U // UART Parity Error
|
||||
#define UART_DR_BE 0x400U // UART Break Error
|
||||
#define UART_DR_OE 0x800U // UART Overrun Error
|
||||
|
||||
//*****************************************************************************
|
||||
//
|
||||
// The following are defines for the bit fields in the UARTRSR register
|
||||
//
|
||||
//*****************************************************************************
|
||||
#define UART_RSR_FE 0x1U // UART Framing Error
|
||||
#define UART_RSR_PE 0x2U // UART Parity Error
|
||||
#define UART_RSR_BE 0x4U // UART Break Error
|
||||
#define UART_RSR_OE 0x8U // UART Overrun Error
|
||||
|
||||
//*****************************************************************************
|
||||
//
|
||||
// The following are defines for the bit fields in the UARTFR register
|
||||
//
|
||||
//*****************************************************************************
|
||||
#define UART_FR_BUSY 0x8U // UART Busy
|
||||
#define UART_FR_RXFE 0x10U // UART Receive FIFO Empty
|
||||
#define UART_FR_TXFF 0x20U // UART Transmit FIFO Full
|
||||
#define UART_FR_RXFF 0x40U // UART Receive FIFO Full
|
||||
#define UART_FR_TXFE 0x80U // UART Transmit FIFO Empty
|
||||
|
||||
//*****************************************************************************
|
||||
//
|
||||
// The following are defines for the bit fields in the UARTILPR register
|
||||
//
|
||||
//*****************************************************************************
|
||||
#define UART_ILPR_ILPDVSR_S 0U
|
||||
#define UART_ILPR_ILPDVSR_M 0xFFU // IrDA Low-Power Divisor
|
||||
|
||||
//*****************************************************************************
|
||||
//
|
||||
// The following are defines for the bit fields in the UARTIBRD register
|
||||
//
|
||||
//*****************************************************************************
|
||||
#define UART_IBRD_DIVINT_S 0U
|
||||
#define UART_IBRD_DIVINT_M 0xFFFFU // Integer Baud-Rate Divisor
|
||||
|
||||
//*****************************************************************************
|
||||
//
|
||||
// The following are defines for the bit fields in the UARTFBRD register
|
||||
//
|
||||
//*****************************************************************************
|
||||
#define UART_FBRD_DIVFRAC_S 0U
|
||||
#define UART_FBRD_DIVFRAC_M 0x3FU // Fractional Baud-Rate Divisor
|
||||
|
||||
//*****************************************************************************
|
||||
//
|
||||
// The following are defines for the bit fields in the UARTLCRH register
|
||||
//
|
||||
//*****************************************************************************
|
||||
#define UART_LCRH_BRK 0x1U // UART Send Break
|
||||
#define UART_LCRH_PEN 0x2U // UART Parity Enable
|
||||
#define UART_LCRH_EPS 0x4U // UART Even Parity Select
|
||||
#define UART_LCRH_STP2 0x8U // UART Two Stop Bits Select
|
||||
#define UART_LCRH_FEN 0x10U // UART Enable FIFOs
|
||||
#define UART_LCRH_WLEN_S 5U
|
||||
#define UART_LCRH_WLEN_M 0x60U // UART Word Length
|
||||
#define UART_LCRH_SPS 0x80U // UART Stick Parity Select
|
||||
|
||||
//*****************************************************************************
|
||||
//
|
||||
// The following are defines for the bit fields in the UARTCTL register
|
||||
//
|
||||
//*****************************************************************************
|
||||
#define UART_CTL_UARTEN 0x1U // UART Enable
|
||||
#define UART_CTL_SIREN 0x2U // UART SIR Enable
|
||||
#define UART_CTL_SIRLP 0x4U // UART SIR Low-Power Mode
|
||||
#define UART_CTL_EOT 0x10U // End of Transmission
|
||||
#define UART_CTL_HSE 0x20U // High-Speed Enable
|
||||
#define UART_CTL_LBE 0x80U // UART Loop Back Enable
|
||||
#define UART_CTL_TXE 0x100U // UART Transmit Enable
|
||||
#define UART_CTL_RXE 0x200U // UART Receive Enable
|
||||
|
||||
//*****************************************************************************
|
||||
//
|
||||
// The following are defines for the bit fields in the UARTIFLS register
|
||||
//
|
||||
//*****************************************************************************
|
||||
#define UART_IFLS_TXIFLSEL_S 0U
|
||||
#define UART_IFLS_TXIFLSEL_M 0x7U // UART Transmit Interrupt FIFO
|
||||
// Level Select
|
||||
#define UART_IFLS_RXIFLSEL_S 3U
|
||||
#define UART_IFLS_RXIFLSEL_M 0x38U // UART Receive Interrupt FIFO
|
||||
// Level Select
|
||||
|
||||
//*****************************************************************************
|
||||
//
|
||||
// The following are defines for the bit fields in the UARTIM register
|
||||
//
|
||||
//*****************************************************************************
|
||||
#define UART_IM_RXIM 0x10U // UART Receive Interrupt Mask
|
||||
#define UART_IM_TXIM 0x20U // UART Transmit Interrupt Mask
|
||||
#define UART_IM_RTIM 0x40U // UART Receive Time-Out
|
||||
// Interrupt Mask
|
||||
#define UART_IM_FEIM 0x80U // UART Framing Error Interrupt
|
||||
// Mask
|
||||
#define UART_IM_PEIM 0x100U // UART Parity Error Interrupt
|
||||
// Mask
|
||||
#define UART_IM_BEIM 0x200U // UART Break Error Interrupt
|
||||
// Mask
|
||||
#define UART_IM_OEIM 0x400U // UART Overrun Error Interrupt
|
||||
// Mask
|
||||
#define UART_IM_EOTIM 0x800U // End of Transmission Interrupt
|
||||
// Mask
|
||||
#define UART_IM_9BITIM 0x1000U // 9-Bit Mode Interrupt Mask
|
||||
#define UART_IM_DMARXIM 0x10000U // Receive DMA Interrupt Mask
|
||||
#define UART_IM_DMATXIM 0x20000U // Transmit DMA Interrupt Mask
|
||||
|
||||
//*****************************************************************************
|
||||
//
|
||||
// The following are defines for the bit fields in the UARTRIS register
|
||||
//
|
||||
//*****************************************************************************
|
||||
#define UART_RIS_RXRIS 0x10U // UART Receive Raw Interrupt
|
||||
// Status
|
||||
#define UART_RIS_TXRIS 0x20U // UART Transmit Raw Interrupt
|
||||
// Status
|
||||
#define UART_RIS_RTRIS 0x40U // UART Receive Time-Out Raw
|
||||
// Interrupt Status
|
||||
#define UART_RIS_FERIS 0x80U // UART Framing Error Raw
|
||||
// Interrupt Status
|
||||
#define UART_RIS_PERIS 0x100U // UART Parity Error Raw
|
||||
// Interrupt Status
|
||||
#define UART_RIS_BERIS 0x200U // UART Break Error Raw
|
||||
// Interrupt Status
|
||||
#define UART_RIS_OERIS 0x400U // UART Overrun Error Raw
|
||||
// Interrupt Status
|
||||
#define UART_RIS_EOTRIS 0x800U // End of Transmission Raw
|
||||
// Interrupt Status
|
||||
#define UART_RIS_9BITRIS 0x1000U // 9-Bit Mode Raw Interrupt
|
||||
// Status
|
||||
#define UART_RIS_DMARXRIS 0x10000U // Receive DMA Raw Interrupt
|
||||
// Status
|
||||
#define UART_RIS_DMATXRIS 0x20000U // Transmit DMA Raw Interrupt
|
||||
// Status
|
||||
|
||||
//*****************************************************************************
|
||||
//
|
||||
// The following are defines for the bit fields in the UARTMIS register
|
||||
//
|
||||
//*****************************************************************************
|
||||
#define UART_MIS_RXMIS 0x10U // UART Receive Masked Interrupt
|
||||
// Status
|
||||
#define UART_MIS_TXMIS 0x20U // UART Transmit Masked
|
||||
// Interrupt Status
|
||||
#define UART_MIS_RTMIS 0x40U // UART Receive Time-Out Masked
|
||||
// Interrupt Status
|
||||
#define UART_MIS_FEMIS 0x80U // UART Framing Error Masked
|
||||
// Interrupt Status
|
||||
#define UART_MIS_PEMIS 0x100U // UART Parity Error Masked
|
||||
// Interrupt Status
|
||||
#define UART_MIS_BEMIS 0x200U // UART Break Error Masked
|
||||
// Interrupt Status
|
||||
#define UART_MIS_OEMIS 0x400U // UART Overrun Error Masked
|
||||
// Interrupt Status
|
||||
#define UART_MIS_EOTMIS 0x800U // End of Transmission Masked
|
||||
// Interrupt Status
|
||||
#define UART_MIS_9BITMIS 0x1000U // 9-Bit Mode Masked Interrupt
|
||||
// Status
|
||||
#define UART_MIS_DMARXMIS 0x10000U // Receive DMA Masked Interrupt
|
||||
// Status
|
||||
#define UART_MIS_DMATXMIS 0x20000U // Transmit DMA Masked Interrupt
|
||||
// Status
|
||||
|
||||
//*****************************************************************************
|
||||
//
|
||||
// The following are defines for the bit fields in the UARTICR register
|
||||
//
|
||||
//*****************************************************************************
|
||||
#define UART_ICR_RXIC 0x10U // Receive Interrupt Clear
|
||||
#define UART_ICR_TXIC 0x20U // Transmit Interrupt Clear
|
||||
#define UART_ICR_RTIC 0x40U // Receive Time-Out Interrupt
|
||||
// Clear
|
||||
#define UART_ICR_FEIC 0x80U // Framing Error Interrupt Clear
|
||||
#define UART_ICR_PEIC 0x100U // Parity Error Interrupt Clear
|
||||
#define UART_ICR_BEIC 0x200U // Break Error Interrupt Clear
|
||||
#define UART_ICR_OEIC 0x400U // Overrun Error Interrupt Clear
|
||||
#define UART_ICR_EOTIC 0x800U // End of Transmission Interrupt
|
||||
// Clear
|
||||
#define UART_ICR_9BITIC 0x1000U // 9-Bit Mode Interrupt Clear
|
||||
#define UART_ICR_DMARXIC 0x10000U // Receive DMA Interrupt Clear
|
||||
#define UART_ICR_DMATXIC 0x20000U // Transmit DMA Interrupt Clear
|
||||
|
||||
//*****************************************************************************
|
||||
//
|
||||
// The following are defines for the bit fields in the UARTDMACTL register
|
||||
//
|
||||
//*****************************************************************************
|
||||
#define UART_DMACTL_RXDMAE 0x1U // Receive DMA Enable
|
||||
#define UART_DMACTL_TXDMAE 0x2U // Transmit DMA Enable
|
||||
#define UART_DMACTL_DMAERR 0x4U // DMA on Error
|
||||
|
||||
//*****************************************************************************
|
||||
//
|
||||
// The following are defines for the bit fields in the UART9BITADDR register
|
||||
//
|
||||
//*****************************************************************************
|
||||
#define UART_9BITADDR_ADDR_S 0U
|
||||
#define UART_9BITADDR_ADDR_M 0xFFU // Self Address for 9-Bit Mode
|
||||
#define UART_9BITADDR_9BITEN 0x8000U // Enable 9-Bit Mode
|
||||
|
||||
//*****************************************************************************
|
||||
//
|
||||
// The following are defines for the bit fields in the UART9BITAMASK register
|
||||
//
|
||||
//*****************************************************************************
|
||||
#define UART_9BITAMASK_MASK_S 0U
|
||||
#define UART_9BITAMASK_MASK_M 0xFFU // Self Address Mask for 9-Bit
|
||||
// Mode
|
||||
|
||||
//*****************************************************************************
|
||||
//
|
||||
// The following are defines for the bit fields in the UARTPP register
|
||||
//
|
||||
//*****************************************************************************
|
||||
#define UART_PP_SC 0x1U // Smart Card Support
|
||||
#define UART_PP_NB 0x2U // 9-Bit Support
|
||||
#define UART_PP_MS 0x4U // Modem Support
|
||||
#define UART_PP_MSE 0x8U // Modem Support Extended
|
||||
|
||||
//*****************************************************************************
|
||||
//
|
||||
// The following are defines for the bit fields in the UARTPERIPHID4 register
|
||||
//
|
||||
//*****************************************************************************
|
||||
#define UART_PERIPHID4_PID4_S 0U
|
||||
#define UART_PERIPHID4_PID4_M 0xFFU // UART Peripheral ID Register
|
||||
// [7:0]
|
||||
|
||||
//*****************************************************************************
|
||||
//
|
||||
// The following are defines for the bit fields in the UARTPERIPHID5 register
|
||||
//
|
||||
//*****************************************************************************
|
||||
#define UART_PERIPHID5_PID5_S 0U
|
||||
#define UART_PERIPHID5_PID5_M 0xFFU // UART Peripheral ID Register
|
||||
// [15:8]
|
||||
|
||||
//*****************************************************************************
|
||||
//
|
||||
// The following are defines for the bit fields in the UARTPERIPHID6 register
|
||||
//
|
||||
//*****************************************************************************
|
||||
#define UART_PERIPHID6_PID6_S 0U
|
||||
#define UART_PERIPHID6_PID6_M 0xFFU // UART Peripheral ID Register
|
||||
// [23:16]
|
||||
|
||||
//*****************************************************************************
|
||||
//
|
||||
// The following are defines for the bit fields in the UARTPERIPHID7 register
|
||||
//
|
||||
//*****************************************************************************
|
||||
#define UART_PERIPHID7_PID7_S 0U
|
||||
#define UART_PERIPHID7_PID7_M 0xFFU // UART Peripheral ID Register
|
||||
// [31:24]
|
||||
|
||||
//*****************************************************************************
|
||||
//
|
||||
// The following are defines for the bit fields in the UARTPERIPHID0 register
|
||||
//
|
||||
//*****************************************************************************
|
||||
#define UART_PERIPHID0_PID0_S 0U
|
||||
#define UART_PERIPHID0_PID0_M 0xFFU // UART Peripheral ID Register
|
||||
// [7:0]
|
||||
|
||||
//*****************************************************************************
|
||||
//
|
||||
// The following are defines for the bit fields in the UARTPERIPHID1 register
|
||||
//
|
||||
//*****************************************************************************
|
||||
#define UART_PERIPHID1_PID1_S 0U
|
||||
#define UART_PERIPHID1_PID1_M 0xFFU // UART Peripheral ID Register
|
||||
// [15:8]
|
||||
|
||||
//*****************************************************************************
|
||||
//
|
||||
// The following are defines for the bit fields in the UARTPERIPHID2 register
|
||||
//
|
||||
//*****************************************************************************
|
||||
#define UART_PERIPHID2_PID2_S 0U
|
||||
#define UART_PERIPHID2_PID2_M 0xFFU // UART Peripheral ID Register
|
||||
// [23:16]
|
||||
|
||||
//*****************************************************************************
|
||||
//
|
||||
// The following are defines for the bit fields in the UARTPERIPHID3 register
|
||||
//
|
||||
//*****************************************************************************
|
||||
#define UART_PERIPHID3_PID3_S 0U
|
||||
#define UART_PERIPHID3_PID3_M 0xFFU // UART Peripheral ID Register
|
||||
// [31:24]
|
||||
|
||||
//*****************************************************************************
|
||||
//
|
||||
// The following are defines for the bit fields in the UARTPCELLID0 register
|
||||
//
|
||||
//*****************************************************************************
|
||||
#define UART_PCELLID0_CID0_S 0U
|
||||
#define UART_PCELLID0_CID0_M 0xFFU // UART PrimeCell ID Register
|
||||
// [7:0]
|
||||
|
||||
//*****************************************************************************
|
||||
//
|
||||
// The following are defines for the bit fields in the UARTPCELLID1 register
|
||||
//
|
||||
//*****************************************************************************
|
||||
#define UART_PCELLID1_CID1_S 0U
|
||||
#define UART_PCELLID1_CID1_M 0xFFU // UART PrimeCell ID Register
|
||||
// [15:8]
|
||||
|
||||
//*****************************************************************************
|
||||
//
|
||||
// The following are defines for the bit fields in the UARTPCELLID2 register
|
||||
//
|
||||
//*****************************************************************************
|
||||
#define UART_PCELLID2_CID2_S 0U
|
||||
#define UART_PCELLID2_CID2_M 0xFFU // UART PrimeCell ID Register
|
||||
// [23:16]
|
||||
|
||||
//*****************************************************************************
|
||||
//
|
||||
// The following are defines for the bit fields in the UARTPCELLID3 register
|
||||
//
|
||||
//*****************************************************************************
|
||||
#define UART_PCELLID3_CID3_S 0U
|
||||
#define UART_PCELLID3_CID3_M 0xFFU // UART PrimeCell ID Register
|
||||
// [31:24]
|
||||
|
||||
//*****************************************************************************
|
||||
//
|
||||
// The following are defines for the bit fields in the UARTECR register
|
||||
//
|
||||
//*****************************************************************************
|
||||
#define UART_ECR_DATA_S 0U
|
||||
#define UART_ECR_DATA_M 0xFFU // Error Clear
|
||||
#endif
|
||||
+329
@@ -0,0 +1,329 @@
|
||||
//###########################################################################
|
||||
//
|
||||
// FILE: hw_udma.h
|
||||
//
|
||||
// TITLE: Definitions for the UDMA registers.
|
||||
//
|
||||
//###########################################################################
|
||||
// $TI Release: $
|
||||
// $Release Date: $
|
||||
//
|
||||
// C2000Ware v5.04.00.00
|
||||
//
|
||||
// Copyright (C) 2024 Texas Instruments Incorporated - http://www.ti.com
|
||||
//
|
||||
// Redistribution and use in source and binary forms, with or without
|
||||
// modification, are permitted provided that the following conditions
|
||||
// are met:
|
||||
//
|
||||
// Redistributions of source code must retain the above copyright
|
||||
// notice, this list of conditions and the following disclaimer.
|
||||
//
|
||||
// Redistributions in binary form must reproduce the above copyright
|
||||
// notice, this list of conditions and the following disclaimer in the
|
||||
// documentation and/or other materials provided with the
|
||||
// distribution.
|
||||
//
|
||||
// Neither the name of Texas Instruments Incorporated nor the names of
|
||||
// its contributors may be used to endorse or promote products derived
|
||||
// from this software without specific prior written permission.
|
||||
//
|
||||
// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
|
||||
// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
|
||||
// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
|
||||
// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
|
||||
// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
|
||||
// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
|
||||
// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
|
||||
// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
|
||||
// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
||||
// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
|
||||
// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
// $
|
||||
//###########################################################################
|
||||
|
||||
#ifndef HW_UDMA_H
|
||||
#define HW_UDMA_H
|
||||
|
||||
//*****************************************************************************
|
||||
//
|
||||
// The following are defines for the UDMA register offsets
|
||||
//
|
||||
//*****************************************************************************
|
||||
#define UDMA_O_DMASRCENDP 0x0U // DMA Channel Source Address
|
||||
// End Pointer
|
||||
#define UDMA_O_DMADSTENDP 0x4U // DMA Channel Destination
|
||||
// Address End Pointer
|
||||
#define UDMA_O_DMACHCTL 0x8U // DMA Channel Control Word
|
||||
#define UDMA_O_DMASTAT 0x0U // DMA Status
|
||||
#define UDMA_O_DMACFG 0x4U // DMA Configuration
|
||||
#define UDMA_O_DMACTLBASE 0x8U // DMA Channel Control Base
|
||||
// Pointer
|
||||
#define UDMA_O_DMAALTBASE 0xCU // DMA Alternate Channel Control
|
||||
// Base Pointer
|
||||
#define UDMA_O_DMAWAITSTAT 0x10U // DMA Channel Wait-on-Request
|
||||
// Status
|
||||
#define UDMA_O_DMASWREQ 0x14U // DMA Channel Software Request
|
||||
#define UDMA_O_DMAUSEBURSTSET 0x18U // DMA Channel Useburst Set
|
||||
#define UDMA_O_DMAUSEBURSTCLR 0x1CU // DMA Channel Useburst Clear
|
||||
#define UDMA_O_DMAREQMASKSET 0x20U // DMA Channel Request Mask Set
|
||||
#define UDMA_O_DMAREQMASKCLR 0x24U // DMA Channel Request Mask
|
||||
// Clear
|
||||
#define UDMA_O_DMAENASET 0x28U // DMA Channel Enable Set
|
||||
#define UDMA_O_DMAENACLR 0x2CU // DMA Channel Enable Clear
|
||||
#define UDMA_O_DMAALTSET 0x30U // DMA Channel Primary Alternate
|
||||
// Set
|
||||
#define UDMA_O_DMAALTCLR 0x34U // DMA Channel Primary Alternate
|
||||
// Clear
|
||||
#define UDMA_O_DMAPRIOSET 0x38U // DMA Channel Priority Set
|
||||
#define UDMA_O_DMAPRIOCLR 0x3CU // DMA Channel Priority Clear
|
||||
#define UDMA_O_DMAERRCLR 0x4CU // DMA Bus Error Clear
|
||||
#define UDMA_O_DMACHASGN 0x500U // DMA Channel Assignment
|
||||
#define UDMA_O_DMACHMAP0 0x510U // DMA Channel Map Select 0
|
||||
#define UDMA_O_DMACHMAP1 0x514U // DMA Channel Map Select 1
|
||||
#define UDMA_O_DMACHMAP2 0x518U // DMA Channel Map Select 2
|
||||
#define UDMA_O_DMACHMAP3 0x51CU // DMA Channel Map Select 3
|
||||
#define UDMA_O_DMAPERIPHID4 0xFD0U // DMA Peripheral Identification
|
||||
// 4
|
||||
#define UDMA_O_DMAPERIPHID0 0xFE0U // DMA Peripheral Identification
|
||||
// 0
|
||||
#define UDMA_O_DMAPERIPHID1 0xFE4U // DMA Peripheral Identification
|
||||
// 1
|
||||
#define UDMA_O_DMAPERIPHID2 0xFE8U // DMA Peripheral Identification
|
||||
// 2
|
||||
#define UDMA_O_DMAPERIPHID3 0xFECU // DMA Peripheral Identification
|
||||
// 3
|
||||
#define UDMA_O_DMAPCELLID0 0xFF0U // DMA PrimeCell Identification
|
||||
// 0
|
||||
#define UDMA_O_DMAPCELLID1 0xFF4U // DMA PrimeCell Identification
|
||||
// 1
|
||||
#define UDMA_O_DMAPCELLID2 0xFF8U // DMA PrimeCell Identification
|
||||
// 2
|
||||
#define UDMA_O_DMAPCELLID3 0xFFCU // DMA PrimeCell Identification
|
||||
// 3
|
||||
|
||||
//*****************************************************************************
|
||||
//
|
||||
// The following are defines for the bit fields in the DMACHCTL register
|
||||
//
|
||||
//*****************************************************************************
|
||||
#define UDMA_DMACHCTL_XFERMODE_S 0U
|
||||
#define UDMA_DMACHCTL_XFERMODE_M 0x7U // DMA Transfer Mode
|
||||
#define UDMA_DMACHCTL_NXTUSEBURST 0x8U // Next Useburst
|
||||
#define UDMA_DMACHCTL_XFERSIZE_S 4U
|
||||
#define UDMA_DMACHCTL_XFERSIZE_M 0x3FF0U // Transfer Size (minus 1)
|
||||
#define UDMA_DMACHCTL_ARBSIZE_S 14U
|
||||
#define UDMA_DMACHCTL_ARBSIZE_M 0x3C000U // Arbitration Size
|
||||
#define UDMA_DMACHCTL_SRCPROT0 0x40000U // Source Privilege Access
|
||||
#define UDMA_DMACHCTL_DSTPROT0 0x200000U // Destination Privilege Access
|
||||
#define UDMA_DMACHCTL_SRCSIZE_S 24U
|
||||
#define UDMA_DMACHCTL_SRCSIZE_M 0x3000000U // Source Data Size
|
||||
#define UDMA_DMACHCTL_SRCINC_S 26U
|
||||
#define UDMA_DMACHCTL_SRCINC_M 0xC000000U // Source Address Increment
|
||||
#define UDMA_DMACHCTL_DSTSIZE_S 28U
|
||||
#define UDMA_DMACHCTL_DSTSIZE_M 0x30000000U // Destination Data Size
|
||||
#define UDMA_DMACHCTL_DSTINC_S 30U
|
||||
#define UDMA_DMACHCTL_DSTINC_M 0xC0000000U // Destination Address Increment
|
||||
|
||||
//*****************************************************************************
|
||||
//
|
||||
// The following are defines for the bit fields in the DMASTAT register
|
||||
//
|
||||
//*****************************************************************************
|
||||
#define UDMA_DMASTAT_MASTEN 0x1U // Master Enable Status
|
||||
#define UDMA_DMASTAT_STATE_S 4U
|
||||
#define UDMA_DMASTAT_STATE_M 0xF0U // Control State Machine Status
|
||||
#define UDMA_DMASTAT_DMACHANS_S 16U
|
||||
#define UDMA_DMASTAT_DMACHANS_M 0x1F0000U // Available DMA Channels Minus
|
||||
// 1
|
||||
|
||||
//*****************************************************************************
|
||||
//
|
||||
// The following are defines for the bit fields in the DMACFG register
|
||||
//
|
||||
//*****************************************************************************
|
||||
#define UDMA_DMACFG_MASTEN 0x1U // Controller Master Enable
|
||||
|
||||
//*****************************************************************************
|
||||
//
|
||||
// The following are defines for the bit fields in the DMACTLBASE register
|
||||
//
|
||||
//*****************************************************************************
|
||||
#define UDMA_DMACTLBASE_ADDR_S 10U
|
||||
#define UDMA_DMACTLBASE_ADDR_M 0xFFFFFC00U // Channel Control Base Address
|
||||
|
||||
//*****************************************************************************
|
||||
//
|
||||
// The following are defines for the bit fields in the DMAERRCLR register
|
||||
//
|
||||
//*****************************************************************************
|
||||
#define UDMA_DMAERRCLR_ERRCLR 0x1U // DMA Bus Error Status
|
||||
|
||||
//*****************************************************************************
|
||||
//
|
||||
// The following are defines for the bit fields in the DMACHMAP0 register
|
||||
//
|
||||
//*****************************************************************************
|
||||
#define UDMA_DMACHMAP0_CH0SEL_S 0U
|
||||
#define UDMA_DMACHMAP0_CH0SEL_M 0xFU // DMA Channel 0 Source Select
|
||||
#define UDMA_DMACHMAP0_CH1SEL_S 4U
|
||||
#define UDMA_DMACHMAP0_CH1SEL_M 0xF0U // DMA Channel 1 Source Select
|
||||
#define UDMA_DMACHMAP0_CH2SEL_S 8U
|
||||
#define UDMA_DMACHMAP0_CH2SEL_M 0xF00U // DMA Channel 2 Source Select
|
||||
#define UDMA_DMACHMAP0_CH3SEL_S 12U
|
||||
#define UDMA_DMACHMAP0_CH3SEL_M 0xF000U // DMA Channel 3 Source Select
|
||||
#define UDMA_DMACHMAP0_CH4SEL_S 16U
|
||||
#define UDMA_DMACHMAP0_CH4SEL_M 0xF0000U // DMA Channel 4 Source Select
|
||||
#define UDMA_DMACHMAP0_CH5SEL_S 20U
|
||||
#define UDMA_DMACHMAP0_CH5SEL_M 0xF00000U // DMA Channel 5 Source Select
|
||||
#define UDMA_DMACHMAP0_CH6SEL_S 24U
|
||||
#define UDMA_DMACHMAP0_CH6SEL_M 0xF000000U // DMA Channel 6 Source Select
|
||||
#define UDMA_DMACHMAP0_CH7SEL_S 28U
|
||||
#define UDMA_DMACHMAP0_CH7SEL_M 0xF0000000U // DMA Channel 7 Source Select
|
||||
|
||||
//*****************************************************************************
|
||||
//
|
||||
// The following are defines for the bit fields in the DMACHMAP1 register
|
||||
//
|
||||
//*****************************************************************************
|
||||
#define UDMA_DMACHMAP1_CH8SEL_S 0U
|
||||
#define UDMA_DMACHMAP1_CH8SEL_M 0xFU // DMA Channel 8 Source Select
|
||||
#define UDMA_DMACHMAP1_CH9SEL_S 4U
|
||||
#define UDMA_DMACHMAP1_CH9SEL_M 0xF0U // DMA Channel 9 Source Select
|
||||
#define UDMA_DMACHMAP1_CH10SEL_S 8U
|
||||
#define UDMA_DMACHMAP1_CH10SEL_M 0xF00U // DMA Channel 10 Source Select
|
||||
#define UDMA_DMACHMAP1_CH11SEL_S 12U
|
||||
#define UDMA_DMACHMAP1_CH11SEL_M 0xF000U // DMA Channel 11 Source Select
|
||||
#define UDMA_DMACHMAP1_CH12SEL_S 16U
|
||||
#define UDMA_DMACHMAP1_CH12SEL_M 0xF0000U // DMA Channel 12 Source Select
|
||||
#define UDMA_DMACHMAP1_CH13SEL_S 20U
|
||||
#define UDMA_DMACHMAP1_CH13SEL_M 0xF00000U // DMA Channel 13 Source Select
|
||||
#define UDMA_DMACHMAP1_CH14SEL_S 24U
|
||||
#define UDMA_DMACHMAP1_CH14SEL_M 0xF000000U // DMA Channel 14 Source Select
|
||||
#define UDMA_DMACHMAP1_CH15SEL_S 28U
|
||||
#define UDMA_DMACHMAP1_CH15SEL_M 0xF0000000U // DMA Channel 15 Source Select
|
||||
|
||||
//*****************************************************************************
|
||||
//
|
||||
// The following are defines for the bit fields in the DMACHMAP2 register
|
||||
//
|
||||
//*****************************************************************************
|
||||
#define UDMA_DMACHMAP2_CH16SEL_S 0U
|
||||
#define UDMA_DMACHMAP2_CH16SEL_M 0xFU // DMA Channel 16 Source Select
|
||||
#define UDMA_DMACHMAP2_CH17SEL_S 4U
|
||||
#define UDMA_DMACHMAP2_CH17SEL_M 0xF0U // DMA Channel 17 Source Select
|
||||
#define UDMA_DMACHMAP2_CH18SEL_S 8U
|
||||
#define UDMA_DMACHMAP2_CH18SEL_M 0xF00U // DMA Channel 18 Source Select
|
||||
#define UDMA_DMACHMAP2_CH19SEL_S 12U
|
||||
#define UDMA_DMACHMAP2_CH19SEL_M 0xF000U // DMA Channel 19 Source Select
|
||||
#define UDMA_DMACHMAP2_CH20SEL_S 16U
|
||||
#define UDMA_DMACHMAP2_CH20SEL_M 0xF0000U // DMA Channel 20 Source Select
|
||||
#define UDMA_DMACHMAP2_CH21SEL_S 20U
|
||||
#define UDMA_DMACHMAP2_CH21SEL_M 0xF00000U // DMA Channel 21 Source Select
|
||||
#define UDMA_DMACHMAP2_CH22SEL_S 24U
|
||||
#define UDMA_DMACHMAP2_CH22SEL_M 0xF000000U // DMA Channel 22 Source Select
|
||||
#define UDMA_DMACHMAP2_CH23SEL_S 28U
|
||||
#define UDMA_DMACHMAP2_CH23SEL_M 0xF0000000U // DMA Channel 23 Source Select
|
||||
|
||||
//*****************************************************************************
|
||||
//
|
||||
// The following are defines for the bit fields in the DMACHMAP3 register
|
||||
//
|
||||
//*****************************************************************************
|
||||
#define UDMA_DMACHMAP3_CH24SEL_S 0U
|
||||
#define UDMA_DMACHMAP3_CH24SEL_M 0xFU // DMA Channel 24 Source Select
|
||||
#define UDMA_DMACHMAP3_CH25SEL_S 4U
|
||||
#define UDMA_DMACHMAP3_CH25SEL_M 0xF0U // DMA Channel 25 Source Select
|
||||
#define UDMA_DMACHMAP3_CH26SEL_S 8U
|
||||
#define UDMA_DMACHMAP3_CH26SEL_M 0xF00U // DMA Channel 26 Source Select
|
||||
#define UDMA_DMACHMAP3_CH27SEL_S 12U
|
||||
#define UDMA_DMACHMAP3_CH27SEL_M 0xF000U // DMA Channel 27 Source Select
|
||||
#define UDMA_DMACHMAP3_CH28SEL_S 16U
|
||||
#define UDMA_DMACHMAP3_CH28SEL_M 0xF0000U // DMA Channel 28 Source Select
|
||||
#define UDMA_DMACHMAP3_CH29SEL_S 20U
|
||||
#define UDMA_DMACHMAP3_CH29SEL_M 0xF00000U // DMA Channel 29 Source Select
|
||||
#define UDMA_DMACHMAP3_CH30SEL_S 24U
|
||||
#define UDMA_DMACHMAP3_CH30SEL_M 0xF000000U // DMA Channel 30 Source Select
|
||||
#define UDMA_DMACHMAP3_CH31SEL_S 28U
|
||||
#define UDMA_DMACHMAP3_CH31SEL_M 0xF0000000U // DMA Channel 31 Source Select
|
||||
|
||||
//*****************************************************************************
|
||||
//
|
||||
// The following are defines for the bit fields in the DMAPERIPHID4 register
|
||||
//
|
||||
//*****************************************************************************
|
||||
#define UDMA_DMAPERIPHID4_PID4_S 0U
|
||||
#define UDMA_DMAPERIPHID4_PID4_M 0xFFU // DMA Peripheral ID Register
|
||||
|
||||
//*****************************************************************************
|
||||
//
|
||||
// The following are defines for the bit fields in the DMAPERIPHID0 register
|
||||
//
|
||||
//*****************************************************************************
|
||||
#define UDMA_DMAPERIPHID0_PID0_S 0U
|
||||
#define UDMA_DMAPERIPHID0_PID0_M 0xFFU // DMA Peripheral ID Register
|
||||
// [7:0]
|
||||
|
||||
//*****************************************************************************
|
||||
//
|
||||
// The following are defines for the bit fields in the DMAPERIPHID1 register
|
||||
//
|
||||
//*****************************************************************************
|
||||
#define UDMA_DMAPERIPHID1_PID1_S 0U
|
||||
#define UDMA_DMAPERIPHID1_PID1_M 0xFFU // DMA Peripheral ID Register
|
||||
// [15:8]
|
||||
|
||||
//*****************************************************************************
|
||||
//
|
||||
// The following are defines for the bit fields in the DMAPERIPHID2 register
|
||||
//
|
||||
//*****************************************************************************
|
||||
#define UDMA_DMAPERIPHID2_PID2_S 0U
|
||||
#define UDMA_DMAPERIPHID2_PID2_M 0xFFU // DMA Peripheral ID Register
|
||||
// [23:16]
|
||||
|
||||
//*****************************************************************************
|
||||
//
|
||||
// The following are defines for the bit fields in the DMAPERIPHID3 register
|
||||
//
|
||||
//*****************************************************************************
|
||||
#define UDMA_DMAPERIPHID3_PID3_S 0U
|
||||
#define UDMA_DMAPERIPHID3_PID3_M 0xFFU // DMA Peripheral ID Register
|
||||
// [31:24]
|
||||
|
||||
//*****************************************************************************
|
||||
//
|
||||
// The following are defines for the bit fields in the DMAPCELLID0 register
|
||||
//
|
||||
//*****************************************************************************
|
||||
#define UDMA_DMAPCELLID0_CID0_S 0U
|
||||
#define UDMA_DMAPCELLID0_CID0_M 0xFFU // DMA PrimeCell ID Register
|
||||
// [7:0]
|
||||
|
||||
//*****************************************************************************
|
||||
//
|
||||
// The following are defines for the bit fields in the DMAPCELLID1 register
|
||||
//
|
||||
//*****************************************************************************
|
||||
#define UDMA_DMAPCELLID1_CID1_S 0U
|
||||
#define UDMA_DMAPCELLID1_CID1_M 0xFFU // DMA PrimeCell ID Register
|
||||
// [15:8]
|
||||
|
||||
//*****************************************************************************
|
||||
//
|
||||
// The following are defines for the bit fields in the DMAPCELLID2 register
|
||||
//
|
||||
//*****************************************************************************
|
||||
#define UDMA_DMAPCELLID2_CID2_S 0U
|
||||
#define UDMA_DMAPCELLID2_CID2_M 0xFFU // DMA PrimeCell ID Register
|
||||
// [23:16]
|
||||
|
||||
//*****************************************************************************
|
||||
//
|
||||
// The following are defines for the bit fields in the DMAPCELLID3 register
|
||||
//
|
||||
//*****************************************************************************
|
||||
#define UDMA_DMAPCELLID3_CID3_S 0U
|
||||
#define UDMA_DMAPCELLID3_CID3_M 0xFFU // DMA PrimeCell ID Register
|
||||
// [31:24]
|
||||
#endif
|
||||
+123
@@ -0,0 +1,123 @@
|
||||
//###########################################################################
|
||||
//
|
||||
// FILE: hw_wwd.h
|
||||
//
|
||||
// TITLE: Definitions for the WWD registers.
|
||||
//
|
||||
//###########################################################################
|
||||
// $TI Release: $
|
||||
// $Release Date: $
|
||||
//
|
||||
// C2000Ware v5.04.00.00
|
||||
//
|
||||
// Copyright (C) 2024 Texas Instruments Incorporated - http://www.ti.com
|
||||
//
|
||||
// Redistribution and use in source and binary forms, with or without
|
||||
// modification, are permitted provided that the following conditions
|
||||
// are met:
|
||||
//
|
||||
// Redistributions of source code must retain the above copyright
|
||||
// notice, this list of conditions and the following disclaimer.
|
||||
//
|
||||
// Redistributions in binary form must reproduce the above copyright
|
||||
// notice, this list of conditions and the following disclaimer in the
|
||||
// documentation and/or other materials provided with the
|
||||
// distribution.
|
||||
//
|
||||
// Neither the name of Texas Instruments Incorporated nor the names of
|
||||
// its contributors may be used to endorse or promote products derived
|
||||
// from this software without specific prior written permission.
|
||||
//
|
||||
// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
|
||||
// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
|
||||
// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
|
||||
// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
|
||||
// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
|
||||
// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
|
||||
// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
|
||||
// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
|
||||
// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
||||
// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
|
||||
// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
// $
|
||||
//###########################################################################
|
||||
|
||||
#ifndef HW_WWD_H
|
||||
#define HW_WWD_H
|
||||
|
||||
//*****************************************************************************
|
||||
//
|
||||
// The following are defines for the WWD register offsets
|
||||
//
|
||||
//*****************************************************************************
|
||||
#define WWD_O_SCSR 0x0U // System Control & Status
|
||||
// Register
|
||||
#define WWD_O_WDCNTR 0x4U // Watchdog Counter Register
|
||||
#define WWD_O_WDKEY 0x8U // Watchdog Reset Key Register
|
||||
#define WWD_O_WDCR 0xCU // Watchdog Control Register
|
||||
#define WWD_O_WDWCR 0x10U // Watchdog Windowed Control
|
||||
// Register
|
||||
|
||||
//*****************************************************************************
|
||||
//
|
||||
// The following are defines for the bit fields in the SCSR register
|
||||
//
|
||||
//*****************************************************************************
|
||||
#define WWD_SCSR_WDOVERRIDE 0x1U // WD Override for WDDIS bit
|
||||
#define WWD_SCSR_WDENINT 0x2U // WD Interrupt Enable
|
||||
#define WWD_SCSR_RSVD_S 3U
|
||||
#define WWD_SCSR_RSVD_M 0xFFF8U // Reserved
|
||||
#define WWD_SCSR_KEY_S 16U
|
||||
#define WWD_SCSR_KEY_M 0xFFFF0000U // KEY field
|
||||
|
||||
//*****************************************************************************
|
||||
//
|
||||
// The following are defines for the bit fields in the WDCNTR register
|
||||
//
|
||||
//*****************************************************************************
|
||||
#define WWD_WDCNTR_WDCNTR_S 0U
|
||||
#define WWD_WDCNTR_WDCNTR_M 0xFFU // WD Counter
|
||||
#define WWD_WDCNTR_RSVD_S 8U
|
||||
#define WWD_WDCNTR_RSVD_M 0xFFFFFF00U // Reserved
|
||||
|
||||
//*****************************************************************************
|
||||
//
|
||||
// The following are defines for the bit fields in the WDKEY register
|
||||
//
|
||||
//*****************************************************************************
|
||||
#define WWD_WDKEY_WDKEY_S 0U
|
||||
#define WWD_WDKEY_WDKEY_M 0xFFU // WD KEY
|
||||
#define WWD_WDKEY_RSVD_S 8U
|
||||
#define WWD_WDKEY_RSVD_M 0xFFFFFF00U // Reserved
|
||||
|
||||
//*****************************************************************************
|
||||
//
|
||||
// The following are defines for the bit fields in the WDCR register
|
||||
//
|
||||
//*****************************************************************************
|
||||
#define WWD_WDCR_WDPS_S 0U
|
||||
#define WWD_WDCR_WDPS_M 0x7U // WD Clock Prescalar
|
||||
#define WWD_WDCR_WDCHK_S 3U
|
||||
#define WWD_WDCR_WDCHK_M 0x38U // WD Check Bits
|
||||
#define WWD_WDCR_WDDIS 0x40U // WD Disable
|
||||
#define WWD_WDCR_WDFLG 0x80U // WD Reset Status Flag
|
||||
#define WWD_WDCR_WDPRECLKDIV_S 8U
|
||||
#define WWD_WDCR_WDPRECLKDIV_M 0xF00U // WD Pre Clock Divider
|
||||
#define WWD_WDCR_RSVD_S 12U
|
||||
#define WWD_WDCR_RSVD_M 0xFFFFF000U // Reserved
|
||||
|
||||
//*****************************************************************************
|
||||
//
|
||||
// The following are defines for the bit fields in the WDWCR register
|
||||
//
|
||||
//*****************************************************************************
|
||||
#define WWD_WDWCR_MIN_S 0U
|
||||
#define WWD_WDWCR_MIN_M 0xFFU // WD Min Threshold setting for
|
||||
// Windowed Watchdog
|
||||
// functionality
|
||||
#define WWD_WDWCR_FIRSTKEY 0x100U // First Key Detect Flag
|
||||
#define WWD_WDWCR_RSVD_S 9U
|
||||
#define WWD_WDWCR_RSVD_M 0xFE00U // Reserved
|
||||
#define WWD_WDWCR_KEY_S 16U
|
||||
#define WWD_WDWCR_KEY_M 0xFFFF0000U // KEY field
|
||||
#endif
|
||||
+94
@@ -0,0 +1,94 @@
|
||||
/* =============================================================================
|
||||
* Copyright (c) Texas Instruments Incorporated 2012-2015
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions
|
||||
* are met:
|
||||
*
|
||||
* Redistributions of source code must retain the above copyright
|
||||
* notice, this list of conditions and the following disclaimer.
|
||||
*
|
||||
* Redistributions in binary form must reproduce the above copyright
|
||||
* notice, this list of conditions and the following disclaimer in the
|
||||
* documentation and/or other materials provided with the
|
||||
* distribution.
|
||||
*
|
||||
* Neither the name of Texas Instruments Incorporated nor the names of
|
||||
* its contributors may be used to endorse or promote products derived
|
||||
* from this software without specific prior written permission.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
|
||||
* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
|
||||
* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
|
||||
* A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
|
||||
* OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
|
||||
* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
|
||||
* LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
|
||||
* DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
|
||||
* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
||||
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
|
||||
* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
*/
|
||||
|
||||
/**
|
||||
* \file stw_dataTypes.h
|
||||
*
|
||||
* \brief Starterware header file containing standard data types.
|
||||
*
|
||||
*/
|
||||
|
||||
#ifndef STW_DATATYPES_H_
|
||||
#define STW_DATATYPES_H_
|
||||
|
||||
/* ========================================================================== */
|
||||
/* Include Files */
|
||||
/* ========================================================================== */
|
||||
|
||||
#include <stdint.h>
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
/* ========================================================================== */
|
||||
/* Macros & Typedefs */
|
||||
/* ========================================================================== */
|
||||
|
||||
typedef uint16_t Bool; /* In sync with xdc/std.h */
|
||||
typedef uint32_t UInt32;
|
||||
typedef int32_t Int32;
|
||||
typedef uint16_t UInt16;
|
||||
typedef int16_t Int16;
|
||||
typedef char Char;
|
||||
typedef void * Ptr;
|
||||
typedef uint32_t UArg;
|
||||
typedef double Double;
|
||||
typedef uint64_t UInt64;
|
||||
typedef unsigned char tBoolean;
|
||||
typedef float Float32;
|
||||
|
||||
/* To fix Misra-C errors */
|
||||
#ifndef TRUE
|
||||
#define TRUE ((Bool) 1)
|
||||
#endif
|
||||
#ifndef FALSE
|
||||
#define FALSE ((Bool) 0)
|
||||
#endif
|
||||
|
||||
/* ========================================================================== */
|
||||
/* Structure Declarations */
|
||||
/* ========================================================================== */
|
||||
|
||||
/* None */
|
||||
|
||||
/* ========================================================================== */
|
||||
/* Function Declarations */
|
||||
/* ========================================================================== */
|
||||
|
||||
/* None */
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif /* #ifndef STW_DATATYPES_H_ */
|
||||
+111
@@ -0,0 +1,111 @@
|
||||
/* =============================================================================
|
||||
* Copyright (c) Texas Instruments Incorporated 2014-2015
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions
|
||||
* are met:
|
||||
*
|
||||
* Redistributions of source code must retain the above copyright
|
||||
* notice, this list of conditions and the following disclaimer.
|
||||
*
|
||||
* Redistributions in binary form must reproduce the above copyright
|
||||
* notice, this list of conditions and the following disclaimer in the
|
||||
* documentation and/or other materials provided with the
|
||||
* distribution.
|
||||
*
|
||||
* Neither the name of Texas Instruments Incorporated nor the names of
|
||||
* its contributors may be used to endorse or promote products derived
|
||||
* from this software without specific prior written permission.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
|
||||
* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
|
||||
* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
|
||||
* A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
|
||||
* OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
|
||||
* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
|
||||
* LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
|
||||
* DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
|
||||
* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
||||
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
|
||||
* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
*/
|
||||
|
||||
/**
|
||||
* \file stw_types.h
|
||||
*
|
||||
* \brief This file contains the data types and macros commonly used in
|
||||
* Starterware.
|
||||
*/
|
||||
|
||||
#ifndef STW_TYPES_H_
|
||||
#define STW_TYPES_H_
|
||||
|
||||
/* ========================================================================== */
|
||||
/* Include Files */
|
||||
/* ========================================================================== */
|
||||
|
||||
/* None */
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
/* ========================================================================== */
|
||||
/* Macros & Typedefs */
|
||||
/* ========================================================================== */
|
||||
|
||||
/**
|
||||
* \brief This macro defines the Boolean that is used for True.
|
||||
*/
|
||||
#define SUCCESS ((uint32_t) 1U)
|
||||
|
||||
/**
|
||||
* \brief This macro defines the Boolean that is used for False.
|
||||
*/
|
||||
#define FAIL ((uint32_t) 0U)
|
||||
|
||||
#define INVALID_PARAM (-((int32_t) 1))
|
||||
|
||||
/*
|
||||
* =========== Error codes returned by STW functions ===========
|
||||
*/
|
||||
#define STW_SOK ((int32_t) 0)
|
||||
#define STW_EFAIL (-((int32_t) 1))
|
||||
#define STW_EBADARGS (-((int32_t) 2))
|
||||
#define STW_EINVALID_PARAMS (-((int32_t) 3))
|
||||
#define STW_ETIMEOUT (-((int32_t) 4))
|
||||
#define STW_EOUT_OF_RANGE (-((int32_t) 5))
|
||||
#define STW_EUNSUPPORTED_CMD (-((int32_t) 6))
|
||||
#define STW_EUNSUPPORTED_OPS (-((int32_t) 7))
|
||||
|
||||
/* ========================================================================== */
|
||||
/* Structures and Enums */
|
||||
/* ========================================================================== */
|
||||
|
||||
/* None */
|
||||
|
||||
/* ========================================================================== */
|
||||
/* Internal Function Declarations */
|
||||
/* ========================================================================== */
|
||||
|
||||
/* None */
|
||||
|
||||
/* ========================================================================== */
|
||||
/* Global Variables */
|
||||
/* ========================================================================== */
|
||||
|
||||
/* None */
|
||||
|
||||
/* ========================================================================== */
|
||||
/* Function Declarations */
|
||||
/* ========================================================================== */
|
||||
|
||||
/* None */
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
|
||||
#endif
|
||||
|
||||
#endif
|
||||
|
||||
+517
@@ -0,0 +1,517 @@
|
||||
//###########################################################################
|
||||
//
|
||||
// FILE: interrupt.c
|
||||
//
|
||||
// TITLE: Driver for the NVIC Interrupt Controller.
|
||||
//
|
||||
//###########################################################################
|
||||
// $TI Release: $
|
||||
// $Release Date: $
|
||||
//
|
||||
// C2000Ware v5.04.00.00
|
||||
//
|
||||
// Copyright (C) 2024 Texas Instruments Incorporated - http://www.ti.com
|
||||
//
|
||||
// Redistribution and use in source and binary forms, with or without
|
||||
// modification, are permitted provided that the following conditions
|
||||
// are met:
|
||||
//
|
||||
// Redistributions of source code must retain the above copyright
|
||||
// notice, this list of conditions and the following disclaimer.
|
||||
//
|
||||
// Redistributions in binary form must reproduce the above copyright
|
||||
// notice, this list of conditions and the following disclaimer in the
|
||||
// documentation and/or other materials provided with the
|
||||
// distribution.
|
||||
//
|
||||
// Neither the name of Texas Instruments Incorporated nor the names of
|
||||
// its contributors may be used to endorse or promote products derived
|
||||
// from this software without specific prior written permission.
|
||||
//
|
||||
// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
|
||||
// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
|
||||
// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
|
||||
// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
|
||||
// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
|
||||
// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
|
||||
// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
|
||||
// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
|
||||
// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
||||
// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
|
||||
// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
// $
|
||||
//###########################################################################
|
||||
|
||||
#include "interrupt.h"
|
||||
|
||||
//*****************************************************************************
|
||||
//
|
||||
// RAM Vector Table to be used as srcVectorTable in
|
||||
// Interrupt_initRAMVectorTable(). Set the size of the vector table to the
|
||||
// largest number of interrupts of any device.
|
||||
//
|
||||
//*****************************************************************************
|
||||
#ifndef USE_RTOS
|
||||
#pragma DATA_ALIGN(vectorTableRAM, 128U)
|
||||
#pragma DATA_SECTION(vectorTableRAM, ".vtable")
|
||||
void (*vectorTableRAM[NUM_INTERRUPTS])(void);
|
||||
#endif
|
||||
|
||||
//*****************************************************************************
|
||||
//
|
||||
// Interrupt_enable()
|
||||
//
|
||||
//*****************************************************************************
|
||||
void
|
||||
Interrupt_enable(uint32_t interruptNum)
|
||||
{
|
||||
//
|
||||
// Check the arguments.
|
||||
//
|
||||
ASSERT(interruptNum < NUM_INTERRUPTS);
|
||||
|
||||
//
|
||||
// Enable the interrupt.
|
||||
//
|
||||
if(interruptNum == FAULT_MPU)
|
||||
{
|
||||
HWREG(NVIC_BASE + NVIC_O_SHCSRS) |= NVIC_SHCSRS_MEMFAULTENA;
|
||||
}
|
||||
else if(interruptNum == FAULT_BUS)
|
||||
{
|
||||
HWREG(NVIC_BASE + NVIC_O_SHCSRS) |= NVIC_SHCSRS_BUSFAULTENA;
|
||||
}
|
||||
else if(interruptNum == FAULT_USAGE)
|
||||
{
|
||||
HWREG(NVIC_BASE + NVIC_O_SHCSRS) |= NVIC_SHCSRS_USGFAULTENA;
|
||||
}
|
||||
else if(interruptNum == FAULT_SYSTICK)
|
||||
{
|
||||
HWREG(NVIC_BASE + NVIC_O_SYST_CSR) |= NVIC_SYST_CSR_TICKINT;
|
||||
}
|
||||
else if(interruptNum >= 16U)
|
||||
{
|
||||
HWREG(NVIC_BASE + NVIC_O_ISER0 + (NVIC_OFFSET_INC *
|
||||
((interruptNum - 16U)/32U))) |= (uint32_t)1U <<
|
||||
((interruptNum - 16U) & 0x1FU);
|
||||
}
|
||||
else
|
||||
{
|
||||
// Do Nothing.
|
||||
}
|
||||
}
|
||||
|
||||
//*****************************************************************************
|
||||
//
|
||||
// Interrupt_disable()
|
||||
//
|
||||
//*****************************************************************************
|
||||
void
|
||||
Interrupt_disable(uint32_t interruptNum)
|
||||
{
|
||||
//
|
||||
// Check the arguments.
|
||||
//
|
||||
ASSERT(interruptNum <= NUM_INTERRUPTS);
|
||||
|
||||
//
|
||||
// Disable the interrupt.
|
||||
//
|
||||
if(interruptNum == FAULT_MPU)
|
||||
{
|
||||
HWREG(NVIC_BASE + NVIC_O_SHCSRS) &= ~NVIC_SHCSRS_MEMFAULTENA;
|
||||
}
|
||||
else if(interruptNum == FAULT_BUS)
|
||||
{
|
||||
HWREG(NVIC_BASE + NVIC_O_SHCSRS) &= ~NVIC_SHCSRS_BUSFAULTENA;
|
||||
}
|
||||
else if(interruptNum == FAULT_USAGE)
|
||||
{
|
||||
HWREG(NVIC_BASE + NVIC_O_SHCSRS) &= ~NVIC_SHCSRS_USGFAULTENA;
|
||||
}
|
||||
else if(interruptNum == FAULT_SYSTICK)
|
||||
{
|
||||
HWREG(NVIC_BASE + NVIC_O_SYST_CSR) &= ~NVIC_SYST_CSR_TICKINT;
|
||||
}
|
||||
else if(interruptNum >= 16U)
|
||||
{
|
||||
HWREG(NVIC_BASE + NVIC_O_ICER0 + (NVIC_OFFSET_INC *
|
||||
((interruptNum - 16U)/32U))) |= (uint32_t)1U <<
|
||||
((interruptNum - 16U) & 0x1FU);
|
||||
}
|
||||
else
|
||||
{
|
||||
// Do Nothing.
|
||||
}
|
||||
}
|
||||
|
||||
//*****************************************************************************
|
||||
//
|
||||
// Interrupt_isEnabled()
|
||||
//
|
||||
//*****************************************************************************
|
||||
bool
|
||||
Interrupt_isEnabled(uint32_t interruptNum)
|
||||
{
|
||||
uint32_t status;
|
||||
//
|
||||
// Check the arguments.
|
||||
//
|
||||
ASSERT(interruptNum <= NUM_INTERRUPTS);
|
||||
|
||||
//
|
||||
// Return the interrupt status
|
||||
//
|
||||
if(interruptNum == FAULT_MPU)
|
||||
{
|
||||
status = HWREG(NVIC_BASE + NVIC_O_SHCSRS) & NVIC_SHCSRS_MEMFAULTENA;
|
||||
}
|
||||
else if(interruptNum == FAULT_BUS)
|
||||
{
|
||||
status = HWREG(NVIC_BASE + NVIC_O_SHCSRS) & NVIC_SHCSRS_BUSFAULTENA;
|
||||
}
|
||||
else if(interruptNum == FAULT_USAGE)
|
||||
{
|
||||
status = HWREG(NVIC_BASE + NVIC_O_SHCSRS) & NVIC_SHCSRS_USGFAULTENA;
|
||||
}
|
||||
else if(interruptNum == FAULT_SYSTICK)
|
||||
{
|
||||
status = HWREG(NVIC_BASE + NVIC_O_SYST_CSR) & NVIC_SYST_CSR_TICKINT;
|
||||
}
|
||||
else if(interruptNum >= 16U)
|
||||
{
|
||||
status = HWREG(NVIC_BASE + (uint32_t)NVIC_O_ISER0 +
|
||||
(NVIC_OFFSET_INC *
|
||||
((interruptNum - 16U)/32U))) &
|
||||
(1U << ((interruptNum - 16U) & 0x1FU));
|
||||
}
|
||||
else
|
||||
{
|
||||
status = 0U;
|
||||
}
|
||||
|
||||
//
|
||||
// Return peripheral interrupt status.
|
||||
//
|
||||
return(status != 0U);
|
||||
}
|
||||
|
||||
//*****************************************************************************
|
||||
//
|
||||
// Interrupt_pend()
|
||||
//
|
||||
//*****************************************************************************
|
||||
void
|
||||
Interrupt_pend(uint32_t interruptNum)
|
||||
{
|
||||
//
|
||||
// Check the arguments.
|
||||
//
|
||||
ASSERT(interruptNum <= NUM_INTERRUPTS);
|
||||
|
||||
//
|
||||
// Pends the corresponding channel interrupt.
|
||||
//
|
||||
if(interruptNum == FAULT_NMI)
|
||||
{
|
||||
HWREG(NVIC_BASE + NVIC_O_ICSR) |= NVIC_ICSR_NMIPENDSET;
|
||||
}
|
||||
else if(interruptNum == FAULT_PENDSV)
|
||||
{
|
||||
HWREG(NVIC_BASE + NVIC_O_ICSR) |= NVIC_ICSR_PENDSVSET;
|
||||
}
|
||||
else if(interruptNum == FAULT_SYSTICK)
|
||||
{
|
||||
HWREG(NVIC_BASE + NVIC_O_ICSR) |= NVIC_ICSR_PENDSTSET;
|
||||
}
|
||||
else if(interruptNum == FAULT_SVCALL)
|
||||
{
|
||||
HWREG(NVIC_BASE + NVIC_O_SHCSRS) |= NVIC_SHCSRS_SVCALLPENDED;
|
||||
}
|
||||
else if(interruptNum == FAULT_BUS)
|
||||
{
|
||||
HWREG(NVIC_BASE + NVIC_O_SHCSRS) |= NVIC_SHCSRS_BUSFAULTPENDED;
|
||||
}
|
||||
else if(interruptNum == FAULT_MPU)
|
||||
{
|
||||
HWREG(NVIC_BASE + NVIC_O_SHCSRS) |= NVIC_SHCSRS_MEMFAULTPENDED;
|
||||
}
|
||||
else if(interruptNum == FAULT_USAGE)
|
||||
{
|
||||
HWREG(NVIC_BASE + NVIC_O_SHCSRS) |= NVIC_SHCSRS_USGFAULTPENDED;
|
||||
}
|
||||
else if(interruptNum >= 16U)
|
||||
{
|
||||
HWREG(NVIC_BASE + NVIC_O_ISPR0 +
|
||||
(NVIC_OFFSET_INC * ((interruptNum - 16U)/32U))) |= (uint32_t)1U <<
|
||||
((interruptNum - 16U) & 0x1FU);
|
||||
}
|
||||
else
|
||||
{
|
||||
// Do Nothing.
|
||||
}
|
||||
}
|
||||
|
||||
//*****************************************************************************
|
||||
//
|
||||
// Interrupt_unpend()
|
||||
//
|
||||
//*****************************************************************************
|
||||
void
|
||||
Interrupt_unpend(uint32_t interruptNum)
|
||||
{
|
||||
//
|
||||
// Check the arguments.
|
||||
//
|
||||
ASSERT(interruptNum <= NUM_INTERRUPTS);
|
||||
|
||||
//
|
||||
// Unpends the corresponding channel interrupt.
|
||||
//
|
||||
if(interruptNum == FAULT_PENDSV)
|
||||
{
|
||||
HWREG(NVIC_BASE + NVIC_O_ICSR) |= NVIC_ICSR_PENDSVCLR;
|
||||
}
|
||||
else if(interruptNum == FAULT_SYSTICK)
|
||||
{
|
||||
HWREG(NVIC_BASE + NVIC_O_ICSR) |= NVIC_ICSR_PENDSTCLR;
|
||||
}
|
||||
else if(interruptNum == FAULT_SVCALL)
|
||||
{
|
||||
HWREG(NVIC_BASE + NVIC_O_SHCSRS) &= ~NVIC_SHCSRS_SVCALLPENDED;
|
||||
}
|
||||
else if(interruptNum == FAULT_BUS)
|
||||
{
|
||||
HWREG(NVIC_BASE + NVIC_O_SHCSRS) &= ~NVIC_SHCSRS_BUSFAULTPENDED;
|
||||
}
|
||||
else if(interruptNum == FAULT_MPU)
|
||||
{
|
||||
HWREG(NVIC_BASE + NVIC_O_SHCSRS) &= ~NVIC_SHCSRS_MEMFAULTPENDED;
|
||||
}
|
||||
else if(interruptNum == FAULT_USAGE)
|
||||
{
|
||||
HWREG(NVIC_BASE + NVIC_O_SHCSRS) &= ~NVIC_SHCSRS_USGFAULTPENDED;
|
||||
}
|
||||
else if(interruptNum >= 16U)
|
||||
{
|
||||
HWREG(NVIC_BASE + NVIC_O_ICPR0 +
|
||||
(NVIC_OFFSET_INC * ((interruptNum - 16U)/32U))) |= (uint32_t)1U <<
|
||||
((interruptNum - 16U) & (uint32_t)0x1FU);
|
||||
}
|
||||
else
|
||||
{
|
||||
// Do Nothing.
|
||||
}
|
||||
}
|
||||
|
||||
//*****************************************************************************
|
||||
//
|
||||
// Interrupt_setPriority()
|
||||
//
|
||||
//*****************************************************************************
|
||||
void
|
||||
Interrupt_setPriority(uint32_t interruptNum, uint32_t priority)
|
||||
{
|
||||
uint32_t offset, shift;
|
||||
|
||||
//
|
||||
// Check the arguments.
|
||||
//
|
||||
ASSERT((interruptNum >= 4U) && (interruptNum < NUM_INTERRUPTS));
|
||||
|
||||
//
|
||||
// Set the interrupt priority.
|
||||
//
|
||||
if(interruptNum == FAULT_MPU)
|
||||
{
|
||||
HWREG(NVIC_BASE + NVIC_O_SHPR1) = (HWREG(NVIC_BASE + NVIC_O_SHPR1) &
|
||||
~NVIC_SHPR1_PRI_4_M) | priority;
|
||||
}
|
||||
else if(interruptNum == FAULT_BUS)
|
||||
{
|
||||
HWREG(NVIC_BASE + NVIC_O_SHPR1) = (HWREG(NVIC_BASE + NVIC_O_SHPR1) &
|
||||
~(uint32_t)NVIC_SHPR1_PRI_5_M) |
|
||||
(priority << NVIC_SHPR1_PRI_5_S);
|
||||
}
|
||||
else if(interruptNum == FAULT_USAGE)
|
||||
{
|
||||
HWREG(NVIC_BASE + NVIC_O_SHPR1) = (HWREG(NVIC_BASE + NVIC_O_SHPR1) &
|
||||
~NVIC_SHPR1_PRI_6_M) | (priority <<
|
||||
NVIC_SHPR1_PRI_6_S);
|
||||
}
|
||||
else if(interruptNum == FAULT_SVCALL)
|
||||
{
|
||||
HWREG(NVIC_BASE + NVIC_O_SHPR2) = (HWREG(NVIC_BASE + NVIC_O_SHPR2) &
|
||||
~NVIC_SHPR2_PRI_11_M) | (priority <<
|
||||
NVIC_SHPR2_PRI_11_S);
|
||||
}
|
||||
else if(interruptNum == FAULT_PENDSV)
|
||||
{
|
||||
HWREG(NVIC_BASE + NVIC_O_SHPR3) = (HWREG(NVIC_BASE + NVIC_O_SHPR3) &
|
||||
~NVIC_SHPR3_PRI_14_M) | (priority <<
|
||||
NVIC_SHPR3_PRI_14_S);
|
||||
}
|
||||
else if(interruptNum == FAULT_SYSTICK)
|
||||
{
|
||||
HWREG(NVIC_BASE + NVIC_O_SHPR3) = (HWREG(NVIC_BASE + NVIC_O_SHPR3) &
|
||||
~NVIC_SHPR3_PRI_15_M) | (priority <<
|
||||
NVIC_SHPR3_PRI_15_S);
|
||||
}
|
||||
else if(interruptNum >= 16U)
|
||||
{
|
||||
offset = (uint32_t)NVIC_OFFSET_INC * ((interruptNum - 16U)/4U);
|
||||
shift = ((uint32_t)8U * (interruptNum & 0x3U)) + 5U;
|
||||
|
||||
HWREG(NVIC_BASE + NVIC_O_IPR0 + offset) =
|
||||
(HWREG(NVIC_BASE + (uint32_t)NVIC_O_IPR0 + offset) &
|
||||
~((uint32_t)NVIC_IPR0_PRI_0_M << shift)) |
|
||||
(priority << shift);
|
||||
}
|
||||
else
|
||||
{
|
||||
// Do Nothing.
|
||||
}
|
||||
}
|
||||
|
||||
//*****************************************************************************
|
||||
//
|
||||
// Interrupt_getPriority()
|
||||
//
|
||||
//*****************************************************************************
|
||||
uint32_t
|
||||
Interrupt_getPriority(uint32_t interruptNum)
|
||||
{
|
||||
uint32_t offset, shift, status;
|
||||
//
|
||||
// Check the arguments.
|
||||
//
|
||||
ASSERT((interruptNum >= 4U) && (interruptNum < NUM_INTERRUPTS));
|
||||
|
||||
//
|
||||
// Set the interrupt priority.
|
||||
//
|
||||
if(interruptNum == FAULT_MPU)
|
||||
{
|
||||
status = HWREG(NVIC_BASE + NVIC_O_SHPR1) & NVIC_SHPR1_PRI_4_M;
|
||||
}
|
||||
else if(interruptNum == FAULT_BUS)
|
||||
{
|
||||
status = (HWREG(NVIC_BASE + NVIC_O_SHPR1) & NVIC_SHPR1_PRI_5_M) >>
|
||||
NVIC_SHPR1_PRI_5_S;
|
||||
}
|
||||
else if(interruptNum == FAULT_USAGE)
|
||||
{
|
||||
status = (HWREG(NVIC_BASE + NVIC_O_SHPR1) & NVIC_SHPR1_PRI_6_M) >>
|
||||
NVIC_SHPR1_PRI_6_S;
|
||||
}
|
||||
else if(interruptNum == FAULT_SVCALL)
|
||||
{
|
||||
status = (HWREG(NVIC_BASE + NVIC_O_SHPR2) & NVIC_SHPR2_PRI_11_M) >>
|
||||
NVIC_SHPR2_PRI_11_S;
|
||||
}
|
||||
else if(interruptNum == FAULT_PENDSV)
|
||||
{
|
||||
status = (HWREG(NVIC_BASE + NVIC_O_SHPR3) & NVIC_SHPR3_PRI_14_M) >>
|
||||
NVIC_SHPR3_PRI_14_S;
|
||||
}
|
||||
else if(interruptNum == FAULT_SYSTICK)
|
||||
{
|
||||
status = (HWREG(NVIC_BASE + NVIC_O_SHPR3) & NVIC_SHPR3_PRI_15_M) >>
|
||||
NVIC_SHPR3_PRI_15_S;
|
||||
}
|
||||
else if(interruptNum >= 16U)
|
||||
{
|
||||
offset = (uint32_t)NVIC_OFFSET_INC * ((interruptNum - 16U)/4U);
|
||||
shift = ((uint32_t)8U * (interruptNum & 0x3U)) + 5U;
|
||||
|
||||
status = (HWREG(NVIC_BASE + (uint32_t)NVIC_O_IPR0 + offset) >> shift) &
|
||||
0xFFU;
|
||||
}
|
||||
else
|
||||
{
|
||||
status = 0U;
|
||||
}
|
||||
return(status);
|
||||
}
|
||||
|
||||
//*****************************************************************************
|
||||
//
|
||||
// Interrupt_initRAMVectorTable()
|
||||
//
|
||||
//*****************************************************************************
|
||||
void
|
||||
Interrupt_initRAMVectorTable(void (*srcVectorTable[])(void),
|
||||
void (*dstVectorTable[])(void))
|
||||
{
|
||||
uint32_t index;
|
||||
|
||||
//
|
||||
// Check whether dstVectorTable lies in RAM and is correctly aligned.
|
||||
//
|
||||
ASSERT((uint32_t)dstVectorTable >= 0x20000000U);
|
||||
ASSERT(((uint32_t)dstVectorTable & 0x000003FFU) == 0U);
|
||||
|
||||
if(HWREG(NVIC_BASE + NVIC_O_VTOR) != (uint32_t)dstVectorTable)
|
||||
{
|
||||
//
|
||||
// Point the NVIC at the RAM vector table.
|
||||
//
|
||||
HWREG(NVIC_BASE + NVIC_O_VTOR) = (uint32_t)dstVectorTable;
|
||||
}
|
||||
|
||||
//
|
||||
// Copy the ISRs from temp vector table to RAM vector table.
|
||||
//
|
||||
for(index = 0U; index < NUM_INTERRUPTS; index++)
|
||||
{
|
||||
dstVectorTable[index] = srcVectorTable[index];
|
||||
}
|
||||
}
|
||||
//*****************************************************************************
|
||||
//
|
||||
// Interrupt_registerHandler()
|
||||
//
|
||||
//*****************************************************************************
|
||||
void
|
||||
Interrupt_registerHandler(uint32_t interruptNum, void (*intHandler)(void))
|
||||
{
|
||||
uint32_t index, value;
|
||||
|
||||
//
|
||||
// Check the arguments.
|
||||
//
|
||||
ASSERT(interruptNum < NUM_INTERRUPTS);
|
||||
|
||||
//
|
||||
// Make sure that the RAM vector table is correctly aligned.
|
||||
// Check vector table alignment in device datasheet.
|
||||
//
|
||||
ASSERT(((uint32_t)vectorTableRAM & 0x000003FFU) == 0U);
|
||||
|
||||
//
|
||||
// See if the RAM vector table has been initialized.
|
||||
//
|
||||
if(HWREG(NVIC_BASE + NVIC_O_VTOR) != (uint32_t)vectorTableRAM)
|
||||
{
|
||||
//
|
||||
// Copy the vector table from the beginning of FLASH to the RAM vector
|
||||
// table.
|
||||
//
|
||||
value = HWREG(NVIC_BASE + NVIC_O_VTOR);
|
||||
for(index = 0U; index < NUM_INTERRUPTS; index++)
|
||||
{
|
||||
vectorTableRAM[index] = (void (*)(void))HWREG((index * 4U) +
|
||||
value);
|
||||
}
|
||||
|
||||
//
|
||||
// Point the NVIC at the RAM vector table.
|
||||
//
|
||||
HWREG(NVIC_BASE + NVIC_O_VTOR) = (uint32_t)vectorTableRAM;
|
||||
}
|
||||
|
||||
//
|
||||
// Save the interrupt handler.
|
||||
//
|
||||
vectorTableRAM[interruptNum] = intHandler;
|
||||
}
|
||||
+765
@@ -0,0 +1,765 @@
|
||||
//###########################################################################
|
||||
//
|
||||
// FILE: interrupt.h
|
||||
//
|
||||
// TITLE: Driver for the NVIC Interrupt Controller.
|
||||
//
|
||||
//###########################################################################
|
||||
// $TI Release: $
|
||||
// $Release Date: $
|
||||
//
|
||||
// C2000Ware v5.04.00.00
|
||||
//
|
||||
// Copyright (C) 2024 Texas Instruments Incorporated - http://www.ti.com
|
||||
//
|
||||
// Redistribution and use in source and binary forms, with or without
|
||||
// modification, are permitted provided that the following conditions
|
||||
// are met:
|
||||
//
|
||||
// Redistributions of source code must retain the above copyright
|
||||
// notice, this list of conditions and the following disclaimer.
|
||||
//
|
||||
// Redistributions in binary form must reproduce the above copyright
|
||||
// notice, this list of conditions and the following disclaimer in the
|
||||
// documentation and/or other materials provided with the
|
||||
// distribution.
|
||||
//
|
||||
// Neither the name of Texas Instruments Incorporated nor the names of
|
||||
// its contributors may be used to endorse or promote products derived
|
||||
// from this software without specific prior written permission.
|
||||
//
|
||||
// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
|
||||
// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
|
||||
// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
|
||||
// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
|
||||
// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
|
||||
// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
|
||||
// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
|
||||
// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
|
||||
// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
||||
// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
|
||||
// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
// $
|
||||
//###########################################################################
|
||||
|
||||
#ifndef INTERRUPT_H
|
||||
#define INTERRUPT_H
|
||||
|
||||
//*****************************************************************************
|
||||
//
|
||||
// If building with a C++ compiler, make all of the definitions in this header
|
||||
// have a C binding.
|
||||
//
|
||||
//*****************************************************************************
|
||||
#ifdef __cplusplus
|
||||
extern "C"
|
||||
{
|
||||
#endif
|
||||
|
||||
//*****************************************************************************
|
||||
//
|
||||
//! \addtogroup interrupt_api INTERRUPT
|
||||
//! \brief This module configures the NVIC interrupt controller.
|
||||
//! @{
|
||||
//
|
||||
//*****************************************************************************
|
||||
|
||||
#include <stdbool.h>
|
||||
#include <stdint.h>
|
||||
#include "cpu.h"
|
||||
#include "debug.h"
|
||||
#include "inc_cm/hw_ints.h"
|
||||
#include "inc_cm/hw_memmap.h"
|
||||
#include "inc_cm/hw_nvic.h"
|
||||
#include "inc_cm/hw_types.h"
|
||||
|
||||
#ifndef DOXYGEN_PDF_IGNORE
|
||||
//*****************************************************************************
|
||||
//
|
||||
// Defines for the API.
|
||||
//
|
||||
//*****************************************************************************
|
||||
//*****************************************************************************
|
||||
//
|
||||
// Defines for specifying NVIC module register offset increment.
|
||||
//
|
||||
//*****************************************************************************
|
||||
#define NVIC_OFFSET_INC 0x4U //!< 8-bit offset increment
|
||||
|
||||
//*****************************************************************************
|
||||
//
|
||||
// Define for specifying the key for AIRCR register.
|
||||
//
|
||||
//*****************************************************************************
|
||||
#define NVIC_AIRCR_VECTKEY 0x05FA0000U
|
||||
|
||||
//*****************************************************************************
|
||||
//
|
||||
// Flash Vector Table defined in startup.ccs.
|
||||
//
|
||||
//*****************************************************************************
|
||||
#ifndef USE_RTOS
|
||||
extern void (*vectorTableFlash[NUM_INTERRUPTS])(void);
|
||||
#endif
|
||||
|
||||
//*****************************************************************************
|
||||
//
|
||||
// RAM Vector Table to be used as dstVectorTable in
|
||||
// Interrupt_initRAMVectorTable(). Set the size of the vector table to the
|
||||
// largest number of interrupts of any device.
|
||||
//
|
||||
//*****************************************************************************
|
||||
#ifndef USE_RTOS
|
||||
extern void (*vectorTableRAM[NUM_INTERRUPTS])(void);
|
||||
#endif
|
||||
#endif
|
||||
|
||||
//*****************************************************************************
|
||||
//
|
||||
//! Values that can be passed to Interrupt_setPriorityGrouping() as priGroup
|
||||
//! parameter.
|
||||
//
|
||||
//*****************************************************************************
|
||||
typedef enum
|
||||
{
|
||||
Interrupt_PriorityGrouping_7_1 = 0x00000000U, //!<Priority group 7.1 split
|
||||
Interrupt_PriorityGrouping_6_2 = 0x00000100U, //!<Priority group 6.2 split
|
||||
Interrupt_PriorityGrouping_5_3 = 0x00000200U, //!<Priority group 5.3 split
|
||||
Interrupt_PriorityGrouping_4_4 = 0x00000300U, //!<Priority group 4.4 split
|
||||
Interrupt_PriorityGrouping_3_5 = 0x00000400U, //!<Priority group 3.5 split
|
||||
Interrupt_PriorityGrouping_2_6 = 0x00000500U, //!<Priority group 2.6 split
|
||||
Interrupt_PriorityGrouping_1_7 = 0x00000600U, //!<Priority group 1.7 split
|
||||
Interrupt_PriorityGrouping_0_8 = 0x00000700U //!<Priority group 0.8 split
|
||||
} Interrupt_PriorityGrouping;
|
||||
|
||||
//*****************************************************************************
|
||||
//
|
||||
// Prototypes for the APIs.
|
||||
//
|
||||
//*****************************************************************************
|
||||
//*****************************************************************************
|
||||
//
|
||||
//! \internal
|
||||
//! The default interrupt handler.
|
||||
//!
|
||||
//! \param None
|
||||
//!
|
||||
//! This is the default interrupt handler for all interrupts. It simply loops
|
||||
//! forever so that the system state is preserved for observation by a
|
||||
//! debugger. Since interrupts must be disabled before unregistering the
|
||||
//! corresponding handler, this should never be called during normal operation.
|
||||
//!
|
||||
//! \return None.
|
||||
//
|
||||
//*****************************************************************************
|
||||
#ifndef USE_RTOS
|
||||
static inline void
|
||||
Interrupt_defaultHandler(void)
|
||||
{
|
||||
//
|
||||
// Go into an infinite loop.
|
||||
//
|
||||
while(1)
|
||||
{
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
||||
//*****************************************************************************
|
||||
//
|
||||
//! Enables the processor interrupt.
|
||||
//!
|
||||
//! \param None
|
||||
//!
|
||||
//! This function allows the processor to respond to interrupts. This function
|
||||
//! does not affect the set of interrupts enabled in the interrupt controller,
|
||||
//! it just gates the single interrupt from the controller to the processor.
|
||||
//!
|
||||
//! \return Returns \b true if interrupts were disabled when the function was
|
||||
//! called or \b false if they were initially enabled.
|
||||
//
|
||||
//*****************************************************************************
|
||||
static inline bool
|
||||
Interrupt_enableInProcessor(void)
|
||||
{
|
||||
//
|
||||
// Enable processor interrupts.
|
||||
//
|
||||
return(CPU_clearPRIMASK() == (int32_t)0x1);
|
||||
}
|
||||
|
||||
//*****************************************************************************
|
||||
//
|
||||
//! Disables the processor interrupt.
|
||||
//!
|
||||
//! \param None
|
||||
//!
|
||||
//! This function prevents the processor from receiving interrupts. This
|
||||
//! function does not affect the set of interrupts enabled in the interrupt
|
||||
//! controller; it just gates the single interrupt from the controller to the
|
||||
//! processor.
|
||||
//!
|
||||
//! \return Returns \b true if interrupts were already disabled when the
|
||||
//! function was called or \b false if they were initially enabled.
|
||||
//
|
||||
//*****************************************************************************
|
||||
static inline bool
|
||||
Interrupt_disableInProcessor(void)
|
||||
{
|
||||
//
|
||||
// Disable processor interrupts.
|
||||
//
|
||||
return(CPU_setPRIMASK() == (int32_t)0x1);
|
||||
}
|
||||
|
||||
//*****************************************************************************
|
||||
//
|
||||
//! Triggers an interrupt.
|
||||
//!
|
||||
//! \param None
|
||||
//!
|
||||
//! \param interruptNum specifies the interrupt to be triggered.
|
||||
//!
|
||||
//! This function performs a software trigger of an interrupt.The interrupt
|
||||
//! controller behaves as if the corresponding interrupt line was asserted,
|
||||
//! and the interrupt is handled in the same manner (meaning that it must be
|
||||
//! enabled in order to be processed, and the processing is based on its
|
||||
//! priority with respect to other unhandled interrupts).
|
||||
//!
|
||||
//! \return None.
|
||||
//
|
||||
//*****************************************************************************
|
||||
static inline void
|
||||
Interrupt_setSoftwareTrigger(uint32_t interruptNum)
|
||||
{
|
||||
//
|
||||
// Check the arguments.
|
||||
//
|
||||
ASSERT((interruptNum >= 16U) && (interruptNum < NUM_INTERRUPTS));
|
||||
|
||||
//
|
||||
// Trigger this interrupt.
|
||||
//
|
||||
HWREG(NVIC_BASE + NVIC_O_STIR) = interruptNum - 16U;
|
||||
}
|
||||
|
||||
//*****************************************************************************
|
||||
//
|
||||
//! Sets the offset address of the vector table.
|
||||
//!
|
||||
//! \param addr is the new address of the vector table.
|
||||
//!
|
||||
//! Sets the address of the vector table. This function is for advanced users
|
||||
//! who might want to switch between multiple instances of vector tables
|
||||
//! (perhaps between flash/ram). The param addr can take following values:
|
||||
//! (uint32_t)vectorTableFlash - Offset address for Flash Vector Table
|
||||
//! (uint32_t)vectorTableRAM - Offset address for RAM Vector Table
|
||||
//!
|
||||
//! \return None.
|
||||
//
|
||||
//*****************************************************************************
|
||||
static inline void
|
||||
Interrupt_setVectorTableOffset(uint32_t addr)
|
||||
{
|
||||
HWREG(NVIC_BASE + NVIC_O_VTOR) = addr;
|
||||
}
|
||||
|
||||
//*****************************************************************************
|
||||
//
|
||||
//! Returns the offset address of the interrupt vector table.
|
||||
//!
|
||||
//! \param None
|
||||
//!
|
||||
//! This function returns the offset address of the interrupt vector table.
|
||||
//!
|
||||
//! \return Offset address of the vector table.
|
||||
//
|
||||
//*****************************************************************************
|
||||
static inline uint32_t
|
||||
Interrupt_getVectorTableOffset(void)
|
||||
{
|
||||
return(HWREG(NVIC_BASE + NVIC_O_VTOR));
|
||||
}
|
||||
|
||||
//*****************************************************************************
|
||||
//
|
||||
//! Sets the priority grouping of the interrupt controller.
|
||||
//!
|
||||
//! \param priGrouping specifies the required priority grouping
|
||||
//!
|
||||
//! This function specifies the split between preemptable priority levels and
|
||||
//! sub-priority levels in the interrupt priority specification. The range of
|
||||
//! the grouping values are dependent upon the hardware implementation; on
|
||||
//! the MSP432 family, three bits are available for hardware interrupt
|
||||
//! prioritization and therefore priority grouping values of three through
|
||||
//! seven have the same effect.
|
||||
//!
|
||||
//! \return None.
|
||||
//
|
||||
//*****************************************************************************
|
||||
static inline void
|
||||
Interrupt_setPriorityGrouping(Interrupt_PriorityGrouping priGrouping)
|
||||
{
|
||||
//
|
||||
// Check the arguments.
|
||||
//
|
||||
ASSERT(priGrouping < NUM_PRIORITY);
|
||||
|
||||
//
|
||||
// Set the priority grouping.
|
||||
//
|
||||
HWREG(NVIC_BASE + NVIC_O_AIRCR) = NVIC_AIRCR_VECTKEY |
|
||||
(uint32_t)priGrouping;
|
||||
}
|
||||
|
||||
//*****************************************************************************
|
||||
//
|
||||
//! Gets the priority grouping of the interrupt controller.
|
||||
//!
|
||||
//! \param None
|
||||
//!
|
||||
//! This function returns the split between preemptable priority levels and
|
||||
//! sub-priority levels in the interrupt priority specification.
|
||||
//!
|
||||
//! \return The number of bits of preemptable priority.
|
||||
//
|
||||
//*****************************************************************************
|
||||
static inline uint32_t
|
||||
Interrupt_getPriorityGrouping(void)
|
||||
{
|
||||
//
|
||||
// Read the priority grouping.
|
||||
//
|
||||
return(HWREG(NVIC_BASE + NVIC_O_AIRCR) & NVIC_AIRCR_PRIGROUP_M);
|
||||
}
|
||||
|
||||
//*****************************************************************************
|
||||
//! Resets the core and all on-chip peripherals except Debug interface.
|
||||
//!
|
||||
//! \param None
|
||||
//!
|
||||
//! This function will perform a software reset of the entire device. The
|
||||
//! processor and all peripherals will be reset and all device registers will
|
||||
//! return to their default values (with the exception of the reset cause
|
||||
//! register, which will maintain its current value but have the software reset
|
||||
//! bit set as well).
|
||||
//!
|
||||
//! \return None
|
||||
//*****************************************************************************
|
||||
static inline void
|
||||
Interrupt_requestSystemReset(void)
|
||||
{
|
||||
//
|
||||
// Perform a software reset request. This will cause the device to reset,
|
||||
// no further code will be executed.
|
||||
//
|
||||
HWREG(NVIC_BASE + NVIC_O_AIRCR) = NVIC_AIRCR_VECTKEY |
|
||||
NVIC_AIRCR_SYSRESETREQ;
|
||||
|
||||
//
|
||||
// The device should have reset, so this should never be reached. Just in
|
||||
// case, loop forever.
|
||||
//
|
||||
while(1)
|
||||
{
|
||||
}
|
||||
}
|
||||
|
||||
//*****************************************************************************
|
||||
//
|
||||
//! Sets the priority masking level.
|
||||
//!
|
||||
//! \param priorityMask is the priority level that is masked.
|
||||
//!
|
||||
//! This function sets the interrupt priority masking level so that all
|
||||
//! interrupts at the specified or lesser priority level are masked. Masking
|
||||
//! interrupts can be used to globally disable a set of interrupts with
|
||||
//! priority below a predetermined threshold. A value of 0 disables priority
|
||||
//! masking.
|
||||
//!
|
||||
//! Smaller numbers correspond to higher interrupt priorities. So for example
|
||||
//! a priority level mask of 4 allows interrupts of priority level 0-3,
|
||||
//! and interrupts with a numerical priority of 4 and greater are blocked.
|
||||
//!
|
||||
//! \return None.
|
||||
//
|
||||
//*****************************************************************************
|
||||
static inline void
|
||||
Interrupt_setPriorityMask(uint32_t priorityMask)
|
||||
{
|
||||
//
|
||||
// Set the priority mask.
|
||||
//
|
||||
CPU_setBASEPRI(priorityMask);
|
||||
}
|
||||
|
||||
//*****************************************************************************
|
||||
//
|
||||
//! Gets the priority masking level.
|
||||
//!
|
||||
//! \param None
|
||||
//!
|
||||
//! This function gets the current setting of the interrupt priority masking
|
||||
//! level. The value returned is the priority level such that all interrupts
|
||||
//! of that and lesser priority are masked. A value of 0 means that priority
|
||||
//! masking is disabled.
|
||||
//!
|
||||
//! Smaller numbers correspond to higher interrupt priorities. So for example
|
||||
//! a priority level mask of 4 allows interrupts of priority level 0-3,
|
||||
//! and interrupts with a numerical priority of 4 and greater are blocked.
|
||||
//!
|
||||
//! \return Returns the value of the interrupt priority level mask.
|
||||
//
|
||||
//*****************************************************************************
|
||||
static inline uint32_t
|
||||
Interrupt_getPriorityMask(void)
|
||||
{
|
||||
//
|
||||
// Return the current priority mask.
|
||||
//
|
||||
return((uint32_t)CPU_getBASEPRI());
|
||||
}
|
||||
|
||||
//*****************************************************************************
|
||||
//
|
||||
//! Enables the processor to sleep when exiting an ISR.
|
||||
//!
|
||||
//! \param None
|
||||
//!
|
||||
//! This function enables the processor to sleep when exiting an ISR. For low
|
||||
//! power operation, this is ideal as power cycles are not wasted with the
|
||||
//! processing required for waking up from an ISR and going back to sleep.
|
||||
//!
|
||||
//! \return None
|
||||
//
|
||||
//*****************************************************************************
|
||||
static inline void
|
||||
Interrupt_enableSleepOnISRExit(void)
|
||||
{
|
||||
HWREG(NVIC_BASE + NVIC_O_SCR) |= NVIC_SCR_SLEEPONEXIT;
|
||||
}
|
||||
|
||||
//*****************************************************************************
|
||||
//
|
||||
//! Disables the processor to sleep when exiting an ISR.
|
||||
//!
|
||||
//! \param None
|
||||
//!
|
||||
//! This function disables the processor to sleep when exiting an ISR.
|
||||
//!
|
||||
//! \return None
|
||||
//
|
||||
//*****************************************************************************
|
||||
static inline void
|
||||
Interrupt_disableSleepOnISRExit(void)
|
||||
{
|
||||
HWREG(NVIC_BASE + NVIC_O_SCR) &= ~NVIC_SCR_SLEEPONEXIT;
|
||||
}
|
||||
|
||||
//*****************************************************************************
|
||||
//! Enables deep sleep mode as the low power mode.
|
||||
//!
|
||||
//! \param None
|
||||
//!
|
||||
//! This function enables deep sleep mode as the low power mode.
|
||||
//! until the processor returns to run mode.
|
||||
//!
|
||||
//! \return None.
|
||||
//*****************************************************************************
|
||||
static inline void
|
||||
Interrupt_enableDeepSleepMode(void)
|
||||
{
|
||||
HWREG(NVIC_BASE + NVIC_O_SCR) |= NVIC_SCR_SLEEPDEEP;
|
||||
}
|
||||
|
||||
//*****************************************************************************
|
||||
//! Disables deep sleep mode as the low power mode.
|
||||
//!
|
||||
//! \param None
|
||||
//!
|
||||
//! This function enables deep sleep mode as the low power mode.
|
||||
//! until the processor returns to run mode.
|
||||
//!
|
||||
//! \return None.
|
||||
//*****************************************************************************
|
||||
static inline void
|
||||
Interrupt_disableDeepSleepMode(void)
|
||||
{
|
||||
HWREG(NVIC_BASE + NVIC_O_SCR) &= ~NVIC_SCR_SLEEPDEEP;
|
||||
}
|
||||
|
||||
//*****************************************************************************
|
||||
//! Enables processor wake up by all the interrupts.
|
||||
//!
|
||||
//! \param None
|
||||
//!
|
||||
//! This function enables processor wake up by all the interrupts i.e both the
|
||||
//! enables and disabled interrupts.
|
||||
//!
|
||||
//! \return None.
|
||||
//*****************************************************************************
|
||||
static inline void
|
||||
Interrupt_enableWakeupOnPend(void)
|
||||
{
|
||||
HWREG(NVIC_BASE + NVIC_O_SCR) |= NVIC_SCR_SEVONPEND;
|
||||
}
|
||||
|
||||
//*****************************************************************************
|
||||
//! Disables processor wake up by all the interrupts.
|
||||
//!
|
||||
//! \param None
|
||||
//!
|
||||
//! This function disables processor wake up by all the interrupts i.e only
|
||||
//! enabled interrupts can wake up the processor.
|
||||
//!
|
||||
//! \return None.
|
||||
//*****************************************************************************
|
||||
static inline void
|
||||
Interrupt_disableWakeupOnPend(void)
|
||||
{
|
||||
HWREG(NVIC_BASE + NVIC_O_SCR) &= ~NVIC_SCR_SEVONPEND;
|
||||
}
|
||||
|
||||
//*****************************************************************************
|
||||
//
|
||||
//! Unregisters the function to be called when an interrupt occurs.
|
||||
//!
|
||||
//! \param interruptNum specifies the interrupt in question.
|
||||
//!
|
||||
//! This function is used to indicate that no handler should be called when the
|
||||
//! given interrupt is asserted to the processor. The interrupt source is
|
||||
//! automatically disabled (via Interrupt_disableInterrupt()) if necessary.
|
||||
//!
|
||||
//! \sa Interrupt_registerInterrupt() for important information about
|
||||
//! registering interrupt handlers.
|
||||
//!
|
||||
//! See \link Interrupt_enable() \endlink for details about the interrupt
|
||||
//! parameter
|
||||
//!
|
||||
//! \return None.
|
||||
//
|
||||
//*****************************************************************************
|
||||
static inline void
|
||||
Interrupt_unregisterHandler(uint32_t interruptNum)
|
||||
{
|
||||
//
|
||||
// Check the arguments.
|
||||
//
|
||||
ASSERT(interruptNum < NUM_INTERRUPTS);
|
||||
|
||||
//
|
||||
// Reset the interrupt handler.
|
||||
//
|
||||
vectorTableRAM[interruptNum] = Interrupt_defaultHandler;
|
||||
}
|
||||
|
||||
//*****************************************************************************
|
||||
//
|
||||
//! Registers a function to be called when an interrupt occurs.
|
||||
//!
|
||||
//! \param interruptNum specifies the interrupt in question.
|
||||
//! \param intHandler is a pointer to the function to be called.
|
||||
//!
|
||||
//! \note The use of this function (directly or indirectly via a peripheral
|
||||
//! driver interrupt register function) moves the interrupt vector table from
|
||||
//! flash to SRAM. Therefore, care must be taken when linking the application
|
||||
//! to ensure that the SRAM vector table is located at the beginning of SRAM,
|
||||
//! otherwise the NVIC does not look in the correct portion of memory for the
|
||||
//! vector table (it requires the vector table be on a 1 kB memory alignment).
|
||||
//! Normally, the SRAM vector table is so placed via the use of linker scripts.
|
||||
//! See the discussion of compile-time versus run-time interrupt handler
|
||||
//! registration in the introduction to this chapter.
|
||||
//!
|
||||
//! \note This function is only used if the customer wants to specify the
|
||||
//! interrupt handler at run time. In most cases, this is done through means
|
||||
//! of the user setting the ISR function pointer in the startup file. Refer
|
||||
//! Refer to the Module Operation section for more details.
|
||||
//!
|
||||
//! See \link Interrupt_enable() \endlink for details about the interrupt
|
||||
//! parameter
|
||||
//!
|
||||
//! \return None.
|
||||
//
|
||||
//*****************************************************************************
|
||||
extern void
|
||||
Interrupt_registerHandler(uint32_t interruptNum, void (*intHandler)(void));
|
||||
|
||||
//*****************************************************************************
|
||||
//
|
||||
//! Enables an interrupt in interrupt controller.
|
||||
//!
|
||||
//! \param base is the base address of the NVIC module.
|
||||
//! \param interruptNum is the interrupt to be enabled.
|
||||
//!
|
||||
//! This function enables the specified interrupt in the interrupt controller.
|
||||
//! The parameter interruptNum can take any of the valid interrupts from
|
||||
//! hw_ints.h file. Other enables for the interrupt (such as at the peripheral
|
||||
//! level) are unaffected by this function.
|
||||
//!
|
||||
//! \return None.
|
||||
//
|
||||
//*****************************************************************************
|
||||
extern void
|
||||
Interrupt_enable(uint32_t interruptNum);
|
||||
|
||||
//*****************************************************************************
|
||||
//
|
||||
//! Disables an interrupt in interrupt controller.
|
||||
//!
|
||||
//! \param interruptNum is the interrupt to be disabled.
|
||||
//!
|
||||
//! This function disables the specified interrupt in the interrupt controller.
|
||||
//! The parameter interruptNum can take any of the valid interrupts from
|
||||
//! hw_ints.h file. Other enables for the interrupt (such as at the peripheral
|
||||
//! level) are unaffected by this function.
|
||||
//!
|
||||
//! \return None.
|
||||
//
|
||||
//*****************************************************************************
|
||||
extern void
|
||||
Interrupt_disable(uint32_t interruptNum);
|
||||
|
||||
//*****************************************************************************
|
||||
//
|
||||
//! Returns if a peripheral interrupt is enabled.
|
||||
//!
|
||||
//! \param interruptNum is the interrupt to be checked.
|
||||
//!
|
||||
//! This function checks if the specified interrupt is enabled in the interrupt
|
||||
//! controller. The \e interruptNum parameter must be one of the valid
|
||||
//! interrupts defined in the inc/hw_ints.h header file.
|
||||
//!
|
||||
//! \return None.
|
||||
//
|
||||
//*****************************************************************************
|
||||
extern bool
|
||||
Interrupt_isEnabled(uint32_t interruptNum);
|
||||
|
||||
//*****************************************************************************
|
||||
//
|
||||
//! Pends an interrupt.
|
||||
//!
|
||||
//! \param interruptNum specifies the interrupt to be pended.
|
||||
//!
|
||||
//! The specified interrupt is pended in the interrupt controller. Pending an
|
||||
//! interrupt causes the interrupt controller to execute the corresponding
|
||||
//! interrupt handler at the next available time, based on the current
|
||||
//! interrupt state priorities. For example, if called by a higher priority
|
||||
//! interrupt handler, the specified interrupt handler is not called until
|
||||
//! after the current interrupt handler has completed execution. The interrupt
|
||||
//! must have been enabled for it to be called.
|
||||
//!
|
||||
//! See \link Interrupt_enable() \endlink for details about the
|
||||
//! interrupt parameter
|
||||
//!
|
||||
//! \return None.
|
||||
//
|
||||
//*****************************************************************************
|
||||
extern void
|
||||
Interrupt_pend(uint32_t interruptNum);
|
||||
|
||||
//*****************************************************************************
|
||||
//
|
||||
//! Un-pends an interrupt.
|
||||
//!
|
||||
//! \param interruptNumber specifies the interrupt to be un-pended.
|
||||
//!
|
||||
//! The specified interrupt is un-pended in the interrupt controller. This
|
||||
//! will cause any previously generated interrupts that have not been handled
|
||||
//! yet (due to higher priority interrupts or the interrupt no having been
|
||||
//! enabled yet) to be discarded.
|
||||
//!
|
||||
//! See \link Interrupt_enable() \endlink for details about the interrupt
|
||||
//! parameter
|
||||
//!
|
||||
//! \return None.
|
||||
//
|
||||
//*****************************************************************************
|
||||
extern void
|
||||
Interrupt_unpend(uint32_t interruptNum);
|
||||
|
||||
//*****************************************************************************
|
||||
//
|
||||
//! Sets the priority of an interrupt.
|
||||
//!
|
||||
//! \param interruptNumber specifies the interrupt in question.
|
||||
//! \param priority specifies the priority of the interrupt.
|
||||
//!
|
||||
//! This function is used to set the priority of an interrupt. When multiple
|
||||
//! interrupts are asserted simultaneously, the ones with the highest priority
|
||||
//! are processed before the lower priority interrupts. Smaller numbers
|
||||
//! correspond to higher interrupt priorities; priority 0 is the highest
|
||||
//! interrupt priority.
|
||||
//!
|
||||
//! The hardware priority mechanism only looks at the upper N bits of the
|
||||
//! priority level, so any prioritization must be performed in those bits.
|
||||
//! The remaining bits can be used to sub-prioritize the interrupt sources,
|
||||
//! and may be used by the hardware priority mechanism on a future part. This
|
||||
//! arrangement allows priorities to migrate to different NVIC implementations
|
||||
//! without changing the gross prioritization of the interrupts.
|
||||
//!
|
||||
//! See \link Interrupt_enable() \endlink for details about the interrupt
|
||||
//! parameter
|
||||
//!
|
||||
//! \return None.
|
||||
//
|
||||
//*****************************************************************************
|
||||
extern void
|
||||
Interrupt_setPriority(uint32_t interruptNum, uint32_t priority);
|
||||
|
||||
//*****************************************************************************
|
||||
//
|
||||
//! Gets the priority of an interrupt.
|
||||
//!
|
||||
//! \param interruptNumber specifies the interrupt in question.
|
||||
//!
|
||||
//! This function gets the priority of an interrupt. See
|
||||
//! Interrupt_setPriority() for a definition of the priority value.
|
||||
//!
|
||||
//! See \link Interrupt_enable() \endlink for details about the interrupt
|
||||
//! parameter
|
||||
//!
|
||||
//! \return Returns the interrupt priority, or -1 if an invalid interrupt was
|
||||
//! specified.
|
||||
//
|
||||
//*****************************************************************************
|
||||
extern uint32_t
|
||||
Interrupt_getPriority(uint32_t interruptNum);
|
||||
|
||||
//*****************************************************************************
|
||||
//
|
||||
//! Initializes all the ISRs in the RAM vector table.
|
||||
//!
|
||||
//! \param srcVectorTable is source vector table array
|
||||
//! \param dstVectorTable is destination vector table array
|
||||
//!
|
||||
//! This function initializes all the ISRs in the RAM vector table. It copies
|
||||
//! the ISR addresses from temporary source table to destination RAM vector
|
||||
//! table. The \e srcVectorTable can be preinitialised table which can be used
|
||||
//! to initialize vector table in one go. \e dstVectorTable can be the RAM
|
||||
//! vector table to be populated.
|
||||
//!
|
||||
//! \return None
|
||||
//
|
||||
//*****************************************************************************
|
||||
extern void
|
||||
Interrupt_initRAMVectorTable(void (*srcVectorTable[])(void),
|
||||
void (*dstVectorTable[])(void));
|
||||
|
||||
//*****************************************************************************
|
||||
//
|
||||
// Close the Doxygen group.
|
||||
//! @}
|
||||
//
|
||||
//*****************************************************************************
|
||||
|
||||
//*****************************************************************************
|
||||
//
|
||||
// Mark the end of the C bindings section for C++ compilers.
|
||||
//
|
||||
//*****************************************************************************
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif // INTERRUPT_H
|
||||
+458
@@ -0,0 +1,458 @@
|
||||
//###########################################################################
|
||||
//
|
||||
// FILE: ipc.c
|
||||
//
|
||||
// TITLE: C28x IPC driver.
|
||||
//
|
||||
//###########################################################################
|
||||
// $TI Release: $
|
||||
// $Release Date: $
|
||||
//
|
||||
// C2000Ware v5.04.00.00
|
||||
//
|
||||
// Copyright (C) 2024 Texas Instruments Incorporated - http://www.ti.com
|
||||
//
|
||||
// Redistribution and use in source and binary forms, with or without
|
||||
// modification, are permitted provided that the following conditions
|
||||
// are met:
|
||||
//
|
||||
// Redistributions of source code must retain the above copyright
|
||||
// notice, this list of conditions and the following disclaimer.
|
||||
//
|
||||
// Redistributions in binary form must reproduce the above copyright
|
||||
// notice, this list of conditions and the following disclaimer in the
|
||||
// documentation and/or other materials provided with the
|
||||
// distribution.
|
||||
//
|
||||
// Neither the name of Texas Instruments Incorporated nor the names of
|
||||
// its contributors may be used to endorse or promote products derived
|
||||
// from this software without specific prior written permission.
|
||||
//
|
||||
// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
|
||||
// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
|
||||
// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
|
||||
// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
|
||||
// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
|
||||
// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
|
||||
// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
|
||||
// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
|
||||
// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
||||
// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
|
||||
// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
// $
|
||||
//###########################################################################
|
||||
|
||||
#include "ipc.h"
|
||||
|
||||
//
|
||||
// Macros internal to the IPC driver
|
||||
//
|
||||
#define IPC_REG_BOOTSTS_OFFSET 0x40U
|
||||
|
||||
#define IPC_CPU1_TO_CPU2_MSGRAM_CPU1VIEW 0x0003A000U
|
||||
#define IPC_CPU1_TO_CPU2_MSGRAM_CPU2VIEW 0x0003A000U
|
||||
|
||||
#define IPC_CPU1_TO_CM_MSGRAM_CPU1VIEW 0x00039000U
|
||||
#define IPC_CPU1_TO_CM_MSGRAM_CMVIEW 0x20080000U
|
||||
|
||||
#define IPC_CPU2_TO_CPU1_MSGRAM_CPU2VIEW 0x0003B000U
|
||||
#define IPC_CPU2_TO_CPU1_MSGRAM_CPU1VIEW 0x0003B000U
|
||||
|
||||
#define IPC_CPU2_TO_CM_MSGRAM_CPU2VIEW 0x00039000U
|
||||
#define IPC_CPU2_TO_CM_MSGRAM_CMVIEW 0x20084000U
|
||||
|
||||
#define IPC_CM_TO_CPU1_MSGRAM_CMVIEW 0x20082000U
|
||||
#define IPC_CM_TO_CPU1_MSGRAM_CPU1VIEW 0x00038000U
|
||||
|
||||
#define IPC_CM_TO_CPU2_MSGRAM_CMVIEW 0x20086000U
|
||||
#define IPC_CM_TO_CPU2_MSGRAM_CPU2VIEW 0x00038000U
|
||||
|
||||
#define IPC_ADDR_OFFSET_NOCHANGE 2U
|
||||
#define IPC_ADDR_OFFSET_MUL2 4U
|
||||
#define IPC_ADDR_OFFSET_DIV2 1U
|
||||
|
||||
#define IPC_ADDR_OFFSET_CORR(addr, corr) (((addr) * (corr)) / 2U)
|
||||
|
||||
#if IPC_MSGQ_SUPPORT == 1U
|
||||
//
|
||||
// Global Circular Buffer Definitions
|
||||
//
|
||||
|
||||
#pragma DATA_SECTION(IPC_CM_To_CPU1_PutBuffer, "MSGRAM_CM_TO_CPU1")
|
||||
#pragma DATA_SECTION(IPC_CM_To_CPU1_GetBuffer, "MSGRAM_CPU1_TO_CM")
|
||||
#pragma DATA_SECTION(IPC_CM_To_CPU2_PutBuffer, "MSGRAM_CM_TO_CPU2")
|
||||
#pragma DATA_SECTION(IPC_CM_To_CPU2_GetBuffer, "MSGRAM_CPU2_TO_CM")
|
||||
|
||||
IPC_PutBuffer_t IPC_CM_To_CPU1_PutBuffer;
|
||||
IPC_GetBuffer_t IPC_CM_To_CPU1_GetBuffer;
|
||||
IPC_PutBuffer_t IPC_CM_To_CPU2_PutBuffer;
|
||||
IPC_GetBuffer_t IPC_CM_To_CPU2_GetBuffer;
|
||||
#endif
|
||||
|
||||
const IPC_Instance_t IPC_Instance[IPC_TOTAL_NUM] = {
|
||||
|
||||
/* IPC_CM_L_CPU1_R */
|
||||
{
|
||||
.IPC_Flag_Ctr_Reg = (volatile IPC_Flag_Ctr_Reg_t *) IPC_CMTOCPU1_BASE,
|
||||
.IPC_SendCmd_Reg = (volatile IPC_SendCmd_Reg_t *)
|
||||
(IPC_CMTOCPU1_BASE + IPC_O_CMTOCPU1IPCSENDCOM),
|
||||
.IPC_RecvCmd_Reg = (volatile IPC_RecvCmd_Reg_t *)
|
||||
(IPC_CMTOCPU1_BASE + IPC_O_CPU1TOCMIPCRECVCOM),
|
||||
.IPC_Boot_Pump_Reg = (volatile IPC_Boot_Pump_Reg_t *)
|
||||
(IPC_CMTOCPU1_BASE + IPC_REG_BOOTSTS_OFFSET),
|
||||
.IPC_IntNum = {INT_IPC_CPU1TOCM_0, INT_IPC_CPU1TOCM_1,
|
||||
INT_IPC_CPU1TOCM_2, INT_IPC_CPU1TOCM_3,
|
||||
INT_IPC_CPU1TOCM_4, INT_IPC_CPU1TOCM_5,
|
||||
INT_IPC_CPU1TOCM_6, INT_IPC_CPU1TOCM_7},
|
||||
.IPC_MsgRam_LtoR = IPC_CM_TO_CPU1_MSGRAM_CMVIEW,
|
||||
.IPC_MsgRam_RtoL = IPC_CPU1_TO_CM_MSGRAM_CMVIEW,
|
||||
.IPC_Offset_Corr = IPC_ADDR_OFFSET_MUL2
|
||||
#if IPC_MSGQ_SUPPORT == 1U
|
||||
,
|
||||
.IPC_PutBuffer = &IPC_CM_To_CPU1_PutBuffer,
|
||||
.IPC_GetBuffer = &IPC_CM_To_CPU1_GetBuffer
|
||||
#endif
|
||||
},
|
||||
|
||||
/* IPC_CM_L_CPU2_R */
|
||||
{
|
||||
.IPC_Flag_Ctr_Reg = (volatile IPC_Flag_Ctr_Reg_t *) IPC_CMTOCPU2_BASE,
|
||||
.IPC_SendCmd_Reg = (volatile IPC_SendCmd_Reg_t *)
|
||||
(IPC_CMTOCPU2_BASE + IPC_O_CMTOCPU2IPCSENDCOM),
|
||||
.IPC_RecvCmd_Reg = (volatile IPC_RecvCmd_Reg_t *)
|
||||
(IPC_CMTOCPU2_BASE + IPC_O_CPU2TOCMIPCRECVCOM),
|
||||
.IPC_Boot_Pump_Reg = (volatile IPC_Boot_Pump_Reg_t *)
|
||||
(IPC_CMTOCPU2_BASE + IPC_REG_BOOTSTS_OFFSET),
|
||||
.IPC_IntNum = {INT_IPC_CPU2TOCM_0, INT_IPC_CPU2TOCM_1,
|
||||
INT_IPC_CPU2TOCM_2, INT_IPC_CPU2TOCM_3,
|
||||
INT_IPC_CPU2TOCM_4, INT_IPC_CPU2TOCM_5,
|
||||
INT_IPC_CPU2TOCM_6, INT_IPC_CPU2TOCM_7},
|
||||
.IPC_MsgRam_LtoR = IPC_CM_TO_CPU2_MSGRAM_CMVIEW,
|
||||
.IPC_MsgRam_RtoL = IPC_CPU2_TO_CM_MSGRAM_CMVIEW,
|
||||
.IPC_Offset_Corr = IPC_ADDR_OFFSET_MUL2
|
||||
#if IPC_MSGQ_SUPPORT == 1U
|
||||
,
|
||||
.IPC_PutBuffer = &IPC_CM_To_CPU2_PutBuffer,
|
||||
.IPC_GetBuffer = &IPC_CM_To_CPU2_GetBuffer
|
||||
#endif
|
||||
},
|
||||
};
|
||||
|
||||
//*****************************************************************************
|
||||
//
|
||||
// IPC_sendCommand
|
||||
//
|
||||
//*****************************************************************************
|
||||
bool IPC_sendCommand(IPC_Type_t ipcType, uint32_t flags, bool addrCorrEnable,
|
||||
uint32_t command, uint32_t addr, uint32_t data)
|
||||
{
|
||||
bool ret;
|
||||
|
||||
//
|
||||
// Check whether the flags are not busy
|
||||
//
|
||||
if((IPC_Instance[ipcType].IPC_Flag_Ctr_Reg->IPC_FLG & flags) == 0U)
|
||||
{
|
||||
ret = true;
|
||||
|
||||
if(addrCorrEnable)
|
||||
{
|
||||
//
|
||||
// Update the command registers. ADDR register holds the offset
|
||||
// from the base address of the MSG RAM
|
||||
//
|
||||
IPC_Instance[ipcType].IPC_SendCmd_Reg->IPC_SENDCOM = command;
|
||||
IPC_Instance[ipcType].IPC_SendCmd_Reg->IPC_SENDDATA = data;
|
||||
IPC_Instance[ipcType].IPC_SendCmd_Reg->IPC_SENDADDR =
|
||||
addr - IPC_Instance[ipcType].IPC_MsgRam_LtoR;
|
||||
}
|
||||
else
|
||||
{
|
||||
//
|
||||
// Update the command registers. addr param remains as is.
|
||||
//
|
||||
IPC_Instance[ipcType].IPC_SendCmd_Reg->IPC_SENDCOM = command;
|
||||
IPC_Instance[ipcType].IPC_SendCmd_Reg->IPC_SENDDATA = data;
|
||||
IPC_Instance[ipcType].IPC_SendCmd_Reg->IPC_SENDADDR = addr;
|
||||
}
|
||||
|
||||
//
|
||||
// Set the flags to indicate the remote core
|
||||
//
|
||||
IPC_Instance[ipcType].IPC_Flag_Ctr_Reg->IPC_SET = flags;
|
||||
}
|
||||
else
|
||||
{
|
||||
ret = false;
|
||||
}
|
||||
|
||||
return(ret);
|
||||
}
|
||||
|
||||
//*****************************************************************************
|
||||
//
|
||||
// IPC_readCommand
|
||||
//
|
||||
//*****************************************************************************
|
||||
bool IPC_readCommand(IPC_Type_t ipcType, uint32_t flags, bool addrCorrEnable,
|
||||
uint32_t* command, uint32_t* addr, uint32_t* data)
|
||||
{
|
||||
bool ret;
|
||||
uint32_t addrReg;
|
||||
|
||||
//
|
||||
// Check whether the flags are not empty
|
||||
//
|
||||
if((IPC_Instance[ipcType].IPC_Flag_Ctr_Reg->IPC_STS & flags) != 0U)
|
||||
{
|
||||
ret = true;
|
||||
|
||||
//
|
||||
// Read the command registers
|
||||
//
|
||||
*command = IPC_Instance[ipcType].IPC_RecvCmd_Reg->IPC_RECVCOM;
|
||||
addrReg = IPC_Instance[ipcType].IPC_RecvCmd_Reg->IPC_RECVADDR;
|
||||
*data = IPC_Instance[ipcType].IPC_RecvCmd_Reg->IPC_RECVDATA;
|
||||
|
||||
if(addrCorrEnable)
|
||||
{
|
||||
//
|
||||
// Calculate the address form the offset
|
||||
//
|
||||
*addr = IPC_Instance[ipcType].IPC_MsgRam_RtoL +
|
||||
IPC_ADDR_OFFSET_CORR(addrReg,
|
||||
IPC_Instance[ipcType].IPC_Offset_Corr);
|
||||
|
||||
}
|
||||
else
|
||||
{
|
||||
*addr = addrReg;
|
||||
}
|
||||
|
||||
}
|
||||
else
|
||||
{
|
||||
ret = false;
|
||||
}
|
||||
|
||||
return(ret);
|
||||
}
|
||||
|
||||
|
||||
//*****************************************************************************
|
||||
//
|
||||
// IPC_registerInterrupt
|
||||
//
|
||||
//*****************************************************************************
|
||||
void IPC_registerInterrupt(IPC_Type_t ipcType, uint32_t ipcInt,
|
||||
void (*pfnHandler)(void))
|
||||
{
|
||||
// Check for arguments
|
||||
|
||||
ASSERT(ipcInt <= IPC_INT7);
|
||||
|
||||
//
|
||||
// Get the corresponding interrupt number
|
||||
//
|
||||
uint32_t intNum = IPC_Instance[ipcType].IPC_IntNum[ipcInt];
|
||||
|
||||
//
|
||||
// Register the interrupt handler
|
||||
//
|
||||
|
||||
Interrupt_registerHandler(intNum, pfnHandler);
|
||||
|
||||
//
|
||||
// Enable the interrupt
|
||||
//
|
||||
Interrupt_enable(intNum);
|
||||
}
|
||||
|
||||
//*****************************************************************************
|
||||
//
|
||||
// IPC_unregisterInterrupt
|
||||
//
|
||||
//*****************************************************************************
|
||||
void IPC_unregisterInterrupt(IPC_Type_t ipcType, uint32_t ipcInt)
|
||||
{
|
||||
// Check for arguments
|
||||
|
||||
ASSERT(ipcInt <= IPC_INT7);
|
||||
|
||||
//
|
||||
// Get the corresponding interrupt number
|
||||
//
|
||||
uint32_t intNum = IPC_Instance[ipcType].IPC_IntNum[ipcInt];
|
||||
|
||||
//
|
||||
// Disable the interrupt.
|
||||
//
|
||||
Interrupt_disable(intNum);
|
||||
|
||||
//
|
||||
// Unregister the interrupt handler.
|
||||
//
|
||||
|
||||
Interrupt_unregisterHandler(intNum);
|
||||
}
|
||||
|
||||
#if IPC_MSGQ_SUPPORT == 1U
|
||||
//*****************************************************************************
|
||||
//
|
||||
// IPCinitMessageQueue
|
||||
//
|
||||
//*****************************************************************************
|
||||
void IPC_initMessageQueue(IPC_Type_t ipcType,
|
||||
volatile IPC_MessageQueue_t *msgQueue,
|
||||
uint32_t ipcInt_L, uint32_t ipcInt_R)
|
||||
{
|
||||
// Check for arguments
|
||||
ASSERT(msgQueue != NULL);
|
||||
ASSERT(ipcInt_L < NUM_IPC_INTERRUPTS);
|
||||
ASSERT(ipcInt_R < NUM_IPC_INTERRUPTS);
|
||||
|
||||
IPC_PutBuffer_t *PutBuffer = IPC_Instance[ipcType].IPC_PutBuffer;
|
||||
IPC_GetBuffer_t *GetBuffer = IPC_Instance[ipcType].IPC_GetBuffer;
|
||||
|
||||
//
|
||||
// L->R Put Buffer and Index Initialization
|
||||
//
|
||||
msgQueue->PutBuffer = PutBuffer->Buffer[ipcInt_R];
|
||||
msgQueue->PutWriteIndex = &(PutBuffer->PutWriteIndex[ipcInt_R]);
|
||||
msgQueue->GetReadIndex = &(PutBuffer->GetReadIndex[ipcInt_L]);
|
||||
msgQueue->PutFlag = (uint32_t)1U << ipcInt_R;
|
||||
|
||||
//
|
||||
// L->R Get Buffer and Index Initialization
|
||||
//
|
||||
msgQueue->GetBuffer = GetBuffer->Buffer[ipcInt_L];
|
||||
msgQueue->GetWriteIndex = &(GetBuffer->GetWriteIndex[ipcInt_L]);
|
||||
msgQueue->PutReadIndex = &(GetBuffer->PutReadIndex[ipcInt_R]);
|
||||
|
||||
//
|
||||
// Initialize PutBuffer WriteIndex = 0 and GetBuffer ReadIndex = 0
|
||||
//
|
||||
*(msgQueue->PutWriteIndex) = 0U;
|
||||
*(msgQueue->GetReadIndex) = 0U;
|
||||
}
|
||||
|
||||
//*****************************************************************************
|
||||
//
|
||||
// IPC_sendMessageToQueue
|
||||
//
|
||||
//*****************************************************************************
|
||||
bool IPC_sendMessageToQueue(IPC_Type_t ipcType,
|
||||
volatile IPC_MessageQueue_t *msgQueue,
|
||||
bool addrCorrEnable, IPC_Message_t *msg, bool block)
|
||||
{
|
||||
// Check for arguments
|
||||
ASSERT(msgQueue != NULL);
|
||||
ASSERT(msg != NULL);
|
||||
|
||||
uint16_t writeIndex;
|
||||
uint16_t readIndex;
|
||||
uint16_t ret = true;
|
||||
|
||||
writeIndex = *(msgQueue->PutWriteIndex);
|
||||
readIndex = *(msgQueue->PutReadIndex);
|
||||
|
||||
//
|
||||
// Wait until Put Buffer slot is free
|
||||
//
|
||||
while (((writeIndex + 1U) & MAX_BUFFER_INDEX) == readIndex)
|
||||
{
|
||||
//
|
||||
// If designated as a "Blocking" function, and Put buffer is full,
|
||||
// return immediately with fail status.
|
||||
//
|
||||
if (!block)
|
||||
{
|
||||
ret = false;
|
||||
break;
|
||||
}
|
||||
|
||||
readIndex = *(msgQueue->PutReadIndex);
|
||||
}
|
||||
|
||||
if (ret != false)
|
||||
{
|
||||
//
|
||||
// When slot is free, Write Message to PutBuffer, update PutWriteIndex,
|
||||
// and set the CPU IPC INT Flag
|
||||
//
|
||||
msgQueue->PutBuffer[writeIndex] = *msg;
|
||||
|
||||
if(addrCorrEnable)
|
||||
{
|
||||
msgQueue->PutBuffer[writeIndex].address -=
|
||||
IPC_Instance[ipcType].IPC_MsgRam_LtoR;
|
||||
}
|
||||
|
||||
writeIndex = (writeIndex + 1U) & MAX_BUFFER_INDEX;
|
||||
*(msgQueue->PutWriteIndex) = writeIndex;
|
||||
|
||||
IPC_setFlagLtoR(ipcType, msgQueue->PutFlag);
|
||||
}
|
||||
|
||||
return ret;
|
||||
}
|
||||
|
||||
//*****************************************************************************
|
||||
//
|
||||
// IPC_readMessageFromQueue
|
||||
//
|
||||
//*****************************************************************************
|
||||
bool IPC_readMessageFromQueue(IPC_Type_t ipcType,
|
||||
volatile IPC_MessageQueue_t *msgQueue,
|
||||
bool addrCorrEnable, IPC_Message_t *msg, bool block)
|
||||
{
|
||||
// Check for arguments
|
||||
ASSERT(msgQueue != NULL);
|
||||
ASSERT(msg != NULL);
|
||||
|
||||
uint16_t writeIndex;
|
||||
uint16_t readIndex;
|
||||
uint16_t ret = true;
|
||||
|
||||
writeIndex = *(msgQueue->GetWriteIndex);
|
||||
readIndex = *(msgQueue->GetReadIndex);
|
||||
|
||||
//
|
||||
// Loop while GetBuffer is empty
|
||||
//
|
||||
while (writeIndex == readIndex)
|
||||
{
|
||||
//
|
||||
// If designated as a "Blocking" function, and Get buffer is empty,
|
||||
// return immediately with fail status.
|
||||
//
|
||||
if (!block)
|
||||
{
|
||||
ret = false;
|
||||
break;
|
||||
}
|
||||
|
||||
writeIndex = *(msgQueue->GetWriteIndex);
|
||||
}
|
||||
|
||||
if (ret != false)
|
||||
{
|
||||
//
|
||||
// If there is a message in GetBuffer, Read Message and update
|
||||
// the ReadIndex
|
||||
//
|
||||
*msg = msgQueue->GetBuffer[readIndex];
|
||||
if(addrCorrEnable)
|
||||
{
|
||||
msg->address = IPC_Instance[ipcType].IPC_MsgRam_RtoL +
|
||||
IPC_ADDR_OFFSET_CORR(msg->address,
|
||||
IPC_Instance[ipcType].IPC_Offset_Corr);
|
||||
}
|
||||
|
||||
readIndex = (readIndex + 1U) & MAX_BUFFER_INDEX;
|
||||
*(msgQueue->GetReadIndex) = readIndex;
|
||||
}
|
||||
|
||||
return ret;
|
||||
}
|
||||
#endif
|
||||
+837
@@ -0,0 +1,837 @@
|
||||
//###########################################################################
|
||||
//
|
||||
// FILE: ipc.h
|
||||
//
|
||||
// TITLE: Driver for the IPC module.
|
||||
//
|
||||
//###########################################################################
|
||||
// $TI Release: $
|
||||
// $Release Date: $
|
||||
//
|
||||
// C2000Ware v5.04.00.00
|
||||
//
|
||||
// Copyright (C) 2024 Texas Instruments Incorporated - http://www.ti.com
|
||||
//
|
||||
// Redistribution and use in source and binary forms, with or without
|
||||
// modification, are permitted provided that the following conditions
|
||||
// are met:
|
||||
//
|
||||
// Redistributions of source code must retain the above copyright
|
||||
// notice, this list of conditions and the following disclaimer.
|
||||
//
|
||||
// Redistributions in binary form must reproduce the above copyright
|
||||
// notice, this list of conditions and the following disclaimer in the
|
||||
// documentation and/or other materials provided with the
|
||||
// distribution.
|
||||
//
|
||||
// Neither the name of Texas Instruments Incorporated nor the names of
|
||||
// its contributors may be used to endorse or promote products derived
|
||||
// from this software without specific prior written permission.
|
||||
//
|
||||
// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
|
||||
// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
|
||||
// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
|
||||
// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
|
||||
// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
|
||||
// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
|
||||
// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
|
||||
// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
|
||||
// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
||||
// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
|
||||
// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
// $
|
||||
//###########################################################################
|
||||
|
||||
#ifndef IPC_H
|
||||
#define IPC_H
|
||||
|
||||
//*****************************************************************************
|
||||
//
|
||||
// If building with a C++ compiler, make all of the definitions in this header
|
||||
// have a C binding.
|
||||
//
|
||||
//*****************************************************************************
|
||||
#ifdef __cplusplus
|
||||
extern "C"
|
||||
{
|
||||
#endif
|
||||
|
||||
//*****************************************************************************
|
||||
//
|
||||
//! \addtogroup ipc_api IPC
|
||||
//! @{
|
||||
//
|
||||
//*****************************************************************************
|
||||
|
||||
#include <stdbool.h>
|
||||
#include <stdint.h>
|
||||
#include "debug.h"
|
||||
#include "inc_cm/hw_memmap.h"
|
||||
#include "inc_cm/hw_types.h"
|
||||
#include "inc_cm/hw_ipc.h"
|
||||
#include "inc_cm/hw_ints.h"
|
||||
#include "interrupt.h"
|
||||
|
||||
//*****************************************************************************
|
||||
//
|
||||
// Defines for the APIs
|
||||
//
|
||||
//*****************************************************************************
|
||||
//*****************************************************************************
|
||||
//
|
||||
// Driver configuration macros
|
||||
//
|
||||
//*****************************************************************************
|
||||
#define IPC_MSGQ_SUPPORT 1U
|
||||
#define IPC_BUFFER_SIZE 4U // No. of IPC messages in circular buffer
|
||||
// (must be interval of 2)
|
||||
#define NUM_IPC_INTERRUPTS 4U // No. of IPC interrupts using circular buffer
|
||||
// (must be same number on both CPUs
|
||||
|
||||
//*****************************************************************************
|
||||
//
|
||||
// Values that can be passed as parameter flags in all the IPC API functions.
|
||||
//
|
||||
//*****************************************************************************
|
||||
#define IPC_NO_FLAG 0x00000000U //!< NO FLAG
|
||||
#define IPC_FLAG0 0x00000001U //!< IPC FLAG 0
|
||||
#define IPC_FLAG1 0x00000002U //!< IPC FLAG 1
|
||||
#define IPC_FLAG2 0x00000004U //!< IPC FLAG 2
|
||||
#define IPC_FLAG3 0x00000008U //!< IPC FLAG 3
|
||||
#define IPC_FLAG4 0x00000010U //!< IPC FLAG 4
|
||||
#define IPC_FLAG5 0x00000020U //!< IPC FLAG 5
|
||||
#define IPC_FLAG6 0x00000040U //!< IPC FLAG 6
|
||||
#define IPC_FLAG7 0x00000080U //!< IPC FLAG 7
|
||||
#define IPC_FLAG8 0x00000100U //!< IPC FLAG 8
|
||||
#define IPC_FLAG9 0x00000200U //!< IPC FLAG 9
|
||||
#define IPC_FLAG10 0x00000400U //!< IPC FLAG 10
|
||||
#define IPC_FLAG11 0x00000800U //!< IPC FLAG 11
|
||||
#define IPC_FLAG12 0x00001000U //!< IPC FLAG 12
|
||||
#define IPC_FLAG13 0x00002000U //!< IPC FLAG 13
|
||||
#define IPC_FLAG14 0x00004000U //!< IPC FLAG 14
|
||||
#define IPC_FLAG15 0x00008000U //!< IPC FLAG 15
|
||||
#define IPC_FLAG16 0x00010000U //!< IPC FLAG 16
|
||||
#define IPC_FLAG17 0x00020000U //!< IPC FLAG 17
|
||||
#define IPC_FLAG18 0x00040000U //!< IPC FLAG 18
|
||||
#define IPC_FLAG19 0x00080000U //!< IPC FLAG 19
|
||||
#define IPC_FLAG20 0x00100000U //!< IPC FLAG 20
|
||||
#define IPC_FLAG21 0x00200000U //!< IPC FLAG 21
|
||||
#define IPC_FLAG22 0x00400000U //!< IPC FLAG 22
|
||||
#define IPC_FLAG23 0x00800000U //!< IPC FLAG 23
|
||||
#define IPC_FLAG24 0x01000000U //!< IPC FLAG 24
|
||||
#define IPC_FLAG25 0x02000000U //!< IPC FLAG 25
|
||||
#define IPC_FLAG26 0x04000000U //!< IPC FLAG 26
|
||||
#define IPC_FLAG27 0x08000000U //!< IPC FLAG 27
|
||||
#define IPC_FLAG28 0x10000000U //!< IPC FLAG 28
|
||||
#define IPC_FLAG29 0x20000000U //!< IPC FLAG 29
|
||||
#define IPC_FLAG30 0x40000000U //!< IPC FLAG 30
|
||||
#define IPC_FLAG31 0x80000000U //!< IPC FLAG 31
|
||||
#define IPC_FLAG_ALL 0xFFFFFFFFU //!< All IPC flags
|
||||
|
||||
//*****************************************************************************
|
||||
//
|
||||
// Values that can be passed as parameter ipcInt in
|
||||
// IPC_registerInterrupt and IPC_unregisterInterrupt functions.
|
||||
// Please refer to the datasheet for the actual number of interrupts available
|
||||
// for each IPC instance
|
||||
//
|
||||
//*****************************************************************************
|
||||
#define IPC_INT0 0x0U //!< IPC Interrupt 0
|
||||
#define IPC_INT1 0x1U //!< IPC Interrupt 1
|
||||
#define IPC_INT2 0x2U //!< IPC Interrupt 2
|
||||
#define IPC_INT3 0x3U //!< IPC Interrupt 3
|
||||
#define IPC_INT4 0x4U //!< IPC Interrupt 4
|
||||
#define IPC_INT5 0x5U //!< IPC Interrupt 5
|
||||
#define IPC_INT6 0x6U //!< IPC Interrupt 6
|
||||
#define IPC_INT7 0x7U //!< IPC Interrupt 7
|
||||
|
||||
//*****************************************************************************
|
||||
//
|
||||
// Values that can be passed as parameter addrCorrEnable in
|
||||
// IPC_sendCommand, IPC_readCommand, IPC_sendMessageToQueue and
|
||||
// IPC_readMessageFromQueue functions.
|
||||
//
|
||||
//*****************************************************************************
|
||||
#define IPC_ADDR_CORRECTION_ENABLE true
|
||||
#define IPC_ADDR_CORRECTION_DISABLE false
|
||||
|
||||
//*****************************************************************************
|
||||
//
|
||||
// Values that can be passed as parameter block in
|
||||
// IPC_sendMessageToQueue and IPC_readMessageFromQueue functions.
|
||||
//
|
||||
//*****************************************************************************
|
||||
#define IPC_BLOCKING_CALL true
|
||||
#define IPC_NONBLOCKING_CALL false
|
||||
|
||||
//*****************************************************************************
|
||||
//
|
||||
// Macros used to get and release the flash pump sempahore
|
||||
//
|
||||
//*****************************************************************************
|
||||
|
||||
#define IPC_PUMPREQUEST_REG \
|
||||
IPC_Instance[IPC_CM_L_CPU1_R].IPC_Boot_Pump_Reg->IPC_PUMPREQUEST
|
||||
|
||||
//*****************************************************************************
|
||||
//
|
||||
// Internal macros used for message queue implementation
|
||||
//
|
||||
//*****************************************************************************
|
||||
#define MAX_BUFFER_INDEX (IPC_BUFFER_SIZE - 1U)
|
||||
|
||||
//*****************************************************************************
|
||||
//
|
||||
// Enums for the APIs
|
||||
//
|
||||
//*****************************************************************************
|
||||
|
||||
typedef enum
|
||||
{
|
||||
IPC_CM_L_CPU1_R, //!< CM - Local core, CPU1 - Remote core
|
||||
IPC_CM_L_CPU2_R, //!< CM - Local core, CPU2 - Remote core
|
||||
IPC_TOTAL_NUM
|
||||
}IPC_Type_t;
|
||||
|
||||
//*****************************************************************************
|
||||
//
|
||||
// Internal structs for register and messaage queue accesses
|
||||
//
|
||||
//*****************************************************************************
|
||||
typedef struct
|
||||
{
|
||||
uint32_t IPC_ACK;
|
||||
uint32_t IPC_STS;
|
||||
uint32_t IPC_SET;
|
||||
uint32_t IPC_CLR;
|
||||
uint32_t IPC_FLG;
|
||||
uint32_t IPC_RSVDREG;
|
||||
uint32_t IPC_COUNTERL;
|
||||
uint32_t IPC_COUNTERH;
|
||||
}IPC_Flag_Ctr_Reg_t;
|
||||
|
||||
typedef struct
|
||||
{
|
||||
uint32_t IPC_SENDCOM;
|
||||
uint32_t IPC_SENDADDR;
|
||||
uint32_t IPC_SENDDATA;
|
||||
uint32_t IPC_REMOTEREPLY;
|
||||
}IPC_SendCmd_Reg_t;
|
||||
|
||||
typedef struct
|
||||
{
|
||||
uint32_t IPC_RECVCOM;
|
||||
uint32_t IPC_RECVADDR;
|
||||
uint32_t IPC_RECVDATA;
|
||||
uint32_t IPC_LOCALREPLY;
|
||||
}IPC_RecvCmd_Reg_t;
|
||||
|
||||
typedef struct
|
||||
{
|
||||
uint32_t IPC_BOOTSTS;
|
||||
uint32_t IPC_BOOTMODE;
|
||||
uint32_t IPC_PUMPREQUEST;
|
||||
}IPC_Boot_Pump_Reg_t;
|
||||
|
||||
#if IPC_MSGQ_SUPPORT == 1U
|
||||
typedef struct
|
||||
{
|
||||
uint32_t command;
|
||||
uint32_t address;
|
||||
uint32_t dataw1;
|
||||
uint32_t dataw2;
|
||||
}IPC_Message_t;
|
||||
|
||||
typedef struct
|
||||
{
|
||||
IPC_Message_t Buffer[NUM_IPC_INTERRUPTS][IPC_BUFFER_SIZE];
|
||||
uint16_t PutWriteIndex[NUM_IPC_INTERRUPTS];
|
||||
uint16_t GetReadIndex[NUM_IPC_INTERRUPTS];
|
||||
}IPC_PutBuffer_t;
|
||||
|
||||
typedef struct
|
||||
{
|
||||
IPC_Message_t Buffer[NUM_IPC_INTERRUPTS][IPC_BUFFER_SIZE];
|
||||
uint16_t GetWriteIndex[NUM_IPC_INTERRUPTS];
|
||||
uint16_t PutReadIndex[NUM_IPC_INTERRUPTS];
|
||||
}IPC_GetBuffer_t;
|
||||
#endif
|
||||
|
||||
//*****************************************************************************
|
||||
//
|
||||
// Internal struct used to store the required information regarding an IPC
|
||||
// instance
|
||||
//
|
||||
//*****************************************************************************
|
||||
typedef struct
|
||||
{
|
||||
volatile IPC_Flag_Ctr_Reg_t* IPC_Flag_Ctr_Reg;
|
||||
volatile IPC_SendCmd_Reg_t* IPC_SendCmd_Reg;
|
||||
volatile IPC_RecvCmd_Reg_t* IPC_RecvCmd_Reg;
|
||||
volatile IPC_Boot_Pump_Reg_t* IPC_Boot_Pump_Reg;
|
||||
uint32_t IPC_IntNum[8U];
|
||||
uint32_t IPC_MsgRam_LtoR;
|
||||
uint32_t IPC_MsgRam_RtoL;
|
||||
uint32_t IPC_Offset_Corr;
|
||||
#if IPC_MSGQ_SUPPORT == 1U
|
||||
IPC_PutBuffer_t* IPC_PutBuffer;
|
||||
IPC_GetBuffer_t* IPC_GetBuffer;
|
||||
#endif
|
||||
}IPC_Instance_t;
|
||||
|
||||
extern const IPC_Instance_t IPC_Instance[IPC_TOTAL_NUM];
|
||||
|
||||
#if IPC_MSGQ_SUPPORT == 1U
|
||||
//*****************************************************************************
|
||||
//
|
||||
// A structure that defines an IPC message queue. These
|
||||
// fields are used by the IPC drivers, and normally it is not necessary for
|
||||
// user software to directly read or write fields in the table.
|
||||
//
|
||||
//*****************************************************************************
|
||||
|
||||
typedef struct
|
||||
{
|
||||
IPC_Message_t * PutBuffer;
|
||||
uint32_t PutFlag;
|
||||
uint16_t * PutWriteIndex;
|
||||
uint16_t * PutReadIndex;
|
||||
IPC_Message_t * GetBuffer;
|
||||
uint16_t * GetWriteIndex;
|
||||
uint16_t * GetReadIndex;
|
||||
} IPC_MessageQueue_t;
|
||||
#endif
|
||||
|
||||
//*****************************************************************************
|
||||
//
|
||||
// API Function prototypes
|
||||
//
|
||||
//*****************************************************************************
|
||||
|
||||
//*****************************************************************************
|
||||
//
|
||||
//! Local core sets Local to Remote IPC Flag
|
||||
//!
|
||||
//! \param ipcType is the enum corresponding to the IPC instance used
|
||||
//! \param flags is the IPC flag mask for the flags being set
|
||||
//!
|
||||
//! This function will allow the Local core system to set the designated IPC
|
||||
//! flags to send to the Remote core system. The \e flags parameter can be any
|
||||
//! of the IPC flag values: \b IPC_FLAG0 - \b IPC_FLAG31.
|
||||
//!
|
||||
//! \return None.
|
||||
//
|
||||
//*****************************************************************************
|
||||
static inline void
|
||||
IPC_setFlagLtoR(IPC_Type_t ipcType, uint32_t flags)
|
||||
{
|
||||
IPC_Instance[ipcType].IPC_Flag_Ctr_Reg->IPC_SET = flags;
|
||||
}
|
||||
|
||||
//*****************************************************************************
|
||||
//
|
||||
//! Local core clears Local to Remote IPC Flag
|
||||
//!
|
||||
//! \param ipcType is the enum corresponding to the IPC instance used
|
||||
//! \param flags is the IPC flag mask for the flags being cleared
|
||||
//!
|
||||
//! This function will allow the Local core system to clear the designated IPC
|
||||
//! flags sent to the Remote core system. The \e flags parameter can be any
|
||||
//! of the IPC flag values: \b IPC_FLAG0 - \b IPC_FLAG31.
|
||||
//!
|
||||
//! \return None.
|
||||
//
|
||||
//*****************************************************************************
|
||||
static inline void
|
||||
IPC_clearFlagLtoR(IPC_Type_t ipcType, uint32_t flags)
|
||||
{
|
||||
IPC_Instance[ipcType].IPC_Flag_Ctr_Reg->IPC_CLR = flags;
|
||||
}
|
||||
|
||||
//*****************************************************************************
|
||||
//
|
||||
//! Local core acknowledges Remote to Local IPC Flag.
|
||||
//!
|
||||
//! \param ipcType is the enum corresponding to the IPC instance used
|
||||
//! \param flags is the IPC flag mask for the flags being acknowledged.
|
||||
//!
|
||||
//! This function will allow the Local core system to acknowledge/clear the IPC
|
||||
//! flag set by the Remote core system. The \e flags parameter can be any of
|
||||
//! the IPC flag values: \b IPC_FLAG0 - \b IPC_FLAG31.
|
||||
//!
|
||||
//! \return None.
|
||||
//
|
||||
//*****************************************************************************
|
||||
static inline void
|
||||
IPC_ackFlagRtoL(IPC_Type_t ipcType, uint32_t flags)
|
||||
{
|
||||
IPC_Instance[ipcType].IPC_Flag_Ctr_Reg->IPC_ACK = flags;
|
||||
}
|
||||
|
||||
//*****************************************************************************
|
||||
//
|
||||
//! Determines whether the given IPC flags are busy or not.
|
||||
//!
|
||||
//! \param ipcType is the enum corresponding to the IPC instance used
|
||||
//! \param flags is the Local to Remote IPC flag masks to check the status of
|
||||
//!
|
||||
//! Allows the caller to determine whether the designated Local to Remote
|
||||
//! IPC flags are pending. The \e flags parameter can be any of the IPC flag
|
||||
//! values: \b IPC_FLAG0 - \b IPC_FLAG31.
|
||||
//!
|
||||
//! \return Returns \b true if the any of the designated IPC flags are busy
|
||||
//! or \b false if all the designated IPC flags are free.
|
||||
//
|
||||
//*****************************************************************************
|
||||
static inline bool
|
||||
IPC_isFlagBusyLtoR(IPC_Type_t ipcType, uint32_t flags)
|
||||
{
|
||||
return((IPC_Instance[ipcType].IPC_Flag_Ctr_Reg->IPC_FLG & flags) != 0U);
|
||||
}
|
||||
|
||||
//*****************************************************************************
|
||||
//
|
||||
//! Determines whether the given Remote to Local IPC flags are busy or not.
|
||||
//!
|
||||
//! \param ipcType is the enum corresponding to the IPC instance used
|
||||
//! \param flags is the Remote to Local IPC Flag masks to check the status of
|
||||
//!
|
||||
//! Allows the caller to determine whether the designated Remote to Local
|
||||
//! IPC flags are pending. The \e flags parameter can be any of the IPC flag
|
||||
//! values: \b IPC_FLAG0 - \b IPC_FLAG31.
|
||||
//!
|
||||
//! \return Returns \b true if the any of the designated IPC flags are busy
|
||||
//! or \b false if all the designated IPC flags are free.
|
||||
//
|
||||
//*****************************************************************************
|
||||
static inline bool
|
||||
IPC_isFlagBusyRtoL(IPC_Type_t ipcType, uint32_t flags)
|
||||
{
|
||||
return((IPC_Instance[ipcType].IPC_Flag_Ctr_Reg->IPC_STS & flags) != 0U);
|
||||
}
|
||||
|
||||
//*****************************************************************************
|
||||
//
|
||||
//! Wait for the remote core to send a flag
|
||||
//!
|
||||
//! \param ipcType is the enum corresponding to the IPC instance used
|
||||
//! \param flag is the Remote to Local IPC flag mask to wait for
|
||||
//!
|
||||
//! Allows the caller to wait for the Remote to Local flag to be send by
|
||||
//! the remote core. The \e flags parameter can be any of the IPC flag
|
||||
//! values: \b IPC_FLAG0 - \b IPC_FLAG31.
|
||||
//!
|
||||
//! \return None
|
||||
//
|
||||
//*****************************************************************************
|
||||
static inline void
|
||||
IPC_waitForFlag(IPC_Type_t ipcType, uint32_t flag)
|
||||
{
|
||||
while((IPC_Instance[ipcType].IPC_Flag_Ctr_Reg->IPC_STS & flag) == 0U)
|
||||
{
|
||||
}
|
||||
}
|
||||
|
||||
//*****************************************************************************
|
||||
//
|
||||
//! Wait for the IPC flag to be acknowledged
|
||||
//!
|
||||
//! \param ipcType is the enum corresponding to the IPC instance used
|
||||
//! \param flag is the IPC flag mask for which ack is pending
|
||||
//!
|
||||
//! Allows the caller to wait for the IPC flag to be acknowledged by the
|
||||
//! remote core. The \e flagsparameter can be any of the IPC flag values:
|
||||
//! \b IPC_FLAG0 - \b IPC_FLAG31.
|
||||
//!
|
||||
//! \return None
|
||||
//
|
||||
//*****************************************************************************
|
||||
static inline void
|
||||
IPC_waitForAck(IPC_Type_t ipcType, uint32_t flag)
|
||||
{
|
||||
while((IPC_Instance[ipcType].IPC_Flag_Ctr_Reg->IPC_FLG & flag) != 0U)
|
||||
{
|
||||
}
|
||||
}
|
||||
|
||||
//*****************************************************************************
|
||||
//
|
||||
//! Synchronises the two cores
|
||||
//!
|
||||
//! \param ipcType is the enum corresponding to the IPC instance used
|
||||
//! \param flag is the IPC flag mask with which synchronisation is done
|
||||
//!
|
||||
//! Allows the local and remote cores to synchronise. Neither core will return
|
||||
//! from this function call before the other core enters it.
|
||||
//!
|
||||
//! \note Must be called with same flag mask on both the cores
|
||||
//!
|
||||
//! \return None
|
||||
//
|
||||
//*****************************************************************************
|
||||
static inline void
|
||||
IPC_sync(IPC_Type_t ipcType, uint32_t flag)
|
||||
{
|
||||
IPC_setFlagLtoR(ipcType, flag);
|
||||
IPC_waitForFlag(ipcType, flag);
|
||||
IPC_ackFlagRtoL(ipcType, flag);
|
||||
IPC_waitForAck(ipcType, flag);
|
||||
}
|
||||
|
||||
//*****************************************************************************
|
||||
//
|
||||
//! Sends a command to the Remote core
|
||||
//!
|
||||
//! \param ipcType is the enum corresponding to the IPC instance used
|
||||
//! \param flags is the IPC flag mask for the flags to be set
|
||||
//! \param addrCorrEnable is the flag used to determine whether or not to
|
||||
//! convert the addr parameter to remote core's address space
|
||||
//! \param command is the 32-bit command value
|
||||
//! \param addr is the 32-bit address to be sent as part of command
|
||||
//! \param data is the 32-bit data to be sent as part of command
|
||||
//!
|
||||
//! Allows the caller to send a command to the remote core. A command consists
|
||||
//! of a unique command value, a 32-bit address and a 32-bit data. The function
|
||||
//! also sends the designated flags to the remote core.
|
||||
//! There may be differences in the address spaces of Local and Remote core.
|
||||
//! For example in case of F28307X device, the address spaces of C28x core and
|
||||
//! CM core are different. In case the \e addr refers to an address in the IPC
|
||||
//! MSG RAM, \e addrCorrEnable param may be used to correct the address mismatch
|
||||
//!
|
||||
//! The \e flags parameter can be any of the IPC flag values: \b IPC_FLAG0 -
|
||||
//! \b IPC_FLAG31.
|
||||
//! The \e addrCorrEnable parameter can take values IPC_ADDR_CORRECTION_ENABLE
|
||||
//! (converts the address to remote core's address space) or
|
||||
//! IPC_ADDR_CORRECTION_DISABLE(does not modify the addr parmeter)
|
||||
//!
|
||||
//! The application shall use the function IPC_getResponse to read the response
|
||||
//! sent by the remote core.
|
||||
//!
|
||||
//! \note The application is expected to wait until the the response is
|
||||
//! received before sending another command.
|
||||
//!
|
||||
//! \note \e addrCorrEnable parameter must be kept same on the sending and
|
||||
//! receiving cores
|
||||
//!
|
||||
//! \return Returns \b true if the command is sent properly and \b false if
|
||||
//! the designated flags were busy and hence command was not sent.
|
||||
//
|
||||
//*****************************************************************************
|
||||
extern bool
|
||||
IPC_sendCommand(IPC_Type_t ipcType, uint32_t flags, bool addrCorrEnable,
|
||||
uint32_t command, uint32_t addr, uint32_t data);
|
||||
|
||||
//*****************************************************************************
|
||||
//
|
||||
//! Reads a command sent by the Remote core
|
||||
//!
|
||||
//! \param ipcType is the enum corresponding to the IPC instance used
|
||||
//! \param flags is the IPC flag mask for the flags sent by the remote core
|
||||
//! \param addrCorrEnable is the flag used to determine whether or not to
|
||||
//! convert the addr parameter to remote core's address space
|
||||
//! \param command is the 32-bit pointer at which the command value is read to
|
||||
//! \param addr is the 32-bit pointer at which address value is read to
|
||||
//! \param data is the 32-bit pointer at which the data is read to
|
||||
//!
|
||||
//! Allows the caller to read a command sent by the remote core. A command
|
||||
//! consists of a unique command value, a 32-bit address and a 32-bit data.
|
||||
//! There may be differences in the address spaces of Local and Remote core.
|
||||
//! For example in case of F28307X device, the address spaces of C28x core and
|
||||
//! CM core are different. In case the \e addr refers to an address in the IPC
|
||||
//! MSG RAM, \e addrCorrEnable param may be used to correct the address mismatch
|
||||
//!
|
||||
//! The \e flags parameter can be any of the IPC flag values: \b IPC_FLAG0 -
|
||||
//! \b IPC_FLAG31.
|
||||
//! The \e addrCorrEnable parameter can take values IPC_ADDR_CORRECTION_ENABLE
|
||||
//! (converts the address to remote core's address space) or
|
||||
//! IPC_ADDR_CORRECTION_DISABLE(does not modify the addr parmeter)
|
||||
//!
|
||||
//! \note The application is expected to acknowledge the flag and send a
|
||||
//! response (if needed) after reading the command
|
||||
//!
|
||||
//! \note \e addrCorrEnable parameter must be kept same on the sending and
|
||||
//! receiving cores
|
||||
//!
|
||||
//! \return Returns \b true if the command is read properly and \b false if
|
||||
//! the designated flags were empty and hence command was not read.
|
||||
//
|
||||
//*****************************************************************************
|
||||
extern bool
|
||||
IPC_readCommand(IPC_Type_t ipcType, uint32_t flags, bool addrCorrEnable,
|
||||
uint32_t* command, uint32_t* addr, uint32_t* data);
|
||||
|
||||
//*****************************************************************************
|
||||
//
|
||||
//! Sends the response to the command sent by remote core.
|
||||
//!
|
||||
//! \param ipcType is the enum corresponding to the IPC instance used
|
||||
//! \data is the 32-bit value of the response to be sent
|
||||
//!
|
||||
//! Allows the caller to send a response to the command previously sent by the
|
||||
//! remote core
|
||||
//!
|
||||
//! \return None.
|
||||
//
|
||||
//*****************************************************************************
|
||||
static inline void
|
||||
IPC_sendResponse(IPC_Type_t ipcType, uint32_t data)
|
||||
{
|
||||
IPC_Instance[ipcType].IPC_RecvCmd_Reg->IPC_LOCALREPLY = data;
|
||||
}
|
||||
|
||||
//*****************************************************************************
|
||||
//
|
||||
//! Reads the response from the remote core.
|
||||
//!
|
||||
//! \param ipcType is the enum corresponding to the IPC instance used
|
||||
//!
|
||||
//! Allows the caller to read the response sent by the remote core to the
|
||||
//! command previously sent by the local core
|
||||
//!
|
||||
//! \return the 32-bit value of the response.
|
||||
//
|
||||
//*****************************************************************************
|
||||
static inline uint32_t
|
||||
IPC_getResponse(IPC_Type_t ipcType)
|
||||
{
|
||||
return(IPC_Instance[ipcType].IPC_SendCmd_Reg->IPC_REMOTEREPLY);
|
||||
}
|
||||
|
||||
|
||||
//*****************************************************************************
|
||||
//
|
||||
//! Reads the BOOTMODE register.
|
||||
//!
|
||||
//! \param ipcType is the enum corresponding to the IPC instance used
|
||||
//!
|
||||
//! Allows the caller to read the BOOTMODE register.
|
||||
//!
|
||||
//! \note Boot registers are not available in CPU2<->CM IPC instance
|
||||
//!
|
||||
//! \return 32-bit value of the BOOOTMODE register
|
||||
//
|
||||
//*****************************************************************************
|
||||
static inline uint32_t
|
||||
IPC_getBootMode(IPC_Type_t ipcType)
|
||||
{
|
||||
return(IPC_Instance[ipcType].IPC_Boot_Pump_Reg->IPC_BOOTMODE);
|
||||
}
|
||||
|
||||
//*****************************************************************************
|
||||
//
|
||||
//! Sets the BOOTSTS register.
|
||||
//!
|
||||
//! \param ipcType is the enum corresponding to the IPC instance used
|
||||
//! \param status is the 32-bit value to be set
|
||||
//!
|
||||
//! Allows the caller to set the BOOTSTS register.
|
||||
//!
|
||||
//! \note This function shall be called by CPU2 and CM only
|
||||
//!
|
||||
//! \note This function shall be called by CPU2 and CM only. Boot registers
|
||||
//! are not available in CPU2<->CM IPC instance
|
||||
//!
|
||||
//! \return None.
|
||||
//
|
||||
//*****************************************************************************
|
||||
static inline void
|
||||
IPC_setBootStatus(IPC_Type_t ipcType, uint32_t status)
|
||||
{
|
||||
ASSERT(ipcType == IPC_CM_L_CPU1_R);
|
||||
|
||||
IPC_Instance[ipcType].IPC_Boot_Pump_Reg->IPC_BOOTSTS = status;
|
||||
}
|
||||
|
||||
//*****************************************************************************
|
||||
//
|
||||
//! Reads the BOOTSTS register.
|
||||
//!
|
||||
//! \param ipcType is the enum corresponding to the IPC instance used
|
||||
//!
|
||||
//! Allows the caller to set the BOOTMODE register.
|
||||
//!
|
||||
//! \note Boot registers are not available in CPU2<->CM IPC instance
|
||||
//!
|
||||
//! \return 32-bit value of the BOOOTSTS register
|
||||
//
|
||||
//*****************************************************************************
|
||||
static inline uint32_t
|
||||
IPC_getBootStatus(IPC_Type_t ipcType)
|
||||
{
|
||||
return(IPC_Instance[ipcType].IPC_Boot_Pump_Reg->IPC_BOOTSTS);
|
||||
}
|
||||
|
||||
//*****************************************************************************
|
||||
//
|
||||
//! Reads the timestamp counter value.
|
||||
//!
|
||||
//! \param ipcType is the enum corresponding to the IPC instance used
|
||||
//!
|
||||
//! Allows the caller to read the IPC timestamp counter value.
|
||||
//!
|
||||
//! \return 64-bit counter value.
|
||||
//
|
||||
//*****************************************************************************
|
||||
static inline uint64_t
|
||||
IPC_getCounter(IPC_Type_t ipcType)
|
||||
{
|
||||
//
|
||||
// Get the Counter High and Low values. Read to the Counter low register
|
||||
// saves the value of Counter High register.
|
||||
//
|
||||
uint32_t ctrL = IPC_Instance[ipcType].IPC_Flag_Ctr_Reg->IPC_COUNTERL;
|
||||
uint32_t ctrH = IPC_Instance[ipcType].IPC_Flag_Ctr_Reg->IPC_COUNTERH;
|
||||
|
||||
//
|
||||
// Return the 64-bit value of the counter
|
||||
//
|
||||
return(((uint64_t)ctrH << 32) | ((uint64_t)ctrL));
|
||||
}
|
||||
|
||||
//*****************************************************************************
|
||||
//
|
||||
//! Registers an interrupt handler for IPC
|
||||
//!
|
||||
//! \param ipcType is the enum corresponding to the IPC instance used
|
||||
//! \param ipcInt is the Flag number for which interrupt is being registered
|
||||
//!
|
||||
//! This function registers the handler to be called when an IPC interrupt
|
||||
//! occurs. This function enables the global interrupt in the interrupt
|
||||
//! controller.
|
||||
//! The \e ipcInt parameter can be any of the IPC flag values:\b IPC_INT0 -
|
||||
//! \b IPC_INT7. IPC_INT0 corresponds to IPC Flag 0 interrupt and so on.
|
||||
//
|
||||
//*****************************************************************************
|
||||
extern void
|
||||
IPC_registerInterrupt(IPC_Type_t ipcType, uint32_t ipcInt,
|
||||
void (*pfnHandler)(void));
|
||||
|
||||
//*****************************************************************************
|
||||
//
|
||||
//! Unregisters an interrupt handler for IPC
|
||||
//!
|
||||
//! \param ipcType is the enum corresponding to the IPC instance used
|
||||
//! \param ipcInt is the Flag number for which interrupt is being unregistered
|
||||
//!
|
||||
//! This function clears the handler to be called when an IPC interrupt
|
||||
//! occurs. This function also masks off the interrupt in the interrupt
|
||||
//! controller so that the interrupt handler no longer is called.
|
||||
//! The \e ipcInt parameter can be any of the IPC flag values:\b IPC_INT0 -
|
||||
//! \b IPC_INT7. IPC_INT0 corresponds to IPC Flag 0 interrupt and so on.
|
||||
//
|
||||
//*****************************************************************************
|
||||
extern void
|
||||
IPC_unregisterInterrupt(IPC_Type_t ipcType, uint32_t ipcInt);
|
||||
|
||||
#if IPC_MSGQ_SUPPORT == 1U
|
||||
//*****************************************************************************
|
||||
//
|
||||
//! Initializes the IPC message queue
|
||||
//!
|
||||
//! \param ipcType is the enum corresponding to the IPC instance used
|
||||
//! \param msgQueue specifies the address of a \e IPC_MessageQueue_t instance
|
||||
//! \param ipcInt_L specifies the interrupt number on the local core used by
|
||||
//! the message queue .
|
||||
//! \param ipcInt_R specifies the interrupt number on the remote core used by
|
||||
//! the message queue.
|
||||
//!
|
||||
//! This function initializes the IPC message queue with circular buffer
|
||||
//! and index addresses for an IPC interrupt pair. The
|
||||
//! \e ipcInt_L and \e ipcInt_R parameters can be one of the following values:
|
||||
//! \b IPC_INT0, \b IPC_INT1, \b IPC_INT2, \b IPC_INT3.
|
||||
//!
|
||||
//! \note If an interrupt is currently in use by an \e IPC_MessageQueue_t
|
||||
//! instance, that particular interrupt should not be tied to a second
|
||||
//! \e IPC_MessageQueue_t instance.
|
||||
//!
|
||||
//! \note For a particular ipcInt_L - ipcInt_R pair, there must be an instance
|
||||
//! of IPC_MessageQueue_t defined and initialized on both the locakl and remote
|
||||
//! systems.
|
||||
//!
|
||||
//! \return None.
|
||||
//
|
||||
//*****************************************************************************
|
||||
extern void
|
||||
IPC_initMessageQueue(IPC_Type_t ipcType, volatile IPC_MessageQueue_t *msgQueue,
|
||||
uint32_t ipcInt_L, uint32_t ipcInt_R);
|
||||
|
||||
//*****************************************************************************
|
||||
//
|
||||
//! Sends a message into the messageQueue.
|
||||
//!
|
||||
//! \param ipcType is the enum corresponding to the IPC instance used
|
||||
//! \param msgQueue specifies the address of a \e IPC_MessageQueue_t instance
|
||||
//! \param addrCorrEnable is the flag used to determine whether or not to
|
||||
//! convert the addr parameter to remote core's address space
|
||||
//! \param msg specifies the address of the \e IPC_Message_t instance to be
|
||||
//! sent to message queue.
|
||||
//! \param block specifies whether to allow function to block until the buffer
|
||||
//! has a free slot
|
||||
//!
|
||||
//! This function checks if there is a free slot in the message queue. If so, it
|
||||
//! puts the message pointed to by \e msg into the free and sets the
|
||||
//! appropriate IPC interrupt flag
|
||||
//!
|
||||
//! The \e addrCorrEnable parameter can take values IPC_ADDR_CORRECTION_ENABLE
|
||||
//! (converts the address to remote core's address space) or
|
||||
//! IPC_ADDR_CORRECTION_DISABLE(does not modify the addr parmeter)
|
||||
//! The \e block parameter can be one of the following values:
|
||||
//! \b IPC_BLOCKING_CALL or \b IPC_NONBLOCKING_CALL.
|
||||
//!
|
||||
//! \return \b false if the queue is full. \b true if the message is successfully
|
||||
//! sent.
|
||||
//
|
||||
//*****************************************************************************
|
||||
extern bool
|
||||
IPC_sendMessageToQueue(IPC_Type_t ipcType,
|
||||
volatile IPC_MessageQueue_t *msgQueue,
|
||||
bool addrCorrEnable, IPC_Message_t *msg, bool block);
|
||||
|
||||
//*****************************************************************************
|
||||
//
|
||||
//! Reads a message from the messageQueue.
|
||||
//!
|
||||
//! \param ipcType is the enum corresponding to the IPC instance used
|
||||
//! \param msgQueue specifies the address of a \e IPC_MessageQueue_t instance
|
||||
//! \param addrCorrEnable is the flag used to determine whether or not to
|
||||
//! convert the addr parameter to remote core's address space
|
||||
//! \param msg specifies the address of the \e IPC_Message_t instance to which
|
||||
//! the message needs to be read
|
||||
//! \param block specifies whether to allow function to block until a message
|
||||
//! is available in the message queue
|
||||
//!
|
||||
//! This function checks if there is a message in the message queue. If so, it
|
||||
//! reads the message and writes to the address pointed to by \e msg into.
|
||||
//!
|
||||
//! The \e addrCorrEnable parameter can take values IPC_ADDR_CORRECTION_ENABLE
|
||||
//! (converts the address to remote core's address space) or
|
||||
//! IPC_ADDR_CORRECTION_DISABLE(does not modify the addr parmeter)
|
||||
//! The \e block parameter can be one of the following values:
|
||||
//! \b IPC_BLOCKING_CALL or \b IPC_NONBLOCKING_CALL.
|
||||
//!
|
||||
//! \return \b false if the queue is empty. \b true if the message successfully
|
||||
//! read.
|
||||
//
|
||||
//*****************************************************************************
|
||||
extern bool
|
||||
IPC_readMessageFromQueue(IPC_Type_t ipcType,
|
||||
volatile IPC_MessageQueue_t *msgQueue,
|
||||
bool addrCorrEnable, IPC_Message_t *msg, bool block);
|
||||
#endif
|
||||
//*****************************************************************************
|
||||
//
|
||||
// Close the Doxygen group.
|
||||
//! @}
|
||||
//
|
||||
//*****************************************************************************
|
||||
|
||||
//*****************************************************************************
|
||||
//
|
||||
// Mark the end of the C bindings section for C++ compilers.
|
||||
//
|
||||
//*****************************************************************************
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif // IPC_H
|
||||
+1860
File diff suppressed because it is too large.
Load diff
+2087
File diff suppressed because it is too large.
Load diff
+651
@@ -0,0 +1,651 @@
|
||||
//###########################################################################
|
||||
//
|
||||
// FILE: memcfg.c
|
||||
//
|
||||
// TITLE: CM SRAM config driver.
|
||||
//
|
||||
//###########################################################################
|
||||
// $TI Release: $
|
||||
// $Release Date: $
|
||||
//
|
||||
// C2000Ware v5.04.00.00
|
||||
//
|
||||
// Copyright (C) 2024 Texas Instruments Incorporated - http://www.ti.com
|
||||
//
|
||||
// Redistribution and use in source and binary forms, with or without
|
||||
// modification, are permitted provided that the following conditions
|
||||
// are met:
|
||||
//
|
||||
// Redistributions of source code must retain the above copyright
|
||||
// notice, this list of conditions and the following disclaimer.
|
||||
//
|
||||
// Redistributions in binary form must reproduce the above copyright
|
||||
// notice, this list of conditions and the following disclaimer in the
|
||||
// documentation and/or other materials provided with the
|
||||
// distribution.
|
||||
//
|
||||
// Neither the name of Texas Instruments Incorporated nor the names of
|
||||
// its contributors may be used to endorse or promote products derived
|
||||
// from this software without specific prior written permission.
|
||||
//
|
||||
// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
|
||||
// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
|
||||
// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
|
||||
// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
|
||||
// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
|
||||
// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
|
||||
// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
|
||||
// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
|
||||
// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
||||
// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
|
||||
// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
// $
|
||||
//###########################################################################
|
||||
|
||||
#include "memcfg.h"
|
||||
|
||||
//*****************************************************************************
|
||||
//
|
||||
// MemCfg_lockConfig
|
||||
//
|
||||
//*****************************************************************************
|
||||
void
|
||||
MemCfg_lockConfig(uint32_t memSections)
|
||||
{
|
||||
//
|
||||
// Check the arguments.
|
||||
//
|
||||
ASSERT(((memSections & MEMCFG_SECT_TYPE_MASK) == MEMCFG_SECT_TYPE_CX) ||
|
||||
((memSections & MEMCFG_SECT_TYPE_MASK) == MEMCFG_SECT_TYPE_SX) ||
|
||||
((memSections & MEMCFG_SECT_TYPE_MASK) == MEMCFG_SECT_TYPE_ROM) ||
|
||||
((memSections & MEMCFG_SECT_TYPE_MASK) == MEMCFG_SECT_TYPE_PERIMEM)||
|
||||
((memSections & MEMCFG_SECT_TYPE_MASK) == MEMCFG_SECT_TYPE_CMMSGX) ||
|
||||
(memSections == MEMCFG_SECT_ALL));
|
||||
|
||||
//
|
||||
// Set the bit that blocks writes to the sections' configuration registers.
|
||||
//
|
||||
switch(memSections & MEMCFG_SECT_TYPE_MASK)
|
||||
{
|
||||
case MEMCFG_SECT_TYPE_CX:
|
||||
HWREG(CMMEMCFG_BASE + MEMCFG_O_CXLOCK) |= (MEMCFG_SECT_NUM_MASK &
|
||||
memSections);
|
||||
break;
|
||||
|
||||
case MEMCFG_SECT_TYPE_CMMSGX:
|
||||
HWREG(CMMEMCFG_BASE + MEMCFG_O_CMMSGXLOCK) |= (MEMCFG_SECT_NUM_MASK
|
||||
& memSections);
|
||||
break;
|
||||
|
||||
case MEMCFG_SECT_TYPE_SX:
|
||||
HWREG(CMMEMCFG_BASE + MEMCFG_O_SXGROUP1_LOCK) |=
|
||||
(MEMCFG_SECT_NUM_MASK & memSections);
|
||||
break;
|
||||
|
||||
case MEMCFG_SECT_TYPE_ROM:
|
||||
HWREG(CMMEMCFG_BASE + MEMCFG_O_ROM_LOCK) |= (MEMCFG_SECT_NUM_MASK &
|
||||
memSections);
|
||||
break;
|
||||
|
||||
case MEMCFG_SECT_TYPE_PERIMEM:
|
||||
HWREG(CMMEMCFG_BASE + MEMCFG_O_PERI_MEM_TEST_LOCK) |=
|
||||
(MEMCFG_SECT_NUM_MASK & memSections);
|
||||
break;
|
||||
|
||||
case MEMCFG_SECT_TYPE_MASK:
|
||||
//
|
||||
// Lock configuration for all sections.
|
||||
//
|
||||
HWREG(CMMEMCFG_BASE + MEMCFG_O_CXLOCK) |=
|
||||
(MEMCFG_SECT_NUM_MASK & MEMCFG_SECT_CX_ALL);
|
||||
|
||||
HWREG(CMMEMCFG_BASE + MEMCFG_O_CMMSGXLOCK) |=
|
||||
(MEMCFG_SECT_NUM_MASK & MEMCFG_SECT_CMMSGX_ALL);
|
||||
|
||||
HWREG(CMMEMCFG_BASE + MEMCFG_O_SXGROUP1_LOCK) |=
|
||||
(MEMCFG_SECT_NUM_MASK & MEMCFG_SECT_SX_ALL);
|
||||
|
||||
HWREG(CMMEMCFG_BASE + MEMCFG_O_ROM_LOCK) |=
|
||||
(MEMCFG_SECT_NUM_MASK & MEMCFG_SECT_ROM);
|
||||
|
||||
HWREG(CMMEMCFG_BASE + MEMCFG_O_PERI_MEM_TEST_LOCK) |=
|
||||
(MEMCFG_SECT_NUM_MASK & MEMCFG_SECT_PERIMEM_ALL);
|
||||
break;
|
||||
|
||||
default:
|
||||
// Do nothing. Invalid memSections. Make sure you aren't OR-ing
|
||||
// values for two different types of RAM.
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
//*****************************************************************************
|
||||
//
|
||||
// MemCfg_unlockConfig
|
||||
//
|
||||
//*****************************************************************************
|
||||
void
|
||||
MemCfg_unlockConfig(uint32_t memSections)
|
||||
{
|
||||
//
|
||||
// Check the arguments.
|
||||
//
|
||||
ASSERT(((memSections & MEMCFG_SECT_TYPE_MASK) == MEMCFG_SECT_TYPE_CX) ||
|
||||
((memSections & MEMCFG_SECT_TYPE_MASK) == MEMCFG_SECT_TYPE_SX) ||
|
||||
((memSections & MEMCFG_SECT_TYPE_MASK) == MEMCFG_SECT_TYPE_ROM) ||
|
||||
((memSections & MEMCFG_SECT_TYPE_MASK) == MEMCFG_SECT_TYPE_PERIMEM)||
|
||||
((memSections & MEMCFG_SECT_TYPE_MASK) == MEMCFG_SECT_TYPE_CMMSGX) ||
|
||||
(memSections == MEMCFG_SECT_ALL));
|
||||
|
||||
//
|
||||
// Clear the bit that blocks writes to the sections' configuration
|
||||
// registers.
|
||||
//
|
||||
switch(memSections & MEMCFG_SECT_TYPE_MASK)
|
||||
{
|
||||
case MEMCFG_SECT_TYPE_CX:
|
||||
HWREG(CMMEMCFG_BASE + MEMCFG_O_CXLOCK) &=
|
||||
~(MEMCFG_SECT_NUM_MASK & memSections);
|
||||
break;
|
||||
|
||||
case MEMCFG_SECT_TYPE_CMMSGX:
|
||||
HWREG(CMMEMCFG_BASE + MEMCFG_O_CMMSGXLOCK) &=
|
||||
~(MEMCFG_SECT_NUM_MASK & memSections);
|
||||
break;
|
||||
|
||||
case MEMCFG_SECT_TYPE_SX:
|
||||
HWREG(CMMEMCFG_BASE + MEMCFG_O_SXGROUP1_LOCK) &=
|
||||
~(MEMCFG_SECT_NUM_MASK & memSections);
|
||||
break;
|
||||
|
||||
case MEMCFG_SECT_TYPE_ROM:
|
||||
HWREG(CMMEMCFG_BASE + MEMCFG_O_ROM_LOCK) &=
|
||||
~(MEMCFG_SECT_NUM_MASK & memSections);
|
||||
break;
|
||||
|
||||
case MEMCFG_SECT_TYPE_PERIMEM:
|
||||
HWREG(CMMEMCFG_BASE + MEMCFG_O_PERI_MEM_TEST_LOCK) &=
|
||||
~(MEMCFG_SECT_NUM_MASK & memSections);
|
||||
break;
|
||||
|
||||
case MEMCFG_SECT_TYPE_MASK:
|
||||
//
|
||||
// Lock configuration for all sections.
|
||||
//
|
||||
HWREG(CMMEMCFG_BASE + MEMCFG_O_CXLOCK) &= ~((uint32_t)
|
||||
(MEMCFG_SECT_NUM_MASK & MEMCFG_SECT_CX_ALL));
|
||||
|
||||
HWREG(CMMEMCFG_BASE + MEMCFG_O_CMMSGXLOCK) &= ~((uint32_t)
|
||||
(MEMCFG_SECT_NUM_MASK & MEMCFG_SECT_CMMSGX_ALL));
|
||||
|
||||
HWREG(CMMEMCFG_BASE + MEMCFG_O_SXGROUP1_LOCK) &= ~((uint32_t)
|
||||
(MEMCFG_SECT_NUM_MASK & MEMCFG_SECT_SX_ALL));
|
||||
|
||||
HWREG(CMMEMCFG_BASE + MEMCFG_O_ROM_LOCK) &= ~((uint32_t)
|
||||
(MEMCFG_SECT_NUM_MASK & MEMCFG_SECT_ROM));
|
||||
|
||||
HWREG(CMMEMCFG_BASE + MEMCFG_O_PERI_MEM_TEST_LOCK) &= ~((uint32_t)
|
||||
(MEMCFG_SECT_NUM_MASK & MEMCFG_SECT_PERIMEM_ALL));
|
||||
break;
|
||||
|
||||
default:
|
||||
// Do nothing. Invalid memSections. Make sure you aren't OR-ing
|
||||
// values for two different types of RAM.
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
//*****************************************************************************
|
||||
//
|
||||
// MemCfg_setTestMode
|
||||
//
|
||||
//*****************************************************************************
|
||||
void
|
||||
MemCfg_setTestMode(uint32_t memSection, MemCfg_TestMode testMode)
|
||||
{
|
||||
uint32_t shiftVal = 0U;
|
||||
uint32_t maskVal;
|
||||
uint32_t regVal;
|
||||
uint32_t sectionNum;
|
||||
|
||||
//
|
||||
// Check the arguments.
|
||||
//
|
||||
ASSERT(((memSection & MEMCFG_SECT_TYPE_MASK) == MEMCFG_SECT_TYPE_CX) ||
|
||||
((memSection & MEMCFG_SECT_TYPE_MASK) == MEMCFG_SECT_TYPE_SX) ||
|
||||
((memSection & MEMCFG_SECT_TYPE_MASK) == MEMCFG_SECT_TYPE_ROM) ||
|
||||
((memSection & MEMCFG_SECT_TYPE_MASK) == MEMCFG_SECT_TYPE_CMMSGX));
|
||||
|
||||
//
|
||||
// Calculate how far the protect mode value needs to be shifted. Each
|
||||
// section number is represented by a bit in the lower word of memSection
|
||||
// and 2 bits in the corresponding TEST register.
|
||||
//
|
||||
sectionNum = memSection & MEMCFG_SECT_NUM_MASK;
|
||||
|
||||
while(sectionNum != 1U)
|
||||
{
|
||||
sectionNum = sectionNum >> 1U;
|
||||
shiftVal += 2U;
|
||||
}
|
||||
|
||||
maskVal = (uint32_t)MEMCFG_TESTMODE_M << shiftVal;
|
||||
regVal = ((uint32_t)testMode) << shiftVal;
|
||||
|
||||
//
|
||||
// Write the test mode into the appropriate field
|
||||
//
|
||||
switch(memSection & MEMCFG_SECT_TYPE_MASK)
|
||||
{
|
||||
case MEMCFG_SECT_TYPE_CX:
|
||||
HWREG(CMMEMCFG_BASE + MEMCFG_O_CXTEST) =
|
||||
((HWREG(CMMEMCFG_BASE + MEMCFG_O_CXTEST) & ~maskVal) | regVal);
|
||||
break;
|
||||
|
||||
case MEMCFG_SECT_TYPE_CMMSGX:
|
||||
HWREG(CMMEMCFG_BASE + MEMCFG_O_CMMSGXTEST) =
|
||||
((HWREG(CMMEMCFG_BASE + MEMCFG_O_CMMSGXTEST) & ~maskVal) | regVal);
|
||||
break;
|
||||
|
||||
case MEMCFG_SECT_TYPE_SX:
|
||||
HWREG(CMMEMCFG_BASE + MEMCFG_O_SXGROUP1_TEST) =
|
||||
((HWREG(CMMEMCFG_BASE + MEMCFG_O_CXTEST) & ~maskVal) | regVal);
|
||||
break;
|
||||
|
||||
case MEMCFG_SECT_TYPE_ROM:
|
||||
HWREG(CMMEMCFG_BASE + MEMCFG_O_ROM_TEST) =
|
||||
((HWREG(CMMEMCFG_BASE + MEMCFG_O_ROM_TEST) & ~maskVal) | regVal);
|
||||
break;
|
||||
|
||||
default:
|
||||
//
|
||||
// Do nothing. Invalid memSection.
|
||||
//
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
//*****************************************************************************
|
||||
//
|
||||
// MemCfg_initSections
|
||||
//
|
||||
//*****************************************************************************
|
||||
void
|
||||
MemCfg_initSections(uint32_t ramSections)
|
||||
{
|
||||
//
|
||||
// Check the arguments.
|
||||
//
|
||||
ASSERT(((ramSections & MEMCFG_SECT_TYPE_MASK) == MEMCFG_SECT_TYPE_CX) ||
|
||||
((ramSections & MEMCFG_SECT_TYPE_MASK) == MEMCFG_SECT_TYPE_SX) ||
|
||||
((ramSections & MEMCFG_SECT_TYPE_MASK) == MEMCFG_SECT_TYPE_CMMSGX)||
|
||||
(ramSections == MEMCFG_SECT_ALL));
|
||||
|
||||
//
|
||||
// Set the bit in the various initialization registers that starts
|
||||
// initialization.
|
||||
//
|
||||
switch(ramSections & MEMCFG_SECT_TYPE_MASK)
|
||||
{
|
||||
case MEMCFG_SECT_TYPE_CX:
|
||||
HWREG(CMMEMCFG_BASE + MEMCFG_O_CXINIT) |=
|
||||
(MEMCFG_SECT_NUM_MASK & ramSections);
|
||||
break;
|
||||
|
||||
case MEMCFG_SECT_TYPE_CMMSGX:
|
||||
HWREG(CMMEMCFG_BASE + MEMCFG_O_CMMSGXINIT) |=
|
||||
(MEMCFG_SECT_NUM_MASK & ramSections);
|
||||
break;
|
||||
|
||||
case MEMCFG_SECT_TYPE_SX:
|
||||
HWREG(CMMEMCFG_BASE + MEMCFG_O_SXGROUP1_INIT) |=
|
||||
(MEMCFG_SECT_NUM_MASK & ramSections);
|
||||
break;
|
||||
|
||||
case MEMCFG_SECT_TYPE_MASK:
|
||||
//
|
||||
// Initialize all sections.
|
||||
//
|
||||
HWREG(CMMEMCFG_BASE + MEMCFG_O_CXINIT) |=
|
||||
(MEMCFG_SECT_NUM_MASK & MEMCFG_SECT_CX_ALL);
|
||||
|
||||
HWREG(CMMEMCFG_BASE + MEMCFG_O_CMMSGXINIT) |=
|
||||
(MEMCFG_SECT_NUM_MASK & MEMCFG_SECT_CMMSGX_ALL);
|
||||
|
||||
HWREG(CMMEMCFG_BASE + MEMCFG_O_SXGROUP1_INIT) |=
|
||||
(MEMCFG_SECT_NUM_MASK & MEMCFG_SECT_SX_ALL);
|
||||
break;
|
||||
|
||||
default:
|
||||
//
|
||||
// Do nothing. Invalid ramSections. Make sure you aren't OR-ing
|
||||
// values for two different types of RAM.
|
||||
//
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
//*****************************************************************************
|
||||
//
|
||||
// MemCfg_getInitStatus
|
||||
//
|
||||
//*****************************************************************************
|
||||
bool
|
||||
MemCfg_getInitStatus(uint32_t ramSections)
|
||||
{
|
||||
uint32_t status;
|
||||
|
||||
//
|
||||
// Check the arguments.
|
||||
//
|
||||
ASSERT(((ramSections & MEMCFG_SECT_TYPE_MASK) == MEMCFG_SECT_TYPE_CX) ||
|
||||
((ramSections & MEMCFG_SECT_TYPE_MASK) == MEMCFG_SECT_TYPE_SX) ||
|
||||
((ramSections & MEMCFG_SECT_TYPE_MASK) == MEMCFG_SECT_TYPE_CMMSGX)||
|
||||
(ramSections == MEMCFG_SECT_ALL));
|
||||
|
||||
//
|
||||
// Read registers containing the initialization complete status.
|
||||
//
|
||||
switch(ramSections & MEMCFG_SECT_TYPE_MASK)
|
||||
{
|
||||
case MEMCFG_SECT_TYPE_CX:
|
||||
status = HWREG(CMMEMCFG_BASE + MEMCFG_O_CXINITDONE);
|
||||
break;
|
||||
|
||||
case MEMCFG_SECT_TYPE_CMMSGX:
|
||||
status = HWREG(CMMEMCFG_BASE + MEMCFG_O_CMMSGXINITDONE);
|
||||
break;
|
||||
|
||||
case MEMCFG_SECT_TYPE_SX:
|
||||
status = HWREG(CMMEMCFG_BASE + MEMCFG_O_SXGROUP1_INITDONE);
|
||||
break;
|
||||
|
||||
case MEMCFG_SECT_TYPE_MASK:
|
||||
//
|
||||
// Return the overall status.
|
||||
//
|
||||
if((HWREG(CMMEMCFG_BASE + MEMCFG_O_CXINITDONE) ==
|
||||
MEMCFG_SECT_CX_ALL) &&
|
||||
(HWREG(CMMEMCFG_BASE + MEMCFG_O_CMMSGXINITDONE) ==
|
||||
MEMCFG_SECT_CMMSGX_ALL) &&
|
||||
(HWREG(CMMEMCFG_BASE + MEMCFG_O_SXGROUP1_INITDONE) ==
|
||||
MEMCFG_SECT_SX_ALL))
|
||||
{
|
||||
status = MEMCFG_SECT_NUM_MASK;
|
||||
}
|
||||
else
|
||||
{
|
||||
status = 0x0U;
|
||||
}
|
||||
break;
|
||||
|
||||
default:
|
||||
// Invalid ramSections. Make sure you aren't OR-ing values for two
|
||||
// different types of RAM.
|
||||
status = 0x0U;
|
||||
break;
|
||||
}
|
||||
return((ramSections & status) == (ramSections & MEMCFG_SECT_NUM_MASK));
|
||||
}
|
||||
|
||||
//*****************************************************************************
|
||||
//
|
||||
// MemCfg_forceMemError
|
||||
//
|
||||
//*****************************************************************************
|
||||
void
|
||||
MemCfg_forceMemError(uint32_t memTypes)
|
||||
{
|
||||
//
|
||||
// Check the arguments.
|
||||
//
|
||||
ASSERT((memTypes == MEMCFG_SECT_ROM) ||
|
||||
(memTypes == MEMCFG_SECT_PERIMEM_EMAC) ||
|
||||
(memTypes == MEMCFG_SECT_PERIMEM_ETHERCAT) ||
|
||||
(memTypes == MEMCFG_SECT_ALL));
|
||||
|
||||
//
|
||||
// Forces error in the selected memory.
|
||||
//
|
||||
switch(memTypes)
|
||||
{
|
||||
case MEMCFG_SECT_ROM:
|
||||
HWREG(CMMEMCFG_BASE + MEMCFG_O_ROM_FORCE_ERROR) |=
|
||||
MEMCFG_ROM_FORCE_ERROR_FORCE_BOOTROM_ERROR;
|
||||
break;
|
||||
|
||||
case MEMCFG_SECT_PERIMEM_EMAC:
|
||||
HWREG(CMMEMCFG_BASE + MEMCFG_O_PERI_MEM_TEST_CONTROL) |=
|
||||
MEMCFG_PERI_MEM_TEST_CONTROL_EMAC_MEM_FORCE_ERROR;
|
||||
break;
|
||||
|
||||
case MEMCFG_SECT_PERIMEM_ETHERCAT:
|
||||
HWREG(CMMEMCFG_BASE + MEMCFG_O_PERI_MEM_TEST_CONTROL) |=
|
||||
MEMCFG_PERI_MEM_TEST_CONTROL_ETHERCAT_MEM_FORCE_ERROR;
|
||||
break;
|
||||
|
||||
case MEMCFG_SECT_ALL:
|
||||
HWREG(CMMEMCFG_BASE + MEMCFG_O_ROM_FORCE_ERROR) |=
|
||||
MEMCFG_ROM_FORCE_ERROR_FORCE_BOOTROM_ERROR;
|
||||
|
||||
HWREG(CMMEMCFG_BASE + MEMCFG_O_PERI_MEM_TEST_CONTROL) |=
|
||||
MEMCFG_PERI_MEM_TEST_CONTROL_EMAC_MEM_FORCE_ERROR;
|
||||
|
||||
HWREG(CMMEMCFG_BASE + MEMCFG_O_PERI_MEM_TEST_CONTROL) |=
|
||||
MEMCFG_PERI_MEM_TEST_CONTROL_ETHERCAT_MEM_FORCE_ERROR;
|
||||
break;
|
||||
|
||||
default:
|
||||
//
|
||||
// Do nothing. Invalid memory.
|
||||
//
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
//*****************************************************************************
|
||||
//
|
||||
// MemCfg_enablePeriMemTestMode
|
||||
//
|
||||
//*****************************************************************************
|
||||
void
|
||||
MemCfg_enablePeriMemTestMode(uint32_t memTypes)
|
||||
{
|
||||
//
|
||||
// Check the arguments.
|
||||
//
|
||||
ASSERT((memTypes == MEMCFG_SECT_PERIMEM_EMAC) ||
|
||||
(memTypes == MEMCFG_SECT_PERIMEM_ETHERCAT) ||
|
||||
(memTypes == MEMCFG_SECT_PERIMEM_ALL));
|
||||
|
||||
//
|
||||
// Enables test mode for selected memory type.
|
||||
//
|
||||
switch(memTypes)
|
||||
{
|
||||
case MEMCFG_SECT_PERIMEM_EMAC:
|
||||
HWREG(CMMEMCFG_BASE + MEMCFG_O_PERI_MEM_TEST_CONTROL) |=
|
||||
MEMCFG_PERI_MEM_TEST_CONTROL_EMAC_TEST_ENABLE;
|
||||
break;
|
||||
|
||||
case MEMCFG_SECT_PERIMEM_ETHERCAT:
|
||||
HWREG(CMMEMCFG_BASE + MEMCFG_O_PERI_MEM_TEST_CONTROL) |=
|
||||
MEMCFG_PERI_MEM_TEST_CONTROL_ETHERCAT_TEST_ENABLE;
|
||||
break;
|
||||
|
||||
case MEMCFG_SECT_PERIMEM_ALL:
|
||||
HWREG(CMMEMCFG_BASE + MEMCFG_O_PERI_MEM_TEST_CONTROL) |=
|
||||
MEMCFG_PERI_MEM_TEST_CONTROL_EMAC_TEST_ENABLE;
|
||||
|
||||
HWREG(CMMEMCFG_BASE + MEMCFG_O_PERI_MEM_TEST_CONTROL) |=
|
||||
MEMCFG_PERI_MEM_TEST_CONTROL_ETHERCAT_TEST_ENABLE;
|
||||
break;
|
||||
|
||||
default:
|
||||
//
|
||||
// Do nothing. Invalid memory type.
|
||||
//
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
//*****************************************************************************
|
||||
//
|
||||
// MemCfg_disablePeriMemTestMode
|
||||
//
|
||||
//*****************************************************************************
|
||||
void
|
||||
MemCfg_disablePeriMemTestMode(uint32_t memTypes)
|
||||
{
|
||||
//
|
||||
// Check the arguments.
|
||||
//
|
||||
ASSERT((memTypes == MEMCFG_SECT_PERIMEM_EMAC) ||
|
||||
(memTypes == MEMCFG_SECT_PERIMEM_ETHERCAT) ||
|
||||
(memTypes == MEMCFG_SECT_PERIMEM_ALL));
|
||||
|
||||
//
|
||||
// Disables test mode for selected memory type.
|
||||
//
|
||||
switch(memTypes)
|
||||
{
|
||||
case MEMCFG_SECT_PERIMEM_EMAC:
|
||||
HWREG(CMMEMCFG_BASE + MEMCFG_O_PERI_MEM_TEST_CONTROL) &=
|
||||
~MEMCFG_PERI_MEM_TEST_CONTROL_EMAC_TEST_ENABLE;
|
||||
break;
|
||||
|
||||
case MEMCFG_SECT_PERIMEM_ETHERCAT:
|
||||
HWREG(CMMEMCFG_BASE + MEMCFG_O_PERI_MEM_TEST_CONTROL) &=
|
||||
~MEMCFG_PERI_MEM_TEST_CONTROL_ETHERCAT_TEST_ENABLE;
|
||||
break;
|
||||
|
||||
case MEMCFG_SECT_PERIMEM_ALL:
|
||||
HWREG(CMMEMCFG_BASE + MEMCFG_O_PERI_MEM_TEST_CONTROL) &=
|
||||
~MEMCFG_PERI_MEM_TEST_CONTROL_EMAC_TEST_ENABLE;
|
||||
|
||||
HWREG(CMMEMCFG_BASE + MEMCFG_O_PERI_MEM_TEST_CONTROL) &=
|
||||
~MEMCFG_PERI_MEM_TEST_CONTROL_ETHERCAT_TEST_ENABLE;
|
||||
break;
|
||||
|
||||
default:
|
||||
//
|
||||
// Do nothing. Invalid memory type.
|
||||
//
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
//*****************************************************************************
|
||||
//
|
||||
// MemCfg_getUncorrErrorAddress
|
||||
//
|
||||
//*****************************************************************************
|
||||
uint32_t
|
||||
MemCfg_getUncorrErrorAddress(uint32_t stsFlag)
|
||||
{
|
||||
uint32_t errAddress;
|
||||
|
||||
//
|
||||
// Gets address location of selected uncorrectable read/write error.
|
||||
//
|
||||
switch(stsFlag)
|
||||
{
|
||||
case MEMCFG_UCERR_M4READ:
|
||||
case MEMCFG_UCERR_M4WRITE:
|
||||
errAddress = HWREG(CMMEMORYERROR_BASE + MEMCFG_O_UCM4EADDR);
|
||||
break;
|
||||
|
||||
case MEMCFG_UCERR_EMACREAD:
|
||||
errAddress = HWREG(CMMEMORYERROR_BASE + MEMCFG_O_UCEMACEADDR);
|
||||
break;
|
||||
|
||||
case MEMCFG_UCERR_UDMAREAD:
|
||||
case MEMCFG_UCERR_UDMAWRITE:
|
||||
errAddress = HWREG(CMMEMORYERROR_BASE + MEMCFG_O_UCUDMAEADDR);
|
||||
break;
|
||||
|
||||
case MEMCFG_UCERR_ETHERCATMEMREAD:
|
||||
errAddress = HWREG(CMMEMORYERROR_BASE + MEMCFG_O_UCETHERCATMEMREADDR);
|
||||
break;
|
||||
|
||||
case MEMCFG_UCERR_EMACMEMREAD:
|
||||
errAddress = HWREG(CMMEMORYERROR_BASE + MEMCFG_O_UCEMACMEMREADDR);
|
||||
break;
|
||||
|
||||
default:
|
||||
//
|
||||
// Invalid stsFlag.
|
||||
//
|
||||
errAddress = 0x0U;
|
||||
break;
|
||||
}
|
||||
return(errAddress);
|
||||
}
|
||||
|
||||
//*****************************************************************************
|
||||
//
|
||||
// MemCfg_getCorrErrorAddress
|
||||
//
|
||||
//*****************************************************************************
|
||||
uint32_t
|
||||
MemCfg_getCorrErrorAddress(uint32_t stsFlag)
|
||||
{
|
||||
uint32_t errAddress;
|
||||
|
||||
//
|
||||
// Gets address location of selected uncorrectable read/write error.
|
||||
//
|
||||
switch(stsFlag)
|
||||
{
|
||||
case MEMCFG_CERR_M4READ:
|
||||
case MEMCFG_CERR_M4WRITE:
|
||||
errAddress = HWREG(CMMEMORYERROR_BASE + MEMCFG_O_CM4EADDR);
|
||||
break;
|
||||
|
||||
case MEMCFG_CERR_EMACREAD:
|
||||
errAddress = HWREG(CMMEMORYERROR_BASE + MEMCFG_O_CEMACEADDR);
|
||||
break;
|
||||
|
||||
case MEMCFG_CERR_UDMAREAD:
|
||||
case MEMCFG_CERR_UDMAWRITE:
|
||||
errAddress = HWREG(CMMEMORYERROR_BASE + MEMCFG_O_CUDMAEADDR);
|
||||
break;
|
||||
|
||||
default:
|
||||
//
|
||||
// Invalid stsFlag.
|
||||
//
|
||||
errAddress = 0x0U;
|
||||
break;
|
||||
}
|
||||
return(errAddress);
|
||||
}
|
||||
|
||||
//*****************************************************************************
|
||||
//
|
||||
// MemCfg_getBusFaultAddress
|
||||
//
|
||||
//*****************************************************************************
|
||||
uint32_t
|
||||
MemCfg_getBusFaultAddress(uint32_t busMaster)
|
||||
{
|
||||
uint32_t offset, temp;
|
||||
|
||||
//
|
||||
// Calculate the address offset for selected bus master.
|
||||
//
|
||||
offset = 0U;
|
||||
temp = busMaster;
|
||||
while(temp > 1U)
|
||||
{
|
||||
temp = temp >> 1U;
|
||||
offset += (uint32_t)(MEMCFG_O_UDMABUSFAULTADDR -
|
||||
MEMCFG_O_M4BUSFAULTADDR);
|
||||
}
|
||||
|
||||
//
|
||||
// Read and return the bus fault address at the calculated offset.
|
||||
//
|
||||
return(HWREG(CMMEMORYERROR_BASE + (uint32_t)MEMCFG_O_M4BUSFAULTADDR +
|
||||
offset));
|
||||
}
|
||||
+907
@@ -0,0 +1,907 @@
|
||||
//###########################################################################
|
||||
//
|
||||
// FILE: memcfg.h
|
||||
//
|
||||
// TITLE: CM SRAM config driver.
|
||||
//
|
||||
//###########################################################################
|
||||
// $TI Release: $
|
||||
// $Release Date: $
|
||||
//
|
||||
// C2000Ware v5.04.00.00
|
||||
//
|
||||
// Copyright (C) 2024 Texas Instruments Incorporated - http://www.ti.com
|
||||
//
|
||||
// Redistribution and use in source and binary forms, with or without
|
||||
// modification, are permitted provided that the following conditions
|
||||
// are met:
|
||||
//
|
||||
// Redistributions of source code must retain the above copyright
|
||||
// notice, this list of conditions and the following disclaimer.
|
||||
//
|
||||
// Redistributions in binary form must reproduce the above copyright
|
||||
// notice, this list of conditions and the following disclaimer in the
|
||||
// documentation and/or other materials provided with the
|
||||
// distribution.
|
||||
//
|
||||
// Neither the name of Texas Instruments Incorporated nor the names of
|
||||
// its contributors may be used to endorse or promote products derived
|
||||
// from this software without specific prior written permission.
|
||||
//
|
||||
// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
|
||||
// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
|
||||
// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
|
||||
// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
|
||||
// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
|
||||
// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
|
||||
// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
|
||||
// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
|
||||
// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
||||
// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
|
||||
// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
// $
|
||||
//###########################################################################
|
||||
|
||||
#ifndef MEMCFG_H
|
||||
#define MEMCFG_H
|
||||
|
||||
//*****************************************************************************
|
||||
//
|
||||
// If building with a C++ compiler, make all of the definitions in this header
|
||||
// have a C binding.
|
||||
//
|
||||
//*****************************************************************************
|
||||
#ifdef __cplusplus
|
||||
extern "C"
|
||||
{
|
||||
#endif
|
||||
|
||||
//*****************************************************************************
|
||||
//
|
||||
//! \addtogroup memcfg_api MemCfg
|
||||
//! @{
|
||||
//
|
||||
//*****************************************************************************
|
||||
|
||||
#include <stdbool.h>
|
||||
#include <stdint.h>
|
||||
#include "inc_cm/hw_memcfg.h"
|
||||
#include "inc_cm/hw_memmap.h"
|
||||
#include "inc_cm/hw_types.h"
|
||||
#include "cpu.h"
|
||||
#include "debug.h"
|
||||
|
||||
//*****************************************************************************
|
||||
//
|
||||
// Defines for the API.
|
||||
//
|
||||
//*****************************************************************************
|
||||
//*****************************************************************************
|
||||
//
|
||||
// Define for specifying the key for writing error registers
|
||||
//
|
||||
//*****************************************************************************
|
||||
#define MEMCFG_KEY 0xA5A50000U //!< Key for error registers
|
||||
|
||||
//*****************************************************************************
|
||||
//
|
||||
// Masks to decode memory section defines.
|
||||
//
|
||||
//*****************************************************************************
|
||||
#define MEMCFG_SECT_TYPE_MASK 0xFF000000U //!< Mask for section type
|
||||
#define MEMCFG_SECT_TYPE_CX 0x00000000U //!< Mask for CX memory
|
||||
#define MEMCFG_SECT_TYPE_CMMSGX 0x01000000U //!< Mask for CMMSGRAM
|
||||
#define MEMCFG_SECT_TYPE_SX 0x02000000U //!< Mask for SX memory
|
||||
#define MEMCFG_SECT_TYPE_ROM 0x03000000U //!< Mask for ROM memory
|
||||
#define MEMCFG_SECT_TYPE_PERIMEM 0x04000000U //!< Mask for peripheral
|
||||
//!< memory(EMAC & EtherCAT)
|
||||
#define MEMCFG_SECT_NUM_MASK 0x00FFFFFFU //!< Mask for selecting the
|
||||
//!< section number
|
||||
//*****************************************************************************
|
||||
//
|
||||
// Define to specify the mask for memory test mode.
|
||||
//
|
||||
//*****************************************************************************
|
||||
#define MEMCFG_TESTMODE_M MEMCFG_CXTEST_TEST_C0_M //!< Mask for
|
||||
//!< test mode
|
||||
|
||||
//*****************************************************************************
|
||||
//
|
||||
// Values that can be passed to MemCfg_lockConfig(), MemCfg_unlockConfig(),
|
||||
// MemCfg_setTestMode() as memSection(s) parameter; to MemCfg_initSections(),
|
||||
// MemCfg_getInitStatus() as ramSections parameter; to MemCfg_forceMemError(),
|
||||
// MemCfg_enablePeriMemTestMode(), MemCfg_disablePeriMemTestMode() as the
|
||||
// memTypes parameter.
|
||||
//
|
||||
//*****************************************************************************
|
||||
// Cx Memories - Dedicated to core CM, accessible on CODE bus.
|
||||
#define MEMCFG_SECT_C0 0x00000001U //!< C0 RAM
|
||||
#define MEMCFG_SECT_C1 0x00000002U //!< C1 RAM
|
||||
#define MEMCFG_SECT_CX_ALL 0x00000003U //!< All Cx RAM
|
||||
|
||||
// CMMSGx Memories - For exchanging data between CM & C28x subsystem.
|
||||
#define MEMCFG_SECT_CMTOCPU1MSGRAM0 0x01000001U //!< CM TO CPU1 MSG RAM0
|
||||
#define MEMCFG_SECT_CMTOCPU1MSGRAM1 0x01000002U //!< CM TO CPU1 MSG RAM1
|
||||
#define MEMCFG_SECT_CMTOCPU2MSGRAM0 0x01000004U //!< CM TO CPU2 MSG RAM0
|
||||
#define MEMCFG_SECT_CMTOCPU2MSGRAM1 0x01000008U //!< CM TO CPU2 MSG RAM1
|
||||
#define MEMCFG_SECT_CMMSGX_ALL 0x0100000FU //!< All CM MSG RAMs
|
||||
|
||||
// Sx Memories - shared between bus masters.
|
||||
#define MEMCFG_SECT_S0 0x02000001U //!< S0 RAM
|
||||
#define MEMCFG_SECT_S1 0x02000002U //!< S1 RAM
|
||||
#define MEMCFG_SECT_S2 0x02000004U //!< S2 RAM
|
||||
#define MEMCFG_SECT_S3 0x02000008U //!< S3 RAM
|
||||
#define MEMCFG_SECT_S4 0x02000010U //!< S4 RAM
|
||||
#define MEMCFG_SECT_SX_ALL 0x0200001FU //!< All Sx RAM
|
||||
|
||||
// ROM memory - read only
|
||||
#define MEMCFG_SECT_ROM 0x03000001U //!< ROM Section
|
||||
|
||||
// Peripheral Memories - EMAC & EtherCAT
|
||||
#define MEMCFG_SECT_PERIMEM_EMAC 0x04000002U //!< EMAC memory
|
||||
#define MEMCFG_SECT_PERIMEM_ETHERCAT 0x04000020U //!< EtherCAT memory
|
||||
#define MEMCFG_SECT_PERIMEM_ALL 0x04000001U //!< All peripheral memories
|
||||
|
||||
// All Memory Sections
|
||||
#define MEMCFG_SECT_ALL 0xFFFFFFFFU //!< All memory Sections
|
||||
|
||||
//*****************************************************************************
|
||||
//
|
||||
// Values that can be passed to MemCfg_forceUncorrErrorStatus(),
|
||||
// MemCfg_clearUncorrErrorStatus(), MemCfg_getUncorrErrorAddress() as stsFlags
|
||||
// parameter and returned by MemCfg_getUncorrErrorStatus().
|
||||
//
|
||||
//*****************************************************************************
|
||||
#define MEMCFG_UCERR_M4READ 0x00000001U //!< Uncorr M4 Read Error
|
||||
#define MEMCFG_UCERR_M4WRITE 0x00000002U //!< Uncorr M4 Write Error
|
||||
#define MEMCFG_UCERR_EMACREAD 0x00000004U //!< Uncorr EMAC Read Error
|
||||
#define MEMCFG_UCERR_UDMAREAD 0x00000010U //!< Uncorr uDMA Read Error
|
||||
#define MEMCFG_UCERR_UDMAWRITE 0x00000020U //!< Uncorr uDMA Write Error
|
||||
#define MEMCFG_UCERR_ETHERCATMEMREAD 0x00000040U //!< Uncorr ECAT Mem Read
|
||||
//!< Error
|
||||
#define MEMCFG_UCERR_EMACMEMREAD 0x00000080U //!< Uncorr EMAC Mem Read
|
||||
//!< Error
|
||||
|
||||
//*****************************************************************************
|
||||
//
|
||||
// Values that can be passed to MemCfg_getCorrErrorStatus(),
|
||||
// MemCfg_forceCorrErrorStatus(), MemCfg_clearCorrErrorStatus(),
|
||||
// MemCfg_getCorrErrorAddress(), as stsFlag(s) parameter; to
|
||||
// MemCfg_enableCorrErrorInterrupt(), MemCfg_disableCorrErrorInterrupt(),
|
||||
// MemCfg_clearCorrErrorInterruptStatus() as intFlags parameter and returned by
|
||||
// MemCfg_getCorrErrorStatus() and MemCfg_getCorrErrorInterruptStatus().
|
||||
//
|
||||
//*****************************************************************************
|
||||
#define MEMCFG_CERR_M4READ 0x00000001U //!< Corr M4 Read Error
|
||||
#define MEMCFG_CERR_M4WRITE 0x00000002U //!< Corr M4 Write Error
|
||||
#define MEMCFG_CERR_EMACREAD 0x00000004U //!< Corr EMAC Read Error
|
||||
#define MEMCFG_CERR_UDMAREAD 0x00000010U //!< Corr uDMA Read Error
|
||||
#define MEMCFG_CERR_UDMAWRITE 0x00000020U //!< Corr uDMA Write Error
|
||||
|
||||
//*****************************************************************************
|
||||
//
|
||||
// Values that can be passed to MemCfg_clearDiagErrorStatus() as stsFlags
|
||||
// parameter and returned by MemCfg_getDiagErrorStatus().
|
||||
//
|
||||
//*****************************************************************************
|
||||
#define MEMCFG_DIAGERR_UNCORR_READ 0x00000001U //!< Diag Uncorr Read Error
|
||||
#define MEMCFG_DIAGERR_UNCORR_WRITE 0x00000002U //!< Diag Uncorr Write Error
|
||||
#define MEMCFG_DIAGERR_CORR_READ 0x00000004U //!< Diag Corr Read Error
|
||||
#define MEMCFG_DIAGERR_CORR_WRITE 0x00000008U //!< Diag Corr Write Error
|
||||
|
||||
//*****************************************************************************
|
||||
//
|
||||
// Values that can be passed to MemCfg_getBusFaultAddress(),
|
||||
// MemCfg_clearBusFaultStatus(), MemCfg_getBusFaultStatus() as busMaster(s)
|
||||
// parameter.
|
||||
//
|
||||
//*****************************************************************************
|
||||
// Select M4 as bus master
|
||||
#define MEMCFG_BUSMASTER_M4 MEMCFG_BUSFAULTFLG_M4BUSFAULT
|
||||
// Select uDMA as bus master
|
||||
#define MEMCFG_BUSMASTER_UDMA MEMCFG_BUSFAULTFLG_UDMABUSFAULT
|
||||
// Select EMAC as bus master
|
||||
#define MEMCFG_BUSMASTER_EMAC MEMCFG_BUSFAULTFLG_EMACBUSFAULT
|
||||
// Select all the bus masters
|
||||
#define MEMCFG_BUSMATER_ALL (MEMCFG_BUSMASTER_M4 | \
|
||||
MEMCFG_BUSMASTER_UDMA | \
|
||||
MEMCFG_BUSMASTER_EMAC)
|
||||
|
||||
//*****************************************************************************
|
||||
//
|
||||
// Values that can be returned by MemCfg_getBusFaultStatus().
|
||||
//
|
||||
//*****************************************************************************
|
||||
// M4 access encountered busfault
|
||||
#define MEMCFG_BUSFAULT_M4 MEMCFG_BUSFAULTFLG_M4BUSFAULT
|
||||
// uDMA access encountered busfault
|
||||
#define MEMCFG_BUSFAULT_UDMA MEMCFG_BUSFAULTFLG_UDMABUSFAULT
|
||||
// EMAC access encountered busfault
|
||||
#define MEMCFG_BUSFAULT_EMAC MEMCFG_BUSFAULTFLG_EMACBUSFAULT
|
||||
|
||||
//*****************************************************************************
|
||||
//
|
||||
//! Values that can be passed to MemCfg_setTestMode() as the \e testMode
|
||||
//! parameter.
|
||||
//
|
||||
//*****************************************************************************
|
||||
typedef enum
|
||||
{
|
||||
MEMCFG_TEST_FUNCTIONAL = 0x0U, //!< Functional mode
|
||||
MEMCFG_TEST_WRITE_DATA = 0x1U, //!< Writes allowed to data only
|
||||
MEMCFG_TEST_WRITE_ECC = 0x2U, //!< Writes allowed to ECC only
|
||||
MEMCFG_TEST_FUNC_DIAG = 0x3U //!< Diagnostic mode, similar to
|
||||
//!< functional mode but NMI is
|
||||
//!< not generated
|
||||
} MemCfg_TestMode;
|
||||
|
||||
//*****************************************************************************
|
||||
//
|
||||
// Prototypes for the APIs.
|
||||
//
|
||||
//*****************************************************************************
|
||||
//*****************************************************************************
|
||||
//
|
||||
//! Gets the current uncorrectable memory read/write error status.
|
||||
//!
|
||||
//! \return Returns the current error status, enumerated as a bit field of
|
||||
//! \b MEMCFG_UCERR_M4READ, \b MEMCFG_UCERR_M4WRITE, \b MEMCFG_UCERR_EMACREAD,
|
||||
//! \b MEMCFG_UCERR_UDMAREAD, \b MEMCFG_UCERR_UDMAWRITE,
|
||||
//! \b MEMCFG_UCERR_ETHERCATMEMREAD or/and \b MEMCFG_UCERR_EMACMEMREAD.
|
||||
//
|
||||
//*****************************************************************************
|
||||
static inline uint32_t
|
||||
MemCfg_getUncorrErrorStatus(void)
|
||||
{
|
||||
//
|
||||
// Read and return RAM error status flags.
|
||||
//
|
||||
return(HWREG(CMMEMORYERROR_BASE + MEMCFG_O_UCERRFLG));
|
||||
}
|
||||
|
||||
//*****************************************************************************
|
||||
//
|
||||
//! Sets the specified uncorrectable memory read/write error status flag.
|
||||
//!
|
||||
//! \param stsFlags is a bit mask of the error sources.
|
||||
//!
|
||||
//! This function sets the specified uncorrectable memory read/write error
|
||||
//! status flag. The \e stsFlags parameter can take any of the following values:
|
||||
//! \b MEMCFG_UCERR_M4READ, \b MEMCFG_UCERR_M4WRITE, \b MEMCFG_UCERR_EMACREAD,
|
||||
//! \b MEMCFG_UCERR_UDMAREAD, \b MEMCFG_UCERR_UDMAWRITE,
|
||||
//! \b MEMCFG_UCERR_ETHERCATMEMREAD or/and \b MEMCFG_UCERR_EMACMEMREAD.
|
||||
//!
|
||||
//! \return None.
|
||||
//
|
||||
//*****************************************************************************
|
||||
static inline void
|
||||
MemCfg_forceUncorrErrorStatus(uint32_t stsFlags)
|
||||
{
|
||||
//
|
||||
// Write the flags to the appropriate SET register.
|
||||
//
|
||||
HWREG(CMMEMORYERROR_BASE + MEMCFG_O_UCERRSET) = (MEMCFG_KEY | stsFlags);
|
||||
}
|
||||
|
||||
//*****************************************************************************
|
||||
//
|
||||
//! Clears uncorrectable memory read/write error flags.
|
||||
//!
|
||||
//! \param stsFlags is a bit mask of the status flags to be cleared.
|
||||
//!
|
||||
//! This function clears the specified uncorrectable memory read/write error
|
||||
//! flags. The \e stsFlags parameter can take any of the following values or
|
||||
//! their logical OR: \b MEMCFG_UCERR_M4READ, \b MEMCFG_UCERR_M4WRITE,
|
||||
//! \b MEMCFG_UCERR_EMACREAD, \b MEMCFG_UCERR_UDMAREAD,
|
||||
//! \b MEMCFG_UCERR_UDMAWRITE, \b MEMCFG_UCERR_ETHERCATMEMREAD or/and
|
||||
//! \b MEMCFG_UCERR_EMACMEMREAD.
|
||||
//!
|
||||
//! \return None.
|
||||
//
|
||||
//*****************************************************************************
|
||||
static inline void
|
||||
MemCfg_clearUncorrErrorStatus(uint32_t stsFlags)
|
||||
{
|
||||
//
|
||||
// Clear the respective error flags.
|
||||
//
|
||||
HWREG(CMMEMORYERROR_BASE + MEMCFG_O_UCERRCLR) = (MEMCFG_KEY | stsFlags);
|
||||
}
|
||||
|
||||
//*****************************************************************************
|
||||
//
|
||||
//! Gets the bus fault status of the selected bus master.
|
||||
//!
|
||||
//! \param busMasters specifies the bus master for which status is to be
|
||||
//! returned.
|
||||
//!
|
||||
//! This function returns the bus fault status for selected bus masters.The
|
||||
//! parameter \e busMasters can be logical OR of any of the following values:
|
||||
//! \b MEMCFG_BUSMASTER_M4, \b MEMCFG_BUSMASTER_UDMA, \b MEMCFG_BUSMASTER_EMAC,
|
||||
//! or \b MEMCFG_BUSMATER_ALL to get the status for all the bus masters.
|
||||
//!
|
||||
//! \return Returns bus fault status of the bus masters. It can return below
|
||||
//! values or their logical OR's:
|
||||
//! - \b MEMCFG_BUSFAULT_M4 - M4 access encountered busfault
|
||||
//! - \b MEMCFG_BUSFAULT_UDMA - uDMA access encountered busfault
|
||||
//! - \b MEMCFG_BUSFAULT_EMAC - EMAC access encountered busfault
|
||||
//
|
||||
//*****************************************************************************
|
||||
static inline uint32_t
|
||||
MemCfg_getBusFaultStatus(uint32_t busMasters)
|
||||
{
|
||||
//
|
||||
// Return the bus fault status.
|
||||
//
|
||||
return(HWREG(CMMEMORYERROR_BASE + MEMCFG_O_BUSFAULTFLG) & busMasters);
|
||||
}
|
||||
|
||||
//*****************************************************************************
|
||||
//
|
||||
//! Clears the bus fault status of the selected bus master.
|
||||
//!
|
||||
//! \param busMasters specifies the bus masters for which fault status is to be
|
||||
//! cleared.
|
||||
//!
|
||||
//! This function clears the bus fault status for selected bus masters. The
|
||||
//! \e busMasters parameter can be logical OR of any of the following values:
|
||||
//! \b MEMCFG_BUSMASTER_M4, MEMCFG_BUSMASTER_UDMA, MEMCFG_BUSMASTER_EMAC, or
|
||||
//! \b MEMCFG_BUSMATER_ALL to clear the status for all the bus masters.
|
||||
//!
|
||||
//! \return None
|
||||
//
|
||||
//*****************************************************************************
|
||||
static inline void
|
||||
MemCfg_clearBusFaultStatus(uint32_t busMasters)
|
||||
{
|
||||
HWREG(CMMEMORYERROR_BASE + MEMCFG_O_BUSFAULTCLR) =
|
||||
(MEMCFG_KEY | busMasters);
|
||||
}
|
||||
|
||||
//*****************************************************************************
|
||||
//
|
||||
//! Gets the current correctable memory read/write error status.
|
||||
//!
|
||||
//! \return Returns the current error status, enumerated as a bit field of
|
||||
//! \b MEMCFG_CERR_M4READ, \b MEMCFG_CERR_M4WRITE, \b MEMCFG_CERR_EMACREAD,
|
||||
//! \b MEMCFG_CERR_UDMAREAD, and/or \b MEMCFG_CERR_UDMAWRITE.
|
||||
//
|
||||
//*****************************************************************************
|
||||
static inline uint32_t
|
||||
MemCfg_getCorrErrorStatus(void)
|
||||
{
|
||||
//
|
||||
// Read and return RAM error status flags.
|
||||
//
|
||||
return(HWREG(CMMEMORYERROR_BASE + MEMCFG_O_CERRFLG));
|
||||
}
|
||||
|
||||
//*****************************************************************************
|
||||
//
|
||||
//! Sets the specified correctable memory read/write error status flag.
|
||||
//!
|
||||
//! \param stsFlags is a bit mask of the error sources.
|
||||
//!
|
||||
//! This function sets the specified correctable memory read/write error status
|
||||
//! flag. The \e stsFlags parameter can take any of the following values:
|
||||
//! \b MEMCFG_CERR_M4READ, \b MEMCFG_CERR_M4WRITE, \b MEMCFG_CERR_EMACREAD,
|
||||
//! \b MEMCFG_CERR_UDMAREAD, and/or \b MEMCFG_CERR_UDMAWRITE.
|
||||
//!
|
||||
//! \return None.
|
||||
//
|
||||
//*****************************************************************************
|
||||
static inline void
|
||||
MemCfg_forceCorrErrorStatus(uint32_t stsFlags)
|
||||
{
|
||||
//
|
||||
// Write the flags to the appropriate SET register.
|
||||
//
|
||||
HWREG(CMMEMORYERROR_BASE + MEMCFG_O_CERRSET) = (MEMCFG_KEY | stsFlags);
|
||||
}
|
||||
|
||||
//*****************************************************************************
|
||||
//
|
||||
//! Clears correctable memory read/write error flags.
|
||||
//!
|
||||
//! \param stsFlags is a bit mask of the status flags to be cleared.
|
||||
//!
|
||||
//! This function clears the specified correctable memory read/write error
|
||||
//! flags. The \e stsFlags parameter can take any of the following values:
|
||||
//! \b MEMCFG_CERR_M4READ, \b MEMCFG_CERR_M4WRITE, \b MEMCFG_CERR_EMACREAD,
|
||||
//! \b MEMCFG_CERR_UDMAREAD and/or \b MEMCFG_CERR_UDMAWRITE.
|
||||
//!
|
||||
//! \return None.
|
||||
//
|
||||
//*****************************************************************************
|
||||
static inline void
|
||||
MemCfg_clearCorrErrorStatus(uint32_t stsFlags)
|
||||
{
|
||||
//
|
||||
// Clear the requested flags.
|
||||
//
|
||||
HWREG(CMMEMORYERROR_BASE + MEMCFG_O_CERRCLR) = (MEMCFG_KEY | stsFlags);
|
||||
}
|
||||
|
||||
//*****************************************************************************
|
||||
//
|
||||
//! Gets the correctable error count.
|
||||
//!
|
||||
//! \return Returns the number of correctable error which have occurred.
|
||||
//
|
||||
//*****************************************************************************
|
||||
static inline uint32_t
|
||||
MemCfg_getCorrErrorCount(void)
|
||||
{
|
||||
//
|
||||
// Read and return the number of errors that have occurred.
|
||||
//
|
||||
return(HWREG(CMMEMORYERROR_BASE + MEMCFG_O_CERRCNT));
|
||||
}
|
||||
|
||||
//*****************************************************************************
|
||||
//
|
||||
//! Sets the correctable error threshold value.
|
||||
//!
|
||||
//! \param threshold is the correctable error threshold.
|
||||
//!
|
||||
//! This value sets the error-count threshold at which a correctable error
|
||||
//! interrupt is generated. That is when the error count register reaches the
|
||||
//! value specified by the \e threshold parameter, an interrupt is
|
||||
//! generated if it is enabled.
|
||||
//!
|
||||
//! \return None.
|
||||
//
|
||||
//*****************************************************************************
|
||||
static inline void
|
||||
MemCfg_setCorrErrorThreshold(uint32_t threshold)
|
||||
{
|
||||
//
|
||||
// Write the threshold value to the appropriate register.
|
||||
//
|
||||
HWREG(CMMEMORYERROR_BASE + MEMCFG_O_CERRTHRES) = threshold;
|
||||
}
|
||||
|
||||
//*****************************************************************************
|
||||
//
|
||||
//! Enables correctable error interrupt source.
|
||||
//!
|
||||
//! \param intFlags is a bit mask of the interrupt sources to be enabled.
|
||||
//!
|
||||
//! This function enables the indicated correctable error interrupt
|
||||
//! source. Only the sources that are enabled can be reflected to the
|
||||
//! processor interrupt; disabled sources have no effect on the processor. The
|
||||
//! param \e intFlags can take the value \b MEMCFG_CERR_M4READ only. Other
|
||||
//! values are reserved.
|
||||
//!
|
||||
//! \note Note that only correctable errors may generate interrupts.
|
||||
//!
|
||||
//! \return None.
|
||||
//
|
||||
//*****************************************************************************
|
||||
static inline void
|
||||
MemCfg_enableCorrErrorInterrupt(uint32_t intFlags)
|
||||
{
|
||||
//
|
||||
// Enable the specified interrupts.
|
||||
//
|
||||
HWREG(CMMEMORYERROR_BASE + MEMCFG_O_CEINTEN) = (MEMCFG_KEY | intFlags);
|
||||
}
|
||||
|
||||
//*****************************************************************************
|
||||
//
|
||||
//! Disables individual correctable error interrupt sources.
|
||||
//!
|
||||
//! \param intFlags is a bit mask of the interrupt sources to be disabled.
|
||||
//!
|
||||
//! This function disables the indicated correctable error interrupt
|
||||
//! sources. Only the sources that are enabled can be reflected to the
|
||||
//! processor interrupt; disabled sources have no effect on the processor. The
|
||||
//! param \e intFlags can take the value \b MEMCFG_CERR_M4READ only. Other
|
||||
//! values are reserved.
|
||||
//!
|
||||
//! \note Note that only correctable errors may generate interrupts.
|
||||
//!
|
||||
//! \return None.
|
||||
//
|
||||
//*****************************************************************************
|
||||
static inline void
|
||||
MemCfg_disableCorrErrorInterrupt(uint32_t intFlags)
|
||||
{
|
||||
//
|
||||
// Disable the specified interrupts.
|
||||
//
|
||||
HWREG(CMMEMORYERROR_BASE + MEMCFG_O_CEINTEN) = (MEMCFG_KEY | (~(intFlags) &
|
||||
0x0000FFFFU));
|
||||
}
|
||||
|
||||
//*****************************************************************************
|
||||
//
|
||||
//! Gets the current RAM correctable error interrupt status.
|
||||
//!
|
||||
//! \return Returns the current error interrupt status. Will return a value of
|
||||
//! \b MEMCFG_CERR_M4READ if an interrupt has been generated. If not, the
|
||||
//! function will return 0.
|
||||
//
|
||||
//*****************************************************************************
|
||||
static inline uint32_t
|
||||
MemCfg_getCorrErrorInterruptStatus(void)
|
||||
{
|
||||
//
|
||||
// Read and return correctable error interrupt flags.
|
||||
//
|
||||
return(HWREG(CMMEMORYERROR_BASE + MEMCFG_O_CEINTFLG));
|
||||
}
|
||||
|
||||
//*****************************************************************************
|
||||
//
|
||||
//! Sets the correctable error interrupt status.
|
||||
//!
|
||||
//! \param intFlags is a bit mask of the interrupt sources to be set.
|
||||
//!
|
||||
//! This function sets the correctable error interrupt flag. The parameter
|
||||
//! \e intFlags can take the value \b MEMCFG_CERR_M4READ only. Other values are
|
||||
//! reserved.
|
||||
//!
|
||||
//! \note Note that only correctable errors may generate interrupts.
|
||||
//!
|
||||
//! \return None.
|
||||
//
|
||||
//*****************************************************************************
|
||||
static inline void
|
||||
MemCfg_forceCorrErrorInterrupt(uint32_t intFlags)
|
||||
{
|
||||
//
|
||||
// Write the flags to the appropriate SET register.
|
||||
//
|
||||
HWREG(CMMEMORYERROR_BASE + MEMCFG_O_CEINTSET) = (MEMCFG_KEY | intFlags);
|
||||
}
|
||||
|
||||
//*****************************************************************************
|
||||
//
|
||||
//! Clears the correctable error interrupt status.
|
||||
//!
|
||||
//! \param intFlags is a bit mask of the interrupt sources to be cleared. Can
|
||||
//! take the value \b MEMCFG_CERR_M4READ only. Other values are reserved.
|
||||
//!
|
||||
//! This function clears the correctable error interrupt flag.
|
||||
//!
|
||||
//! \note Note that only correctable errors may generate interrupts.
|
||||
//!
|
||||
//! \return None.
|
||||
//
|
||||
//*****************************************************************************
|
||||
static inline void
|
||||
MemCfg_clearCorrErrorInterruptStatus(uint32_t intFlags)
|
||||
{
|
||||
//
|
||||
// Clear the requested flags.
|
||||
//
|
||||
HWREG(CMMEMORYERROR_BASE + MEMCFG_O_CEINTCLR) = (MEMCFG_KEY | intFlags);
|
||||
}
|
||||
|
||||
//*****************************************************************************
|
||||
//
|
||||
//! Gets the diagnostics corr/uncorr memory error status.
|
||||
//!
|
||||
//! \return Returns the diagnostics error status. It can return following
|
||||
//! values: \b MEMCFG_DIAGERR_UNCORR_READ, \b MEMCFG_DIAGERR_UNCORR_WRITE,
|
||||
//! \b MEMCFG_DIAGERR_CORR_READ and/or \b MEMCFG_DIAGERR_CORR_WRITE.
|
||||
//
|
||||
//*****************************************************************************
|
||||
static inline uint32_t
|
||||
MemCfg_getDiagErrorStatus(void)
|
||||
{
|
||||
//
|
||||
// Returns diag error status.
|
||||
//
|
||||
return(HWREG(CMMEMORYDIAGERROR_BASE + MEMCFG_O_DIAGERRFLG));
|
||||
}
|
||||
|
||||
//*****************************************************************************
|
||||
//
|
||||
//! Clears the diagnostics corr/uncorr memory error status.
|
||||
//!
|
||||
//! \param stsFlags is a bit mask of the status flags to be cleared.
|
||||
//!
|
||||
//! This function clears the specified diagnostics corr/uncorr memory read/write
|
||||
//! error flags. The param \e stsFlags can be any of the following values:
|
||||
//! \b MEMCFG_DIAGERR_UNCORR_READ, \b MEMCFG_DIAGERR_UNCORR_WRITE,
|
||||
//! \b MEMCFG_DIAGERR_CORR_READ and/or MEMCFG_DIAGERR_CORR_WRITE.
|
||||
//!
|
||||
//! \return None.
|
||||
//
|
||||
//*****************************************************************************
|
||||
static inline void
|
||||
MemCfg_clearDiagErrorStatus(uint32_t stsFlags)
|
||||
{
|
||||
//
|
||||
// Clear diag error status.
|
||||
//
|
||||
HWREG(CMMEMORYDIAGERROR_BASE + MEMCFG_O_DIAGERRCLR ) |= stsFlags;
|
||||
}
|
||||
|
||||
//*****************************************************************************
|
||||
//
|
||||
//! Gets address location of diagnostics corr/uncorr memory read/write error.
|
||||
//!
|
||||
//! \return Return address location of diagnostics corr/uncorr memory
|
||||
//! read/write error.
|
||||
//
|
||||
//*****************************************************************************
|
||||
static inline uint32_t
|
||||
MemCfg_getDiagErrorAddress(void)
|
||||
{
|
||||
//
|
||||
// Return diag error address.
|
||||
//
|
||||
return(HWREG(CMMEMORYDIAGERROR_BASE + MEMCFG_O_DIAGERRADDR));
|
||||
}
|
||||
|
||||
//*****************************************************************************
|
||||
//
|
||||
//! Locks the write to the configuration of specified memory sections.
|
||||
//!
|
||||
//! \param memSections is the logical OR of the sections to be configured.
|
||||
//!
|
||||
//! This function locks writes to the init and test configuration of RAM
|
||||
//! sections, test configuration of boot ROM & peripheral(EMAC & EtherCAT)
|
||||
//! memory sections. That means calling MemCfg_setTestMode(),
|
||||
//! MemCfg_initSections() for a locked RAM section; MemCfg_setTestMode() for
|
||||
//! locked BootROM & peripheral memory will have no effect until
|
||||
//! MemCfg_unlockConfig() is called.
|
||||
//!
|
||||
//! The \e ramSections parameter is an OR of one of the following sets of
|
||||
//! indicators:
|
||||
//! - \b MEMCFG_SECT_C0 through \b MEMCFG_SECT_C1 or \b MEMCFG_SECT_CX_ALL,
|
||||
//! - \b MEMCFG_SECT_CMTOCPU1MSGRAM0 through \b MEMCFG_SECT_CMTOCPU2MSGRAM1 or
|
||||
//! \b MEMCFG_SECT_CMMSGX_ALL,
|
||||
//! - \b MEMCFG_SECT_S0 through \b MEMCFG_SECT_S4 or \b MEMCFG_SECT_SX_ALL,
|
||||
//! - \b MEMCFG_SECT_ROM,
|
||||
//! - \b MEMCFG_SECT_PERIMEM_ALL,
|
||||
//! - \b OR use \b MEMCFG_SECT_ALL to configure all possible sections.
|
||||
//!
|
||||
//! \return None.
|
||||
//
|
||||
//*****************************************************************************
|
||||
extern void
|
||||
MemCfg_lockConfig(uint32_t memSections);
|
||||
|
||||
//*****************************************************************************
|
||||
//
|
||||
//! Unlocks the writes to the configuration of specified memory sections.
|
||||
//!
|
||||
//! \param memSections is the logical OR of the sections to be configured.
|
||||
//!
|
||||
//! This function unlocks writes to the init and test configuration of RAM
|
||||
//! sections, test configuration of boot ROM & peripheral(EMAC & EtherCAT)
|
||||
//! memory sections that has been locked using MemCfg_lockConfig().
|
||||
//!
|
||||
//! The \e ramSections parameter is an OR of one of the following sets of
|
||||
//! indicators:
|
||||
//! - \b MEMCFG_SECT_C0 through \b MEMCFG_SECT_C1 or \b MEMCFG_SECT_CX_ALL,
|
||||
//! - \b MEMCFG_SECT_CMTOCPU1MSGRAM0 through \b MEMCFG_SECT_CMTOCPU2MSGRAM1 or
|
||||
//! \b MEMCFG_SECT_CMMSGX_ALL,
|
||||
//! - \b MEMCFG_SECT_S0 through \b MEMCFG_SECT_S4 or \b MEMCFG_SECT_SX_ALL,
|
||||
//! - \b MEMCFG_SECT_ROM,
|
||||
//! - \b MEMCFG_SECT_PERIMEM_ALL,
|
||||
//! - \b OR use \b MEMCFG_SECT_ALL to configure all possible sections.
|
||||
//!
|
||||
//! \sa MemCfg_lockConfig()
|
||||
//!
|
||||
//! \return None.
|
||||
//
|
||||
//*****************************************************************************
|
||||
extern void
|
||||
MemCfg_unlockConfig(uint32_t memSections);
|
||||
|
||||
//*****************************************************************************
|
||||
//
|
||||
//! Sets the test mode of the specified memory section.
|
||||
//!
|
||||
//! \param memSection is the memory section to be configured.
|
||||
//! \param testMode is the test mode selected.
|
||||
//!
|
||||
//! This function sets the test mode configuration of the RAM section. The
|
||||
//! \e testMode parameter can take one of the following values:
|
||||
//! - \b MEMCFG_TEST_FUNCTIONAL,
|
||||
//! - \b MEMCFG_TEST_WRITE_DATA,
|
||||
//! - \b MEMCFG_TEST_WRITE_ECC, or
|
||||
//! - \b MEMCFG_TEST_FUNC_DIAG
|
||||
//!
|
||||
//! The \e ramSection parameter is one of the following indicators:
|
||||
//! - \b MEMCFG_SECT_C0 through \b MEMCFG_SECT_C1 or \b MEMCFG_SECT_CX_ALL,
|
||||
//! - \b MEMCFG_SECT_CMTOCPU1MSGRAM0 through \b MEMCFG_SECT_CMTOCPU2MSGRAM1 or
|
||||
//! \b MEMCFG_SECT_CMMSGX_ALL,
|
||||
//! - \b MEMCFG_SECT_S0 through \b MEMCFG_SECT_S4 or \b MEMCFG_SECT_SX_ALL,
|
||||
//! - \b OR use \b MEMCFG_SECT_ROM.
|
||||
//!
|
||||
//! \return None.
|
||||
//
|
||||
//*****************************************************************************
|
||||
extern void
|
||||
MemCfg_setTestMode(uint32_t memSection, MemCfg_TestMode testMode);
|
||||
|
||||
//*****************************************************************************
|
||||
//
|
||||
//! Starts the initialization the specified RAM sections.
|
||||
//!
|
||||
//! \param ramSections is the logical OR of the sections to be initialized.
|
||||
//!
|
||||
//! This function starts the initialization of the specified RAM sections. Use
|
||||
//! MemCfg_getInitStatus() to check if the initialization is done.
|
||||
//!
|
||||
//! The \e ramSections parameter is an OR of one of the following sets of
|
||||
//! indicators:
|
||||
//! - \b MEMCFG_SECT_C0 through \b MEMCFG_SECT_C1 or \b MEMCFG_SECT_CX_ALL,
|
||||
//! - \b MEMCFG_SECT_CMTOCPU1MSGRAM0 through \b MEMCFG_SECT_CMTOCPU2MSGRAM1 or
|
||||
//! \b MEMCFG_SECT_CMMSGX_ALL,
|
||||
//! - \b MEMCFG_SECT_S0 through \b MEMCFG_SECT_S4 or \b MEMCFG_SECT_SX_ALL,
|
||||
//! - \b OR use \b MEMCFG_SECT_ALL to configure all possible sections.
|
||||
//!
|
||||
//! \return None.
|
||||
//
|
||||
//*****************************************************************************
|
||||
extern void
|
||||
MemCfg_initSections(uint32_t ramSections);
|
||||
|
||||
//*****************************************************************************
|
||||
//
|
||||
//! Get the status of initialized RAM sections.
|
||||
//!
|
||||
//! \param ramSections is the logical OR of the sections to be checked.
|
||||
//!
|
||||
//! This function gets the initialization status of the RAM sections specified
|
||||
//! by the \e ramSections parameter.
|
||||
//!
|
||||
//! The \e ramSections parameter is an OR of one of the following sets of
|
||||
//! indicators:
|
||||
//! - \b MEMCFG_SECT_C0 through \b MEMCFG_SECT_C1 or \b MEMCFG_SECT_CX_ALL,
|
||||
//! - \b MEMCFG_SECT_CMTOCPU1MSGRAM0 through \b MEMCFG_SECT_CMTOCPU2MSGRAM1 or
|
||||
//! \b MEMCFG_SECT_CMMSGX_ALL,
|
||||
//! - \b MEMCFG_SECT_S0 through \b MEMCFG_SECT_S4 or \b MEMCFG_SECT_SX_ALL,
|
||||
//! - \b OR use \b MEMCFG_SECT_ALL to configure all possible sections.
|
||||
//!
|
||||
//! \note Use MemCfg_initSections() to start the initialization.
|
||||
//!
|
||||
//! \return Returns \b true if all the sections specified by \e ramSections
|
||||
//! have been initialized and \b false if not.
|
||||
//
|
||||
//*****************************************************************************
|
||||
extern bool
|
||||
MemCfg_getInitStatus(uint32_t ramSections);
|
||||
|
||||
//*****************************************************************************
|
||||
//
|
||||
//! Forces parity error in the selected memory.
|
||||
//!
|
||||
//! \param memTypes is the logical OR of the sections to be tested.
|
||||
//!
|
||||
//! This function forces the parity error in the memories specified
|
||||
//! by the \e memTypes parameter.
|
||||
//!
|
||||
//! The \e memTypes parameter is an OR of one of the following sets of
|
||||
//! indicators:
|
||||
//! - \b MEMCFG_SECT_ROM,
|
||||
//! - \b MEMCFG_SECT_PERIMEM_EMAC,
|
||||
//! - \b MEMCFG_SECT_PERIMEM_ETHERCAT, or
|
||||
//! - \b OR use \b MEMCFG_SECT_ALL to get status of all possible sections.
|
||||
//!
|
||||
//! \return None.
|
||||
//
|
||||
//*****************************************************************************
|
||||
extern void
|
||||
MemCfg_forceMemError(uint32_t memTypes);
|
||||
|
||||
//*****************************************************************************
|
||||
//
|
||||
//! Enables test mode for selected peripheral memories.
|
||||
//!
|
||||
//! \param memTypes is the logical OR of the memories to be tested.
|
||||
//!
|
||||
//! This function enables test mode for selected peripheral memories specified
|
||||
//! by the \e memTypes parameter.
|
||||
//!
|
||||
//! The \e memTypes parameter is an OR of one of the following sets of
|
||||
//! indicators:
|
||||
//! - \b MEMCFG_SECT_PERIMEM_EMAC,
|
||||
//! - \b MEMCFG_SECT_PERIMEM_ETHERCAT, or
|
||||
//! - \b MEMCFG_SECT_PERIMEM_ALL
|
||||
//!
|
||||
//! \return None.
|
||||
//
|
||||
//*****************************************************************************
|
||||
extern void
|
||||
MemCfg_enablePeriMemTestMode(uint32_t memTypes);
|
||||
|
||||
//*****************************************************************************
|
||||
//
|
||||
//! Disables the test mode for selected peripheral memories.
|
||||
//!
|
||||
//! \param memTypes is the logical OR of the memories to be tested.
|
||||
//!
|
||||
//! This function disables test mode for selected peripheral memories specified
|
||||
//! by the \e memTypes parameter.
|
||||
//!
|
||||
//! The \e memTypes parameter is an OR of one of the following sets of
|
||||
//! indicators:
|
||||
//! - \b MEMCFG_SECT_PERIMEM_EMAC,
|
||||
//! - \b MEMCFG_SECT_PERIMEM_ETHERCAT, or
|
||||
//! - \b MEMCFG_SECT_PERIMEM_ALL
|
||||
//!
|
||||
//! \return None.
|
||||
//
|
||||
//*****************************************************************************
|
||||
extern void
|
||||
MemCfg_disablePeriMemTestMode(uint32_t memTypes);
|
||||
|
||||
//*****************************************************************************
|
||||
//
|
||||
//! Gets the address location of uncorrectable memory read/write error.
|
||||
//!
|
||||
//! \param stsFlag is the error for which address needs to be returned.
|
||||
//!
|
||||
//! This function returns the address location of uncorrectable read/write
|
||||
//! error for the specified error. The parameter \e stsFlag can be any of the
|
||||
//! \b MEMCFG_UCERR_M4READ, \b MEMCFG_UCERR_M4WRITE, \b MEMCFG_UCERR_EMACREAD,
|
||||
//! \b MEMCFG_UCERR_EMACWRITE,\b MEMCFG_UCERR_UDMAREAD,
|
||||
//! \b MEMCFG_UCERR_UDMAWRITE, \b MEMCFG_UCERR_ETHERCATMEMREAD or/and
|
||||
//! \b MEMCFG_UCERR_EMACMEMREAD values.
|
||||
//!
|
||||
//! \return Return address location of uncorrectable read/write error.
|
||||
//
|
||||
//*****************************************************************************
|
||||
extern uint32_t
|
||||
MemCfg_getUncorrErrorAddress(uint32_t stsFlag);
|
||||
|
||||
//*****************************************************************************
|
||||
//
|
||||
//! Gets the address location of correctable memory read/write error.
|
||||
//!
|
||||
//! \param stsFlag is the error for which address needs to be returned.
|
||||
//!
|
||||
//! This function returns the address location of correctable read/write
|
||||
//! error for the specified error. The param \e stsFlag can take any of the
|
||||
//! \b MEMCFG_CERR_M4READ, \b MEMCFG_CERR_M4WRITE, \b MEMCFG_CERR_EMACREAD,
|
||||
//! MEMCFG_CERR_EMACWRITE, \b MEMCFG_CERR_UDMAREAD and/or
|
||||
//! \b MEMCFG_CERR_UDMAWRITE values.
|
||||
//!
|
||||
//! \return Return address location of correctable read/write error.
|
||||
//
|
||||
//*****************************************************************************
|
||||
extern uint32_t
|
||||
MemCfg_getCorrErrorAddress(uint32_t stsFlag);
|
||||
|
||||
//*****************************************************************************
|
||||
//
|
||||
//! Gets the bus fault address for the selected bus master.
|
||||
//!
|
||||
//! \param busMaster specifies the bus masters for which fault address is to be
|
||||
//! returned.
|
||||
//!
|
||||
//! This function return the bus fault address for selected bus master. The
|
||||
//! parameter \e busMaster can be any of the following values:
|
||||
//! \b MEMCFG_BUSMASTER_M4, MEMCFG_BUSMASTER_UDMA, or MEMCFG_BUSMASTER_EMAC.
|
||||
//!
|
||||
//! \return Returns bus fault address for the selected bus master.
|
||||
//
|
||||
//*****************************************************************************
|
||||
extern uint32_t
|
||||
MemCfg_getBusFaultAddress(uint32_t busMaster);
|
||||
|
||||
//*****************************************************************************
|
||||
//
|
||||
// Close the Doxygen group.
|
||||
//! @}
|
||||
//
|
||||
//*****************************************************************************
|
||||
|
||||
//*****************************************************************************
|
||||
//
|
||||
// Mark the end of the C bindings section for C++ compilers.
|
||||
//
|
||||
//*****************************************************************************
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif // MEMCFG_H
|
||||
@@ -0,0 +1,46 @@
|
||||
//###########################################################################
|
||||
//
|
||||
// FILE: mpu.c
|
||||
//
|
||||
// TITLE: Driver for the memory protection unit (MPU).
|
||||
//
|
||||
//###########################################################################
|
||||
// $TI Release: $
|
||||
// $Release Date: $
|
||||
//
|
||||
// C2000Ware v5.04.00.00
|
||||
//
|
||||
// Copyright (C) 2024 Texas Instruments Incorporated - http://www.ti.com
|
||||
//
|
||||
// Redistribution and use in source and binary forms, with or without
|
||||
// modification, are permitted provided that the following conditions
|
||||
// are met:
|
||||
//
|
||||
// Redistributions of source code must retain the above copyright
|
||||
// notice, this list of conditions and the following disclaimer.
|
||||
//
|
||||
// Redistributions in binary form must reproduce the above copyright
|
||||
// notice, this list of conditions and the following disclaimer in the
|
||||
// documentation and/or other materials provided with the
|
||||
// distribution.
|
||||
//
|
||||
// Neither the name of Texas Instruments Incorporated nor the names of
|
||||
// its contributors may be used to endorse or promote products derived
|
||||
// from this software without specific prior written permission.
|
||||
//
|
||||
// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
|
||||
// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
|
||||
// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
|
||||
// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
|
||||
// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
|
||||
// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
|
||||
// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
|
||||
// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
|
||||
// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
||||
// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
|
||||
// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
// $
|
||||
//###########################################################################
|
||||
|
||||
#include "mpu.h"
|
||||
|
||||
+641
@@ -0,0 +1,641 @@
|
||||
//###########################################################################
|
||||
//
|
||||
// FILE: mpu.h
|
||||
//
|
||||
// TITLE: Driver for the memory protection unit (MPU).
|
||||
//
|
||||
//###########################################################################
|
||||
// $TI Release: $
|
||||
// $Release Date: $
|
||||
//
|
||||
// C2000Ware v5.04.00.00
|
||||
//
|
||||
// Copyright (C) 2024 Texas Instruments Incorporated - http://www.ti.com
|
||||
//
|
||||
// Redistribution and use in source and binary forms, with or without
|
||||
// modification, are permitted provided that the following conditions
|
||||
// are met:
|
||||
//
|
||||
// Redistributions of source code must retain the above copyright
|
||||
// notice, this list of conditions and the following disclaimer.
|
||||
//
|
||||
// Redistributions in binary form must reproduce the above copyright
|
||||
// notice, this list of conditions and the following disclaimer in the
|
||||
// documentation and/or other materials provided with the
|
||||
// distribution.
|
||||
//
|
||||
// Neither the name of Texas Instruments Incorporated nor the names of
|
||||
// its contributors may be used to endorse or promote products derived
|
||||
// from this software without specific prior written permission.
|
||||
//
|
||||
// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
|
||||
// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
|
||||
// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
|
||||
// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
|
||||
// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
|
||||
// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
|
||||
// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
|
||||
// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
|
||||
// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
||||
// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
|
||||
// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
// $
|
||||
//###########################################################################
|
||||
|
||||
#ifndef MPU_H
|
||||
#define MPU_H
|
||||
|
||||
//*****************************************************************************
|
||||
//
|
||||
// If building with a C++ compiler, make all of the definitions in this header
|
||||
// have a C binding.
|
||||
//
|
||||
//*****************************************************************************
|
||||
#ifdef __cplusplus
|
||||
extern "C"
|
||||
{
|
||||
#endif
|
||||
|
||||
//*****************************************************************************
|
||||
//
|
||||
//! \addtogroup mpu_api MPU
|
||||
//! @{
|
||||
//
|
||||
//*****************************************************************************
|
||||
|
||||
#include <stdbool.h>
|
||||
#include <stdint.h>
|
||||
#include "debug.h"
|
||||
#include "interrupt.h"
|
||||
#include "inc_cm/hw_ints.h"
|
||||
#include "inc_cm/hw_memmap.h"
|
||||
#include "inc_cm/hw_nvic.h"
|
||||
#include "inc_cm/hw_types.h"
|
||||
|
||||
//*****************************************************************************
|
||||
//
|
||||
// Defines for the API.
|
||||
//
|
||||
//*****************************************************************************
|
||||
//*****************************************************************************
|
||||
//
|
||||
// Values that can be passed to MPU_enable() as config parameter.
|
||||
//
|
||||
//*****************************************************************************
|
||||
#define MPU_CONFIG_PRIV_DEFAULT 0x4U //!< Enable default memory map as bg
|
||||
//!< region for priv sw access.
|
||||
#define MPU_CONFIG_HARDFLT_NMI 0x2U //!< MPU is enabled during hard fault,
|
||||
//!< NMI and FAULTMASK handlers.
|
||||
#define MPU_CONFIG_NONE 0x0U //!< None of the above configurations.
|
||||
|
||||
//*****************************************************************************
|
||||
//
|
||||
// Values that can be passed to MPU_setRegionAttributes() and
|
||||
// MPU_getRegionAttributes() as regionNum parameter.
|
||||
//
|
||||
//*****************************************************************************
|
||||
#define MPU_RGN_0 0x0U
|
||||
#define MPU_RGN_1 0x1U
|
||||
#define MPU_RGN_2 0x2U
|
||||
#define MPU_RGN_3 0x3U
|
||||
#define MPU_RGN_4 0x4U
|
||||
#define MPU_RGN_5 0x5U
|
||||
#define MPU_RGN_6 0x6U
|
||||
#define MPU_RGN_7 0x7U
|
||||
|
||||
//*****************************************************************************
|
||||
//
|
||||
// Flags for the region size to be passed to MPU_setRegionAttributes().
|
||||
//
|
||||
//*****************************************************************************
|
||||
#define MPU_RGN_SIZE_32B (4U << 1U) //!< Region Size is 32-bytes
|
||||
#define MPU_RGN_SIZE_64B (5U << 1U) //!< Region Size is 64-bytes
|
||||
#define MPU_RGN_SIZE_128B (6U << 1U) //!< Region Size is 128-bytes
|
||||
#define MPU_RGN_SIZE_256B (7U << 1U) //!< Region Size is 256-bytes
|
||||
#define MPU_RGN_SIZE_512B (8U << 1U) //!< Region Size is 512-bytes
|
||||
#define MPU_RGN_SIZE_1K (9U << 1U) //!< Region Size is 1K-bytes
|
||||
#define MPU_RGN_SIZE_2K (10U << 1U) //!< Region Size is 2K-bytes
|
||||
#define MPU_RGN_SIZE_4K (11U << 1U) //!< Region Size is 4K-bytes
|
||||
#define MPU_RGN_SIZE_8K (12U << 1U) //!< Region Size is 8K-bytes
|
||||
#define MPU_RGN_SIZE_16K (13U << 1U) //!< Region Size is 16K-bytes
|
||||
#define MPU_RGN_SIZE_32K (14U << 1U) //!< Region Size is 32K-bytes
|
||||
#define MPU_RGN_SIZE_64K (15U << 1U) //!< Region Size is 64K-bytes
|
||||
#define MPU_RGN_SIZE_128K (16U << 1U) //!< Region Size is 128K-bytes
|
||||
#define MPU_RGN_SIZE_256K (17U << 1U) //!< Region Size is 256K-bytes
|
||||
#define MPU_RGN_SIZE_512K (18U << 1U) //!< Region Size is 512K-bytes
|
||||
#define MPU_RGN_SIZE_1M (19U << 1U) //!< Region Size is 1M-bytes
|
||||
#define MPU_RGN_SIZE_2M (20U << 1U) //!< Region Size is 2M-bytes
|
||||
#define MPU_RGN_SIZE_4M (21U << 1U) //!< Region Size is 4M-bytes
|
||||
#define MPU_RGN_SIZE_8M (22U << 1U) //!< Region Size is 8M-bytes
|
||||
#define MPU_RGN_SIZE_16M (23U << 1U) //!< Region Size is 16M-bytes
|
||||
#define MPU_RGN_SIZE_32M (24U << 1U) //!< Region Size is 32M-bytes
|
||||
#define MPU_RGN_SIZE_64M (25U << 1U) //!< Region Size is 64M-bytes
|
||||
#define MPU_RGN_SIZE_128M (26U << 1U) //!< Region Size is 128M-bytes
|
||||
#define MPU_RGN_SIZE_256M (27U << 1U) //!< Region Size is 256M-bytes
|
||||
#define MPU_RGN_SIZE_512M (28U << 1U) //!< Region Size is 512M-bytes
|
||||
#define MPU_RGN_SIZE_1G (29U << 1U) //!< Region Size is 1G-bytes
|
||||
#define MPU_RGN_SIZE_2G (30U << 1U) //!< Region Size is 2G-bytes
|
||||
#define MPU_RGN_SIZE_4G (31U << 1U) //!< Region Size is 4G-bytes
|
||||
|
||||
//*****************************************************************************
|
||||
//
|
||||
// Flags for the permissions to be passed to MPU_setRegionAttributes().
|
||||
//
|
||||
//*****************************************************************************
|
||||
#define MPU_RGN_PERM_EXEC 0x00000000U //!< Inst. fetches are enabled
|
||||
#define MPU_RGN_PERM_NOEXEC 0x10000000U //!< Inst. fetches are disabled
|
||||
#define MPU_RGN_PERM_PRV_NO_USR_NO 0x00000000U //!< No access to privileged &
|
||||
//!< unprivileged access
|
||||
#define MPU_RGN_PERM_PRV_RW_USR_NO 0x01000000U //!< R/W to privileged sw, no
|
||||
//!< access to unprivileged sw
|
||||
#define MPU_RGN_PERM_PRV_RW_USR_RO 0x02000000U //!< R/W access to priv sw, no
|
||||
//!< access to unpriv sw
|
||||
#define MPU_RGN_PERM_PRV_RW_USR_RW 0x03000000U //!< R/W access to priv sw, R/W
|
||||
//!< access to unpriv sw
|
||||
#define MPU_RGN_PERM_PRV_RO_USR_NO 0x05000000U //!< RO access to priv sw, no
|
||||
//!< access to unpriv sw
|
||||
#define MPU_RGN_PERM_PRV_RO_USR_RO 0x06000000U //!< RO access to priv sw, RO
|
||||
//!< access to unpriv sw
|
||||
|
||||
//*****************************************************************************
|
||||
//
|
||||
// Flags for the sub-region to be passed to MPU_setRegionAttributes().
|
||||
//
|
||||
//*****************************************************************************
|
||||
#define MPU_SUB_RGN_DISABLE_0 0x00000100U //!< Disable sub-region 0
|
||||
#define MPU_SUB_RGN_DISABLE_1 0x00000200U //!< Disable sub-region 1
|
||||
#define MPU_SUB_RGN_DISABLE_2 0x00000400U //!< Disable sub-region 2
|
||||
#define MPU_SUB_RGN_DISABLE_3 0x00000800U //!< Disable sub-region 3
|
||||
#define MPU_SUB_RGN_DISABLE_4 0x00001000U //!< Disable sub-region 4
|
||||
#define MPU_SUB_RGN_DISABLE_5 0x00002000U //!< Disable sub-region 5
|
||||
#define MPU_SUB_RGN_DISABLE_6 0x00004000U //!< Disable sub-region 6
|
||||
#define MPU_SUB_RGN_DISABLE_7 0x00008000U //!< Disable sub-region 7
|
||||
|
||||
//*****************************************************************************
|
||||
//
|
||||
// Flags to enable or disable a region, to be passed to
|
||||
// MPU_setRegionAttributes().
|
||||
//
|
||||
//*****************************************************************************
|
||||
#define MPU_RGN_ENABLE 1U //!< Enable MPU Region
|
||||
#define MPU_RGN_DISABLE 0U //!< Disable MPU Region
|
||||
|
||||
//*****************************************************************************
|
||||
//
|
||||
// Mask for MPU region attributes to be used by MPU_setRegionAttributes().
|
||||
//
|
||||
//*****************************************************************************
|
||||
|
||||
#define MPU_RGN_CONFIG_M ((uint32_t)NVIC_MPU_RASR_ENABLE | \
|
||||
(uint32_t)NVIC_MPU_RASR_SIZE_M | \
|
||||
(uint32_t)NVIC_MPU_RASR_SRD_M | \
|
||||
(uint32_t)NVIC_MPU_RASR_B | \
|
||||
(uint32_t)NVIC_MPU_RASR_C | \
|
||||
(uint32_t)NVIC_MPU_RASR_S | \
|
||||
(uint32_t)NVIC_MPU_RASR_TEX_M | \
|
||||
(uint32_t)NVIC_MPU_RASR_AP_M | \
|
||||
(uint32_t)NVIC_MPU_RASR_XN)
|
||||
|
||||
//*****************************************************************************
|
||||
//
|
||||
// API Function prototypes
|
||||
//
|
||||
//*****************************************************************************
|
||||
//*****************************************************************************
|
||||
//
|
||||
//! Enables and configures the MPU for use.
|
||||
//!
|
||||
//! \param config is the logical OR of the possible configurations.
|
||||
//!
|
||||
//! This function enables the Cortex-M memory protection unit. It also
|
||||
//! configures the default behavior when in privileged mode and while handling
|
||||
//! a hard fault or NMI. Prior to enabling the MPU, at least one region must
|
||||
//! be set by calling MPU_setRegionAttributes() or else by enabling the default
|
||||
//! region for privileged mode by passing the \b MPU_CONFIG_PRIV_DEFAULT flag
|
||||
//! to MPU_enable(). Once the MPU is enabled, a memory management fault is
|
||||
//! generated for memory access violations.
|
||||
//!
|
||||
//! The \e config parameter should be the logical OR of any of the
|
||||
//! following:
|
||||
//! - \b MPU_CONFIG_PRIV_DEFAULT enables the default memory map when in
|
||||
//! privileged mode and when no other regions are defined. If this option
|
||||
//! is not enabled, then there must be at least one valid region already
|
||||
//! defined when the MPU is enabled.
|
||||
//! - \b MPU_CONFIG_HARDFLT_NMI enables the MPU while in a hard fault or NMI
|
||||
//! exception handler. If this option is not enabled, then the MPU is
|
||||
//! disabled while in one of these exception handlers and the default
|
||||
//! memory map is applied.
|
||||
//! - \b MPU_CONFIG_NONE chooses none of the above options. In this case,
|
||||
//! no default memory map is provided in privileged mode, and the MPU is not
|
||||
//! enabled in the fault handlers.
|
||||
//!
|
||||
//! \return None.
|
||||
//
|
||||
//*****************************************************************************
|
||||
static inline void
|
||||
MPU_enable(uint32_t config)
|
||||
{
|
||||
//
|
||||
// Check the arguments.
|
||||
//
|
||||
ASSERT((config & ~(MPU_CONFIG_PRIV_DEFAULT |
|
||||
MPU_CONFIG_HARDFLT_NMI)) == 0U);
|
||||
|
||||
//
|
||||
// Set the MPU control bits according to the flags passed by the user,
|
||||
// and also set the enable bit.
|
||||
//
|
||||
HWREG(NVIC_BASE + NVIC_O_MPU_CTRL) |= (config | NVIC_MPU_CTRL_ENABLE);
|
||||
}
|
||||
|
||||
//*****************************************************************************
|
||||
//
|
||||
//! Disables the MPU for use.
|
||||
//!
|
||||
//! \param None
|
||||
//!
|
||||
//! This function disables the Cortex-M memory protection unit. When the
|
||||
//! MPU is disabled, the default memory map is used and memory management
|
||||
//! faults are not generated.
|
||||
//!
|
||||
//! \return None.
|
||||
//
|
||||
//*****************************************************************************
|
||||
static inline void
|
||||
MPU_disable(void)
|
||||
{
|
||||
//
|
||||
// Turn off the MPU enable bit.
|
||||
//
|
||||
HWREG(NVIC_BASE + NVIC_O_MPU_CTRL) &= ~NVIC_MPU_CTRL_ENABLE;
|
||||
}
|
||||
|
||||
//*****************************************************************************
|
||||
//
|
||||
//! Gets the count of regions supported by the MPU.
|
||||
//!
|
||||
//! \param None
|
||||
//!
|
||||
//! This function is used to get the total number of regions that are supported
|
||||
//! by the MPU, including regions that are already programmed.
|
||||
//!
|
||||
//! \return The number of memory protection regions that are available
|
||||
//! for programming using MPU_setRegionAttributes().
|
||||
//
|
||||
//*****************************************************************************
|
||||
static inline uint32_t
|
||||
MPU_getRegionCount(void)
|
||||
{
|
||||
//
|
||||
// Read the DREGION field of the MPU type register and mask off
|
||||
// the bits of interest to get the count of regions.
|
||||
//
|
||||
return((HWREG(NVIC_BASE + NVIC_O_MPU_TYPE) & NVIC_MPU_TYPE_DREGION_M) >>
|
||||
NVIC_MPU_TYPE_DREGION_S);
|
||||
}
|
||||
|
||||
//*****************************************************************************
|
||||
//
|
||||
//! Enables a specific region.
|
||||
//!
|
||||
//! \param regionNum is the region number to enable.
|
||||
//!
|
||||
//! This function is used to enable a memory protection region. The region
|
||||
//! should already be configured with the MPU_setRegionAttributes() function.
|
||||
//! Once enabled, the memory protection rules of the region are applied and
|
||||
//! access violations cause a memory management fault.
|
||||
//!
|
||||
//! \return None.
|
||||
//
|
||||
//*****************************************************************************
|
||||
static inline void
|
||||
MPU_enableRegion(uint32_t regionNum)
|
||||
{
|
||||
//
|
||||
// Check the arguments.
|
||||
//
|
||||
ASSERT(regionNum < 8U);
|
||||
|
||||
//
|
||||
// Select the region to modify.
|
||||
//
|
||||
HWREG(NVIC_BASE + NVIC_O_MPU_RNR) = (HWREG(NVIC_BASE + NVIC_O_MPU_RNR) &
|
||||
~NVIC_MPU_RNR_REGION_M) | regionNum;
|
||||
|
||||
//
|
||||
// Modify the enable bit in the region attributes.
|
||||
//
|
||||
HWREG(NVIC_BASE + NVIC_O_MPU_RASR) |= NVIC_MPU_RASR_ENABLE;
|
||||
}
|
||||
|
||||
//*****************************************************************************
|
||||
//
|
||||
//! Disables a specific region.
|
||||
//!
|
||||
//! \param regionNum is the region number to disable.
|
||||
//!
|
||||
//! This function is used to disable a previously enabled memory protection
|
||||
//! region. The region remains configured if it is not overwritten with
|
||||
//! another call to MPU_setRegionAttributes(), and can be enabled again by
|
||||
//! calling MPU_enableRegion().
|
||||
//!
|
||||
//! \return None.
|
||||
//
|
||||
//*****************************************************************************
|
||||
static inline void
|
||||
MPU_disableRegion(uint32_t regionNum)
|
||||
{
|
||||
//
|
||||
// Check the arguments.
|
||||
//
|
||||
ASSERT(regionNum < 8U);
|
||||
|
||||
//
|
||||
// Select the region to modify.
|
||||
//
|
||||
HWREG(NVIC_BASE + NVIC_O_MPU_RNR) = (HWREG(NVIC_BASE + NVIC_O_MPU_RNR) &
|
||||
~NVIC_MPU_RNR_REGION_M) | regionNum;
|
||||
|
||||
//
|
||||
// Modify the enable bit in the region attributes.
|
||||
//
|
||||
HWREG(NVIC_BASE + NVIC_O_MPU_RASR) &= ~NVIC_MPU_RASR_ENABLE;
|
||||
}
|
||||
|
||||
//*****************************************************************************
|
||||
//
|
||||
//! Sets up the access rules for a specific region.
|
||||
//!
|
||||
//! \param regionNum is the region number to set up.
|
||||
//! \param baseAddr is the base address of the region. It must be aligned
|
||||
//! according to the size of the region specified in attrFlags.
|
||||
//! \param attrFlags is a set of flags to define the attributes of the region.
|
||||
//!
|
||||
//! This function sets up the protection rules for a region. The region has
|
||||
//! a base address and a set of attributes including the size.
|
||||
//!
|
||||
//! The region number parameter, \e regionNum specifies the region number to be
|
||||
//! setup. Valid values for \e regionNum paramter are:
|
||||
//! - \b MPU_RGN_0
|
||||
//! - \b MPU_RGN_1
|
||||
//! - \b MPU_RGN_2
|
||||
//! - \b MPU_RGN_3
|
||||
//! - \b MPU_RGN_4
|
||||
//! - \b MPU_RGN_5
|
||||
//! - \b MPU_RGN_6
|
||||
//! - \b MPU_RGN_7
|
||||
//!
|
||||
//! The base address parameter, \e baseAddr, must be aligned according to the
|
||||
//! size, and the size must be a power of 2.
|
||||
//!
|
||||
//! The \e attrFlags parameter is the logical OR of all of the attributes
|
||||
//! of the region. It is a combination of choices for region size,
|
||||
//! execute permission, read/write permissions, disabled sub-regions,
|
||||
//! and a flag to determine if the region is enabled.
|
||||
//!
|
||||
//! The size flag determines the size of a region and must be one of the
|
||||
//! following:
|
||||
//! - \b MPU_RGN_SIZE_32B
|
||||
//! - \b MPU_RGN_SIZE_64B
|
||||
//! - \b MPU_RGN_SIZE_128B
|
||||
//! - \b MPU_RGN_SIZE_256B
|
||||
//! - \b MPU_RGN_SIZE_512B
|
||||
//! - \b MPU_RGN_SIZE_1K
|
||||
//! - \b MPU_RGN_SIZE_2K
|
||||
//! - \b MPU_RGN_SIZE_4K
|
||||
//! - \b MPU_RGN_SIZE_8K
|
||||
//! - \b MPU_RGN_SIZE_16K
|
||||
//! - \b MPU_RGN_SIZE_32K
|
||||
//! - \b MPU_RGN_SIZE_64K
|
||||
//! - \b MPU_RGN_SIZE_128K
|
||||
//! - \b MPU_RGN_SIZE_256K
|
||||
//! - \b MPU_RGN_SIZE_512K
|
||||
//! - \b MPU_RGN_SIZE_1M
|
||||
//! - \b MPU_RGN_SIZE_2M
|
||||
//! - \b MPU_RGN_SIZE_4M
|
||||
//! - \b MPU_RGN_SIZE_8M
|
||||
//! - \b MPU_RGN_SIZE_16M
|
||||
//! - \b MPU_RGN_SIZE_32M
|
||||
//! - \b MPU_RGN_SIZE_64M
|
||||
//! - \b MPU_RGN_SIZE_128M
|
||||
//! - \b MPU_RGN_SIZE_256M
|
||||
//! - \b MPU_RGN_SIZE_512M
|
||||
//! - \b MPU_RGN_SIZE_1G
|
||||
//! - \b MPU_RGN_SIZE_2G
|
||||
//! - \b MPU_RGN_SIZE_4G
|
||||
//!
|
||||
//! The execute permission flag must be one of the following:
|
||||
//! - \b MPU_RGN_PERM_EXEC enables the region for execution of code
|
||||
//! - \b MPU_RGN_PERM_NOEXEC disables the region for execution of code
|
||||
//!
|
||||
//! The read/write access permissions are applied separately for the
|
||||
//! privileged and user modes. The read/write access flags must be one
|
||||
//! of the following:
|
||||
//! - \b MPU_RGN_PERM_PRV_NO_USR_NO - no access in privileged or user mode
|
||||
//! - \b MPU_RGN_PERM_PRV_RW_USR_NO - privileged read/write, user no access
|
||||
//! - \b MPU_RGN_PERM_PRV_RW_USR_RO - privileged read/write, user read-only
|
||||
//! - \b MPU_RGN_PERM_PRV_RW_USR_RW - privileged read/write, user read/write
|
||||
//! - \b MPU_RGN_PERM_PRV_RO_USR_NO - privileged read-only, user no access
|
||||
//! - \b MPU_RGN_PERM_PRV_RO_USR_RO - privileged read-only, user read-only
|
||||
//!
|
||||
//! The region is automatically divided into 8 equally-sized sub-regions by
|
||||
//! the MPU. Sub-regions can only be used in regions of size 256 bytes
|
||||
//! or larger. Any of these 8 sub-regions can be disabled, allowing for
|
||||
//! creation of ``holes'' in a region which can be left open, or overlaid
|
||||
//! by another region with different attributes. Any of the 8 sub-regions
|
||||
//! can be disabled with a logical OR of any of the following flags:
|
||||
//! - \b MPU_SUB_RGN_DISABLE_0
|
||||
//! - \b MPU_SUB_RGN_DISABLE_1
|
||||
//! - \b MPU_SUB_RGN_DISABLE_2
|
||||
//! - \b MPU_SUB_RGN_DISABLE_3
|
||||
//! - \b MPU_SUB_RGN_DISABLE_4
|
||||
//! - \b MPU_SUB_RGN_DISABLE_5
|
||||
//! - \b MPU_SUB_RGN_DISABLE_6
|
||||
//! - \b MPU_SUB_RGN_DISABLE_7
|
||||
//!
|
||||
//! Finally, the region can be initially enabled or disabled with one of
|
||||
//! the following flags:
|
||||
//! - \b MPU_RGN_ENABLE
|
||||
//! - \b MPU_RGN_DISABLE
|
||||
//!
|
||||
//! As an example, to set a region with the following attributes: size of
|
||||
//! 32 KB, execution enabled, read-only for both privileged and user, one
|
||||
//! sub-region disabled, and initially enabled; the \e attrFlags parameter
|
||||
//! would have the following value:
|
||||
//!
|
||||
//! <code>
|
||||
//! (MPU_RGN_SIZE_32K | MPU_RGN_PERM_EXEC | MPU_RGN_PERM_PRV_RO_USR_RO |
|
||||
//! MPU_SUB_RGN_DISABLE_2 | MPU_RGN_ENABLE)
|
||||
//! </code>
|
||||
//!
|
||||
//! \note This function writes to multiple registers and is not protected
|
||||
//! from interrupts. It is possible that an interrupt which accesses a
|
||||
//! region may occur while that region is in the process of being changed.
|
||||
//! The safest way to handle this is to disable a region before changing it.
|
||||
//! Refer to the discussion of this in the API Detailed Description section.
|
||||
//!
|
||||
//! \return None.
|
||||
//
|
||||
//*****************************************************************************
|
||||
static inline void
|
||||
MPU_setRegionAttributes(uint32_t regionNum, uint32_t baseAddr,
|
||||
uint32_t attrFlags)
|
||||
{
|
||||
uint32_t temp;
|
||||
//
|
||||
// Check the arguments.
|
||||
//
|
||||
ASSERT(regionNum < 8U);
|
||||
|
||||
//
|
||||
// Checking whether the region base address is aligned according to the
|
||||
// desired region size.
|
||||
//
|
||||
ASSERT(baseAddr == (baseAddr & (~(uint32_t)0U <<
|
||||
(((attrFlags & NVIC_MPU_RASR_SIZE_M) >>
|
||||
NVIC_MPU_RASR_SIZE_S) + 1U))));
|
||||
|
||||
//
|
||||
// Program the base address, use the region field to select the
|
||||
// region at the same time.
|
||||
//
|
||||
HWREG(NVIC_BASE + NVIC_O_MPU_RBAR) = baseAddr | regionNum |
|
||||
NVIC_MPU_RBAR_VALID;
|
||||
|
||||
//
|
||||
// Program the region attributes.
|
||||
//
|
||||
temp = MPU_RGN_CONFIG_M;
|
||||
HWREG(NVIC_BASE + NVIC_O_MPU_RASR) = (HWREG(NVIC_BASE + NVIC_O_MPU_RASR) &
|
||||
~(temp)) | attrFlags;
|
||||
}
|
||||
|
||||
//*****************************************************************************
|
||||
//
|
||||
//! Gets the current settings for a specific region.
|
||||
//!
|
||||
//! \param regionNum is the region number to get.
|
||||
//! \param baseAddr points to storage for the base address of the region.
|
||||
//! \param attrFlags points to the attribute flags for the region.
|
||||
//!
|
||||
//! This function retrieves the configuration of a specific region. The
|
||||
//! meanings and format of the parameters is the same as that of the
|
||||
//! MPU_setRegionAttributes() function.
|
||||
//!
|
||||
//! This function can be used to save the configuration of a region for later
|
||||
//! use with the MPU_setRegionAttributes() function. The region's enable state
|
||||
//! is preserved in the attributes that are saved.
|
||||
//!
|
||||
//! \return None.
|
||||
//
|
||||
//*****************************************************************************
|
||||
static inline void
|
||||
MPU_getRegionAttributes(uint32_t regionNum, uint32_t *baseAddr,
|
||||
uint32_t *attrFlags)
|
||||
{
|
||||
//
|
||||
// Check the arguments.
|
||||
//
|
||||
ASSERT(regionNum < 8U);
|
||||
ASSERT(baseAddr != 0U);
|
||||
ASSERT(attrFlags != 0U);
|
||||
|
||||
//
|
||||
// Select the region to get.
|
||||
//
|
||||
HWREG(NVIC_BASE + NVIC_O_MPU_RNR) = regionNum;
|
||||
|
||||
//
|
||||
// Read and store the base address for the region.
|
||||
//
|
||||
*baseAddr = HWREG(NVIC_BASE + NVIC_O_MPU_RBAR) & NVIC_MPU_RBAR_ADDR_M;
|
||||
|
||||
//
|
||||
// Read and store the region attributes.
|
||||
//
|
||||
*attrFlags = HWREG(NVIC_BASE + NVIC_O_MPU_RASR);
|
||||
}
|
||||
|
||||
//*****************************************************************************
|
||||
//
|
||||
//! Registers an interrupt handler for the memory management fault.
|
||||
//!
|
||||
//! \param intNum is the interrupt number to be registered.
|
||||
//! \param fnHandler is a pointer to the function to be called when the
|
||||
//! memory management fault occurs.
|
||||
//!
|
||||
//! This function sets and enables the handler to be called when the MPU
|
||||
//! generates a memory management fault due to a protection region access
|
||||
//! violation. The param intNum can take value FAULT_MPU.
|
||||
//!
|
||||
//! \sa Interrupt_registerHandler() for important information about registering
|
||||
//! interrupt handlers.
|
||||
//!
|
||||
//! \return None.
|
||||
//
|
||||
//*****************************************************************************
|
||||
static inline void
|
||||
MPU_registerHandler(uint32_t intNum, void (*fnHandler)(void))
|
||||
{
|
||||
//
|
||||
// Check the arguments.
|
||||
//
|
||||
ASSERT(fnHandler);
|
||||
|
||||
//
|
||||
// Register the interrupt handler.
|
||||
//
|
||||
Interrupt_registerHandler(intNum, fnHandler);
|
||||
|
||||
//
|
||||
// Enable the memory management fault.
|
||||
//
|
||||
Interrupt_enable(intNum);
|
||||
}
|
||||
|
||||
//*****************************************************************************
|
||||
//
|
||||
//! Unregisters an interrupt handler for the memory management fault.
|
||||
//!
|
||||
//! \param intNum is the interrupt number to be unregistered.
|
||||
//!
|
||||
//! This function disables and clears the handler to be called when a
|
||||
//! memory management fault occurs. The param intNum can take value FAULT_MPU.
|
||||
//!
|
||||
//! \sa Interrupt_registerHandler() for important information about registering
|
||||
//! interrupt handlers.
|
||||
//!
|
||||
//! \return None.
|
||||
//
|
||||
//*****************************************************************************
|
||||
static inline void
|
||||
MPU_unregisterHandler(uint32_t intNum)
|
||||
{
|
||||
//
|
||||
// Disable the interrupt.
|
||||
//
|
||||
Interrupt_disable(intNum);
|
||||
|
||||
//
|
||||
// Unregister the interrupt handler.
|
||||
//
|
||||
Interrupt_unregisterHandler(intNum);
|
||||
}
|
||||
|
||||
//*****************************************************************************
|
||||
//
|
||||
// Close the Doxygen group.
|
||||
//! @}
|
||||
//
|
||||
//*****************************************************************************
|
||||
|
||||
//*****************************************************************************
|
||||
//
|
||||
// Mark the end of the C bindings section for C++ compilers.
|
||||
//
|
||||
//*****************************************************************************
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif // MPU_H
|
||||
+218
@@ -0,0 +1,218 @@
|
||||
//###########################################################################
|
||||
//
|
||||
// FILE: ssi.c
|
||||
//
|
||||
// TITLE: Driver for the SSI module.
|
||||
//
|
||||
//###########################################################################
|
||||
// $TI Release: $
|
||||
// $Release Date: $
|
||||
//
|
||||
// C2000Ware v5.04.00.00
|
||||
//
|
||||
// Copyright (C) 2024 Texas Instruments Incorporated - http://www.ti.com
|
||||
//
|
||||
// Redistribution and use in source and binary forms, with or without
|
||||
// modification, are permitted provided that the following conditions
|
||||
// are met:
|
||||
//
|
||||
// Redistributions of source code must retain the above copyright
|
||||
// notice, this list of conditions and the following disclaimer.
|
||||
//
|
||||
// Redistributions in binary form must reproduce the above copyright
|
||||
// notice, this list of conditions and the following disclaimer in the
|
||||
// documentation and/or other materials provided with the
|
||||
// distribution.
|
||||
//
|
||||
// Neither the name of Texas Instruments Incorporated nor the names of
|
||||
// its contributors may be used to endorse or promote products derived
|
||||
// from this software without specific prior written permission.
|
||||
//
|
||||
// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
|
||||
// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
|
||||
// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
|
||||
// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
|
||||
// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
|
||||
// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
|
||||
// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
|
||||
// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
|
||||
// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
||||
// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
|
||||
// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
// $
|
||||
//###########################################################################
|
||||
|
||||
#include "ssi.h"
|
||||
|
||||
|
||||
//*****************************************************************************
|
||||
//
|
||||
// SSI_setConfig
|
||||
//
|
||||
//*****************************************************************************
|
||||
void SSI_setConfig(uint32_t base, uint32_t ssiClk, uint32_t protocol,
|
||||
uint32_t mode, uint32_t bitRate, uint32_t dataWidth)
|
||||
{
|
||||
|
||||
uint32_t maxBitRate;
|
||||
uint32_t preDiv;
|
||||
uint32_t scr;
|
||||
uint32_t sph_spo;
|
||||
|
||||
//
|
||||
// Check the arguments.
|
||||
//
|
||||
ASSERT(SSI_isBaseValid(base));
|
||||
ASSERT((protocol == SSI_FRF_MOTO_MODE_0) ||
|
||||
(protocol == SSI_FRF_MOTO_MODE_1) ||
|
||||
(protocol == SSI_FRF_MOTO_MODE_2) ||
|
||||
(protocol == SSI_FRF_MOTO_MODE_3) ||
|
||||
(protocol == SSI_FRF_TI));
|
||||
ASSERT((mode == SSI_MODE_MASTER) ||
|
||||
(mode == SSI_MODE_SLAVE));
|
||||
ASSERT(((mode == SSI_MODE_MASTER) && (bitRate <= (ssiClk / 2U))) ||
|
||||
((mode != SSI_MODE_MASTER) && (bitRate <= (ssiClk / 12U))));
|
||||
ASSERT((ssiClk / bitRate) <= (254U * 256U));
|
||||
ASSERT((dataWidth >= 4U) && (dataWidth <= 16U));
|
||||
|
||||
//
|
||||
// Set the mode.
|
||||
//
|
||||
HWREG(base + SSI_O_CR1) = ((mode == SSI_MODE_MASTER) ? 0U : SSI_CR1_MS);
|
||||
|
||||
//
|
||||
// Set the clock predivider.
|
||||
//
|
||||
maxBitRate = ssiClk / bitRate;
|
||||
preDiv = 0U;
|
||||
do
|
||||
{
|
||||
preDiv += 2U;
|
||||
scr = (maxBitRate / preDiv) - 1U;
|
||||
}
|
||||
while(scr > 255U);
|
||||
HWREG(base + SSI_O_CPSR) = preDiv;
|
||||
|
||||
//
|
||||
// Set protocol and clock rate.
|
||||
//
|
||||
sph_spo = (protocol & 3U) << 6U;
|
||||
HWREG(base + SSI_O_CR0) = (scr << 8U) | sph_spo |
|
||||
(protocol & SSI_CR0_FRF_M) |
|
||||
(dataWidth - 1U);
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
//*****************************************************************************
|
||||
//
|
||||
// SSI_writeData
|
||||
//
|
||||
//*****************************************************************************
|
||||
void SSI_writeData(uint32_t base, uint32_t data)
|
||||
{
|
||||
//
|
||||
// Check the arguments.
|
||||
//
|
||||
ASSERT(SSI_isBaseValid(base));
|
||||
ASSERT((data & (0xFFFFFFFEU << (HWREG(base + SSI_O_CR0) &
|
||||
SSI_CR0_DSS_M))) == 0U);
|
||||
|
||||
//
|
||||
// Wait until there is space.
|
||||
//
|
||||
while((HWREG(base + SSI_O_SR) & SSI_SR_TNF) == 0U)
|
||||
{
|
||||
}
|
||||
|
||||
//
|
||||
// Write the data to the SSI.
|
||||
//
|
||||
HWREG(base + SSI_O_DR) = data;
|
||||
}
|
||||
|
||||
//*****************************************************************************
|
||||
//
|
||||
// SSI_writeDataNonBlocking
|
||||
//
|
||||
//*****************************************************************************
|
||||
int32_t SSI_writeDataNonBlocking(uint32_t base, uint32_t data)
|
||||
{
|
||||
int32_t retVal;
|
||||
|
||||
//
|
||||
// Check the arguments.
|
||||
//
|
||||
ASSERT(SSI_isBaseValid(base));
|
||||
ASSERT((data & (0xFFFFFFFEU << (HWREG(base + SSI_O_CR0) &
|
||||
SSI_CR0_DSS_M))) == 0U);
|
||||
|
||||
//
|
||||
// Check for space to write.
|
||||
//
|
||||
if((HWREG(base + SSI_O_SR) & SSI_SR_TNF) != 0U)
|
||||
{
|
||||
HWREG(base + SSI_O_DR) = data;
|
||||
retVal = 1;
|
||||
}
|
||||
else
|
||||
{
|
||||
retVal = 0;
|
||||
}
|
||||
return(retVal);
|
||||
}
|
||||
|
||||
//*****************************************************************************
|
||||
//
|
||||
// SSI_readData
|
||||
//
|
||||
//*****************************************************************************
|
||||
void SSI_readData(uint32_t base, uint32_t *dataPtr)
|
||||
{
|
||||
//
|
||||
// Check the arguments.
|
||||
//
|
||||
ASSERT(SSI_isBaseValid(base));
|
||||
|
||||
//
|
||||
// Wait until there is data to be read.
|
||||
//
|
||||
while((HWREG(base + SSI_O_SR) & SSI_SR_RNE) == 0U)
|
||||
{
|
||||
}
|
||||
|
||||
//
|
||||
// Read data from SSI.
|
||||
//
|
||||
*dataPtr = HWREG(base + SSI_O_DR);
|
||||
}
|
||||
|
||||
//*****************************************************************************
|
||||
//
|
||||
// SSI_readDataNonBlocking
|
||||
//
|
||||
//*****************************************************************************
|
||||
int32_t SSI_readDataNonBlocking(uint32_t base, uint32_t *dataPtr)
|
||||
{
|
||||
int32_t retVal;
|
||||
|
||||
//
|
||||
// Check the arguments.
|
||||
//
|
||||
ASSERT(SSI_isBaseValid(base));
|
||||
|
||||
//
|
||||
// Check for data to read.
|
||||
//
|
||||
if((HWREG(base + SSI_O_SR) & SSI_SR_RNE) != 0U)
|
||||
{
|
||||
*dataPtr = HWREG(base + SSI_O_DR);
|
||||
retVal = 1;
|
||||
}
|
||||
else
|
||||
{
|
||||
retVal = 0;
|
||||
}
|
||||
return(retVal);
|
||||
}
|
||||
+713
@@ -0,0 +1,713 @@
|
||||
//###########################################################################
|
||||
//
|
||||
// FILE: ssi.h
|
||||
//
|
||||
// TITLE: Driver for the SSI module.
|
||||
//
|
||||
//###########################################################################
|
||||
// $TI Release: $
|
||||
// $Release Date: $
|
||||
//
|
||||
// C2000Ware v5.04.00.00
|
||||
//
|
||||
// Copyright (C) 2024 Texas Instruments Incorporated - http://www.ti.com
|
||||
//
|
||||
// Redistribution and use in source and binary forms, with or without
|
||||
// modification, are permitted provided that the following conditions
|
||||
// are met:
|
||||
//
|
||||
// Redistributions of source code must retain the above copyright
|
||||
// notice, this list of conditions and the following disclaimer.
|
||||
//
|
||||
// Redistributions in binary form must reproduce the above copyright
|
||||
// notice, this list of conditions and the following disclaimer in the
|
||||
// documentation and/or other materials provided with the
|
||||
// distribution.
|
||||
//
|
||||
// Neither the name of Texas Instruments Incorporated nor the names of
|
||||
// its contributors may be used to endorse or promote products derived
|
||||
// from this software without specific prior written permission.
|
||||
//
|
||||
// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
|
||||
// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
|
||||
// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
|
||||
// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
|
||||
// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
|
||||
// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
|
||||
// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
|
||||
// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
|
||||
// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
||||
// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
|
||||
// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
// $
|
||||
//###########################################################################
|
||||
|
||||
#ifndef SSI_H
|
||||
#define SSI_H
|
||||
|
||||
//*****************************************************************************
|
||||
//
|
||||
// If building with a C++ compiler, make all of the definitions in this header
|
||||
// have a C binding.
|
||||
//
|
||||
//*****************************************************************************
|
||||
#ifdef __cplusplus
|
||||
extern "C"
|
||||
{
|
||||
#endif
|
||||
|
||||
//*****************************************************************************
|
||||
//
|
||||
//! \addtogroup ssi_api SSI
|
||||
//! @{
|
||||
//
|
||||
//*****************************************************************************
|
||||
|
||||
#include <stdbool.h>
|
||||
#include <stdint.h>
|
||||
#include "debug.h"
|
||||
#include "inc_cm/hw_ints.h"
|
||||
#include "inc_cm/hw_memmap.h"
|
||||
#include "inc_cm/hw_types.h"
|
||||
#include "inc_cm/hw_ssi.h"
|
||||
#include "interrupt.h"
|
||||
|
||||
//*****************************************************************************
|
||||
//
|
||||
// Defines for the API.
|
||||
//
|
||||
//*****************************************************************************
|
||||
//*****************************************************************************
|
||||
//
|
||||
// Values that can be passed to SSI_enableInterrupt, SSI_disableInterrupt,
|
||||
// and SSI_clearInterruptStatus as the interrupts parameter,
|
||||
// and returned by SSI_getInterruptStatus.
|
||||
//
|
||||
//*****************************************************************************
|
||||
#define SSI_TXEOT 0x00000040U // Transmit FIFO is empty
|
||||
#define SSI_DMATX 0x00000020U // DMA Transmit complete
|
||||
#define SSI_DMARX 0x00000010U // DMA Receive complete
|
||||
#define SSI_TXFF 0x00000008U // TX FIFO half full or less
|
||||
#define SSI_RXFF 0x00000004U // RX FIFO half full or more
|
||||
#define SSI_RXTO 0x00000002U // RX timeout
|
||||
#define SSI_RXOR 0x00000001U // RX overrun
|
||||
|
||||
//*****************************************************************************
|
||||
//
|
||||
// Values that can be passed to SSI_setConfig.
|
||||
//
|
||||
//*****************************************************************************
|
||||
#define SSI_FRF_MOTO_MODE_0 0x00000000U // Moto/Freescale fmt, pol 0, ph 0
|
||||
#define SSI_FRF_MOTO_MODE_1 0x00000002U // Moto/Freescale fmt, pol 0, ph 1
|
||||
#define SSI_FRF_MOTO_MODE_2 0x00000001U // Moto/Freescale fmt, pol 1, ph 0
|
||||
#define SSI_FRF_MOTO_MODE_3 0x00000003U // Moto/Freescale fmt, pol 1, ph 1
|
||||
#define SSI_FRF_TI 0x00000010U // TI frame format
|
||||
|
||||
#define SSI_MODE_MASTER 0x00000000U // SSI master
|
||||
#define SSI_MODE_SLAVE 0x00000001U // SSI slave
|
||||
|
||||
//*****************************************************************************
|
||||
//
|
||||
// Values that can be passed to SSI_enableDMA() and SSI_disableDMA().
|
||||
//
|
||||
//*****************************************************************************
|
||||
#define SSI_DMA_TX 0x00000002U // Enable DMA for transmit
|
||||
#define SSI_DMA_RX 0x00000001U // Enable DMA for receive
|
||||
|
||||
|
||||
//*****************************************************************************
|
||||
//
|
||||
// API Function prototypes
|
||||
//
|
||||
//*****************************************************************************
|
||||
//*****************************************************************************
|
||||
//
|
||||
//! \internal
|
||||
//! Checks an SSI base address.
|
||||
//!
|
||||
//! \param base specifies the SSI module base address.
|
||||
//!
|
||||
//! This function determines if a SSI module base address is valid.
|
||||
//!
|
||||
//! \return Returns \b true if the base address is valid and \b false
|
||||
//! otherwise.
|
||||
//
|
||||
//*****************************************************************************
|
||||
#ifdef DEBUG
|
||||
static bool
|
||||
SSI_isBaseValid(uint32_t base)
|
||||
{
|
||||
return(base == SSI0_BASE);
|
||||
}
|
||||
#endif
|
||||
|
||||
|
||||
//*****************************************************************************
|
||||
//
|
||||
//! Enables the synchronous serial interface.
|
||||
//!
|
||||
//! \param base specifies the SSI module base address.
|
||||
//!
|
||||
//! This function enables operation of the synchronous serial interface. The
|
||||
//! synchronous serial interface must be configured before it is enabled.
|
||||
//!
|
||||
//! \note The function SSI_setConfig() must be called before calling
|
||||
//! SSI_enableModule() function
|
||||
//!
|
||||
//! \return None.
|
||||
//
|
||||
//*****************************************************************************
|
||||
|
||||
static inline void
|
||||
SSI_enableModule(uint32_t base)
|
||||
{
|
||||
//
|
||||
// Check the arguments.
|
||||
//
|
||||
ASSERT(SSI_isBaseValid(base));
|
||||
|
||||
//
|
||||
// Read-modify-write the enable bit.
|
||||
//
|
||||
HWREG(base + SSI_O_CR1) |= SSI_CR1_SSE;
|
||||
}
|
||||
|
||||
|
||||
//*****************************************************************************
|
||||
//
|
||||
//! Disables the synchronous serial interface.
|
||||
//!
|
||||
//! \param base specifies the SSI module base address.
|
||||
//!
|
||||
//! This function disables operation of the synchronous serial interface.
|
||||
//!
|
||||
//! \return None.
|
||||
//
|
||||
//*****************************************************************************
|
||||
static inline void
|
||||
SSI_disableModule(uint32_t base)
|
||||
{
|
||||
//
|
||||
// Check the arguments.
|
||||
//
|
||||
ASSERT(SSI_isBaseValid(base));
|
||||
|
||||
//
|
||||
// Read-modify-write the enable bit.
|
||||
//
|
||||
HWREG(base + SSI_O_CR1) &= ~(SSI_CR1_SSE);
|
||||
}
|
||||
|
||||
//*****************************************************************************
|
||||
//
|
||||
//! Registers an interrupt handler for the synchronous serial interface.
|
||||
//!
|
||||
//! \intNum specifies the SSI interrupt number
|
||||
//! \param pfnHandler is a pointer to the function to be called when the
|
||||
//! SSI interrupt occurs.
|
||||
//!
|
||||
//! This function registers the handler to be called when an SSI interrupt
|
||||
//! occurs. This function enables the global interrupt in the interrupt
|
||||
//! controller; specific SSI interrupts must be enabled via
|
||||
//! SSI_enableInterrupt(). If necessary, it is the interrupt handler's
|
||||
//! responsibility to clear the interrupt source via SSI_clearInterruptStatus().
|
||||
//!
|
||||
//! \sa Interrupt_registerHandler() for important information about registering
|
||||
//! interrupt handlers.
|
||||
//!
|
||||
//! \return None.
|
||||
//
|
||||
//*****************************************************************************
|
||||
static inline void
|
||||
SSI_registerInterrupt(uint32_t intNum, void (*pfnHandler)(void))
|
||||
{
|
||||
//
|
||||
// Register the interrupt handler, returning an error if an error occurs.
|
||||
//
|
||||
Interrupt_registerHandler(intNum, pfnHandler);
|
||||
|
||||
//
|
||||
// Enable the synchronous serial interface interrupt.
|
||||
//
|
||||
Interrupt_enable(intNum);
|
||||
}
|
||||
|
||||
//*****************************************************************************
|
||||
//
|
||||
//! Unregisters an interrupt handler for the synchronous serial interface.
|
||||
//!
|
||||
//! \param intNum specifies the SSI interrupt number
|
||||
//!
|
||||
//! This function clears the handler to be called when an SSI interrupt
|
||||
//! occurs. This function also masks off the interrupt in the interrupt
|
||||
//! controller so that the interrupt handler no longer is called.
|
||||
//!
|
||||
//! \sa Interrupt_registerHandler() for important information about registering
|
||||
//! interrupt handlers.
|
||||
//!
|
||||
//! \return None.
|
||||
//
|
||||
//*****************************************************************************
|
||||
static inline void
|
||||
SSI_unregisterInterrupt(uint32_t intNum)
|
||||
{
|
||||
//
|
||||
// Disable the interrupt.
|
||||
//
|
||||
Interrupt_disable(intNum);
|
||||
|
||||
//
|
||||
// Unregister the interrupt handler.
|
||||
//
|
||||
Interrupt_unregisterHandler(intNum);
|
||||
}
|
||||
|
||||
//*****************************************************************************
|
||||
//
|
||||
//! Enables individual SSI interrupt sources.
|
||||
//!
|
||||
//! \param base specifies the SSI module base address.
|
||||
//! \param interrupts is a bit mask of the interrupt sources to be enabled.
|
||||
//!
|
||||
//! This function enables the indicated SSI interrupt sources.
|
||||
//! Only the sources that are enabled can be reflected to the processor
|
||||
//! interrupt; disabled sources have no effect on the processor.
|
||||
//! The \e interrupts parameter can be any of the \\b SSI_TXEOT, \b SSI_DMATX,
|
||||
//! \b SSI_DMARX, \b SSI_TXFF, \b SSI_RXFF, \b SSI_RXTO, or \b SSI_RXOR values.
|
||||
//!
|
||||
//! \return None.
|
||||
//
|
||||
//*****************************************************************************
|
||||
static inline void
|
||||
SSI_enableInterrupt(uint32_t base, uint32_t interrupts)
|
||||
{
|
||||
//
|
||||
// Check the arguments.
|
||||
//
|
||||
ASSERT(SSI_isBaseValid(base));
|
||||
|
||||
//
|
||||
// Enable the specified interrupts.
|
||||
//
|
||||
HWREG(base + SSI_O_IM) |= interrupts;
|
||||
}
|
||||
|
||||
|
||||
//*****************************************************************************
|
||||
//
|
||||
//! Disables individual SSI interrupt sources.
|
||||
//!
|
||||
//! \param base specifies the SSI module base address.
|
||||
//! \param interrupts is a bit mask of the interrupt sources to be disabled.
|
||||
//!
|
||||
//! This function disables the indicated SSI interrupt sources. The
|
||||
//! \e interrupts parameter can be any of the \b SSI_TXEOT, \b SSI_DMATX,
|
||||
//! \b SSI_DMARX, \b SSI_TXFF, \b SSI_RXFF, \b SSI_RXTO, or \b SSI_RXOR values.
|
||||
//!
|
||||
//! \return None.
|
||||
//
|
||||
//*****************************************************************************
|
||||
static inline void
|
||||
SSI_disableInterrupt(uint32_t base, uint32_t interrupts)
|
||||
{
|
||||
//
|
||||
// Check the arguments.
|
||||
//
|
||||
ASSERT(SSI_isBaseValid(base));
|
||||
|
||||
//
|
||||
// Disable the specified interrupts.
|
||||
//
|
||||
HWREG(base + SSI_O_IM) &= ~(interrupts);
|
||||
}
|
||||
|
||||
//*****************************************************************************
|
||||
//
|
||||
//! Gets the current interrupt status.
|
||||
//!
|
||||
//! \param base specifies the SSI module base address.
|
||||
//! \param Masked is \b false if the raw interrupt status is required or
|
||||
//! \b true if the masked interrupt status is required.
|
||||
//!
|
||||
//! This function returns the interrupt status for the SSI module. Either the
|
||||
//! raw interrupt status or the status of interrupts that are allowed to
|
||||
//! reflect to the processor can be returned.
|
||||
//!
|
||||
//! \return The current interrupt status, enumerated as a bit field of
|
||||
//! \b SSI_TXEOT, \b SSI_DMATX, b SSI_DMARX, \b SSI_TXFF, \b SSI_RXFF,
|
||||
//! \\b SSI_RXTO, or \b SSI_RXOR
|
||||
//
|
||||
//*****************************************************************************
|
||||
static inline uint32_t
|
||||
SSI_getInterruptStatus(uint32_t base, bool masked)
|
||||
{
|
||||
//
|
||||
// Check the arguments.
|
||||
//
|
||||
ASSERT(SSI_isBaseValid(base));
|
||||
|
||||
//
|
||||
// Return either the interrupt status or the raw interrupt status as
|
||||
// requested.
|
||||
//
|
||||
|
||||
return(masked ? HWREG(base + SSI_O_MIS) : HWREG(base + SSI_O_RIS));
|
||||
|
||||
}
|
||||
//*****************************************************************************
|
||||
//
|
||||
//! Clears SSI interrupt sources.
|
||||
//!
|
||||
//! \param base specifies the SSI module base address.
|
||||
//! \param interrupts is a bit mask of the interrupt sources to be cleared.
|
||||
//!
|
||||
//! This function clears the specified SSI interrupt sources so that they no
|
||||
//! longer assert. This function must be called in the interrupt handler to
|
||||
//! keep the interrupts from being triggered again immediately upon exit. The
|
||||
//! \e interrupts parameter can consist of either or both the \b SSI_RXTO and
|
||||
//! \b SSI_RXOR values.
|
||||
//!
|
||||
//! \note Because there is a write buffer in the Cortex-M processor, it may
|
||||
//! take several clock cycles before the interrupt source is actually cleared.
|
||||
//! Therefore, it is recommended that the interrupt source be cleared early in
|
||||
//! the interrupt handler (as opposed to the very last action) to avoid
|
||||
//! returning from the interrupt handler before the interrupt source is
|
||||
//! actually cleared. Failure to do so may result in the interrupt handler
|
||||
//! being immediately reentered (because the interrupt controller still sees
|
||||
//! the interrupt source asserted).
|
||||
//!
|
||||
//! \return None.
|
||||
//
|
||||
//*****************************************************************************
|
||||
static inline void
|
||||
SSI_clearInterruptStatus(uint32_t base, uint32_t interrupts)
|
||||
{
|
||||
//
|
||||
// Check the arguments.
|
||||
//
|
||||
ASSERT(SSI_isBaseValid(base));
|
||||
|
||||
//
|
||||
// Clear the requested interrupt sources.
|
||||
//
|
||||
HWREG(base + SSI_O_ICR) = interrupts;
|
||||
}
|
||||
|
||||
//*****************************************************************************
|
||||
//
|
||||
//! Enables SSI DMA operation.
|
||||
//!
|
||||
//! \param base is the base address of the SSI module.
|
||||
//! \param dmaFlags is a bit mask of the DMA features to enable.
|
||||
//!
|
||||
//! This function enables the specified SSI DMA features. The SSI can be
|
||||
//! configured to use DMA for transmit and/or receive data transfers.
|
||||
//! The \e dmaFlags parameter is the logical OR of any of the following
|
||||
//! values:
|
||||
//!
|
||||
//! - SSI_DMA_RX - enable DMA for receive
|
||||
//! - SSI_DMA_TX - enable DMA for transmit
|
||||
//!
|
||||
//! \note The uDMA controller must also be set up before DMA can be used
|
||||
//! with the SSI.
|
||||
//!
|
||||
//! \return None.
|
||||
//
|
||||
//*****************************************************************************
|
||||
static inline void
|
||||
SSI_enableDMA(uint32_t base, uint32_t dmaFlags)
|
||||
{
|
||||
//
|
||||
// Check the arguments.
|
||||
//
|
||||
ASSERT(SSI_isBaseValid(base));
|
||||
|
||||
//
|
||||
// Set the requested bits in the SSI DMA control register.
|
||||
//
|
||||
HWREG(base + SSI_O_DMACTL) |= dmaFlags;
|
||||
}
|
||||
|
||||
//*****************************************************************************
|
||||
//
|
||||
//! Disables SSI DMA operation.
|
||||
//!
|
||||
//! \param base is the base address of the SSI module.
|
||||
//! \param dmaFlags is a bit mask of the DMA features to disable.
|
||||
//!
|
||||
//! This function is used to disable SSI DMA features that were enabled
|
||||
//! by SSI_enableDMA(). The specified SSI DMA features are disabled. The
|
||||
//! \e dmaFlags parameter is the logical OR of any of the following values:
|
||||
//!
|
||||
//! - SSI_DMA_RX - disable DMA for receive
|
||||
//! - SSI_DMA_TX - disable DMA for transmit
|
||||
//!
|
||||
//! \return None.
|
||||
//
|
||||
//*****************************************************************************
|
||||
static inline void
|
||||
SSI_disableDMA(uint32_t base, uint32_t dmaFlags)
|
||||
{
|
||||
//
|
||||
// Check the arguments.
|
||||
//
|
||||
ASSERT(SSI_isBaseValid(base));
|
||||
|
||||
//
|
||||
// Clear the requested bits in the SSI DMA control register.
|
||||
//
|
||||
HWREG(base + SSI_O_DMACTL) &= ~dmaFlags;
|
||||
}
|
||||
|
||||
//*****************************************************************************
|
||||
//
|
||||
//! Determines whether the SSI transmitter is busy or not.
|
||||
//!
|
||||
//! \param base is the base address of the SSI module.
|
||||
//!
|
||||
//! This function allows the caller to determine whether all transmitted bytes
|
||||
//! have cleared the transmitter hardware. If \b false is returned, then the
|
||||
//! transmit FIFO is empty and all bits of the last transmitted word have left
|
||||
//! the hardware shift register.
|
||||
//!
|
||||
//! \return Returns \b true if the SSI is transmitting or \b false if all
|
||||
//! transmissions are complete.
|
||||
//
|
||||
//*****************************************************************************
|
||||
static inline bool
|
||||
SSI_isBusy(uint32_t base)
|
||||
{
|
||||
//
|
||||
// Check the arguments.
|
||||
//
|
||||
ASSERT(SSI_isBaseValid(base));
|
||||
|
||||
//
|
||||
// Determine if the SSI is busy.
|
||||
//
|
||||
return(((HWREG(base + SSI_O_SR) & SSI_SR_BSY) == SSI_SR_BSY));
|
||||
}
|
||||
|
||||
//*****************************************************************************
|
||||
//
|
||||
//! Enables internal loopback mode for SSI.
|
||||
//!
|
||||
//! \param base is the base address of the SSI module.
|
||||
//!
|
||||
//! This function configures SSI port in internal loopback mode to help with
|
||||
//! diagnostics and debug. In this mode, Output of the transmit serial
|
||||
//! shift register is connected internally to the input of the receive
|
||||
//! serial shift register.
|
||||
//!
|
||||
//! \return None.
|
||||
//
|
||||
//*****************************************************************************
|
||||
static inline void
|
||||
SSI_enableLoopback(uint32_t base)
|
||||
{
|
||||
//
|
||||
// Check the arguments.
|
||||
//
|
||||
ASSERT(SSI_isBaseValid(base));
|
||||
|
||||
//
|
||||
// Enable loopback
|
||||
//
|
||||
HWREG(base + SSI_O_CR1) |= SSI_CR1_LBM;
|
||||
}
|
||||
|
||||
//*****************************************************************************
|
||||
//
|
||||
//! Disables internal loopback mode for SSI.
|
||||
//!
|
||||
//! \param base is the base address of the SSI module.
|
||||
//!
|
||||
//! This function is used to disable SSI internal loopback that was enabled by
|
||||
//! SSI_enableLoopback().
|
||||
//!
|
||||
//! \return None.
|
||||
//
|
||||
//*****************************************************************************
|
||||
static inline void
|
||||
SSI_disableLoopback(uint32_t base)
|
||||
{
|
||||
//
|
||||
// Check the arguments.
|
||||
//
|
||||
ASSERT(SSI_isBaseValid(base));
|
||||
|
||||
//
|
||||
// Enable loopback
|
||||
//
|
||||
HWREG(base + SSI_O_CR1) &= ~SSI_CR1_LBM;
|
||||
}
|
||||
|
||||
|
||||
//*****************************************************************************
|
||||
//
|
||||
//! Configures the synchronous serial interface.
|
||||
//!
|
||||
//! \param base specifies the SSI module base address.
|
||||
//! \param ssiClk is the rate of the clock supplied to the SSI module.
|
||||
//! \param protocol specifies the data transfer protocol.
|
||||
//! \param mode specifies the mode of operation.
|
||||
//! \param bitRate specifies the clock rate.
|
||||
//! \param dataWidth specifies number of bits transferred per frame.
|
||||
//!
|
||||
//! This function configures the synchronous serial interface. It sets
|
||||
//! the SSI protocol, mode of operation, bit rate, and data width.
|
||||
//!
|
||||
//! The \e protocol parameter defines the data frame format. The
|
||||
//! \e protocol parameter can be one of the following values:
|
||||
//! \b SSI_FRF_MOTO_MODE_0, \b SSI_FRF_MOTO_MODE_1, \b SSI_FRF_MOTO_MODE_2,
|
||||
//! \b SSI_FRF_MOTO_MODE_3 or \b SSI_FRF_TI.
|
||||
//! The Motorola/Freescale frame formats encode the following polarity and phase
|
||||
//! configurations:
|
||||
//!
|
||||
//! <pre>
|
||||
//! Polarity Phase mode
|
||||
//! 0 0 SSI_FRF_MOTO_MODE_0
|
||||
//! 0 1 SSI_FRF_MOTO_MODE_1
|
||||
//! 1 0 SSI_FRF_MOTO_MODE_2
|
||||
//! 1 1 SSI_FRF_MOTO_MODE_3
|
||||
//! </pre>
|
||||
//!
|
||||
//! The \e mode parameter defines the operating mode of the SSI module.
|
||||
//! The SSI module can operate as a master or slave. The \e mode parameter
|
||||
//! can be one of the following values: \b SSI_MODE_MASTER or \b SSI_MODE_SLAVE.
|
||||
//!
|
||||
//! The \e bitRate parameter defines the bit rate for the SSI. This bit
|
||||
//! rate must satisfy the following clock ratio criteria:
|
||||
//!
|
||||
//! - ssiClk >= 2 * bit rate (master mode)
|
||||
//! - ssiClk >= 12 * bit rate (slave modes)
|
||||
//!
|
||||
//! where ssiClk is the frequency of the clock supplied to the SSI module. Note
|
||||
//! that there are frequency limits for FSSI that are described in the Bit Rate
|
||||
//! Generation section of the SSI chapter in the data sheet.
|
||||
//!
|
||||
//! The \e dataWidth parameter defines the width of the data transfers and
|
||||
//! can be a value between 4 and 16, inclusive.
|
||||
//!
|
||||
//! The peripheral clock is the same as the processor clock. The macro
|
||||
//! CM_CLK_FREQ from sysctl.h can be used as the parameter
|
||||
//!
|
||||
//! \return None.
|
||||
//
|
||||
//*****************************************************************************
|
||||
extern void
|
||||
SSI_setConfig(uint32_t base, uint32_t ssiClk, uint32_t protocol,
|
||||
uint32_t mode, uint32_t bitRate, uint32_t dataWidth);
|
||||
|
||||
//*****************************************************************************
|
||||
//
|
||||
//! Puts a data element into the SSI transmit FIFO.
|
||||
//!
|
||||
//! \param base specifies the SSI module base address.
|
||||
//! \param data is the data to be transmitted over the SSI interface.
|
||||
//!
|
||||
//! This function places the supplied data into the transmit FIFO of the
|
||||
//! specified SSI module. If there is no space available in the transmit FIFO,
|
||||
//! this function waits until there is space available before returning.
|
||||
//!
|
||||
//! \note The upper 32 - N bits of \e data are discarded by the hardware,
|
||||
//! where N is the data width as configured by SSI_setConfig(). For
|
||||
//! example, if the interface is configured for 8-bit data width, the upper 24
|
||||
//! bits of \e data are discarded.
|
||||
//!
|
||||
//! \return None.
|
||||
//
|
||||
//*****************************************************************************
|
||||
extern void
|
||||
SSI_writeData(uint32_t base, uint32_t data);
|
||||
|
||||
//*****************************************************************************
|
||||
//
|
||||
//! Puts a data element into the SSI transmit FIFO.
|
||||
//!
|
||||
//! \param base specifies the SSI module base address.
|
||||
//! \param data is the data to be transmitted over the SSI interface.
|
||||
//!
|
||||
//! This function places the supplied data into the transmit FIFO of the
|
||||
//! specified SSI module. If there is no space in the FIFO, then this function
|
||||
//! returns a zero.
|
||||
//!
|
||||
//! \note The upper 32 - N bits of \e data are discarded by the hardware,
|
||||
//! where N is the data width as configured by SSI_setConfig(). For
|
||||
//! example, if the interface is configured for 8-bit data width, the upper 24
|
||||
//! bits of \e data are discarded.
|
||||
//!
|
||||
//! \return Returns the number of elements written to the SSI transmit FIFO.
|
||||
//
|
||||
//*****************************************************************************
|
||||
extern int32_t
|
||||
SSI_writeDataNonBlocking(uint32_t base, uint32_t data);
|
||||
|
||||
//*****************************************************************************
|
||||
//
|
||||
//! Gets a data element from the SSI receive FIFO.
|
||||
//!
|
||||
//! \param base specifies the SSI module base address.
|
||||
//! \param dataPtr is a pointer to a storage location for data that was
|
||||
//! received over the SSI interface.
|
||||
//!
|
||||
//! This function gets received data from the receive FIFO of the specified
|
||||
//! SSI module and places that data into the location specified by the
|
||||
//! \e dataPtr parameter. If there is no data available, this function waits
|
||||
//! until data is received before returning.
|
||||
//!
|
||||
//! \note Only the lower N bits of the value written to \e dataPtr contain
|
||||
//! valid data, where N is the data width as configured by
|
||||
//! SSI_setConfig(). For example, if the interface is configured for
|
||||
//! 8-bit data width, only the lower 8 bits of the value written to
|
||||
//! \e dataPtr contain valid data.
|
||||
//!
|
||||
//! \return None.
|
||||
//
|
||||
//*****************************************************************************
|
||||
extern void
|
||||
SSI_readData(uint32_t base, uint32_t *dataPtr);
|
||||
|
||||
//*****************************************************************************
|
||||
//
|
||||
//! Gets a data element from the SSI receive FIFO.
|
||||
//!
|
||||
//! \param base specifies the SSI module base address.
|
||||
//! \param dataPtr is a pointer to a storage location for data that was
|
||||
//! received over the SSI interface.
|
||||
//!
|
||||
//! This function gets received data from the receive FIFO of the specified SSI
|
||||
//! module and places that data into the location specified by the \e data
|
||||
//! parameter. If there is no data in the FIFO, then this function returns a
|
||||
//! zero.
|
||||
//!
|
||||
//! \note Only the lower N bits of the value written to \e dataPtr contain
|
||||
//! valid data, where N is the data width as configured by
|
||||
//! SSI_setConfig(). For example, if the interface is configured for
|
||||
//! 8-bit data width, only the lower 8 bits of the value written to
|
||||
//! \e dataPtr contain valid data.
|
||||
//!
|
||||
//! \return Returns the number of elements read from the SSI receive FIFO.
|
||||
//
|
||||
//*****************************************************************************
|
||||
extern int32_t
|
||||
SSI_readDataNonBlocking(uint32_t base, uint32_t *dataPtr);
|
||||
|
||||
|
||||
//*****************************************************************************
|
||||
//
|
||||
// Close the Doxygen group.
|
||||
//! @}
|
||||
//
|
||||
//*****************************************************************************
|
||||
|
||||
//*****************************************************************************
|
||||
//
|
||||
// Mark the end of the C bindings section for C++ compilers.
|
||||
//
|
||||
//*****************************************************************************
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif // SSI_H
|
||||
+264
@@ -0,0 +1,264 @@
|
||||
//###########################################################################
|
||||
//
|
||||
// FILE: sysctl.c
|
||||
//
|
||||
// TITLE: CM system control driver.
|
||||
//
|
||||
//###########################################################################
|
||||
// $TI Release: $
|
||||
// $Release Date: $
|
||||
//
|
||||
// C2000Ware v5.04.00.00
|
||||
//
|
||||
// Copyright (C) 2024 Texas Instruments Incorporated - http://www.ti.com
|
||||
//
|
||||
// Redistribution and use in source and binary forms, with or without
|
||||
// modification, are permitted provided that the following conditions
|
||||
// are met:
|
||||
//
|
||||
// Redistributions of source code must retain the above copyright
|
||||
// notice, this list of conditions and the following disclaimer.
|
||||
//
|
||||
// Redistributions in binary form must reproduce the above copyright
|
||||
// notice, this list of conditions and the following disclaimer in the
|
||||
// documentation and/or other materials provided with the
|
||||
// distribution.
|
||||
//
|
||||
// Neither the name of Texas Instruments Incorporated nor the names of
|
||||
// its contributors may be used to endorse or promote products derived
|
||||
// from this software without specific prior written permission.
|
||||
//
|
||||
// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
|
||||
// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
|
||||
// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
|
||||
// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
|
||||
// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
|
||||
// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
|
||||
// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
|
||||
// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
|
||||
// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
||||
// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
|
||||
// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
// $
|
||||
//###########################################################################
|
||||
|
||||
#include "sysctl.h"
|
||||
|
||||
//*****************************************************************************
|
||||
//
|
||||
// SysCtl_delay()
|
||||
//
|
||||
//*****************************************************************************
|
||||
|
||||
//SYSCTL_DELAY define for delay of fixed cycles.
|
||||
SYSCTL_DELAY
|
||||
|
||||
//*****************************************************************************
|
||||
//
|
||||
// Prototypes for the APIs.
|
||||
//
|
||||
//*****************************************************************************
|
||||
//*****************************************************************************
|
||||
//
|
||||
// SysCtl_resetPeripheral()
|
||||
//
|
||||
//*****************************************************************************
|
||||
|
||||
void
|
||||
SysCtl_resetPeripheral(SysCtl_PeripheralSOFTPRES peripheral)
|
||||
{
|
||||
uint16_t regIndex;
|
||||
uint16_t bitIndex;
|
||||
uint32_t clearvalue;
|
||||
|
||||
//
|
||||
// Decode the peripheral variable.
|
||||
//
|
||||
regIndex = (uint16_t)4U * ((uint16_t)peripheral &
|
||||
(uint16_t)SYSCTL_PERIPH_REG_M);
|
||||
bitIndex = ((uint16_t)peripheral & SYSCTL_PERIPH_BIT_M) >>
|
||||
SYSCTL_PERIPH_BIT_S;
|
||||
|
||||
|
||||
//Write will succeed only if a matching key value is written
|
||||
//to the KEY field
|
||||
//Sets the appropriate reset bit and then clears it.
|
||||
//
|
||||
HWREG(CMSYSCTL_BASE + SYSCTL_O_CMSOFTPRESET0 + regIndex) |=
|
||||
(((uint32_t)1U << bitIndex) |
|
||||
(((uint32_t)SYSCTL_CMSYSCTL_KEY << 16U ) &
|
||||
SYSCTL_CMSOFTPRESET0_KEY_M));
|
||||
|
||||
clearvalue = HWREG(CMSYSCTL_BASE + SYSCTL_O_CMSOFTPRESET0 + regIndex);
|
||||
clearvalue &= ~((uint32_t)1U << bitIndex);
|
||||
HWREG(CMSYSCTL_BASE + SYSCTL_O_CMSOFTPRESET0 + regIndex) =
|
||||
(((uint32_t)SYSCTL_CMSYSCTL_KEY << 16U) &
|
||||
SYSCTL_CMPCLKCR0_KEY_M) | clearvalue;
|
||||
|
||||
}
|
||||
|
||||
//*****************************************************************************
|
||||
//
|
||||
// SysCtl_enablePeripheral()
|
||||
//
|
||||
//*****************************************************************************
|
||||
|
||||
void
|
||||
SysCtl_enablePeripheral(SysCtl_PeripheralPCLOCKCR peripheral)
|
||||
{
|
||||
uint16_t regIndex;
|
||||
uint16_t bitIndex;
|
||||
|
||||
//
|
||||
// Decode the peripheral variable.
|
||||
//
|
||||
regIndex = (uint16_t)4U * ((uint16_t)peripheral &
|
||||
(uint16_t)SYSCTL_PERIPH_REG_M);
|
||||
bitIndex = ((uint16_t)peripheral & SYSCTL_PERIPH_BIT_M) >>
|
||||
SYSCTL_PERIPH_BIT_S;
|
||||
|
||||
|
||||
// Write will succeed only if a matching key value is written to
|
||||
// the KEY field
|
||||
// Turn on the module clock.
|
||||
//
|
||||
HWREG(CMSYSCTL_BASE + SYSCTL_O_CMPCLKCR0 + regIndex) |=
|
||||
(((uint32_t)1U << bitIndex) |
|
||||
(((uint32_t)SYSCTL_CMSYSCTL_KEY << 16U ) &
|
||||
SYSCTL_CMPCLKCR0_KEY_M));
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
//*****************************************************************************
|
||||
//
|
||||
// SysCtl_disablePeripheral()
|
||||
//
|
||||
//*****************************************************************************
|
||||
|
||||
void
|
||||
SysCtl_disablePeripheral(SysCtl_PeripheralPCLOCKCR peripheral)
|
||||
{
|
||||
uint16_t regIndex;
|
||||
uint16_t bitIndex;
|
||||
uint32_t clearvalue;
|
||||
|
||||
//
|
||||
// Decode the peripheral variable.
|
||||
//
|
||||
regIndex = (uint16_t)4U * ((uint16_t)peripheral &
|
||||
(uint16_t)SYSCTL_PERIPH_REG_M);
|
||||
bitIndex = ((uint16_t)peripheral & SYSCTL_PERIPH_BIT_M) >>
|
||||
SYSCTL_PERIPH_BIT_S;
|
||||
|
||||
|
||||
//Write will succeed only if a matching key value is written
|
||||
// to the KEY field
|
||||
// Turn off the module clock.
|
||||
//
|
||||
clearvalue = HWREG(CMSYSCTL_BASE + SYSCTL_O_CMPCLKCR0 + regIndex);
|
||||
clearvalue &= ~((uint32_t)1U << bitIndex);
|
||||
HWREG(CMSYSCTL_BASE + SYSCTL_O_CMPCLKCR0 + regIndex) =
|
||||
(((uint32_t)SYSCTL_CMSYSCTL_KEY << 16U) &
|
||||
SYSCTL_CMPCLKCR0_KEY_M) | clearvalue;
|
||||
|
||||
}
|
||||
|
||||
|
||||
//*****************************************************************************
|
||||
//
|
||||
// SysCtl_requestPeripheralClockStop()
|
||||
//
|
||||
//*****************************************************************************
|
||||
|
||||
void
|
||||
SysCtl_requestPeripheralClockStop(SysCtl_PeripheralCMCLKSTOPREQ peripheral,
|
||||
uint16_t enable)
|
||||
{
|
||||
uint16_t regIndex;
|
||||
uint16_t bitIndex;
|
||||
uint32_t clearvalue;
|
||||
|
||||
//
|
||||
// Decode the peripheral variable.
|
||||
//
|
||||
regIndex = (uint16_t)4U * ((uint16_t)peripheral &
|
||||
(uint16_t)SYSCTL_PERIPH_REG_M);
|
||||
bitIndex = ((uint16_t)peripheral & SYSCTL_PERIPH_BIT_M) >>
|
||||
SYSCTL_PERIPH_BIT_S;
|
||||
|
||||
|
||||
//Write will succeed only if a matching key value is written
|
||||
//to the KEY field
|
||||
// Request to stop the clock
|
||||
//
|
||||
|
||||
if(enable == 1U) //enable the peripheral clock Stop
|
||||
{
|
||||
HWREG(CMSYSCTL_BASE + SYSCTL_O_CMCLKSTOPREQ0 + regIndex) |=
|
||||
(((uint32_t)1U << bitIndex) |
|
||||
(((uint32_t)SYSCTL_CMSYSCTL_KEY << 16U) &
|
||||
SYSCTL_CMCLKSTOPREQ0_KEY_M));
|
||||
}
|
||||
else //disable the peripheral clock Stop
|
||||
{
|
||||
clearvalue = HWREG(CMSYSCTL_BASE + SYSCTL_O_CMCLKSTOPREQ0 + regIndex);
|
||||
clearvalue &= ~((uint32_t)1U << bitIndex);
|
||||
HWREG(CMSYSCTL_BASE + SYSCTL_O_CMCLKSTOPREQ0 + regIndex) =
|
||||
(((uint32_t)SYSCTL_CMSYSCTL_KEY << 16U) &
|
||||
SYSCTL_CMCLKSTOPREQ0_KEY_M) | clearvalue;
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
//*****************************************************************************
|
||||
//
|
||||
// SysCtl_isPeripheralClockStopAcked()
|
||||
//
|
||||
//*****************************************************************************
|
||||
|
||||
bool
|
||||
SysCtl_isPeripheralClockStopAcked(SysCtl_PeripheralCMCLKSTOPACK peripheral)
|
||||
{
|
||||
uint16_t regIndex;
|
||||
uint16_t bitIndex;
|
||||
|
||||
//
|
||||
// Decode the peripheral variable.
|
||||
//
|
||||
regIndex = (uint16_t)4U * ((uint16_t)peripheral &
|
||||
(uint16_t)SYSCTL_PERIPH_REG_M);
|
||||
bitIndex = ((uint16_t)peripheral & SYSCTL_PERIPH_BIT_M) >>
|
||||
SYSCTL_PERIPH_BIT_S;
|
||||
|
||||
//
|
||||
// Read the register and return true if the clk stop Req is acked or not.
|
||||
//
|
||||
return((HWREGH(CMSYSCTL_BASE + SYSCTL_O_CMCLKSTOPACK1 + regIndex) &
|
||||
((uint32_t)1U << bitIndex)) != 0U);
|
||||
}
|
||||
|
||||
//*****************************************************************************
|
||||
//
|
||||
// SysCtl_getPeripheralClockStop()
|
||||
//
|
||||
//*****************************************************************************
|
||||
|
||||
uint16_t
|
||||
SysCtl_getPeripheralClockStop(SysCtl_PeripheralCMCLKSTOPREQ peripheral)
|
||||
{
|
||||
uint16_t regIndex;
|
||||
|
||||
//
|
||||
// Decode the peripheral variable.
|
||||
//
|
||||
regIndex = (uint16_t)4U * ((uint16_t)peripheral &
|
||||
(uint16_t)SYSCTL_PERIPH_REG_M);
|
||||
|
||||
//
|
||||
// Read the register and return the value of clk stop Req
|
||||
//
|
||||
return(HWREGH(CMSYSCTL_BASE + SYSCTL_O_CMCLKSTOPREQ0 + regIndex));
|
||||
}
|
||||
|
||||
+1250
File diff suppressed because it is too large.
Load diff
+46
@@ -0,0 +1,46 @@
|
||||
//###########################################################################
|
||||
//
|
||||
// FILE: systick.c
|
||||
//
|
||||
// TITLE: Driver for the Systick module.
|
||||
//
|
||||
//###########################################################################
|
||||
// $TI Release: $
|
||||
// $Release Date: $
|
||||
//
|
||||
// C2000Ware v5.04.00.00
|
||||
//
|
||||
// Copyright (C) 2024 Texas Instruments Incorporated - http://www.ti.com
|
||||
//
|
||||
// Redistribution and use in source and binary forms, with or without
|
||||
// modification, are permitted provided that the following conditions
|
||||
// are met:
|
||||
//
|
||||
// Redistributions of source code must retain the above copyright
|
||||
// notice, this list of conditions and the following disclaimer.
|
||||
//
|
||||
// Redistributions in binary form must reproduce the above copyright
|
||||
// notice, this list of conditions and the following disclaimer in the
|
||||
// documentation and/or other materials provided with the
|
||||
// distribution.
|
||||
//
|
||||
// Neither the name of Texas Instruments Incorporated nor the names of
|
||||
// its contributors may be used to endorse or promote products derived
|
||||
// from this software without specific prior written permission.
|
||||
//
|
||||
// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
|
||||
// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
|
||||
// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
|
||||
// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
|
||||
// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
|
||||
// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
|
||||
// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
|
||||
// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
|
||||
// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
||||
// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
|
||||
// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
// $
|
||||
//###########################################################################
|
||||
|
||||
#include "systick.h"
|
||||
|
||||
+357
@@ -0,0 +1,357 @@
|
||||
//###########################################################################
|
||||
//
|
||||
// FILE: syctick.h
|
||||
//
|
||||
// TITLE: Driver for the Systick module.
|
||||
//
|
||||
//###########################################################################
|
||||
// $TI Release: $
|
||||
// $Release Date: $
|
||||
//
|
||||
// C2000Ware v5.04.00.00
|
||||
//
|
||||
// Copyright (C) 2024 Texas Instruments Incorporated - http://www.ti.com
|
||||
//
|
||||
// Redistribution and use in source and binary forms, with or without
|
||||
// modification, are permitted provided that the following conditions
|
||||
// are met:
|
||||
//
|
||||
// Redistributions of source code must retain the above copyright
|
||||
// notice, this list of conditions and the following disclaimer.
|
||||
//
|
||||
// Redistributions in binary form must reproduce the above copyright
|
||||
// notice, this list of conditions and the following disclaimer in the
|
||||
// documentation and/or other materials provided with the
|
||||
// distribution.
|
||||
//
|
||||
// Neither the name of Texas Instruments Incorporated nor the names of
|
||||
// its contributors may be used to endorse or promote products derived
|
||||
// from this software without specific prior written permission.
|
||||
//
|
||||
// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
|
||||
// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
|
||||
// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
|
||||
// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
|
||||
// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
|
||||
// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
|
||||
// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
|
||||
// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
|
||||
// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
||||
// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
|
||||
// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
// $
|
||||
//###########################################################################
|
||||
|
||||
#ifndef SYSTICK_H
|
||||
#define SYSTICK_H
|
||||
|
||||
//*****************************************************************************
|
||||
//
|
||||
// If building with a C++ compiler, make all of the definitions in this header
|
||||
// have a C binding.
|
||||
//
|
||||
//*****************************************************************************
|
||||
#ifdef __cplusplus
|
||||
extern "C"
|
||||
{
|
||||
#endif
|
||||
|
||||
//*****************************************************************************
|
||||
//
|
||||
//! \addtogroup systick_api
|
||||
//! @{
|
||||
//
|
||||
//*****************************************************************************
|
||||
#include <stdbool.h>
|
||||
#include <stdint.h>
|
||||
#include "debug.h"
|
||||
#include "interrupt.h"
|
||||
#include "inc_cm/hw_ints.h"
|
||||
#include "inc_cm/hw_memmap.h"
|
||||
#include "inc_cm/hw_nvic.h"
|
||||
#include "inc_cm/hw_types.h"
|
||||
|
||||
//*****************************************************************************
|
||||
//
|
||||
//! Values that can be passed to SYSTICK_setClockSource() as the
|
||||
//! \e clkSrc parameter.
|
||||
//
|
||||
//*****************************************************************************
|
||||
typedef enum
|
||||
{
|
||||
SYSTICK_CLOCK_SOURCE_EXTERNAL = 0x0U, //!< External clock is used
|
||||
SYSTICK_CLOCK_SOURCE_INTERNAL = 0x4U, //!< Internal clock is used
|
||||
} SYSTICK_ClockSource;
|
||||
|
||||
//*****************************************************************************
|
||||
//
|
||||
//! Sets the clokc source for SysTick counter.
|
||||
//!
|
||||
//! \param clkSrc specifies the clock source type.
|
||||
//!
|
||||
//! This function sets the clokc source for SysTick counter. The Systick clock
|
||||
//! can be set as either internal clock or external. The param clkSrc can
|
||||
//! take following values:SYSTICK_CLOCK_SOURCE_EXTERNAL and
|
||||
//! SYSTICK_CLOCK_SOURCE_INTERNAL.
|
||||
//!
|
||||
//! \return None.
|
||||
//
|
||||
//*****************************************************************************
|
||||
static inline void
|
||||
SYSTICK_setClockSource(SYSTICK_ClockSource clkSrc)
|
||||
{
|
||||
//
|
||||
// Sets SysTick clock source.
|
||||
//
|
||||
HWREG(NVIC_BASE + NVIC_O_SYST_CSR) = (HWREG(NVIC_BASE + NVIC_O_SYST_CSR) &
|
||||
~NVIC_SYST_CSR_CLKSOURCE) |
|
||||
(uint32_t)clkSrc;
|
||||
}
|
||||
|
||||
//*****************************************************************************
|
||||
//
|
||||
//! Enables the SysTick counter.
|
||||
//!
|
||||
//! \param None
|
||||
//!
|
||||
//! This function starts the SysTick counter. If an interrupt handler has been
|
||||
//! registered, it is called when the SysTick counter rolls over.
|
||||
//!
|
||||
//! \note Calling this function causes the SysTick counter to (re)commence
|
||||
//! counting from its current value. The counter is not automatically reloaded
|
||||
//! with the period as specified in a previous call to SysTick_setPeriod(). If
|
||||
//! an immediate reload is required, the \b NVIC_O_SYST_CVR register must be
|
||||
//! written to force the reload. Any write to this register clears the SysTick
|
||||
//! counter to 0 and causes a reload with the supplied period on the next
|
||||
//! clock.
|
||||
//!
|
||||
//! \return None.
|
||||
//
|
||||
//*****************************************************************************
|
||||
static inline void
|
||||
SYSTICK_enableCounter(void)
|
||||
{
|
||||
//
|
||||
// Enable SysTick Counter.
|
||||
//
|
||||
HWREG(NVIC_BASE + NVIC_O_SYST_CSR) |= NVIC_SYST_CSR_ENABLE;
|
||||
}
|
||||
|
||||
//*****************************************************************************
|
||||
//
|
||||
//! Disables the SysTick counter.
|
||||
//!
|
||||
//! \param None
|
||||
//!
|
||||
//! This function stops the SysTick counter. If an interrupt handler has been
|
||||
//! registered, it is not called until SysTick is restarted.
|
||||
//!
|
||||
//! \return None.
|
||||
//
|
||||
//*****************************************************************************
|
||||
static inline void
|
||||
SYSTICK_disableCounter(void)
|
||||
{
|
||||
//
|
||||
// Disable SysTick Counter.
|
||||
//
|
||||
HWREG(NVIC_BASE + NVIC_O_SYST_CSR) &= ~NVIC_SYST_CSR_ENABLE;
|
||||
}
|
||||
|
||||
//*****************************************************************************
|
||||
//
|
||||
//! Sets the period of the SysTick counter.
|
||||
//!
|
||||
//! \param period is the number of clock ticks in each period of the
|
||||
//! SysTick counter and must be between 1 and 16,777,216, inclusive.
|
||||
//!
|
||||
//! This function sets the rate at which the SysTick counter wraps, which
|
||||
//! equates to the number of processor clocks between interrupts.
|
||||
//!
|
||||
//! \note Calling this function does not cause the SysTick counter to reload
|
||||
//! immediately. If an immediate reload is required, the \b NVIC_O_SYST_CVR
|
||||
//! register must be written. Any write to this register clears the SysTick
|
||||
//! counter to 0 and causes a reload with the \e period supplied here on
|
||||
//! the next clock after SysTick is enabled.
|
||||
//!
|
||||
//! \return None.
|
||||
//
|
||||
//*****************************************************************************
|
||||
static inline void
|
||||
SYSTICK_setPeriod(uint32_t period)
|
||||
{
|
||||
//
|
||||
// Check the arguments.
|
||||
//
|
||||
ASSERT((period > 0) && (period <= 0x1000000U));
|
||||
|
||||
//
|
||||
// Set the period of the SysTick counter.
|
||||
//
|
||||
HWREG(NVIC_BASE + NVIC_O_SYST_RVR) = period - 1;
|
||||
}
|
||||
|
||||
//*****************************************************************************
|
||||
//
|
||||
//! Gets the period of the SysTick counter.
|
||||
//!
|
||||
//! \param None
|
||||
//!
|
||||
//! This function returns the rate at which the SysTick counter wraps, which
|
||||
//! equates to the number of processor clocks between interrupts.
|
||||
//!
|
||||
//! \return Returns the period of the SysTick counter.
|
||||
//
|
||||
//*****************************************************************************
|
||||
static inline uint32_t
|
||||
SYSTICK_getPeriod(void)
|
||||
{
|
||||
//
|
||||
// Return the period of the SysTick counter.
|
||||
//
|
||||
return(HWREG(NVIC_BASE + NVIC_O_SYST_RVR) + 1U);
|
||||
}
|
||||
|
||||
//*****************************************************************************
|
||||
//
|
||||
//! Gets the current value of the SysTick counter.
|
||||
//!
|
||||
//! \param None
|
||||
//!
|
||||
//! This function returns the current value of the SysTick counter, which is
|
||||
//! a value between the period - 1 and zero, inclusive.
|
||||
//!
|
||||
//! \return Returns the current value of the SysTick counter.
|
||||
//
|
||||
//*****************************************************************************
|
||||
static inline uint32_t
|
||||
SYSTICK_getCurrentValue(void)
|
||||
{
|
||||
//
|
||||
// Return the current value of the SysTick counter.
|
||||
//
|
||||
return(HWREG(NVIC_BASE + NVIC_O_SYST_CVR));
|
||||
}
|
||||
|
||||
//*****************************************************************************
|
||||
//
|
||||
//! Enables the SysTick interrupt.
|
||||
//!
|
||||
//! \param None
|
||||
//!
|
||||
//! This function enables the SysTick interrupt, allowing it to be
|
||||
//! reflected to the processor.
|
||||
//!
|
||||
//! \note The SysTick interrupt handler is not required to clear the SysTick
|
||||
//! interrupt source because it is cleared automatically by the NVIC when the
|
||||
//! interrupt handler is called.
|
||||
//!
|
||||
//! \return None.
|
||||
//
|
||||
//*****************************************************************************
|
||||
static inline void
|
||||
SYSTICK_enableInterrupt(void)
|
||||
{
|
||||
//
|
||||
// Enable the SysTick interrupt.
|
||||
//
|
||||
Interrupt_enable(FAULT_SYSTICK);
|
||||
}
|
||||
|
||||
//*****************************************************************************
|
||||
//
|
||||
//! Disables the SysTick interrupt.
|
||||
//!
|
||||
//! \param None
|
||||
//!
|
||||
//! This function disables the SysTick interrupt, preventing it from being
|
||||
//! reflected to the processor.
|
||||
//!
|
||||
//! \return None.
|
||||
//
|
||||
//*****************************************************************************
|
||||
static inline void
|
||||
SYSTICK_disableInterrupt(void)
|
||||
{
|
||||
//
|
||||
// Disable the SysTick interrupt.
|
||||
//
|
||||
Interrupt_disable(FAULT_SYSTICK);
|
||||
}
|
||||
|
||||
//*****************************************************************************
|
||||
//
|
||||
//! Registers an interrupt handler for the SysTick interrupt.
|
||||
//!
|
||||
//! \param fnHandler is a pointer to the function to be called when the
|
||||
//! SysTick interrupt occurs.
|
||||
//!
|
||||
//! This function registers the handler to be called when a SysTick interrupt
|
||||
//! occurs.
|
||||
//!
|
||||
//! \sa Interrupt_registerHandler() for important information about registering
|
||||
//! interrupt handlers.
|
||||
//!
|
||||
//! \return None.
|
||||
//
|
||||
//*****************************************************************************
|
||||
static inline void
|
||||
SYSTICK_registerInterruptHandler(void (*fnHandler)(void))
|
||||
{
|
||||
//
|
||||
// Register the interrupt handler, returning an error if an error occurs.
|
||||
//
|
||||
Interrupt_registerHandler(FAULT_SYSTICK, fnHandler);
|
||||
|
||||
//
|
||||
// Enable the SysTick interrupt.
|
||||
//
|
||||
Interrupt_enable(FAULT_SYSTICK);
|
||||
}
|
||||
|
||||
//*****************************************************************************
|
||||
//
|
||||
//! Unregisters the interrupt handler for the SysTick interrupt.
|
||||
//!
|
||||
//! \param None
|
||||
//!
|
||||
//! This function unregisters the handler to be called when a SysTick interrupt
|
||||
//! occurs.
|
||||
//!
|
||||
//! \sa Interrupt_registerHandler() for important information about registering
|
||||
//! interrupt handlers.
|
||||
//!
|
||||
//! \return None.
|
||||
//
|
||||
//*****************************************************************************
|
||||
static inline void
|
||||
SYSTICK_unregisterInterruptHandler(void)
|
||||
{
|
||||
//
|
||||
// Disable the SysTick interrupt.
|
||||
//
|
||||
Interrupt_disable(FAULT_SYSTICK);
|
||||
|
||||
//
|
||||
// Unregister the interrupt handler.
|
||||
//
|
||||
Interrupt_unregisterHandler(FAULT_SYSTICK);
|
||||
}
|
||||
|
||||
//*****************************************************************************
|
||||
//
|
||||
// Close the Doxygen group.
|
||||
//! @}
|
||||
//
|
||||
//*****************************************************************************
|
||||
|
||||
//*****************************************************************************
|
||||
//
|
||||
// Mark the end of the C bindings section for C++ compilers.
|
||||
//
|
||||
//*****************************************************************************
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif // SYSTICK_H
|
||||
+315
@@ -0,0 +1,315 @@
|
||||
//###########################################################################
|
||||
//
|
||||
// FILE: uart.c
|
||||
//
|
||||
// TITLE: CM UARTdriver.
|
||||
//
|
||||
//###########################################################################
|
||||
// $TI Release: $
|
||||
// $Release Date: $
|
||||
//
|
||||
// C2000Ware v5.04.00.00
|
||||
//
|
||||
// Copyright (C) 2024 Texas Instruments Incorporated - http://www.ti.com
|
||||
//
|
||||
// Redistribution and use in source and binary forms, with or without
|
||||
// modification, are permitted provided that the following conditions
|
||||
// are met:
|
||||
//
|
||||
// Redistributions of source code must retain the above copyright
|
||||
// notice, this list of conditions and the following disclaimer.
|
||||
//
|
||||
// Redistributions in binary form must reproduce the above copyright
|
||||
// notice, this list of conditions and the following disclaimer in the
|
||||
// documentation and/or other materials provided with the
|
||||
// distribution.
|
||||
//
|
||||
// Neither the name of Texas Instruments Incorporated nor the names of
|
||||
// its contributors may be used to endorse or promote products derived
|
||||
// from this software without specific prior written permission.
|
||||
//
|
||||
// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
|
||||
// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
|
||||
// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
|
||||
// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
|
||||
// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
|
||||
// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
|
||||
// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
|
||||
// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
|
||||
// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
||||
// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
|
||||
// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
// $
|
||||
//###########################################################################
|
||||
|
||||
#include <stdbool.h>
|
||||
#include <stdint.h>
|
||||
#include "inc_cm/hw_memmap.h"
|
||||
#include "inc_cm/hw_types.h"
|
||||
#include "inc_cm/hw_uart.h"
|
||||
#include "debug.h"
|
||||
#include "interrupt.h"
|
||||
#include "uart.h"
|
||||
|
||||
//*****************************************************************************
|
||||
//
|
||||
// API Function prototypes
|
||||
//
|
||||
//*****************************************************************************
|
||||
|
||||
//*****************************************************************************
|
||||
//
|
||||
// UART_setConfig()
|
||||
//
|
||||
//*****************************************************************************
|
||||
|
||||
void
|
||||
UART_setConfig(uint32_t base, uint32_t uartClk,
|
||||
uint32_t baud, uint32_t config)
|
||||
{
|
||||
uint32_t div, baudrt;
|
||||
|
||||
baudrt = baud;
|
||||
//
|
||||
// Check the arguments.
|
||||
//
|
||||
ASSERT(UART_isBaseValid(base));
|
||||
ASSERT(baudrt != 0U);
|
||||
ASSERT(uartClk >= (baudrt * UART_CLK_DIVIDER));
|
||||
|
||||
//
|
||||
// Stop the UART.
|
||||
//
|
||||
UART_disableModule(base);
|
||||
|
||||
//
|
||||
// Is the required baud rate greater than the maximum rate supported
|
||||
// without the use of high speed mode?
|
||||
//
|
||||
if((baudrt * 16U) > uartClk)
|
||||
{
|
||||
//
|
||||
// Enable high speed mode.
|
||||
//
|
||||
HWREG(base + UART_O_CTL) |= UART_CTL_HSE;
|
||||
|
||||
//
|
||||
// Half the supplied baud rate to compensate for enabling high speed
|
||||
// mode. This allows the following code to be common to both cases.
|
||||
//
|
||||
baudrt /= 2U;
|
||||
}
|
||||
else
|
||||
{
|
||||
//
|
||||
// Disable high speed mode.
|
||||
//
|
||||
HWREG(base + UART_O_CTL) &= ~(UART_CTL_HSE);
|
||||
}
|
||||
|
||||
//
|
||||
// Compute the fractional baud rate divider.
|
||||
//
|
||||
div = (((uartClk * 8U) / baudrt) + 1U) / 2U;
|
||||
|
||||
//
|
||||
// Set the baud rate.
|
||||
//
|
||||
HWREG(base + UART_O_IBRD) = div / 64U;
|
||||
HWREG(base + UART_O_FBRD) = div % 64U;
|
||||
|
||||
//
|
||||
// Set parity, data length, and number of stop bits.
|
||||
//
|
||||
HWREG(base + UART_O_LCRH) = config;
|
||||
|
||||
//
|
||||
// Start the UART.
|
||||
//
|
||||
UART_enableModule(base);
|
||||
}
|
||||
|
||||
//*****************************************************************************
|
||||
//
|
||||
// UART_getConfig()
|
||||
//
|
||||
//*****************************************************************************
|
||||
|
||||
void
|
||||
UART_getConfig(uint32_t base, uint32_t uartClk,
|
||||
uint32_t *baud, uint32_t *config)
|
||||
{
|
||||
uint32_t integr, frac;
|
||||
|
||||
//
|
||||
// Check the arguments.
|
||||
//
|
||||
ASSERT(UART_isBaseValid(base));
|
||||
|
||||
//
|
||||
// Compute the baud rate.
|
||||
//
|
||||
integr = HWREG(base + UART_O_IBRD);
|
||||
frac = HWREG(base + UART_O_FBRD);
|
||||
*baud = (uartClk * 4U) / ((64U * integr) + frac);
|
||||
|
||||
//
|
||||
// See if high speed mode enabled.
|
||||
//
|
||||
if((HWREG(base + UART_O_CTL) & UART_CTL_HSE) == UART_CTL_HSE)
|
||||
{
|
||||
//
|
||||
// High speed mode is enabled so the actual baud rate is actually
|
||||
// double what was just calculated.
|
||||
//
|
||||
*baud *= 2U;
|
||||
}
|
||||
|
||||
//
|
||||
// Get the parity, data length, and number of stop bits.
|
||||
//
|
||||
*config = (HWREG(base + UART_O_LCRH) &
|
||||
(UART_LCRH_SPS | UART_LCRH_WLEN_M | UART_LCRH_STP2 |
|
||||
UART_LCRH_EPS | UART_LCRH_PEN));
|
||||
}
|
||||
|
||||
//*****************************************************************************
|
||||
//
|
||||
// UART_writeCharNonBlocking()
|
||||
//
|
||||
//*****************************************************************************
|
||||
|
||||
bool
|
||||
UART_writeCharNonBlocking(uint32_t base, uint8_t data)
|
||||
{
|
||||
bool ret;
|
||||
//
|
||||
// Check the arguments.
|
||||
//
|
||||
ASSERT(UART_isBaseValid(base));
|
||||
|
||||
//
|
||||
// See if there is space in the transmit FIFO.
|
||||
//
|
||||
if((HWREG(base + UART_O_FR) & UART_FR_TXFF) == 0U)
|
||||
{
|
||||
//
|
||||
// Write this character to the transmit FIFO.
|
||||
//
|
||||
HWREG(base + UART_O_DR) = data;
|
||||
|
||||
//
|
||||
// Success.
|
||||
//
|
||||
ret = true;
|
||||
}
|
||||
else
|
||||
{
|
||||
//
|
||||
// There is no space in the transmit FIFO, so return a failure.
|
||||
//
|
||||
ret = false;
|
||||
}
|
||||
return(ret);
|
||||
}
|
||||
|
||||
//*****************************************************************************
|
||||
//
|
||||
// UART_send9BitAddress()
|
||||
//
|
||||
//*****************************************************************************
|
||||
|
||||
void
|
||||
UART_send9BitAddress(uint32_t base, uint8_t addr)
|
||||
{
|
||||
uint32_t lcrh;
|
||||
|
||||
//
|
||||
// Check the arguments.
|
||||
//
|
||||
ASSERT(UART_isBaseValid(base));
|
||||
|
||||
//
|
||||
// Wait until the FIFO is empty and the UART is not busy.
|
||||
//
|
||||
while((HWREG(base + UART_O_FR) & (UART_FR_TXFE | UART_FR_BUSY)) !=
|
||||
UART_FR_TXFE)
|
||||
{
|
||||
}
|
||||
|
||||
//
|
||||
// Force the address/data bit to 1 to indicate this is an address byte.
|
||||
//
|
||||
lcrh = HWREG(base + UART_O_LCRH);
|
||||
HWREG(base + UART_O_LCRH) = ((lcrh & ~UART_LCRH_EPS) |
|
||||
UART_LCRH_SPS | UART_LCRH_PEN);
|
||||
|
||||
//
|
||||
// Send the address.
|
||||
//
|
||||
HWREG(base + UART_O_DR) = addr;
|
||||
|
||||
//
|
||||
// Wait until the address has been sent.
|
||||
//
|
||||
while((HWREG(base + UART_O_FR) & (UART_FR_TXFE | UART_FR_BUSY)) !=
|
||||
UART_FR_TXFE)
|
||||
{
|
||||
}
|
||||
|
||||
//
|
||||
// Restore the address/data setting.
|
||||
//
|
||||
HWREG(base + UART_O_LCRH) = lcrh;
|
||||
}
|
||||
|
||||
//*****************************************************************************
|
||||
//
|
||||
// UART_send9BitData()
|
||||
//
|
||||
//*****************************************************************************
|
||||
|
||||
void
|
||||
UART_send9BitData(uint32_t base, uint8_t data)
|
||||
{
|
||||
uint32_t lcrh;
|
||||
|
||||
//
|
||||
// Check the arguments.
|
||||
//
|
||||
ASSERT(UART_isBaseValid(base));
|
||||
|
||||
//
|
||||
// Wait until the FIFO is empty and the UART is not busy.
|
||||
//
|
||||
while((HWREG(base + UART_O_FR) & (UART_FR_TXFE | UART_FR_BUSY)) !=
|
||||
UART_FR_TXFE)
|
||||
{
|
||||
}
|
||||
|
||||
//
|
||||
// Force the address/data bit to 0 to indicate this is an data byte.
|
||||
//
|
||||
lcrh = HWREG(base + UART_O_LCRH);
|
||||
HWREG(base + UART_O_LCRH) = (lcrh |UART_LCRH_EPS |
|
||||
UART_LCRH_SPS | UART_LCRH_PEN);
|
||||
|
||||
//
|
||||
// Send the data.
|
||||
//
|
||||
HWREG(base + UART_O_DR) = data;
|
||||
|
||||
//
|
||||
// Wait until the address has been sent.
|
||||
//
|
||||
while((HWREG(base + UART_O_FR) & (UART_FR_TXFE | UART_FR_BUSY)) !=
|
||||
UART_FR_TXFE)
|
||||
{
|
||||
}
|
||||
|
||||
//
|
||||
// Restore the address/data setting.
|
||||
//
|
||||
HWREG(base + UART_O_LCRH) = lcrh;
|
||||
}
|
||||
|
||||
+1589
File diff suppressed because it is too large.
Load diff
+468
@@ -0,0 +1,468 @@
|
||||
//###########################################################################
|
||||
//
|
||||
// FILE: udma.c
|
||||
//
|
||||
// TITLE: Driver for the micro-DMA controller.
|
||||
//
|
||||
//###########################################################################
|
||||
// $TI Release: $
|
||||
// $Release Date: $
|
||||
//
|
||||
// C2000Ware v5.04.00.00
|
||||
//
|
||||
// Copyright (C) 2024 Texas Instruments Incorporated - http://www.ti.com
|
||||
//
|
||||
// Redistribution and use in source and binary forms, with or without
|
||||
// modification, are permitted provided that the following conditions
|
||||
// are met:
|
||||
//
|
||||
// Redistributions of source code must retain the above copyright
|
||||
// notice, this list of conditions and the following disclaimer.
|
||||
//
|
||||
// Redistributions in binary form must reproduce the above copyright
|
||||
// notice, this list of conditions and the following disclaimer in the
|
||||
// documentation and/or other materials provided with the
|
||||
// distribution.
|
||||
//
|
||||
// Neither the name of Texas Instruments Incorporated nor the names of
|
||||
// its contributors may be used to endorse or promote products derived
|
||||
// from this software without specific prior written permission.
|
||||
//
|
||||
// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
|
||||
// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
|
||||
// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
|
||||
// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
|
||||
// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
|
||||
// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
|
||||
// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
|
||||
// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
|
||||
// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
||||
// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
|
||||
// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
// $
|
||||
//###########################################################################
|
||||
|
||||
#include "udma.h"
|
||||
|
||||
//*****************************************************************************
|
||||
//
|
||||
// UDMA_enableChannelAttribute()
|
||||
//
|
||||
//*****************************************************************************
|
||||
void
|
||||
UDMA_enableChannelAttribute(uint32_t base, uint32_t channelNum,
|
||||
uint32_t channelAttr)
|
||||
{
|
||||
//
|
||||
// Check the arguments.
|
||||
//
|
||||
ASSERT(UDMA_isBaseValid(base));
|
||||
ASSERT((channelNum & 0xFFFFU) < 32U);
|
||||
ASSERT((channelAttr & ~(UDMA_CH_ATTR_USEBURST | UDMA_CH_ATTR_ALTSELECT |
|
||||
UDMA_CH_ATTR_HIGH_PRIORITY | UDMA_CH_ATTR_REQMASK)) == 0U);
|
||||
|
||||
|
||||
//
|
||||
// Set the useburst bit for this channel if set in channelAttr.
|
||||
//
|
||||
if((channelAttr & UDMA_CH_ATTR_USEBURST) == UDMA_CH_ATTR_USEBURST)
|
||||
{
|
||||
HWREG(base + UDMA_O_DMAUSEBURSTSET) = 1U << channelNum;
|
||||
}
|
||||
|
||||
//
|
||||
// Set the alternate control select bit for this channel,
|
||||
// if set in channelAttr.
|
||||
//
|
||||
if((channelAttr & UDMA_CH_ATTR_ALTSELECT) == UDMA_CH_ATTR_ALTSELECT)
|
||||
{
|
||||
HWREG(base + UDMA_O_DMAALTSET) = 1U << channelNum;
|
||||
}
|
||||
|
||||
//
|
||||
// Set the high priority bit for this channel, if set in channelAttr.
|
||||
//
|
||||
if((channelAttr & UDMA_CH_ATTR_HIGH_PRIORITY) == UDMA_CH_ATTR_HIGH_PRIORITY)
|
||||
{
|
||||
HWREG(base + UDMA_O_DMAPRIOSET) = 1U << channelNum;
|
||||
}
|
||||
|
||||
//
|
||||
// Set the request mask bit for this channel, if set in channelAttr.
|
||||
//
|
||||
if((channelAttr & UDMA_CH_ATTR_REQMASK) == UDMA_CH_ATTR_REQMASK)
|
||||
{
|
||||
HWREG(base + UDMA_O_DMAREQMASKSET) = 1U << channelNum;
|
||||
}
|
||||
}
|
||||
|
||||
//*****************************************************************************
|
||||
//
|
||||
// UDMA_disableChannelAttribute()
|
||||
//
|
||||
//*****************************************************************************
|
||||
void
|
||||
UDMA_disableChannelAttribute(uint32_t base, uint32_t channelNum,
|
||||
uint32_t channelAttr)
|
||||
{
|
||||
//
|
||||
// Check the arguments.
|
||||
//
|
||||
ASSERT(UDMA_isBaseValid(base));
|
||||
ASSERT((channelNum & 0xFFFFU) < 32U);
|
||||
ASSERT((channelAttr & ~(UDMA_CH_ATTR_USEBURST | UDMA_CH_ATTR_ALTSELECT |
|
||||
UDMA_CH_ATTR_HIGH_PRIORITY | UDMA_CH_ATTR_REQMASK)) == 0U);
|
||||
|
||||
//
|
||||
// Clear the useburst bit for this channel if set in channelAttr.
|
||||
//
|
||||
if((channelAttr & UDMA_CH_ATTR_USEBURST) == UDMA_CH_ATTR_USEBURST)
|
||||
{
|
||||
HWREG(base + UDMA_O_DMAUSEBURSTCLR) = 1U << channelNum;
|
||||
}
|
||||
|
||||
//
|
||||
// Clear the alternate control select bit for this channel, if set in
|
||||
// channelAttr.
|
||||
//
|
||||
if((channelAttr & UDMA_CH_ATTR_ALTSELECT) == UDMA_CH_ATTR_ALTSELECT)
|
||||
{
|
||||
HWREG(base + UDMA_O_DMAALTCLR) = 1U << channelNum;
|
||||
}
|
||||
|
||||
//
|
||||
// Clear the high priority bit for this channel, if set in channelAttr.
|
||||
//
|
||||
if((channelAttr & UDMA_CH_ATTR_HIGH_PRIORITY) == UDMA_CH_ATTR_HIGH_PRIORITY)
|
||||
{
|
||||
HWREG(base + UDMA_O_DMAPRIOCLR) = 1U << channelNum;
|
||||
}
|
||||
|
||||
//
|
||||
// Clear the request mask bit for this channel, if set in channelAttr.
|
||||
//
|
||||
if((channelAttr & UDMA_CH_ATTR_REQMASK) == UDMA_CH_ATTR_REQMASK)
|
||||
{
|
||||
HWREG(base + UDMA_O_DMAREQMASKCLR) = 1U << channelNum;
|
||||
}
|
||||
}
|
||||
|
||||
//*****************************************************************************
|
||||
//
|
||||
// UDMA_getChannelAttribute()
|
||||
//
|
||||
//*****************************************************************************
|
||||
uint32_t
|
||||
UDMA_getChannelAttribute(uint32_t base, uint32_t channelNum)
|
||||
{
|
||||
uint32_t channelAttr = 0U;
|
||||
uint32_t offset = 1U << channelNum;
|
||||
|
||||
//
|
||||
// Check the arguments.
|
||||
//
|
||||
ASSERT(UDMA_isBaseValid(base));
|
||||
ASSERT((channelNum & 0xFFFFU) < 32U);
|
||||
|
||||
//
|
||||
// Check to see if useburst bit is set for this channel.
|
||||
//
|
||||
if((HWREG(base + UDMA_O_DMAUSEBURSTSET) & offset) == offset)
|
||||
{
|
||||
channelAttr |= UDMA_CH_ATTR_USEBURST;
|
||||
}
|
||||
|
||||
//
|
||||
// Check to see if the alternate control bit is set for this channel.
|
||||
//
|
||||
if((HWREG(base + UDMA_O_DMAALTSET) & offset) == offset)
|
||||
{
|
||||
channelAttr |= UDMA_CH_ATTR_ALTSELECT;
|
||||
}
|
||||
|
||||
//
|
||||
// Check to see if the high priority bit is set for this channel.
|
||||
//
|
||||
if((HWREG(base + UDMA_O_DMAPRIOSET) & offset) == offset)
|
||||
{
|
||||
channelAttr |= UDMA_CH_ATTR_HIGH_PRIORITY;
|
||||
}
|
||||
|
||||
//
|
||||
// Check to see if the request mask bit is set for this channel.
|
||||
//
|
||||
if((HWREG(base + UDMA_O_DMAREQMASKSET) & offset) == offset)
|
||||
{
|
||||
channelAttr |= UDMA_CH_ATTR_REQMASK;
|
||||
}
|
||||
|
||||
//
|
||||
// Return the configuration flags.
|
||||
//
|
||||
return(channelAttr);
|
||||
}
|
||||
|
||||
//*****************************************************************************
|
||||
//
|
||||
// UDMA_setChannelTransferParams()
|
||||
//
|
||||
//*****************************************************************************
|
||||
extern void
|
||||
UDMA_setChannelTransferParams(uint32_t base, uint32_t index, void *srcAddr,
|
||||
void *dstAddr, uint32_t transferMode,
|
||||
uint32_t transferSize)
|
||||
{
|
||||
UDMA_ControlTable *controlTable;
|
||||
uint32_t chControlAttr;
|
||||
uint32_t addrInc;
|
||||
uint32_t bufferBytes;
|
||||
uint32_t txModeTemp, srcAddrTemp, dstAddrTemp;
|
||||
|
||||
//
|
||||
// Check the arguments.
|
||||
//
|
||||
ASSERT(UDMA_isBaseValid(base));
|
||||
ASSERT(index < 64U);
|
||||
ASSERT(HWREG(base + UDMA_O_DMACTLBASE) != 0U);
|
||||
ASSERT(transferMode <= UDMA_MODE_PER_SCATTER_GATHER);
|
||||
ASSERT((uint32_t)srcAddr >= 0x20000000U);
|
||||
ASSERT((uint32_t)dstAddr >= 0x20000000U);
|
||||
ASSERT((transferSize != 0U) && (transferSize <= 1024U));
|
||||
|
||||
//
|
||||
// Get the base address of the control table.
|
||||
//
|
||||
controlTable = (UDMA_ControlTable *)HWREG(base + UDMA_O_DMACTLBASE);
|
||||
ASSERT(controlTable != 0U);
|
||||
|
||||
//
|
||||
// Get the current control word value and mask off the mode and size
|
||||
// fields.
|
||||
//
|
||||
chControlAttr = (controlTable[index].chControlAttr &
|
||||
~(UDMA_DMACHCTL_XFERSIZE_M | UDMA_DMACHCTL_XFERMODE_M));
|
||||
|
||||
//
|
||||
// Adjust the mode if the alt control structure is selected.
|
||||
//
|
||||
if((index & UDMA_ALT_SELECT) == UDMA_ALT_SELECT)
|
||||
{
|
||||
if((transferMode == UDMA_MODE_MEM_SCATTER_GATHER) ||
|
||||
(transferMode == UDMA_MODE_PER_SCATTER_GATHER))
|
||||
{
|
||||
txModeTemp = transferMode | UDMA_MODE_ALT_SELECT;
|
||||
}
|
||||
else
|
||||
{
|
||||
txModeTemp = transferMode;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
txModeTemp = transferMode;
|
||||
}
|
||||
|
||||
//
|
||||
// Set the transfer size and mode in the control word (but don't write the
|
||||
// control word yet as it could kick off a transfer).
|
||||
//
|
||||
chControlAttr |= txModeTemp |
|
||||
((transferSize - 1U) << UDMA_DMACHCTL_XFERSIZE_S);
|
||||
|
||||
//
|
||||
// Get the address increment value for the source, from the control word.
|
||||
//
|
||||
addrInc = (chControlAttr & UDMA_DMACHCTL_SRCINC_M);
|
||||
|
||||
//
|
||||
// Compute the ending source address of the transfer. If the source
|
||||
// increment is set to none, then the ending address is the same as the
|
||||
// beginning.
|
||||
//
|
||||
if(addrInc != UDMA_SRC_INC_NONE)
|
||||
{
|
||||
addrInc = addrInc >> UDMA_DMACHCTL_SRCINC_S;
|
||||
bufferBytes = transferSize << addrInc;
|
||||
srcAddrTemp = ((uint32_t)srcAddr + bufferBytes - 1U);
|
||||
}
|
||||
else
|
||||
{
|
||||
srcAddrTemp = (uint32_t)srcAddr;
|
||||
}
|
||||
|
||||
//
|
||||
// Load the source ending address into the control block.
|
||||
//
|
||||
controlTable[index].srcEndAddr = (void *)srcAddrTemp;
|
||||
|
||||
//
|
||||
// Get the address increment value for the destination, from the control
|
||||
// word.
|
||||
//
|
||||
addrInc = chControlAttr & UDMA_DMACHCTL_DSTINC_M;
|
||||
|
||||
//
|
||||
// Compute the ending destination address of the transfer. If the
|
||||
// destination increment is set to none, then the ending address is the
|
||||
// same as the beginning.
|
||||
//
|
||||
if(addrInc != UDMA_DST_INC_NONE)
|
||||
{
|
||||
//
|
||||
// There is a special case if this is setting up a scatter-gather
|
||||
// transfer. The destination pointer must point to the end of
|
||||
// the alternate structure for this channel instead of calculating
|
||||
// the end of the buffer in the normal way.
|
||||
//
|
||||
if((transferMode == UDMA_MODE_MEM_SCATTER_GATHER) ||
|
||||
(transferMode == UDMA_MODE_PER_SCATTER_GATHER))
|
||||
{
|
||||
dstAddrTemp = (uint32_t)&controlTable[index |
|
||||
UDMA_ALT_SELECT].spare;
|
||||
}
|
||||
//
|
||||
// Not a scatter-gather transfer, calculate end pointer normally.
|
||||
//
|
||||
else
|
||||
{
|
||||
addrInc = addrInc >> UDMA_DMACHCTL_DSTINC_S;
|
||||
bufferBytes = transferSize << addrInc;
|
||||
dstAddrTemp = ((uint32_t)dstAddr + bufferBytes - 1U);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
dstAddrTemp = (uint32_t)dstAddr;
|
||||
}
|
||||
|
||||
//
|
||||
// Load the destination ending address into the control block.
|
||||
//
|
||||
controlTable[index].dstEndAddr = (void *)dstAddrTemp;
|
||||
|
||||
//
|
||||
// Write the new control word value.
|
||||
//
|
||||
controlTable[index].chControlAttr = chControlAttr;
|
||||
}
|
||||
|
||||
//*****************************************************************************
|
||||
//
|
||||
// UDMA_getChannelTransferSize()
|
||||
//
|
||||
//*****************************************************************************
|
||||
uint32_t
|
||||
UDMA_getChannelTransferSize(uint32_t base, uint32_t index)
|
||||
{
|
||||
UDMA_ControlTable *controlTable;
|
||||
uint32_t chControlAttr, txSize;
|
||||
|
||||
//
|
||||
// Check the arguments.
|
||||
//
|
||||
ASSERT(UDMA_isBaseValid(base));
|
||||
ASSERT((index & 0xFFFFU) < 64U);
|
||||
ASSERT(HWREG(base + UDMA_O_DMACTLBASE) != 0U);
|
||||
|
||||
//
|
||||
// Get the base address of the control table.
|
||||
//
|
||||
controlTable = (UDMA_ControlTable *)HWREG(base + UDMA_O_DMACTLBASE);
|
||||
ASSERT(controlTable != 0U);
|
||||
|
||||
//
|
||||
// Get the current control word value and mask off all but the size field
|
||||
// and the mode field.
|
||||
//
|
||||
chControlAttr = (controlTable[index].chControlAttr &
|
||||
(UDMA_DMACHCTL_XFERSIZE_M | UDMA_DMACHCTL_XFERMODE_M));
|
||||
|
||||
//
|
||||
// If the size field and mode field are 0 then the transfer is finished
|
||||
// and there are no more items to transfer
|
||||
//
|
||||
if(chControlAttr == 0U)
|
||||
{
|
||||
txSize = 0U;
|
||||
}
|
||||
|
||||
//
|
||||
// Otherwise, if either the size field or more field is non-zero, then
|
||||
// not all the items have been transferred.
|
||||
//
|
||||
else
|
||||
{
|
||||
//
|
||||
// Shift the size field and add one, then return to user.
|
||||
//
|
||||
txSize = (chControlAttr >> UDMA_DMACHCTL_XFERSIZE_S) + 1U;
|
||||
}
|
||||
return(txSize);
|
||||
}
|
||||
//*****************************************************************************
|
||||
//
|
||||
// UDMA_setChannelScatterGatherMode()
|
||||
//
|
||||
//*****************************************************************************
|
||||
void
|
||||
UDMA_setChannelScatterGatherMode(uint32_t base, uint32_t channelNum,
|
||||
uint32_t taskCount, UDMA_ControlTable *taskList,
|
||||
bool isPeriphScatterGather)
|
||||
{
|
||||
volatile UDMA_ControlTable *controlTable;
|
||||
UDMA_ControlTable *taskTable;
|
||||
|
||||
//
|
||||
// Check the parameters
|
||||
//
|
||||
ASSERT(UDMA_isBaseValid(base));
|
||||
ASSERT(channelNum < 32U);
|
||||
ASSERT(HWREG(base + UDMA_O_DMACTLBASE) != 0U);
|
||||
ASSERT(taskList != 0U);
|
||||
ASSERT(taskCount != 0U && taskCount <= 1024U);
|
||||
|
||||
//
|
||||
// Get the base address of the control table.
|
||||
//
|
||||
controlTable = (UDMA_ControlTable *)HWREG(base + UDMA_O_DMACTLBASE);
|
||||
|
||||
//
|
||||
// Get a handy pointer to the task list.
|
||||
//
|
||||
taskTable = taskList;
|
||||
ASSERT(taskTable);
|
||||
|
||||
//
|
||||
// Compute the ending address for the source pointer. This address is the
|
||||
// last element of the last task in the task table.
|
||||
//
|
||||
controlTable[channelNum].srcEndAddr = &taskTable[taskCount - 1U].spare;
|
||||
|
||||
//
|
||||
// Compute the ending address for the destination pointer. This address
|
||||
// is the end of the alternate structure for this channel.
|
||||
//
|
||||
controlTable[channelNum].dstEndAddr = &controlTable[channelNum |
|
||||
UDMA_ALT_SELECT].spare;
|
||||
|
||||
//
|
||||
// Compute the control word. Most configurable items are fixed for
|
||||
// scatter-gather. Item and increment sizes are all 32-bit and arb
|
||||
// size must be 4. The count is the number of items in the task list
|
||||
// times 4 (4 words per task).
|
||||
//
|
||||
controlTable[channelNum].chControlAttr =
|
||||
(UDMA_DST_INC_32 | UDMA_SIZE_32 | UDMA_SRC_INC_32 | UDMA_ARB_4 |
|
||||
((uint32_t)((taskCount * 4U) - 1U) << UDMA_DMACHCTL_XFERSIZE_S) |
|
||||
((isPeriphScatterGather == true) ? UDMA_MODE_PER_SCATTER_GATHER :
|
||||
UDMA_MODE_MEM_SCATTER_GATHER));
|
||||
|
||||
//
|
||||
// Scatter-gather operations can leave the alt bit set. So if doing
|
||||
// back to back scatter-gather transfers, the second attempt may not
|
||||
// work correctly because the alt bit is set. Therefore, clear the
|
||||
// alt bit here to ensure that it is always cleared before a new SG
|
||||
// transfer is started.
|
||||
//
|
||||
HWREG(base + UDMA_O_DMAALTCLR) = 1U << channelNum;
|
||||
}
|
||||
+1191
File diff suppressed because it is too large.
Load diff
+78
@@ -0,0 +1,78 @@
|
||||
/*
|
||||
//###########################################################################
|
||||
//
|
||||
// FILE: F2838x_cm_boot_rom_lnk.cmd
|
||||
//
|
||||
// TITLE: CM boot rom linker command file
|
||||
//
|
||||
//
|
||||
//###########################################################################
|
||||
// $TI Release: $
|
||||
// $Release Date: $
|
||||
//###########################################################################
|
||||
*/
|
||||
|
||||
//
|
||||
// Required for EABI retention of unreferenced sections
|
||||
//
|
||||
--retain '(.CMVersion)'
|
||||
--retain '(.test_signature1)'
|
||||
--retain '(.CKSUMLOC)'
|
||||
--retain '(.BOOT_CKSUMLOC)'
|
||||
--retain '(.bootrom_func)'
|
||||
--retain '(.checksumfuncs)'
|
||||
|
||||
MEMORY
|
||||
{
|
||||
//
|
||||
// ROM Memories
|
||||
//
|
||||
VECS : origin = 0x000000, length = 0x000140
|
||||
VERSION : origin = 0x000140, length = 0x000004
|
||||
BOOT_CHECKSUM : origin = 0x000144, length = 0x000084
|
||||
CHECKSUM : origin = 0x0001C8, length = 0x000084
|
||||
BOOT : origin = 0x00024C, length = 0x003DCC//, fill = 0xFFFF
|
||||
INTERRUPT_HANDLERS : origin = 0x004018, length = 0x000204
|
||||
|
||||
RESERVED : origin = 0x00421C, length = 0x00B9E0//, fill = 0xFFFF
|
||||
|
||||
CRCTABLE_ROM : origin = 0x00FBFC, length = 0x000400
|
||||
ROM_SIGNATURE : origin = 0x00FFFC, length = 0x000004
|
||||
|
||||
//
|
||||
// RAM Memories
|
||||
//
|
||||
CM_BROM_STATUS : origin = 0x20000000, length = 0x000004
|
||||
CM_BROM_BOOTMODE : origin = 0x20000004, length = 0x000004
|
||||
BSS : origin = 0x20000008, length = 0x000004
|
||||
STACK : origin = 0x2000000C, length = 0x0007F4
|
||||
}
|
||||
|
||||
SECTIONS
|
||||
{
|
||||
GROUP : load = INTERRUPT_HANDLERS
|
||||
{
|
||||
CMBROM_NMI_HANDLER
|
||||
CMBROM_HARDFAULT_HANDLER
|
||||
CMBROM_DEFAULT_HANDLER
|
||||
}
|
||||
|
||||
.test_signature1: load = ROM_SIGNATURE
|
||||
.bootrom_func: load = CRCTABLE_ROM //Will come from secure CRC lib
|
||||
.InitBoot: load = BOOT
|
||||
.text: load = BOOT
|
||||
.checksumfuncs: load = BOOT, ALIGN(2)
|
||||
.Isr: load = BOOT
|
||||
.BootVecs: load = VECS
|
||||
.BOOT_CKSUMLOC: load = BOOT_CHECKSUM, ALIGN(2)
|
||||
.CKSUMLOC: load = CHECKSUM, ALIGN(2)
|
||||
.CMVersion: load = VERSION
|
||||
.stack: load = STACK
|
||||
.bss: load = BSS
|
||||
.const: load = BOOT, ALIGN(2)
|
||||
.cinit: load = BOOT, ALIGN(2)
|
||||
.switch: load = BOOT, ALIGN(2)
|
||||
BootStatusVariable: load = CM_BROM_STATUS
|
||||
UserBootModeVariable: load = CM_BROM_BOOTMODE
|
||||
}
|
||||
|
||||
+360
@@ -0,0 +1,360 @@
|
||||
******************************************************************************
|
||||
TI ARM Linker PC v17.6.0
|
||||
******************************************************************************
|
||||
>> Linked Sun Mar 25 11:29:22 2018
|
||||
|
||||
OUTPUT FILE NAME: <F2838x_CM_ROM.out>
|
||||
ENTRY POINT SYMBOL: "CM_resetISR" address: 00001511
|
||||
|
||||
|
||||
MEMORY CONFIGURATION
|
||||
|
||||
name origin length used unused attr fill
|
||||
---------------------- -------- --------- -------- -------- ---- --------
|
||||
VECS 00000000 00000140 00000140 00000000 RWIX
|
||||
VERSION 00000140 00000004 00000004 00000000 RWIX
|
||||
BOOT_CHECKSUM 00000144 00000084 00000084 00000000 RWIX
|
||||
CHECKSUM 000001c8 00000084 00000084 00000000 RWIX
|
||||
BOOT 0000024c 00003dcc 000017ca 00002602 RWIX
|
||||
INTERRUPT_HANDLERS 00004018 00000204 00000204 00000000 RWIX
|
||||
RESERVED 0000421c 0000b9e0 00000000 0000b9e0 RWIX
|
||||
CRCTABLE_ROM 0000fbfc 00000400 00000400 00000000 RWIX
|
||||
ROM_SIGNATURE 0000fffc 00000004 00000004 00000000 RWIX
|
||||
Z1_SCC_ROM_Secure_Fla 00010000 00005000 00000746 000048ba RWIX
|
||||
Z1_SCC_ROM 00015000 00001000 00000baa 00000456 RWIX
|
||||
Z2_SCC_ROM 00016000 00001000 00000baa 00000456 RWIX
|
||||
Z2_RESERVED 00017000 00001000 00000000 00001000 RWIX
|
||||
CM_BROM_STATUS 20000000 00000004 00000004 00000000 RWIX
|
||||
CM_BROM_BOOTMODE 20000004 00000004 00000004 00000000 RWIX
|
||||
BSS 20000008 00000004 00000004 00000000 RWIX
|
||||
STACK 2000000c 000007f4 00000000 000007f4 RWIX
|
||||
|
||||
|
||||
SEGMENT ALLOCATION MAP
|
||||
|
||||
run origin load origin length init length attrs members
|
||||
---------- ----------- ---------- ----------- ----- -------
|
||||
00000000 00000000 00001a1c 00001a1c r-x
|
||||
00000000 00000000 00000140 00000140 r-- .BootVecs
|
||||
00000140 00000140 00000004 00000004 r-- .CMVersion
|
||||
00000144 00000144 00000084 00000084 r-- .BOOT_CKSUMLOC
|
||||
000001c8 000001c8 00000084 00000084 r-- .CKSUMLOC
|
||||
0000024c 0000024c 00000d04 00000d04 r-x .checksumfuncs
|
||||
00000f50 00000f50 00000a92 00000a92 r-x .text
|
||||
000019e8 000019e8 00000034 00000034 r-- .cinit
|
||||
00004018 00004018 00000204 00000204 r-x
|
||||
00004018 00004018 000001ac 000001ac r-x CMBROM_NMI_HANDLER
|
||||
000041c4 000041c4 00000026 00000026 r-x CMBROM_HARDFAULT_HANDLER
|
||||
000041ea 000041ea 00000032 00000032 r-x CMBROM_DEFAULT_HANDLER
|
||||
0000fbfc 0000fbfc 00000b4a 00000b4a r-x
|
||||
0000fbfc 0000fbfc 00000400 00000400 r-- .bootrom_func
|
||||
0000fffc 0000fffc 00000004 00000004 r-- .test_signature1
|
||||
00010000 00010000 00000746 00000746 r-x SCCLSFZ1
|
||||
00015000 00015000 00000baa 00000baa r-x
|
||||
00015000 00015000 00000baa 00000baa r-x SCCLZ1
|
||||
00016000 00016000 00000baa 00000baa r-x
|
||||
00016000 00016000 00000baa 00000baa r-x SCCLZ2
|
||||
20000000 20000000 0000000c 00000000 rw-
|
||||
20000000 20000000 00000004 00000000 rw- BootStatusVariable
|
||||
20000004 20000004 00000004 00000000 rw- UserBootModeVariable
|
||||
20000008 20000008 00000004 00000000 rw- .bss
|
||||
|
||||
|
||||
SECTION ALLOCATION MAP
|
||||
|
||||
output attributes/
|
||||
section page origin length input sections
|
||||
-------- ---- ---------- ---------- ----------------
|
||||
.CMVersion
|
||||
* 0 00000140 00000004
|
||||
00000140 00000004 cmbrom_init_boot.obj (.CMVersion)
|
||||
|
||||
.checksumfuncs
|
||||
* 0 0000024c 00000d04
|
||||
0000024c 000005fc cmbrom_checksum.obj (.checksumfuncs:calculate_checksum)
|
||||
00000848 000001ee cmbrom_checksum.obj (.checksumfuncs:compare_two_composite_checksums)
|
||||
00000a36 0000015e cmbrom_checksum.obj (.checksumfuncs:calculate_composite_checksum_on_rom)
|
||||
00000b94 00000136 cmbrom_checksum.obj (.checksumfuncs:add_to_bitcolumn_checksum)
|
||||
00000cca 000000ea cmbrom_checksum.obj (.checksumfuncs:add_to_factorial_sum)
|
||||
00000db4 000000da cmbrom_checksum.obj (.checksumfuncs:add_to_row_weight_sum)
|
||||
00000e8e 0000008c cmbrom_checksum.obj (.checksumfuncs:verify_checksum_onROM)
|
||||
00000f1a 00000036 cmbrom_checksum.obj (.checksumfuncs:test_reserved_memory)
|
||||
|
||||
CMBROM_NMI_HANDLER
|
||||
* 0 00004018 000001ac
|
||||
00004018 000001ac cmbrom_interrupts.obj (CMBROM_NMI_HANDLER:CMBROM_nmiHandler)
|
||||
|
||||
CMBROM_HARDFAULT_HANDLER
|
||||
* 0 000041c4 00000026
|
||||
000041c4 00000026 cmbrom_interrupts.obj (CMBROM_HARDFAULT_HANDLER:CMBROM_hardFaultISR)
|
||||
|
||||
CMBROM_DEFAULT_HANDLER
|
||||
* 0 000041ea 00000032
|
||||
000041ea 00000032 cmbrom_interrupts.obj (CMBROM_DEFAULT_HANDLER:CMBROM_defaultHandler)
|
||||
|
||||
.bootrom_func
|
||||
* 0 0000fbfc 00000400
|
||||
0000fbfc 00000400 sw_crc.obj (.bootrom_func)
|
||||
|
||||
.test_signature1
|
||||
* 0 0000fffc 00000004
|
||||
0000fffc 00000004 cmbrom_init_boot.obj (.test_signature1)
|
||||
|
||||
.text 0 00000f50 00000a92
|
||||
00000f50 00000298 cmbrom_system_boot.obj (.text:CMBROM_runSelectedBootMode)
|
||||
000011e8 000001da cmbrom_system_boot.obj (.text:CMBROM_startSystemBoot)
|
||||
000013c2 0000014e cmbrom_system_boot.obj (.text:CMBROM_setupDeviceSystems)
|
||||
00001510 00000108 cmbrom_init_boot.obj (.text)
|
||||
00001618 000000b0 cmbrom_system_boot.obj (.text:CMBROM_verifyBootCommand)
|
||||
000016c8 0000007a cmbrom_ipc_msg_copy.obj (.text:CMBROM_performCopyToRAM)
|
||||
00001742 0000007a rtsv7M4_T_le_xo_eabi.lib : memset_t2.obj (.text)
|
||||
000017bc 00000072 cmbrom_system_boot.obj (.text:CMBROM_waitForCommand)
|
||||
0000182e 00000064 cmbrom_system_boot.obj (.text:CMBROM_verifySecureFlash)
|
||||
00001892 00000044 cmbrom_ipc.obj (.text:CMBROM_sendErrorIPC)
|
||||
000018d6 00000030 cmbrom_system_boot.obj (.text:Flash_setBankPowerMode)
|
||||
00001906 00000024 cmbrom_system_boot.obj (.text:Flash_setPumpWakeupTime)
|
||||
0000192a 00000022 cmbrom_system_boot.obj (.text:Flash_setWaitstates)
|
||||
0000194c 00000020 cmbrom_system_boot.obj (.text:Flash_setPumpPowerMode)
|
||||
0000196c 0000001a cmbrom_system_boot.obj (.text:SysCtl_enableWatchdog)
|
||||
00001986 00000016 cmbrom_ipc.obj (.text:CMBROM_setIPCBootStatus)
|
||||
0000199c 00000016 cmbrom_system_boot.obj (.text:SysCtl_clearResetCause)
|
||||
000019b2 00000014 cmbrom_system_boot.obj (.text:Flash_unlockCtrlRegisters)
|
||||
000019c6 00000010 cmbrom_checksum.obj (.text:SysCtl_disableWatchdog)
|
||||
000019d6 0000000c rtsv7M4_T_le_xo_eabi.lib : copy_zero_init.obj (.text:decompress:ZI)
|
||||
|
||||
.BootVecs
|
||||
* 0 00000000 00000140
|
||||
00000000 00000140 cmbrom_vector_table.obj (.BootVecs)
|
||||
|
||||
.BOOT_CKSUMLOC
|
||||
* 0 00000144 00000084
|
||||
00000144 00000084 cmbrom_checksum.obj (.BOOT_CKSUMLOC)
|
||||
|
||||
.CKSUMLOC
|
||||
* 0 000001c8 00000084
|
||||
000001c8 00000084 cmbrom_checksum.obj (.CKSUMLOC)
|
||||
|
||||
.bss 0 20000008 00000004 UNINITIALIZED
|
||||
20000008 00000004 (.common:CMBROM_nmiStatus)
|
||||
|
||||
.cinit 0 000019e8 00000034
|
||||
000019e8 00000008 (.cinit..bss.load) [load image, compression = zero_init]
|
||||
000019f0 00000008 (.cinit.BootStatusVariable.load) [load image, compression = zero_init]
|
||||
000019f8 00000008 (.cinit.UserBootModeVariable.load) [load image, compression = zero_init]
|
||||
00001a00 00000004 (__TI_handler_table)
|
||||
00001a04 00000018 (__TI_cinit_table)
|
||||
|
||||
SCCLSFZ1 0 00010000 00000746
|
||||
00010000 00000456 cmbrom_calculate_cmac.obj (SCCLSFZ1:CMBROM_calculateCMAC)
|
||||
00010456 000000ac cmbrom_calculate_cmac.obj (SCCLSFZ1:CMAC_readMemoryBlockWithSigMask)
|
||||
00010502 0000009a cmbrom_calculate_cmac.obj (SCCLSFZ1:CMAC_generateKey0)
|
||||
0001059c 00000072 cmbrom_calculate_cmac.obj (SCCLSFZ1:CMAC_performOneBitLeftshift)
|
||||
0001060e 0000006e cmbrom_calculate_cmac.obj (SCCLSFZ1:CMAC_generateKey1)
|
||||
0001067c 00000054 cmbrom_calculate_cmac.obj (SCCLSFZ1:CMAC_readGoldenSignature)
|
||||
000106d0 0000003c cmbrom_calculate_cmac.obj (SCCLSFZ1:CMAC_readMemoryBlock)
|
||||
0001070c 00000030 cmbrom_calculate_cmac.obj (SCCLSFZ1:CMAC_memset)
|
||||
0001073c 0000000a cmbrom_calculate_cmac.obj (SCCLSFZ1:CMAC_getControlReg)
|
||||
|
||||
SCCLZ1 0 00015000 00000baa
|
||||
00015000 00000678 ti_internal_cm.obj (SCCLZ1:SecureCRCCalcZ1)
|
||||
00015678 00000444 ti_internal_cm.obj (SCCLZ1:SecureCopyCodeZ1)
|
||||
00015abc 000000ee sw_crc.obj (SCCLZ1:CRCCalcZ1)
|
||||
|
||||
SCCLZ2 0 00016000 00000baa
|
||||
00016000 00000678 ti_internal_cm.obj (SCCLZ2:SecureCRCCalcZ2)
|
||||
00016678 00000444 ti_internal_cm.obj (SCCLZ2:SecureCopyCodeZ2)
|
||||
00016abc 000000ee sw_crc.obj (SCCLZ2:CRCCalcZ2)
|
||||
|
||||
BootStatusVariable
|
||||
* 0 20000000 00000004 UNINITIALIZED
|
||||
20000000 00000004 cmbrom_system_boot.obj (BootStatusVariable)
|
||||
|
||||
UserBootModeVariable
|
||||
* 0 20000004 00000004 UNINITIALIZED
|
||||
20000004 00000004 cmbrom_system_boot.obj (UserBootModeVariable)
|
||||
|
||||
MODULE SUMMARY
|
||||
|
||||
Module code ro data rw data
|
||||
------ ---- ------- -------
|
||||
.\bootROM\source\
|
||||
cmbrom_checksum.obj 3348 264 0
|
||||
cmbrom_system_boot.obj 2080 0 8
|
||||
cmbrom_interrupts.obj 516 0 4
|
||||
cmbrom_vector_table.obj 0 320 0
|
||||
cmbrom_init_boot.obj 264 8 0
|
||||
cmbrom_ipc_msg_copy.obj 122 0 0
|
||||
cmbrom_ipc.obj 90 0 0
|
||||
+--+---------------------------+-------+---------+---------+
|
||||
Total: 6420 592 12
|
||||
|
||||
.\secureROM\
|
||||
ti_internal_cm.obj 5496 0 0
|
||||
cmbrom_calculate_cmac.obj 1862 0 0
|
||||
sw_crc.obj 476 1024 0
|
||||
+--+---------------------------+-------+---------+---------+
|
||||
Total: 7834 1024 0
|
||||
|
||||
C:\ti\ccsv7\tools\compiler\ti-cgt-arm_17.6.0.STS\lib\rtsv7M4_T_le_xo_eabi.lib
|
||||
memset_t2.obj 122 0 0
|
||||
copy_zero_init.obj 12 0 0
|
||||
+--+---------------------------+-------+---------+---------+
|
||||
Total: 134 0 0
|
||||
|
||||
Linker Generated: 0 52 0
|
||||
+--+---------------------------+-------+---------+---------+
|
||||
Grand Total: 14388 1668 12
|
||||
|
||||
|
||||
LINKER GENERATED COPY TABLES
|
||||
|
||||
__TI_cinit_table @ 00001a04 records: 3, size/record: 8, table size: 24
|
||||
.bss: load addr=000019e8, load size=00000008 bytes, run addr=20000008, run size=00000004 bytes, compression=zero_init
|
||||
BootStatusVariable: load addr=000019f0, load size=00000008 bytes, run addr=20000000, run size=00000004 bytes, compression=zero_init
|
||||
UserBootModeVariable: load addr=000019f8, load size=00000008 bytes, run addr=20000004, run size=00000004 bytes, compression=zero_init
|
||||
|
||||
|
||||
LINKER GENERATED HANDLER TABLE
|
||||
|
||||
__TI_handler_table @ 00001a00 records: 1, size/record: 4, table size: 4
|
||||
index: 0, handler: __TI_zero_init
|
||||
|
||||
|
||||
GLOBAL SYMBOLS: SORTED ALPHABETICALLY BY Name
|
||||
|
||||
address name
|
||||
------- ----
|
||||
00010503 CMAC_generateKey0
|
||||
0001060f CMAC_generateKey1
|
||||
0001073d CMAC_getControlReg
|
||||
0001070d CMAC_memset
|
||||
0001059d CMAC_performOneBitLeftshift
|
||||
0001067d CMAC_readGoldenSignature
|
||||
000106d1 CMAC_readMemoryBlock
|
||||
00010457 CMAC_readMemoryBlockWithSigMask
|
||||
20000004 CMBROM_bootMode
|
||||
20000000 CMBROM_bootStatus
|
||||
00010001 CMBROM_calculateCMAC
|
||||
000041eb CMBROM_defaultHandler
|
||||
000041c5 CMBROM_hardFaultISR
|
||||
00004019 CMBROM_nmiHandler
|
||||
20000008 CMBROM_nmiStatus
|
||||
000016c9 CMBROM_performCopyToRAM
|
||||
00000f51 CMBROM_runSelectedBootMode
|
||||
00001893 CMBROM_sendErrorIPC
|
||||
00001987 CMBROM_setIPCBootStatus
|
||||
000013c3 CMBROM_setupDeviceSystems
|
||||
000011e9 CMBROM_startSystemBoot
|
||||
00001619 CMBROM_verifyBootCommand
|
||||
0000182f CMBROM_verifySecureFlash
|
||||
000017bd CMBROM_waitForCommand
|
||||
00001613 CM_performDelay
|
||||
00001511 CM_resetISR
|
||||
00015abd CRCCalcZ1
|
||||
00016abd CRCCalcZ2
|
||||
00015001 SecureCRCCalcZ1
|
||||
00016001 SecureCRCCalcZ2
|
||||
00015679 SecureCopyCodeZ1
|
||||
00016679 SecureCopyCodeZ2
|
||||
00000000 Vectors
|
||||
00001a04 __TI_CINIT_Base
|
||||
00001a1c __TI_CINIT_Limit
|
||||
00001a00 __TI_Handler_Table_Base
|
||||
00001a04 __TI_Handler_Table_Limit
|
||||
ffffffff __TI_pprof_out_hndl
|
||||
ffffffff __TI_prof_data_size
|
||||
ffffffff __TI_prof_data_start
|
||||
00000000 __TI_static_base__
|
||||
000019d7 __TI_zero_init
|
||||
00001743 __aeabi_memclr
|
||||
00001743 __aeabi_memclr4
|
||||
00001743 __aeabi_memclr8
|
||||
00001745 __aeabi_memset
|
||||
00001745 __aeabi_memset4
|
||||
00001745 __aeabi_memset8
|
||||
ffffffff __binit__
|
||||
ffffffff __c_args__
|
||||
00000b95 add_to_bitcolumn_checksum
|
||||
00000ccb add_to_factorial_sum
|
||||
00000db5 add_to_row_weight_sum
|
||||
ffffffff binit
|
||||
00000144 boot_csum_rom
|
||||
0000024d calculate_checksum
|
||||
00000a37 calculate_composite_checksum_on_rom
|
||||
00000140 cmbrom_version
|
||||
00000849 compare_two_composite_checksums
|
||||
000001c8 composite_checksum_in_rom
|
||||
0000174b memset
|
||||
00000f1b test_reserved_memory
|
||||
00000e8f verify_checksum_onROM
|
||||
|
||||
|
||||
GLOBAL SYMBOLS: SORTED BY Symbol Address
|
||||
|
||||
address name
|
||||
------- ----
|
||||
00000000 Vectors
|
||||
00000000 __TI_static_base__
|
||||
00000140 cmbrom_version
|
||||
00000144 boot_csum_rom
|
||||
000001c8 composite_checksum_in_rom
|
||||
0000024d calculate_checksum
|
||||
00000849 compare_two_composite_checksums
|
||||
00000a37 calculate_composite_checksum_on_rom
|
||||
00000b95 add_to_bitcolumn_checksum
|
||||
00000ccb add_to_factorial_sum
|
||||
00000db5 add_to_row_weight_sum
|
||||
00000e8f verify_checksum_onROM
|
||||
00000f1b test_reserved_memory
|
||||
00000f51 CMBROM_runSelectedBootMode
|
||||
000011e9 CMBROM_startSystemBoot
|
||||
000013c3 CMBROM_setupDeviceSystems
|
||||
00001511 CM_resetISR
|
||||
00001613 CM_performDelay
|
||||
00001619 CMBROM_verifyBootCommand
|
||||
000016c9 CMBROM_performCopyToRAM
|
||||
00001743 __aeabi_memclr
|
||||
00001743 __aeabi_memclr4
|
||||
00001743 __aeabi_memclr8
|
||||
00001745 __aeabi_memset
|
||||
00001745 __aeabi_memset4
|
||||
00001745 __aeabi_memset8
|
||||
0000174b memset
|
||||
000017bd CMBROM_waitForCommand
|
||||
0000182f CMBROM_verifySecureFlash
|
||||
00001893 CMBROM_sendErrorIPC
|
||||
00001987 CMBROM_setIPCBootStatus
|
||||
000019d7 __TI_zero_init
|
||||
00001a00 __TI_Handler_Table_Base
|
||||
00001a04 __TI_CINIT_Base
|
||||
00001a04 __TI_Handler_Table_Limit
|
||||
00001a1c __TI_CINIT_Limit
|
||||
00004019 CMBROM_nmiHandler
|
||||
000041c5 CMBROM_hardFaultISR
|
||||
000041eb CMBROM_defaultHandler
|
||||
00010001 CMBROM_calculateCMAC
|
||||
00010457 CMAC_readMemoryBlockWithSigMask
|
||||
00010503 CMAC_generateKey0
|
||||
0001059d CMAC_performOneBitLeftshift
|
||||
0001060f CMAC_generateKey1
|
||||
0001067d CMAC_readGoldenSignature
|
||||
000106d1 CMAC_readMemoryBlock
|
||||
0001070d CMAC_memset
|
||||
0001073d CMAC_getControlReg
|
||||
00015001 SecureCRCCalcZ1
|
||||
00015679 SecureCopyCodeZ1
|
||||
00015abd CRCCalcZ1
|
||||
00016001 SecureCRCCalcZ2
|
||||
00016679 SecureCopyCodeZ2
|
||||
00016abd CRCCalcZ2
|
||||
20000000 CMBROM_bootStatus
|
||||
20000004 CMBROM_bootMode
|
||||
20000008 CMBROM_nmiStatus
|
||||
ffffffff __TI_pprof_out_hndl
|
||||
ffffffff __TI_prof_data_size
|
||||
ffffffff __TI_prof_data_start
|
||||
ffffffff __binit__
|
||||
ffffffff __c_args__
|
||||
ffffffff binit
|
||||
|
||||
[63 symbols]
|
||||
BIN
Binary file not shown.
+4441
File diff suppressed because it is too large.
Load diff
+46
@@ -0,0 +1,46 @@
|
||||
//###########################################################################
|
||||
//
|
||||
// FILE: cla_data_rom_lnk.cmd
|
||||
//
|
||||
// TITLE: CLA data rom linker command file
|
||||
//
|
||||
//###########################################################################
|
||||
// $TI Release: $
|
||||
// $Release Date: $
|
||||
//###########################################################################
|
||||
|
||||
--retain '(.CLA1fftTables)'
|
||||
--retain '(CLA1mathTables)'
|
||||
--retain '(.CROMVersion)'
|
||||
|
||||
MEMORY
|
||||
{
|
||||
|
||||
CLA1_DATAROM_RESERVED : origin = 0x01001000, length = 0x000070 //, fill = 0xFFFF
|
||||
CLA1_FFT_TABLES : origin = 0x01001070, length = 0x000800 //, fill = 0xFFFF
|
||||
CLA1_DATAROM : origin = 0x01001870, length = 0x00078a //, fill = 0xFFFF
|
||||
CROM_VERSION : origin = 0x01001FFA, length = 0x000006 //, fill = 0xFFFF
|
||||
|
||||
CLA1_DATAROM_RESERVED_RUN : origin = 0x0000F000, length = 0x000070
|
||||
CLA1_FFT_TABLES_RUN : origin = 0x0000F070, length = 0x000800
|
||||
CLA1_DATAROM_RUN : origin = 0x0000F870, length = 0x00078a
|
||||
CROM_VERSION_RUN : origin = 0x0000FFFA, length = 0x000006
|
||||
|
||||
|
||||
/* CLA1_DATAROM : origin = 0x01001000, length = 0x001000*/
|
||||
}
|
||||
|
||||
|
||||
SECTIONS
|
||||
{
|
||||
.CLA1fftTables : load = CLA1_FFT_TABLES, ALIGN(2) //, run = CLA1_FFT_TABLES_RUN , ALIGN(2)
|
||||
CLA1mathTables : load = CLA1_DATAROM//, run = CLA1_DATAROM_RUN
|
||||
.CROMVersion : load = CROM_VERSION//, run = CROM_VERSION_RUN
|
||||
|
||||
}
|
||||
|
||||
/*
|
||||
//===========================================================================
|
||||
// End of file.
|
||||
//===========================================================================
|
||||
*/
|
||||
+20
@@ -0,0 +1,20 @@
|
||||
;;###########################################################################
|
||||
;;
|
||||
;; FILE: cla_rom_version.asm
|
||||
;;
|
||||
;; TITLE: CLA data ROM Version and checksum values.
|
||||
;;
|
||||
;; Functions:
|
||||
;;
|
||||
;;
|
||||
;; Notes:
|
||||
;;
|
||||
;;###########################################################################
|
||||
;; $TI Release: $
|
||||
;; $Release Date: $
|
||||
;;###########################################################################
|
||||
|
||||
.sect ".CROMVersion"
|
||||
.word 0x0100 ; CLA ROM Version v1.0
|
||||
.word 0x0318 ; Month/Year: (ex: 0x0318 = 3/18 = March 2018)
|
||||
|
||||
+1330
File diff suppressed because it is too large.
Load diff
+252
@@ -0,0 +1,252 @@
|
||||
;******************************************************************************
|
||||
;
|
||||
; FILE: CLASinCosTable.asm
|
||||
;
|
||||
; DESCRIPTION: Sine and Cosine Tables
|
||||
;
|
||||
;******************************************************************************
|
||||
; $TI Release: $
|
||||
; $Release Date: $
|
||||
;******************************************************************************
|
||||
; This software is licensed for use with Texas Instruments C28x
|
||||
; family DSCs. This license was provided to you prior to installing
|
||||
; the software. You may review this license by consulting a copy of
|
||||
; the agreement in the doc directory of this library.
|
||||
; ------------------------------------------------------------------------
|
||||
; Copyright (C) 2010-2011 Texas Instruments, Incorporated.
|
||||
; All Rights Reserved.
|
||||
;******************************************************************************
|
||||
|
||||
;############################################################################
|
||||
;/*! \defgroup CLAMATH_TABLES (Math Tables)
|
||||
; @{
|
||||
;*/
|
||||
;############################################################################
|
||||
.if __TI_EABI__
|
||||
.asg CLAsincosTable,_CLAsincosTable
|
||||
.asg CLAsinTable,_CLAsinTable
|
||||
.asg CLAsincosTable_Sin0,_CLAsincosTable_Sin0
|
||||
.asg CLAcosTable,_CLAcosTable
|
||||
.asg CLAsincosTable_Cos0,_CLAsincosTable_Cos0
|
||||
.asg CLAsinTableEnd,_CLAsinTableEnd
|
||||
.asg CLAcosTableEnd,_CLAcosTableEnd
|
||||
.asg CLAsincosTable_TABLE_SIZE,_CLAsincosTable_TABLE_SIZE
|
||||
.asg CLAsincosTable_TABLE_SIZEDivTwoPi,_CLAsincosTable_TABLE_SIZEDivTwoPi
|
||||
.asg CLAsincosTable_TwoPiDivTABLE_SIZE,_CLAsincosTable_TwoPiDivTABLE_SIZE
|
||||
.asg CLAsincosTable_TABLE_MASK,_CLAsincosTable_TABLE_MASK
|
||||
.asg CLAsincosTable_Coef0,_CLAsincosTable_Coef0
|
||||
.asg CLAsincosTable_Coef1,_CLAsincosTable_Coef1
|
||||
.asg CLAsincosTable_Coef1_pos,_CLAsincosTable_Coef1_pos
|
||||
.asg CLAsincosTable_Coef2,_CLAsincosTable_Coef2
|
||||
.asg CLAsincosTable_Coef3,_CLAsincosTable_Coef3
|
||||
.asg CLAsincosTable_Coef3_neg,_CLAsincosTable_Coef3_neg
|
||||
.asg CLAsincosTableEnd,_CLAsincosTableEnd
|
||||
.endif
|
||||
|
||||
.def _CLAsincosTable
|
||||
.def _CLAsinTable
|
||||
.def _CLAsincosTable_Sin0
|
||||
.def _CLAcosTable
|
||||
.def _CLAsincosTable_Cos0
|
||||
.def _CLAsinTableEnd
|
||||
.def _CLAcosTableEnd
|
||||
.def _CLAsincosTable_TABLE_SIZE
|
||||
.def _CLAsincosTable_TABLE_SIZEDivTwoPi
|
||||
.def _CLAsincosTable_TwoPiDivTABLE_SIZE
|
||||
.def _CLAsincosTable_TABLE_MASK
|
||||
.def _CLAsincosTable_Coef0
|
||||
.def _CLAsincosTable_Coef1
|
||||
.def _CLAsincosTable_Coef1_pos
|
||||
.def _CLAsincosTable_Coef2
|
||||
.def _CLAsincosTable_Coef3
|
||||
.def _CLAsincosTable_Coef3_neg
|
||||
.def _CLAsincosTableEnd
|
||||
|
||||
.sect "CLA1mathTables"
|
||||
|
||||
_CLAsincosTable:
|
||||
_CLAsinTable:
|
||||
_CLAsincosTable_Sin0:
|
||||
.float 0.0; ; sin( 0 * 2*pi/TABLE_SIZE)
|
||||
.float 0.04906767432742; ; sin( 1 * 2*pi/TABLE_SIZE)
|
||||
.float 0.09801714032956; ; sin( 2 * 2*pi/TABLE_SIZE)
|
||||
.float 0.1467304744553; ; sin( 3 * 2*pi/TABLE_SIZE)
|
||||
.float 0.1950903220162; ; sin( 4 * 2*pi/TABLE_SIZE)
|
||||
.float 0.2429801799032; ; sin( 5 * 2*pi/TABLE_SIZE)
|
||||
.float 0.2902846772544; ; sin( 6 * 2*pi/TABLE_SIZE)
|
||||
.float 0.3368898533922; ; sin( 7 * 2*pi/TABLE_SIZE)
|
||||
.float 0.3826834323651; ; sin( 8 * 2*pi/TABLE_SIZE)
|
||||
.float 0.4275550934303; ; sin( 9 * 2*pi/TABLE_SIZE)
|
||||
.float 0.4713967368260; ; sin( 10 * 2*pi/TABLE_SIZE)
|
||||
.float 0.5141027441932; ; sin( 11 * 2*pi/TABLE_SIZE)
|
||||
.float 0.5555702330196; ; sin( 12 * 2*pi/TABLE_SIZE)
|
||||
.float 0.5956993044925; ; sin( 13 * 2*pi/TABLE_SIZE)
|
||||
.float 0.6343932841637; ; sin( 14 * 2*pi/TABLE_SIZE)
|
||||
.float 0.6715589548470; ; sin( 15 * 2*pi/TABLE_SIZE)
|
||||
.float 0.7071067811865; ; sin( 16 * 2*pi/TABLE_SIZE)
|
||||
.float 0.7409511253549; ; sin( 17 * 2*pi/TABLE_SIZE)
|
||||
.float 0.7730104533627; ; sin( 18 * 2*pi/TABLE_SIZE)
|
||||
.float 0.8032075314806; ; sin( 19 * 2*pi/TABLE_SIZE)
|
||||
.float 0.8314696123026; ; sin( 20 * 2*pi/TABLE_SIZE)
|
||||
.float 0.8577286100001; ; sin( 21 * 2*pi/TABLE_SIZE)
|
||||
.float 0.8819212643481; ; sin( 22 * 2*pi/TABLE_SIZE)
|
||||
.float 0.9039892931235; ; sin( 23 * 2*pi/TABLE_SIZE)
|
||||
.float 0.9238795325113; ; sin( 24 * 2*pi/TABLE_SIZE)
|
||||
.float 0.9415440651832; ; sin( 25 * 2*pi/TABLE_SIZE)
|
||||
.float 0.9569403357322; ; sin( 26 * 2*pi/TABLE_SIZE)
|
||||
.float 0.9700312531945; ; sin( 27 * 2*pi/TABLE_SIZE)
|
||||
.float 0.9807852804033; ; sin( 28 * 2*pi/TABLE_SIZE)
|
||||
.float 0.9891765099649; ; sin( 29 * 2*pi/TABLE_SIZE)
|
||||
.float 0.9951847266721; ; sin( 30 * 2*pi/TABLE_SIZE)
|
||||
.float 0.9987954562052; ; sin( 31 * 2*pi/TABLE_SIZE)
|
||||
|
||||
_CLAcosTable:
|
||||
_CLAsincosTable_Cos0:
|
||||
.float 1.0; ; sin( 32 * 2*pi/TABLE_SIZE)
|
||||
.float 0.9987954562052; ; sin( 33 * 2*pi/TABLE_SIZE)
|
||||
.float 0.9951847266721; ; sin( 34 * 2*pi/TABLE_SIZE)
|
||||
.float 0.9891765099649; ; sin( 35 * 2*pi/TABLE_SIZE)
|
||||
.float 0.9807852804033; ; sin( 36 * 2*pi/TABLE_SIZE)
|
||||
.float 0.9700312531945; ; sin( 37 * 2*pi/TABLE_SIZE)
|
||||
.float 0.9569403357322; ; sin( 38 * 2*pi/TABLE_SIZE)
|
||||
.float 0.9415440651832; ; sin( 39 * 2*pi/TABLE_SIZE)
|
||||
.float 0.9238795325113; ; sin( 40 * 2*pi/TABLE_SIZE)
|
||||
.float 0.9039892931235; ; sin( 41 * 2*pi/TABLE_SIZE)
|
||||
.float 0.8819212643481; ; sin( 42 * 2*pi/TABLE_SIZE)
|
||||
.float 0.8577286100001; ; sin( 43 * 2*pi/TABLE_SIZE)
|
||||
.float 0.8314696123026; ; sin( 44 * 2*pi/TABLE_SIZE)
|
||||
.float 0.8032075314806; ; sin( 45 * 2*pi/TABLE_SIZE)
|
||||
.float 0.7730104533627; ; sin( 46 * 2*pi/TABLE_SIZE)
|
||||
.float 0.7409511253549; ; sin( 47 * 2*pi/TABLE_SIZE)
|
||||
.float 0.7071067811865; ; sin( 48 * 2*pi/TABLE_SIZE)
|
||||
.float 0.6715589548470; ; sin( 49 * 2*pi/TABLE_SIZE)
|
||||
.float 0.6343932841637; ; sin( 50 * 2*pi/TABLE_SIZE)
|
||||
.float 0.5956993044925; ; sin( 51 * 2*pi/TABLE_SIZE)
|
||||
.float 0.5555702330196; ; sin( 52 * 2*pi/TABLE_SIZE)
|
||||
.float 0.5141027441932; ; sin( 53 * 2*pi/TABLE_SIZE)
|
||||
.float 0.4713967368260; ; sin( 54 * 2*pi/TABLE_SIZE)
|
||||
.float 0.4275550934303; ; sin( 55 * 2*pi/TABLE_SIZE)
|
||||
.float 0.3826834323651; ; sin( 56 * 2*pi/TABLE_SIZE)
|
||||
.float 0.3368898533922; ; sin( 57 * 2*pi/TABLE_SIZE)
|
||||
.float 0.2902846772544; ; sin( 58 * 2*pi/TABLE_SIZE)
|
||||
.float 0.2429801799032; ; sin( 59 * 2*pi/TABLE_SIZE)
|
||||
.float 0.1950903220162; ; sin( 60 * 2*pi/TABLE_SIZE)
|
||||
.float 0.1467304744553; ; sin( 61 * 2*pi/TABLE_SIZE)
|
||||
.float 0.09801714032956; ; sin( 62 * 2*pi/TABLE_SIZE)
|
||||
.float 0.04906767432742; ; sin( 63 * 2*pi/TABLE_SIZE)
|
||||
.float 0.0; ; sin( 64 * 2*pi/TABLE_SIZE)
|
||||
.float -0.04906767432742; ; sin( 65 * 2*pi/TABLE_SIZE)
|
||||
.float -0.09801714032956; ; sin( 66 * 2*pi/TABLE_SIZE)
|
||||
.float -0.1467304744553; ; sin( 67 * 2*pi/TABLE_SIZE)
|
||||
.float -0.1950903220162; ; sin( 68 * 2*pi/TABLE_SIZE)
|
||||
.float -0.2429801799032; ; sin( 69 * 2*pi/TABLE_SIZE)
|
||||
.float -0.2902846772544; ; sin( 70 * 2*pi/TABLE_SIZE)
|
||||
.float -0.3368898533922; ; sin( 71 * 2*pi/TABLE_SIZE)
|
||||
.float -0.3826834323651; ; sin( 72 * 2*pi/TABLE_SIZE)
|
||||
.float -0.4275550934303; ; sin( 73 * 2*pi/TABLE_SIZE)
|
||||
.float -0.4713967368260; ; sin( 74 * 2*pi/TABLE_SIZE)
|
||||
.float -0.5141027441932; ; sin( 75 * 2*pi/TABLE_SIZE)
|
||||
.float -0.5555702330196; ; sin( 76 * 2*pi/TABLE_SIZE)
|
||||
.float -0.5956993044925; ; sin( 77 * 2*pi/TABLE_SIZE)
|
||||
.float -0.6343932841637; ; sin( 78 * 2*pi/TABLE_SIZE)
|
||||
.float -0.6715589548470; ; sin( 79 * 2*pi/TABLE_SIZE)
|
||||
.float -0.7071067811865; ; sin( 80 * 2*pi/TABLE_SIZE)
|
||||
.float -0.7409511253549; ; sin( 81 * 2*pi/TABLE_SIZE)
|
||||
.float -0.7730104533627; ; sin( 82 * 2*pi/TABLE_SIZE)
|
||||
.float -0.8032075314806; ; sin( 83 * 2*pi/TABLE_SIZE)
|
||||
.float -0.8314696123026; ; sin( 84 * 2*pi/TABLE_SIZE)
|
||||
.float -0.8577286100001; ; sin( 85 * 2*pi/TABLE_SIZE)
|
||||
.float -0.8819212643481; ; sin( 86 * 2*pi/TABLE_SIZE)
|
||||
.float -0.9039892931235; ; sin( 87 * 2*pi/TABLE_SIZE)
|
||||
.float -0.9238795325113; ; sin( 88 * 2*pi/TABLE_SIZE)
|
||||
.float -0.9415440651832; ; sin( 89 * 2*pi/TABLE_SIZE)
|
||||
.float -0.9569403357322; ; sin( 90 * 2*pi/TABLE_SIZE)
|
||||
.float -0.9700312531945; ; sin( 91 * 2*pi/TABLE_SIZE)
|
||||
.float -0.9807852804033; ; sin( 92 * 2*pi/TABLE_SIZE)
|
||||
.float -0.9891765099649; ; sin( 93 * 2*pi/TABLE_SIZE)
|
||||
.float -0.9951847266721; ; sin( 94 * 2*pi/TABLE_SIZE)
|
||||
.float -0.9987954562052; ; sin( 95 * 2*pi/TABLE_SIZE)
|
||||
.float -1.0; ; sin( 96 * 2*pi/TABLE_SIZE)
|
||||
.float -0.9987954562052; ; sin( 97 * 2*pi/TABLE_SIZE)
|
||||
.float -0.9951847266721; ; sin( 98 * 2*pi/TABLE_SIZE)
|
||||
.float -0.9891765099649; ; sin( 99 * 2*pi/TABLE_SIZE)
|
||||
.float -0.9807852804033; ; sin(100 * 2*pi/TABLE_SIZE)
|
||||
.float -0.9700312531945; ; sin(101 * 2*pi/TABLE_SIZE)
|
||||
.float -0.9569403357322; ; sin(102 * 2*pi/TABLE_SIZE)
|
||||
.float -0.9415440651832; ; sin(103 * 2*pi/TABLE_SIZE)
|
||||
.float -0.9238795325113; ; sin(104 * 2*pi/TABLE_SIZE)
|
||||
.float -0.9039892931235; ; sin(105 * 2*pi/TABLE_SIZE)
|
||||
.float -0.8819212643481; ; sin(106 * 2*pi/TABLE_SIZE)
|
||||
.float -0.8577286100001; ; sin(107 * 2*pi/TABLE_SIZE)
|
||||
.float -0.8314696123026; ; sin(108 * 2*pi/TABLE_SIZE)
|
||||
.float -0.8032075314806; ; sin(109 * 2*pi/TABLE_SIZE)
|
||||
.float -0.7730104533627; ; sin(110 * 2*pi/TABLE_SIZE)
|
||||
.float -0.7409511253549; ; sin(111 * 2*pi/TABLE_SIZE)
|
||||
.float -0.7071067811865; ; sin(112 * 2*pi/TABLE_SIZE)
|
||||
.float -0.6715589548470; ; sin(113 * 2*pi/TABLE_SIZE)
|
||||
.float -0.6343932841637; ; sin(114 * 2*pi/TABLE_SIZE)
|
||||
.float -0.5956993044925; ; sin(115 * 2*pi/TABLE_SIZE)
|
||||
.float -0.5555702330196; ; sin(116 * 2*pi/TABLE_SIZE)
|
||||
.float -0.5141027441932; ; sin(117 * 2*pi/TABLE_SIZE)
|
||||
.float -0.4713967368260; ; sin(118 * 2*pi/TABLE_SIZE)
|
||||
.float -0.4275550934303; ; sin(119 * 2*pi/TABLE_SIZE)
|
||||
.float -0.3826834323651; ; sin(120 * 2*pi/TABLE_SIZE)
|
||||
.float -0.3368898533922; ; sin(121 * 2*pi/TABLE_SIZE)
|
||||
.float -0.2902846772544; ; sin(122 * 2*pi/TABLE_SIZE)
|
||||
.float -0.2429801799032; ; sin(123 * 2*pi/TABLE_SIZE)
|
||||
.float -0.1950903220162; ; sin(124 * 2*pi/TABLE_SIZE)
|
||||
.float -0.1467304744553; ; sin(125 * 2*pi/TABLE_SIZE)
|
||||
.float -0.09801714032956; ; sin(126 * 2*pi/TABLE_SIZE)
|
||||
.float -0.04906767432742; ; sin(127 * 2*pi/TABLE_SIZE)
|
||||
_CLAsinTableEnd:
|
||||
.float 0.0; ; sin( 0 * 2*pi/TABLE_SIZE)
|
||||
.float 0.04906767432742; ; sin( 1 * 2*pi/TABLE_SIZE)
|
||||
.float 0.09801714032956; ; sin( 2 * 2*pi/TABLE_SIZE)
|
||||
.float 0.1467304744553; ; sin( 3 * 2*pi/TABLE_SIZE)
|
||||
.float 0.1950903220162; ; sin( 4 * 2*pi/TABLE_SIZE)
|
||||
.float 0.2429801799032; ; sin( 5 * 2*pi/TABLE_SIZE)
|
||||
.float 0.2902846772544; ; sin( 6 * 2*pi/TABLE_SIZE)
|
||||
.float 0.3368898533922; ; sin( 7 * 2*pi/TABLE_SIZE)
|
||||
.float 0.3826834323651; ; sin( 8 * 2*pi/TABLE_SIZE)
|
||||
.float 0.4275550934303; ; sin( 9 * 2*pi/TABLE_SIZE)
|
||||
.float 0.4713967368260; ; sin( 10 * 2*pi/TABLE_SIZE)
|
||||
.float 0.5141027441932; ; sin( 11 * 2*pi/TABLE_SIZE)
|
||||
.float 0.5555702330196; ; sin( 12 * 2*pi/TABLE_SIZE)
|
||||
.float 0.5956993044925; ; sin( 13 * 2*pi/TABLE_SIZE)
|
||||
.float 0.6343932841637; ; sin( 14 * 2*pi/TABLE_SIZE)
|
||||
.float 0.6715589548470; ; sin( 15 * 2*pi/TABLE_SIZE)
|
||||
.float 0.7071067811865; ; sin( 16 * 2*pi/TABLE_SIZE)
|
||||
.float 0.7409511253549; ; sin( 17 * 2*pi/TABLE_SIZE)
|
||||
.float 0.7730104533627; ; sin( 18 * 2*pi/TABLE_SIZE)
|
||||
.float 0.8032075314806; ; sin( 19 * 2*pi/TABLE_SIZE)
|
||||
.float 0.8314696123026; ; sin( 20 * 2*pi/TABLE_SIZE)
|
||||
.float 0.8577286100001; ; sin( 21 * 2*pi/TABLE_SIZE)
|
||||
.float 0.8819212643481; ; sin( 22 * 2*pi/TABLE_SIZE)
|
||||
.float 0.9039892931235; ; sin( 23 * 2*pi/TABLE_SIZE)
|
||||
.float 0.9238795325113; ; sin( 24 * 2*pi/TABLE_SIZE)
|
||||
.float 0.9415440651832; ; sin( 25 * 2*pi/TABLE_SIZE)
|
||||
.float 0.9569403357322; ; sin( 26 * 2*pi/TABLE_SIZE)
|
||||
.float 0.9700312531945; ; sin( 27 * 2*pi/TABLE_SIZE)
|
||||
.float 0.9807852804033; ; sin( 28 * 2*pi/TABLE_SIZE)
|
||||
.float 0.9891765099649; ; sin( 29 * 2*pi/TABLE_SIZE)
|
||||
.float 0.9951847266721; ; sin( 30 * 2*pi/TABLE_SIZE)
|
||||
.float 0.9987954562052; ; sin( 31 * 2*pi/TABLE_SIZE)
|
||||
.float 1.0; ; sin( 32 * 2*pi/TABLE_SIZE)
|
||||
_CLAcosTableEnd:
|
||||
|
||||
|
||||
_CLAsincosTable_TABLE_SIZE .float 128.0
|
||||
_CLAsincosTable_TABLE_SIZEDivTwoPi .float 20.37183271576
|
||||
_CLAsincosTable_TwoPiDivTABLE_SIZE .float 0.04908738521234
|
||||
_CLAsincosTable_TABLE_MASK .long 0x0000007F;
|
||||
_CLAsincosTable_Coef0 .float -0.5;
|
||||
_CLAsincosTable_Coef1 .float -0.1666666666666;
|
||||
_CLAsincosTable_Coef1_pos .float 0.1666666666666;
|
||||
_CLAsincosTable_Coef2 .float 4.1666666666666e-2;
|
||||
_CLAsincosTable_Coef3 .float 8.3333333333333e-3;
|
||||
_CLAsincosTable_Coef3_neg .float -8.3333333333333e-3;
|
||||
_CLAsincosTableEnd:
|
||||
|
||||
;############################################################################
|
||||
;//! @}
|
||||
;############################################################################
|
||||
+241
@@ -0,0 +1,241 @@
|
||||
;******************************************************************************
|
||||
;
|
||||
; FILE: CLAacosineTable.asm
|
||||
;
|
||||
; DESCRIPTION: acosine Tables
|
||||
;
|
||||
;******************************************************************************
|
||||
; $TI Release: $
|
||||
; $Release Date: $
|
||||
;******************************************************************************
|
||||
; This software is licensed for use with Texas Instruments C28x
|
||||
; family DSCs. This license was provided to you prior to installing
|
||||
; the software. You may review this license by consulting a copy of
|
||||
; the agreement in the doc directory of this library.
|
||||
; ------------------------------------------------------------------------
|
||||
; Copyright (C) 2010-2011 Texas Instruments, Incorporated.
|
||||
; All Rights Reserved.
|
||||
;******************************************************************************
|
||||
|
||||
;############################################################################
|
||||
;/*! \addtogroup CLAMATH_TABLES
|
||||
; @{
|
||||
;*/
|
||||
;############################################################################
|
||||
|
||||
.if __TI_EABI__
|
||||
.asg CLAacosinHalfPITable,_CLAacosinHalfPITable
|
||||
.asg CLAacosinTable,_CLAacosinTable
|
||||
.asg CLAacosinTableEnd,_CLAacosinTableEnd
|
||||
.endif
|
||||
|
||||
.def _CLAacosinHalfPITable
|
||||
.def _CLAacosinTable
|
||||
.def _CLAacosinTableEnd
|
||||
|
||||
.sect "CLA1mathTables"
|
||||
|
||||
_CLAacosinHalfPITable:
|
||||
.float 2.0 ; 2.0
|
||||
.float 3.141592653589 ; PI
|
||||
|
||||
_CLAacosinTable:
|
||||
.float 1.570795690593 ;
|
||||
.float -0.999877862610 ;
|
||||
.float -0.007815361896 ;
|
||||
.float 1.570791227101 ;
|
||||
.float -0.999510644409 ;
|
||||
.float -0.015647916155 ;
|
||||
.float 1.570779058483 ;
|
||||
.float -0.998895919094 ;
|
||||
.float -0.023514960332 ;
|
||||
.float 1.570755205030 ;
|
||||
.float -0.998029615282 ;
|
||||
.float -0.031434003631 ;
|
||||
.float 1.570715532275 ;
|
||||
.float -0.996905974725 ;
|
||||
.float -0.039422875916 ;
|
||||
.float 1.570655695706 ;
|
||||
.float -0.995517492804 ;
|
||||
.float -0.047499840611 ;
|
||||
.float 1.570571082211 ;
|
||||
.float -0.993854840311 ;
|
||||
.float -0.055683712914 ;
|
||||
.float 1.570456747283 ;
|
||||
.float -0.991906765146 ;
|
||||
.float -0.063993984848 ;
|
||||
.float 1.570307346943 ;
|
||||
.float -0.989659972212 ;
|
||||
.float -0.072450958820 ;
|
||||
.float 1.570117063183 ;
|
||||
.float -0.987098979366 ;
|
||||
.float -0.081075891529 ;
|
||||
.float 1.569879521613 ;
|
||||
.float -0.984205946802 ;
|
||||
.float -0.089891150305 ;
|
||||
.float 1.569587699755 ;
|
||||
.float -0.980960476685 ;
|
||||
.float -0.098920384204 ;
|
||||
.float 1.569233824246 ;
|
||||
.float -0.977339379243 ;
|
||||
.float -0.108188712551 ;
|
||||
.float 1.568809254867 ;
|
||||
.float -0.973316400729 ;
|
||||
.float -0.117722933997 ;
|
||||
.float 1.568304353010 ;
|
||||
.float -0.968861907789 ;
|
||||
.float -0.127551759665 ;
|
||||
.float 1.567708331742 ;
|
||||
.float -0.963942521723 ;
|
||||
.float -0.137706074532 ;
|
||||
.float 1.567009084103 ;
|
||||
.float -0.958520694794 ;
|
||||
.float -0.148219231941 ;
|
||||
.float 1.566192985657 ;
|
||||
.float -0.952554219267 ;
|
||||
.float -0.159127386977 ;
|
||||
.float 1.565244666501 ;
|
||||
.float -0.945995657913 ;
|
||||
.float -0.170469875522 ;
|
||||
.float 1.564146746998 ;
|
||||
.float -0.938791682505 ;
|
||||
.float -0.182289647088 ;
|
||||
.float 1.562879530320 ;
|
||||
.float -0.930882303984 ;
|
||||
.float -0.194633761132 ;
|
||||
.float 1.561420643385 ;
|
||||
.float -0.922199974574 ;
|
||||
.float -0.207553958472 ;
|
||||
.float 1.559744615987 ;
|
||||
.float -0.912668537890 ;
|
||||
.float -0.221107321885 ;
|
||||
.float 1.557822385620 ;
|
||||
.float -0.902201997769 ;
|
||||
.float -0.235357042896 ;
|
||||
.float 1.555620712621 ;
|
||||
.float -0.890703070035 ;
|
||||
.float -0.250373315541 ;
|
||||
.float 1.553101486693 ;
|
||||
.float -0.878061473098 ;
|
||||
.float -0.266234382514 ;
|
||||
.float 1.550220901258 ;
|
||||
.float -0.864151902887 ;
|
||||
.float -0.283027765009 ;
|
||||
.float 1.546928466282 ;
|
||||
.float -0.848831624374 ;
|
||||
.float -0.300851714968 ;
|
||||
.float 1.543165822740 ;
|
||||
.float -0.831937595031 ;
|
||||
.float -0.319816937941 ;
|
||||
.float 1.538865312248 ;
|
||||
.float -0.813283013821 ;
|
||||
.float -0.340048646894 ;
|
||||
.float 1.533948242840 ;
|
||||
.float -0.792653161200 ;
|
||||
.float -0.361689022958 ;
|
||||
.float 1.528322775521 ;
|
||||
.float -0.769800358920 ;
|
||||
.float -0.384900179460 ;
|
||||
.float 1.521881334589 ;
|
||||
.float -0.744437830278 ;
|
||||
.float -0.409867752228 ;
|
||||
.float 1.514497416045 ;
|
||||
.float -0.716232177740 ;
|
||||
.float -0.436805274317 ;
|
||||
.float 1.506021630009 ;
|
||||
.float -0.684794109766 ;
|
||||
.float -0.465959540059 ;
|
||||
.float 1.496276761095 ;
|
||||
.float -0.649666934178 ;
|
||||
.float -0.497617226179 ;
|
||||
.float 1.485051559906 ;
|
||||
.float -0.610312179660 ;
|
||||
.float -0.532113122767 ;
|
||||
.float 1.472092881189 ;
|
||||
.float -0.566091493186 ;
|
||||
.float -0.569840443472 ;
|
||||
.float 1.457095648266 ;
|
||||
.float -0.516243664372 ;
|
||||
.float -0.611263845480 ;
|
||||
.float 1.439689931785 ;
|
||||
.float -0.459855210927 ;
|
||||
.float -0.656936015611 ;
|
||||
.float 1.419424157563 ;
|
||||
.float -0.395822366759 ;
|
||||
.float -0.707518998893 ;
|
||||
.float 1.395743063136 ;
|
||||
.float -0.322801460177 ;
|
||||
.float -0.763811905770 ;
|
||||
.float 1.367958442925 ;
|
||||
.float -0.239143420888 ;
|
||||
.float -0.826787304376 ;
|
||||
.float 1.335209858030 ;
|
||||
.float -0.142806299514 ;
|
||||
.float -0.897639596948 ;
|
||||
.float 1.296411176970 ;
|
||||
.float -0.031236880585 ;
|
||||
.float -0.977850174820 ;
|
||||
.float 1.250176790856 ;
|
||||
.float 0.098791845166 ;
|
||||
.float -1.069276441800 ;
|
||||
.float 1.194718157174 ;
|
||||
.float 0.251407364538 ;
|
||||
.float -1.174275392129 ;
|
||||
.float 1.127696183180 ;
|
||||
.float 0.431959397725 ;
|
||||
.float -1.295878193174 ;
|
||||
.float 1.046006454968 ;
|
||||
.float 0.647485610469 ;
|
||||
.float -1.438041695773 ;
|
||||
.float 0.945459855532 ;
|
||||
.float 0.907400624736 ;
|
||||
.float -1.606018804842 ;
|
||||
.float 0.820295736860 ;
|
||||
.float 1.224540947101 ;
|
||||
.float -1.806917563896 ;
|
||||
.float 0.662418669454 ;
|
||||
.float 1.616794995066 ;
|
||||
.float -2.050569262035 ;
|
||||
.float 0.460162432609 ;
|
||||
.float 2.109729648039 ;
|
||||
.float -2.350920816737 ;
|
||||
.float 0.196211605358 ;
|
||||
.float 2.740985157716 ;
|
||||
.float -2.728353889708 ;
|
||||
.float -0.156051915958 ;
|
||||
.float 3.567962877198 ;
|
||||
.float -3.213722960014 ;
|
||||
.float -0.639321234262 ;
|
||||
.float 4.682006534082 ;
|
||||
.float -3.855770086891 ;
|
||||
.float -1.325757685059 ;
|
||||
.float 6.236312386687 ;
|
||||
.float -4.735651038017 ;
|
||||
.float -2.345709388587 ;
|
||||
.float 8.505488022524 ;
|
||||
.float -5.997790945975 ;
|
||||
.float -3.956059541908 ;
|
||||
.float 12.026617159136 ;
|
||||
.float -7.922628470498 ;
|
||||
.float -6.727400789527 ;
|
||||
.float 17.983705080358 ;
|
||||
.float -11.123941286820;
|
||||
.float -12.170909745654;
|
||||
.float 29.488929624542 ;
|
||||
.float -17.203344479111;
|
||||
.float -25.631911490690;
|
||||
.float 57.466598393615 ;
|
||||
.float -31.741016484669;
|
||||
.float -81.587305009103;
|
||||
.float 171.803399517566;
|
||||
.float -90.149831709374;
|
||||
.float 0.0;
|
||||
.float 0.0;
|
||||
.float 0.0;
|
||||
|
||||
|
||||
_CLAacosinTableEnd:
|
||||
|
||||
;############################################################################
|
||||
;//! @}
|
||||
;############################################################################
|
||||
+244
@@ -0,0 +1,244 @@
|
||||
;******************************************************************************
|
||||
;
|
||||
; FILE: CLAasineTable.asm
|
||||
;
|
||||
; DESCRIPTION: asine Tables
|
||||
;
|
||||
;******************************************************************************
|
||||
; $TI Release: $
|
||||
; $Release Date: $
|
||||
;******************************************************************************
|
||||
; This software is licensed for use with Texas Instruments C28x
|
||||
; family DSCs. This license was provided to you prior to installing
|
||||
; the software. You may review this license by consulting a copy of
|
||||
; the agreement in the doc directory of this library.
|
||||
; ------------------------------------------------------------------------
|
||||
; Copyright (C) 2010-2011 Texas Instruments, Incorporated.
|
||||
; All Rights Reserved.
|
||||
;******************************************************************************
|
||||
|
||||
;############################################################################
|
||||
;/*! \addtogroup CLAMATH_TABLES
|
||||
; @{
|
||||
;*/
|
||||
;############################################################################
|
||||
|
||||
.if __TI_EABI__
|
||||
.asg CLAasinHalfPITable,_CLAasinHalfPITable
|
||||
.asg CLAasinTable,_CLAasinTable
|
||||
.asg CLAasinTableEnd,_CLAasinTableEnd
|
||||
.endif
|
||||
|
||||
.def _CLAasinHalfPITable
|
||||
.def _CLAasinTable
|
||||
.def _CLAasinTableEnd
|
||||
|
||||
.sect "CLA1mathTables"
|
||||
|
||||
_CLAasinHalfPITable:
|
||||
.float 2.0 ; 2.0
|
||||
.float 1.570796327 ; PI/2
|
||||
|
||||
_CLAasinTable:
|
||||
|
||||
.float 0.0
|
||||
.float 1.0
|
||||
.float 0.0
|
||||
.float 0.000000636202
|
||||
.float 0.999877862610
|
||||
.float 0.007815361896
|
||||
.float 0.000005099694
|
||||
.float 0.999510644409
|
||||
.float 0.015647916155
|
||||
.float 0.000017268312
|
||||
.float 0.998895919094
|
||||
.float 0.023514960332
|
||||
.float 0.000041121765
|
||||
.float 0.998029615282
|
||||
.float 0.031434003631
|
||||
.float 0.000080794520
|
||||
.float 0.996905974725
|
||||
.float 0.039422875916
|
||||
.float 0.000140631089
|
||||
.float 0.995517492804
|
||||
.float 0.047499840611
|
||||
.float 0.000225244584
|
||||
.float 0.993854840311
|
||||
.float 0.055683712914
|
||||
.float 0.000339579512
|
||||
.float 0.991906765146
|
||||
.float 0.063993984848
|
||||
.float 0.000488979852
|
||||
.float 0.989659972212
|
||||
.float 0.072450958820
|
||||
.float 0.000679263611
|
||||
.float 0.987098979366
|
||||
.float 0.081075891529
|
||||
.float 0.000916805182
|
||||
.float 0.984205946802
|
||||
.float 0.089891150305
|
||||
.float 0.001208627040
|
||||
.float 0.980960476685
|
||||
.float 0.098920384204
|
||||
.float 0.001562502549
|
||||
.float 0.977339379243
|
||||
.float 0.108188712551
|
||||
.float 0.001987071928
|
||||
.float 0.973316400729
|
||||
.float 0.117722933997
|
||||
.float 0.002491973784
|
||||
.float 0.968861907789
|
||||
.float 0.127551759665
|
||||
.float 0.003087995053
|
||||
.float 0.963942521723
|
||||
.float 0.137706074532
|
||||
.float 0.003787242692
|
||||
.float 0.958520694794
|
||||
.float 0.148219231941
|
||||
.float 0.004603341138
|
||||
.float 0.952554219267
|
||||
.float 0.159127386977
|
||||
.float 0.005551660294
|
||||
.float 0.945995657913
|
||||
.float 0.170469875522
|
||||
.float 0.006649579796
|
||||
.float 0.938791682505
|
||||
.float 0.182289647088
|
||||
.float 0.007916796475
|
||||
.float 0.930882303984
|
||||
.float 0.194633761132
|
||||
.float 0.009375683410
|
||||
.float 0.922199974574
|
||||
.float 0.207553958472
|
||||
.float 0.011051710808
|
||||
.float 0.912668537890
|
||||
.float 0.221107321885
|
||||
.float 0.012973941175
|
||||
.float 0.902201997769
|
||||
.float 0.235357042896
|
||||
.float 0.015175614174
|
||||
.float 0.890703070035
|
||||
.float 0.250373315541
|
||||
.float 0.017694840102
|
||||
.float 0.878061473098
|
||||
.float 0.266234382514
|
||||
.float 0.020575425537
|
||||
.float 0.864151902887
|
||||
.float 0.283027765009
|
||||
.float 0.023867860513
|
||||
.float 0.848831624374
|
||||
.float 0.300851714968
|
||||
.float 0.027630504055
|
||||
.float 0.831937595031
|
||||
.float 0.319816937941
|
||||
.float 0.031931014547
|
||||
.float 0.813283013821
|
||||
.float 0.340048646894
|
||||
.float 0.036848083955
|
||||
.float 0.792653161200
|
||||
.float 0.361689022958
|
||||
.float 0.042473551274
|
||||
.float 0.769800358920
|
||||
.float 0.384900179460
|
||||
.float 0.048914992206
|
||||
.float 0.744437830278
|
||||
.float 0.409867752228
|
||||
.float 0.056298910750
|
||||
.float 0.716232177740
|
||||
.float 0.436805274317
|
||||
.float 0.064774696786
|
||||
.float 0.684794109766
|
||||
.float 0.465959540059
|
||||
.float 0.074519565699
|
||||
.float 0.649666934178
|
||||
.float 0.497617226179
|
||||
.float 0.085744766889
|
||||
.float 0.610312179660
|
||||
.float 0.532113122767
|
||||
.float 0.098703445606
|
||||
.float 0.566091493186
|
||||
.float 0.569840443472
|
||||
.float 0.113700678529
|
||||
.float 0.516243664372
|
||||
.float 0.611263845480
|
||||
.float 0.131106395009
|
||||
.float 0.459855210927
|
||||
.float 0.656936015611
|
||||
.float 0.151372169232
|
||||
.float 0.395822366759
|
||||
.float 0.707518998893
|
||||
.float 0.175053263659
|
||||
.float 0.322801460177
|
||||
.float 0.763811905770
|
||||
.float 0.202837883870
|
||||
.float 0.239143420888
|
||||
.float 0.826787304376
|
||||
.float 0.235586468765
|
||||
.float 0.142806299514
|
||||
.float 0.897639596948
|
||||
.float 0.274385149825
|
||||
.float 0.031236880585
|
||||
.float 0.977850174820
|
||||
.float 0.320619535938
|
||||
.float -0.098791845166
|
||||
.float 1.069276441800
|
||||
.float 0.376078169620
|
||||
.float -0.251407364538
|
||||
.float 1.174275392129
|
||||
.float 0.443100143614
|
||||
.float -0.431959397725
|
||||
.float 1.295878193174
|
||||
.float 0.524789871827
|
||||
.float -0.647485610469
|
||||
.float 1.438041695773
|
||||
.float 0.625336471263
|
||||
.float -0.907400624736
|
||||
.float 1.606018804842
|
||||
.float 0.750500589935
|
||||
.float -1.224540947101
|
||||
.float 1.806917563896
|
||||
.float 0.908377657341
|
||||
.float -1.616794995066
|
||||
.float 2.050569262035
|
||||
.float 1.110633894185
|
||||
.float -2.109729648039
|
||||
.float 2.350920816737
|
||||
.float 1.374584721437
|
||||
.float -2.740985157716
|
||||
.float 2.728353889708
|
||||
.float 1.726848242753
|
||||
.float -3.567962877198
|
||||
.float 3.213722960014
|
||||
.float 2.210117561056
|
||||
.float -4.682006534082
|
||||
.float 3.855770086891
|
||||
.float 2.896554011854
|
||||
.float -6.236312386687
|
||||
.float 4.735651038017
|
||||
.float 3.916505715382
|
||||
.float -8.505488022524
|
||||
.float 5.997790945975
|
||||
.float 5.526855868703
|
||||
.float -12.026617159136
|
||||
.float 7.922628470498
|
||||
.float 8.298197116322
|
||||
.float -17.983705080358
|
||||
.float 11.123941286820
|
||||
.float 13.741706072449
|
||||
.float -29.488929624542
|
||||
.float 17.203344479111
|
||||
.float 27.202707817485
|
||||
.float -57.466598393615
|
||||
.float 31.741016484669
|
||||
.float 83.158101335898
|
||||
.float -171.803399517566
|
||||
.float 90.149831709374
|
||||
|
||||
.float 1.5707963267948966192313216916398
|
||||
.float 0
|
||||
.float 0
|
||||
|
||||
_CLAasinTableEnd:
|
||||
;############################################################################
|
||||
;//! @}
|
||||
;############################################################################
|
||||
+253
@@ -0,0 +1,253 @@
|
||||
;******************************************************************************
|
||||
;
|
||||
; FILE: CLAatanTable.asm
|
||||
;
|
||||
; DESCRIPTION: atan Tables
|
||||
;
|
||||
;******************************************************************************
|
||||
; $TI Release: $
|
||||
; $Release Date: $
|
||||
;******************************************************************************
|
||||
; This software is licensed for use with Texas Instruments C28x
|
||||
; family DSCs. This license was provided to you prior to installing
|
||||
; the software. You may review this license by consulting a copy of
|
||||
; the agreement in the doc directory of this library.
|
||||
; ------------------------------------------------------------------------
|
||||
; Copyright (C) 2010-2011 Texas Instruments, Incorporated.
|
||||
; All Rights Reserved.
|
||||
;******************************************************************************
|
||||
|
||||
;############################################################################
|
||||
;/*! \addtogroup CLAMATH_TABLES
|
||||
; @{
|
||||
;*/
|
||||
;############################################################################
|
||||
|
||||
.if __TI_EABI__
|
||||
.asg CLAatan2HalfPITable,_CLAatan2HalfPITable
|
||||
.asg CLAINV2PI,_CLAINV2PI
|
||||
.asg CLAatan2Table,_CLAatan2Table
|
||||
.asg CLAatan2TableEnd,_CLAatan2TableEnd
|
||||
.endif
|
||||
|
||||
.def _CLAatan2HalfPITable
|
||||
.def _CLAINV2PI
|
||||
.def _CLAatan2Table
|
||||
.def _CLAatan2TableEnd
|
||||
|
||||
.sect "CLA1mathTables"
|
||||
|
||||
_CLAatan2HalfPITable:
|
||||
.float 2.0 ; 2.0
|
||||
.float 1.570796327 ; PI/2
|
||||
_CLAINV2PI:
|
||||
.float 0.159154943 ;1 / {2*PI}
|
||||
|
||||
_CLAatan2Table:
|
||||
.float 0.000000000000 ; 0 x0 = 0.000000000000 -> a0 = 0.000000000000
|
||||
.float 1.000040679675 ; 0 x1 = 0.007812500000 -> a1 = 1.000040679675
|
||||
.float -0.007811069750 ; 0 x2 = 0.015625000000 -> a2 = -0.007811069750
|
||||
|
||||
.float -0.000003807022 ; 1 x0 = 0.015625000000 -> a0 = -0.000003807022
|
||||
.float 1.000528067772 ; 1 x1 = 0.023437500000 -> a1 = 1.000528067772
|
||||
.float -0.023410345493 ; 1 x2 = 0.031250000000 -> a2 = -0.023410345493
|
||||
|
||||
.float -0.000018968310 ; 2 x0 = 0.031250000000 -> a0 = -0.000018968310
|
||||
.float 1.001498568106 ; 2 x1 = 0.039062500000 -> a1 = 1.001498568106
|
||||
.float -0.038941197075 ; 2 x2 = 0.046875000000 -> a2 = -0.038941197075
|
||||
|
||||
.float -0.000052831927 ; 3 x0 = 0.046875000000 -> a0 = -0.000052831927
|
||||
.float 1.002943680965 ; 3 x1 = 0.054687500000 -> a1 = 1.002943680965
|
||||
.float -0.054358563160 ; 3 x2 = 0.062500000000 -> a2 = -0.054358563160
|
||||
|
||||
.float -0.000112417996 ; 4 x0 = 0.062500000000 -> a0 = -0.000112417996
|
||||
.float 1.004850785788 ; 4 x1 = 0.070312500000 -> a1 = 1.004850785788
|
||||
.float -0.069618206649 ; 4 x2 = 0.078125000000 -> a2 = -0.069618206649
|
||||
|
||||
.float -0.000204295885 ; 5 x0 = 0.078125000000 -> a0 = -0.000204295885
|
||||
.float 1.007203293243 ; 5 x1 = 0.085937500000 -> a1 = 1.007203293243
|
||||
.float -0.084677028723 ; 5 x2 = 0.093750000000 -> a2 = -0.084677028723
|
||||
.float -0.000334469493 ; 6 x0 = 0.093750000000 -> a0 = -0.000334469493
|
||||
.float 1.009980843501 ; 6 x1 = 0.101562500000 -> a1 = 1.009980843501
|
||||
.float -0.099493367628 ; 6 x2 = 0.109375000000 -> a2 = -0.099493367628
|
||||
.float -0.000508272606 ; 7 x0 = 0.109375000000 -> a0 = -0.000508272606
|
||||
.float 1.013159547023 ; 7 x1 = 0.117187500000 -> a1 = 1.013159547023
|
||||
.float -0.114027278430 ; 7 x2 = 0.125000000000 -> a2 = -0.114027278430
|
||||
.float -0.000730276035 ; 8 x0 = 0.125000000000 -> a0 = -0.000730276035
|
||||
.float 1.016712263449 ; 8 x1 = 0.132812500000 -> a1 = 1.016712263449
|
||||
.float -0.128240790343 ; 8 x2 = 0.140625000000 -> a2 = -0.128240790343
|
||||
.float -0.001004207980 ; 9 x0 = 0.140625000000 -> a0 = -0.001004207980
|
||||
.float 1.020608913557 ; 9 x1 = 0.148437500000 -> a1 = 1.020608913557
|
||||
.float -0.142098138715 ; 9 x2 = 0.156250000000 -> a2 = -0.142098138715
|
||||
.float -0.001332888717 ; 10 x0 = 0.156250000000 -> a0 = -0.001332888717
|
||||
.float 1.024816818801 ; 10 x1 = 0.164062500000 -> a1 = 1.024816818801
|
||||
.float -0.155565969259 ; 10 x2 = 0.171875000000 -> a2 = -0.155565969259
|
||||
.float -0.001718180431 ; 11 x0 = 0.171875000000 -> a0 = -0.001718180431
|
||||
.float 1.029301062569 ; 11 x1 = 0.179687500000 -> a1 = 1.029301062569
|
||||
.float -0.168613512667 ; 11 x2 = 0.187500000000 -> a2 = -0.168613512667
|
||||
.float -0.002160952612 ; 12 x0 = 0.187500000000 -> a0 = -0.002160952612
|
||||
.float 1.034024867135 ; 12 x1 = 0.195312500000 -> a1 = 1.034024867135
|
||||
.float -0.181212728329 ; 12 x2 = 0.203125000000 -> a2 = -0.181212728329
|
||||
.float -0.002661063159 ; 13 x0 = 0.203125000000 -> a0 = -0.002661063159
|
||||
.float 1.038949980222 ; 13 x1 = 0.210937500000 -> a1 = 1.038949980222
|
||||
.float -0.193338416410 ; 13 x2 = 0.218750000000 -> a2 = -0.193338416410
|
||||
.float -0.003217354977 ; 14 x0 = 0.218750000000 -> a0 = -0.003217354977
|
||||
.float 1.044037065160 ; 14 x1 = 0.226562500000 -> a1 = 1.044037065160
|
||||
.float -0.204968298146 ; 14 x2 = 0.234375000000 -> a2 = -0.204968298146
|
||||
.float -0.003827667546 ; 15 x0 = 0.234375000000 -> a0 = -0.003827667546
|
||||
.float 1.049246088868 ; 15 x1 = 0.242187500000 -> a1 = 1.049246088868
|
||||
.float -0.216083064706 ; 15 x2 = 0.250000000000 -> a2 = -0.216083064706
|
||||
.float -0.004488862702 ; 16 x0 = 0.250000000000 -> a0 = -0.004488862702
|
||||
.float 1.054536702192 ; 16 x1 = 0.257812500000 -> a1 = 1.054536702192
|
||||
.float -0.226666395507 ; 16 x2 = 0.265625000000 -> a2 = -0.226666395507
|
||||
.float -0.005196863579 ; 17 x0 = 0.265625000000 -> a0 = -0.005196863579
|
||||
.float 1.059868607573 ; 17 x1 = 0.273437500000 -> a1 = 1.059868607573
|
||||
.float -0.236704947279 ; 17 x2 = 0.281250000000 -> a2 = -0.236704947279
|
||||
.float -0.005946705500 ; 18 x0 = 0.281250000000 -> a0 = -0.005946705500
|
||||
.float 1.065201909527 ; 18 x1 = 0.289062500000 -> a1 = 1.065201909527
|
||||
.float -0.246188315613 ; 18 x2 = 0.296875000000 -> a2 = -0.246188315613
|
||||
.float -0.006732597422 ; 19 x0 = 0.296875000000 -> a0 = -0.006732597422
|
||||
.float 1.070497443994 ; 19 x1 = 0.304687500000 -> a1 = 1.070497443994
|
||||
.float -0.255108971022 ; 19 x2 = 0.312500000000 -> a2 = -0.255108971022
|
||||
.float -0.007547992413 ; 20 x0 = 0.312500000000 -> a0 = -0.007547992413
|
||||
.float 1.075717083222 ; 20 x1 = 0.320312500000 -> a1 = 1.075717083222
|
||||
.float -0.263462171840 ; 20 x2 = 0.328125000000 -> a2 = -0.263462171840
|
||||
.float -0.008385665599 ; 21 x0 = 0.328125000000 -> a0 = -0.008385665599
|
||||
.float 1.080824013499 ; 21 x1 = 0.335937500000 -> a1 = 1.080824013499
|
||||
.float -0.271245856476 ; 21 x2 = 0.343750000000 -> a2 = -0.271245856476
|
||||
.float -0.009237797924 ; 22 x0 = 0.343750000000 -> a0 = -0.009237797924
|
||||
.float 1.085782983693 ; 22 x1 = 0.351562500000 -> a1 = 1.085782983693
|
||||
.float -0.278460517693 ; 22 x2 = 0.359375000000 -> a2 = -0.278460517693
|
||||
.float -0.010096064139 ; 23 x0 = 0.359375000000 -> a0 = -0.010096064139
|
||||
.float 1.090560523211 ; 23 x1 = 0.367187500000 -> a1 = 1.090560523211
|
||||
.float -0.285109061650 ; 23 x2 = 0.375000000000 -> a2 = -0.285109061650
|
||||
.float -0.010951723407 ; 24 x0 = 0.375000000000 -> a0 = -0.010951723407
|
||||
.float 1.095125128557 ; 24 x1 = 0.382812500000 -> a1 = 1.095125128557
|
||||
.float -0.291196654447 ; 24 x2 = 0.390625000000 -> a2 = -0.291196654447
|
||||
.float -0.011795711029 ; 25 x0 = 0.390625000000 -> a0 = -0.011795711029
|
||||
.float 1.099447418304 ; 25 x1 = 0.398437500000 -> a1 = 1.099447418304
|
||||
.float -0.296730558920 ; 25 x2 = 0.406250000000 -> a2 = -0.296730558920
|
||||
.float -0.012618729873 ; 26 x0 = 0.406250000000 -> a0 = -0.012618729873
|
||||
.float 1.103500256784 ; 26 x1 = 0.414062500000 -> a1 = 1.103500256784
|
||||
.float -0.301719964310 ; 26 x2 = 0.421875000000 -> a2 = -0.301719964310
|
||||
.float -0.013411340199 ; 27 x0 = 0.421875000000 -> a0 = -0.013411340199
|
||||
.float 1.107258847274 ; 27 x1 = 0.429687500000 -> a1 = 1.107258847274
|
||||
.float -0.306175811325 ; 27 x2 = 0.437500000000 -> a2 = -0.306175811325
|
||||
.float -0.014164046711 ; 28 x0 = 0.437500000000 -> a0 = -0.014164046711
|
||||
.float 1.110700795887 ; 28 x1 = 0.445312500000 -> a1 = 1.110700795887
|
||||
.float -0.310110614947 ; 28 x2 = 0.453125000000 -> a2 = -0.310110614947
|
||||
.float -0.014867381831 ; 29 x0 = 0.453125000000 -> a0 = -0.014867381831
|
||||
.float 1.113806147717 ; 29 x1 = 0.460937500000 -> a1 = 1.113806147717
|
||||
.float -0.313538287176 ; 29 x2 = 0.468750000000 -> a2 = -0.313538287176
|
||||
.float -0.015511984298 ; 30 x0 = 0.468750000000 -> a0 = -0.015511984298
|
||||
.float 1.116557397059 ; 30 x1 = 0.476562500000 -> a1 = 1.116557397059
|
||||
.float -0.316473961655 ; 30 x2 = 0.484375000000 -> a2 = -0.316473961655
|
||||
.float -0.016088672395 ; 31 x0 = 0.484375000000 -> a0 = -0.016088672395
|
||||
.float 1.118939473766 ; 31 x1 = 0.492187500000 -> a1 = 1.118939473766
|
||||
.float -0.318933821948 ; 31 x2 = 0.500000000000 -> a2 = -0.318933821948
|
||||
.float -0.016588511229 ; 32 x0 = 0.500000000000 -> a0 = -0.016588511229
|
||||
.float 1.120939707956 ; 32 x1 = 0.507812500000 -> a1 = 1.120939707956
|
||||
.float -0.320934934991 ; 32 x2 = 0.515625000000 -> a2 = -0.320934934991
|
||||
.float -0.017002873645 ; 33 x0 = 0.515625000000 -> a0 = -0.017002873645
|
||||
.float 1.122547775367 ; 33 x1 = 0.523437500000 -> a1 = 1.122547775367
|
||||
.float -0.322495091022 ; 33 x2 = 0.531250000000 -> a2 = -0.322495091022
|
||||
.float -0.017323494499 ; 34 x0 = 0.531250000000 -> a0 = -0.017323494499
|
||||
.float 1.123755625749 ; 34 x1 = 0.539062500000 -> a1 = 1.123755625749
|
||||
.float -0.323632651068 ; 34 x2 = 0.546875000000 -> a2 = -0.323632651068
|
||||
.float -0.017542518140 ; 35 x0 = 0.546875000000 -> a0 = -0.017542518140
|
||||
.float 1.124557396633 ; 35 x1 = 0.554687500000 -> a1 = 1.124557396633
|
||||
.float -0.324366402860 ; 35 x2 = 0.562500000000 -> a2 = -0.324366402860
|
||||
.float -0.017652539065 ; 36 x0 = 0.562500000000 -> a0 = -0.017652539065
|
||||
.float 1.124949314810 ; 36 x1 = 0.570312500000 -> a1 = 1.124949314810
|
||||
.float -0.324715425833 ; 36 x2 = 0.578125000000 -> a2 = -0.324715425833
|
||||
.float -0.017646635823 ; 37 x0 = 0.578125000000 -> a0 = -0.017646635823
|
||||
.float 1.124929587773 ; 37 x1 = 0.585937500000 -> a1 = 1.124929587773
|
||||
.float -0.324698965683 ; 37 x2 = 0.593750000000 -> a2 = -0.324698965683
|
||||
.float -0.017518398344 ; 38 x0 = 0.593750000000 -> a0 = -0.017518398344
|
||||
.float 1.124498287266 ; 38 x1 = 0.601562500000 -> a1 = 1.124498287266
|
||||
.float -0.324336318787 ; 38 x2 = 0.609375000000 -> a2 = -0.324336318787
|
||||
.float -0.017261948920 ; 39 x0 = 0.609375000000 -> a0 = -0.017261948920
|
||||
.float 1.123657226955 ; 39 x1 = 0.617187500000 -> a1 = 1.123657226955
|
||||
.float -0.323646726613 ; 39 x2 = 0.625000000000 -> a2 = -0.323646726613
|
||||
.float -0.016871957164 ; 40 x0 = 0.625000000000 -> a0 = -0.016871957164
|
||||
.float 1.122409836098 ; 40 x1 = 0.632812500000 -> a1 = 1.122409836098
|
||||
.float -0.322649280139 ; 40 x2 = 0.640625000000 -> a2 = -0.322649280139
|
||||
.float -0.016343649294 ; 41 x0 = 0.640625000000 -> a0 = -0.016343649294
|
||||
.float 1.120761030918 ; 41 x1 = 0.648437500000 -> a1 = 1.120761030918
|
||||
.float -0.321362834119 ; 41 x2 = 0.656250000000 -> a2 = -0.321362834119
|
||||
.float -0.015672812166 ; 42 x0 = 0.656250000000 -> a0 = -0.015672812166
|
||||
.float 1.118717085258 ; 42 x1 = 0.664062500000 -> a1 = 1.118717085258
|
||||
.float -0.319805931024 ; 42 x2 = 0.671875000000 -> a2 = -0.319805931024
|
||||
.float -0.014855792451 ; 43 x0 = 0.671875000000 -> a0 = -0.014855792451
|
||||
.float 1.116285501852 ; 43 x1 = 0.679687500000 -> a1 = 1.116285501852
|
||||
.float -0.317996734279 ; 43 x2 = 0.687500000000 -> a2 = -0.317996734279
|
||||
.float -0.013889491441 ; 44 x0 = 0.687500000000 -> a0 = -0.013889491441
|
||||
.float 1.113474885484 ; 44 x1 = 0.695312500000 -> a1 = 1.113474885484
|
||||
.float -0.315952970460 ; 44 x2 = 0.703125000000 -> a2 = -0.315952970460
|
||||
.float -0.012771355912 ; 45 x0 = 0.703125000000 -> a0 = -0.012771355912
|
||||
.float 1.110294819035 ; 45 x1 = 0.710937500000 -> a1 = 1.110294819035
|
||||
.float -0.313691879968 ; 45 x2 = 0.718750000000 -> a2 = -0.313691879968
|
||||
.float -0.011499365513 ; 46 x0 = 0.718750000000 -> a0 = -0.011499365513
|
||||
.float 1.106755743329 ; 46 x1 = 0.726562500000 -> a1 = 1.106755743329
|
||||
.float -0.311230175714 ; 46 x2 = 0.734375000000 -> a2 = -0.311230175714
|
||||
.float -0.010072017131 ; 47 x0 = 0.734375000000 -> a0 = -0.010072017131
|
||||
.float 1.102868841531 ; 47 x1 = 0.742187500000 -> a1 = 1.102868841531
|
||||
.float -0.308584009287 ; 47 x2 = 0.750000000000 -> a2 = -0.308584009287
|
||||
.float -0.008488306656 ; 48 x0 = 0.750000000000 -> a0 = -0.008488306656
|
||||
.float 1.098645928648 ; 48 x1 = 0.757812500000 -> a1 = 1.098645928648
|
||||
.float -0.305768944066 ; 48 x2 = 0.765625000000 -> a2 = -0.305768944066
|
||||
.float -0.006747708579 ; 49 x0 = 0.765625000000 -> a0 = -0.006747708579
|
||||
.float 1.094099346648 ; 49 x1 = 0.773437500000 -> a1 = 1.094099346648
|
||||
.float -0.302799934724 ; 49 x2 = 0.781250000000 -> a2 = -0.302799934724
|
||||
.float -0.004850153815 ; 50 x0 = 0.781250000000 -> a0 = -0.004850153815
|
||||
.float 1.089241865523 ; 50 x1 = 0.789062500000 -> a1 = 1.089241865523
|
||||
.float -0.299691312610 ; 50 x2 = 0.796875000000 -> a2 = -0.299691312610
|
||||
.float -0.002796006119 ; 51 x0 = 0.796875000000 -> a0 = -0.002796006119
|
||||
.float 1.084086590517 ; 51 x1 = 0.804687500000 -> a1 = 1.084086590517
|
||||
.float -0.296456776409 ; 51 x2 = 0.812500000000 -> a2 = -0.296456776409
|
||||
.float -0.000586037441 ; 52 x0 = 0.812500000000 -> a0 = -0.000586037441
|
||||
.float 1.078646875666 ; 52 x1 = 0.820312500000 -> a1 = 1.078646875666
|
||||
.float -0.293109387609 ; 52 x2 = 0.828125000000 -> a2 = -0.293109387609
|
||||
.float 0.001778597452 ; 53 x0 = 0.828125000000 -> a0 = 0.001778597452
|
||||
.float 1.072936243727 ; 53 x1 = 0.835937500000 -> a1 = 1.072936243727
|
||||
.float -0.289661570229 ; 53 x2 = 0.843750000000 -> a2 = -0.289661570229
|
||||
.float 0.004296386804 ; 54 x0 = 0.843750000000 -> a0 = 0.004296386804
|
||||
.float 1.066968312440 ; 54 x1 = 0.851562500000 -> a1 = 1.066968312440
|
||||
.float -0.286125114351 ; 54 x2 = 0.859375000000 -> a2 = -0.286125114351
|
||||
.float 0.006965487894 ; 55 x0 = 0.859375000000 -> a0 = 0.006965487894
|
||||
.float 1.060756727064 ; 55 x1 = 0.867187500000 -> a1 = 1.060756727064
|
||||
.float -0.282511182960 ; 55 x2 = 0.875000000000 -> a2 = -0.282511182960
|
||||
.float 0.009783753017 ; 56 x0 = 0.875000000000 -> a0 = 0.009783753017
|
||||
.float 1.054315099009 ; 56 x1 = 0.882812500000 -> a1 = 1.054315099009
|
||||
.float -0.278830321668 ; 56 x2 = 0.890625000000 -> a2 = -0.278830321668
|
||||
.float 0.012748755207 ; 57 x0 = 0.890625000000 -> a0 = 0.012748755207
|
||||
.float 1.047656950440 ; 57 x1 = 0.898437500000 -> a1 = 1.047656950440
|
||||
.float -0.275092470943 ; 57 x2 = 0.906250000000 -> a2 = -0.275092470943
|
||||
.float 0.015857813546 ; 58 x0 = 0.906250000000 -> a0 = 0.015857813546
|
||||
.float 1.040795664582 ; 58 x1 = 0.914062500000 -> a1 = 1.040795664582
|
||||
.float -0.271306980411 ; 58 x2 = 0.921875000000 -> a2 = -0.271306980411
|
||||
.float 0.019108017893 ; 59 x0 = 0.921875000000 -> a0 = 0.019108017893
|
||||
.float 1.033744441476 ; 59 x1 = 0.929687500000 -> a1 = 1.033744441476
|
||||
.float -0.267482624928 ; 59 x2 = 0.937500000000 -> a2 = -0.267482624928
|
||||
.float 0.022496252887 ; 60 x0 = 0.937500000000 -> a0 = 0.022496252887
|
||||
.float 1.026516258989 ; 60 x1 = 0.945312500000 -> a1 = 1.026516258989
|
||||
.float -0.263627622089 ; 60 x2 = 0.953125000000 -> a2 = -0.263627622089
|
||||
.float 0.026019221162 ; 61 x0 = 0.953125000000 -> a0 = 0.026019221162
|
||||
.float 1.019123838651 ; 61 x1 = 0.960937500000 -> a1 = 1.019123838651
|
||||
.float -0.259749650860 ; 61 x2 = 0.968750000000 -> a2 = -0.259749650860
|
||||
.float 0.029673465636 ; 62 x0 = 0.968750000000 -> a0 = 0.029673465636
|
||||
.float 1.011579616186 ; 62 x1 = 0.976562500000 -> a1 = 1.011579616186
|
||||
.float -0.255855871106 ; 62 x2 = 0.984375000000 -> a2 = -0.255855871106
|
||||
|
||||
.float 0.033455390838 ; 63 x0 = 0.984375000000 -> a0 = 0.033455390838
|
||||
.float 1.003895716322 ; 63 x1 = 0.992187500000 -> a1 = 1.003895716322
|
||||
.float -0.251952943763 ; 63 x2 = 1.000000000000 -> a2 = -0.251952943763
|
||||
|
||||
.float 0.037361283212 ; 64 x0 = 1.000000000000 -> a0 = 0.037361283212
|
||||
.float 0.996083931611 ; 64 x1 = 1.007812500000 -> a1 = 0.996083931611
|
||||
.float -0.248047051426 ; 64 x2 = 1.015625000000 -> a2 = -0.248047051426
|
||||
_CLAatan2TableEnd:
|
||||
|
||||
;############################################################################
|
||||
;//! @}
|
||||
;############################################################################
|
||||
+155
@@ -0,0 +1,155 @@
|
||||
;******************************************************************************
|
||||
;
|
||||
; FILE: CLAexpTable.asm
|
||||
;
|
||||
; DESCRIPTION: Exponential Tables
|
||||
;
|
||||
;******************************************************************************
|
||||
; $TI Release: $
|
||||
; $Release Date: $
|
||||
;******************************************************************************
|
||||
; This software is licensed for use with Texas Instruments C28x
|
||||
; family DSCs. This license was provided to you prior to installing
|
||||
; the software. You may review this license by consulting a copy of
|
||||
; the agreement in the doc directory of this library.
|
||||
; ------------------------------------------------------------------------
|
||||
; Copyright (C) 2010-2011 Texas Instruments, Incorporated.
|
||||
; All Rights Reserved.
|
||||
;******************************************************************************
|
||||
|
||||
;############################################################################
|
||||
;/*! \addtogroup CLAMATH_TABLES
|
||||
; @{
|
||||
;*/
|
||||
;############################################################################
|
||||
|
||||
.if __TI_EABI__
|
||||
.asg CLAINV1,_CLAINV1
|
||||
.asg CLAINV2,_CLAINV2
|
||||
.asg CLAINV3,_CLAINV3
|
||||
.asg CLAINV4,_CLAINV4
|
||||
.asg CLAINV5,_CLAINV5
|
||||
.asg CLAINV6,_CLAINV6
|
||||
.asg CLAINV7,_CLAINV7
|
||||
.asg CLALOG10,_CLALOG10
|
||||
.asg CLAExpTable,_CLAExpTable
|
||||
.asg CLAExpTableEnd,_CLAExpTableEnd
|
||||
.endif
|
||||
|
||||
.def _CLAINV1
|
||||
.def _CLAINV2
|
||||
.def _CLAINV3
|
||||
.def _CLAINV4
|
||||
.def _CLAINV5
|
||||
.def _CLAINV6
|
||||
.def _CLAINV7
|
||||
.def _CLALOG10
|
||||
.def _CLAExpTable
|
||||
.def _CLAExpTableEnd
|
||||
|
||||
.sect "CLA1mathTables"
|
||||
_CLAINV1 .float 1
|
||||
_CLAINV2 .float 0.5 ;1/2
|
||||
_CLAINV3 .float 0.333333333333333333 ;1/3
|
||||
_CLAINV4 .float 0.25 ;1/4
|
||||
_CLAINV5 .float 0.20 ;1/5
|
||||
_CLAINV6 .float 0.166666666666666666 ;1/6
|
||||
_CLAINV7 .float 0.142857142857142857 ;1/7
|
||||
|
||||
_CLALOG10 .float 2.302585092 ;LOG10(e)
|
||||
|
||||
_CLAExpTable:
|
||||
.float 1.0; exp(0)
|
||||
.float 2.7182818285e+0; exp(1)
|
||||
.float 7.3890560989e+0; exp(2)
|
||||
.float 2.0085536923e+1; exp(3)
|
||||
.float 5.4598150033e+1; exp(4)
|
||||
.float 1.484131591e+2; exp(5)
|
||||
.float 4.0342879349e+2; exp(6)
|
||||
.float 1.0966331584e+3; exp(7)
|
||||
.float 2.980957987e+3; exp(8)
|
||||
.float 8.1030839276e+3; exp(9)
|
||||
.float 2.2026465795e+4; exp(10)
|
||||
.float 5.9874141715e+4; exp(11)
|
||||
.float 1.6275479142e+5; exp(12)
|
||||
.float 4.4241339201e+5; exp(13)
|
||||
.float 1.2026042842e+6; exp(14)
|
||||
.float 3.2690173725e+6; exp(15)
|
||||
.float 8.8861105205e+6; exp(16)
|
||||
.float 2.4154952754e+7; exp(17)
|
||||
.float 6.5659969137e+7; exp(18)
|
||||
.float 1.7848230096e+8; exp(19)
|
||||
.float 4.8516519541e+8; exp(20)
|
||||
.float 1.3188157345e+9; exp(21)
|
||||
.float 3.5849128461e+9; exp(22)
|
||||
.float 9.7448034462e+9; exp(23)
|
||||
.float 2.648912213e+10; exp(24)
|
||||
.float 7.2004899337e+10; exp(25)
|
||||
.float 1.9572960943e+11; exp(26)
|
||||
.float 5.320482406e+11; exp(27)
|
||||
.float 1.4462570643e+12; exp(28)
|
||||
.float 3.9313342971e+12; exp(29)
|
||||
.float 1.0686474582e+13; exp(30)
|
||||
.float 2.9048849665e+13; exp(31)
|
||||
.float 7.8962960183e+13; exp(32)
|
||||
.float 2.1464357979e+14; exp(33)
|
||||
.float 5.8346174253e+14; exp(34)
|
||||
.float 1.5860134523e+15; exp(35)
|
||||
.float 4.3112315471e+15; exp(36)
|
||||
.float 1.1719142373e+16; exp(37)
|
||||
.float 3.1855931757e+16; exp(38)
|
||||
.float 8.6593400424e+16; exp(39)
|
||||
.float 2.3538526684e+17; exp(40)
|
||||
.float 6.3984349353e+17; exp(41)
|
||||
.float 1.7392749415e+18; exp(42)
|
||||
.float 4.7278394682e+18; exp(43)
|
||||
.float 1.2851600114e+19; exp(44)
|
||||
.float 3.4934271057e+19; exp(45)
|
||||
.float 9.4961194206e+19; exp(46)
|
||||
.float 2.5813128862e+20; exp(47)
|
||||
.float 7.0167359121e+20; exp(48)
|
||||
.float 1.9073465725e+21; exp(49)
|
||||
.float 5.1847055286e+21; exp(50)
|
||||
.float 1.4093490824e+22; exp(51)
|
||||
.float 3.8310080007e+22; exp(52)
|
||||
.float 1.0413759433e+23; exp(53)
|
||||
.float 2.8307533033e+23; exp(54)
|
||||
.float 7.6947852651e+23; exp(55)
|
||||
.float 2.091659496e+24; exp(56)
|
||||
.float 5.6857199993e+24; exp(57)
|
||||
.float 1.5455389356e+25; exp(58)
|
||||
.float 4.2012104038e+25; exp(59)
|
||||
.float 1.1420073898e+26; exp(60)
|
||||
.float 3.1042979357e+26; exp(61)
|
||||
.float 8.4383566687e+26; exp(62)
|
||||
.float 2.2937831595e+27; exp(63)
|
||||
.float 6.2351490808e+27; exp(64)
|
||||
.float 1.6948892444e+28; exp(65)
|
||||
.float 4.6071866343e+28; exp(66)
|
||||
.float 1.2523631708e+29; exp(67)
|
||||
.float 3.4042760499e+29; exp(68)
|
||||
.float 9.2537817256e+29; exp(69)
|
||||
.float 2.5154386709e+30; exp(70)
|
||||
.float 6.8376712298e+30; exp(71)
|
||||
.float 1.8586717453e+31; exp(72)
|
||||
.float 5.0523936303e+31; exp(73)
|
||||
.float 1.3733829795e+32; exp(74)
|
||||
.float 3.7332419968e+32; exp(75)
|
||||
.float 1.0148003881e+33; exp(76)
|
||||
.float 2.7585134545e+33; exp(77)
|
||||
.float 7.498416997e+33; exp(78)
|
||||
.float 2.0382810665e+34; exp(79)
|
||||
.float 5.5406223844e+34; exp(80)
|
||||
.float 1.5060973146e+35; exp(81)
|
||||
.float 4.0939969621e+35; exp(82)
|
||||
.float 1.1128637548e+36; exp(83)
|
||||
.float 3.0250773222e+36; exp(84)
|
||||
.float 8.2230127146e+36; exp(85)
|
||||
.float 2.2352466037e+37; exp(86)
|
||||
.float 6.0760302251e+37; exp(87)
|
||||
.float 1.651636255e+38; exp(88)
|
||||
|
||||
_CLAExpTableEnd:
|
||||
;############################################################################
|
||||
;//! @}
|
||||
;############################################################################
|
||||
+160
@@ -0,0 +1,160 @@
|
||||
;******************************************************************************
|
||||
;
|
||||
; FILE: CLAlnTable.asm
|
||||
;
|
||||
; DESCRIPTION: Natural Logarithm Tables
|
||||
;
|
||||
;******************************************************************************
|
||||
; $TI Release: $
|
||||
; $Release Date: $
|
||||
;******************************************************************************
|
||||
; This software is licensed for use with Texas Instruments C28x
|
||||
; family DSCs. This license was provided to you prior to installing
|
||||
; the software. You may review this license by consulting a copy of
|
||||
; the agreement in the doc directory of this library.
|
||||
; ------------------------------------------------------------------------
|
||||
; Copyright (C) 2010-2011 Texas Instruments, Incorporated.
|
||||
; All Rights Reserved.
|
||||
;******************************************************************************
|
||||
|
||||
;############################################################################
|
||||
;/*! \addtogroup CLAMATH_TABLES
|
||||
; @{
|
||||
;*/
|
||||
;############################################################################
|
||||
.if __TI_EABI__
|
||||
.asg CLALNV2,_CLALNV2
|
||||
.asg CLALNVe,_CLALNVe
|
||||
.asg CLALNV10,_CLALNV10
|
||||
.asg CLABIAS,_CLABIAS
|
||||
.asg CLALN_TABLE_MASK1,_CLALN_TABLE_MASK1
|
||||
.asg CLALN_TABLE_MASK2,_CLALN_TABLE_MASK2
|
||||
.asg CLALnTable,_CLALnTable
|
||||
.asg CLALnTableEnd,_CLALnTableEnd
|
||||
.endif
|
||||
|
||||
.def _CLALNV2
|
||||
.def _CLALNVe
|
||||
.def _CLALNV10
|
||||
.def _CLABIAS
|
||||
.def _CLALN_TABLE_MASK1
|
||||
.def _CLALN_TABLE_MASK2
|
||||
.def _CLALnTable
|
||||
.def _CLALnTableEnd
|
||||
|
||||
.sect "CLA1mathTables"
|
||||
|
||||
_CLALNV2 .float 0.693147180559 ;
|
||||
_CLALNVe .float 1.0 ;
|
||||
_CLALNV10 .float 0.4342944819032;
|
||||
_CLABIAS .float 127.0 ;
|
||||
_CLALN_TABLE_MASK1 .long 0x3FFFFFFF ;
|
||||
_CLALN_TABLE_MASK2 .long 0x3F800000 ;
|
||||
|
||||
|
||||
_CLALnTable:
|
||||
.float 0 ;
|
||||
.float 1 ;
|
||||
.float -0.5 ;
|
||||
.float 9.49154e-06 ;
|
||||
.float 0.999081726 ;
|
||||
.float -0.470156107 ;
|
||||
.float 7.09886e-05 ;
|
||||
.float 0.996539792 ;
|
||||
.float -0.442906574 ;
|
||||
.float 0.000224404 ;
|
||||
.float 0.992653061 ;
|
||||
.float -0.417959184 ;
|
||||
.float 0.000499085 ;
|
||||
.float 0.987654321 ;
|
||||
.float -0.395061728 ;
|
||||
.float 0.000916122 ;
|
||||
.float 0.981738495 ;
|
||||
.float -0.373995617 ;
|
||||
.float 0.001490146 ;
|
||||
.float 0.975069252 ;
|
||||
.float -0.354570637 ;
|
||||
.float 0.00223074 ;
|
||||
.float 0.967784352 ;
|
||||
.float -0.336620644 ;
|
||||
.float 0.003143551 ;
|
||||
.float 0.96 ;
|
||||
.float -0.32 ;
|
||||
.float 0.004231167 ;
|
||||
.float 0.951814396 ;
|
||||
.float -0.304580607 ;
|
||||
.float 0.005493806 ;
|
||||
.float 0.943310658 ;
|
||||
.float -0.290249433 ;
|
||||
.float 0.00692987 ;
|
||||
.float 0.934559221 ;
|
||||
.float -0.276906436 ;
|
||||
.float 0.008536376 ;
|
||||
.float 0.925619835 ;
|
||||
.float -0.26446281 ;
|
||||
.float 0.010309303 ;
|
||||
.float 0.91654321 ;
|
||||
.float -0.252839506 ;
|
||||
.float 0.012243868 ;
|
||||
.float 0.907372401 ;
|
||||
.float -0.241965974 ;
|
||||
.float 0.014334741 ;
|
||||
.float 0.898143957 ;
|
||||
.float -0.231779086 ;
|
||||
.float 0.016576219 ;
|
||||
.float 0.888888889 ;
|
||||
.float -0.222222222 ;
|
||||
.float 0.018962363 ;
|
||||
.float 0.879633486 ;
|
||||
.float -0.213244481 ;
|
||||
.float 0.021487103 ;
|
||||
.float 0.8704 ;
|
||||
.float -0.2048 ;
|
||||
.float 0.024144324 ;
|
||||
.float 0.861207228 ;
|
||||
.float -0.196847366 ;
|
||||
.float 0.026927934 ;
|
||||
.float 0.852071006 ;
|
||||
.float -0.189349112 ;
|
||||
.float 0.02983191 ;
|
||||
.float 0.843004628 ;
|
||||
.float -0.182271271 ;
|
||||
.float 0.032850339 ;
|
||||
.float 0.834019204 ;
|
||||
.float -0.17558299 ;
|
||||
.float 0.035977448 ;
|
||||
.float 0.825123967 ;
|
||||
.float -0.169256198 ;
|
||||
.float 0.039207625 ;
|
||||
.float 0.816326531 ;
|
||||
.float -0.163265306 ;
|
||||
.float 0.042535433 ;
|
||||
.float 0.807633118 ;
|
||||
.float -0.15758695 ;
|
||||
.float 0.045955621 ;
|
||||
.float 0.799048751 ;
|
||||
.float -0.152199762 ;
|
||||
.float 0.049463133 ;
|
||||
.float 0.79057742 ;
|
||||
.float -0.147084171 ;
|
||||
.float 0.053053104 ;
|
||||
.float 0.782222222 ;
|
||||
.float -0.142222222 ;
|
||||
.float 0.056720869 ;
|
||||
.float 0.773985488 ;
|
||||
.float -0.13759742 ;
|
||||
.float 0.060461958 ;
|
||||
.float 0.765868887 ;
|
||||
.float -0.133194589 ;
|
||||
.float 0.064272091 ;
|
||||
.float 0.75787352 ;
|
||||
.float -0.128999748 ;
|
||||
.float 0.068147181 ;
|
||||
.float 0.75 ;
|
||||
.float -0.125 ;
|
||||
|
||||
|
||||
_CLALnTableEnd:
|
||||
;############################################################################
|
||||
;//! @}
|
||||
;############################################################################
|
||||
+115
@@ -0,0 +1,115 @@
|
||||
//###########################################################################
|
||||
//
|
||||
// FILE: bootloader_can_timing.h
|
||||
//
|
||||
// TITLE: CAN Timing Definitions.
|
||||
//
|
||||
//###########################################################################
|
||||
// $TI Release: $
|
||||
// $Release Date: $
|
||||
//###########################################################################
|
||||
|
||||
#ifndef BOOTLOADER_CAN_TIMING_H_
|
||||
#define BOOTLOADER_CAN_TIMING_H_
|
||||
|
||||
//
|
||||
// CAN bit timing settings for running CAN at 100kbps with a 20MHz crystal
|
||||
//
|
||||
#define CAN_CALC_BITRATE 100000U
|
||||
#define CAN_CALC_CANCLK 20000000U
|
||||
#define CAN_CALC_BITTIME 25U
|
||||
|
||||
//
|
||||
// CAN bit timing parameters
|
||||
//This code does compile-time calculation of CAN bit timing parameters based on user-provided
|
||||
//input settings. There are some error checks at the end, but you (the user) are ultimately
|
||||
//responsible for verifying and testing the final register value. See section 12 of the CAN
|
||||
//user guide in your F28M35x, F28M36x, or F28x7x TRM for an explanation of CAN timings and
|
||||
//associated requirements. The main requirements are:
|
||||
//
|
||||
//1. One CAN bit must take between 8 and 25 time quanta.
|
||||
//2. Tseg1 and Tseg2 must fit into their respective register fields.
|
||||
//3. The synchronization jump width cannot be longer than either phase segment.
|
||||
//
|
||||
//The calculated bit timing register values is #defined as CAN_CALC_BTRREG.
|
||||
|
||||
//There are three user-controlled parameters that must be #defined before #including this header.
|
||||
//They are (with examples):
|
||||
//
|
||||
//Bit rate (bits/sec) CAN bit rate -- must match the rest of the CAN network
|
||||
//CANCLK (hertz) CAN module peripheral clock frequency before the bit rate prescaler
|
||||
//Bit time (Tq) Number of time quanta per bit; the ratio of prescaled bit clock frequency to bit rate
|
||||
//#define CAN_CALC_BITRATE 50000L
|
||||
//#define CAN_CALC_CANCLK 10000000L
|
||||
//#define CAN_CALC_BITTIME 20
|
||||
//
|
||||
//Other parameters are defined according to the instructions in section 12.2.1
|
||||
//of the CAN spec. Exception: This code rounds PhSeg1 up and PhSeg2 down since a
|
||||
//later sample time works better on most networks. This is implemented by rounding
|
||||
//down PhSeg2 first, then computing PhSeg1 as Tphase - PhSeg2. Calculating in this
|
||||
//order also lets us limit Tseg2 to 8 so it will fit in the register.
|
||||
//
|
||||
//BRP - Bit rate prescaler, which divides down CANCLK to provide the bit clock
|
||||
//Tsync (Tq) Synchronization time delay: Fixed at 1 Tq by the CAN protocol
|
||||
//Tprop (Tq) Propagation delay: <2 microseconds for a <1000 foot bus; assumed to be <2 Tq
|
||||
//Tphase (Tq) Phase compensation buffer for oscillator tolerance: The remainder of the bit time
|
||||
//PhSeg1 (Tq) Phase segment 1: Pre-sample buffer; half of the phase time, rounded up (<=16)
|
||||
//PhSeg2 (Tq) Phase segment 2: Post-sample buffer; half of the phase time, rounded down (<=8)
|
||||
//
|
||||
#define CAN_CALC_BRP (CAN_CALC_CANCLK / (CAN_CALC_BITRATE * CAN_CALC_BITTIME))
|
||||
#define CAN_CALC_TSYNC 1U
|
||||
#define CAN_CALC_TPROP 2U
|
||||
#define CAN_CALC_TPHASE (CAN_CALC_BITTIME - (CAN_CALC_TSYNC + CAN_CALC_TPROP))
|
||||
#define CAN_CALC_PHSEG2 (((CAN_CALC_TPHASE / 2U) <= 8U) ? (CAN_CALC_TPHASE / 2U) : 8U)
|
||||
#define CAN_CALC_PHSEG1 (CAN_CALC_TPHASE - CAN_CALC_PHSEG2)
|
||||
|
||||
//
|
||||
//These parameters are then converted into register values. All parameters
|
||||
//are -1 in the register:
|
||||
//
|
||||
//Tseg1 (Tq) Everything between sync and sample: Tprop + PhSeg1; MUST BE LESS THAN 16
|
||||
//Tseg2 (Tq) Everything between sample and next time: PhSeg2; MUST BE LESS THAN 8
|
||||
//Tsjw (Tq) Synchronization jump width: The lesser of 4 and PhSeg1/2
|
||||
//BRPEREG - Upper 4 bits of bit prescaler; SUBTRACT ONE FROM BRP BEFORE COMPUTING THIS
|
||||
//BRPREG - Lower 6 bits of bit prescaler; SUBTRACT ONE FROM BRP BEFORE COMPUTING THIS
|
||||
//
|
||||
#define CAN_CALC_TSEG1 ((CAN_CALC_PHSEG1 + CAN_CALC_TPROP) - 1U)
|
||||
#define CAN_CALC_TSEG2 (CAN_CALC_PHSEG2 - 1U)
|
||||
#define CAN_CALC_TSJW (((CAN_CALC_PHSEG2 > 4U) ? 4U : CAN_CALC_PHSEG2) - 1U)
|
||||
#define CAN_CALC_BRPEREG ((CAN_CALC_BRP - 1U) / 64U)
|
||||
#define CAN_CALC_BRPREG ((CAN_CALC_BRP - 1U) % 64U)
|
||||
|
||||
//
|
||||
//The final result -- a value to write to the bit timing register
|
||||
//
|
||||
#define CAN_CALC_BTRREG ((CAN_CALC_BRPEREG<<16U) | (CAN_CALC_TSEG2<<12U) | (CAN_CALC_TSEG1<<8U) | (CAN_CALC_TSJW<<6U) | CAN_CALC_BRPREG)
|
||||
|
||||
//
|
||||
// Error and sanity checks
|
||||
//
|
||||
#if (CAN_CALC_BITRATE > 1000000)
|
||||
#error "Can config error: Bit rate cannot exceed 1000000 Hz!
|
||||
#endif
|
||||
#if (CAN_CALC_BITTIME < 8)
|
||||
#error "CAN config error: Bit time cannot be less than 8 time quanta!"
|
||||
#elif (CAN_CALC_BITTIME > 25)
|
||||
#error "CAN config error: Bit time cannot exceed 25 time quanta!"
|
||||
#endif
|
||||
#if (CAN_CALC_BRP * CAN_CALC_BITTIME * CAN_CALC_BITRATE != CAN_CALC_CANCLK)
|
||||
#error "CAN config error: These settings require a fractional prescaler! (CAN_CALC_BITRATE * CAN_CLK_BITTIME) must evenly divide CAN_CALC_CANCLK.
|
||||
#endif
|
||||
#if (CAN_CALC_TSEG1 >= 16)
|
||||
#error "CAN config error: Tseg1 register value cannot be greater than 15! Something is broken in the calculation routine."
|
||||
#endif
|
||||
#if (CAN_CALC_TSEG2 >= 8)
|
||||
#error "CAN config error: Tseg2 register value cannot be greater than 7! Something is broken in the calculation routine."
|
||||
#endif
|
||||
#if (CAN_CALC_TSJW > CAN_CALC_PHSEG1 || CAN_CALC_TSJW > CAN_CALC_PHSEG2)
|
||||
#error "CAN config error: Tsjw cannot be greater than PhSeg1 or PhSeg2! Something is broken in the calculation routine."
|
||||
#endif
|
||||
|
||||
#endif // BOOTLOADER_CAN_TIMING_H_
|
||||
|
||||
//
|
||||
// End of file
|
||||
//
|
||||
+164
@@ -0,0 +1,164 @@
|
||||
//###########################################################################
|
||||
//
|
||||
// FILE: bootloader_usb_registers.h
|
||||
//
|
||||
// TITLE: USB boot loader register definitions and helper macros
|
||||
//
|
||||
//###########################################################################
|
||||
// $TI Release: $
|
||||
// $Release Date: $
|
||||
//###########################################################################
|
||||
|
||||
#ifndef USB_REGS_H_
|
||||
#define USB_REGS_H_
|
||||
|
||||
//
|
||||
//Register read/write helper functions, mostly to provide 8-bit reads on C28x
|
||||
//
|
||||
#define USB0_BASE 0x00040000UL
|
||||
|
||||
//
|
||||
//Register offsets
|
||||
//
|
||||
#define USB_O_FADDR 0x00000000U // USB Device Functional Address
|
||||
#define USB_O_POWER 0x00000001U // USB Power
|
||||
#define USB_O_TXIS 0x00000002U // USB Transmit Interrupt Status
|
||||
#define USB_O_RXIS 0x00000004U // USB Receive Interrupt Status
|
||||
#define USB_O_TXIE 0x00000006U // USB Transmit Interrupt Enable
|
||||
#define USB_O_RXIE 0x00000008U // USB Receive Interrupt Enable
|
||||
#define USB_O_IS 0x0000000AU // USB General Interrupt Status
|
||||
#define USB_O_IE 0x0000000BU // USB Interrupt Enable
|
||||
#define USB_O_FRAME 0x0000000CU // USB Frame Value
|
||||
#define USB_O_EPIDX 0x0000000EU // USB Endpoint Index
|
||||
#define USB_O_TEST 0x0000000FU // USB Test Mode
|
||||
|
||||
#define USB_O_FIFO0 0x00000020U // USB FIFO Endpoint 0
|
||||
#define USB_O_FIFO1 0x00000024U // USB FIFO Endpoint 1
|
||||
#define USB_O_FIFO2 0x00000028U // USB FIFO Endpoint 2
|
||||
#define USB_O_FIFO3 0x0000002CU // USB FIFO Endpoint 3
|
||||
|
||||
#define USB_O_DEVCTL 0x00000060U // USB Device Control
|
||||
#define USB_O_TXFIFOSZ 0x00000062U // USB Transmit Dynamic FIFO Sizing
|
||||
#define USB_O_RXFIFOSZ 0x00000063U // USB Receive Dynamic FIFO Sizing
|
||||
#define USB_O_TXFIFOADD 0x00000064U // USB Transmit FIFO Start Address
|
||||
#define USB_O_RXFIFOADD 0x00000066U // USB Receive FIFO Start Address
|
||||
#define USB_O_CONTIM 0x0000007AU // USB Connect Timing
|
||||
#define USB_O_FSEOF 0x0000007DU // USB Full-Speed Last Transaction to End of Frame Timing
|
||||
#define USB_O_LSEOF 0x0000007EU // USB Low-Speed Last Transaction to End of Frame Timing
|
||||
|
||||
#define USB_O_TXFUNCADDR0 0x00000080U // USB Transmit Functional Address Endpoint 0
|
||||
#define USB_O_TXHUBADDR0 0x00000082U // USB Transmit Hub Address Endpoint 0
|
||||
#define USB_O_TXHUBPORT0 0x00000083U // USB Transmit Hub Port Endpoint 0
|
||||
#define USB_O_TXFUNCADDR1 0x00000088U // USB Transmit Functional Address Endpoint 1
|
||||
#define USB_O_TXHUBADDR1 0x0000008AU // USB Transmit Hub Address Endpont 1
|
||||
#define USB_O_TXHUBPORT1 0x0000008BU // USB Transmit Hub Port Endpoint 1
|
||||
#define USB_O_RXFUNCADDR1 0x0000008CU // USB Receive Functional Address Endpoint 1
|
||||
#define USB_O_RXHUBADDR1 0x0000008EU // USB Receive Hub Address Endpoint 1
|
||||
#define USB_O_RXHUBPORT1 0x0000008FU // USB Receive Hub Port Endpoint 1
|
||||
#define USB_O_TXFUNCADDR2 0x00000090U // USB Transmit Functional Address Endpoint 2
|
||||
#define USB_O_TXHUBADDR2 0x00000092U // USB Transmit Hub Address Endpoint 2
|
||||
#define USB_O_TXHUBPORT2 0x00000093U // USB Transmit Hub Port Endpoint 2
|
||||
#define USB_O_RXFUNCADDR2 0x00000094U // USB Receive Functional Address Endpoint 2
|
||||
#define USB_O_RXHUBADDR2 0x00000096U // USB Receive Hub Address Endpoint 2
|
||||
#define USB_O_RXHUBPORT2 0x00000097U // USB Receive Hub Port Endpoint 2
|
||||
#define USB_O_TXFUNCADDR3 0x00000098U // USB Transmit Functional Address Endpoint 3
|
||||
#define USB_O_TXHUBADDR3 0x0000009AU // USB Transmit Hub Address Endpoint 3
|
||||
#define USB_O_TXHUBPORT3 0x0000009BU // USB Transmit Hub Port Endpoint 3
|
||||
#define USB_O_RXFUNCADDR3 0x0000009CU // USB Receive Functional Address Endpoint 3
|
||||
#define USB_O_RXHUBADDR3 0x0000009EU // USB Receive Hub Address Endpoint 3
|
||||
#define USB_O_RXHUBPORT3 0x0000009FU // USB Receive Hub Port Endpoint 3
|
||||
|
||||
#define USB_O_CSRL0 0x00000102U // USB Control and Status Endpoint 0 Low
|
||||
#define USB_O_CSRH0 0x00000103U // USB Control and Status Endpoint 0 High
|
||||
#define USB_O_COUNT0 0x00000108U // USB Receive Byte Count Endpoint 0
|
||||
#define USB_O_TYPE0 0x0000010AU // USB Type Endpoint 0
|
||||
#define USB_O_NAKLMT 0x0000010BU // USB NAK Limit
|
||||
#define USB_O_TXMAXP1 0x00000110U // USB Maximum Transmit Data Endpoint 1
|
||||
#define USB_O_TXCSRL1 0x00000112U // USB Transmit Control and Status Endpoint 1 Low
|
||||
#define USB_O_TXCSRH1 0x00000113U // USB Transmit Control and Status Endpoint 1 High
|
||||
#define USB_O_RXMAXP1 0x00000114U // USB Maximum Receive Data Endpoint 1
|
||||
#define USB_O_RXCSRL1 0x00000116U // USB Receive Control and Status Endpoint 1 Low
|
||||
#define USB_O_RXCSRH1 0x00000117U // USB Receive Control and Status Endpoint 1 High
|
||||
#define USB_O_RXCOUNT1 0x00000118U // USB Receive Byte Count Endpoint 1
|
||||
#define USB_O_TXTYPE1 0x0000011AU // USB Host Transmit Configure Type Endpoint 1
|
||||
#define USB_O_TXINTERVAL1 0x0000011BU // USB Host Transmit Interval Endpoint 1
|
||||
#define USB_O_RXTYPE1 0x0000011CU // USB Host Configure Receive Type Endpoint 1
|
||||
#define USB_O_RXINTERVAL1 0x0000011DU // USB Host Receive Polling Interval Endpoint 1
|
||||
#define USB_O_TXMAXP2 0x00000120U // USB Maximum Transmit Data Endpoint 2
|
||||
#define USB_O_TXCSRL2 0x00000122U // USB Transmit Control and Status Endpoint 2 Low
|
||||
#define USB_O_TXCSRH2 0x00000123U // USB Transmit Control and Status Endpoint 2 High
|
||||
#define USB_O_RXMAXP2 0x00000124U // USB Maximum Receive Data Endpoint 2
|
||||
#define USB_O_RXCSRL2 0x00000126U // USB Receive Control and Status Endpoint 2 Low
|
||||
#define USB_O_RXCSRH2 0x00000127U // USB Receive Control and Status Endpoint 2 High
|
||||
#define USB_O_RXCOUNT2 0x00000128U // USB Receive Byte Count Endpoint 2
|
||||
#define USB_O_TXTYPE2 0x0000012AU // USB Host Transmit Configure Type Endpoint 2
|
||||
#define USB_O_TXINTERVAL2 0x0000012BU // USB Host Transmit Interval Endpoint 2
|
||||
#define USB_O_RXTYPE2 0x0000012CU // USB Host Configure Receive Type Endpoint 2
|
||||
#define USB_O_RXINTERVAL2 0x0000012DU // USB Host Receive Polling Interval Endpoint 2
|
||||
#define USB_O_TXMAXP3 0x00000130U // USB Maximum Transmit Data Endpoint 3
|
||||
#define USB_O_TXCSRL3 0x00000132U // USB Transmit Control and Status Endpoint 3 Low
|
||||
#define USB_O_TXCSRH3 0x00000133U // USB Transmit Control and Status Endpoint 3 High
|
||||
#define USB_O_RXMAXP3 0x00000134U // USB Maximum Receive Data Endpoint 3
|
||||
#define USB_O_RXCSRL3 0x00000136U // USB Receive Control and Status Endpoint 3 Low
|
||||
#define USB_O_RXCSRH3 0x00000137U // USB Receive Control and Status Endpoint 3 High
|
||||
#define USB_O_RXCOUNT3 0x00000138U // USB Receive Byte Count Endpoint 3
|
||||
#define USB_O_TXTYPE3 0x0000013AU // USB Host Transmit Configure Type Endpoint 3
|
||||
#define USB_O_TXINTERVAL3 0x0000013BU // USB Host Transmit Interval Endpoint 3
|
||||
#define USB_O_RXTYPE3 0x0000013CU // USB Host Configure Receive Type Endpoint 3
|
||||
#define USB_O_RXINTERVAL3 0x0000013DU // USB Host Receive Polling Interval Endpoint 3
|
||||
#define USB_O_RQPKTCOUNT1 0x00000304U // USB Request Packet Count in Block Transfer Endpoint 1
|
||||
#define USB_O_RQPKTCOUNT2 0x00000308U // USB Request Packet Count in Block Transfer Endpoint 2
|
||||
#define USB_O_RQPKTCOUNT3 0x0000030CU // USB Request Packet Count in Block Transfer Endpoint 3
|
||||
|
||||
#define USB_O_RXDPKTBUFDIS 0x00000340U // USB Receive Double Packet Buffer Disable
|
||||
#define USB_O_TXDPKTBUFDIS 0x00000342U // USB Transmit Double Packet Buffer Disable
|
||||
#define USB_O_EPC 0x00000400U // USB External Power Control
|
||||
#define USB_O_EPCRIS 0x00000404U // USB External Power Control Raw Interrupt Status
|
||||
#define USB_O_EPCIM 0x00000408U // USB External Power Control Interrupt Mask
|
||||
#define USB_O_EPCISC 0x0000040CU // USB External Power Control Interrupt Status and Clear
|
||||
#define USB_O_DRRIS 0x00000410U // USB Device RESUME Raw Interrupt Status
|
||||
#define USB_O_DRIM 0x00000414U // USB Device RESUME Interrupt Mask
|
||||
#define USB_O_DRISC 0x00000418U // USB Device RESUME Interrupt Status and Clear
|
||||
#define USB_O_GPCS 0x0000041CU // USB General-Purpose Control and Status
|
||||
#define USB_O_IDVISC 0x0000444CU // USB ID Valid Detect Interrupt status and clear
|
||||
#define USB_O_DMASEL 0x00000450U // USB DMA Select
|
||||
|
||||
//
|
||||
//Bit definitions for USB_O_POWER
|
||||
//
|
||||
#define USB_POWER_ISOUP 0x00000080U // Isochronous Update
|
||||
#define USB_POWER_SOFTCONN 0x00000040U // Soft Connect/Disconnect
|
||||
#define USB_POWER_RESET 0x00000008U // RESET Signaling
|
||||
#define USB_POWER_RESUME 0x00000004U // RESUME Signaling
|
||||
#define USB_POWER_SUSPEND 0x00000002U // SUSPEND Mode
|
||||
#define USB_POWER_PWRDNPHY 0x00000001U // Power Down PHY
|
||||
|
||||
//
|
||||
//Bit definitions for USB_O_IE
|
||||
//
|
||||
#define USB_IE_VBUSERR 0x00000080U // Enable VBUS Error Interrupt
|
||||
#define USB_IE_SESREQ 0x00000040U // Enable Session Request
|
||||
#define USB_IE_DISCON 0x00000020U // Enable Disconnect Interrupt
|
||||
#define USB_IE_CONN 0x00000010U // Enable Connect Interrupt
|
||||
#define USB_IE_SOF 0x00000008U // Enable Start-of-Frame Interrupt
|
||||
#define USB_IE_RESET 0x00000004U // Enable RESET Interrupt
|
||||
#define USB_IE_RESUME 0x00000002U // Enable RESUME Interrupt
|
||||
#define USB_IE_SUSPND 0x00000001U // Enable SUSPEND Interrupt
|
||||
|
||||
//
|
||||
//Bit definitions for USB_O_CSRL0
|
||||
//
|
||||
#define USB_CSRL0_RXRDY 0x01U // Received packet is ready
|
||||
#define USB_CSRL0_TXRDY 0x02U // Transmit FIFO is ready for transmission
|
||||
#define USB_CSRL0_STALLED 0x04U // Stall handshake has been sent
|
||||
#define USB_CSRL0_DATAEND 0x08U // Set to indicate no more TX/RX data
|
||||
#define USB_CSRL0_SETEND 0x10U // Control transfer ended prematurely
|
||||
#define USB_CSRL0_STALL 0x20U // Send a stall
|
||||
#define USB_CSRL0_RXRDYC 0x40U // Clear the RXRDY bit
|
||||
#define USB_CSRL0_SETENDC 0x80U // Clear the SETEND bit
|
||||
|
||||
#endif //USB_REGS_H_
|
||||
|
||||
//
|
||||
// End of file
|
||||
//
|
||||
+191
@@ -0,0 +1,191 @@
|
||||
//###########################################################################
|
||||
//
|
||||
// FILE: bootloader_usb_structs.h
|
||||
//
|
||||
// TITLE: USB boot loader descriptor structure definitions
|
||||
//
|
||||
//###########################################################################
|
||||
// $TI Release: $
|
||||
// $Release Date: $
|
||||
//###########################################################################
|
||||
|
||||
#ifndef USB_STRUCTS_H_
|
||||
#define USB_STRUCTS_H_
|
||||
|
||||
//
|
||||
// Included Files
|
||||
//
|
||||
#include "cpu1bootrom.h"
|
||||
|
||||
|
||||
//Descriptor types
|
||||
#define USB_DTYPE_DEVICE 0x01U
|
||||
#define USB_DTYPE_CONFIG 0x02U
|
||||
#define USB_DTYPE_STRING 0x03U
|
||||
#define USB_DTYPE_INTERFACE 0x04U
|
||||
#define USB_DTYPE_ENDPOINT 0x05U
|
||||
#define USB_DTYPE_DEVICE_QUAL 0x06U
|
||||
#define USB_DTYPE_OSPEED_CONF 0x07U
|
||||
#define USB_DTYPE_INTERFACE_PWR 0x08U
|
||||
|
||||
//
|
||||
// Device descriptor
|
||||
//
|
||||
typedef struct
|
||||
{
|
||||
uint16_t bDescriptorType_bLength; //[7:0] Descriptor length in bytes (18 for device)
|
||||
//[15:8] Descriptor type (0x01 for device)
|
||||
uint16_t bcdUSB; //USB specification number -- 0x0110 for low/full speed
|
||||
uint16_t bDeviceSubClass_bDeviceClass; //[7:0] Subclass code
|
||||
//[15:8] Class code -- 0x00 for interface-specific, 0xFF for vendor-specific
|
||||
uint16_t bMaxPacketSize_bDeviceProtocol; //[7:0] Protocol code
|
||||
//[15:8] Maximum packet size for EP0 (64 for Soprano)
|
||||
uint16_t idVendor; //Vendor ID code -- 0x1CBE for TI
|
||||
uint16_t idProduct; //Product ID code -- assigned by manufacturer
|
||||
uint16_t bcdDevice; //Device release number
|
||||
uint16_t iProduct_iManufacturer; //[7:0] Index of manufacturer string descriptor
|
||||
//[15:8] Index of product string descriptor
|
||||
uint16_t bNumConfigurations_iSerialNumber; //[7:0] Index of serial number string descriptor
|
||||
//[15:8] Number of possible configurations
|
||||
} sUsbDeviceDescriptor;
|
||||
|
||||
//
|
||||
// Configuration descriptor
|
||||
//
|
||||
typedef struct
|
||||
{
|
||||
uint16_t bDescriptorType_bLength; //[7:0] Descriptor length in bytes (9+1 for configuration)
|
||||
//[15:8] Descriptor type (0x02 for configuration)
|
||||
uint16_t wTotalLength; //Total length of config, interface, and endpoint descriptors
|
||||
uint16_t bConfigurationValue_bNumInterfaces; //[7:0] Number of interfaces in this descriptor
|
||||
//[15:8] ID number of this configuration
|
||||
uint16_t bmAttributes_iConfiguration; //[7:0] Index of configuration string descriptor
|
||||
//[15] Reserved, set to 1
|
||||
//[14] Self-powered
|
||||
//[13] Remote wake-up
|
||||
//[12:8] Reserved, set to 0
|
||||
uint16_t padding_bMaxPower; //[7:0] Max power consumption in 2mA units
|
||||
//[15:8] Unused -- only present for alignment
|
||||
} sUsbConfigDescriptor;
|
||||
|
||||
//
|
||||
// Interface descriptor
|
||||
//
|
||||
typedef struct
|
||||
{
|
||||
uint16_t bDescriptorType_bLength; //[7:0] Descriptor length in bytes (9+1 for interface)
|
||||
//[15:8] Descriptor type (0x04 for interface)
|
||||
uint16_t bAlternateSetting_bInterfaceNumber; //[7:0] Alternate interface number for SetInterface
|
||||
//[15:8] ID number of this interface
|
||||
uint16_t bInterfaceClass_bNumEndpoints; //[7:0] Number of endpoints used by this interface
|
||||
//[15:8] Interface-specific class code
|
||||
uint16_t bInterfaceProtocol_bInterfaceSubclass; //[7:0] Interface-specific subclass code
|
||||
//[15:8] Interface-specific protocol code
|
||||
uint16_t padding_iInterface; //[7:0] Index of interface string descriptor
|
||||
//[15:8] Unused -- only present for alignment
|
||||
} sUsbInterfaceDescriptor;
|
||||
|
||||
//
|
||||
// Endpoint descriptor
|
||||
//
|
||||
typedef struct
|
||||
{
|
||||
uint16_t bDescriptorType_bLength; //[7:0] Descriptor length in bytes (7+1 for endpoint)
|
||||
//[15:8] Descriptor type (0x05 for interface)
|
||||
struct
|
||||
{
|
||||
//bEndpointAddress
|
||||
uint16_t endpointNumber : 4; //Endpoint number
|
||||
uint16_t rsvd1 : 3; //Reserved -- set to 0
|
||||
uint16_t direction : 1; //0: OUT, 1: IN (ignored for control endpoints)
|
||||
|
||||
//bmAttributes
|
||||
uint16_t transferType : 2; //0x0: Control, 0x1: Isochronous, 0x2: Bulk, 0x3: Interrupt
|
||||
uint16_t syncMode : 2; //Synchronization mode (isochronous only)
|
||||
uint16_t usageType : 2; //Usage type (isochronous only)
|
||||
uint16_t rsvd2 : 2; //Reserved
|
||||
} bmAttributes_bEndpointAddress;
|
||||
|
||||
uint16_t wMaxPacketSize; //Maximum packet size this endpoint can send or receive
|
||||
uint16_t padding_bInterval; //[7:0] Interval for polling data transfers (ignored for bulk and control)
|
||||
//[15:0] Unused -- only present for alignment
|
||||
} sUsbEndpointDescriptor;
|
||||
|
||||
//
|
||||
// String descriptor
|
||||
//
|
||||
typedef struct
|
||||
{
|
||||
uint16_t bDescriptorType_bLength; //[7:0] Descriptor length in bytes (2+L for string)
|
||||
//[15:8] Descriptor type (0x03 for string)
|
||||
const char *bString; //Pointer to the actual string
|
||||
} sUsbStringDescriptor;
|
||||
|
||||
//
|
||||
// Standard control request identifiers
|
||||
//
|
||||
#define USB_REQ_GET_STATUS 0x00U
|
||||
#define USB_REQ_CLEAR_FEATURE 0x01U
|
||||
#define USB_REQ_SET_FEATURE 0x03U
|
||||
#define USB_REQ_SET_ADDRESS 0x05U
|
||||
#define USB_REQ_GET_DESCRIPTOR 0x06U
|
||||
#define USB_REQ_SET_DESCRIPTOR 0x07U
|
||||
#define USB_REQ_GET_CONFIG 0x08U
|
||||
#define USB_REQ_SET_CONFIG 0x09U
|
||||
#define USB_REQ_GET_INTERFACE 0x0AU
|
||||
#define USB_REQ_SET_INTERFACE 0x0BU
|
||||
|
||||
//
|
||||
// Control request types
|
||||
//
|
||||
#define USB_REQTYPE_STD 0x0U
|
||||
#define USB_REQTYPE_CLASS 0x1U
|
||||
#define USB_REQTYPE_VENDOR 0x2U
|
||||
|
||||
//
|
||||
// Control request recipients
|
||||
//
|
||||
#define USB_REQREC_DEVICE 0x0U
|
||||
#define USB_REQREC_INTERFACE 0x1U
|
||||
#define USB_REQREC_ENDPOINT 0x2U
|
||||
#define USB_REQREC_OTHER 0x3U
|
||||
|
||||
//
|
||||
// Control request data packet format (received from host during enumeration)
|
||||
//
|
||||
typedef struct
|
||||
{
|
||||
struct
|
||||
{
|
||||
uint16_t recipient : 5; //[4:0] Recipient (0: device, 1: interface, 2: endpoint, 3: other)
|
||||
uint16_t reqType : 2; //[6:5] Request type (00: standard, 01: class-specific, 10: vendor-specific)
|
||||
uint16_t dataDir : 1; //[7] Direction of data flow (0: OUT, 1: IN)
|
||||
uint16_t bRequest : 8; //[15:8] Request identifier
|
||||
} bmRequestType_bRequest;
|
||||
uint16_t wValue; //Extra request-specific information
|
||||
uint16_t wIndex; //Extra request-specific information
|
||||
uint16_t wLength; //Max number of bytes expected in the follow-up data packet (0: no data packet)
|
||||
} sUsbRequestPacket;
|
||||
|
||||
//
|
||||
// Implementations for use in the control request handler
|
||||
//
|
||||
extern const sUsbDeviceDescriptor loaderDeviceDescriptor;
|
||||
extern const sUsbStringDescriptor langDescriptor;
|
||||
extern const sUsbStringDescriptor mfgDescriptor;
|
||||
extern const sUsbStringDescriptor prodDescriptor;
|
||||
extern const sUsbStringDescriptor serialDescriptor;
|
||||
extern const sUsbStringDescriptor loaderStringDescriptor;
|
||||
extern const sUsbStringDescriptor * const stringDescriptors[];
|
||||
|
||||
//
|
||||
// Function prototypes
|
||||
//
|
||||
void CombineUsbDescriptors(uint16_t *buffer);
|
||||
|
||||
|
||||
#endif //USB_STRUCTS_H_
|
||||
|
||||
//
|
||||
// End of file
|
||||
//
|
||||
+81
@@ -0,0 +1,81 @@
|
||||
//###########################################################################
|
||||
//
|
||||
// FILE: bootloader_usb_support_funcs.h
|
||||
//
|
||||
// TITLE: USB boot loader support definitions
|
||||
//
|
||||
//###########################################################################
|
||||
// $TI Release: $
|
||||
// $Release Date: $
|
||||
//###########################################################################
|
||||
|
||||
#ifndef USB_BOOT_FUNCS_H_
|
||||
#define USB_BOOT_FUNCS_H_
|
||||
|
||||
//
|
||||
// Included Files
|
||||
//
|
||||
#include "cpu1bootrom.h"
|
||||
#include "bootloader_usb_registers.h"
|
||||
#include "bootloader_usb_structs.h"
|
||||
|
||||
//
|
||||
//Truth and falsehood
|
||||
//
|
||||
#ifndef true
|
||||
#define true 1U
|
||||
#endif
|
||||
|
||||
#ifndef false
|
||||
#define false 0U
|
||||
#endif
|
||||
|
||||
//
|
||||
//Max packet size for endpoint 0
|
||||
//
|
||||
#define EP0_MAX_PACKET_SIZE 64U
|
||||
|
||||
//
|
||||
//USB endpoint state enum
|
||||
//
|
||||
typedef enum
|
||||
{
|
||||
USB_STATE_IDLE, //Waiting for a request from the host controller
|
||||
USB_STATE_TX, //Sending data to the host due to an IN request
|
||||
USB_STATE_RX, //Receiving data from the host due to an OUT request
|
||||
USB_STATE_STALL, //Waiting for the host to acknowledge a stall condition
|
||||
USB_STATE_STATUS //Waiting for the host to acknowledge completion of an IN or OUT request
|
||||
} eEndpointState;
|
||||
|
||||
//
|
||||
// DATAEND selector enum
|
||||
//
|
||||
typedef enum
|
||||
{
|
||||
USB_MORE_DATA, //Do not set the DATAEND bit
|
||||
USB_END_DATA //Set the DATAEND bit
|
||||
} eDataEnd;
|
||||
|
||||
//
|
||||
// Function prototypes
|
||||
//
|
||||
interrupt void UsbIntHandler(void);
|
||||
static void UsbEndpoint0StateMachine(void);
|
||||
static eEndpointState HandleControlRequest(const sUsbRequestPacket *req);
|
||||
static void CopyStringDescriptor(const sUsbStringDescriptor *strDesc, uint16_t *buffer);
|
||||
void ResetUsbDriver(void);
|
||||
|
||||
void TxDataEp0(const uint16_t *data, uint16_t length8, eDataEnd dataEnd);
|
||||
uint16_t RxDataEp0(uint16_t *data);
|
||||
static void StallEp0(void);
|
||||
void AckEp0(eDataEnd dataEnd);
|
||||
|
||||
uint16_t RxDataEp1(uint16_t *data);
|
||||
void AckEp1(void);
|
||||
|
||||
|
||||
#endif //USB_BOOT_FUNCS_H_
|
||||
|
||||
//
|
||||
// End of file
|
||||
//
|
||||
+519
@@ -0,0 +1,519 @@
|
||||
//###########################################################################
|
||||
//
|
||||
// FILE: cpu1bootrom.h
|
||||
//
|
||||
// TITLE: CPU1 BootROM Definitions.
|
||||
//
|
||||
//###########################################################################
|
||||
// $TI Release: $
|
||||
// $Release Date: $
|
||||
//###########################################################################
|
||||
|
||||
#ifndef CPU1_BOOTROM_H_
|
||||
#define CPU1_BOOTROM_H_
|
||||
|
||||
//
|
||||
// Included Files
|
||||
//
|
||||
#include <stdint.h>
|
||||
#include "hw_types.h"
|
||||
#include "hw_memmap.h"
|
||||
#include "hw_sysctl.h"
|
||||
#include "hw_sci.h"
|
||||
#include "hw_i2c.h"
|
||||
#include "hw_memcfg.h"
|
||||
#include "hw_asysctl.h"
|
||||
#include "hw_dcsm.h"
|
||||
#include "sysctl.h"
|
||||
#include "cpu.h"
|
||||
#include "flash.h"
|
||||
#include "pin_map.h"
|
||||
#include "gpio.h"
|
||||
#include "sci.h"
|
||||
#include "spi.h"
|
||||
#include "i2c.h"
|
||||
#include "can.h"
|
||||
#include "pbist.h"
|
||||
#include "dcc.h"
|
||||
|
||||
//
|
||||
// BootROM System Clock (10MHz)
|
||||
//
|
||||
#define BOOTROM_SYSCLK 10000000UL
|
||||
|
||||
//
|
||||
// Flash Configurations
|
||||
//
|
||||
#define CPU1_FLASH_15MHZ_PSLEEP (0xE1U * 2)
|
||||
#define CPU1_FLASH_15MHZ_RWAIT 0x1U
|
||||
#define CPU1_FLASH_DEFAULT_PSLEEP (0xA41U * 2)
|
||||
#define CPU1_FLASH_DEFAULT_RWAIT 0x3U
|
||||
#define CPU1_FLASH_15MHZ_TIMEOUT_VALUE 91U //Loop ~28cycles (Freq = 15MHz)
|
||||
//(Loop timeout value = (170us * freq)/28cycles)
|
||||
|
||||
//
|
||||
// DCx Registers
|
||||
//
|
||||
#define BROM_SYSCTL_O_DC6 0x1CU
|
||||
#define BROM_SYSCTL_O_DC13 0x2AU
|
||||
#define BROM_SYSCTL_O_DC16 0x30U
|
||||
#define BROM_SYSCTL_O_DC23 0x3EU
|
||||
|
||||
|
||||
//
|
||||
// Emulation Boot Defines
|
||||
//
|
||||
|
||||
//
|
||||
// Emulation Boot Configuration Registers (Emulates DCSM OTP registers)
|
||||
//
|
||||
#define EMU_BOOTPIN_CONFIG 0xD00U //Equivalent to Z1 DCSM GPREG1
|
||||
#define EMU_BOOT_GPREG2 0xD02U //Equivalent to Z1 DCSM GPREG2
|
||||
#define EMU_BOOTDEF_LOW 0xD04U //Equivalent to Z1 DCSM GPREG3
|
||||
#define EMU_BOOTDEF_HIGH 0xD06U //Equivalent to Z1 DCSM GPREG4
|
||||
|
||||
//
|
||||
// Get key to validate Emulation BOOTPIN_CONFIG
|
||||
//
|
||||
#define EMU_BOOTPIN_CONFIG_KEY ((HWREG(EMU_BOOTPIN_CONFIG) & (uint32_t)0xFF000000UL) >> 24U)
|
||||
|
||||
//
|
||||
// Emulation macros to extract boot definition from BOOTDEF table at
|
||||
// specified index
|
||||
//
|
||||
#define EMU_BOOTDEF_L(x) ((HWREG(EMU_BOOTDEF_LOW) & ((uint32_t)0xFFU << (8U*x))) >> (8U*x))
|
||||
#define EMU_BOOTDEF_H(x) ((HWREG(EMU_BOOTDEF_HIGH) & ((uint32_t)0xFFU << (8U*x))) >> (8U*x))
|
||||
|
||||
|
||||
//
|
||||
// Standalone Boot Defines
|
||||
//
|
||||
|
||||
//
|
||||
// DCSM OTP Boot Configuration Registers
|
||||
//
|
||||
#define Z1_OTP_BOOTPIN_CONFIG (DCSM_Z1_BASE + (uint32_t)DCSM_O_Z1_GPREG1)
|
||||
#define Z1_OTP_BOOT_GPREG2 (DCSM_Z1_BASE + (uint32_t)DCSM_O_Z1_GPREG2)
|
||||
#define Z1_OTP_BOOTDEF_LOW (DCSM_Z1_BASE + (uint32_t)DCSM_O_Z1_GPREG3)
|
||||
#define Z1_OTP_BOOTDEF_HIGH (DCSM_Z1_BASE + (uint32_t)DCSM_O_Z1_GPREG4)
|
||||
#define Z2_OTP_BOOTPIN_CONFIG (DCSM_Z2_BASE + (uint32_t)DCSM_O_Z2_GPREG1)
|
||||
#define Z2_OTP_BOOT_GPREG2 (DCSM_Z2_BASE + (uint32_t)DCSM_O_Z2_GPREG2)
|
||||
#define Z2_OTP_BOOTDEF_LOW (DCSM_Z2_BASE + (uint32_t)DCSM_O_Z2_GPREG3)
|
||||
#define Z2_OTP_BOOTDEF_HIGH (DCSM_Z2_BASE + (uint32_t)DCSM_O_Z2_GPREG4)
|
||||
|
||||
//
|
||||
// GPREG2 Defines - Get Key and Get PBIST enable status
|
||||
//
|
||||
#define HWREAD_Z1_OTP_BOOT_GPREG2_KEY ((HWREG(Z1_OTP_BOOT_GPREG2) & (uint32_t)0xFF000000UL) >> 24U)
|
||||
#define HWREAD_Z1_OTP_BOOT_GPREG2_PBIST_CONFIG ((HWREG(Z1_OTP_BOOT_GPREG2) & (uint32_t)0x000000F0UL) >> 4U)
|
||||
#define HWREAD_Z2_OTP_BOOT_GPREG2_KEY ((HWREG(Z2_OTP_BOOT_GPREG2) & (uint32_t)0xFF000000UL) >> 24U)
|
||||
#define HWREAD_Z2_OTP_BOOT_GPREG2_PBIST_CONFIG ((HWREG(Z2_OTP_BOOT_GPREG2) & (uint32_t)0x000000F0UL) >> 4U)
|
||||
#define GPREG2_KEY 0x5AU
|
||||
#define GPREG2_PBIST_PLL_ENABLE_HIGH_SPEED 0x0UL
|
||||
#define GPREG2_PBIST_PLL_ENABLE_MED_SPEED 0xCUL
|
||||
#define GPREG2_PBIST_PLL_ENABLE_LOW_SPEED 0x3UL
|
||||
#define GPREG2_PBIST_PLL_DISABLED 0x9UL
|
||||
#define PBIST_CHECKSUM_SUCCESS 0x0U
|
||||
|
||||
//
|
||||
// Get key to validate Z1 OTP BOOTPIN_CONFIG
|
||||
//
|
||||
#define HWREAD_Z1_OTP_BOOTPIN_CONFIG_KEY ((HWREG(Z1_OTP_BOOTPIN_CONFIG) & (uint32_t)0xFF000000UL) >> 24U)
|
||||
#define HWREAD_Z2_OTP_BOOTPIN_CONFIG_KEY ((HWREG(Z2_OTP_BOOTPIN_CONFIG) & (uint32_t)0xFF000000UL) >> 24U)
|
||||
|
||||
//
|
||||
// Standalone macros to extract boot definition from BOOTDEF table at
|
||||
// specified index
|
||||
//
|
||||
#define HWREAD_Z1_OTP_BOOTDEF_L(x) ((HWREG(Z1_OTP_BOOTDEF_LOW) & ((uint32_t)0xFFUL << (8U*(x)))) >> (8U*(x)))
|
||||
#define HWREAD_Z1_OTP_BOOTDEF_H(x) ((HWREG(Z1_OTP_BOOTDEF_HIGH) & ((uint32_t)0xFFUL << (8U*(x)))) >> (8U*(x)))
|
||||
#define HWREAD_Z2_OTP_BOOTDEF_L(x) ((HWREG(Z2_OTP_BOOTDEF_LOW) & ((uint32_t)0xFFUL << (8U*(x)))) >> (8U*(x)))
|
||||
#define HWREAD_Z2_OTP_BOOTDEF_H(x) ((HWREG(Z2_OTP_BOOTDEF_HIGH) & ((uint32_t)0xFFUL << (8U*(x)))) >> (8U*(x)))
|
||||
|
||||
|
||||
//
|
||||
// Boot Pin and Boot Mode Options
|
||||
//
|
||||
|
||||
//
|
||||
// Default Boot Mode Select Pins
|
||||
//
|
||||
#define FACTORY_DEFAULT_BMSP0 84U //GPIO84
|
||||
#define FACTORY_DEFAULT_BMSP1 72U //GPIO72
|
||||
|
||||
//
|
||||
// Parallel IO Boot Options
|
||||
//
|
||||
#define PARALLEL_BOOT 0x00U
|
||||
|
||||
//
|
||||
// SCI Boot Options
|
||||
//
|
||||
#define SCI_BOOT 0x01U //GPIO29, 28
|
||||
#define SCI_BOOT_ALT1 0x21U //GPIO84, 85
|
||||
#define SCI_BOOT_ALT2 0x41U //GPIO36, 35
|
||||
#define SCI_BOOT_ALT3 0x61U //GPIO42, 43
|
||||
#define SCI_BOOT_ALT4 0x81U //GPIO65, 64
|
||||
#define SCI_BOOT_ALT5 0xA1U //GPIO135, 136
|
||||
#define SCI_BOOT_ALT6 0xC1U //GPIO8, 9
|
||||
|
||||
//
|
||||
// CAN Boot Options
|
||||
//
|
||||
#define CAN_BOOT 0x02U //GPIO37, 36
|
||||
#define CAN_BOOT_ALT1 0x22U //GPIO71, 70
|
||||
#define CAN_BOOT_ALT2 0x42U //GPIO63, 62
|
||||
#define CAN_BOOT_ALT3 0x62U //GPIO19, 18
|
||||
#define CAN_BOOT_ALT4 0x82U //GPIO4, 5
|
||||
#define CAN_BOOT_ALT5 0xA2U //GPIO31, 30
|
||||
|
||||
#define CAN_BOOT_SENDTEST 0xC2U //GPIO37, 36
|
||||
#define CAN_BOOT_ALT1_SENDTEST 0xD2U //GPIO71, 70
|
||||
#define CAN_BOOT_ALT2_SENDTEST 0xE2U //GPIO63, 62
|
||||
#define CAN_BOOT_ALT3_SENDTEST 0xF2U //GPIO19, 18
|
||||
#define CAN_BOOT_ALT4_SENDTEST 0x2F2U //GPIO4, 5
|
||||
#define CAN_BOOT_ALT5_SENDTEST 0x3F2U //GPIO31, 30
|
||||
|
||||
//
|
||||
// Flash Boot Options
|
||||
//
|
||||
#define FLASH_BOOT 0x03U //Start of BANK 0 Sector 0
|
||||
#define FLASH_BOOT_ALT1 0x23U //Start of BANK 0 Sector 4
|
||||
#define FLASH_BOOT_ALT2 0x43U //Start of BANK 0 Sector 8
|
||||
#define FLASH_BOOT_ALT3 0x63U //Start of BANK 0 Sector 13
|
||||
|
||||
//
|
||||
// Wait Boot Options
|
||||
//
|
||||
#define WAIT_BOOT 0x04U //Wait mode with WDOG enabled
|
||||
#define WAIT_BOOT_ALT1 0x24U //Wait mode with WDOG disabled
|
||||
|
||||
//
|
||||
// RAM Boot Options
|
||||
//
|
||||
#define RAM_BOOT 0x05U //Start of M0 RAM
|
||||
|
||||
//
|
||||
// SPI Boot Options
|
||||
//
|
||||
#define SPI_MASTER_BOOT 0x06U //GPIO58-61
|
||||
#define SPI_MASTER_BOOT_ALT1 0x26U //GPIO16-19
|
||||
#define SPI_MASTER_BOOT_ALT2 0x46U //GPIO32-35
|
||||
#define SPI_MASTER_BOOT_ALT3 0x66U //GPIO16,17,56,57
|
||||
#define SPI_MASTER_BOOT_ALT4 0x86U //GPIO54-57
|
||||
|
||||
//
|
||||
// I2C Boot Options
|
||||
//
|
||||
#define I2C_MASTER_BOOT 0x07U //GPIO91,92
|
||||
#define I2C_MASTER_BOOT_ALT1 0x27U //GPIO32,33
|
||||
#define I2C_MASTER_BOOT_ALT2 0x47U //GPIO42,43
|
||||
#define I2C_MASTER_BOOT_ALT3 0x67U //GPIO0,1
|
||||
#define I2C_MASTER_BOOT_ALT4 0x87U //GPIO104,105
|
||||
|
||||
//
|
||||
// USB Boot Options
|
||||
//
|
||||
#define USB_BOOT 0x09U //GPIO42,43
|
||||
|
||||
//
|
||||
// Secure Flash Boot Options
|
||||
//
|
||||
#define SECURE_FLASH_BOOT 0x0AU //Start of BANK 0 Sector 0
|
||||
#define SECURE_FLASH_BOOT_ALT1 0x2AU //Start of BANK 0 Sector 4
|
||||
#define SECURE_FLASH_BOOT_ALT2 0x4AU //Start of BANK 0 Sector 8
|
||||
#define SECURE_FLASH_BOOT_ALT3 0x6AU //Start of BANK 0 Sector 13
|
||||
|
||||
|
||||
//
|
||||
// Fixed Boot Entry Points (Addresses)
|
||||
//
|
||||
|
||||
//
|
||||
// Flash (secure and unsecured) Entry Points
|
||||
//
|
||||
#define FLASH_ENTRY_POINT 0x080000UL //BANK0 Sector 0
|
||||
#define FLASH_ENTRY_POINT_ALT1 0x088000UL //BANK0 Sector 4
|
||||
#define FLASH_ENTRY_POINT_ALT2 0x0A8000UL //BANK0 sector 8
|
||||
#define FLASH_ENTRY_POINT_ALT3 0x0BE000UL //BANK0 sector 13
|
||||
|
||||
//
|
||||
// RAM Entry Point
|
||||
//
|
||||
#define RAM_ENTRY_POINT 0x000000UL //M0 start address
|
||||
|
||||
|
||||
//
|
||||
// CPU1 Boot ROM Status Bit Fields
|
||||
//
|
||||
#define CPU1_BOOTROM_BOOTSTS_BOOT_MASK 0x000000FFUL
|
||||
|
||||
#define CPU1_BOOTROM_BOOTSTS_SYSTEM_START_BOOT 0x00000001UL
|
||||
#define CPU1_BOOTROM_BOOTSTS_IN_FLASH_BOOT 0x00000002UL
|
||||
#define CPU1_BOOTROM_BOOTSTS_IN_SECURE_FLASH_BOOT 0x00000003UL
|
||||
#define CPU1_BOOTROM_BOOTSTS_IN_PARALLEL_BOOT 0x00000004UL
|
||||
#define CPU1_BOOTROM_BOOTSTS_IN_RAM_BOOT 0x00000005UL
|
||||
#define CPU1_BOOTROM_BOOTSTS_IN_SCI_BOOT 0x00000006UL
|
||||
#define CPU1_BOOTROM_BOOTSTS_IN_SPI_BOOT 0x00000007UL
|
||||
#define CPU1_BOOTROM_BOOTSTS_IN_I2C_BOOT 0x00000008UL
|
||||
#define CPU1_BOOTROM_BOOTSTS_IN_CAN_BOOT 0x00000009UL
|
||||
#define CPU1_BOOTROM_BOOTSTS_IN_USB_BOOT 0x0000000AUL
|
||||
#define CPU1_BOOTROM_BOOTSTS_IN_WAIT_BOOT 0x0000000BUL
|
||||
|
||||
#define CPU1_BOOTROM_RESC_HANDLED 0x00001000UL
|
||||
#define CPU1_BOOTROM_HANDLED_XRSN 0x00002000UL
|
||||
#define CPU1_BOOTROM_HANDLED_POR 0x00004000UL
|
||||
#define CPU1_BOOTROM_HANDLED_HWBIST 0x00008000UL
|
||||
|
||||
#define CPU1_BOOTROM_DCSM_INIT_COMPLETE 0x00010000UL
|
||||
#define CPU1_BOOTROM_RAM_INIT_COMPLETE 0x00020000UL
|
||||
#define CPU1_BOOTROM_POR_MEM_TEST_COMPLETE 0x00040000UL
|
||||
#define CPU1_BOOTROM_PLL_FAILED_TO_ENABLE 0x00080000UL
|
||||
|
||||
#define CPU1_BOOTROM_GOT_A_MCAN_NMI 0x00100000UL
|
||||
#define CPU1_BOOTROM_GOT_AN_ECAT_NMI 0x00200000UL
|
||||
#define CPU1_BOOTROM_GOT_AN_ERAD_NMI 0x00400000UL
|
||||
#define CPU1_BOOTROM_GOT_ITRAP 0x00800000UL
|
||||
#define CPU1_BOOTROM_GOT_A_PIE_MISMATCH 0x01000000UL
|
||||
#define CPU1_BOOTROM_GOT_A_RL_NMI 0x02000000UL
|
||||
#define CPU1_BOOTROM_GOT_A_PIE_VECTOR_NMI 0x04000000UL
|
||||
#define CPU1_BOOTROM_GOT_A_HWBIST_NMI 0x08000000UL
|
||||
#define CPU1_BOOTROM_GOT_A_FLASH_UNCERR_NMI 0x10000000UL
|
||||
#define CPU1_BOOTROM_GOT_A_RAM_UNCERR_NMI 0x20000000UL
|
||||
#define CPU1_BOOTROM_GOT_A_MCLK_NMI 0x40000000UL
|
||||
|
||||
#define CPU1_BOOTROM_BOOT_COMPLETE 0x80000000UL
|
||||
|
||||
|
||||
//
|
||||
// Device Configuration OTP Registers
|
||||
//
|
||||
#define HWREAD_TI_OTP_PARTID_L (HWREG(0x70212UL))
|
||||
#define HWREAD_TI_OTP_PARTID_H (HWREG(0x70214UL))
|
||||
|
||||
#define HWREAD_TI_OTP_REG_DC00 (HWREGH(0x70218UL))
|
||||
#define HWREAD_TI_OTP_REG_DC11 (HWREGH(0x70219UL))
|
||||
#define HWREAD_TI_OTP_REG_DC19 (HWREGH(0x7021AUL))
|
||||
#define HWREAD_TI_OTP_REG_DC20 (HWREGH(0x7021BUL))
|
||||
#define HWREAD_TI_OTP_REG_DC21 (HWREGH(0x7021CUL))
|
||||
#define HWREAD_TI_OTP_REG_DC26 (HWREGH(0x7021DUL))
|
||||
|
||||
#define HWREAD_TI_OTP_REG_PERCNF1 (HWREGH(0x7021EUL))
|
||||
|
||||
#define HWREAD_TI_OTP_CPU1ROM_DC1 (HWREGH(0x7021FUL))
|
||||
#define HWREAD_TI_OTP_CPU1ROM_DC2 (HWREGH(0x70220UL))
|
||||
#define HWREAD_TI_OTP_CPU2ROM_DC1 (HWREGH(0x70221UL))
|
||||
#define HWREAD_TI_OTP_CPU2ROM_DC2 (HWREGH(0x70222UL))
|
||||
|
||||
#define BROM_DCX_ALWAYS_ENABLED 0xFFFFFFFFUL
|
||||
#define BROM_DCX_ENABLE_HIGH 0xFFFF0000UL
|
||||
|
||||
//
|
||||
// OTP Keys
|
||||
//
|
||||
#define TI_OTP_KEY 0x5A5AU
|
||||
|
||||
//
|
||||
// PMM Trim - Analog Subsystem Register Offsets
|
||||
//
|
||||
// Refer to hw_asysctl.h
|
||||
|
||||
//
|
||||
// PMM OTP Trim Values
|
||||
//
|
||||
#define HWREAD_TI_OTP_PMM_TRIM_KEY (HWREGH(0x70233UL))
|
||||
#define HWREAD_TI_OTP_PMM_TRIM_BASE_ADDRESS (HWREG(0x7023EUL))
|
||||
#define HWREAD_TI_OTP_PMM_REF_TRIM_VALUE (HWREGH(HWREAD_TI_OTP_PMM_TRIM_BASE_ADDRESS))
|
||||
#define HWREAD_TI_OTP_PMM_VREG_TRIM_VALUE (HWREGH(HWREAD_TI_OTP_PMM_TRIM_BASE_ADDRESS + 0x1UL))
|
||||
#define HWREAD_TI_OTP_PMM_VSINK_TRIM_VALUE (HWREGH(HWREAD_TI_OTP_PMM_TRIM_BASE_ADDRESS + 0x2UL))
|
||||
#define HWREAD_TI_OTP_PMM_VMON_TRIM_VALUE (HWREGH(HWREAD_TI_OTP_PMM_TRIM_BASE_ADDRESS + 0x3UL))
|
||||
|
||||
//
|
||||
// Internal Oscillator Trim - Analog Subsystem Register Offsets
|
||||
//
|
||||
// Refer to hw_asysctl.h
|
||||
|
||||
//
|
||||
// Internal Oscillator OTP Trim Values
|
||||
//
|
||||
#define HWREAD_TI_OTP_INTOSC_TRIM_KEY (HWREGH(0x70232UL))
|
||||
#define HWREAD_TI_OTP_INTOSC_BASE_ADDRESS (HWREG(0x7023CUL))
|
||||
|
||||
#define HWREAD_TI_OTP_OSC_REF_TRIM_VALUE (HWREGH(HWREAD_TI_OTP_INTOSC_BASE_ADDRESS))
|
||||
#define HWREAD_TI_OTP_INTOSC1_TRIM_VALUE (HWREG(HWREAD_TI_OTP_INTOSC_BASE_ADDRESS + 0x1U))
|
||||
#define HWREAD_TI_OTP_INTOSC2_TRIM_VALUE (HWREG(HWREAD_TI_OTP_INTOSC_BASE_ADDRESS + 0x3U))
|
||||
|
||||
//
|
||||
// PLL Selection - Analog Subsystem Register Offset
|
||||
//
|
||||
// Refer to hw_asysctl.h
|
||||
|
||||
//
|
||||
// PLL Selection (OTP)
|
||||
//
|
||||
#define HWREAD_TI_OTP_PLLSEL_KEY (HWREGH(0x70235UL))
|
||||
#define HWREAD_TI_OTP_PLLSEL_ADDRESS (HWREG(0x70242UL))
|
||||
#define HWREAD_TI_OTP_PLLSEL_VALUE (HWREGH(HWREAD_TI_OTP_PLLSEL_ADDRESS))
|
||||
|
||||
//
|
||||
// APLL Trim - Analog Subsystem Register Offsets
|
||||
//
|
||||
// Refer to hw_asysctl.h
|
||||
|
||||
//
|
||||
// APLL OTP Trim Values
|
||||
//
|
||||
#define HWREAD_TI_OTP_APLL_TRIM_KEY (HWREGH(0x70234UL))
|
||||
#define HWREAD_TI_OTP_APLLREF_TRIM_ADDRESS (HWREG(0x70240UL))
|
||||
#define TI_OTP_APLL_SYS_TRIM_ADDRESS (HWREAD_TI_OTP_APLLREF_TRIM_ADDRESS + 0x1U)
|
||||
#define TI_OTP_APLL_AUX_TRIM_ADDRESS (HWREAD_TI_OTP_APLLREF_TRIM_ADDRESS + 0x2U)
|
||||
#define HWREAD_TI_OTP_APLLREF_TRIM_VALUE (HWREGH(HWREAD_TI_OTP_APLLREF_TRIM_ADDRESS))
|
||||
#define HWREAD_TI_OTP_APLL_SYS_TRIM_VALUE (HWREGH(TI_OTP_APLL_SYS_TRIM_ADDRESS))
|
||||
#define HWREAD_TI_OTP_APLL_AUX_TRIM_VALUE (HWREGH(TI_OTP_APLL_AUX_TRIM_ADDRESS))
|
||||
|
||||
//
|
||||
// APLL OTP Trim Masks/Shifts
|
||||
//
|
||||
#define TI_OTP_APLL_OSC_FREQ_MASK 0x700U
|
||||
#define TI_OTP_APLL_OSC_FREQ_SHIFT 0x8U
|
||||
#define TI_OTP_APLL_OSC_VDD_MASK 0xFFU
|
||||
|
||||
//
|
||||
// APLL Lock - Analog Subsystem Register Offset
|
||||
//
|
||||
// Refer to hw_asysctl.h
|
||||
|
||||
//
|
||||
// APLL Lock (OTP)
|
||||
//
|
||||
#define HWREAD_TI_OTP_APLLLOCK_KEY (HWREGH(0x70236UL))
|
||||
#define HWREAD_TI_OTP_APLLLOCK_ADDRESS (HWREG(0x70244UL))
|
||||
#define HWREAD_TI_OTP_APLLLOCK_VALUE (HWREGH(HWREAD_TI_OTP_APLLLOCK_ADDRESS))
|
||||
|
||||
//
|
||||
// APLL Configurations - Analog Subsystem Register Offset
|
||||
//
|
||||
#define BROM_ASYSCTL_O_SYSAPLLCONFIG6 0xC5U
|
||||
#define BROM_ASYSCTL_O_AUXAPLLCONFIG6 0xDDU
|
||||
|
||||
|
||||
//
|
||||
// APLL Configurations (Both SYS and AUX) (OTP)
|
||||
//
|
||||
#define HWREAD_TI_OTP_APLLCONFIG_KEY (HWREGH(0x70237UL))
|
||||
#define HWREAD_TI_OTP_APLLCONFIG_BASE_ADDRESS (HWREG(0x70246UL))
|
||||
#define HWREAD_TI_OTP_APLLCONFIG1_VALUE (HWREGH(HWREAD_TI_OTP_APLLCONFIG_BASE_ADDRESS))
|
||||
#define HWREAD_TI_OTP_APLLCONFIG2_VALUE (HWREGH(HWREAD_TI_OTP_APLLCONFIG_BASE_ADDRESS + 1U))
|
||||
#define HWREAD_TI_OTP_APLLCONFIG3_VALUE (HWREGH(HWREAD_TI_OTP_APLLCONFIG_BASE_ADDRESS + 2U))
|
||||
#define HWREAD_TI_OTP_APLLCONFIG4_VALUE (HWREGH(HWREAD_TI_OTP_APLLCONFIG_BASE_ADDRESS + 3U))
|
||||
#define HWREAD_TI_OTP_APLLCONFIG5_VALUE (HWREGH(HWREAD_TI_OTP_APLLCONFIG_BASE_ADDRESS + 4U))
|
||||
#define HWREAD_TI_OTP_APLLCONFIG6_VALUE (HWREGH(HWREAD_TI_OTP_APLLCONFIG_BASE_ADDRESS + 5U))
|
||||
#define HWREAD_TI_OTP_APLLCONFIG7_VALUE (HWREGH(HWREAD_TI_OTP_APLLCONFIG_BASE_ADDRESS + 6U))
|
||||
#define HWREAD_TI_OTP_APLLCONFIG8_VALUE (HWREGH(HWREAD_TI_OTP_APLLCONFIG_BASE_ADDRESS + 7U))
|
||||
#define HWREAD_TI_OTP_APLLCONFIG9_VALUE (HWREGH(HWREAD_TI_OTP_APLLCONFIG_BASE_ADDRESS + 8U))
|
||||
#define HWREAD_TI_OTP_APLLCONFIG10_VALUE (HWREGH(HWREAD_TI_OTP_APLLCONFIG_BASE_ADDRESS + 9U))
|
||||
|
||||
//
|
||||
// Device Cal OTP Location and Function Call
|
||||
//
|
||||
#define HWREAD_TI_OTP_DEVCAL_KEY (HWREGH(0x70238UL))
|
||||
#define HWREAD_DEVICE_CAL_LOCATION (HWREG(0x70248UL))
|
||||
#define CBROM_DEVCAL ((void (*)(void))HWREAD_DEVICE_CAL_LOCATION)
|
||||
|
||||
//
|
||||
// OTP Version/CPU ID value (Used as OTP access to power up flash)
|
||||
//
|
||||
#define HWREAD_OTP_VERSION_FOR_BOOT (HWREGH(0x70223UL))
|
||||
|
||||
//
|
||||
// Boot Escape/Patch Point OTP Addresses
|
||||
//
|
||||
#define OTP_BOOT_ESCAPE_TABLE_END 0x703ECUL
|
||||
|
||||
#define CPU1BROM_TI_OTP_ESCAPE_POINT_15 (HWREG((OTP_BOOT_ESCAPE_TABLE_END)-28))
|
||||
#define CPU1BROM_TI_OTP_ESCAPE_POINT_14 (HWREG((OTP_BOOT_ESCAPE_TABLE_END)-26))
|
||||
#define CPU1BROM_TI_OTP_ESCAPE_POINT_13 (HWREG((OTP_BOOT_ESCAPE_TABLE_END)-24))
|
||||
#define CPU1BROM_TI_OTP_ESCAPE_POINT_12 (HWREG((OTP_BOOT_ESCAPE_TABLE_END)-22))
|
||||
#define CPU1BROM_TI_OTP_ESCAPE_POINT_11 (HWREG((OTP_BOOT_ESCAPE_TABLE_END)-20))
|
||||
#define CPU1BROM_TI_OTP_ESCAPE_POINT_10 (HWREG((OTP_BOOT_ESCAPE_TABLE_END)-18))
|
||||
#define CPU1BROM_TI_OTP_ESCAPE_POINT_9 (HWREG((OTP_BOOT_ESCAPE_TABLE_END)-16))
|
||||
#define CPU1BROM_TI_OTP_ESCAPE_POINT_8 (HWREG((OTP_BOOT_ESCAPE_TABLE_END)-14))
|
||||
#define CPU1BROM_TI_OTP_ESCAPE_POINT_7 (HWREG((OTP_BOOT_ESCAPE_TABLE_END)-12))
|
||||
#define CPU1BROM_TI_OTP_ESCAPE_POINT_6 (HWREG((OTP_BOOT_ESCAPE_TABLE_END)-10))
|
||||
#define CPU1BROM_TI_OTP_ESCAPE_POINT_5 (HWREG((OTP_BOOT_ESCAPE_TABLE_END)-8))
|
||||
#define CPU1BROM_TI_OTP_ESCAPE_POINT_4 (HWREG((OTP_BOOT_ESCAPE_TABLE_END)-6))
|
||||
#define CPU1BROM_TI_OTP_ESCAPE_POINT_3 (HWREG((OTP_BOOT_ESCAPE_TABLE_END)-4))
|
||||
#define CPU1BROM_TI_OTP_ESCAPE_POINT_2 (HWREG((OTP_BOOT_ESCAPE_TABLE_END)-2))
|
||||
#define CPU1BROM_TI_OTP_ESCAPE_POINT_1 (HWREG((OTP_BOOT_ESCAPE_TABLE_END)-0))
|
||||
|
||||
//
|
||||
// Boot Selection Defines
|
||||
//
|
||||
|
||||
#define CPU1_ALL_BMSP_DISABLED_MASK 0x00FFFFFFUL
|
||||
#define CPU1_PIN_CONFIG_MASK 0xFFU
|
||||
#define CPU1_BMSP_DISABLED 0xFFU
|
||||
|
||||
#define CPU1_INVALID_GPIO42 42U //USB0DM
|
||||
#define CPU1_INVALID_GPIO43 43U //USB0DP
|
||||
#define CPU1_GPIO169 169U
|
||||
#define CPU1_GPIO254 254U
|
||||
|
||||
//
|
||||
// Miscellaneous Boot Defines
|
||||
//
|
||||
#define ERROR 1U
|
||||
#define NO_ERROR 0U
|
||||
#define BROM_EIGHT_BIT_HEADER 0x08AAU
|
||||
#define BOOTPIN_CONFIG_STANDALONE_KEY 0xA5U
|
||||
#define BOOTPIN_CONFIG_KEY 0x5AU
|
||||
#define FLASH_NOT_PROGRAMMED 0x1U
|
||||
#define FLASH_IS_PROGRAMMED 0x0U
|
||||
#define RAM_GSX_NOT_DONE 0x0U
|
||||
#define CAN_BOOT_DEFAULT_BIT_TIMING 0x0U
|
||||
#define CAN_BOOT_USE_XTAL 0x1U
|
||||
#define USB_BOOT_ENABLE_PIE_INIT 0x1U
|
||||
#define BROM_PLL_ENABLE_ERROR 0xFFFFU
|
||||
#define BROM_PLL_ENABLE_SUCCESS 0x0U
|
||||
#define BROM_CMCLKCTL_MASK 0xFU
|
||||
|
||||
//
|
||||
// Globals
|
||||
//
|
||||
typedef uint16_t (*uint16fptr)();
|
||||
extern uint16fptr GetWordData;
|
||||
|
||||
//
|
||||
// Function prototypes
|
||||
//
|
||||
extern void CPU1BROM_initDCSM(void);
|
||||
|
||||
extern __interrupt void CPU1BROM_itrapISR(void);
|
||||
extern __interrupt void CPU1BROM_nmiHandler(void);
|
||||
extern void CPU1BROM_enablePIEinBoot(void);
|
||||
|
||||
extern uint32_t GetLongData(void);
|
||||
extern void CopyData(void);
|
||||
extern void ReadReservedFn(void);
|
||||
extern uint16_t CPU1BROM_enableSysPLL(uint16_t multiplier, uint16_t divider);
|
||||
extern uint16_t CPU1BROM_enableAuxPLL(uint16_t multiplier, uint16_t divider);
|
||||
extern uint32_t PBIST_PORMemoryTest(void);
|
||||
|
||||
extern uint32_t I2C_Boot(uint32_t bootMode);
|
||||
extern uint32_t SCI_Boot(uint32_t bootMode);
|
||||
extern uint32_t USB_Boot(uint32_t bootMode, uint16_t enablePIEInit);
|
||||
extern uint32_t SPI_Boot(uint32_t bootMode);
|
||||
extern uint32_t DCAN_Boot(uint32_t bootMode, uint32_t bitTimingRegValue, uint16_t switchToXTAL);
|
||||
extern uint32_t Parallel_Boot(void);
|
||||
|
||||
extern uint32_t CPU1BROM_selectBootMode(void);
|
||||
|
||||
extern uint32_t CPU1BROM_calculateCMAC(volatile uint32_t startAddress,
|
||||
volatile uint32_t endAddress,
|
||||
volatile uint32_t signatureAddress);
|
||||
|
||||
#endif //CPU1_BOOTROM_H_
|
||||
|
||||
//
|
||||
// End of file
|
||||
//
|
||||
+654
@@ -0,0 +1,654 @@
|
||||
//###########################################################################
|
||||
//
|
||||
// FILE: dcsm_otp.h
|
||||
//
|
||||
// TITLE: DCSM Init Header
|
||||
//
|
||||
//###########################################################################
|
||||
// $TI Release: $
|
||||
// $Release Date: $
|
||||
//###########################################################################
|
||||
|
||||
#ifndef DCSM_OTP_H_
|
||||
#define DCSM_OTP_H_
|
||||
|
||||
//TI_OTP Definitions
|
||||
|
||||
#define SECDC_OTP_TI 0xFFFFFFE8u //C28SL,ECSL enabled and FASTSPIN applicable
|
||||
|
||||
//USER OTP Definitions
|
||||
|
||||
// USER OTP BANK 1
|
||||
//Zone 1: Header
|
||||
|
||||
#define B0_Z1_LINKPOINTER1 0x00003FFFu
|
||||
#define B0_Z1_LINKPOINTER2 0x00003FFFu
|
||||
#define B0_Z1_LINKPOINTER3 0x00003FFFu
|
||||
#define Z1_JLM_ENABLE 0xFFFF000Fu
|
||||
#define Z1_GPREG1 0xFFFFFFFFu
|
||||
#define Z1_GPREG2 0xFFFFFFFFu
|
||||
#define Z1_GPREG3 0xFFFFFFFFu
|
||||
#define Z1_GPREG4 0xFFFFFFFFu
|
||||
#define Z1_PSWDLOCK 0xFB7FFFFFu
|
||||
#define Z1_CRCLOCK 0x7FFFFFFFu
|
||||
#define JTAGPSWDH0 0x4BFFFFFFu
|
||||
#define JTAGPSWDH1 0x3FFFFFFFu
|
||||
#define CMAC_KEY0 0xFFFFFFFFu
|
||||
#define CMAC_KEY1 0xFFFFFFFFu
|
||||
#define CMAC_KEY2 0xFFFFFFFFu
|
||||
#define CMAC_KEY3 0xFFFFFFFFu
|
||||
|
||||
//Zone 1: Zone Select Block
|
||||
|
||||
//ZONE SELECT BLOCK 0
|
||||
#define ZSB0_Z1_CSMPSWD0 0xFFFFFFFFu
|
||||
#define ZSB0_Z1_CSMPSWD1 0x4D7FFFFFu
|
||||
#define ZSB0_Z1_CSMPSWD2 0xFFFFFFFFu
|
||||
#define ZSB0_Z1_CSMPSWD3 0xFFFFFFFFu
|
||||
#define ZSB0_Z1_GRABSECT1 0xFFFFFFFFu
|
||||
#define ZSB0_Z1_GRABSECT2 0xFFFFFFFFu
|
||||
#define ZSB0_Z1_GRABSECT3 0xFFFFFFFFu
|
||||
#define ZSB0_Z1_GRABRAM1 0xFFFFFFFFu
|
||||
#define ZSB0_Z1_GRABRAM2 0xFFFFFFFFu
|
||||
#define ZSB0_Z1_GRABRAM3 0xFFFFFFFFu
|
||||
#define ZSB0_Z1_EXEONLYSECT1 0xFFFFFFFFu
|
||||
#define ZSB0_Z1_EXEONLYSECT2 0xFFFFFFFFu
|
||||
#define ZSB0_Z1_EXEONLYRAM1 0xFFFFFFFFu
|
||||
#define ZSB0_JTAGPSWDL0 0xFFFFFFFFu
|
||||
#define ZSB0_JTAGPSWDL1 0x2BFFFFFFu
|
||||
|
||||
|
||||
//ZONE SELECT BLOCK 1
|
||||
#define ZSB1_Z1_CSMPSWD0 0xFFFFFFFFu
|
||||
#define ZSB1_Z1_CSMPSWD1 0x5F7FFFFFu
|
||||
#define ZSB1_Z1_CSMPSWD2 0xFFFFFFFFu
|
||||
#define ZSB1_Z1_CSMPSWD3 0xFFFFFFFFu
|
||||
#define ZSB1_Z1_GRABSECT1 0xFFFFFFFFu
|
||||
#define ZSB1_Z1_GRABSECT2 0xFFFFFFFFu
|
||||
#define ZSB1_Z1_GRABSECT3 0xFFFFFFFFu
|
||||
#define ZSB1_Z1_GRABRAM1 0xFFFFFFFFu
|
||||
#define ZSB1_Z1_GRABRAM2 0xFFFFFFFFu
|
||||
#define ZSB1_Z1_GRABRAM3 0xFFFFFFFFu
|
||||
#define ZSB1_Z1_EXEONLYSECT1 0xFFFFFFFFu
|
||||
#define ZSB1_Z1_EXEONLYSECT2 0xFFFFFFFFu
|
||||
#define ZSB1_Z1_EXEONLYRAM1 0xFFFFFFFFu
|
||||
#define ZSB1_JTAGPSWDL0 0xFFFFFFFFu
|
||||
#define ZSB1_JTAGPSWDL1 0x27FFFFFFu
|
||||
|
||||
//ZONE SELECT BLOCK 2
|
||||
#define ZSB2_Z1_CSMPSWD0 0xFFFFFFFFu
|
||||
#define ZSB2_Z1_CSMPSWD1 0x1DFFFFFFu
|
||||
#define ZSB2_Z1_CSMPSWD2 0xFFFFFFFFu
|
||||
#define ZSB2_Z1_CSMPSWD3 0xFFFFFFFFu
|
||||
#define ZSB2_Z1_GRABSECT1 0xFFFFFFFFu
|
||||
#define ZSB2_Z1_GRABSECT2 0xFFFFFFFFu
|
||||
#define ZSB2_Z1_GRABSECT3 0xFFFFFFFFu
|
||||
#define ZSB2_Z1_GRABRAM1 0xFFFFFFFFu
|
||||
#define ZSB2_Z1_GRABRAM2 0xFFFFFFFFu
|
||||
#define ZSB2_Z1_GRABRAM3 0xFFFFFFFFu
|
||||
#define ZSB2_Z1_EXEONLYSECT1 0xFFFFFFFFu
|
||||
#define ZSB2_Z1_EXEONLYSECT2 0xFFFFFFFFu
|
||||
#define ZSB2_Z1_EXEONLYRAM1 0xFFFFFFFFu
|
||||
#define ZSB2_JTAGPSWDL0 0xFFFFFFFFu
|
||||
#define ZSB2_JTAGPSWDL1 0x7B7FFFFFu
|
||||
|
||||
//ZONE SELECT BLOCK 3
|
||||
#define ZSB3_Z1_CSMPSWD0 0xFFFFFFFFu
|
||||
#define ZSB3_Z1_CSMPSWD1 0xAF7FFFFFu
|
||||
#define ZSB3_Z1_CSMPSWD2 0xFFFFFFFFu
|
||||
#define ZSB3_Z1_CSMPSWD3 0xFFFFFFFFu
|
||||
#define ZSB3_Z1_GRABSECT1 0xFFFFFFFFu
|
||||
#define ZSB3_Z1_GRABSECT2 0xFFFFFFFFu
|
||||
#define ZSB3_Z1_GRABSECT3 0xFFFFFFFFu
|
||||
#define ZSB3_Z1_GRABRAM1 0xFFFFFFFFu
|
||||
#define ZSB3_Z1_GRABRAM2 0xFFFFFFFFu
|
||||
#define ZSB3_Z1_GRABRAM3 0xFFFFFFFFu
|
||||
#define ZSB3_Z1_EXEONLYSECT1 0xFFFFFFFFu
|
||||
#define ZSB3_Z1_EXEONLYSECT2 0xFFFFFFFFu
|
||||
#define ZSB3_Z1_EXEONLYRAM1 0xFFFFFFFFu
|
||||
#define ZSB3_JTAGPSWDL0 0xFFFFFFFFu
|
||||
#define ZSB3_JTAGPSWDL1 0xC9FFFFFFu
|
||||
|
||||
//ZONE SELECT BLOCK 4
|
||||
#define ZSB4_Z1_CSMPSWD0 0xFFFFFFFFu
|
||||
#define ZSB4_Z1_CSMPSWD1 0x1BFFFFFFu
|
||||
#define ZSB4_Z1_CSMPSWD2 0xFFFFFFFFu
|
||||
#define ZSB4_Z1_CSMPSWD3 0xFFFFFFFFu
|
||||
#define ZSB4_Z1_GRABSECT1 0xFFFFFFFFu
|
||||
#define ZSB4_Z1_GRABSECT2 0xFFFFFFFFu
|
||||
#define ZSB4_Z1_GRABSECT3 0xFFFFFFFFu
|
||||
#define ZSB4_Z1_GRABRAM1 0xFFFFFFFFu
|
||||
#define ZSB4_Z1_GRABRAM2 0xFFFFFFFFu
|
||||
#define ZSB4_Z1_GRABRAM3 0xFFFFFFFFu
|
||||
#define ZSB4_Z1_EXEONLYSECT1 0xFFFFFFFFu
|
||||
#define ZSB4_Z1_EXEONLYSECT2 0xFFFFFFFFu
|
||||
#define ZSB4_Z1_EXEONLYRAM1 0xFFFFFFFFu
|
||||
#define ZSB4_JTAGPSWDL0 0xFFFFFFFFu
|
||||
#define ZSB4_JTAGPSWDL1 0x7D7FFFFFu
|
||||
|
||||
//ZONE SELECT BLOCK 5
|
||||
#define ZSB5_Z1_CSMPSWD0 0xFFFFFFFFu
|
||||
#define ZSB5_Z1_CSMPSWD1 0x17FFFFFFu
|
||||
#define ZSB5_Z1_CSMPSWD2 0xFFFFFFFFu
|
||||
#define ZSB5_Z1_CSMPSWD3 0xFFFFFFFFu
|
||||
#define ZSB5_Z1_GRABSECT1 0xFFFFFFFFu
|
||||
#define ZSB5_Z1_GRABSECT2 0xFFFFFFFFu
|
||||
#define ZSB5_Z1_GRABSECT3 0xFFFFFFFFu
|
||||
#define ZSB5_Z1_GRABRAM1 0xFFFFFFFFu
|
||||
#define ZSB5_Z1_GRABRAM2 0xFFFFFFFFu
|
||||
#define ZSB5_Z1_GRABRAM3 0xFFFFFFFFu
|
||||
#define ZSB5_Z1_EXEONLYSECT1 0xFFFFFFFFu
|
||||
#define ZSB5_Z1_EXEONLYSECT2 0xFFFFFFFFu
|
||||
#define ZSB5_Z1_EXEONLYRAM1 0xFFFFFFFFu
|
||||
#define ZSB5_JTAGPSWDL0 0xFFFFFFFFu
|
||||
#define ZSB5_JTAGPSWDL1 0x6F7FFFFFu
|
||||
|
||||
//ZONE SELECT BLOCK 6
|
||||
#define ZSB6_Z1_CSMPSWD0 0xFFFFFFFFu
|
||||
#define ZSB6_Z1_CSMPSWD1 0xBD7FFFFFu
|
||||
#define ZSB6_Z1_CSMPSWD2 0xFFFFFFFFu
|
||||
#define ZSB6_Z1_CSMPSWD3 0xFFFFFFFFu
|
||||
#define ZSB6_Z1_GRABSECT1 0xFFFFFFFFu
|
||||
#define ZSB6_Z1_GRABSECT2 0xFFFFFFFFu
|
||||
#define ZSB6_Z1_GRABSECT3 0xFFFFFFFFu
|
||||
#define ZSB6_Z1_GRABRAM1 0xFFFFFFFFu
|
||||
#define ZSB6_Z1_GRABRAM2 0xFFFFFFFFu
|
||||
#define ZSB6_Z1_GRABRAM3 0xFFFFFFFFu
|
||||
#define ZSB6_Z1_EXEONLYSECT1 0xFFFFFFFFu
|
||||
#define ZSB6_Z1_EXEONLYSECT2 0xFFFFFFFFu
|
||||
#define ZSB6_Z1_EXEONLYRAM1 0xFFFFFFFFu
|
||||
#define ZSB6_JTAGPSWDL0 0xFFFFFFFFu
|
||||
#define ZSB6_JTAGPSWDL1 0x33FFFFFFu
|
||||
|
||||
//ZONE SELECT BLOCK 7
|
||||
#define ZSB7_Z1_CSMPSWD0 0xFFFFFFFFu
|
||||
#define ZSB7_Z1_CSMPSWD1 0x9F7FFFFFu
|
||||
#define ZSB7_Z1_CSMPSWD2 0xFFFFFFFFu
|
||||
#define ZSB7_Z1_CSMPSWD3 0xFFFFFFFFu
|
||||
#define ZSB7_Z1_GRABSECT1 0xFFFFFFFFu
|
||||
#define ZSB7_Z1_GRABSECT2 0xFFFFFFFFu
|
||||
#define ZSB7_Z1_GRABSECT3 0xFFFFFFFFu
|
||||
#define ZSB7_Z1_GRABRAM1 0xFFFFFFFFu
|
||||
#define ZSB7_Z1_GRABRAM2 0xFFFFFFFFu
|
||||
#define ZSB7_Z1_GRABRAM3 0xFFFFFFFFu
|
||||
#define ZSB7_Z1_EXEONLYSECT1 0xFFFFFFFFu
|
||||
#define ZSB7_Z1_EXEONLYSECT2 0xFFFFFFFFu
|
||||
#define ZSB7_Z1_EXEONLYRAM1 0xFFFFFFFFu
|
||||
#define ZSB7_JTAGPSWDL0 0xFFFFFFFFu
|
||||
#define ZSB7_JTAGPSWDL1 0x0FFFFFFFu
|
||||
|
||||
//ZONE SELECT BLOCK 8
|
||||
#define ZSB8_Z1_CSMPSWD0 0xFFFFFFFFu
|
||||
#define ZSB8_Z1_CSMPSWD1 0x2BFFFFFFu
|
||||
#define ZSB8_Z1_CSMPSWD2 0xFFFFFFFFu
|
||||
#define ZSB8_Z1_CSMPSWD3 0xFFFFFFFFu
|
||||
#define ZSB8_Z1_GRABSECT1 0xFFFFFFFFu
|
||||
#define ZSB8_Z1_GRABSECT2 0xFFFFFFFFu
|
||||
#define ZSB8_Z1_GRABSECT3 0xFFFFFFFFu
|
||||
#define ZSB8_Z1_GRABRAM1 0xFFFFFFFFu
|
||||
#define ZSB8_Z1_GRABRAM2 0xFFFFFFFFu
|
||||
#define ZSB8_Z1_GRABRAM3 0xFFFFFFFFu
|
||||
#define ZSB8_Z1_EXEONLYSECT1 0xFFFFFFFFu
|
||||
#define ZSB8_Z1_EXEONLYSECT2 0xFFFFFFFFu
|
||||
#define ZSB8_Z1_EXEONLYRAM1 0xFFFFFFFFu
|
||||
#define ZSB8_JTAGPSWDL0 0xFFFFFFFFu
|
||||
#define ZSB8_JTAGPSWDL1 0xBB7FFFFFu
|
||||
|
||||
//ZONE SELECT BLOCK 9
|
||||
#define ZSB9_Z1_CSMPSWD0 0xFFFFFFFFu
|
||||
#define ZSB9_Z1_CSMPSWD1 0x27FFFFFFu
|
||||
#define ZSB9_Z1_CSMPSWD2 0xFFFFFFFFu
|
||||
#define ZSB9_Z1_CSMPSWD3 0xFFFFFFFFu
|
||||
#define ZSB9_Z1_GRABSECT1 0xFFFFFFFFu
|
||||
#define ZSB9_Z1_GRABSECT2 0xFFFFFFFFu
|
||||
#define ZSB9_Z1_GRABSECT3 0xFFFFFFFFu
|
||||
#define ZSB9_Z1_GRABRAM1 0xFFFFFFFFu
|
||||
#define ZSB9_Z1_GRABRAM2 0xFFFFFFFFu
|
||||
#define ZSB9_Z1_GRABRAM3 0xFFFFFFFFu
|
||||
#define ZSB9_Z1_EXEONLYSECT1 0xFFFFFFFFu
|
||||
#define ZSB9_Z1_EXEONLYSECT2 0xFFFFFFFFu
|
||||
#define ZSB9_Z1_EXEONLYRAM1 0xFFFFFFFFu
|
||||
#define ZSB9_JTAGPSWDL0 0xFFFFFFFFu
|
||||
#define ZSB9_JTAGPSWDL1 0x5F7FFFFFu
|
||||
|
||||
//ZONE SELECT BLOCK 10
|
||||
#define ZSB10_Z1_CSMPSWD0 0xFFFFFFFFu
|
||||
#define ZSB10_Z1_CSMPSWD1 0x7B7FFFFFu
|
||||
#define ZSB10_Z1_CSMPSWD2 0xFFFFFFFFu
|
||||
#define ZSB10_Z1_CSMPSWD3 0xFFFFFFFFu
|
||||
#define ZSB10_Z1_GRABSECT1 0xFFFFFFFFu
|
||||
#define ZSB10_Z1_GRABSECT2 0xFFFFFFFFu
|
||||
#define ZSB10_Z1_GRABSECT3 0xFFFFFFFFu
|
||||
#define ZSB10_Z1_GRABRAM1 0xFFFFFFFFu
|
||||
#define ZSB10_Z1_GRABRAM2 0xFFFFFFFFu
|
||||
#define ZSB10_Z1_GRABRAM3 0xFFFFFFFFu
|
||||
#define ZSB10_Z1_EXEONLYSECT1 0xFFFFFFFFu
|
||||
#define ZSB10_Z1_EXEONLYSECT2 0xFFFFFFFFu
|
||||
#define ZSB10_Z1_EXEONLYRAM1 0xFFFFFFFFu
|
||||
#define ZSB10_JTAGPSWDL0 0xFFFFFFFFu
|
||||
#define ZSB10_JTAGPSWDL1 0x1DFFFFFFu
|
||||
|
||||
//ZONE SELECT BLOCK 11
|
||||
#define ZSB11_Z1_CSMPSWD0 0xFFFFFFFFu
|
||||
#define ZSB11_Z1_CSMPSWD1 0xC9FFFFFFu
|
||||
#define ZSB11_Z1_CSMPSWD2 0xFFFFFFFFu
|
||||
#define ZSB11_Z1_CSMPSWD3 0xFFFFFFFFu
|
||||
#define ZSB11_Z1_GRABSECT1 0xFFFFFFFFu
|
||||
#define ZSB11_Z1_GRABSECT2 0xFFFFFFFFu
|
||||
#define ZSB11_Z1_GRABSECT3 0xFFFFFFFFu
|
||||
#define ZSB11_Z1_GRABRAM1 0xFFFFFFFFu
|
||||
#define ZSB11_Z1_GRABRAM2 0xFFFFFFFFu
|
||||
#define ZSB11_Z1_GRABRAM3 0xFFFFFFFFu
|
||||
#define ZSB11_Z1_EXEONLYSECT1 0xFFFFFFFFu
|
||||
#define ZSB11_Z1_EXEONLYSECT2 0xFFFFFFFFu
|
||||
#define ZSB11_Z1_EXEONLYRAM1 0xFFFFFFFFu
|
||||
#define ZSB11_JTAGPSWDL0 0xFFFFFFFFu
|
||||
#define ZSB11_JTAGPSWDL1 0xAF7FFFFFu
|
||||
|
||||
//ZONE SELECT BLOCK 12
|
||||
#define ZSB12_Z1_CSMPSWD0 0xFFFFFFFFu
|
||||
#define ZSB12_Z1_CSMPSWD1 0x7D7FFFFFu
|
||||
#define ZSB12_Z1_CSMPSWD2 0xFFFFFFFFu
|
||||
#define ZSB12_Z1_CSMPSWD3 0xFFFFFFFFu
|
||||
#define ZSB12_Z1_GRABSECT1 0xFFFFFFFFu
|
||||
#define ZSB12_Z1_GRABSECT2 0xFFFFFFFFu
|
||||
#define ZSB12_Z1_GRABSECT3 0xFFFFFFFFu
|
||||
#define ZSB12_Z1_GRABRAM1 0xFFFFFFFFu
|
||||
#define ZSB12_Z1_GRABRAM2 0xFFFFFFFFu
|
||||
#define ZSB12_Z1_GRABRAM3 0xFFFFFFFFu
|
||||
#define ZSB12_Z1_EXEONLYSECT1 0xFFFFFFFFu
|
||||
#define ZSB12_Z1_EXEONLYSECT2 0xFFFFFFFFu
|
||||
#define ZSB12_Z1_EXEONLYRAM1 0xFFFFFFFFu
|
||||
#define ZSB12_JTAGPSWDL0 0xFFFFFFFFu
|
||||
#define ZSB12_JTAGPSWDL1 0x1BFFFFFFu
|
||||
|
||||
//ZONE SELECT BLOCK 13
|
||||
#define ZSB13_Z1_CSMPSWD0 0xFFFFFFFFu
|
||||
#define ZSB13_Z1_CSMPSWD1 0x6F7FFFFFu
|
||||
#define ZSB13_Z1_CSMPSWD2 0xFFFFFFFFu
|
||||
#define ZSB13_Z1_CSMPSWD3 0xFFFFFFFFu
|
||||
#define ZSB13_Z1_GRABSECT1 0xFFFFFFFFu
|
||||
#define ZSB13_Z1_GRABSECT2 0xFFFFFFFFu
|
||||
#define ZSB13_Z1_GRABSECT3 0xFFFFFFFFu
|
||||
#define ZSB13_Z1_GRABRAM1 0xFFFFFFFFu
|
||||
#define ZSB13_Z1_GRABRAM2 0xFFFFFFFFu
|
||||
#define ZSB13_Z1_GRABRAM3 0xFFFFFFFFu
|
||||
#define ZSB13_Z1_EXEONLYSECT1 0xFFFFFFFFu
|
||||
#define ZSB13_Z1_EXEONLYSECT2 0xFFFFFFFFu
|
||||
#define ZSB13_Z1_EXEONLYRAM1 0xFFFFFFFFu
|
||||
#define ZSB13_JTAGPSWDL0 0xFFFFFFFFu
|
||||
#define ZSB13_JTAGPSWDL1 0x17FFFFFFu
|
||||
|
||||
//ZONE SELECT BLOCK 14
|
||||
#define ZSB14_Z1_CSMPSWD0 0xFFFFFFFFu
|
||||
#define ZSB14_Z1_CSMPSWD1 0x33FFFFFFu
|
||||
#define ZSB14_Z1_CSMPSWD2 0xFFFFFFFFu
|
||||
#define ZSB14_Z1_CSMPSWD3 0xFFFFFFFFu
|
||||
#define ZSB14_Z1_GRABSECT1 0xFFFFFFFFu
|
||||
#define ZSB14_Z1_GRABSECT2 0xFFFFFFFFu
|
||||
#define ZSB14_Z1_GRABSECT3 0xFFFFFFFFu
|
||||
#define ZSB14_Z1_GRABRAM1 0xFFFFFFFFu
|
||||
#define ZSB14_Z1_GRABRAM2 0xFFFFFFFFu
|
||||
#define ZSB14_Z1_GRABRAM3 0xFFFFFFFFu
|
||||
#define ZSB14_Z1_EXEONLYSECT1 0xFFFFFFFFu
|
||||
#define ZSB14_Z1_EXEONLYSECT2 0xFFFFFFFFu
|
||||
#define ZSB14_Z1_EXEONLYRAM1 0xFFFFFFFFu
|
||||
#define ZSB14_JTAGPSWDL0 0xFFFFFFFFu
|
||||
#define ZSB14_JTAGPSWDL1 0xBD7FFFFFu
|
||||
|
||||
|
||||
//Zone 2: Header
|
||||
|
||||
#define B0_Z2_LINKPOINTER1 0x00003FFFu
|
||||
#define B0_Z2_LINKPOINTER2 0x00003FFFu
|
||||
#define B0_Z2_LINKPOINTER3 0x00003FFFu
|
||||
#define Z2_GPREG1 0xFFFFFFFFu
|
||||
#define Z2_GPREG2 0xFFFFFFFFu
|
||||
#define Z2_GPREG3 0xFFFFFFFFu
|
||||
#define Z2_GPREG4 0xFFFFFFFFu
|
||||
#define Z2_PSWDLOCK 0x1F7FFFFFu
|
||||
#define Z2_CRCLOCK 0x3FFFFFFFu
|
||||
|
||||
//Zone 2: Zone Select Block
|
||||
|
||||
//ZONE SELECT BLOCK 0
|
||||
#define ZSB0_Z2_CSMPSWD0 0xFFFFFFFFu
|
||||
#define ZSB0_Z2_CSMPSWD1 0x1F7FFFFFu
|
||||
#define ZSB0_Z2_CSMPSWD2 0xFFFFFFFFu
|
||||
#define ZSB0_Z2_CSMPSWD3 0xFFFFFFFFu
|
||||
#define ZSB0_Z2_GRABSECT1 0xFFFFFFFFu
|
||||
#define ZSB0_Z2_GRABSECT2 0xFFFFFFFFu
|
||||
#define ZSB0_Z2_GRABSECT3 0xFFFFFFFFu
|
||||
#define ZSB0_Z2_GRABRAM1 0xFFFFFFFFu
|
||||
#define ZSB0_Z2_GRABRAM2 0xFFFFFFFFu
|
||||
#define ZSB0_Z2_GRABRAM3 0xFFFFFFFFu
|
||||
#define ZSB0_Z2_EXEONLYSECT1 0xFFFFFFFFu
|
||||
#define ZSB0_Z2_EXEONLYSECT2 0xFFFFFFFFu
|
||||
#define ZSB0_Z2_EXEONLYRAM1 0xFFFFFFFFu
|
||||
|
||||
//ZONE SELECT BLOCK 1
|
||||
#define ZSB1_Z2_CSMPSWD0 0xFFFFFFFFu
|
||||
#define ZSB1_Z2_CSMPSWD1 0xE57FFFFFu
|
||||
#define ZSB1_Z2_CSMPSWD2 0xFFFFFFFFu
|
||||
#define ZSB1_Z2_CSMPSWD3 0xFFFFFFFFu
|
||||
#define ZSB1_Z2_GRABSECT1 0xFFFFFFFFu
|
||||
#define ZSB1_Z2_GRABSECT2 0xFFFFFFFFu
|
||||
#define ZSB1_Z2_GRABSECT3 0xFFFFFFFFu
|
||||
#define ZSB1_Z2_GRABRAM1 0xFFFFFFFFu
|
||||
#define ZSB1_Z2_GRABRAM2 0xFFFFFFFFu
|
||||
#define ZSB1_Z2_GRABRAM3 0xFFFFFFFFu
|
||||
#define ZSB1_Z2_EXEONLYSECT1 0xFFFFFFFFu
|
||||
#define ZSB1_Z2_EXEONLYSECT2 0xFFFFFFFFu
|
||||
#define ZSB1_Z2_EXEONLYRAM1 0xFFFFFFFFu
|
||||
|
||||
//ZONE SELECT BLOCK 2
|
||||
#define ZSB2_Z2_CSMPSWD0 0xFFFFFFFFu
|
||||
#define ZSB2_Z2_CSMPSWD1 0x4FFFFFFFu
|
||||
#define ZSB2_Z2_CSMPSWD2 0xFFFFFFFFu
|
||||
#define ZSB2_Z2_CSMPSWD3 0xFFFFFFFFu
|
||||
#define ZSB2_Z2_GRABSECT1 0xFFFFFFFFu
|
||||
#define ZSB2_Z2_GRABSECT2 0xFFFFFFFFu
|
||||
#define ZSB2_Z2_GRABSECT3 0xFFFFFFFFu
|
||||
#define ZSB2_Z2_GRABRAM1 0xFFFFFFFFu
|
||||
#define ZSB2_Z2_GRABRAM2 0xFFFFFFFFu
|
||||
#define ZSB2_Z2_GRABRAM3 0xFFFFFFFFu
|
||||
#define ZSB2_Z2_EXEONLYSECT1 0xFFFFFFFFu
|
||||
#define ZSB2_Z2_EXEONLYSECT2 0xFFFFFFFFu
|
||||
#define ZSB2_Z2_EXEONLYRAM1 0xFFFFFFFFu
|
||||
|
||||
//ZONE SELECT BLOCK 3
|
||||
#define ZSB3_Z2_CSMPSWD0 0xFFFFFFFFu
|
||||
#define ZSB3_Z2_CSMPSWD1 0xE37FFFFFu
|
||||
#define ZSB3_Z2_CSMPSWD2 0xFFFFFFFFu
|
||||
#define ZSB3_Z2_CSMPSWD3 0xFFFFFFFFu
|
||||
#define ZSB3_Z2_GRABSECT1 0xFFFFFFFFu
|
||||
#define ZSB3_Z2_GRABSECT2 0xFFFFFFFFu
|
||||
#define ZSB3_Z2_GRABSECT3 0xFFFFFFFFu
|
||||
#define ZSB3_Z2_GRABRAM1 0xFFFFFFFFu
|
||||
#define ZSB3_Z2_GRABRAM2 0xFFFFFFFFu
|
||||
#define ZSB3_Z2_GRABRAM3 0xFFFFFFFFu
|
||||
#define ZSB3_Z2_EXEONLYSECT1 0xFFFFFFFFu
|
||||
#define ZSB3_Z2_EXEONLYSECT2 0xFFFFFFFFu
|
||||
#define ZSB3_Z2_EXEONLYRAM1 0xFFFFFFFFu
|
||||
|
||||
//ZONE SELECT BLOCK 4
|
||||
#define ZSB4_Z2_CSMPSWD0 0xFFFFFFFFu
|
||||
#define ZSB4_Z2_CSMPSWD1 0x57FFFFFFu
|
||||
#define ZSB4_Z2_CSMPSWD2 0xFFFFFFFFu
|
||||
#define ZSB4_Z2_CSMPSWD3 0xFFFFFFFFu
|
||||
#define ZSB4_Z2_GRABSECT1 0xFFFFFFFFu
|
||||
#define ZSB4_Z2_GRABSECT2 0xFFFFFFFFu
|
||||
#define ZSB4_Z2_GRABSECT3 0xFFFFFFFFu
|
||||
#define ZSB4_Z2_GRABRAM1 0xFFFFFFFFu
|
||||
#define ZSB4_Z2_GRABRAM2 0xFFFFFFFFu
|
||||
#define ZSB4_Z2_GRABRAM3 0xFFFFFFFFu
|
||||
#define ZSB4_Z2_EXEONLYSECT1 0xFFFFFFFFu
|
||||
#define ZSB4_Z2_EXEONLYSECT2 0xFFFFFFFFu
|
||||
#define ZSB4_Z2_EXEONLYRAM1 0xFFFFFFFFu
|
||||
|
||||
//ZONE SELECT BLOCK 5
|
||||
#define ZSB5_Z2_CSMPSWD0 0xFFFFFFFFu
|
||||
#define ZSB5_Z2_CSMPSWD1 0x5BFFFFFFu
|
||||
#define ZSB5_Z2_CSMPSWD2 0xFFFFFFFFu
|
||||
#define ZSB5_Z2_CSMPSWD3 0xFFFFFFFFu
|
||||
#define ZSB5_Z2_GRABSECT1 0xFFFFFFFFu
|
||||
#define ZSB5_Z2_GRABSECT2 0xFFFFFFFFu
|
||||
#define ZSB5_Z2_GRABSECT3 0xFFFFFFFFu
|
||||
#define ZSB5_Z2_GRABRAM1 0xFFFFFFFFu
|
||||
#define ZSB5_Z2_GRABRAM2 0xFFFFFFFFu
|
||||
#define ZSB5_Z2_GRABRAM3 0xFFFFFFFFu
|
||||
#define ZSB5_Z2_EXEONLYSECT1 0xFFFFFFFFu
|
||||
#define ZSB5_Z2_EXEONLYSECT2 0xFFFFFFFFu
|
||||
#define ZSB5_Z2_EXEONLYRAM1 0xFFFFFFFFu
|
||||
|
||||
//ZONE SELECT BLOCK 6
|
||||
#define ZSB6_Z2_CSMPSWD0 0xFFFFFFFFu
|
||||
#define ZSB6_Z2_CSMPSWD1 0xF17FFFFFu
|
||||
#define ZSB6_Z2_CSMPSWD2 0xFFFFFFFFu
|
||||
#define ZSB6_Z2_CSMPSWD3 0xFFFFFFFFu
|
||||
#define ZSB6_Z2_GRABSECT1 0xFFFFFFFFu
|
||||
#define ZSB6_Z2_GRABSECT2 0xFFFFFFFFu
|
||||
#define ZSB6_Z2_GRABSECT3 0xFFFFFFFFu
|
||||
#define ZSB6_Z2_GRABRAM1 0xFFFFFFFFu
|
||||
#define ZSB6_Z2_GRABRAM2 0xFFFFFFFFu
|
||||
#define ZSB6_Z2_GRABRAM3 0xFFFFFFFFu
|
||||
#define ZSB6_Z2_EXEONLYSECT1 0xFFFFFFFFu
|
||||
#define ZSB6_Z2_EXEONLYSECT2 0xFFFFFFFFu
|
||||
#define ZSB6_Z2_EXEONLYRAM1 0xFFFFFFFFu
|
||||
|
||||
//ZONE SELECT BLOCK 7
|
||||
#define ZSB7_Z2_CSMPSWD0 0xFFFFFFFFu
|
||||
#define ZSB7_Z2_CSMPSWD1 0x3B7FFFFFu
|
||||
#define ZSB7_Z2_CSMPSWD2 0xFFFFFFFFu
|
||||
#define ZSB7_Z2_CSMPSWD3 0xFFFFFFFFu
|
||||
#define ZSB7_Z2_GRABSECT1 0xFFFFFFFFu
|
||||
#define ZSB7_Z2_GRABSECT2 0xFFFFFFFFu
|
||||
#define ZSB7_Z2_GRABSECT3 0xFFFFFFFFu
|
||||
#define ZSB7_Z2_GRABRAM1 0xFFFFFFFFu
|
||||
#define ZSB7_Z2_GRABRAM2 0xFFFFFFFFu
|
||||
#define ZSB7_Z2_GRABRAM3 0xFFFFFFFFu
|
||||
#define ZSB7_Z2_EXEONLYSECT1 0xFFFFFFFFu
|
||||
#define ZSB7_Z2_EXEONLYSECT2 0xFFFFFFFFu
|
||||
#define ZSB7_Z2_EXEONLYRAM1 0xFFFFFFFFu
|
||||
|
||||
//ZONE SELECT BLOCK 8
|
||||
#define ZSB8_Z2_CSMPSWD0 0xFFFFFFFFu
|
||||
#define ZSB8_Z2_CSMPSWD1 0x8FFFFFFFu
|
||||
#define ZSB8_Z2_CSMPSWD2 0xFFFFFFFFu
|
||||
#define ZSB8_Z2_CSMPSWD3 0xFFFFFFFFu
|
||||
#define ZSB8_Z2_GRABSECT1 0xFFFFFFFFu
|
||||
#define ZSB8_Z2_GRABSECT2 0xFFFFFFFFu
|
||||
#define ZSB8_Z2_GRABSECT3 0xFFFFFFFFu
|
||||
#define ZSB8_Z2_GRABRAM1 0xFFFFFFFFu
|
||||
#define ZSB8_Z2_GRABRAM2 0xFFFFFFFFu
|
||||
#define ZSB8_Z2_GRABRAM3 0xFFFFFFFFu
|
||||
#define ZSB8_Z2_EXEONLYSECT1 0xFFFFFFFFu
|
||||
#define ZSB8_Z2_EXEONLYSECT2 0xFFFFFFFFu
|
||||
#define ZSB8_Z2_EXEONLYRAM1 0xFFFFFFFFu
|
||||
|
||||
//ZONE SELECT BLOCK 9
|
||||
#define ZSB9_Z2_CSMPSWD0 0xFFFFFFFFu
|
||||
#define ZSB9_Z2_CSMPSWD1 0x6BFFFFFFu
|
||||
#define ZSB9_Z2_CSMPSWD2 0xFFFFFFFFu
|
||||
#define ZSB9_Z2_CSMPSWD3 0xFFFFFFFFu
|
||||
#define ZSB9_Z2_GRABSECT1 0xFFFFFFFFu
|
||||
#define ZSB9_Z2_GRABSECT2 0xFFFFFFFFu
|
||||
#define ZSB9_Z2_GRABSECT3 0xFFFFFFFFu
|
||||
#define ZSB9_Z2_GRABRAM1 0xFFFFFFFFu
|
||||
#define ZSB9_Z2_GRABRAM2 0xFFFFFFFFu
|
||||
#define ZSB9_Z2_GRABRAM3 0xFFFFFFFFu
|
||||
#define ZSB9_Z2_EXEONLYSECT1 0xFFFFFFFFu
|
||||
#define ZSB9_Z2_EXEONLYSECT2 0xFFFFFFFFu
|
||||
#define ZSB9_Z2_EXEONLYRAM1 0xFFFFFFFFu
|
||||
|
||||
//ZONE SELECT BLOCK 10
|
||||
#define ZSB10_Z2_CSMPSWD0 0xFFFFFFFFu
|
||||
#define ZSB10_Z2_CSMPSWD1 0x377FFFFFu
|
||||
#define ZSB10_Z2_CSMPSWD2 0xFFFFFFFFu
|
||||
#define ZSB10_Z2_CSMPSWD3 0xFFFFFFFFu
|
||||
#define ZSB10_Z2_GRABSECT1 0xFFFFFFFFu
|
||||
#define ZSB10_Z2_GRABSECT2 0xFFFFFFFFu
|
||||
#define ZSB10_Z2_GRABSECT3 0xFFFFFFFFu
|
||||
#define ZSB10_Z2_GRABRAM1 0xFFFFFFFFu
|
||||
#define ZSB10_Z2_GRABRAM2 0xFFFFFFFFu
|
||||
#define ZSB10_Z2_GRABRAM3 0xFFFFFFFFu
|
||||
#define ZSB10_Z2_EXEONLYSECT1 0xFFFFFFFFu
|
||||
#define ZSB10_Z2_EXEONLYSECT2 0xFFFFFFFFu
|
||||
#define ZSB10_Z2_EXEONLYRAM1 0xFFFFFFFFu
|
||||
|
||||
//ZONE SELECT BLOCK 11
|
||||
#define ZSB11_Z2_CSMPSWD0 0xFFFFFFFFu
|
||||
#define ZSB11_Z2_CSMPSWD1 0x9BFFFFFFu
|
||||
#define ZSB11_Z2_CSMPSWD2 0xFFFFFFFFu
|
||||
#define ZSB11_Z2_CSMPSWD3 0xFFFFFFFFu
|
||||
#define ZSB11_Z2_GRABSECT1 0xFFFFFFFFu
|
||||
#define ZSB11_Z2_GRABSECT2 0xFFFFFFFFu
|
||||
#define ZSB11_Z2_GRABSECT3 0xFFFFFFFFu
|
||||
#define ZSB11_Z2_GRABRAM1 0xFFFFFFFFu
|
||||
#define ZSB11_Z2_GRABRAM2 0xFFFFFFFFu
|
||||
#define ZSB11_Z2_GRABRAM3 0xFFFFFFFFu
|
||||
#define ZSB11_Z2_EXEONLYSECT1 0xFFFFFFFFu
|
||||
#define ZSB11_Z2_EXEONLYSECT2 0xFFFFFFFFu
|
||||
#define ZSB11_Z2_EXEONLYRAM1 0xFFFFFFFFu
|
||||
|
||||
//ZONE SELECT BLOCK 12
|
||||
#define ZSB12_Z2_CSMPSWD0 0xFFFFFFFFu
|
||||
#define ZSB12_Z2_CSMPSWD1 0x2F7FFFFFu
|
||||
#define ZSB12_Z2_CSMPSWD2 0xFFFFFFFFu
|
||||
#define ZSB12_Z2_CSMPSWD3 0xFFFFFFFFu
|
||||
#define ZSB12_Z2_GRABSECT1 0xFFFFFFFFu
|
||||
#define ZSB12_Z2_GRABSECT2 0xFFFFFFFFu
|
||||
#define ZSB12_Z2_GRABSECT3 0xFFFFFFFFu
|
||||
#define ZSB12_Z2_GRABRAM1 0xFFFFFFFFu
|
||||
#define ZSB12_Z2_GRABRAM2 0xFFFFFFFFu
|
||||
#define ZSB12_Z2_GRABRAM3 0xFFFFFFFFu
|
||||
#define ZSB12_Z2_EXEONLYSECT1 0xFFFFFFFFu
|
||||
#define ZSB12_Z2_EXEONLYSECT2 0xFFFFFFFFu
|
||||
#define ZSB12_Z2_EXEONLYRAM1 0xFFFFFFFFu
|
||||
|
||||
//ZONE SELECT BLOCK 13
|
||||
#define ZSB13_Z2_CSMPSWD0 0xFFFFFFFFu
|
||||
#define ZSB13_Z2_CSMPSWD1 0xCB7FFFFFu
|
||||
#define ZSB13_Z2_CSMPSWD2 0xFFFFFFFFu
|
||||
#define ZSB13_Z2_CSMPSWD3 0xFFFFFFFFu
|
||||
#define ZSB13_Z2_GRABSECT1 0xFFFFFFFFu
|
||||
#define ZSB13_Z2_GRABSECT2 0xFFFFFFFFu
|
||||
#define ZSB13_Z2_GRABSECT3 0xFFFFFFFFu
|
||||
#define ZSB13_Z2_GRABRAM1 0xFFFFFFFFu
|
||||
#define ZSB13_Z2_GRABRAM2 0xFFFFFFFFu
|
||||
#define ZSB13_Z2_GRABRAM3 0xFFFFFFFFu
|
||||
#define ZSB13_Z2_EXEONLYSECT1 0xFFFFFFFFu
|
||||
#define ZSB13_Z2_EXEONLYSECT2 0xFFFFFFFFu
|
||||
#define ZSB13_Z2_EXEONLYRAM1 0xFFFFFFFFu
|
||||
|
||||
//ZONE SELECT BLOCK 14
|
||||
#define ZSB14_Z2_CSMPSWD0 0xFFFFFFFFu
|
||||
#define ZSB14_Z2_CSMPSWD1 0x97FFFFFFu
|
||||
#define ZSB14_Z2_CSMPSWD2 0xFFFFFFFFu
|
||||
#define ZSB14_Z2_CSMPSWD3 0xFFFFFFFFu
|
||||
#define ZSB14_Z2_GRABSECT1 0xFFFFFFFFu
|
||||
#define ZSB14_Z2_GRABSECT2 0xFFFFFFFFu
|
||||
#define ZSB14_Z2_GRABSECT3 0xFFFFFFFFu
|
||||
#define ZSB14_Z2_GRABRAM1 0xFFFFFFFFu
|
||||
#define ZSB14_Z2_GRABRAM2 0xFFFFFFFFu
|
||||
#define ZSB14_Z2_GRABRAM3 0xFFFFFFFFu
|
||||
#define ZSB14_Z2_EXEONLYSECT1 0xFFFFFFFFu
|
||||
#define ZSB14_Z2_EXEONLYSECT2 0xFFFFFFFFu
|
||||
#define ZSB14_Z2_EXEONLYRAM1 0xFFFFFFFFu
|
||||
|
||||
|
||||
#define TIOTP1_SECDC 0x000703F0u // TI OTP SECDC Location
|
||||
|
||||
//DCSM ZSB Offsets
|
||||
#define ZSB0 0x20u
|
||||
#define ZSB1 0x40u
|
||||
#define ZSB2 0x60u
|
||||
#define ZSB3 0x80u
|
||||
#define ZSB4 0xA0u
|
||||
#define ZSB5 0xC0u
|
||||
#define ZSB6 0xE0u
|
||||
#define ZSB7 0x100u
|
||||
#define ZSB8 0x120u
|
||||
#define ZSB9 0x140u
|
||||
#define ZSB10 0x160u
|
||||
#define ZSB11 0x180u
|
||||
#define ZSB12 0x1A0u
|
||||
#define ZSB13 0x1C0u
|
||||
#define ZSB14 0x1E0u
|
||||
|
||||
#define LS0_START 0x00008000 // Local Shared Memories between CLA and CPU
|
||||
#define LS1_START 0x00008800 // Local Shared Memories between CLA and CPU
|
||||
#define LS2_START 0x00009000 // Local Shared Memories between CLA and CPU
|
||||
#define LS3_START 0x00009800 // Local Shared Memories between CLA and CPU
|
||||
#define LS4_START 0x0000A000 // Local Shared Memories between CLA and CPU
|
||||
#define LS5_START 0x0000A800 // Local Shared Memories between CLA and CPU
|
||||
#define LS6_START 0x0000B000 // Local Shared Memories between CLA and CPU
|
||||
#define LS7_START 0x0000B800 // Local Shared Memories between CLA and CPU
|
||||
|
||||
#define D0_START 0x0000C000 // Dedicated Memory for CPU
|
||||
#define D1_START 0x0000C800 // Dedicated Memory for CPU
|
||||
|
||||
#define GS0_START 0x0000D000 // Global Shared Memories
|
||||
#define GS1_START 0x0000E000 // Global Shared Memories
|
||||
#define GS2_START 0x0000F000 // Global Shared Memories
|
||||
#define GS3_START 0x00010000 // Global Shared Memories
|
||||
#define GS4_START 0x00011000 // Global Shared Memories
|
||||
#define GS5_START 0x00012000 // Global Shared Memories
|
||||
#define GS6_START 0x00013000 // Global Shared Memories
|
||||
#define GS7_START 0x00014000 // Global Shared Memories
|
||||
#define GS8_START 0x00015000 // Global Shared Memories
|
||||
#define GS9_START 0x00016000 // Global Shared Memories
|
||||
#define GS10_START 0x00017000 // Global Shared Memories
|
||||
#define GS11_START 0x00018000 // Global Shared Memories
|
||||
#define GS12_START 0x00019000 // Global Shared Memories
|
||||
#define GS13_START 0x0001A000 // Global Shared Memories
|
||||
#define GS14_START 0x0001B000 // Global Shared Memories
|
||||
#define GS15_START 0x0001C000 // Global Shared Memories
|
||||
|
||||
#define M0_START 0x00000000 // CPU M0 Memory
|
||||
#define M1_START 0x00000400 // CPU M1 Memory
|
||||
|
||||
#define LS0_END 0x000087FF // Local Shared Memories between CLA and CPU
|
||||
#define LS1_END 0x00008FFF // Local Shared Memories between CLA and CPU
|
||||
#define LS2_END 0x000097FF // Local Shared Memories between CLA and CPU
|
||||
#define LS3_END 0x00009FFF // Local Shared Memories between CLA and CPU
|
||||
#define LS4_END 0x0000A7FF // Local Shared Memories between CLA and CPU
|
||||
#define LS5_END 0x0000AFFF // Local Shared Memories between CLA and CPU
|
||||
#define LS6_END 0x0000B7FF // Local Shared Memories between CLA and CPU
|
||||
#define LS7_END 0x0000BFFF // Local Shared Memories between CLA and CPU
|
||||
|
||||
#define D0_END 0x0000C7FF // Dedicated Memory for CPU
|
||||
#define D1_END 0x0000CFFF // Dedicated Memory for CPU
|
||||
|
||||
#define GS0_END 0x0000DFFF // Global Shared Memories
|
||||
#define GS1_END 0x0000EFFF // Global Shared Memories
|
||||
#define GS2_END 0x0000FFFF // Global Shared Memories
|
||||
#define GS3_END 0x00010FFF // Global Shared Memories
|
||||
#define GS4_END 0x00011FFF // Global Shared Memories
|
||||
#define GS5_END 0x00012FFF // Global Shared Memories
|
||||
#define GS6_END 0x00013FFF // Global Shared Memories
|
||||
#define GS7_END 0x00014FFF // Global Shared Memories
|
||||
#define GS8_END 0x00015FFF // Global Shared Memories
|
||||
#define GS9_END 0x00016FFF // Global Shared Memories
|
||||
#define GS10_END 0x00017FFF // Global Shared Memories
|
||||
#define GS11_END 0x00018FFF // Global Shared Memories
|
||||
#define GS12_END 0x00019FFF // Global Shared Memories
|
||||
#define GS13_END 0x0001AFFF // Global Shared Memories
|
||||
#define GS14_END 0x0001BFFF // Global Shared Memories
|
||||
#define GS15_END 0x0001CFFF // Global Shared Memories
|
||||
|
||||
#define M0_END 0x000003FF // CPU M0 Memory
|
||||
#define M1_END 0x000007FF // CPU M1 Memory
|
||||
|
||||
//DCSM ZSB Content Offsets
|
||||
#define DCSM_O_Zx_CSMPSWD0 0x0
|
||||
#define DCSM_O_Zx_CSMPSWD1 0x2
|
||||
#define DCSM_O_Zx_CSMPSWD2 0x4
|
||||
#define DCSM_O_Zx_CSMPSWD3 0x6
|
||||
#define DCSM_O_Zx_GRABSECT1 0x8
|
||||
#define DCSM_O_Zx_GRABSECT2 0xA
|
||||
#define DCSM_O_Zx_GRABSECT3 0xC
|
||||
#define DCSM_O_Zx_GRABRAM1 0xE
|
||||
#define DCSM_O_Zx_GRABRAM2 0x10
|
||||
#define DCSM_O_Zx_GRABRAM3 0x12
|
||||
#define DCSM_O_Zx_EXEONLYSECT1 0x14
|
||||
#define DCSM_O_Zx_EXEONLYSECT2 0x16
|
||||
#define DCSM_O_Zx_EXEONLYRAM1 0x18
|
||||
#define DCSM_O_Z1_JTAGPSWDL0 0x1C
|
||||
#define DCSM_O_Z1_JTAGPSWDL1 0x1E
|
||||
|
||||
#define ZONE1_CSMKEY0 0xFFFFFFFF
|
||||
#define ZONE1_CSMKEY1 0x4D7FFFFF
|
||||
#define ZONE1_CSMKEY2 0xFFFFFFFF
|
||||
#define ZONE1_CSMKEY3 0xFFFFFFFF
|
||||
#define ZONE2_CSMKEY0 0xFFFFFFFF
|
||||
#define ZONE2_CSMKEY1 0x1F7FFFFF
|
||||
#define ZONE2_CSMKEY2 0xFFFFFFFF
|
||||
#define ZONE2_CSMKEY3 0xFFFFFFFF
|
||||
|
||||
#define SYSCTL_WD_CHKBITS 0x0028U
|
||||
|
||||
#endif /* DCSM_OTP_H_ */
|
||||
|
||||
|
||||
|
||||
+366
@@ -0,0 +1,366 @@
|
||||
//###########################################################################
|
||||
//
|
||||
// FILE: pbist.h
|
||||
//
|
||||
// TITLE: PBIST Definitions
|
||||
//
|
||||
//###########################################################################
|
||||
// $TI Release: $
|
||||
// $Release Date: $
|
||||
//###########################################################################
|
||||
|
||||
//
|
||||
// Included Files
|
||||
//
|
||||
#include "cpu1bootrom.h"
|
||||
|
||||
//*****************************************************************************
|
||||
//
|
||||
// Registers and their bits descriptions
|
||||
//
|
||||
//*****************************************************************************
|
||||
|
||||
//
|
||||
// RAM INIT registers
|
||||
//
|
||||
#define PBIST_MEMCFG_DXINT (0x5F412UL)
|
||||
#define PBIST_MEMCFG_LSXINT (0x5F432UL)
|
||||
#define PBIST_MEMCFG_GSXINT (0x5F452UL)
|
||||
#define PBIST_MEMCFG_MSGXINT (0x5F472UL)
|
||||
|
||||
//
|
||||
// PBIST register addresses
|
||||
//
|
||||
#define PBIST_DLRT 0x5E364 // PBIST Data Logger Register
|
||||
#define PBIST_STR 0x5E36C // Resume testing
|
||||
#define PBIST_PACT 0x5E380 // PBIST Activate Register
|
||||
#define PBIST_OVERRIDE 0x5E388 // PBIST Override Register
|
||||
#define PBIST_FAIL_STATUS_0 0x5E390 // Fail Status - Port 0
|
||||
#define PBIST_FAIL_STATUS_1 0x5E394 // Fail Status - Port 1
|
||||
#define PBIST_ALGO 0x5E3C4 // PBIST Algorithm Register
|
||||
#define PBIST_RINFOL 0x5E3C8 // RAM Info Mask Register Lower
|
||||
#define PBIST_RINFOU 0x5E3CC // RAM Info Mask Register Higher
|
||||
|
||||
//
|
||||
// System Device Capability register addresses
|
||||
//
|
||||
#define SYSCTL_DC0 (0x0005D000U + 0x10U) // 0:C28-2 (Mx,Dx,CLAMI0-1,CLADI0-1,PIEI0-1,CPUMSG2-3,CMMSGI0-1), 1: CM4 (CMMSGO2-3, CMMSGI2-CMMSGI3, CX0-3, SX0-9)
|
||||
#define SYSCTL_DC1 (0x0005D000U + 0x12U) // 0:C28-1_FPU_TMU, 1:C28-2_FPU_TMU - Will be taken care in algo-group
|
||||
#define SYSCTL_DC11 (0x0005D000U + 0x26U) // 0: CAN-A 1: CAN-B 4: MCAN
|
||||
#define SYSCTL_DC12 (0x0005D000U + 0x28U) // USB Feature 00--> No USB
|
||||
#define SYSCTL_DC18 (0x0005D000U + 0x34U) // C28-1 - LS0 - LS7
|
||||
#define SYSCTL_DC19 (0x0005D000U + 0x36U) // C28-2 - LS0 - LS7
|
||||
#define SYSCTL_DC20 (0x0005D000U + 0x38U) // GS0 - GS15
|
||||
#define SYSCTL_DC26 (0x0005D000U + 0x44U) // ECAT, ENET0-3
|
||||
|
||||
//
|
||||
// Peripheral Clock gating register addresses
|
||||
//
|
||||
#define SYSCTL_PCLKCR0 (0x0005D300U + 0x22U)
|
||||
#define SYSCTL_PCLKCR1 (0x0005D300U + 0x24U)
|
||||
#define SYSCTL_PCLKCR2 (0x0005D300U + 0x26U)
|
||||
#define SYSCTL_PCLKCR3 (0x0005D300U + 0x28U)
|
||||
#define SYSCTL_PCLKCR4 (0x0005D300U + 0x2AU)
|
||||
#define SYSCTL_PCLKCR5 (0x0005D300U + 0x2CU)
|
||||
#define SYSCTL_PCLKCR6 (0x0005D300U + 0x2EU)
|
||||
#define SYSCTL_PCLKCR7 (0x0005D300U + 0x30U)
|
||||
#define SYSCTL_PCLKCR8 (0x0005D300U + 0x32U)
|
||||
#define SYSCTL_PCLKCR9 (0x0005D300U + 0x34U)
|
||||
#define SYSCTL_PCLKCR10 (0x0005D300U + 0x36U)
|
||||
#define SYSCTL_PCLKCR11 (0x0005D300U + 0x38U)
|
||||
#define SYSCTL_PCLKCR12 (0x0005D300U + 0x3AU)
|
||||
#define SYSCTL_PCLKCR13 (0x0005D300U + 0x3CU)
|
||||
#define SYSCTL_PCLKCR14 (0x0005D300U + 0x3EU)
|
||||
#define SYSCTL_PCLKCR15 (0x0005D300U + 0x40U)
|
||||
#define SYSCTL_PCLKCR16 (0x0005D300U + 0x42U)
|
||||
#define SYSCTL_PCLKCR17 (0x0005D300U + 0x44U)
|
||||
#define SYSCTL_PCLKCR18 (0x0005D300U + 0x46U)
|
||||
#define SYSCTL_PCLKCR19 (0x0005D300U + 0x48U)
|
||||
#define SYSCTL_PCLKCR20 (0x0005D300U + 0x4AU)
|
||||
#define SYSCTL_PCLKCR21 (0x0005D300U + 0x4CU)
|
||||
#define SYSCTL_PCLKCR22 (0x0005D300U + 0x4EU)
|
||||
#define SYSCTL_PCLKCR23 (0x0005D300U + 0x50U)
|
||||
|
||||
//
|
||||
// Peripheral soft reset register addresses
|
||||
//
|
||||
#define SYSCTL_SOFTPRES0 (0x0005D000U + 0x82U)
|
||||
#define SYSCTL_SOFTPRES1 (0x0005D000U + 0x84U)
|
||||
#define SYSCTL_SOFTPRES2 (0x0005D000U + 0x86U)
|
||||
#define SYSCTL_SOFTPRES3 (0x0005D000U + 0x88U)
|
||||
#define SYSCTL_SOFTPRES4 (0x0005D000U + 0x8AU)
|
||||
#define SYSCTL_SOFTPRES5 (0x0005D000U + 0x8CU)
|
||||
#define SYSCTL_SOFTPRES6 (0x0005D000U + 0x8EU)
|
||||
#define SYSCTL_SOFTPRES7 (0x0005D000U + 0x90U)
|
||||
#define SYSCTL_SOFTPRES8 (0x0005D000U + 0x92U)
|
||||
#define SYSCTL_SOFTPRES9 (0x0005D000U + 0x94U)
|
||||
#define SYSCTL_SOFTPRES10 (0x0005D000U + 0x96U)
|
||||
#define SYSCTL_SOFTPRES11 (0x0005D000U + 0x98U)
|
||||
#define SYSCTL_SOFTPRES12 (0x0005D000U + 0x9AU)
|
||||
#define SYSCTL_SOFTPRES13 (0x0005D000U + 0x9CU)
|
||||
#define SYSCTL_SOFTPRES14 (0x0005D000U + 0x9EU)
|
||||
#define SYSCTL_SOFTPRES15 (0x0005D000U + 0xA0U)
|
||||
#define SYSCTL_SOFTPRES16 (0x0005D000U + 0xA2U)
|
||||
#define SYSCTL_SOFTPRES17 (0x0005D000U + 0xA4U)
|
||||
#define SYSCTL_SOFTPRES18 (0x0005D000U + 0xA6U)
|
||||
#define SYSCTL_SOFTPRES19 (0x0005D000U + 0xA8U)
|
||||
#define SYSCTL_SOFTPRES20 (0x0005D000U + 0xAAU)
|
||||
#define SYSCTL_SOFTPRES21 (0x0005D000U + 0xACU)
|
||||
#define SYSCTL_SOFTPRES22 (0x0005D000U + 0xAEU)
|
||||
#define SYSCTL_SOFTPRES23 (0x0005D000U + 0xB0U)
|
||||
|
||||
|
||||
#define SYSCTL_SYSPLLCTL1 (0x0005D200U + 0x0EU)
|
||||
#define SYSCTL_SYSPLLMULT (0x0005D200U + 0x14U)
|
||||
#define SYSCTL_SYSPLLSTS (0x0005D200U + 0x16U)
|
||||
#define SYSCTL_AUXPLLCTL1 (0x0005D200U + 0x18U)
|
||||
#define SYSCTL_AUXPLLMULT (0x0005D200U + 0x1EU)
|
||||
#define SYSCTL_AUXPLLSTS (0x0005D200U + 0x20U)
|
||||
#define SYSCTL_SYSCLKDIVSEL (0x0005D200U + 0x22U)
|
||||
#define SYSCTL_AUXCLKDIVSEL (0x0005D200U + 0x24U)
|
||||
#define SYSCTL_CMCLKCTL (0x0005D200U + 0x38U)
|
||||
|
||||
|
||||
#define SYSCTL_PALLOCATE0 (0x0005DC00U + 0x20U)
|
||||
//PBIST GPRREG Configurations
|
||||
#define FLASH_Z1_GPREG2 (0x0005F00AUL)
|
||||
#define FLASH_Z2_GPREG2 (0x0005F08AUL)
|
||||
//#define SYSPLL_CONFIG110 (0x5A000000UL) //SYSPLL1: 110
|
||||
#define SYSPLL_CONFIG110 (0x5A000000UL) //SYSPLL1: 110 SAL to update
|
||||
#define SYSPLL_CONFIG080 (0x5A0000C0UL) //SYSPLL1: 080
|
||||
#define SYSPLL_CONFIG060 (0x5A000030UL) //SYSPLL1: 060
|
||||
#define SYSPLL_CONFIGBYP (0x5A000090UL) //SYSPLL1: 010
|
||||
//
|
||||
// PBIST pie interrupt register
|
||||
//
|
||||
#define PBIST_PIE12_IER (0x0CE0U + 0x18U)
|
||||
#define PBIST_PIE12_IFR (0x0CE0U + 0x19U)
|
||||
|
||||
//
|
||||
// RAM init start and check registers
|
||||
//
|
||||
#define RAM_INIT_START 0x0005F412U
|
||||
#define RAM_INIT_CHECK 0x0005F414U
|
||||
//
|
||||
// ALGO register bits description
|
||||
//
|
||||
#define PBIST_ALGO_TRIPLE_READ_PBIST_ROM ((uint32_t)1 << 0)
|
||||
#define PBIST_ALGO_TRIPLE_READ_SECURE_ROMO0 ((uint32_t)1 << 1)
|
||||
#define PBIST_ALGO_TRIPLE_READ_SECURE_ROMO1 ((uint32_t)1 << 2)
|
||||
#define PBIST_ALGO_TRIPLE_READ_SECURE_ROMI0 ((uint32_t)1 << 3)
|
||||
#define PBIST_ALGO_TRIPLE_READ_SECURE_ROMI1 ((uint32_t)1 << 4)
|
||||
|
||||
#define PBIST_ALGO_TRIPLE_READ_BOOT_ROMO1 ((uint32_t)1 << 5)
|
||||
#define PBIST_ALGO_TRIPLE_READ_BOOT_ROMO2 ((uint32_t)1 << 6)
|
||||
#define PBIST_ALGO_TRIPLE_READ_BOOT_ROMO3 ((uint32_t)1 << 7)
|
||||
#define PBIST_ALGO_TRIPLE_READ_BOOT_ROMO4 ((uint32_t)1 << 8)
|
||||
#define PBIST_ALGO_TRIPLE_READ_BOOT_ROMO5 ((uint32_t)1 << 9)
|
||||
#define PBIST_ALGO_TRIPLE_READ_BOOT_ROMO6 ((uint32_t)1 << 10)
|
||||
|
||||
#define PBIST_ALGO_TRIPLE_READ_BOOT_ROMI1 ((uint32_t)1 << 5)
|
||||
#define PBIST_ALGO_TRIPLE_READ_BOOT_ROMI2 ((uint32_t)1 << 6)
|
||||
#define PBIST_ALGO_TRIPLE_READ_BOOT_ROMI3 ((uint32_t)1 << 7)
|
||||
#define PBIST_ALGO_TRIPLE_READ_BOOT_ROMI4 ((uint32_t)1 << 8)
|
||||
#define PBIST_ALGO_TRIPLE_READ_BOOT_ROMI5 ((uint32_t)1 << 11)
|
||||
#define PBIST_ALGO_TRIPLE_READ_BOOT_ROMI6 ((uint32_t)1 << 12)
|
||||
|
||||
#define PBIST_ALGO_TRIPLE_READ_CLA_DATA_ROM ((uint32_t)1 << 13)
|
||||
#define PBIST_ALGO_TRIPLE_READ_TMU_S1I_ROM ((uint32_t)1 << 14)
|
||||
#define PBIST_ALGO_TRIPLE_READ_TMU_S2I_ROM ((uint32_t)1 << 15)
|
||||
#define PBIST_ALGO_TRIPLE_READ_TMU_Y0_ROM ((uint32_t)1 << 16)
|
||||
|
||||
#define PBIST_ALGO_TRIPLE_READ_CMBOOT_ROM1 ((uint32_t)1 << 17)
|
||||
#define PBIST_ALGO_TRIPLE_READ_CMBOOT_ROM2 ((uint32_t)1 << 18)
|
||||
#define PBIST_ALGO_TRIPLE_READ_HWBIST_ROM0 ((uint32_t)1 << 19)
|
||||
#define PBIST_ALGO_TRIPLE_READ_HWBIST_ROM1 ((uint32_t)1 << 20)
|
||||
#define PBIST_ALGO_TRIPLE_READ_HWBIST_ROM2 ((uint32_t)1 << 21)
|
||||
#define PBIST_ALGO_TRIPLE_READ_HWBIST_ROM3 ((uint32_t)1 << 22) //Have same signature as the previous ROM
|
||||
|
||||
#define PBIST_ALGO_MARCH13N_SINGLE_PORT ((uint32_t)1 << 23)
|
||||
|
||||
//ROM MINFO Values --> The below values are wrong and is not used in the testcase
|
||||
#define PBIST_MINFO_TRIPLE_READ_CPU1_CLA_DATA_ROM ((uint32_t)1 << 17)
|
||||
#define PBIST_MINFO_TRIPLE_READ_CPU2_CLA_DATA_ROM ((uint32_t)1 << 18)
|
||||
#define PBIST_MINFO_TRIPLE_READ_CPU1_TMU_S1I_ROM ((uint32_t)1 << 19)
|
||||
#define PBIST_MINFO_TRIPLE_READ_CPU2_TMU_S1I_ROM ((uint32_t)1 << 20)
|
||||
#define PBIST_MINFO_TRIPLE_READ_CPU1_TMU_S2I_ROM ((uint32_t)1 << 21)
|
||||
#define PBIST_MINFO_TRIPLE_READ_CPU2_TMU_S2I_ROM ((uint32_t)1 << 22)
|
||||
#define PBIST_MINFO_TRIPLE_READ_CPU1_TMU_Y0_ROM ((uint32_t)1 << 23)
|
||||
#define PBIST_MINFO_TRIPLE_READ_CPU2_TMU_Y0_ROM ((uint32_t)1 << 24)
|
||||
|
||||
|
||||
#define PBIST_MINFO_ECAT_DC_0 ((uint64_t)1 << 31)
|
||||
#define PBIST_MINFO_CX_DC_0 ((uint64_t)1 << 31)
|
||||
#define PBIST_MINFO_DX_DC_0 ((uint64_t)1 << 32)
|
||||
#define PBIST_MINFO_DX_DC_1 ((uint64_t)1 << 33)
|
||||
#define PBIST_MINFO_ENET_DC_0 ((uint64_t)1 << 34)
|
||||
#define PBIST_MINFO_GX_DC_1 ((uint64_t)1 << 35)
|
||||
#define PBIST_MINFO_GX_DC_3 ((uint64_t)1 << 35)
|
||||
#define PBIST_MINFO_GX_DC_2 ((uint64_t)1 << 36)
|
||||
#define PBIST_MINFO_GX_DC_0 ((uint64_t)1 << 36)
|
||||
#define PBIST_MINFO_LX_DC_1 ((uint64_t)1 << 37)
|
||||
#define PBIST_MINFO_LX_DC_0 ((uint64_t)1 << 37)
|
||||
#define PBIST_MINFO_LX_DC_3 ((uint64_t)1 << 38)
|
||||
#define PBIST_MINFO_LX_DC_2 ((uint64_t)1 << 38)
|
||||
#define PBIST_MINFO_MX_DC_1 ((uint64_t)1 << 39)
|
||||
#define PBIST_MINFO_MX_DC_0 ((uint64_t)1 << 40)
|
||||
#define PBIST_MINFO_MCAN_DC_0 ((uint64_t)1 << 41)
|
||||
#define PBIST_MINFO_CLAM_DC_0 ((uint64_t)1 << 42)
|
||||
#define PBIST_MINFO_CLAD_DC_1 ((uint64_t)1 << 42)
|
||||
#define PBIST_MINFO_PIE_DC_0 ((uint64_t)1 << 42)
|
||||
#define PBIST_MINFO_STOCK_DC_0 ((uint64_t)1 << 42)
|
||||
#define PBIST_MINFO_FRAME_DC_0 ((uint64_t)1 << 42)
|
||||
#define PBIST_MINFO_FRAME_DC_1 ((uint64_t)1 << 42)
|
||||
#define PBIST_MINFO_CMMSG_DC_0 ((uint64_t)1 << 42)
|
||||
#define PBIST_MINFO_CPUMSG_DC_0 ((uint64_t)1 << 42)
|
||||
#define PBIST_MINFO_CLAM_DC_1 ((uint64_t)1 << 43)
|
||||
#define PBIST_MINFO_CLAD_DC_0 ((uint64_t)1 << 43)
|
||||
#define PBIST_MINFO_PIE_DC_1 ((uint64_t)1 << 43)
|
||||
#define PBIST_MINFO_CMMSG_DC_1 ((uint64_t)1 << 43)
|
||||
#define PBIST_MINFO_SX_DC_1 ((uint64_t)1 << 44)
|
||||
#define PBIST_MINFO_SX_DC_2 ((uint64_t)1 << 44)
|
||||
#define PBIST_MINFO_SX_DC_0 ((uint64_t)1 << 44)
|
||||
#define PBIST_MINFO_USB ((uint64_t)1 << 45)
|
||||
#define PBIST_MINFO_MCAN2 ((uint64_t)1 << 46)
|
||||
|
||||
#define SYSCTL_DC0_C28_2 0x1U
|
||||
#define SYSCTL_DC0_CM4 0x2U
|
||||
#define SYSCTL_DC11_MCAN 0x10U
|
||||
#define SYSCTL_DC12_USB 0x30000U
|
||||
#define SYSCTL_DC12_NOUSB_FUNC 0x0U
|
||||
#define SYSCTL_DC26_ECAT 0x1U
|
||||
#define SYSCTL_DC26_ENET 0x2U
|
||||
|
||||
//*****************************************************************************
|
||||
//
|
||||
// Defines for returning 32 bit values
|
||||
//
|
||||
//*****************************************************************************
|
||||
#define PBIST_ALWAYSFAIL_TIMEOUT_ERROR 0xFF00FF00U
|
||||
#define PBIST_ALWAYSFAIL_INCORRECT_OPERATION 0xFF11FF00U
|
||||
#define PBIST_DOUBLEINT_TIMEOUT_ERROR 0xFF22FF00U
|
||||
#define PBIST_MEMORYTEST_TIMEOUT_ERROR 0xFF33FF00U
|
||||
#define PBIST_MEMORY_TEST_FAIL_ERROR 0xFF44FF00U
|
||||
#define PBIST_MEMORY_RAM210_FAIL_ERROR 0xFF55FF00U
|
||||
#define PBIST_MEMORY_ROM150_FAIL_ERROR 0xFF66FF00U
|
||||
#define PBIST_MEMORY_CLA_DATA_FAIL_ERROR 0xFF77FF00U
|
||||
#define PBIST_MEMORY_TMU_S1I_FAIL_ERROR 0xFF88FF00U
|
||||
#define PBIST_MEMORY_TMU_S2I_FAIL_ERROR 0xFF99FF00U
|
||||
#define PBIST_MEMORY_TMU_Y0_FAIL_ERROR 0xFFAAFF00U
|
||||
#define PBIST_MEMORY_TEST_PASS 0xFFFFFFFFU
|
||||
|
||||
//
|
||||
|
||||
// SECURE ROM ROM Algo group
|
||||
#define PBIST_ALGO_C281_SECURE_ROM (PBIST_ALGO_TRIPLE_READ_SECURE_ROMO0 | \
|
||||
PBIST_ALGO_TRIPLE_READ_SECURE_ROMO1 )
|
||||
|
||||
#define PBIST_ALGO_C282_SECURE_ROM (PBIST_ALGO_TRIPLE_READ_SECURE_ROMI0 | \
|
||||
PBIST_ALGO_TRIPLE_READ_SECURE_ROMI1 )
|
||||
// BOOT ROM ROM Algo group --> Not testing C281 Bootrom to avoid clock issues
|
||||
/*
|
||||
#define PBIST_ALGO_C281BOOT_ROM ( PBIST_ALGO_TRIPLE_READ_BOOT_ROMO1 | \
|
||||
PBIST_ALGO_TRIPLE_READ_BOOT_ROMO2 | \
|
||||
PBIST_ALGO_TRIPLE_READ_BOOT_ROMO3 | \
|
||||
PBIST_ALGO_TRIPLE_READ_BOOT_ROMO4 )
|
||||
*/
|
||||
#define PBIST_ALGO_C281BOOT_ROM 0x0U
|
||||
|
||||
#define PBIST_ALGO_C282BOOT_ROM ( PBIST_ALGO_TRIPLE_READ_BOOT_ROMI1 | \
|
||||
PBIST_ALGO_TRIPLE_READ_BOOT_ROMI2 | \
|
||||
PBIST_ALGO_TRIPLE_READ_BOOT_ROMI3 | \
|
||||
PBIST_ALGO_TRIPLE_READ_BOOT_ROMI4 | \
|
||||
PBIST_ALGO_TRIPLE_READ_BOOT_ROMI5 | \
|
||||
PBIST_ALGO_TRIPLE_READ_BOOT_ROMI6 )
|
||||
|
||||
#define PBIST_MINFO_CLA_DATA_ROM ( PBIST_MINFO_TRIPLE_READ_CPU1_CLA_DATA_ROM | \
|
||||
PBIST_MINFO_TRIPLE_READ_CPU2_CLA_DATA_ROM )
|
||||
|
||||
#define PBIST_MINFO_TMU_S1I_ROM ( PBIST_MINFO_TRIPLE_READ_CPU1_TMU_S1I_ROM | \
|
||||
PBIST_MINFO_TRIPLE_READ_CPU2_TMU_S1I_ROM )
|
||||
|
||||
#define PBIST_MINFO_TMU_S2I_ROM ( PBIST_MINFO_TRIPLE_READ_CPU1_TMU_S2I_ROM | \
|
||||
PBIST_MINFO_TRIPLE_READ_CPU2_TMU_S2I_ROM )
|
||||
|
||||
#define PBIST_MINFO_TMU_Y0_ROM ( PBIST_MINFO_TRIPLE_READ_CPU1_TMU_Y0_ROM | \
|
||||
PBIST_MINFO_TRIPLE_READ_CPU2_TMU_Y0_ROM )
|
||||
|
||||
#define PBIST_MINFO_ALL_RAM ( PBIST_MINFO_ECAT_DC_0 |\
|
||||
PBIST_MINFO_CX_DC_0 |\
|
||||
PBIST_MINFO_DX_DC_0 |\
|
||||
PBIST_MINFO_DX_DC_1 |\
|
||||
PBIST_MINFO_ENET_DC_0 |\
|
||||
PBIST_MINFO_GX_DC_1 |\
|
||||
PBIST_MINFO_GX_DC_3 |\
|
||||
PBIST_MINFO_GX_DC_2 |\
|
||||
PBIST_MINFO_GX_DC_0 |\
|
||||
PBIST_MINFO_LX_DC_1 |\
|
||||
PBIST_MINFO_LX_DC_0 |\
|
||||
PBIST_MINFO_LX_DC_3 |\
|
||||
PBIST_MINFO_LX_DC_2 |\
|
||||
PBIST_MINFO_MX_DC_0 |\
|
||||
PBIST_MINFO_MX_DC_1 |\
|
||||
PBIST_MINFO_MCAN_DC_0 |\
|
||||
PBIST_MINFO_CLAM_DC_0 |\
|
||||
PBIST_MINFO_CLAD_DC_1 |\
|
||||
PBIST_MINFO_PIE_DC_0 |\
|
||||
PBIST_MINFO_STOCK_DC_0 |\
|
||||
PBIST_MINFO_FRAME_DC_0 |\
|
||||
PBIST_MINFO_FRAME_DC_1 |\
|
||||
PBIST_MINFO_CMMSG_DC_0 |\
|
||||
PBIST_MINFO_CPUMSG_DC_0 |\
|
||||
PBIST_MINFO_CLAM_DC_1 |\
|
||||
PBIST_MINFO_CLAD_DC_0 |\
|
||||
PBIST_MINFO_PIE_DC_1 |\
|
||||
PBIST_MINFO_CMMSG_DC_1 |\
|
||||
PBIST_MINFO_SX_DC_1 |\
|
||||
PBIST_MINFO_SX_DC_2 |\
|
||||
PBIST_MINFO_SX_DC_0 |\
|
||||
PBIST_MINFO_USB |\
|
||||
PBIST_MINFO_MCAN2 )
|
||||
|
||||
#define PBIST_ALGO_CLA_DATA_ROM (PBIST_ALGO_TRIPLE_READ_CLA_DATA_ROM)
|
||||
|
||||
#define PBIST_ALGO_TMU_S1I_ROM PBIST_ALGO_TRIPLE_READ_TMU_S1I_ROM
|
||||
#define PBIST_ALGO_TMU_S2I_ROM PBIST_ALGO_TRIPLE_READ_TMU_S2I_ROM
|
||||
#define PBIST_ALGO_TMU_Y0_ROM PBIST_ALGO_TRIPLE_READ_TMU_Y0_ROM
|
||||
|
||||
#define PBIST_ALGO_CMBOOT_ROM ( PBIST_ALGO_TRIPLE_READ_CMBOOT_ROM1 | \
|
||||
PBIST_ALGO_TRIPLE_READ_CMBOOT_ROM2 )
|
||||
|
||||
#define PBIST_ALGO_HWBIST_ROM ( PBIST_ALGO_TRIPLE_READ_HWBIST_ROM0 | \
|
||||
PBIST_ALGO_TRIPLE_READ_HWBIST_ROM1 | \
|
||||
PBIST_ALGO_TRIPLE_READ_HWBIST_ROM2 | \
|
||||
PBIST_ALGO_TRIPLE_READ_HWBIST_ROM3)
|
||||
|
||||
#define PBIST_ALGO_ALL_RAM ( PBIST_ALGO_MARCH13N_SINGLE_PORT )
|
||||
|
||||
#define PBIST_ALGO_210_RAM ( PBIST_ALGO_ALL_RAM )
|
||||
|
||||
#define PBIST_ALGO_210_RAM_ROM ( PBIST_ALGO_210_RAM |\
|
||||
PBIST_ALGO_210_ROM )
|
||||
|
||||
#define PBIST_ALGO_ALL_MEM ( PBIST_ALGO_210_RAM_ROM |\
|
||||
PBIST_ALGO_150_ROM )
|
||||
|
||||
//ALL 210 ROMs except CLA/TMU. They are tested separately
|
||||
#define PBIST_ALGO_210_ROM ( PBIST_ALGO_TRIPLE_READ_PBIST_ROM |\
|
||||
PBIST_ALGO_CLA_DATA_ROM |\
|
||||
PBIST_ALGO_TMU_S1I_ROM |\
|
||||
PBIST_ALGO_TMU_S2I_ROM |\
|
||||
PBIST_ALGO_TMU_Y0_ROM |\
|
||||
PBIST_ALGO_CMBOOT_ROM )
|
||||
|
||||
#define PBIST_ALGO_150_ROM ( PBIST_ALGO_C281_SECURE_ROM |\
|
||||
PBIST_ALGO_C282_SECURE_ROM |\
|
||||
PBIST_ALGO_C281BOOT_ROM |\
|
||||
PBIST_ALGO_C282BOOT_ROM |\
|
||||
PBIST_ALGO_HWBIST_ROM )
|
||||
//
|
||||
// Definitions related to always-fail portion --> Executing MARCH13n on ROM
|
||||
#define PBIST_RINFOL_ROM_MEM_GROUP PBIST_MINFO_TRIPLE_READ_CPU1_TMU_S1I_ROM
|
||||
#define PBIST_ALGO_TMU_ROM_FAIL_ALGO PBIST_ALGO_MARCH13N_SINGLE_PORT //ALGO GROUP --> March13n
|
||||
|
||||
//
|
||||
// End of file
|
||||
//
|
||||
BIN
Binary file not shown.
+64
@@ -0,0 +1,64 @@
|
||||
/*
|
||||
//###########################################################################
|
||||
//
|
||||
// FILE: iqfuncs_lnk.cmd
|
||||
//
|
||||
// TITLE: IQmath Function Symbol List
|
||||
//
|
||||
// DESCRIPTION:
|
||||
//
|
||||
// This file pulls in the functions from the IQmath library into
|
||||
// the boot ROM.
|
||||
//
|
||||
//###########################################################################
|
||||
// $TI Release: $
|
||||
// $Release Date: $
|
||||
//###########################################################################
|
||||
*/
|
||||
|
||||
|
||||
/* IQ15atan2.obj: */ -u _IQ15atan2
|
||||
/* IQ15cos.obj: */ -u _IQ15cos
|
||||
/* IQ15div.obj: */ -u _IQ15div
|
||||
/* IQ15isqrt.obj: */ -u _IQ15isqrt
|
||||
/* IQ15mag.obj: */ -u _IQ15mag
|
||||
/* IQ15sin.obj: */ -u _IQ15sin
|
||||
/* IQ15sqrt.obj: */ -u _IQ15sqrt
|
||||
/* IQ20atan2.obj: */ -u _IQ20atan2
|
||||
/* IQ20cos.obj: */ -u _IQ20cos
|
||||
/* IQ20div.obj: */ -u _IQ20div
|
||||
/* IQ20exp.obj: */ -u _IQ20exp
|
||||
/* IQ20isqrt.obj: */ -u _IQ20isqrt
|
||||
/* IQ20log.obj: */ -u _IQ20log
|
||||
/* IQ20mag.obj: */ -u _IQ20mag
|
||||
/* IQ20sin.obj: */ -u _IQ20sin
|
||||
/* IQ20sqrt.obj: */ -u _IQ20sqrt
|
||||
/* IQ24atan2.obj: */ -u _IQ24atan2
|
||||
/* IQ24cos.obj: */ -u _IQ24cos
|
||||
/* IQ24cosPU.obj: */ -u _IQ24cosPU
|
||||
/* IQ24div.obj: */ -u _IQ24div
|
||||
/* IQ24exp.obj: */ -u _IQ24exp
|
||||
/* IQ24isqrt.obj: */ -u _IQ24isqrt
|
||||
/* IQ24log.obj: */ -u _IQ24log
|
||||
/* IQ24rmpy.obj: */ -u _IQ24rmpy
|
||||
/* IQ24mag.obj: */ -u _IQ24mag
|
||||
/* IQ24sin.obj: */ -u _IQ24sin
|
||||
/* IQ24sinPU.obj: */ -u _IQ24sinPU
|
||||
/* IQ24sqrt.obj: */ -u _IQ24sqrt
|
||||
/* IQ24toF.obj: */ -u _IQ24toF
|
||||
/* IQ29atan2.obj: */ -u _IQ29atan2
|
||||
/* IQ29cos.obj: */ -u _IQ29cos
|
||||
/* IQ29div.obj: */ -u _IQ29div
|
||||
/* IQ29isqrt.obj: */ -u _IQ29isqrt
|
||||
/* IQ29mag.obj: */ -u _IQ29mag
|
||||
/* IQ29rsmpy.obj: */ -u _IQ29rsmpy
|
||||
/* IQ29sin.obj: */ -u _IQ29sin
|
||||
/* IQ29sqrt.obj: */ -u _IQ29sqrt
|
||||
/* IQ30toF.obj: */ -u _IQ30toF
|
||||
/* IQ30rsmpy.obj: */ -u _IQ30rsmpy
|
||||
|
||||
/*
|
||||
//===========================================================================
|
||||
// End of file.
|
||||
//===========================================================================
|
||||
*/
|
||||
+469
@@ -0,0 +1,469 @@
|
||||
//###########################################################################
|
||||
//
|
||||
// FILE: bootloader_can.c
|
||||
//
|
||||
// TITLE: CAN Bootloader
|
||||
//
|
||||
// Functions involved in running CAN bootloader
|
||||
//
|
||||
// ---------------------------------------------------
|
||||
// |Opt No.| BOOTDEF | CANTXA | CANRXA |
|
||||
// ---------------------------------------------------
|
||||
// | 0 | 0x02(default)| 37 | 36 |
|
||||
// | 1 | 0x22 | 71 | 70 |
|
||||
// | 2 | 0x42 | 63 | 62 |
|
||||
// | 3 | 0x62 | 19 | 18 |
|
||||
// | 4 | 0x82 | 4 | 5 |
|
||||
// | 5 | 0xA2 | 31 | 30 |
|
||||
// ---------------------------------------------------
|
||||
//
|
||||
//###########################################################################
|
||||
// $TI Release: $
|
||||
// $Release Date: $
|
||||
//###########################################################################
|
||||
|
||||
//
|
||||
// Included Files
|
||||
//
|
||||
#include "cpu1bootrom.h"
|
||||
#include "inc/hw_memmap.h"
|
||||
#include "inc/hw_sysctl.h"
|
||||
#include "inc/hw_can.h"
|
||||
#include "inc/hw_gpio.h"
|
||||
#include "../include/bootloader_can_timing.h"
|
||||
|
||||
//
|
||||
// Defines
|
||||
//
|
||||
#define SELECT_EXTERNAL_OSC 0x1UL
|
||||
#define CLOCK_DIVIDER_1 0x0U
|
||||
#define CAN_DISABLE_PARITY 0x5UL
|
||||
#define CAN_ENABLE_PARITY 0xAUL
|
||||
#define CAN_11_BIT_ID_S 18U
|
||||
#define CAN_RX_MSG_ID 0x1UL
|
||||
#define CAN_TX_MSG_ID 0x2UL
|
||||
#define CAN_MSG_OBJ_1 0x1U
|
||||
#define CAN_MSG_OBJ_2 0x2U
|
||||
#define CAN_DLC_SIZE 0x2U
|
||||
|
||||
//
|
||||
// CAN bit timing settings for running CAN at 100kbps with a 20MHz crystal
|
||||
//
|
||||
// See CAN timing header for these values
|
||||
|
||||
//
|
||||
// Function Prototypes
|
||||
//
|
||||
static void DCAN_Boot_GPIO(uint32_t bootMode);
|
||||
static void DCAN_Boot_Init(uint32_t btrReg, uint16_t switchToXTAL);
|
||||
static uint16_t DCAN_GetWordData(void);
|
||||
static void DCAN_SendWordData(uint16_t data);
|
||||
static void DCAN_ParseReservedWords(void);
|
||||
|
||||
//
|
||||
// DCAN_Boot - Run the CAN bootloader setup with the specified GPIOs for the
|
||||
// requested CAN boot mode
|
||||
//
|
||||
uint32_t DCAN_Boot(uint32_t bootMode, uint32_t bitTimingRegValue,
|
||||
uint16_t switchToXTAL)
|
||||
{
|
||||
uint32_t entryAddress = 0xFFFFFFFFUL;
|
||||
|
||||
//
|
||||
// CPU1 Patch/Escape Point 10
|
||||
//
|
||||
entryAddress = CPU1BROM_TI_OTP_ESCAPE_POINT_10;
|
||||
if((entryAddress != 0xFFFFFFFFUL) &&
|
||||
(entryAddress != 0x00000000UL))
|
||||
{
|
||||
//
|
||||
// If OTP is programmed, then call OTP patch function
|
||||
//
|
||||
((void (*)(void))entryAddress)();
|
||||
}
|
||||
|
||||
//
|
||||
// If CAN-A is not enabled or X1 isn't saturated for XTAL use,
|
||||
// bypass the boot loader
|
||||
//
|
||||
if(((HWREG(DEVCFG_BASE + SYSCTL_O_DC11) & SYSCTL_DC11_CAN_A) == 0U) ||
|
||||
((HWREGH(CLKCFG_BASE + SYSCTL_O_X1CNT) & SYSCTL_X1CNT_X1CNT_M) != SYSCTL_X1CNT_X1CNT_M))
|
||||
{
|
||||
return(FLASH_ENTRY_POINT);
|
||||
}
|
||||
|
||||
//
|
||||
// Assign the CAN data reader function to the global
|
||||
// function pointer for loading data.
|
||||
//
|
||||
GetWordData = &DCAN_GetWordData;
|
||||
|
||||
//
|
||||
// Set up the GPIO mux for the chosen pinout
|
||||
//
|
||||
DCAN_Boot_GPIO(bootMode);
|
||||
|
||||
//
|
||||
// Set up the CAN to receive data. Pass the user-provided bit timing
|
||||
// register value if one was provided, otherwise pass the default for
|
||||
// 100 kbps with a 20 MHz crystal.
|
||||
//
|
||||
if(bitTimingRegValue == 0U)
|
||||
{
|
||||
bitTimingRegValue = CAN_CALC_BTRREG;
|
||||
}
|
||||
DCAN_Boot_Init(bitTimingRegValue, switchToXTAL);
|
||||
|
||||
//
|
||||
// CPU1 Patch/Escape Point 10
|
||||
//
|
||||
entryAddress = CPU1BROM_TI_OTP_ESCAPE_POINT_10;
|
||||
if((entryAddress != 0xFFFFFFFFUL) &&
|
||||
(entryAddress != 0x00000000UL))
|
||||
{
|
||||
//
|
||||
// If OTP is programmed, then call OTP patch function
|
||||
//
|
||||
((void (*)(void))entryAddress)();
|
||||
}
|
||||
|
||||
//
|
||||
// Testing Only: Send two tests frames if the boot mode says so
|
||||
//
|
||||
if(bootMode >= CAN_BOOT_SENDTEST)
|
||||
{
|
||||
DCAN_SendWordData(0x0320U);
|
||||
DCAN_SendWordData(0xf280U);
|
||||
}
|
||||
|
||||
//
|
||||
// The first data word should be a valid key. If it's not,
|
||||
// bypass the bootloader.
|
||||
//
|
||||
if(DCAN_GetWordData() != 0x08AAU)
|
||||
{
|
||||
return FLASH_ENTRY_POINT;
|
||||
}
|
||||
|
||||
//
|
||||
// Use the shared utility functions to load the data.
|
||||
//
|
||||
DCAN_ParseReservedWords();
|
||||
entryAddress = GetLongData();
|
||||
CopyData();
|
||||
|
||||
return entryAddress;
|
||||
}
|
||||
|
||||
//
|
||||
// DCAN_Boot_GPIO - Configure the peripheral mux to connect CAN-A to the
|
||||
// chosen GPIOs
|
||||
//
|
||||
static void DCAN_Boot_GPIO(uint32_t bootMode)
|
||||
{
|
||||
uint16_t gpioTx;
|
||||
uint16_t gpioRx;
|
||||
uint32_t gpioTxPinConfig;
|
||||
uint32_t gpioRxPinConfig;
|
||||
|
||||
//
|
||||
// Unlock the GPIO configuration registers
|
||||
//
|
||||
GPIO_unlockPortConfig(GPIO_PORT_A,0xFFFFFFFFUL);
|
||||
GPIO_unlockPortConfig(GPIO_PORT_B,0xFFFFFFFFUL);
|
||||
GPIO_unlockPortConfig(GPIO_PORT_C,0xFFFFFFFFUL);
|
||||
|
||||
//
|
||||
// Decode the GPIO selection, then set up the mux and configure the inputs
|
||||
// for asynchronous qualification.
|
||||
//
|
||||
switch (bootMode)
|
||||
{
|
||||
case CAN_BOOT:
|
||||
case CAN_BOOT_SENDTEST:
|
||||
default:
|
||||
//
|
||||
// GPIO37 = CANATX
|
||||
// GPIO36 = CANARX
|
||||
//
|
||||
gpioTx = 37;
|
||||
gpioRx = 36;
|
||||
gpioTxPinConfig = GPIO_37_CANTXA;
|
||||
gpioRxPinConfig = GPIO_36_CANRXA;
|
||||
break;
|
||||
|
||||
case CAN_BOOT_ALT1:
|
||||
case CAN_BOOT_ALT1_SENDTEST:
|
||||
//
|
||||
// GPIO71 = CANATX
|
||||
// GPIO70 = CANARX
|
||||
//
|
||||
gpioTx = 71;
|
||||
gpioRx = 70;
|
||||
gpioTxPinConfig = GPIO_71_CANTXA;
|
||||
gpioRxPinConfig = GPIO_70_CANRXA;
|
||||
|
||||
break;
|
||||
|
||||
case CAN_BOOT_ALT2:
|
||||
case CAN_BOOT_ALT2_SENDTEST:
|
||||
//
|
||||
// GPIO63 = CANATX
|
||||
// GPIO62 = CANARX
|
||||
//
|
||||
gpioTx = 63;
|
||||
gpioRx = 62;
|
||||
gpioTxPinConfig = GPIO_63_CANTXA;
|
||||
gpioRxPinConfig = GPIO_62_CANRXA;
|
||||
|
||||
break;
|
||||
|
||||
case CAN_BOOT_ALT3:
|
||||
case CAN_BOOT_ALT3_SENDTEST:
|
||||
//
|
||||
// GPIO19 = CANATX
|
||||
// GPIO18 = CANARX
|
||||
//
|
||||
gpioTx = 19;
|
||||
gpioRx = 18;
|
||||
gpioTxPinConfig = GPIO_19_CANTXA;
|
||||
gpioRxPinConfig = GPIO_18_CANRXA;
|
||||
|
||||
break;
|
||||
|
||||
case CAN_BOOT_ALT4:
|
||||
case CAN_BOOT_ALT4_SENDTEST:
|
||||
//
|
||||
// GPIO4 = CANATX
|
||||
// GPIO5 = CANARX
|
||||
//
|
||||
gpioTx = 4;
|
||||
gpioRx = 5;
|
||||
gpioTxPinConfig = GPIO_4_CANTXA;
|
||||
gpioRxPinConfig = GPIO_5_CANRXA;
|
||||
|
||||
break;
|
||||
|
||||
case CAN_BOOT_ALT5:
|
||||
case CAN_BOOT_ALT5_SENDTEST:
|
||||
//
|
||||
// GPIO31 = CANATX
|
||||
// GPIO30 = CANARX
|
||||
//
|
||||
gpioTx = 31;
|
||||
gpioRx = 30;
|
||||
gpioTxPinConfig = GPIO_31_CANTXA;
|
||||
gpioRxPinConfig = GPIO_30_CANRXA;
|
||||
|
||||
break;
|
||||
}
|
||||
|
||||
//
|
||||
// Enable pull up on GPIOs pins
|
||||
//
|
||||
GPIO_setPadConfig(gpioTx,GPIO_PIN_TYPE_PULLUP);
|
||||
GPIO_setPadConfig(gpioRx,GPIO_PIN_TYPE_PULLUP);
|
||||
|
||||
//
|
||||
// Set GPIO configuration for CAN
|
||||
//
|
||||
GPIO_setPinConfig(gpioTxPinConfig);
|
||||
GPIO_setPinConfig(gpioRxPinConfig);
|
||||
|
||||
//
|
||||
// Configure GPIOs as async pins
|
||||
//
|
||||
GPIO_setQualificationMode(gpioTx,GPIO_QUAL_ASYNC);
|
||||
GPIO_setQualificationMode(gpioRx,GPIO_QUAL_ASYNC);
|
||||
}
|
||||
|
||||
//
|
||||
// DCAN_Boot_Init - Initialize the CAN-A module and configure its bit clock
|
||||
// and message objects
|
||||
//
|
||||
static void DCAN_Boot_Init(uint32_t btrReg, uint16_t switchToXTAL)
|
||||
{
|
||||
//
|
||||
// Select XTAL for CAN clock
|
||||
//
|
||||
EALLOW;
|
||||
if(switchToXTAL == CAN_BOOT_USE_XTAL)
|
||||
{
|
||||
HWREG(CLKCFG_BASE + SYSCTL_O_CLKSRCCTL2) |= (1U << SYSCTL_CLKSRCCTL2_CANABCLKSEL_S);
|
||||
}
|
||||
|
||||
//
|
||||
// Turn on the clock to the DCAN-A module
|
||||
//
|
||||
HWREG(CPUSYS_BASE + SYSCTL_O_PCLKCR10) |= SYSCTL_PCLKCR10_CAN_A;
|
||||
EDIS;
|
||||
|
||||
//
|
||||
// Put the CAN module into initialization mode, then issue a software reset
|
||||
// via the self-clearing SWR bit.
|
||||
//
|
||||
HWREG_BP(CANA_BASE + CAN_O_CTL) = (CAN_DISABLE_PARITY << CAN_CTL_PMD_S) |
|
||||
CAN_CTL_INIT;
|
||||
asm(" RPT #16 || NOP");
|
||||
EALLOW;
|
||||
HWREG_BP(CANA_BASE + CAN_O_CTL) |= CAN_CTL_SWR;
|
||||
EDIS;
|
||||
asm(" RPT #16 || NOP");
|
||||
|
||||
//
|
||||
// Initialize the CAN message RAM
|
||||
//
|
||||
HWREG_BP(CANA_BASE + CAN_O_RAM_INIT) = CAN_RAM_INIT_CAN_RAM_INIT |
|
||||
CAN_RAM_INIT_KEY;
|
||||
while((HWREG_BP(CANA_BASE + CAN_O_RAM_INIT) & CAN_RAM_INIT_RAM_INIT_DONE) !=
|
||||
CAN_RAM_INIT_RAM_INIT_DONE)
|
||||
{
|
||||
}
|
||||
|
||||
//
|
||||
// Enable config register access, set up the bit timing, and make sure
|
||||
// parity stays enabled.
|
||||
//
|
||||
HWREG_BP(CANA_BASE + CAN_O_CTL) = (CAN_ENABLE_PARITY << CAN_CTL_PMD_S) |
|
||||
CAN_CTL_CCE | CAN_CTL_INIT;
|
||||
HWREG_BP(CANA_BASE + CAN_O_BTR) = btrReg;
|
||||
|
||||
//
|
||||
// Set up a receive message object via interface 1, then transfer it to the
|
||||
// message RAM.
|
||||
//
|
||||
HWREG_BP(CANA_BASE + CAN_O_IF1ARB) = CAN_IF1ARB_MSGVAL | (CAN_RX_MSG_ID << CAN_11_BIT_ID_S);
|
||||
HWREG_BP(CANA_BASE + CAN_O_IF1MCTL) = CAN_IF1MCTL_EOB | CAN_DLC_SIZE;
|
||||
HWREG_BP(CANA_BASE + CAN_O_IF1MSK) = (uint32_t)(CAN_IF1MSK_MSK_M |
|
||||
CAN_IF1MSK_MDIR |
|
||||
CAN_IF1MSK_MXTD);
|
||||
HWREG_BP(CANA_BASE + CAN_O_IF1CMD) = (uint32_t)(CAN_IF1CMD_DIR |
|
||||
CAN_IF1CMD_MASK |
|
||||
CAN_IF1CMD_ARB |
|
||||
CAN_IF1CMD_CONTROL |
|
||||
CAN_IF1CMD_CLRINTPND |
|
||||
CAN_MSG_OBJ_1);
|
||||
|
||||
while((HWREGH(CANA_BASE + CAN_O_IF1CMD) & CAN_IF1CMD_BUSY) == CAN_IF1CMD_BUSY)
|
||||
{
|
||||
}
|
||||
|
||||
//
|
||||
// Set up a transmit object via interface 2 for debug, then transfer it to
|
||||
// the message RAM.
|
||||
//
|
||||
HWREG_BP(CANA_BASE + CAN_O_IF2ARB) = CAN_IF2ARB_MSGVAL | CAN_IF2ARB_DIR |
|
||||
(CAN_TX_MSG_ID << CAN_11_BIT_ID_S);
|
||||
HWREG_BP(CANA_BASE + CAN_O_IF2MCTL) = CAN_IF2MCTL_EOB | CAN_DLC_SIZE;
|
||||
HWREG_BP(CANA_BASE + CAN_O_IF2MSK) = (uint32_t)(CAN_IF2MSK_MSK_M |
|
||||
CAN_IF2MSK_MDIR |
|
||||
CAN_IF2MSK_MXTD);
|
||||
HWREG_BP(CANA_BASE + CAN_O_IF2CMD) = (uint32_t)(CAN_IF2CMD_DIR |
|
||||
CAN_IF2CMD_MASK |
|
||||
CAN_IF2CMD_ARB |
|
||||
CAN_IF2CMD_CONTROL |
|
||||
CAN_IF2CMD_CLRINTPND |
|
||||
CAN_MSG_OBJ_2);
|
||||
|
||||
while((HWREGH(CANA_BASE + CAN_O_IF2CMD) & CAN_IF2CMD_BUSY) == CAN_IF2CMD_BUSY)
|
||||
{
|
||||
}
|
||||
|
||||
//
|
||||
// Leave initialization mode and disable timing register access and
|
||||
// automatic retransmission.
|
||||
//
|
||||
HWREGH(CANA_BASE + CAN_O_CTL) &= ~(CAN_CTL_CCE | CAN_CTL_INIT);
|
||||
}
|
||||
|
||||
//
|
||||
// DCAN_GetWordData - Read 16 bits from an incoming DCAN message sent to ID #1.
|
||||
// If no message has been received, wait for one to arrive.
|
||||
//
|
||||
static uint16_t DCAN_GetWordData(void)
|
||||
{
|
||||
//
|
||||
// Wait for a new CAN message to be received in mailbox 1
|
||||
//
|
||||
while((HWREG_BP(CANA_BASE + CAN_O_NDAT_21) & CAN_MSG_OBJ_1) != CAN_MSG_OBJ_1)
|
||||
{
|
||||
}
|
||||
|
||||
//
|
||||
// Read the message object via IF1 and return the data
|
||||
//
|
||||
HWREG_BP(CANA_BASE + CAN_O_IF1CMD) = (uint32_t)(CAN_IF1CMD_TXRQST |
|
||||
CAN_IF1CMD_DATA_A |
|
||||
CAN_IF1CMD_DATA_B |
|
||||
CAN_MSG_OBJ_1);
|
||||
|
||||
asm(" RPT #2 || NOP");
|
||||
|
||||
while((HWREGH(CANA_BASE + CAN_O_IF1CMD) & CAN_IF1CMD_BUSY) == CAN_IF1CMD_BUSY)
|
||||
{
|
||||
}
|
||||
|
||||
return(HWREGH(CANA_BASE + CAN_O_IF1DATA));
|
||||
}
|
||||
|
||||
//
|
||||
// DCAN_SendWordData - Send a CAN message to ID #2 for external testing and
|
||||
// data rate measurement. Wait for the transmission to
|
||||
// complete.
|
||||
//
|
||||
static void DCAN_SendWordData(uint16_t data)
|
||||
{
|
||||
HWREG_BP(CANA_BASE + CAN_O_IF2DATA) = data;
|
||||
HWREG_BP(CANA_BASE + CAN_O_IF2CMD) = (uint32_t)(CAN_IF2CMD_DIR |
|
||||
CAN_IF2CMD_TXRQST |
|
||||
CAN_IF2CMD_DATA_A |
|
||||
CAN_IF2CMD_DATA_B |
|
||||
CAN_MSG_OBJ_2);
|
||||
|
||||
asm(" RPT #255 || NOP");
|
||||
|
||||
while((HWREGH(CANA_BASE + CAN_O_IF2CMD) & CAN_IF2CMD_BUSY) == CAN_IF2CMD_BUSY)
|
||||
{
|
||||
}
|
||||
|
||||
while((HWREGH(CANA_BASE + CAN_O_TXRQ_21) & CAN_MSG_OBJ_2) == CAN_MSG_OBJ_2)
|
||||
{
|
||||
}
|
||||
}
|
||||
|
||||
//
|
||||
// DCAN_ParseReservedWords - Parse the eight reserved words and check whether
|
||||
// there's a new bit timing register value in the
|
||||
// first pair.
|
||||
//
|
||||
static void DCAN_ParseReservedWords(void)
|
||||
{
|
||||
uint32_t newBtrReg;
|
||||
uint16_t word;
|
||||
|
||||
//
|
||||
// Read the new bit timing value, LSW first
|
||||
//
|
||||
newBtrReg = (uint32_t)DCAN_GetWordData();
|
||||
newBtrReg |= (uint32_t)DCAN_GetWordData() << 16UL;
|
||||
|
||||
//
|
||||
// Skip the rest of the reserved words
|
||||
//
|
||||
for(word = 3U; word <= 8U; word++)
|
||||
{
|
||||
(void)DCAN_GetWordData();
|
||||
}
|
||||
|
||||
//
|
||||
// If a new bit timing value was received, switch to the new settings
|
||||
//
|
||||
if(newBtrReg != 0x00000000UL)
|
||||
{
|
||||
DCAN_Boot_Init(newBtrReg, 0U);
|
||||
}
|
||||
}
|
||||
|
||||
//
|
||||
// End of File
|
||||
//
|
||||
+439
@@ -0,0 +1,439 @@
|
||||
//###########################################################################
|
||||
//
|
||||
// FILE: bootloader_i2c.c
|
||||
//
|
||||
// TITLE: I2C Bootloader routines
|
||||
//
|
||||
// Functions involved in running I2C bootloader
|
||||
//
|
||||
// ---------------------------------------------------
|
||||
// |Opt No.| BOOTDEF | SDAA | SCLA |
|
||||
// ---------------------------------------------------
|
||||
// | 0 | 0x07 | 91 | 92 |
|
||||
// | 1 | 0x27 | 32 | 33 |
|
||||
// | 2 | 0x47 | 42 | 43 |
|
||||
// | 3 | 0x67 | 0 | 1 |
|
||||
// | 4 | 0x87 | 104 | 105 |
|
||||
// ---------------------------------------------------
|
||||
//
|
||||
// Notes:
|
||||
// The I2C code contained here is specifically streamlined for the
|
||||
// bootloader. It can be used to load code via the I2C port into the
|
||||
// RAM and jump to an entry point within that code.
|
||||
//
|
||||
// Features/Limitations:
|
||||
// - The I2C boot loader code is written to communicate with an EEPROM
|
||||
// device at address 0x50. The EEPROM must adhere to conventional I2C
|
||||
// EEPROM protocol (see the boot rom documentation) with a 16-bit
|
||||
// base address architecture (as opposed to 8-bits). The base address
|
||||
// of the code should be contained at address 0x0000 in the EEPROM.
|
||||
// - At boot, the internal oscillator will run at 10Mhz. The boot ROM
|
||||
// will configure the DIVSEL to be /1 for a 10Mhz system clock.
|
||||
// This is due to a requirement that the I2C clock be between 7Mhz
|
||||
// and 12Mhz to meet all of the I2C specification timing requirements.
|
||||
// The I2CPSC default value is hardcoded to 0 so that the I2C
|
||||
// clock will not be divided down from the system clock.
|
||||
// The I2CPSC value can be modified after receiving
|
||||
// the first few bytes from the EEPROM (see the boot rom documentation),
|
||||
// but it is advisable not to, as this can cause the I2C to operate out
|
||||
// of specification with a system clock between 7Mhz and 12Mhz.
|
||||
// - The bit period prescalers (I2CCLKH and I2CCLKL) are configured to
|
||||
// run the I2C at 50% duty cycle at 100kHz bit rate (standard I2C mode)
|
||||
// when the system clock is 12Mhz. These registers can be modified after
|
||||
// receiving the first few bytes from the EEPROM (see the boot rom
|
||||
// documentation). This allows the communication to be increased up to
|
||||
// a 400kHz bit rate (fast I2C mode) during the remaining data reads.
|
||||
// - Arbitration, bus busy, and slave signals are not checked. Therefore,
|
||||
// no other master is allowed to control the bus during this
|
||||
// initialization phase. If the application requires another master
|
||||
// during I2C boot mode, that master must be configured to hold off
|
||||
// sending any I2C messages until the F280x application software
|
||||
// signals that it is past the bootloader portion of initialization.
|
||||
// - The non-acknowledgment bit is only checked during the first message
|
||||
// sent to initialize the EEPROM base address. This ensures that an
|
||||
// EEPROM is present at address 0x50 before continuing on. If an EEPROM
|
||||
// is not present, code will jump to the Flash entry point. The
|
||||
// non-acknowledgment bit is not checked during the address phase of
|
||||
// the data read messages (I2C_GetWord). If a non-acknowledge is
|
||||
// received during the data read messages, the I2C bus will hang.
|
||||
//
|
||||
//###########################################################################
|
||||
// $TI Release: $
|
||||
// $Release Date: $
|
||||
//###########################################################################
|
||||
|
||||
//
|
||||
// Included Files
|
||||
//
|
||||
#include "cpu1bootrom.h"
|
||||
|
||||
//
|
||||
// Defines
|
||||
//
|
||||
#define MODULE_CLOCK BOOTROM_SYSCLK //Frequency of I2C module operation
|
||||
#define SCLA_CLOCK 100000U //I2C bit rate frequency
|
||||
#define SLAVE_ADDRESS 0x0050U
|
||||
#define GET_WORD_KEY 0x08AAU
|
||||
#define NUM_DATA_BYTES 0x02U
|
||||
#define DATA_BYTE_S 0x8U
|
||||
|
||||
//
|
||||
// Function Prototypes
|
||||
//
|
||||
static inline uint16_t I2C_CheckKeyVal(void);
|
||||
static inline void I2C_ReservedFn(void);
|
||||
uint16_t I2C_GetWord(void);
|
||||
void I2CBOOT_configure_gpio(uint32_t bootMode);
|
||||
|
||||
//
|
||||
// I2C_Boot - This module is the main I2C boot routine.
|
||||
// It will load code via the I2C-A port.
|
||||
//
|
||||
// It will return an entry point address back
|
||||
// to the system initialization routine which will call ExitBoot.
|
||||
//
|
||||
uint32_t I2C_Boot(uint32_t bootMode)
|
||||
{
|
||||
uint32_t entryAddress;
|
||||
|
||||
//
|
||||
// CPU1 Patch/Escape Point 11
|
||||
//
|
||||
entryAddress = CPU1BROM_TI_OTP_ESCAPE_POINT_11;
|
||||
if((entryAddress != 0xFFFFFFFFUL) &&
|
||||
(entryAddress != 0x00000000UL))
|
||||
{
|
||||
//
|
||||
// If OTP is programmed, then call OTP patch function
|
||||
//
|
||||
((void (*)(void))entryAddress)();
|
||||
}
|
||||
|
||||
//
|
||||
// Check to verify I2C is present on device
|
||||
//
|
||||
if((HWREG(DEVCFG_BASE + SYSCTL_O_DC10) & SYSCTL_DC10_I2C_A) == 0U)
|
||||
{
|
||||
return(FLASH_ENTRY_POINT);
|
||||
}
|
||||
|
||||
//
|
||||
// Assign GetWordData to the I2C-A version of the
|
||||
// function. GetWordData is a pointer to a function.
|
||||
//
|
||||
GetWordData = I2C_GetWord;
|
||||
|
||||
//
|
||||
// Turn on I2C module clock
|
||||
//
|
||||
SysCtl_enablePeripheral(SYSCTL_PERIPH_CLK_I2CA);
|
||||
|
||||
//
|
||||
// Set Slave address - EEPROM control code
|
||||
//
|
||||
I2C_setSlaveAddress(I2CA_BASE, SLAVE_ADDRESS);
|
||||
|
||||
//
|
||||
// Initialize I2C in master transmitter mode
|
||||
//
|
||||
// I2C input frequency (SYSCLKOUT) = 10 MHz
|
||||
// I2C module frequency(Module clock) = 10 MHz
|
||||
// I2C bit rate (in freq) (Output clock) = 100 KHz
|
||||
//
|
||||
I2C_initMaster(I2CA_BASE,BOOTROM_SYSCLK,SCLA_CLOCK,I2C_DUTYCYCLE_50);
|
||||
I2C_setConfig(I2CA_BASE,I2C_MASTER_SEND_MODE);
|
||||
I2C_setBitCount(I2CA_BASE,I2C_BITCOUNT_8);
|
||||
I2C_enableModule(I2CA_BASE);
|
||||
|
||||
//
|
||||
// Enable FIFO
|
||||
//
|
||||
I2C_enableFIFO(I2CA_BASE);
|
||||
|
||||
//
|
||||
// GPIO INIT
|
||||
//
|
||||
I2CBOOT_configure_gpio(bootMode);
|
||||
|
||||
//
|
||||
// CPU1 Patch/Escape Point 11
|
||||
//
|
||||
entryAddress = CPU1BROM_TI_OTP_ESCAPE_POINT_11;
|
||||
if((entryAddress != 0xFFFFFFFFUL) &&
|
||||
(entryAddress != 0x00000000UL))
|
||||
{
|
||||
//
|
||||
// If OTP is programmed, then call OTP patch function
|
||||
//
|
||||
((void (*)(void))entryAddress)();
|
||||
}
|
||||
|
||||
//
|
||||
// Check for 0x08AA data header, else go to flash
|
||||
//
|
||||
if(I2C_CheckKeyVal() == ERROR)
|
||||
{
|
||||
return FLASH_ENTRY_POINT;
|
||||
}
|
||||
|
||||
//
|
||||
// Check for clock and prescaler speed changes and reserved words
|
||||
//
|
||||
I2C_ReservedFn();
|
||||
|
||||
//
|
||||
// Get point of entry address after load
|
||||
//
|
||||
entryAddress = GetLongData();
|
||||
|
||||
//
|
||||
// Receive and copy one or more code sections to destination addresses
|
||||
//
|
||||
CopyData();
|
||||
|
||||
return entryAddress;
|
||||
}
|
||||
|
||||
//
|
||||
// I2C_CheckKeyVal - This routine sets up the starting address in the
|
||||
// EEPROM by writing two bytes (0x0000) via the
|
||||
// I2C-A port to slave address 0x50. Without
|
||||
// sending a stop bit, the communication is then
|
||||
// restarted and two bytes are read from the EEPROM.
|
||||
// If these two bytes read do not equal 0x08AA
|
||||
// (little endian), an error is returned.
|
||||
//
|
||||
static inline uint16_t I2C_CheckKeyVal(void)
|
||||
{
|
||||
//
|
||||
// To read a word from the EEPROM, an address must be given first in
|
||||
// master transmitter mode. Then a restart is performed and data can
|
||||
// be read back in master receiver mode.
|
||||
//
|
||||
// Setup how many bytes to send
|
||||
//
|
||||
I2C_setDataCount(I2CA_BASE, NUM_DATA_BYTES);
|
||||
|
||||
//
|
||||
// Configure fifo data for byte address of 0x0000
|
||||
//
|
||||
I2C_putData(I2CA_BASE, 0x0U);
|
||||
I2C_putData(I2CA_BASE, 0x0U);
|
||||
|
||||
//
|
||||
// Send data to setup EEPROM address
|
||||
//
|
||||
I2C_sendStartCondition(I2CA_BASE);
|
||||
|
||||
//
|
||||
// Wait until communication complete and registers ready
|
||||
//
|
||||
while((I2C_getStatus(I2CA_BASE) & I2C_STR_ARDY) == 0U)
|
||||
{
|
||||
}
|
||||
|
||||
//
|
||||
// Set stop bit & return error if NACK received
|
||||
//
|
||||
if((I2C_getStatus(I2CA_BASE) & I2C_STR_NACK) == I2C_STR_NACK)
|
||||
{
|
||||
I2C_sendStopCondition(I2CA_BASE);
|
||||
return ERROR;
|
||||
}
|
||||
|
||||
//
|
||||
// Check to make sure key value received is correct
|
||||
//
|
||||
if(I2C_GetWord() != GET_WORD_KEY)
|
||||
{
|
||||
return ERROR;
|
||||
}
|
||||
|
||||
return NO_ERROR;
|
||||
}
|
||||
|
||||
|
||||
//
|
||||
// I2C_ReservedFn - This function reads 8 reserved words in the header.
|
||||
// 1st word - parameters for I2CPSC register
|
||||
// 2nd word - parameters for I2CCLKH register
|
||||
// 3rd word - parameters for I2CCLKL register
|
||||
//
|
||||
// The remaining reserved words are read and discarded
|
||||
// and then program execution returns to the main routine.
|
||||
//
|
||||
static inline void I2C_ReservedFn(void)
|
||||
{
|
||||
uint16_t I2CPrescaler;
|
||||
uint16_t I2cClkHData;
|
||||
uint16_t I2cClkLData;
|
||||
uint16_t i;
|
||||
|
||||
//
|
||||
// Get I2CPSC, I2CCLKH, and I2CCLKL values
|
||||
//
|
||||
I2CPrescaler = I2C_GetWord();
|
||||
I2cClkHData = I2C_GetWord();
|
||||
I2cClkLData = I2C_GetWord();
|
||||
|
||||
//
|
||||
// Store I2C clock prescalers
|
||||
//
|
||||
I2C_disableModule(I2CA_BASE);
|
||||
|
||||
HWREGH(I2CA_BASE + I2C_O_CLKL) = I2cClkLData;
|
||||
HWREGH(I2CA_BASE + I2C_O_CLKH) = I2cClkHData;
|
||||
HWREGH(I2CA_BASE + I2C_O_PSC) = I2CPrescaler;
|
||||
|
||||
I2C_enableModule(I2CA_BASE);
|
||||
|
||||
//
|
||||
// Read and discard the next 5 reserved words
|
||||
//
|
||||
for (i=1U; i<=5U; i++)
|
||||
{
|
||||
(void)I2C_GetWord();
|
||||
}
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
//
|
||||
// I2C_GetWord - This routine fetches two bytes from the I2C-A
|
||||
// port and puts them together little endian style
|
||||
// to form a single 16-bit value.
|
||||
//
|
||||
uint16_t I2C_GetWord(void)
|
||||
{
|
||||
uint16_t lowByte;
|
||||
|
||||
//
|
||||
// Setup how many bytes to expect
|
||||
//
|
||||
I2C_setDataCount(I2CA_BASE, NUM_DATA_BYTES);
|
||||
|
||||
//
|
||||
// Send start as master receiver
|
||||
//
|
||||
I2C_setConfig(I2CA_BASE,I2C_MASTER_RECEIVE_MODE);
|
||||
I2C_sendStartCondition(I2CA_BASE);
|
||||
I2C_sendStopCondition(I2CA_BASE);
|
||||
|
||||
//
|
||||
// Wait until communication done
|
||||
//
|
||||
while(I2C_getStopConditionStatus(I2CA_BASE)){}
|
||||
|
||||
//
|
||||
// Combine two bytes to one word & return
|
||||
//
|
||||
lowByte = I2C_getData(I2CA_BASE);
|
||||
|
||||
return(lowByte | (I2C_getData(I2CA_BASE) << DATA_BYTE_S));
|
||||
}
|
||||
|
||||
|
||||
//
|
||||
// I2CBOOT_configure_gpio - Configure GPIOs for specified I2C boot mode
|
||||
//
|
||||
void I2CBOOT_configure_gpio(uint32_t bootMode)
|
||||
{
|
||||
uint16_t gpioSDAA;
|
||||
uint16_t gpioSCLA;
|
||||
uint32_t gpioSDAAPinConfig;
|
||||
uint32_t gpioSCLAPinConfig;
|
||||
|
||||
//
|
||||
// Unlock the GPIO configuration registers
|
||||
//
|
||||
GPIO_unlockPortConfig(GPIO_PORT_A,0xFFFFFFFFUL);
|
||||
GPIO_unlockPortConfig(GPIO_PORT_B,0xFFFFFFFFUL);
|
||||
GPIO_unlockPortConfig(GPIO_PORT_C,0xFFFFFFFFUL);
|
||||
|
||||
switch (bootMode)
|
||||
{
|
||||
case I2C_MASTER_BOOT:
|
||||
default:
|
||||
//
|
||||
// GPIO91 = SDAA
|
||||
// GPIO92 = SCLA
|
||||
//
|
||||
gpioSDAA = 91;
|
||||
gpioSCLA = 92;
|
||||
gpioSDAAPinConfig = GPIO_91_SDAA;
|
||||
gpioSCLAPinConfig = GPIO_92_SCLA;
|
||||
break;
|
||||
|
||||
case I2C_MASTER_BOOT_ALT1:
|
||||
//
|
||||
// GPIO32 = SDAA
|
||||
// GPIO33 = SCLA
|
||||
//
|
||||
gpioSDAA = 32;
|
||||
gpioSCLA = 33;
|
||||
gpioSDAAPinConfig = GPIO_32_SDAA;
|
||||
gpioSCLAPinConfig = GPIO_33_SCLA;
|
||||
break;
|
||||
|
||||
case I2C_MASTER_BOOT_ALT2:
|
||||
//
|
||||
// GPIO42 = SDAA
|
||||
// GPIO43 = SCLA
|
||||
//
|
||||
gpioSDAA = 42;
|
||||
gpioSCLA = 43;
|
||||
gpioSDAAPinConfig = GPIO_42_SDAA;
|
||||
gpioSCLAPinConfig = GPIO_43_SCLA;
|
||||
break;
|
||||
|
||||
case I2C_MASTER_BOOT_ALT3:
|
||||
//
|
||||
// GPIO0 = SDAA
|
||||
// GPIO1 = SCLA
|
||||
//
|
||||
gpioSDAA = 0;
|
||||
gpioSCLA = 1;
|
||||
gpioSDAAPinConfig = GPIO_0_SDAA;
|
||||
gpioSCLAPinConfig = GPIO_1_SCLA;
|
||||
break;
|
||||
|
||||
case I2C_MASTER_BOOT_ALT4:
|
||||
//
|
||||
// Unlock the GPIO configuration registers
|
||||
//
|
||||
GPIO_unlockPortConfig(GPIO_PORT_D,0x0000FFFFU);
|
||||
|
||||
//
|
||||
// GPIO104 = SDAA
|
||||
// GPIO105 = SCLA
|
||||
//
|
||||
gpioSDAA = 104;
|
||||
gpioSCLA = 105;
|
||||
gpioSDAAPinConfig = GPIO_104_SDAA;
|
||||
gpioSCLAPinConfig = GPIO_105_SCLA;
|
||||
break;
|
||||
}
|
||||
|
||||
//
|
||||
// Enable pull up on GPIOs pins
|
||||
//
|
||||
GPIO_setPadConfig(gpioSDAA,GPIO_PIN_TYPE_PULLUP);
|
||||
GPIO_setPadConfig(gpioSCLA,GPIO_PIN_TYPE_PULLUP);
|
||||
|
||||
//
|
||||
// Set GPIO configuration for I2C
|
||||
//
|
||||
GPIO_setPinConfig(gpioSDAAPinConfig);
|
||||
GPIO_setPinConfig(gpioSCLAPinConfig);
|
||||
|
||||
//
|
||||
// Configure GPIOs as async pins
|
||||
//
|
||||
GPIO_setQualificationMode(gpioSDAA,GPIO_QUAL_ASYNC);
|
||||
GPIO_setQualificationMode(gpioSCLA,GPIO_QUAL_ASYNC);
|
||||
}
|
||||
|
||||
//
|
||||
// End of File
|
||||
//
|
||||
+260
@@ -0,0 +1,260 @@
|
||||
//###########################################################################
|
||||
//
|
||||
// FILE: bootloader_parallel.c
|
||||
//
|
||||
// TITLE: Parallel Port I/O bootloader
|
||||
//
|
||||
// Functions involved in running Parallel I/O bootloader
|
||||
//
|
||||
// ------------------------------------------------------------------
|
||||
// |Opt No.| BOOTDEF | Dx GPIO | DSP Ctrl | Host Ctrl |
|
||||
// ------------------------------------------------------------------
|
||||
// | 0 | 0x00 | 89,90,58-62,88 | 91 | 92 |
|
||||
// ------------------------------------------------------------------
|
||||
//
|
||||
//###########################################################################
|
||||
// $TI Release: $
|
||||
// $Release Date: $
|
||||
//###########################################################################
|
||||
|
||||
//
|
||||
// Included Files
|
||||
//
|
||||
#include "cpu1bootrom.h"
|
||||
|
||||
//
|
||||
// Defines
|
||||
//
|
||||
#define HOST_CTRL_GPIO 92U // GPIO92 is the host control signal
|
||||
// (will be configured as input pin)
|
||||
#define DSP_CTRL_GPIO 91U // GPIO91 is the DSP's control signal
|
||||
// (will be configured as output pin)
|
||||
|
||||
#define PARALLEL_GPIO58 0x04000000UL
|
||||
#define PARALLEL_GPIO59 0x08000000UL
|
||||
#define PARALLEL_GPIO60 0x10000000UL
|
||||
#define PARALLEL_GPIO61 0x20000000UL
|
||||
#define PARALLEL_GPIO62 0x40000000UL
|
||||
#define PARALLEL_GPIO88 0x01000000UL
|
||||
#define PARALLEL_GPIO89 0x02000000UL
|
||||
#define PARALLEL_GPIO90 0x04000000UL
|
||||
#define PARALLEL_GPIO92 0x10000000UL
|
||||
|
||||
//
|
||||
// Function Prototypes
|
||||
//
|
||||
uint16_t Parallel_GetWordData_8bit(void);
|
||||
void Parallel_GPIOSelect(void);
|
||||
uint16_t Parallel_readPortData(void);
|
||||
|
||||
//
|
||||
// Parallel_Boot - This module is the main Parallel boot routine. It will load
|
||||
// code via GP I/Os. This boot mode accepts 8-bit data. 8-bit
|
||||
// data is expected to be the order LSB followed by MSB.
|
||||
//
|
||||
// This function returns a entry point address back
|
||||
// to the system initialization routine which in turn calls
|
||||
// the ExitBoot routine.
|
||||
//
|
||||
uint32_t Parallel_Boot(void)
|
||||
{
|
||||
uint32_t entryAddress;
|
||||
uint16_t wordData;
|
||||
|
||||
//
|
||||
// Setup for Parallel boot
|
||||
//
|
||||
Parallel_GPIOSelect();
|
||||
|
||||
//
|
||||
// CPU1 Patch/Escape Point 12
|
||||
//
|
||||
entryAddress = CPU1BROM_TI_OTP_ESCAPE_POINT_12;
|
||||
if((entryAddress != 0xFFFFFFFFUL) &&
|
||||
(entryAddress != 0x00000000UL))
|
||||
{
|
||||
//
|
||||
// If OTP is programmed, then call OTP patch function
|
||||
//
|
||||
((void (*)(void))entryAddress)();
|
||||
}
|
||||
|
||||
//
|
||||
// Check for the key value. This version only
|
||||
// supports 8-bit data.
|
||||
//
|
||||
GetWordData = Parallel_GetWordData_8bit;
|
||||
wordData = GetWordData();
|
||||
|
||||
if(wordData != BROM_EIGHT_BIT_HEADER)
|
||||
{
|
||||
return FLASH_ENTRY_POINT;
|
||||
}
|
||||
|
||||
//
|
||||
// Read and discard the reserved words
|
||||
//
|
||||
ReadReservedFn();
|
||||
|
||||
//
|
||||
// Get the entry point address
|
||||
//
|
||||
entryAddress = GetLongData();
|
||||
|
||||
//
|
||||
// Load the data
|
||||
//
|
||||
CopyData();
|
||||
|
||||
return entryAddress;
|
||||
}
|
||||
|
||||
//
|
||||
// Parallel_GetWordData_8bit - The 8-bit function is used if the input stream is
|
||||
// an 8-bit input stream and the upper 8-bits of the
|
||||
// GPIO port are ignored. In the 8-bit case the
|
||||
// first fetches the LSB and then the MSB from the
|
||||
// GPIO port. These two bytes are then put together
|
||||
// to form a single 16-bit word that is then passed
|
||||
// back to the host. Note that in this case, the
|
||||
// input stream from the host is in the order LSB
|
||||
// followed by MSB
|
||||
//
|
||||
uint16_t Parallel_GetWordData_8bit(void)
|
||||
{
|
||||
uint16_t wordData;
|
||||
|
||||
//
|
||||
// This routine tells the host that the DSP is ready to
|
||||
// receive data. The DSP then waits for the host to
|
||||
// signal that data is ready on the GP I/O port.
|
||||
//
|
||||
GPIO_writePin(DSP_CTRL_GPIO, 0U);
|
||||
while(GPIO_readPin(HOST_CTRL_GPIO) != 0U){}
|
||||
|
||||
//
|
||||
// Get LSB
|
||||
//
|
||||
wordData = Parallel_readPortData();
|
||||
|
||||
//
|
||||
// This routine tells the host that the DSP has received
|
||||
// the data. The DSP then waits for the host to acknowledge
|
||||
// the receipt before continuing.
|
||||
//
|
||||
GPIO_writePin(DSP_CTRL_GPIO, 1U);
|
||||
while(GPIO_readPin(HOST_CTRL_GPIO) != 1U){}
|
||||
|
||||
//
|
||||
// Fetch the MSB.
|
||||
//
|
||||
wordData = wordData & 0x00FFU;
|
||||
|
||||
//
|
||||
// This routine tells the host that the DSP is ready to
|
||||
// receive data. The DSP then waits for the host to
|
||||
// signal that data is ready on the GP I/O port.
|
||||
//
|
||||
GPIO_writePin(DSP_CTRL_GPIO, 0U);
|
||||
while(GPIO_readPin(HOST_CTRL_GPIO) != 0U){}
|
||||
|
||||
wordData |= (Parallel_readPortData() << 8U);
|
||||
|
||||
//
|
||||
// This routine tells the host that the DSP has received
|
||||
// the data. The DSP then waits for the host to acknowledge
|
||||
// the receipt before continuing.
|
||||
//
|
||||
GPIO_writePin(DSP_CTRL_GPIO, 1U);
|
||||
while(GPIO_readPin(HOST_CTRL_GPIO) != 1U){}
|
||||
|
||||
return wordData;
|
||||
}
|
||||
|
||||
//
|
||||
// Parallel_GPIOSelect - Configure the GPIOs used for Parallel IO bootloader
|
||||
//
|
||||
void Parallel_GPIOSelect(void)
|
||||
{
|
||||
//
|
||||
// Enable Pullups on GPIO88,89,90,58-62
|
||||
//
|
||||
EALLOW;
|
||||
HWREG(GPIOCTRL_BASE + GPIO_O_GPBPUD) &= ~(PARALLEL_GPIO58 |
|
||||
PARALLEL_GPIO59 |
|
||||
PARALLEL_GPIO60 |
|
||||
PARALLEL_GPIO61 |
|
||||
PARALLEL_GPIO62);
|
||||
HWREG(GPIOCTRL_BASE + GPIO_O_GPCPUD) &= ~(PARALLEL_GPIO88 |
|
||||
PARALLEL_GPIO89 |
|
||||
PARALLEL_GPIO90);
|
||||
EDIS;
|
||||
|
||||
//
|
||||
// Configure GPIO89,90,58-62,88,91,92 as GPIO
|
||||
//
|
||||
GPIO_setPinConfig(GPIO_89_GPIO89);
|
||||
GPIO_setPinConfig(GPIO_90_GPIO90);
|
||||
GPIO_setPinConfig(GPIO_58_GPIO58);
|
||||
GPIO_setPinConfig(GPIO_59_GPIO59);
|
||||
GPIO_setPinConfig(GPIO_60_GPIO60);
|
||||
GPIO_setPinConfig(GPIO_61_GPIO61);
|
||||
GPIO_setPinConfig(GPIO_62_GPIO62);
|
||||
GPIO_setPinConfig(GPIO_88_GPIO88);
|
||||
GPIO_setPinConfig(GPIO_91_GPIO91);
|
||||
GPIO_setPinConfig(GPIO_92_GPIO92);
|
||||
|
||||
//
|
||||
// HOST_CTRL_GPIO is an input control from the Host
|
||||
// to the DSP Ack/Rdy
|
||||
// - may require an external pull-up
|
||||
//
|
||||
// DSP_CTRL_GPIO is an output from the DSP Ack/Rdy
|
||||
// - may require an external pull-up for host to correctly
|
||||
// read "1" initially.
|
||||
//
|
||||
// DSP_CTRL_GPIO set to 1 initially
|
||||
// 0 = input 1 = output
|
||||
//
|
||||
|
||||
//
|
||||
// Configure GPIO88,89,90,92,58-62 as input
|
||||
//
|
||||
EALLOW;
|
||||
HWREG(GPIOCTRL_BASE + GPIO_O_GPBDIR) &= ~(PARALLEL_GPIO58 |
|
||||
PARALLEL_GPIO59 |
|
||||
PARALLEL_GPIO60 |
|
||||
PARALLEL_GPIO61 |
|
||||
PARALLEL_GPIO62);
|
||||
HWREG(GPIOCTRL_BASE + GPIO_O_GPCDIR) &= ~(PARALLEL_GPIO88 |
|
||||
PARALLEL_GPIO89 |
|
||||
PARALLEL_GPIO90 |
|
||||
PARALLEL_GPIO92);
|
||||
EDIS;
|
||||
|
||||
//
|
||||
// Configure GPIO91 as output
|
||||
//
|
||||
GPIO_setDirectionMode(DSP_CTRL_GPIO, GPIO_DIR_MODE_OUT);
|
||||
}
|
||||
|
||||
//
|
||||
// Parallel_readPortData - Read the GPIO port data
|
||||
//
|
||||
uint16_t Parallel_readPortData(void)
|
||||
{
|
||||
uint16_t data;
|
||||
|
||||
data = (uint16_t)((GPIO_readPortData(GPIO_PORT_B) &
|
||||
(PARALLEL_GPIO58 | PARALLEL_GPIO59 | PARALLEL_GPIO60 |
|
||||
PARALLEL_GPIO61 | PARALLEL_GPIO62)) >> 24U);
|
||||
data |= (uint16_t)((GPIO_readPortData(GPIO_PORT_C) & PARALLEL_GPIO88) >> 17U);
|
||||
data |= (uint16_t)((GPIO_readPortData(GPIO_PORT_C) &
|
||||
(PARALLEL_GPIO89|PARALLEL_GPIO90)) >> 25U);
|
||||
|
||||
return(data);
|
||||
}
|
||||
|
||||
//
|
||||
// End of File
|
||||
//
|
||||
+350
@@ -0,0 +1,350 @@
|
||||
//###########################################################################
|
||||
//
|
||||
// FILE: bootloader_sci.c
|
||||
//
|
||||
// TITLE: SCI Bootloader Routines
|
||||
//
|
||||
// Functions involved in running SCI bootloader
|
||||
//
|
||||
// ---------------------------------------------------
|
||||
// |Opt No.| BOOTDEF | SCITXA | SCIRXA |
|
||||
// ---------------------------------------------------
|
||||
// | 0 | 0x01(default)| 29 | 28 |
|
||||
// | 1 | 0x21 | 84 | 85 |
|
||||
// | 2 | 0x41 | 36 | 35 |
|
||||
// | 3 | 0x61 | 42 | 43 |
|
||||
// | 4 | 0x81 | 65 | 64 |
|
||||
// | 5 | 0xA1 | 135 | 136 |
|
||||
// | 6 | 0xC1 | 8 | 9 |
|
||||
// ---------------------------------------------------
|
||||
//
|
||||
//###########################################################################
|
||||
// $TI Release: $
|
||||
// $Release Date: $
|
||||
//###########################################################################
|
||||
|
||||
//
|
||||
// Included Files
|
||||
//
|
||||
#include "cpu1bootrom.h"
|
||||
|
||||
//
|
||||
// Defines
|
||||
//
|
||||
#define SCI_DATA_WORD_KEY 0x08AAU
|
||||
#define DATA_BYTE_S 0x8U
|
||||
|
||||
//
|
||||
// Globals
|
||||
//
|
||||
uint16_t SCI_gpioTx;
|
||||
uint32_t SCI_gpioTxPinConfig;
|
||||
|
||||
//
|
||||
// Function Prototypes
|
||||
//
|
||||
uint16_t SCIA_GetWordData(void);
|
||||
static void SCIBOOT_configure_gpio(uint32_t bootMode);
|
||||
|
||||
//
|
||||
// SCI_Boot - This module is the main SCI boot routine.
|
||||
// It will load code via the SCI-A port.
|
||||
//
|
||||
// It will return a entry point address back
|
||||
// to the system initialization routine which in turn calls
|
||||
// the ExitBoot routine.
|
||||
//
|
||||
uint32_t SCI_Boot(uint32_t bootMode)
|
||||
{
|
||||
uint32_t entryAddress;
|
||||
uint16_t byteData;
|
||||
|
||||
//
|
||||
// CPU1 Patch/Escape Point 13
|
||||
//
|
||||
entryAddress = CPU1BROM_TI_OTP_ESCAPE_POINT_13;
|
||||
if((entryAddress != 0xFFFFFFFFUL) &&
|
||||
(entryAddress != 0x00000000UL))
|
||||
{
|
||||
//
|
||||
// If OTP is programmed, then call OTP patch function
|
||||
//
|
||||
((void (*)(void))entryAddress)();
|
||||
}
|
||||
|
||||
//
|
||||
// Check if SCI is enabled on device or not
|
||||
//
|
||||
if((HWREG(DEVCFG_BASE + SYSCTL_O_DC8) & SYSCTL_DC8_SCI_A) == 0U)
|
||||
{
|
||||
return(FLASH_ENTRY_POINT);
|
||||
}
|
||||
|
||||
//
|
||||
// Assign GetWordData to the SCI-A version of the
|
||||
// function. GetWordData is a pointer to a function.
|
||||
//
|
||||
GetWordData = SCIA_GetWordData;
|
||||
|
||||
//
|
||||
// Initialize the SCI-A port for communications
|
||||
// with the host.
|
||||
//
|
||||
|
||||
//
|
||||
// Enable the SCI-A clocks
|
||||
//
|
||||
SysCtl_enablePeripheral(SYSCTL_PERIPH_CLK_SCIA);
|
||||
SysCtl_setLowSpeedClock(SYSCTL_LSPCLK_PRESCALE_4);
|
||||
|
||||
EALLOW;
|
||||
HWREGH(SCIA_BASE + SCI_O_FFTX) = SCI_FFTX_SCIRST;
|
||||
|
||||
//
|
||||
// 1 stop bit, No parity, 8-bit character
|
||||
// No loopback
|
||||
//
|
||||
HWREGH(SCIA_BASE + SCI_O_CCR) = (SCI_CONFIG_WLEN_8 | SCI_CONFIG_STOP_ONE);
|
||||
SCI_setParityMode(SCIA_BASE,SCI_CONFIG_PAR_NONE);
|
||||
|
||||
//
|
||||
// Enable TX, RX, Use internal SCICLK
|
||||
//
|
||||
HWREGH(SCIA_BASE + SCI_O_CTL1) = (SCI_CTL1_TXENA | SCI_CTL1_RXENA);
|
||||
|
||||
//
|
||||
// Disable RxErr, Sleep, TX Wake,
|
||||
// Disable Rx Interrupt, Tx Interrupt
|
||||
//
|
||||
HWREGB(SCIA_BASE + SCI_O_CTL2) = 0x0U;
|
||||
|
||||
//
|
||||
// Relinquish SCI-A from reset and enable TX/RX
|
||||
//
|
||||
SCI_enableModule(SCIA_BASE);
|
||||
|
||||
EDIS;
|
||||
|
||||
//
|
||||
// GPIO INIT
|
||||
//
|
||||
SCIBOOT_configure_gpio(bootMode);
|
||||
|
||||
//
|
||||
// CPU1 Patch/Escape Point 13
|
||||
//
|
||||
entryAddress = CPU1BROM_TI_OTP_ESCAPE_POINT_13;
|
||||
if((entryAddress != 0xFFFFFFFFUL) &&
|
||||
(entryAddress != 0x00000000UL))
|
||||
{
|
||||
//
|
||||
// If OTP is programmed, then call OTP patch function
|
||||
//
|
||||
((void (*)(void))entryAddress)();
|
||||
}
|
||||
|
||||
//
|
||||
// Perform autobaud lock with the host.
|
||||
// Note that if autobaud never occurs
|
||||
// the program will hang in this routine as there
|
||||
// is no timeout mechanism included.
|
||||
//
|
||||
SCI_lockAutobaud(SCIA_BASE);
|
||||
|
||||
//
|
||||
// Read data
|
||||
//
|
||||
byteData = SCI_readCharBlockingNonFIFO(SCIA_BASE);
|
||||
|
||||
//
|
||||
// Configure TX pin after autobaud lock
|
||||
// (Performed here to allow SCI to double as wait boot)
|
||||
//
|
||||
GPIO_setPadConfig(SCI_gpioTx,GPIO_PIN_TYPE_PULLUP);
|
||||
GPIO_setPinConfig(SCI_gpioTxPinConfig);
|
||||
|
||||
//
|
||||
// Write data to request key
|
||||
//
|
||||
SCI_writeCharNonBlocking(SCIA_BASE,byteData);
|
||||
|
||||
//
|
||||
// If the KeyValue was invalid, abort the load
|
||||
// and return the flash entry point.
|
||||
//
|
||||
if(SCIA_GetWordData() != SCI_DATA_WORD_KEY)
|
||||
{
|
||||
return FLASH_ENTRY_POINT;
|
||||
}
|
||||
|
||||
ReadReservedFn();
|
||||
|
||||
entryAddress = GetLongData();
|
||||
|
||||
CopyData();
|
||||
|
||||
return entryAddress;
|
||||
}
|
||||
|
||||
//
|
||||
// SCIA_GetWordData - This routine fetches two bytes from the SCI-A
|
||||
// port and puts them together to form a single
|
||||
// 16-bit value. It is assumed that the host is
|
||||
// sending the data in the order LSB followed by MSB.
|
||||
//
|
||||
uint16_t SCIA_GetWordData(void)
|
||||
{
|
||||
uint16_t wordData;
|
||||
uint16_t byteData;
|
||||
|
||||
wordData = 0x0000U;
|
||||
byteData = 0x0000U;
|
||||
|
||||
//
|
||||
// Fetch the LSB and verify back to the host
|
||||
//
|
||||
wordData = SCI_readCharBlockingNonFIFO(SCIA_BASE);
|
||||
|
||||
SCI_writeCharNonBlocking(SCIA_BASE,wordData);
|
||||
|
||||
byteData = SCI_readCharBlockingNonFIFO(SCIA_BASE);
|
||||
|
||||
SCI_writeCharNonBlocking(SCIA_BASE,byteData);
|
||||
|
||||
//
|
||||
// Form the wordData from the MSB:LSB
|
||||
//
|
||||
wordData |= (byteData << DATA_BYTE_S);
|
||||
|
||||
return wordData;
|
||||
}
|
||||
|
||||
//
|
||||
// SCIBOOT_configure_gpio - This function configures the required GPIOs for the
|
||||
// specified SCI boot mode
|
||||
//
|
||||
static void SCIBOOT_configure_gpio(uint32_t bootMode)
|
||||
{
|
||||
uint16_t gpioRx = 0;
|
||||
uint32_t gpioRxPinConfig = 0;
|
||||
SCI_gpioTx = 0U;
|
||||
SCI_gpioTxPinConfig = 0U;
|
||||
|
||||
//
|
||||
// Unlock the GPIO configuration registers
|
||||
//
|
||||
GPIO_unlockPortConfig(GPIO_PORT_A,0xFFFFFFFFU);
|
||||
GPIO_unlockPortConfig(GPIO_PORT_B,0xFFFFFFFFU);
|
||||
GPIO_unlockPortConfig(GPIO_PORT_C,0x00FFFFFFU);
|
||||
|
||||
switch (bootMode)
|
||||
{
|
||||
case SCI_BOOT:
|
||||
default:
|
||||
//
|
||||
// GPIO29 = SCIATX
|
||||
// GPIO28 = SCIARX
|
||||
//
|
||||
SCI_gpioTx = 29;
|
||||
gpioRx = 28;
|
||||
SCI_gpioTxPinConfig = GPIO_29_SCITXDA;
|
||||
gpioRxPinConfig = GPIO_28_SCIRXDA;
|
||||
break;
|
||||
|
||||
case SCI_BOOT_ALT1:
|
||||
//
|
||||
// GPIO84 = SCIATX
|
||||
// GPIO85 = SCIARX
|
||||
//
|
||||
SCI_gpioTx = 84;
|
||||
gpioRx = 85;
|
||||
SCI_gpioTxPinConfig = GPIO_84_SCITXDA;
|
||||
gpioRxPinConfig = GPIO_85_SCIRXDA;
|
||||
break;
|
||||
|
||||
case SCI_BOOT_ALT2:
|
||||
//
|
||||
// GPIO36 = SCIATX
|
||||
// GPIO35 = SCIARX
|
||||
//
|
||||
SCI_gpioTx = 36;
|
||||
gpioRx = 35;
|
||||
SCI_gpioTxPinConfig = GPIO_36_SCITXDA;
|
||||
gpioRxPinConfig = GPIO_35_SCIRXDA;
|
||||
break;
|
||||
|
||||
case SCI_BOOT_ALT3:
|
||||
//
|
||||
// GPIO42 = SCIATX
|
||||
// GPIO43 = SCIARX
|
||||
//
|
||||
SCI_gpioTx = 42;
|
||||
gpioRx = 43;
|
||||
SCI_gpioTxPinConfig = GPIO_42_SCITXDA;
|
||||
gpioRxPinConfig = GPIO_43_SCIRXDA;
|
||||
break;
|
||||
|
||||
case SCI_BOOT_ALT4:
|
||||
//
|
||||
// GPIO65 = SCIATX
|
||||
// GPIO64 = SCIARX
|
||||
//
|
||||
SCI_gpioTx = 65;
|
||||
gpioRx = 64;
|
||||
SCI_gpioTxPinConfig = GPIO_65_SCITXDA;
|
||||
gpioRxPinConfig = GPIO_64_SCIRXDA;
|
||||
break;
|
||||
|
||||
case SCI_BOOT_ALT5:
|
||||
//
|
||||
// Unlock GPIO Configure Registers
|
||||
//
|
||||
GPIO_unlockPortConfig(GPIO_PORT_E,0x000000FFU);
|
||||
|
||||
//
|
||||
// GPIO135 = SCIATX
|
||||
// GPIO136 = SCIARX
|
||||
//
|
||||
SCI_gpioTx = 135;
|
||||
gpioRx = 136;
|
||||
SCI_gpioTxPinConfig = GPIO_135_SCITXDA;
|
||||
gpioRxPinConfig = GPIO_136_SCIRXDA;
|
||||
break;
|
||||
|
||||
case SCI_BOOT_ALT6:
|
||||
//
|
||||
// GPIO8 = SCIATX
|
||||
// GPIO9 = SCIARX
|
||||
//
|
||||
SCI_gpioTx = 8;
|
||||
gpioRx = 9;
|
||||
SCI_gpioTxPinConfig = GPIO_8_SCITXDA;
|
||||
gpioRxPinConfig = GPIO_9_SCIRXDA;
|
||||
break;
|
||||
}
|
||||
|
||||
//
|
||||
// Configure only the Rx pin so that SCI can receive 'A' for autobaud.
|
||||
// Do not configure Tx pin so that SCI can be used as WAIT Boot
|
||||
// and only one pin will be driven.
|
||||
//
|
||||
|
||||
//
|
||||
// Enable pull up on GPIOs pins
|
||||
//
|
||||
GPIO_setPadConfig(gpioRx,GPIO_PIN_TYPE_PULLUP);
|
||||
|
||||
//
|
||||
// Set GPIO configuration for SCI
|
||||
//
|
||||
GPIO_setPinConfig(gpioRxPinConfig);
|
||||
|
||||
//
|
||||
// Configure GPIOs as async pins
|
||||
//
|
||||
GPIO_setQualificationMode(gpioRx,GPIO_QUAL_ASYNC);
|
||||
}
|
||||
|
||||
//
|
||||
// End of File
|
||||
//
|
||||
Loaded 100 of 14950 files, more files were not shown because too many files have changed in this diff.
Show more
Reference in new issue
Block a user