Re: [PATCH 0/2] Multidrop support for serial ports

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Tue, Apr 11, 2017 at 10:12:32PM +0200, Rodolfo Giometti wrote:
> Multidrop mode differentiates the data characters and the address
> characters. Data is transmitted with the parity bit to 0 and addresses
> are transmitted with the parity bit to 1.
> 
> Usually multidrop is implemented by forcing MARK and SPARE parity as follow:
>         /* Write data */
> 
>         /* Address byte */
>         term.c_cflag |= PARENB | CMSPAR | PARODD;       /* MARK(1) */
>         ret = tcsetattr(fd, TCSADRAIN, &term);
>         if (ret < 0) {
>                 perror("unable to set MARK");
>                 exit(-1);
>         }
>         buf[0] = 0x00;
>         ret = writen(fd, buf, 1);
>         if (ret < 0) {
>                 perror("unable to write address (%m)");
>                 exit(-1);
>         }
> 
>         /* Data bytes */
>         term.c_cflag |= PARENB | CMSPAR;                /* SPACE(0) */
>         term.c_cflag &= ~PARODD;
>         ret = tcsetattr(fd, TCSADRAIN, &term);
>         if (ret < 0) {
>                 perror("unable to set SPACE");
>                 exit(-1);
>         }
>         buf[0] = 0x1c;
>         buf[1] = 0x01;
>         buf[2] = 0x01;
>         buf[3] = 0x00;
>         buf[4] = 0x01;
>         buf[5] = 0xde;
>         buf[6] = 0xd4;
>         ret = writen(fd, buf, 7);
>         if (ret < 0) {
>                 perror("unable to write data (%m)");
>                 exit(-1);
>         }
> 
> However this usually slow down communication by adding a delay between
> the first byte and the others.
> 
> The first attached patch defines two non-stadard bits PARMD (that
> enables multidrop) and SENDA (that marks the next transmitted byte as
> address) that can be used to completely remove the delay by correctly
> managing the parity bit generation in hardware (the second patch is
> for SAMA5D3 CPU). Then the userland code becomes:
> 
>         /* Transmission: enable parity multidrop and mark 1st byte as address */
>         term.c_cflag |= PARENB | CMSPAR | PARMD | SENDA;
>         ret = tcsetattr(fd, TCSADRAIN, &term);
>         if (ret < 0) {
>                 perror("unable to set MARK");
>                 exit(-1);
>         }
> 
>         /* Write data */
>         n = 0;
>         buf[n++] = 0x00;
>         buf[n++] = 0x1c;
>         buf[n++] = 0x01;
>         buf[n++] = 0x01;
>         buf[n++] = 0x00;
>         buf[n++] = 0x01;
>         buf[n++] = 0xde;
>         buf[n++] = 0xd4;
>         ret = writen(fd, buf, n);
>         if (ret < 0) {
>                 perror("unable to write data (%m)");
>                 exit(-1);
>         }
> 
> Rodolfo

Why isn't this info in the changelog text itself?

And this is 'v2', right?  Please always properly say that, remember,
maintainers and reviewers have the short-term memory of a squirrel...

thanks,

greg k-h
--
To unsubscribe from this list: send the line "unsubscribe linux-serial" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html



[Index of Archives]     [Kernel Newbies]     [Security]     [Netfilter]     [Bugtraq]     [Linux PPP]     [Linux FS]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Samba]     [Video 4 Linux]     [Linmodem]     [Device Mapper]     [Linux Kernel for ARM]

  Powered by Linux