I have compile your source code but there are a lot of errors. I do not know what is the problem, probably you work with a different library, or I need add some library to my project. I work with MCUXpresso and SDK source examples to start this project.
These are the errors when I try to compile your source code:
../source/pit.c:423:5: error: unknown type name 'INTERRUPT_SETUP'
INTERRUPT_SETUP interrupt_setup; // interrupt configuration parameters
^~~~~~~~~~~~~~~
../source/pit.c:424:20: error: request for member 'int_type' in something not a structure or union
interrupt_setup.int_type = PORT_INTERRUPT; // identifier to configure port interrupt
^
../source/pit.c:424:32: error: 'PORT_INTERRUPT' undeclared (first use in this function); did you mean 'PORT_DFER_DFE'?
interrupt_setup.int_type = PORT_INTERRUPT; // identifier to configure port interrupt
^~~~~~~~~~~~~~
PORT_DFER_DFE
../source/pit.c:424:32: note: each undeclared identifier is reported only once for each function it appears in
../source/pit.c:425:20: error: request for member 'int_port' in something not a structure or union
interrupt_setup.int_port = PORTB; // the port that the interrupt input is on
^
../source/pit.c:427:20: error: request for member 'int_port_bits' in something not a structure or union
interrupt_setup.int_port_bits = PORTB_BIT16; // UART input pin on FRDM-K64F
^
../source/pit.c:427:37: error: 'PORTB_BIT16' undeclared (first use in this function); did you mean 'PORTB_IRQn'?
interrupt_setup.int_port_bits = PORTB_BIT16; // UART input pin on FRDM-K64F
^~~~~~~~~~~
PORTB_IRQn
../source/pit.c:429:20: error: request for member 'int_port_bits' in something not a structure or union
interrupt_setup.int_port_bits = (PORTB_BIT16 | PORTB_BIT17 | PORTB_BIT18 | PORTB_BIT19 | PORTB_BIT20);
^
../source/pit.c:429:52: error: 'PORTB_BIT17' undeclared (first use in this function); did you mean 'PORTB_BIT16'?
interrupt_setup.int_port_bits = (PORTB_BIT16 | PORTB_BIT17 | PORTB_BIT18 | PORTB_BIT19 | PORTB_BIT20);
^~~~~~~~~~~
PORTB_BIT16
../source/pit.c:429:66: error: 'PORTB_BIT18' undeclared (first use in this function); did you mean 'PORTB_BIT17'?
interrupt_setup.int_port_bits = (PORTB_BIT16 | PORTB_BIT17 | PORTB_BIT18 | PORTB_BIT19 | PORTB_BIT20);
^~~~~~~~~~~
PORTB_BIT17
../source/pit.c:429:80: error: 'PORTB_BIT19' undeclared (first use in this function); did you mean 'PORTB_BIT18'?
interrupt_setup.int_port_bits = (PORTB_BIT16 | PORTB_BIT17 | PORTB_BIT18 | PORTB_BIT19 | PORTB_BIT20);
^~~~~~~~~~~
PORTB_BIT18
../source/pit.c:429:94: error: 'PORTB_BIT20' undeclared (first use in this function); did you mean 'PORTB_BIT19'?
interrupt_setup.int_port_bits = (PORTB_BIT16 | PORTB_BIT17 | PORTB_BIT18 | PORTB_BIT19 | PORTB_BIT20);
^~~~~~~~~~~
PORTB_BIT19
../source/pit.c:431:20: error: request for member 'int_port_sense' in something not a structure or union
interrupt_setup.int_port_sense = (IRQ_FALLING_EDGE | PULLUP_ON | PORT_DMA_MODE); // DMA on falling edge
^
../source/pit.c:431:39: error: 'IRQ_FALLING_EDGE' undeclared (first use in this function)
interrupt_setup.int_port_sense = (IRQ_FALLING_EDGE | PULLUP_ON | PORT_DMA_MODE); // DMA on falling edge
^~~~~~~~~~~~~~~~
../source/pit.c:431:58: error: 'PULLUP_ON' undeclared (first use in this function)
interrupt_setup.int_port_sense = (IRQ_FALLING_EDGE | PULLUP_ON | PORT_DMA_MODE); // DMA on falling edge
^~~~~~~~~
../source/pit.c:431:70: error: 'PORT_DMA_MODE' undeclared (first use in this function); did you mean 'PORT_PCR_ODE'?
interrupt_setup.int_port_sense = (IRQ_FALLING_EDGE | PULLUP_ON | PORT_DMA_MODE); // DMA on falling edge
^~~~~~~~~~~~~
PORT_PCR_ODE
../source/pit.c:432:20: error: request for member 'int_handler' in something not a structure or union
interrupt_setup.int_handler = 0; // no interrupt handler when using DMA
^
../source/pit.c:433:5: warning: implicit declaration of function 'fnConfigureInterrupt' [-Wimplicit-function-declaration]
fnConfigureInterrupt((void *)&interrupt_setup); // configure interrupt
^~~~~~~~~~~~~~~~~~~~
../source/pit.c:436:5: warning: implicit declaration of function 'fnConfigDMA_buffer' [-Wimplicit-function-declaration]
fnConfigDMA_buffer(9, DMAMUX0_CHCFG_SOURCE_PORTB, sizeof(ulOutput), (void *)&(((GPIO_REGS *)GPIOC_ADD)->PDIR), (void *)&ulOutput, (DMA_DIRECTION_INPUT | DMA_LONG_WORDS), 0, 0); // use DMA channel 9 without any interrupts
^~~~~~~~~~~~~~~~~~
../source/pit.c:436:27: error: 'DMAMUX0_CHCFG_SOURCE_PORTB' undeclared (first use in this function); did you mean 'DMAMUX_CHCFG_SOURCE_SHIFT'?
fnConfigDMA_buffer(9, DMAMUX0_CHCFG_SOURCE_PORTB, sizeof(ulOutput), (void *)&(((GPIO_REGS *)GPIOC_ADD)->PDIR), (void *)&ulOutput, (DMA_DIRECTION_INPUT | DMA_LONG_WORDS), 0, 0); // use DMA channel 9 without any interrupts
^~~~~~~~~~~~~~~~~~~~~~~~~~
DMAMUX_CHCFG_SOURCE_SHIFT
../source/pit.c:436:85: error: 'GPIO_REGS' undeclared (first use in this function); did you mean 'GPIO_Type'?
fnConfigDMA_buffer(9, DMAMUX0_CHCFG_SOURCE_PORTB, sizeof(ulOutput), (void *)&(((GPIO_REGS *)GPIOC_ADD)->PDIR), (void *)&ulOutput, (DMA_DIRECTION_INPUT | DMA_LONG_WORDS), 0, 0); // use DMA channel 9 without any interrupts
^~~~~~~~~
GPIO_Type
../source/pit.c:436:96: error: expected expression before ')' token
fnConfigDMA_buffer(9, DMAMUX0_CHCFG_SOURCE_PORTB, sizeof(ulOutput), (void *)&(((GPIO_REGS *)GPIOC_ADD)->PDIR), (void *)&ulOutput, (DMA_DIRECTION_INPUT | DMA_LONG_WORDS), 0, 0); // use DMA channel 9 without any interrupts
^
../source/pit.c:436:136: error: 'DMA_DIRECTION_INPUT' undeclared (first use in this function)
fnConfigDMA_buffer(9, DMAMUX0_CHCFG_SOURCE_PORTB, sizeof(ulOutput), (void *)&(((GPIO_REGS *)GPIOC_ADD)->PDIR), (void *)&ulOutput, (DMA_DIRECTION_INPUT | DMA_LONG_WORDS), 0, 0); // use DMA channel 9 without any interrupts
^~~~~~~~~~~~~~~~~~~
../source/pit.c:436:158: error: 'DMA_LONG_WORDS' undeclared (first use in this function); did you mean 'DMA_CHN_IRQS'?
fnConfigDMA_buffer(9, DMAMUX0_CHCFG_SOURCE_PORTB, sizeof(ulOutput), (void *)&(((GPIO_REGS *)GPIOC_ADD)->PDIR), (void *)&ulOutput, (DMA_DIRECTION_INPUT | DMA_LONG_WORDS), 0, 0); // use DMA channel 9 without any interrupts
^~~~~~~~~~~~~~
DMA_CHN_IRQS
../source/pit.c:437:5: warning: implicit declaration of function 'fnDMA_BufferReset' [-Wimplicit-function-declaration]
fnDMA_BufferReset(9, DMA_BUFFER_START);
^~~~~~~~~~~~~~~~~
../source/pit.c:437:26: error: 'DMA_BUFFER_START' undeclared (first use in this function); did you mean 'DMA_CSR_START'?
fnDMA_BufferReset(9, DMA_BUFFER_START);
^~~~~~~~~~~~~~~~
DMA_CSR_START
../source/pit.c: In function 'main':
../source/pit.c:860:18: warning: unused variable 'pitConfig' [-Wunused-variable]
pit_config_t pitConfig;
^~~~~~~~~
At top level:
../source/pit.c:418:13: warning: 'fnSampleBus' defined but not used [-Wunused-function]
static void fnSampleBus(void)