Re: RTAI moxa cp114

Paolo Mantegazza <[email protected]> Thu, 28 Dec 2017 17:18:40 +0000
Newsgroups gmane.linux.real-time.rtai
Message-ID <HE1PR0601MB2458EE1D86FC30357D5047F590040@HE1PR0601MB2458.eurprd06.prod.outlook.com>
I've no experience with the item you report, but just to be curious: where does it fail in your code shown below?
Paolo
________________________________________
From: Rtai [[email protected]] on behalf of Cédric [[email protected]]
Sent: Thursday, December 28, 2017 11:59 AM
To: [email protected]
Subject: [Rtai] RTAI moxa cp114

Dear RTAI users,

I use moxa series CP-114 RTAI3.8 multiport cards. I'm trying to upgrade from version 3.8 to version 5.1 of RTAI.

With 3.8, I loaded the 16660A module (insmod ./rtai_16550A.ko io=0x3f8,0x2f8,0xcc00,0xcc08,0xcc10,0xcc18 irq=4,3,17,17,17,17 baud_base=115200,115200,921600,921600,921600,921600 start_index=0)

Here is my C program :

#define RTSER_FILE1        "rtser4"

static const struct rtser_config ser_config = {

    0xFFFF,                     /* config_mask */
    921600,                     /* baud_rate */
    RTSER_NO_PARITY,            /* parity */
    RTSER_8_BITS,               /* data_bits */
    RTSER_1_STOPB,              /* stop_bits */
    RTSER_NO_HAND,              /* handshake */
    RTSER_DEF_FIFO_DEPTH,       /* fifo_depth*/
    1000000000LL,                  /* rx_timeout */
    RTSER_DEF_TIMEOUT,          /* tx_timeout */
    1000000000LL,                  /* event_timeout */
    RTSER_RX_TIMESTAMP_HISTORY, /* timestamp_history */
    RTSER_EVENT_RXPEND          /* event mask */
};

int fd;
fd = rt_dev_open(RTSER_FILE1, 0);
    if(fd<0)
    {
        if(DEBUG_NET) rt_printk("RS485 : can't open %s (read)\n", RTSER_FILE1);
        return fd;
    }
    ret = rt_dev_ioctl(fd, RTSER_RTIOC_SET_CONFIG, &ser_config);
    return ret;

while(flag)
{
        rt_dev_ioctl(fd, RTSER_RTIOC_WAIT_EVENT, &rx_event );
        rt_dev_read(fd, &buffer_rx1, sizeof(buffer_rx1));
        rt_dev_write(fd, &buffer_tx1, sz);
}

rt_dev_close(fd);

Since the update, I saw that MOXA cards were detected automatically so this way of using them no longer works. Can you give me a complete code example to use the new module?

thank you very much

Best regards
_______________________________________________
Rtai mailing list
[email protected]
https://mail.rtai.org/cgi-bin/mailman/listinfo/rtai