Or more detailed:
1. Configure pin PA19 to be an output and connect it to the peripheral (PWM in this case) as opposed to the GPIO block.
Although this code looks incorrect:
PORT->Group[0].DIRSET.reg=PORT_PA19;
PORT->Group[0].PINCFG[PORT_PA19].reg |= PORT_PINCFG_PMUXEN;
PORT->Group[0].PMUX[PORT_PA19].bit.PMUXO = 4;
I don't know what PORT_PA19 unrolls in ASF, but I assume it is (1 << 19). In this case it should read
PORT->Group[0].DIRSET.reg=PORT_PA19;
PORT->Group[0].PINCFG[19].reg |= PORT_PINCFG_PMUXEN;
PORT->Group[0].PMUX[19 / 2].bit.PMUXO = 4;
Or, if you were to use my macros:
HAL_GPIO_PIN(PWM_OUT, A, 19) // Define a pin
HAL_GPIO_PWM_OUT_out(); // This is actually not necessary if you use XXX_pmuxen(), but I do it anyway for documentation purposes.
HAL_GPIO_PWM_OUT_pmuxen(PORT_PMUX_PMUXE_D_Val);
2.
PM->APBCMASK.reg |= PM_APBCMASK_TC3;
Enable clock to the TC3.
3.
GCLK->CLKCTRL.reg = GCLK_CLKCTRL_ID(27/*TC3_GCLK_ID*/) |
GCLK_CLKCTRL_CLKEN | GCLK_CLKCTRL_GEN(0);
Configure TC3 to be clocked from generator 0.
4. Setup TC3 according to the requirements. The code is pretty self explanatory.