103 lines
3.8 KiB
Plaintext
103 lines
3.8 KiB
Plaintext
%%{
|
|
var module = system.modules['/driverlib/interrupt.js'];
|
|
var module_sys_err = system.modules['/driverlib/interrupt/interrupt_sys_err.js'];
|
|
let interrupt_common = system.getScript("/driverlib/interrupt/interrupt_common.js");
|
|
var module_wake = system.modules['/driverlib/interrupt/interrupt_wake.js'];
|
|
let Common = system.getScript("/driverlib/Common.js");
|
|
var nameOfModule = "interrupt";
|
|
var nameOfPeripheral = "INTERRUPT";
|
|
let device_driverlib_peripheral =
|
|
system.getScript("/driverlib/device_driverlib_peripherals/" +
|
|
Common.getDeviceName().toLowerCase() + "_interrupt.js");
|
|
%%}
|
|
//*****************************************************************************
|
|
//
|
|
// INTERRUPT Configurations
|
|
//
|
|
//*****************************************************************************
|
|
void `nameOfPeripheral`_init(){
|
|
%%{
|
|
if (module != null)
|
|
{
|
|
for(var i = 0; i < module.$instances.length; i++) {
|
|
var instance = module.$instances[i];
|
|
let owner = instance.$ownedBy;
|
|
//console.log("Interrupt OWNER")
|
|
//console.log(owner.$name);
|
|
//while(owner.$ownedBy)
|
|
//{
|
|
// //console.log("OWNER's Owner:")
|
|
// owner = owner.$ownedBy;
|
|
// //console.log(owner.$name);
|
|
//}
|
|
var driverlibInt = instance.driverlibInt;
|
|
if (instance.pinmuxPeripheralModule)
|
|
{
|
|
let ownerSolution = owner[instance.pinmuxPeripheralModule].$solution;
|
|
var ownerPeripheral = ownerSolution.peripheralName;
|
|
ownerPeripheral = interrupt_common.renameInterrupt(instance.pinmuxPeripheralModule, ownerPeripheral)
|
|
driverlibInt = driverlibInt.replace("#", ownerPeripheral);
|
|
}
|
|
var interruptInfo = device_driverlib_peripheral.interrupts.find((input) => {
|
|
if (driverlibInt == input.int_define_name)
|
|
return input
|
|
})
|
|
var interupt_ack_group = "INTERRUPT_ACK_GROUP" + interruptInfo.int_group_number;
|
|
var interrupt_handler = instance.interruptHandler
|
|
|
|
var interrupt_enable_disable = instance.enableInterrupt? "Interrupt_enable" : "Interrupt_disable";
|
|
%%}
|
|
|
|
// Interrupt Setings for `instance.interruptName`
|
|
Interrupt_register(`instance.interruptName`, &`interrupt_handler`);
|
|
`interrupt_enable_disable`(`instance.interruptName`);
|
|
%%{
|
|
}
|
|
}
|
|
if (module_sys_err != null)
|
|
{
|
|
let device_driverlib_sysctl =
|
|
system.getScript("/driverlib/device_driverlib_peripherals/" +
|
|
Common.getDeviceName().toLowerCase() + "_sysctl.js");
|
|
|
|
for(var i = 0; i < module_sys_err.$instances.length; i++) {
|
|
var instance = module_sys_err.$instances[i];
|
|
var interrupt_enable_disable = instance.enableInterrupt? "Interrupt_enable" : "Interrupt_disable";
|
|
var interrupt_handler = instance.interruptHandler
|
|
|
|
var sysErrSources = device_driverlib_sysctl.SYSCTL_STATUS_SYS_ERR
|
|
var sysErrSourcesConfig = [];
|
|
var enableSysErrors = [];
|
|
for (var sysErrSourceIndex = 1; sysErrSourceIndex < sysErrSources.length; sysErrSourceIndex++)
|
|
{
|
|
if (instance["sysErrSource_" + sysErrSources[sysErrSourceIndex].name])
|
|
{
|
|
enableSysErrors.push(sysErrSources[sysErrSourceIndex].name);
|
|
}
|
|
}
|
|
%%}
|
|
|
|
// Interrupt Setings for `instance.interruptName`
|
|
Interrupt_register(`instance.interruptName`, &`interrupt_handler`);
|
|
`interrupt_enable_disable`(`instance.interruptName`);
|
|
% if (enableSysErrors.length > 0){
|
|
SysCtl_setInterruptStatusMask(`enableSysErrors.join(" | ")`);
|
|
% }
|
|
%%{
|
|
}
|
|
}
|
|
if (module_wake != null){
|
|
for(var i = 0; i < module_wake.$instances.length; i++) {
|
|
var instance = module_wake.$instances[i];
|
|
var interrupt_enable_disable = instance.enableInterrupt? "Interrupt_enable" : "Interrupt_disable";
|
|
var interrupt_handler = instance.interruptHandler
|
|
%%}
|
|
|
|
// Interrupt Setings for `instance.interruptName`
|
|
Interrupt_register(`instance.interruptName`, &`interrupt_handler`);
|
|
`interrupt_enable_disable`(`instance.interruptName`);
|
|
%%{
|
|
}
|
|
}
|
|
%%}
|
|
} |