The TermiosStruct struct defines the ioctl transfer structure used by the /dev/ttyAMA* version of the SerialPorts on the Raspberry Pi 2.
[StructLayout(LayoutKind.Explicit)]
public struct TermiosStruct
{
[MarshalAs(UnmanagedType.U4)]
[FieldOffset(0)]
public UInt32 c_iflag; // input mode flags
[MarshalAs(UnmanagedType.U4)]
[FieldOffset(4)]
public UInt32 c_oflag; // output mode flags
[MarshalAs(UnmanagedType.U4)]
[FieldOffset(8)]
public UInt32 c_cflag; // control mode flags
[MarshalAs(UnmanagedType.U4)]
[FieldOffset(12)]
public UInt32 c_lflag; // local mode flags
[MarshalAs(UnmanagedType.U4)]
[FieldOffset(16)]
public UInt32 c_line; // line discipline
[MarshalAsAttribute(UnmanagedType.ByValTStr, SizeConst = 32)]
[FieldOffset(20)]
public string c_cc;
[MarshalAs(UnmanagedType.U4)]
[FieldOffset(52)]
public UInt32 c_ispeed; // input speed
[MarshalAs(UnmanagedType.U4)]
[FieldOffset(56)]
public UInt32 c_ospeed; // output speed
}