# CLA Module

The Control Law Accelerator (CLA) API provides a set of functions to configure the CLA. The CLA is an independent accelerator with its own buses, ALU and register set. It does share memory, both program and data, with the main processor; it comes out of a power reset with no memory assets and therefore the C28x must configure how the CLA runs, which memory spaces it uses, and when code must run.

The primary use of the CLA is to implement small, fast control loops that run periodically, responding to specific trigger sources like the PWM or an ADC conversion in a deterministic (fixed and low latency) fashion.

group `cla_api`

  This module is used for configurating CLA.

  Defines

  `CLA_NUM_EOT_INTERRUPTS` (8U)
  `CLA_TASKFLAG_1` (0x01U)

    CLA Task 1 Flag.

  `CLA_TASKFLAG_2` (0x02U)

    CLA Task 2 Flag.

  `CLA_TASKFLAG_3` (0x04U)

    CLA Task 3 Flag.

  `CLA_TASKFLAG_4` (0x08U)

    CLA Task 4 Flag.

  `CLA_TASKFLAG_5` (0x10U)

    CLA Task 5 Flag.

  `CLA_TASKFLAG_6` (0x20U)

    CLA Task 6 Flag.

  `CLA_TASKFLAG_7` (0x40U)

    CLA Task 7 Flag.

  `CLA_TASKFLAG_8` (0x80U)

    CLA Task 8 Flag.

  `CLA_TASKFLAG_ALL` (0xFFU)

    CLA All Task Flag.

  Enums

  enum `CLA_BGTaskStatus`

    Values that can be passed to CLA_getBackgroundTaskStatus() as the stsFlag parameter.

    Values:

    enumerator `CLA_BGSTS_RUNNING` = 0x1U

      Run status.

    enumerator `CLA_BGSTS_CANNOT_INTERRUPT` = 0x2U

      Can BG task be interrupted?

    enumerator `CLA_BGSTS_OVERFLOW` = 0x4U

      BG task hardware trigger overflow - if a second trigger occurs while the BG is already running, the overflow is set

  enum `CLA_TaskNumber`

    Values that can be passed to CLA_getPendingTaskFlag(), CLA_getTaskOverflowFlag(), CLA_getTaskRunStatus(), CLA_setTriggerSource(), CLA_registerEndOfTaskInterrupt(), and CLA_unregisterEndOfTaskInterrupt() as the taskNumber parameter.

    Values:

    enumerator `CLA_TASK_1`

      CLA Task 1.

    enumerator `CLA_TASK_2`

      CLA Task 2.

    enumerator `CLA_TASK_3`

      CLA Task 3.

    enumerator `CLA_TASK_4`

      CLA Task 4.

    enumerator `CLA_TASK_5`

      CLA Task 5.

    enumerator `CLA_TASK_6`

      CLA Task 6.

    enumerator `CLA_TASK_7`

      CLA Task 7.

    enumerator `CLA_TASK_8`

      CLA Task 8.

  enum `CLA_MVECTNumber`

    Values that can be passed to CLA_mapTaskVector() as the claIntVect parameter.

    Values:

    enumerator `CLA_MVECT_1` = 0x0U

      Task Interrupt Vector 1.

    enumerator `CLA_MVECT_2` = 0x1U

      Task Interrupt Vector 2.

    enumerator `CLA_MVECT_3` = 0x2U

      Task Interrupt Vector 3.

    enumerator `CLA_MVECT_4` = 0x3U

      Task Interrupt Vector 4.

    enumerator `CLA_MVECT_5` = 0x4U

      Task Interrupt Vector 5.

    enumerator `CLA_MVECT_6` = 0x5U

      Task Interrupt Vector 6.

    enumerator `CLA_MVECT_7` = 0x6U

      Task Interrupt Vector 7.

    enumerator `CLA_MVECT_8` = 0x7U

      Task Interrupt Vector 8.

  enum `CLA_Trigger`

    Values that can be passed to CLA_setTriggerSource() as the trigger parameter.

    Values:

    enumerator `CLA_TRIGGER_SOFTWARE` = 0U

      CLA Task Trigger Source is Software.

    enumerator `CLA_TRIGGER_ADCA1` = 1U

      CLA Task Trigger Source is ADCA1.

    enumerator `CLA_TRIGGER_ADCA2` = 2U

      CLA Task Trigger Source is ADCA2.

    enumerator `CLA_TRIGGER_ADCA3` = 3U

      CLA Task Trigger Source is ADCA3.

    enumerator `CLA_TRIGGER_ADCA4` = 4U

      CLA Task Trigger Source is ADCA4.

    enumerator `CLA_TRIGGER_ADCAEVT` = 5U

      CLA Task Trigger Source is ADCAEVT.

    enumerator `CLA_TRIGGER_ADCB1` = 6U

      CLA Task Trigger Source is ADCB1.

    enumerator `CLA_TRIGGER_ADCB2` = 7U

      CLA Task Trigger Source is ADCB2.

    enumerator `CLA_TRIGGER_ADCB3` = 8U

      CLA Task Trigger Source is ADCB3.

    enumerator `CLA_TRIGGER_ADCB4` = 9U

      CLA Task Trigger Source is ADCB4.

    enumerator `CLA_TRIGGER_ADCBEVT` = 10U

      CLA Task Trigger Source is ADCBEVT.

    enumerator `CLA_TRIGGER_ADCC1` = 11U

      CLA Task Trigger Source is ADCC1.

    enumerator `CLA_TRIGGER_ADCC2` = 12U

      CLA Task Trigger Source is ADCC2.

    enumerator `CLA_TRIGGER_ADCC3` = 13U

      CLA Task Trigger Source is ADCC3.

    enumerator `CLA_TRIGGER_ADCC4` = 14U

      CLA Task Trigger Source is ADCC4.

    enumerator `CLA_TRIGGER_ADCCEVT` = 15U

      CLA Task Trigger Source is ADCCEVT.

    enumerator `CLA_TRIGGER_XINT1` = 29U

      CLA Task Trigger Source is XINT1.

    enumerator `CLA_TRIGGER_XINT2` = 30U

      CLA Task Trigger Source is XINT2.

    enumerator `CLA_TRIGGER_XINT3` = 31U

      CLA Task Trigger Source is XINT3.

    enumerator `CLA_TRIGGER_XINT4` = 32U

      CLA Task Trigger Source is XINT4.

    enumerator `CLA_TRIGGER_XINT5` = 33U

      CLA Task Trigger Source is XINT5.

    enumerator `CLA_TRIGGER_EPWM1INT` = 36U

      CLA Task Trigger Source is EPWM1INT.

    enumerator `CLA_TRIGGER_EPWM2INT` = 37U

      CLA Task Trigger Source is EPWM2INT.

    enumerator `CLA_TRIGGER_EPWM3INT` = 38U

      CLA Task Trigger Source is EPWM3INT.

    enumerator `CLA_TRIGGER_EPWM4INT` = 39U

      CLA Task Trigger Source is EPWM4INT.

    enumerator `CLA_TRIGGER_EPWM5INT` = 40U

      CLA Task Trigger Source is EPWM5INT.

    enumerator `CLA_TRIGGER_EPWM6INT` = 41U

      CLA Task Trigger Source is EPWM6INT.

    enumerator `CLA_TRIGGER_EPWM7INT` = 42U

      CLA Task Trigger Source is EPWM7INT.

    enumerator `CLA_TRIGGER_EPWM8INT` = 43U

      CLA Task Trigger Source is EPWM8INT.

    enumerator `CLA_TRIGGER_EPWM9INT` = 44U

      CLA Task Trigger Source is EPWM9INT.

    enumerator `CLA_TRIGGER_EPWM10INT` = 45U

      CLA Task Trigger Source is EPWM10INT.

    enumerator `CLA_TRIGGER_EPWM11INT` = 46U

      CLA Task Trigger Source is EPWM11INT.

    enumerator `CLA_TRIGGER_EPWM12INT` = 47U

      CLA Task Trigger Source is EPWM12INT.

    enumerator `CLA_TRIGGER_EPWM13INT` = 48U

      CLA Task Trigger Source is EPWM13INT.

    enumerator `CLA_TRIGGER_EPWM14INT` = 49U

      CLA Task Trigger Source is EPWM14INT.

    enumerator `CLA_TRIGGER_EPWM15INT` = 50U

      CLA Task Trigger Source is EPWM15INT.

    enumerator `CLA_TRIGGER_EPWM16INT` = 51U

      CLA Task Trigger Source is EPWM16INT.

    enumerator `CLA_TRIGGER_MCANA_FEVT0` = 52U

      CLA Task Trigger Source is MCANAFEVT0.

    enumerator `CLA_TRIGGER_MCANA_FEVT1` = 53U

      CLA Task Trigger Source is MCANAFEVT1.

    enumerator `CLA_TRIGGER_MCANA_FEVT2` = 54U

      CLA Task Trigger Source is MCANAFEVT2.

    enumerator `CLA_TRIGGER_MCANB_FEVT0` = 55U

      CLA Task Trigger Source is MCANBFEVT0.

    enumerator `CLA_TRIGGER_MCANB_FEVT1` = 56U

      CLA Task Trigger Source is MCANBFEVT1.

    enumerator `CLA_TRIGGER_MCANB_FEVT2` = 57U

      CLA Task Trigger Source is MCANBFEVT2.

    enumerator `CLA_TRIGGER_EPWM17INT` = 58U

      CLA Task Trigger Source is EPWM17INT.

    enumerator `CLA_TRIGGER_EPWM18INT` = 59U

      CLA Task Trigger Source is EPWM18INT.

    enumerator `CLA_TRIGGER_TINT0` = 68U

      CLA Task Trigger Source is TINT0.

    enumerator `CLA_TRIGGER_TINT1` = 69U

      CLA Task Trigger Source is TINT1.

    enumerator `CLA_TRIGGER_TINT2` = 70U

      CLA Task Trigger Source is TINT2.

    enumerator `CLA_TRIGGER_ECAP1INT` = 75U

      CLA Task Trigger Source is ECAP1INT.

    enumerator `CLA_TRIGGER_ECAP2INT` = 76U

      CLA Task Trigger Source is ECAP2INT.

    enumerator `CLA_TRIGGER_ECAP3INT` = 77U

      CLA Task Trigger Source is ECAP3INT.

    enumerator `CLA_TRIGGER_ECAP4INT` = 78U

      CLA Task Trigger Source is ECAP4INT.

    enumerator `CLA_TRIGGER_ECAP5INT` = 79U

      CLA Task Trigger Source is ECAP5INT.

    enumerator `CLA_TRIGGER_ECAP6INT` = 80U

      CLA Task Trigger Source is ECAP6INT.

    enumerator `CLA_TRIGGER_ECAP7INT` = 81U

      CLA Task Trigger Source is ECAP7INT.

    enumerator `CLA_TRIGGER_EQEP1INT` = 83U

      CLA Task Trigger Source is EQEP1INT.

    enumerator `CLA_TRIGGER_EQEP2INT` = 84U

      CLA Task Trigger Source is EQEP2INT.

    enumerator `CLA_TRIGGER_EQEP3INT` = 85U

      CLA Task Trigger Source is EQEP3INT.

    enumerator `CLA_TRIGGER_EQEP4INT` = 86U

      CLA Task Trigger Source is EQEP4INT.

    enumerator `CLA_TRIGGER_EQEP5INT` = 87U

      CLA Task Trigger Source is EQEP5INT.

    enumerator `CLA_TRIGGER_EQEP6INT` = 88U

      CLA Task Trigger Source is EQEP6INT.

    enumerator `CLA_TRIGGER_ECAP6INT2` = 92U

      CLA Task Trigger Source is ECAP6INT2.

    enumerator `CLA_TRIGGER_ECAP7INT2` = 93U

      CLA Task Trigger Source is ECAP7INT2.

    enumerator `CLA_TRIGGER_SDFM1INT` = 95U

      CLA Task Trigger Source is SDFM1INT.

    enumerator `CLA_TRIGGER_SDFM2INT` = 96U

      CLA Task Trigger Source is SDFM2INT.

    enumerator `CLA_TRIGGER_SDFM3INT` = 97U

      CLA Task Trigger Source is SDFM3INT.

    enumerator `CLA_TRIGGER_SDFM4INT` = 98U

      CLA Task Trigger Source is SDFM4INT.

    enumerator `CLA_TRIGGER_LINAINT1` = 99U

      CLA Task Trigger Source is LINAINT1.

    enumerator `CLA_TRIGGER_LINAINT0` = 100U

      CLA Task Trigger Source is LINAINT0.

    enumerator `CLA_TRIGGER_LINBINT1` = 101U

      CLA Task Trigger Source is LINAINT1.

    enumerator `CLA_TRIGGER_LINBINT0` = 102U

      CLA Task Trigger Source is LINAINT0.

    enumerator `CLA_TRIGGER_SPITXAINT` = 109U

      CLA Task Trigger Source is SPITXAINT.

    enumerator `CLA_TRIGGER_SPIRXAINT` = 110U

      CLA Task Trigger Source is SPIRXAINT.

    enumerator `CLA_TRIGGER_SPITXBINT` = 111U

      CLA Task Trigger Source is SPITXBINT.

    enumerator `CLA_TRIGGER_SPIRXBINT` = 112U

      CLA Task Trigger Source is SPIRXBINT.

    enumerator `CLA_TRIGGER_SPITXCINT` = 113U

      CLA Task Trigger Source is SPITXCINT.

    enumerator `CLA_TRIGGER_SPIRXCINT` = 114U

      CLA Task Trigger Source is SPIRXCINT.

    enumerator `CLA_TRIGGER_SPITXDINT` = 115U

      CLA Task Trigger Source is SPITXDINT.

    enumerator `CLA_TRIGGER_SPIRXDINT` = 116U

      CLA Task Trigger Source is SPIRXDINT.

    enumerator `CLA_TRIGGER_CLB5INT` = 117U

      CLA Task Trigger Source is CLB5INT.

    enumerator `CLA_TRIGGER_CLB6INT` = 118U

      CLA Task Trigger Source is CLB6INT.

    enumerator `CLA_TRIGGER_CLA1CRCINT` = 121U

      CLA Task Trigger Srce is CLA1CRCINT.

    enumerator `CLA_TRIGGER_FSITXAINT1` = 123U

      CLA Task Trigger Source is FSITXAINT1.

    enumerator `CLA_TRIGGER_FSITXAINT2` = 124U

      CLA Task Trigger Source is FSITXAINT2.

    enumerator `CLA_TRIGGER_FSIRXAINT1` = 125U

      CLA Task Trigger Source is FSIRXAINT1.

    enumerator `CLA_TRIGGER_FSIRXAINT2` = 126U

      CLA Task Trigger Source is FSIRXAINT2.

    enumerator `CLA_TRIGGER_CLB1INT` = 127

      CLA Task Trigger Source is CLB1INT.

    enumerator `CLA_TRIGGER_CLB2INT` = 128

      CLA Task Trigger Source is CLB2INT.

    enumerator `CLA_TRIGGER_CLB3INT` = 129

      CLA Task Trigger Source is CLB3INT.

    enumerator `CLA_TRIGGER_CLB4INT` = 130

      CLA Task Trigger Source is CLB4INT.

    enumerator `CLA_TRIGGER_SDFM1DRINT1` = 143U

      CLA Task Trigger Srce is SDFM1DRINT1.

    enumerator `CLA_TRIGGER_SDFM1DRINT2` = 144U

      CLA Task Trigger Srce is SDFM1DRINT2.

    enumerator `CLA_TRIGGER_SDFM1DRINT3` = 145U

      CLA Task Trigger Srce is SDFM1DRINT3.

    enumerator `CLA_TRIGGER_SDFM1DRINT4` = 146U

      CLA Task Trigger Srce is SDFM1DRINT4.

    enumerator `CLA_TRIGGER_SDFM2DRINT1` = 147U

      CLA Task Trigger Srce is SDFM2DRINT1.

    enumerator `CLA_TRIGGER_SDFM2DRINT2` = 148U

      CLA Task Trigger Srce is SDFM2DRINT2.

    enumerator `CLA_TRIGGER_SDFM2DRINT3` = 149U

      CLA Task Trigger Srce is SDFM2DRINT3.

    enumerator `CLA_TRIGGER_SDFM2DRINT4` = 150U

      CLA Task Trigger Srce is SDFM2DRINT4.

    enumerator `CLA_TRIGGER_SDFM3DRINT1` = 151U

      CLA Task Trigger Srce is SDFM3DRINT1.

    enumerator `CLA_TRIGGER_SDFM3DRINT2` = 152U

      CLA Task Trigger Srce is SDFM3DRINT2.

    enumerator `CLA_TRIGGER_SDFM3DRINT3` = 153U

      CLA Task Trigger Srce is SDFM3DRINT3.

    enumerator `CLA_TRIGGER_SDFM3DRINT4` = 154U

      CLA Task Trigger Srce is SDFM3DRINT4.

    enumerator `CLA_TRIGGER_FSITXBINT1` = 155U

      CLA Task Trigger Source is FSITXBINT1.

    enumerator `CLA_TRIGGER_FSITXBINT2` = 156U

      CLA Task Trigger Source is FSITXBINT2.

    enumerator `CLA_TRIGGER_FSIRXBINT1` = 157U

      CLA Task Trigger Source is FSIRXBINT1.

    enumerator `CLA_TRIGGER_FSIRXBINT2` = 158U

      CLA Task Trigger Source is FSIRXBINT2.

    enumerator `CLA_TRIGGER_FSIRXCINT1` = 159U

      CLA Task Trigger Source is FSIRXCINT1.

    enumerator `CLA_TRIGGER_FSIRXCINT2` = 160U

      CLA Task Trigger Source is FSIRXCINT2.

    enumerator `CLA_TRIGGER_FSIRXDINT1` = 161U

      CLA Task Trigger Source is FSIRXDINT1.

    enumerator `CLA_TRIGGER_FSIRXDINT2` = 162U

      CLA Task Trigger Source is FSIRXDINT2.

    enumerator `CLA_TRIGGER_DMACH1INT` = 184U

      CLA Task Trigger Source is DMA_CH1INT.

    enumerator `CLA_TRIGGER_DMACH2INT` = 185U

      CLA Task Trigger Source is DMA_CH2INT.

    enumerator `CLA_TRIGGER_DMACH3INT` = 186U

      CLA Task Trigger Source is DMA_CH3INT.

    enumerator `CLA_TRIGGER_DMACH4INT` = 187U

      CLA Task Trigger Source is DMA_CH4INT.

    enumerator `CLA_TRIGGER_DMACH5INT` = 188U

      CLA Task Trigger Source is DMA_CH5INT.

    enumerator `CLA_TRIGGER_DMACH6INT` = 189U

      CLA Task Trigger Source is DMA_CH6INT.

    enumerator `CLA_TRIGGER_SDFM4DRINT1` = 202U

      CLA Task Trigger Srce is SDFM4DRINT1.

    enumerator `CLA_TRIGGER_SDFM4DRINT2` = 203U

      CLA Task Trigger Srce is SDFM4DRINT2.

    enumerator `CLA_TRIGGER_SDFM4DRINT3` = 204U

      CLA Task Trigger Srce is SDFM4DRINT3.

    enumerator `CLA_TRIGGER_SDFM4DRINT4` = 205U

      CLA Task Trigger Srce is SDFM4DRINT4.

  Functions

  void `CLA_mapTaskVector`(uint32_t base, CLA_MVECTNumber claIntVect, uint16_t claTaskAddr)

    Map CLA Task Interrupt Vector

    Each CLA Task (1 to 8) has its own MVECTx register. When a task is triggered, the CLA loads the MVECTx register of the task in question to the MPC (CLA program counter) and begins execution from that point. The CLA has a 16-bit address bus, and can therefore, access the lower 64 KW space. The MVECTx registers take an address anywhere in this space.

    Parameters

      - `base`: is the base address of the CLA controller.

      - `claIntVect`: is CLA interrupt vector (MVECT1 to MVECT8) the value of claIntVect can be any of the following:

        - CLA_MVECT_1 - Task Interrupt Vector 1

        - CLA_MVECT_2 - Task Interrupt Vector 2

        - CLA_MVECT_3 - Task Interrupt Vector 3

        - CLA_MVECT_4 - Task Interrupt Vector 4

        - CLA_MVECT_5 - Task Interrupt Vector 5

        - CLA_MVECT_6 - Task Interrupt Vector 6

        - CLA_MVECT_7 - Task Interrupt Vector 7

        - CLA_MVECT_8 - Task Interrupt Vector 8

      - `claTaskAddr`: is the start address of the code for task

    Return

      None.

  void `CLA_performHardReset`(uint32_t base)

    Hard Reset

    This function will cause a hard reset of the CLA and set all CLA registers to their default state.

    Parameters

      - `base`: is the base address of the CLA controller.

    Return

      None.

  void `CLA_performSoftReset`(uint32_t base)

    Soft Reset

    This function will cause a soft reset of the CLA. This will stop the current task, clear the MIRUN flag and clear all bits in the MIER register.

    Parameters

      - `base`: is the base address of the CLA controller.

    Return

      None.

  void `CLA_enableIACK`(uint32_t base)

    IACK enable

    This function enables the main CPU to use the IACK #16bit instruction to set MIFR bits in the same manner as writing to the MIFRC register.

    Parameters

      - `base`: is the base address of the CLA controller.

    Return

      None.

  void `CLA_disableIACK`(uint32_t base)

    IACK disable

    This function disables the main CPU to use the IACK #16bit instruction to set MIFR bits in the same manner as writing to the MIFRC register.

    Parameters

      - `base`: is the base address of the CLA controller.

    Return

      None.

  bool `CLA_getPendingTaskFlag`(uint32_t base, CLA_TaskNumber taskNumber)

    Query task N to see if it is flagged and pending execution

    This function gets the status of each bit in the interrupt flag register corresponds to a CLA task. The corresponding bit is automatically set when the task is triggered (either from a peripheral, through software, or through the MIFRC register). The bit gets cleared when the CLA starts to execute the flagged task.

    Parameters

      - `base`: is the base address of the CLA controller.

      - `taskNumber`: is the number of the task CLA_TASK_N where N is a number from 1 to 8. Do not use CLA_TASKFLAG_ALL.

    Return

      True if the queried task has been triggered but pending execution.

  uint16_t `CLA_getAllPendingTaskFlags`(uint32_t base)

    Get status of All Task Interrupt Flag

    This function gets the value of the interrupt flag register (MIFR)

    Parameters

      - `base`: is the base address of the CLA controller.

    Return

      the value of Interrupt Flag Register (MIFR)

  bool `CLA_getTaskOverflowFlag`(uint32_t base, CLA_TaskNumber taskNumber)

    Get status of Task n Interrupt Overflow Flag

    This function gets the status of each bit in the overflow flag register corresponds to a CLA task, This bit is set when an interrupt overflow event has occurred for the specific task.

    Parameters

      - `base`: is the base address of the CLA controller.

      - `taskNumber`: is the number of the task CLA_TASK_N where N is a number from 1 to 8. Do not use CLA_TASKFLAG_ALL.

    Return

      True if any of task interrupt overflow has occurred.

  uint16_t `CLA_getAllTaskOverflowFlags`(uint32_t base)

    Get status of All Task Interrupt Overflow Flag

    This function gets the value of the Interrupt Overflow Flag Register

    Parameters

      - `base`: is the base address of the CLA controller.

    Return

      the value of Interrupt Overflow Flag Register(MIOVF)

  void `CLA_clearTaskFlags`(uint32_t base, uint16_t taskFlags)

    Clear the task interrupt flag

    This function is used to manually clear bits in the interrupt flag (MIFR) register

    Parameters

      - `base`: is the base address of the CLA controller.

      - `taskFlags`: is the bitwise OR of the tasks’ flags to be cleared CLA_TASKFLAG_N where N is the task number from 1 to 8, or CLA_TASKFLAG_ALL to clear all flags.

    Return

      None.

  void `CLA_forceTasks`(uint32_t base, uint16_t taskFlags)

    Force a CLA Task

    This function forces a task through software.

    Parameters

      - `base`: is the base address of the CLA controller.

      - `taskFlags`: is the bitwise OR of the tasks’ flags to be forced CLA_TASKFLAG_N where N is the task number from 1 to 8, or CLA_TASKFLAG_ALL to force all tasks.

    Return

      None.

  void `CLA_enableTasks`(uint32_t base, uint16_t taskFlags)

    Enable CLA task(s)

    This function allows an incoming interrupt or main CPU software to start the corresponding CLA task.

    Parameters

      - `base`: is the base address of the CLA controller.

      - `taskFlags`: is the bitwise OR of the tasks’ flags to be enabled CLA_TASKFLAG_N where N is the task number from 1 to 8, or CLA_TASKFLAG_ALL to enable all tasks

    Return

      None.

  void `CLA_disableTasks`(uint32_t base, uint16_t taskFlags)

    Disable CLA task interrupt

    This function disables CLA task interrupt by setting the MIER register bit to 0, while the corresponding task is executing this will have no effect on the task. The task will continue to run until it hits the MSTOP instruction.

    Parameters

      - `base`: is the base address of the CLA controller.

      - `taskFlags`: is the bitwise OR of the tasks’ flags to be disabled CLA_TASKFLAG_N where N is the task number from 1 to 8, or CLA_TASKFLAG_ALL to disable all tasks

    Return

      None.

  bool `CLA_getTaskRunStatus`(uint32_t base, CLA_TaskNumber taskNumber)

    Get the value of a task run status

    This function gets the status of each bit in the Interrupt Run Status Register which indicates whether the task is currently executing

    Parameters

      - `base`: is the base address of the CLA controller.

      - `taskNumber`: is the number of the task CLA_TASK_N where N is a number from 1 to 8. Do not use CLA_TASKFLAG_ALL.

    Return

      True if the task is executing.

  uint16_t `CLA_getAllTaskRunStatus`(uint32_t base)

    Get the value of all task run status

    This function indicates which task is currently executing.

    Parameters

      - `base`: is the base address of the CLA controller.

    Return

      the value of Interrupt Run Status Register (MIRUN)

  uint16_t `CLA_getBackgroundActiveVector`(uint32_t base)

    Get the value of Active register for MVECTBGRNDACTIVE

    This function gives the current interrupted MPC value of the background task.

    Parameters

      - `base`: is the base address of the CLA controller.

    Return

      the value of Active register for the Background Task Vector

  void `CLA_enableBackgroundTask`(uint32_t base)

    Enable the background task

    This function enables the background task

    Parameters

      - `base`: is the base address of the CLA controller.

    Return

      None.

  void `CLA_disableBackgroundTask`(uint32_t base)

    Disable background task

    This function disables the background task

    Parameters

      - `base`: is the base address of the CLA controller.

    Return

      None.

  void `CLA_startBackgroundTask`(uint32_t base)

    Start background task

    This function will start the background task, provided there are no other pending tasks.

    Parameters

      - `base`: is the base address of the CLA controller.

    Return

      None.

  void `CLA_enableHardwareTrigger`(uint32_t base)

    Enable background task hardware trigger

    This function enables hardware trigger for background task

    Note

      Trigger source for the background task will be MPERINT8.1.

    Return

      None.

    Parameters

      - `base`: is the base address of the CLA controller.

  void `CLA_disableHardwareTrigger`(uint32_t base)

    Disable background task hardware trigger

    This function disables hardware trigger for background task

    Parameters

      - `base`: is the base address of the CLA controller.

    Return

      None.

  void `CLA_mapBackgroundTaskVector`(uint32_t base, uint16_t claTaskAddr)

    Map background task vector

    This function specifies the start address for the background task

    Parameters

      - `base`: is the base address of the CLA controller.

      - `claTaskAddr`: is the start address of the code for task

    Return

      None.

  bool `CLA_getBackgroundTaskStatus`(uint32_t base, CLA_BGTaskStatus stsFlag)

    Get Status register for the back ground task.

    The value of

    stsFlag can be any of the following:

    - CLA_BGSTS_RUNNING

    - CLA_BGSTS_CANNOT_INTERRUPT

    - CLA_BGSTS_OVERFLOW

    Parameters

      - `base`: is the base address of the CLA controller.

      - `stsFlag`: is status item to be returned.

    This function gets the status of background task

    Return

      Based on the value of stsFlag, the function will return:

      - CLA_BGSTS_RUNNING - The function will return true if the background task is running.

      - CLA_BGSTS_CANNOT_INTERRUPT - The function will return true if the background task will not be interrupted (when MSETC BGINTM is executed).

      - CLA_BGSTS_OVERFLOW - This function will return true if an enabled hardware trigger occurred while _MCTLBGRND.BGSTART is set.

  void `CLA_enableSoftwareInterrupt`(uint32_t base, uint16_t taskFlags)

    Enable the Software Interrupt for a given CLA Task

    This function enables the Software Interrupt for a single, or set of, CLA task(s). It does this by writing a 1 to the task’s bit in the CLA1SOFTINTEN register. By setting a task’s SOFTINT bit, you disable its ability to generate an end-of-task interrupt For example, if we enable Task 2’s SOFTINT bit, we disable its ability to generate an end-of-task interrupt, but now any running CLA task has the ability to force task 2’s interrupt (through the CLA1INTFRC register) to the main CPU. This interrupt will be handled by the End-of-Task 2 interrupt handler even though the interrupt was not caused by Task 2 running to completion. This allows programmers to generate interrupts while a control task is running.

    Parameters

      - `base`: is the base address of the CLA controller.

      - `taskFlags`: is the bitwise OR of the tasks for which software interrupts are to be enabled, CLA_TASKFLAG_N where N is the task number from 1 to 8, or CLA_TASKFLAG_ALL to enable software interrupts of all tasks

    Note

      1. The CLA1SOFTINTEN and CLA1INTFRC are only writable from the CLA.

      2. Enabling a given task’s software interrupt enable bit disables that task’s ability to generate an End-of-Task interrupt to the main CPU, however, should another task force its interrupt (through the CLA1INTFRC register), it will be handled by that task’s End-of-Task Interrupt Handler.

    Return

      None.

  void `CLA_disableSoftwareInterrupt`(uint32_t base, uint16_t taskFlags)

    Disable the Software Interrupt for a given CLA Task

    This function disables the Software Interrupt for a single, or set of, CLA task(s). It does this by writing a 0 to the task’s bit in the CLA1SOFTINTEN register.

    Parameters

      - `base`: is the base address of the CLA controller.

      - `taskFlags`: is the bitwise OR of the tasks for which software interrupts are to be disabled, CLA_TASKFLAG_N where N is the task number from 1 to 8, or CLA_TASKFLAG_ALL to disable software interrupts of all tasks

    Note

      1. The CLA1SOFTINTEN and CLA1INTFRC are only writable from the CLA.

      2. Disabling a given task’s software interrupt ability allows that task to generate an End-of-Task interrupt to the main CPU.

    Return

      None.

  void `CLA_forceSoftwareInterrupt`(uint32_t base, uint16_t taskFlags)

    Force a particular Task’s Software Interrupt

    This function forces the Software Interrupt for a single, or set of, CLA task(s). It does this by writing a 1 to the task’s bit in the CLA1INTFRC register. For example, if we enable Task 2’s SOFTINT bit, we disable its ability to generate an end-of-task interrupt, but now any running CLA task has the ability to force task 2’s interrupt (through the CLA1INTFRC register) to the main CPU. This interrupt will be handled by the End-of-Task 2 interrupt handler even though the interrupt was not caused by Task 2 running to completion. This allows programmers to generate interrupts while a control task is running.

    Parameters

      - `base`: is the base address of the CLA controller.

      - `taskFlags`: is the bitwise OR of the task’s whose software interrupts are to be forced, CLA_TASKFLAG_N where N is the task number from 1 to 8, or CLA_TASKFLAG_ALL to force software interrupts for all tasks

    Note

      1. The CLA1SOFTINTEN and CLA1INTFRC are only writable from the CLA.

      2. Enabling a given task’s software interrupt enable bit disables that task’s ability to generate an End-of-Task interrupt to the main CPU, however, should another task force its interrupt (through the CLA1INTFRC register), it will be handled by that task’s End-of-Task Interrupt Handler.

      3. This function will set the INTFRC bit for a task, but does not check that its SOFTINT bit is set. It falls to the user to ensure that software interrupt for a given task is enabled before it can be forced.

    Return

      None.

  void `CLA_setTriggerSource`(CLA_TaskNumber taskNumber, CLA_Trigger trigger)

    Configures CLA task triggers.

    This function configures the trigger source of a CLA task. The

    taskNumber parameter indicates which task is being configured, and the trigger parameter is the interrupt source from a specific peripheral interrupt (or software) that will trigger the task.
    Parameters

      - `taskNumber`: is the number of the task CLA_TASK_N where N is a number from 1 to 8.

      - `trigger`: is the trigger source to be assigned to the selected task.

    Return

      None.

The next few paragraphs describe configuration options that are accessible via the main processor (the C28x).

The CLA code is broken up into a main background task and a set of 7 tasks, each of which requires a trigger source either from a hardware peripheral or software. Each task begins at an address that is given by its vector register. The vector for the background task can be configured using the CLA_mapBackgroundTaskVector(), and the task’s vector is set using CLA_mapTaskVector(). The trigger source for all the tasks can be set with CLA_setTriggerSource(). If using a software trigger, the user must first enable the feature with CLA_enableIACK(), and then trigger the task with the assembly instruction,

> align

>   center

__asm(” IACK #<Task>”); Task refers to the task to trigger; it is one less than the actual task. For example, if attempting to trigger task 1 you would issue,

> align

>   center

__asm(” IACK #0”);

A task will only start to execute if it is globally enabled. This is done through CLA_enableTasks(). Once enabled, a task will respond to a peripheral trigger (if configured to do so), a software force (with the IACK instruction), or through CLA_forceTasks().

In this type of CLA, a background task is always running. It is enabled using CLA_enableBackgroundTask() and subsequently kicked off by CLA_startBackgroundTask(), or through a peripheral trigger (it takes the same trigger as task 8 on older CLAs). The user may enable the background task peripheral trigger feature using CLA_enableHardwareTrigger().

The tasks (1 to 7) have a fixed priority, with 1 being the highest and 7 the lowest. They will interrupt the background task, when triggered, in priority order. The user may query the status of all tasks with CLA_getAllTaskRunStatus() or a particular task with CLA_getTaskRunStatus() to determine if its pending, running or idle.

Each task (1 through 7) can issue an interrupt to the main CPU after it completes execution. This is configured through the PIE module, and registering the handler (ISR) for each end-of-task interrupt with CLA_registerEndOfTaskInterrupt().

The CLA can undergo a soft reset with CLA_performSoftReset() or emulate a power cycle or hard reset with CLA_performHardReset().

The CLA can access and configure a few configuration registers (the C28x can read but not alter these registers). A task can force another’s end-of-task interrupt to the main CPU by enabling that task’s software interrupt using CLA_enableSoftwareInterrupt() and subsequently forcing it using CLA_forceSoftwareInterrupt(). Its important to keep in mind that enabling a software interrupt for a given task disables its ability to generate an interrupt to the main CPU once it completes execution.

The code for this module is contained in driverlib/cla.c, with driverlib/cla.h containing the API declarations for use by applications.