00001 #ifndef _DEV_UART_H
00002 #define _DEV_UART_H
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024
00025
00026
00027
00028
00029
00030
00031
00032
00033
00034
00035
00036
00037
00038
00039
00040
00041
00042
00043
00044
00045
00046
00047
00048
00049
00050
00051
00052
00053
00054
00055
00056
00057
00058
00059
00060
00061
00062
00063
00064
00065
00066
00067
00068
00069
00070
00071
00072
00073
00074
00075
00076
00077 #include <sys/device.h>
00078
00100
00106 #define UART_SETSPEED 0x0101
00107
00113 #define UART_GETSPEED 0x0102
00114
00120 #define UART_SETDATABITS 0x0103
00121
00127 #define UART_GETDATABITS 0x0104
00128
00134 #define UART_SETPARITY 0x0105
00135
00141 #define UART_GETPARITY 0x0106
00142
00147 #define UART_SETSTOPBITS 0x0107
00148
00153 #define UART_GETSTOPBITS 0x0108
00154
00159 #define UART_SETSTATUS 0x0109
00160
00165 #define UART_GETSTATUS 0x010a
00166
00172 #define UART_SETREADTIMEOUT 0x010b
00173
00179 #define UART_GETREADTIMEOUT 0x010c
00180
00186 #define UART_SETWRITETIMEOUT 0x010d
00187
00193 #define UART_GETWRITETIMEOUT 0x010e
00194
00200 #define UART_SETLOCALECHO 0x010f
00201
00207 #define UART_GETLOCALECHO 0x0110
00208
00213 #define UART_SETFLOWCONTROL 0x0111
00214
00219 #define UART_GETFLOWCONTROL 0x0112
00220
00226 #define UART_SETCOOKEDMODE 0x0113
00227
00233 #define UART_GETCOOKEDMODE 0x0114
00234
00239 #define UART_SETBUFFERMODE 0x0115
00240
00245 #define UART_GETBUFFERMODE 0x0116
00246
00251 #define HDLC_SETIFNET 0x0117
00252
00257 #define HDLC_GETIFNET 0x0118
00258
00263 #define UART_SETCLOCKMODE 0x0119
00264
00269 #define UART_GETCLOCKMODE 0x011a
00270
00275 #define UART_SETTXBUFSIZ 0x011b
00276
00281 #define UART_GETTXBUFSIZ 0x011c
00282
00287 #define UART_SETRXBUFSIZ 0x011d
00288
00293 #define UART_GETRXBUFSIZ 0x011e
00294
00299 #define UART_SETTXBUFLWMARK 0x0120
00300
00305 #define UART_GETTXBUFLWMARK 0x0121
00306
00311 #define UART_SETTXBUFHWMARK 0x0122
00312
00317 #define UART_GETTXBUFHWMARK 0x0123
00318
00323 #define UART_SETRXBUFLWMARK 0x0124
00324
00329 #define UART_GETRXBUFLWMARK 0x0125
00330
00335 #define UART_SETRXBUFHWMARK 0x0126
00336
00341 #define UART_GETRXBUFHWMARK 0x0127
00342
00347 #define UART_SETBLOCKREAD 0x0128
00348
00353 #define UART_GETBLOCKREAD 0x0129
00354
00361 #define UART_SETRAWMODE 0x012a
00362
00367 #define UART_GETRAWMODE 0x012b
00368
00377
00382 #define UART_FRAMINGERROR 0x00000001UL
00383
00388 #define UART_OVERRUNERROR 0x00000002UL
00389
00394 #define UART_PARITYERROR 0x00000004UL
00395
00400 #define UART_ERRORS (UART_FRAMINGERROR | UART_OVERRUNERROR | UART_PARITYERROR)
00401
00404 #define UART_RXBUFFEREMPTY 0x00000040UL
00405
00411 #define UART_TXBUFFEREMPTY 0x00000080UL
00412
00415 #define UART_RTSENABLED 0x00000100UL
00416
00419 #define UART_RTSDISABLED 0x00000200UL
00420
00423 #define UART_CTSENABLED 0x00000400UL
00424
00427 #define UART_CTSDISABLED 0x00000800UL
00428
00431 #define UART_DTRENABLED 0x00001000UL
00432
00435 #define UART_DTRDISABLED 0x00002000UL
00436
00439 #define UART_RXENABLED 0x00010000UL
00440
00443 #define UART_RXDISABLED 0x00020000UL
00444
00447 #define UART_TXENABLED 0x00040000UL
00448
00451 #define UART_TXDISABLED 0x00080000UL
00452
00458 #define UART_RXADDRFRAME 0x00100000UL
00459
00464 #define UART_RXNORMFRAME 0x00200000UL
00465
00471 #define UART_TXADDRFRAME 0x00400000UL
00472
00477 #define UART_TXNORMFRAME 0x00800000UL
00478
00479
00490
00495 #define UART_HS_RTSCTS 0x0003
00496
00501 #define UART_HS_MODEM 0x001F
00502
00510 #define UART_HS_SOFT 0x0020
00511
00528
00529 #define UART_SYNC 0x01
00530 #define UART_MASTER 0x02
00531 #define UART_NCLOCK 0x04
00532 #define UART_HIGHSPEED 0x20
00533
00536 #define UART_ASYNC 0x00
00537
00543 #define UART_SYNCSLAVE UART_SYNC
00544
00550 #define UART_SYNCMASTER (UART_SYNC | UART_MASTER)
00551
00557 #define UART_NSYNCSLAVE (UART_SYNC | UART_NCLOCK)
00558
00564 #define UART_NSYNCMASTER (UART_SYNC | UART_NCLOCK | UART_MASTER)
00565
00570 #define UART_ASYNC_HS UART_HIGHSPEED
00571
00575
00576 __BEGIN_DECLS
00577
00578
00579
00580
00581
00582
00583
00584
00585 extern int UartAvrInit(NUTDEVICE * dev);
00586 extern int UartAvrIOCtl(NUTDEVICE * dev, int req, void *conf);
00587 extern int UartAvrInput(NUTDEVICE * dev);
00588 extern int UartAvrOutput(NUTDEVICE * dev);
00589 extern int UartAvrFlush(NUTDEVICE * dev);
00590
00591 extern int UartAvrGetRaw(u_char * cp);
00592 extern int UartAvrPutRaw(u_char ch);
00593
00594 extern int UartAvrRead(NUTFILE * fp, void *buffer, int size);
00595 extern int UartAvrWrite(NUTFILE * fp, CONST void *buffer, int len);
00596 #ifdef __HARVARD_ARCH__
00597 extern int UartAvrWrite_P(NUTFILE * fp, PGM_P buffer, int len);
00598 #endif
00599 extern NUTFILE *UartAvrOpen(NUTDEVICE * dev, CONST char *name, int mode, int acc);
00600 extern long UartAvrSize(NUTFILE * fp);
00601 extern int UartAvrClose(NUTFILE * fp);
00602
00603 __END_DECLS
00604 #endif