#ifndef __SPORT_ELCORE_HEADER #define __SPORT_ELCORE_HEADER typedef struct { union { struct { unsigned int ten:1; /* разрешение передачи */ unsigned int reserv1:2; unsigned int tendn:1; /* порядок передаваемых бит */ unsigned int tlen:5; /* длина слова */ unsigned int tpack:1; /* распаковывать слово */ unsigned int ticlk:1; /* внутренняя частота передачи на TCLK */ unsigned int reserv2:1; unsigned int tckre:1; /* выбор фронта частоты */ unsigned int tfsr:1; /* кадровая синхронизация */ unsigned int itfs:1; /* внутренняя кадровая синхронизация на TFS */ unsigned int ditfs:1; /* кадровый синхроимпульс вне зависимости от данных в STx */ unsigned int ltfs:1; /* выбор активного уровня импульса */ unsigned int tlafs:1; /* выбор режима кадровой синхронизации */ unsigned int reserv3:2; unsigned int mfd:1; /* выбор задержки передачи данных от импульса */ const unsigned int chnl:5; /* номер канала при многоканальной работе (RO) */ const unsigned int tuvf:1; /* признак не дозагрузки STx*/ const unsigned int txs:2; /* состояние STx */ } detail; unsigned int raw32; } transfer; union { struct { unsigned int ren:1; unsigned int reserv0:1; unsigned int dtype:1; unsigned int rendn:1; unsigned int rlen:5; unsigned int rpack:1; unsigned int riclk:1; unsigned int reserv1:1; unsigned int rckre:1; unsigned int rfsr:1; unsigned int irfs:1; unsigned int imode:1; unsigned int lrfs:1; unsigned int rlafs:1; unsigned int reserv2:2; unsigned int imat:1; unsigned int reserv3:1; unsigned int spl:1; unsigned int mce:1; unsigned int nch:5; const unsigned int rovf:1; const unsigned int rxs:2; } detail; unsigned int raw32; } receive; union { struct { unsigned int tclkdiv:16; /* пероид частотаы tclk */ unsigned int tfsdiv:16; /* период частоты кадрового синхроимпульса TFS */ } detail; unsigned int raw32; } tdiv; union { struct { unsigned int rclkdiv:16; /* пероид частотаы rclk */ unsigned int rfsdiv:16; /* период частоты кадрового синхроимпульса rFS */ } detail; unsigned int raw32; } rdiv; union { unsigned int raw32; } mtcs; union { unsigned int raw32; } mrcs; union { unsigned int raw32; } mrce; union { unsigned int raw32; } keywd; union { unsigned int raw32; } keymask; } TSportCtrl; typedef struct { unsigned int sport_no; int lock; TSportCtrl* ctrl; TRoundBuffer rec_buffer; } TSport; extern TSport* SportOpen(unsigned int sport_no, TSportCtrl* you_settings); extern void SportClose(TSport*); extern int SportRead(TSport*, unsigned int size, void* data); extern int SportWrite(TSport*, unsigned int size, void* data); /* макросы для RAW режима */ /* STCTL */ #define set_ten(p) (p) |= 0x1 #define clear_ten(p) (p) = ((p) & 0xFFFFFFFE) #define set_tendn(p) (p) |= 0x8 #define clear_tendn(p) (p) = ((p) & 0xFFFFFFF7) #define clear_tlen(p) (p) = ((p) & 0xFFFFFE07) #define set_tlen(p,v) clear_tlen(p); (p) |= (((v-1)&0x1f)<<4) #define set_tpack(p) (p) |= 0x0200 /* 9й бит в 1цу */ #define clear_tpack(p) (p) = ((p) & 0xFFFFFDFF) #define set_ticlk(p) (p) |= 0x0400 #define clear_ticlk(p) (p) = ((p) & 0xFFFFFBFF) #define set_tckre(p) (p) |= 0x1000 #define clear_tckre(p) (p) = ((p) & 0xFFFFEFFF) #define set_tfsr(p) (p) |= 0x2000 #define clear_tfsr(p) (p) = ((p) & 0xFFFFDFFF) #define set_itfs(p) (p) |= 0x4000 #define clear_itfs(p) (p) = ((p) & 0xFFFFBFFF) #define set_ditfs(p) (p) |= 0x8000 #define clear_ditfs(p) (p) = ((p) & 0xFFFF7FFF) #define set_ltfs(p) (p) |= 0x10000 #define clear_ltfs(p) (p) = ((p) & 0xFFFEFFFF) #define set_tlafs(p) (p) |= 0x20000 #define clear_tlafs(p) (p) = ((p) & 0xFFFDFFFF) #define clear_mfd(p) (p) = ((p) & 0xFF0FFFFF) #define set_mfd(p,v) clear_mfd(p); (p) |= (((v-1)&0xF)<<20) #define get_chnl(p) (((p) & 0x1F000000)>>24) #define get_tuvf(p) (((p) & 0x20000000)>>29) #define get_txs(p) (((p) & 0x60000000)>>30) /* макросы работы с SRCTL */ #define set_ren(p) (p) |= 0x1 #define clear_ren(p) (p) = ((p) & 0xFFFFFFFE) #define set_dtype(p) (p) |= 0x4 #define clear_dtype(p) (p) = ((p) & 0xFFFFFFFB) #define set_rendn(p) (p) |= 0x8 #define clear_rendn(p) (p) = ((p) & 0xFFFFFFF7) #define clear_rlen(p) (p) = ((p) & 0xFFFFFE0F) #define set_rlen(p,v) clear_rlen(p); (p) |= (((v-1)&0x1f)<<4) #define set_rpack(p) (p) |= 0x0200 /* 9й бит в 1цу */ #define clear_rpack(p) (p) = ((p) & 0xFFFFFDFF) #define set_riclk(p) (p) |= 0x0400 #define clear_riclk(p) (p) = ((p) & 0xFFFFFBFF) #define set_rckre(p) (p) |= 0x1000 #define clear_rckre(p) (p) = ((p) & 0xFFFFEFFF) #define set_rfsr(p) (p) |= 0x2000 #define clear_rfsr(p) (p) = ((p) & 0xFFFFDFFF) #define set_irfs(p) (p) |= 0x4000 #define clear_irfs(p) (p) = ((p) & 0xFFFFBFFF) #define set_imode(p) (p) |= 0x8000 #define clear_imode(p) (p) = ((p) & 0xFFFF7FFF) #define set_lrfs(p) (p) |= 0x10000 #define clear_lrfs(p) (p) = ((p) & 0xFFFEFFFF) #define set_rlafs(p) (p) |= 0x20000 #define clear_rlafs(p) (p) = ((p) & 0xFFFDFFFF) #define set_imat(p) (p) |= 0x100000 #define clear_imat(p) (p) = ((p) & 0xFFEFFFFF) #define set_spl(p) (p) |= 0x400000 #define clear_spl(p) (p) = ((p) & 0xFFBFFFFF) #define set_mce(p) (p) |= 0x800000 #define clear_mce(p) (p) = ((p) & 0xFF7FFFFF) #define clear_nch(p) (p) = ((p) & 0xE0FFFFFF) #define set_nch(p,v) clear_nch(p); (p) |= (((v-1)&0x1f)<<24) #define get_rovf(p) (((p) & 0x20000000)>>29) #define get_rxs(p) (((p) & 0x60000000)>>30) #endif /* __SPORT_ELCORE_HEADER */