~ [ source navigation ] ~ [ diff markup ] ~ [ identifier search ] ~

TOMOYO Linux Cross Reference
Linux/Documentation/driver-api/serial/serial-iso7816.rst

Version: ~ [ linux-6.12-rc7 ] ~ [ linux-6.11.7 ] ~ [ linux-6.10.14 ] ~ [ linux-6.9.12 ] ~ [ linux-6.8.12 ] ~ [ linux-6.7.12 ] ~ [ linux-6.6.60 ] ~ [ linux-6.5.13 ] ~ [ linux-6.4.16 ] ~ [ linux-6.3.13 ] ~ [ linux-6.2.16 ] ~ [ linux-6.1.116 ] ~ [ linux-6.0.19 ] ~ [ linux-5.19.17 ] ~ [ linux-5.18.19 ] ~ [ linux-5.17.15 ] ~ [ linux-5.16.20 ] ~ [ linux-5.15.171 ] ~ [ linux-5.14.21 ] ~ [ linux-5.13.19 ] ~ [ linux-5.12.19 ] ~ [ linux-5.11.22 ] ~ [ linux-5.10.229 ] ~ [ linux-5.9.16 ] ~ [ linux-5.8.18 ] ~ [ linux-5.7.19 ] ~ [ linux-5.6.19 ] ~ [ linux-5.5.19 ] ~ [ linux-5.4.285 ] ~ [ linux-5.3.18 ] ~ [ linux-5.2.21 ] ~ [ linux-5.1.21 ] ~ [ linux-5.0.21 ] ~ [ linux-4.20.17 ] ~ [ linux-4.19.323 ] ~ [ linux-4.18.20 ] ~ [ linux-4.17.19 ] ~ [ linux-4.16.18 ] ~ [ linux-4.15.18 ] ~ [ linux-4.14.336 ] ~ [ linux-4.13.16 ] ~ [ linux-4.12.14 ] ~ [ linux-4.11.12 ] ~ [ linux-4.10.17 ] ~ [ linux-4.9.337 ] ~ [ linux-4.4.302 ] ~ [ linux-3.10.108 ] ~ [ linux-2.6.32.71 ] ~ [ linux-2.6.0 ] ~ [ linux-2.4.37.11 ] ~ [ unix-v6-master ] ~ [ ccs-tools-1.8.12 ] ~ [ policy-sample ] ~
Architecture: ~ [ i386 ] ~ [ alpha ] ~ [ m68k ] ~ [ mips ] ~ [ ppc ] ~ [ sparc ] ~ [ sparc64 ] ~

Diff markup

Differences between /Documentation/driver-api/serial/serial-iso7816.rst (Version linux-6.12-rc7) and /Documentation/driver-api/serial/serial-iso7816.rst (Version linux-3.10.108)


  1 =============================                     
  2 ISO7816 Serial Communications                     
  3 =============================                     
  4                                                   
  5 1. Introduction                                   
  6 ===============                                   
  7                                                   
  8   ISO/IEC7816 is a series of standards specify    
  9   also known as smart cards.                      
 10                                                   
 11 2. Hardware-related considerations                
 12 ==================================                
 13                                                   
 14   Some CPUs/UARTs (e.g., Microchip AT91) conta    
 15   handling communication with a smart card.       
 16                                                   
 17   For these microcontrollers, the Linux driver    
 18   working in both modes, and proper ioctls (se    
 19   available at user-level to allow switching f    
 20   vice versa.                                     
 21                                                   
 22 3. Data Structures Already Available in the Ke    
 23 ==============================================    
 24                                                   
 25   The Linux kernel provides the serial_iso7816    
 26   ISO7816 communications. This data structure     
 27   ISO7816 parameters in ioctls.                   
 28                                                   
 29   Any driver for devices capable of working bo    
 30   implement the iso7816_config callback in the    
 31   serial_core calls iso7816_config to do the d    
 32   to TIOCGISO7816 and TIOCSISO7816 ioctls (see    
 33   callback receives a pointer to struct serial    
 34                                                   
 35 4. Usage from user-level                          
 36 ========================                          
 37                                                   
 38   From user-level, ISO7816 configuration can b    
 39   ioctls. For instance, to set ISO7816 you can    
 40                                                   
 41         #include <linux/serial.h>                 
 42                                                   
 43         /* Include definition for ISO7816 ioct    
 44         #include <sys/ioctl.h>                    
 45                                                   
 46         /* Open your specific device (e.g., /d    
 47         int fd = open ("/dev/mydevice", O_RDWR    
 48         if (fd < 0) {                             
 49                 /* Error handling. See errno.     
 50         }                                         
 51                                                   
 52         struct serial_iso7816 iso7816conf;        
 53                                                   
 54         /* Reserved fields as to be zeroed */     
 55         memset(&iso7816conf, 0, sizeof(iso7816    
 56                                                   
 57         /* Enable ISO7816 mode: */                
 58         iso7816conf.flags |= SER_ISO7816_ENABL    
 59                                                   
 60         /* Select the protocol: */                
 61         /* T=0 */                                 
 62         iso7816conf.flags |= SER_ISO7816_T(0);    
 63         /* or T=1 */                              
 64         iso7816conf.flags |= SER_ISO7816_T(1);    
 65                                                   
 66         /* Set the guard time: */                 
 67         iso7816conf.tg = 2;                       
 68                                                   
 69         /* Set the clock frequency*/              
 70         iso7816conf.clk = 3571200;                
 71                                                   
 72         /* Set transmission factors: */           
 73         iso7816conf.sc_fi = 372;                  
 74         iso7816conf.sc_di = 1;                    
 75                                                   
 76         if (ioctl(fd_usart, TIOCSISO7816, &iso    
 77                 /* Error handling. See errno.     
 78         }                                         
 79                                                   
 80         /* Use read() and write() syscalls her    
 81                                                   
 82         /* Close the device when finished: */     
 83         if (close (fd) < 0) {                     
 84                 /* Error handling. See errno.     
 85         }                                         
 86                                                   
 87 5. References                                     
 88 =============                                     
 89                                                   
 90  [1]    include/uapi/linux/serial.h               
                                                      

~ [ source navigation ] ~ [ diff markup ] ~ [ identifier search ] ~

kernel.org | git.kernel.org | LWN.net | Project Home | SVN repository | Mail admin

Linux® is a registered trademark of Linus Torvalds in the United States and other countries.
TOMOYO® is a registered trademark of NTT DATA CORPORATION.

sflogo.php