Hi Mark,
Hope you are keeping well..
I call the below to open a Uart and pulse input channels. If I want to call the routine again, do I have to close any handles first? If so how is this done?
Best Regards
Neil
--------------------------
TTYTABLE tGSMInterfaceParameters; // table for passing information to driver
QUEUE_HANDLE fnSetGSMSerialMode(unsigned char ucDriverMode)//
{
GPTIMER_SETUP gptimer_setup; // interrupt configuration parameters
tGSMInterfaceParameters.Channel = 1; // set UART channel for serial use
tGSMInterfaceParameters.ucSpeed = SERIAL_BAUD_115200; // baud rate
tGSMInterfaceParameters.Rx_tx_sizes.RxQueueSize = 400; // input buffer size
tGSMInterfaceParameters.Rx_tx_sizes.TxQueueSize = 800; // output buffer size
// tGSMInterfaceParameters.Rx_tx_sizes.TxQueueSize = 3000; // output buffer size Large size as may be used with diagnostics
tGSMInterfaceParameters.Task_to_wake = TASK_GSM; // wake self when messages have been received
tGSMInterfaceParameters.Config = (CHAR_8 | NO_PARITY | ONE_STOP | CHAR_MODE | RTS_CTS | INFORM_ON_FRAME_TRANSMISSION);
// tGSMInterfaceParameters.ucDMAConfig = 0; // NO DMA for UART1
gptimer_setup.int_type = GPT_TIMER_INTERRUPT;
gptimer_setup.int_handler = DCDPulse_int;
gptimer_setup.channel = 1; // general purpose timer channel 1
gptimer_setup.int_priority = GPTIMER0_INTERRUPT_PRIORITY; // define interrupt priority
gptimer_setup.mode = GPT_CAPTURE_RISING_EDGE; // set up capture mode and define the timer clock
gptimer_setup.usCaptureCount = 0; // request this many capture values to be recorded before calling our interrupt
gptimer_setup.capture_list = 0; // the capture list for saving to
fnConfigureInterrupt((void *)&gptimer_setup); // enter interrupt for DMA timer test
if ((GSMPortID = fnOpen( TYPE_TTY, ucDriverMode, &tGSMInterfaceParameters )) != 0)
{ // open or change the channel with defined configurations (initially inactive)
fnDriver( GSMPortID, ( TX_ON | RX_ON ), 0 ); // enable rx and tx
if (tGSMInterfaceParameters.Config & RTS_CTS) { //
fnDriver( GSMPortID, (MODIFY_INTERRUPT | ENABLE_CTS_CHANGE), 0 ); // activate CTS interrupt when working with HW flow control (this returns also the present control line states)
fnDriver( GSMPortID, (MODIFY_CONTROL | SET_RTS), 0 ); // activate RTS line when working with HW flow control
}
}
return GSMPortID;
}