#ifndef __LPORT_ELCORE_HEADER #define __LPORT_ELCORE_HEADER #include "elcore/elcore.h" #define READ_ONLY 1 #define WRITE_ONLY 2 typedef struct { union { struct { unsigned int len:1; /* разрешение работы */ unsigned int ltran:1; /* режим работы */ unsigned int lclk:1; /* упарвление частатой работы */ unsigned int lstat:2; /* состояние Rx,Tx */ unsigned int lrerr:1; /* ошибка приёма данных */ unsigned int ldw:1; /* разрядность шины данных*/ unsigned int srq_tx:1; unsigned int srq_rx:1; unsigned int reserv:23; } detail; unsigned int raw32; } lcsr; union { struct { unsigned int lclk:1; unsigned int lack:1; unsigned int ldat:8; unsigned int reserv:22; } detail; unsigned int raw32; } ldir; union { struct { unsigned int lclk:1; unsigned int lack:1; unsigned int ldat:8; unsigned int reserv:22; } detail; unsigned int raw32; } ldr; } TLportCtrl; typedef struct { volatile unsigned int *ltx; volatile unsigned int *lrx; volatile unsigned int *lcsr; volatile unsigned int *ldr; volatile unsigned int *ldir; } TLportRegs; typedef struct { unsigned int id; int lock; TLportCtrl* ctrl; TRoundBuffer rec_buffer; /* буфер на приём */ TRoundBuffer write_buffer; /* буфер на передачу */ TLportRegs regs; } TLport; extern TLport* LportOpen(unsigned int id, TLportCtrl* you_settings, unsigned int mode); extern void LportClose(TLport*); extern int LportRead(TLport*, unsigned int size, void* data); extern int LportWrite(TLport*, unsigned int size, void* data); #endif