00001
00002
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
00078
00079
00080
00081
00082
00083
00084
00085
00086
00087
00088
00089
00090
00091
00092
00093
00094
00095
00096
00097
00098
00099
00100
00101
00102
00103
00104
00105
00106
00107
00108
00109
00110
00111
00112
00113
00114
00115
00116
00117
00118
00119
00120
00121
00122
00123
00124
00125
00126
00127
00128
00129
00130
00131
00132 #include <cfg/arch/avr.h>
00133
00134 #include <sys/atom.h>
00135 #include <sys/event.h>
00136 #include <sys/timer.h>
00137 #include <sys/heap.h>
00138
00139 #include <dev/irqreg.h>
00140 #include <dev/vs1001k.h>
00141
00142 #include <sys/bankmem.h>
00143
00144 #include <stddef.h>
00145
00150
00151 #ifndef VS_SCK_BIT
00152
00158 #define VS_SCK_BIT 0
00159 #endif
00160
00161 #if !defined(VS_SCK_AVRPORT) || (VS_SCK_AVRPORT == AVRPORTB)
00162 #define VS_SCK_PORT PORTB
00163 #define VS_SCK_DDR DDRB
00164 #elif (VS_SCK_AVRPORT == AVRPORTD)
00165 #define VS_SCK_PORT PORTD
00166 #define VS_SCK_DDR DDRD
00167 #elif (VS_SCK_AVRPORT == AVRPORTE)
00168 #define VS_SCK_PORT PORTE
00169 #define VS_SCK_DDR DDRE
00170 #elif (VS_SCK_AVRPORT == AVRPORTF)
00171 #define VS_SCK_PORT PORTF
00172 #define VS_SCK_DDR DDRF
00173 #else
00174 #warning "Bad SCK port specification"
00175 #endif
00176
00177 #ifndef VS_SS_BIT
00178
00181 #define VS_SS_BIT 1
00182 #endif
00183
00184 #if !defined(VS_SS_AVRPORT) || (VS_SS_AVRPORT == AVRPORTB)
00185 #define VS_SS_PORT PORTB
00186 #define VS_SS_DDR DDRB
00187 #elif (VS_SS_AVRPORT == AVRPORTD)
00188 #define VS_SS_PORT PORTD
00189 #define VS_SS_DDR DDRD
00190 #elif (VS_SS_AVRPORT == AVRPORTE)
00191 #define VS_SS_PORT PORTE
00192 #define VS_SS_DDR DDRE
00193 #elif (VS_SS_AVRPORT == AVRPORTF)
00194 #define VS_SS_PORT PORTF
00195 #define VS_SS_DDR DDRF
00196 #else
00197 #warning "Bad SS port specification"
00198 #endif
00199
00200 #ifndef VS_SI_BIT
00201
00206 #define VS_SI_BIT 2
00207 #endif
00208
00209 #if !defined(VS_SI_AVRPORT) || (VS_SI_AVRPORT == AVRPORTB)
00210 #define VS_SI_PORT PORTB
00211 #define VS_SI_DDR DDRB
00212 #elif (VS_SI_AVRPORT == AVRPORTD)
00213 #define VS_SI_PORT PORTD
00214 #define VS_SI_DDR DDRD
00215 #elif (VS_SI_AVRPORT == AVRPORTE)
00216 #define VS_SI_PORT PORTE
00217 #define VS_SI_DDR DDRE
00218 #elif (VS_SI_AVRPORT == AVRPORTF)
00219 #define VS_SI_PORT PORTF
00220 #define VS_SI_DDR DDRF
00221 #else
00222 #warning "Bad SI port specification"
00223 #endif
00224
00225 #ifndef VS_SO_BIT
00226
00233 #define VS_SO_BIT 3
00234 #endif
00235
00236 #if !defined(VS_SO_AVRPORT) || (VS_SO_AVRPORT == AVRPORTB)
00237 #define VS_SO_PIN PINB
00238 #define VS_SO_DDR DDRB
00239 #elif (VS_SO_AVRPORT == AVRPORTD)
00240 #define VS_SO_PIN PIND
00241 #define VS_SO_DDR DDRD
00242 #elif (VS_SO_AVRPORT == AVRPORTE)
00243 #define VS_SO_PIN PINE
00244 #define VS_SO_DDR DDRE
00245 #elif (VS_SO_AVRPORT == AVRPORTF)
00246 #define VS_SO_PIN PINF
00247 #define VS_SO_DDR DDRF
00248 #else
00249 #warning "Bad SO port specification"
00250 #endif
00251
00252 #ifndef VS_XCS_BIT
00253
00260 #define VS_XCS_BIT 4
00261 #endif
00262
00263 #if !defined(VS_XCS_AVRPORT) || (VS_XCS_AVRPORT == AVRPORTB)
00264 #define VS_XCS_PORT PORTB
00265 #define VS_XCS_DDR DDRB
00266 #elif (VS_XCS_AVRPORT == AVRPORTD)
00267 #define VS_XCS_PORT PORTD
00268 #define VS_XCS_DDR DDRD
00269 #elif (VS_XCS_AVRPORT == AVRPORTE)
00270 #define VS_XCS_PORT PORTE
00271 #define VS_XCS_DDR DDRE
00272 #elif (VS_XCS_AVRPORT == AVRPORTF)
00273 #define VS_XCS_PORT PORTF
00274 #define VS_XCS_DDR DDRF
00275 #else
00276 #warning "Bad XCS port specification"
00277 #endif
00278
00279 #ifndef VS_BSYNC_BIT
00280
00286 #define VS_BSYNC_BIT 5
00287 #endif
00288
00289 #if !defined(VS_BSYNC_AVRPORT) || (VS_BSYNC_AVRPORT == AVRPORTB)
00290 #define VS_BSYNC_PORT PORTB
00291 #define VS_BSYNC_DDR DDRB
00292 #elif (VS_BSYNC_AVRPORT == AVRPORTD)
00293 #define VS_BSYNC_PORT PORTD
00294 #define VS_BSYNC_DDR DDRD
00295 #elif (VS_BSYNC_AVRPORT == AVRPORTE)
00296 #define VS_BSYNC_PORT PORTE
00297 #define VS_BSYNC_DDR DDRE
00298 #elif (VS_BSYNC_AVRPORT == AVRPORTF)
00299 #define VS_BSYNC_PORT PORTF
00300 #define VS_BSYNC_DDR DDRF
00301 #else
00302 #warning "Bad BSYNC port specification"
00303 #endif
00304
00305 #ifndef VS_RESET_BIT
00306
00309 #define VS_RESET_BIT 7
00310 #endif
00311
00312 #if !defined(VS_RESET_AVRPORT) || (VS_RESET_AVRPORT == AVRPORTB)
00313 #define VS_RESET_PORT PORTB
00314 #define VS_RESET_DDR DDRB
00315 #elif (VS_RESET_AVRPORT == AVRPORTD)
00316 #define VS_RESET_PORT PORTD
00317 #define VS_RESET_DDR DDRD
00318 #elif (VS_RESET_AVRPORT == AVRPORTE)
00319 #define VS_RESET_PORT PORTE
00320 #define VS_RESET_DDR DDRE
00321 #elif (VS_RESET_AVRPORT == AVRPORTF)
00322 #define VS_RESET_PORT PORTF
00323 #define VS_RESET_DDR DDRF
00324 #else
00325 #warning "Bad RESET port specification"
00326 #endif
00327
00328 #ifndef VS_SIGNAL_IRQ
00329
00332 #define VS_SIGNAL sig_INTERRUPT6
00333 #define VS_DREQ_BIT 6
00334 #define VS_DREQ_PORT PORTE
00335 #define VS_DREQ_PIN PINE
00336 #define VS_DREQ_DDR DDRE
00338 #elif (VS_SIGNAL_IRQ == INT0)
00339 #define VS_SIGNAL sig_INTERRUPT0
00340 #define VS_DREQ_BIT 0
00341 #define VS_DREQ_PORT PORTD
00342 #define VS_DREQ_PIN PIND
00343 #define VS_DREQ_DDR DDRD
00344
00345 #elif (VS_SIGNAL_IRQ == INT1)
00346 #define VS_SIGNAL sig_INTERRUPT1
00347 #define VS_DREQ_BIT 1
00348 #define VS_DREQ_PORT PORTD
00349 #define VS_DREQ_PIN PIND
00350 #define VS_DREQ_DDR DDRD
00351
00352 #elif (VS_SIGNAL_IRQ == INT2)
00353 #define VS_SIGNAL sig_INTERRUPT2
00354 #define VS_DREQ_BIT 2
00355 #define VS_DREQ_PORT PORTD
00356 #define VS_DREQ_PIN PIND
00357 #define VS_DREQ_DDR DDRD
00358
00359 #elif (VS_SIGNAL_IRQ == INT3)
00360 #define VS_SIGNAL sig_INTERRUPT3
00361 #define VS_DREQ_BIT 3
00362 #define VS_DREQ_PORT PORTD
00363 #define VS_DREQ_PIN PIND
00364 #define VS_DREQ_DDR DDRD
00365
00366 #elif (VS_SIGNAL_IRQ == INT4)
00367 #define VS_SIGNAL sig_INTERRUPT4
00368 #define VS_DREQ_BIT 4
00369 #define VS_DREQ_PORT PORTE
00370 #define VS_DREQ_PIN PINE
00371 #define VS_DREQ_DDR DDRE
00372
00373 #elif (VS_SIGNAL_IRQ == INT5)
00374 #define VS_SIGNAL sig_INTERRUPT5
00375 #define VS_DREQ_BIT 5
00376 #define VS_DREQ_PORT PORTE
00377 #define VS_DREQ_PIN PINE
00378 #define VS_DREQ_DDR DDRE
00379
00380 #elif (VS_SIGNAL_IRQ == INT7)
00381 #define VS_SIGNAL sig_INTERRUPT7
00382 #define VS_DREQ_BIT 7
00383 #define VS_DREQ_PORT PORTE
00384 #define VS_DREQ_PIN PINE
00385 #define VS_DREQ_DDR DDRE
00386
00387 #else
00388 #warning "Bad interrupt specification"
00389 #endif
00390
00391 static volatile uint8_t vs_status = VS_STATUS_STOPPED;
00392 static volatile uint16_t vs_flush;
00393
00394
00395
00396
00397
00398
00399
00400
00401
00402 static INLINE void VsSdiPutByte(uint8_t b)
00403 {
00404 #ifdef VS_NOSPI
00405 uint8_t mask = 0x80;
00406 sbi(VS_BSYNC_PORT, VS_BSYNC_BIT);
00407 while (mask) {
00408 if (b & mask)
00409 sbi(VS_SI_PORT, VS_SI_BIT);
00410 else
00411 cbi(VS_SI_PORT, VS_SI_BIT);
00412
00413 sbi(VS_SS_PORT, VS_SS_BIT);
00414 mask >>= 1;
00415 cbi(VS_SS_PORT, VS_SS_BIT);
00416 cbi(VS_BSYNC_PORT, VS_BSYNC_BIT);
00417 }
00418 #else
00419
00420 loop_until_bit_is_set(SPSR, SPIF);
00421 sbi(VS_BSYNC_PORT, VS_BSYNC_BIT);
00422 outb(SPDR, b);
00423 _NOP();
00424 _NOP();
00425 _NOP();
00426 _NOP();
00427 cbi(VS_BSYNC_PORT, VS_BSYNC_BIT);
00428 #endif
00429 }
00430
00437 static int VsSdiWrite(CONST uint8_t * data, uint16_t len)
00438 {
00439 uint16_t try = 5000;
00440
00441 while (len--) {
00442 while (try-- && bit_is_clear(VS_DREQ_PIN, VS_DREQ_BIT));
00443 VsSdiPutByte(*data);
00444 data++;
00445 }
00446 return try ? 0 : -1;
00447 }
00448
00456 static int VsSdiWrite_P(PGM_P data, uint16_t len)
00457 {
00458 uint16_t try = 5000;
00459
00460 while (len--) {
00461 while (try-- && bit_is_clear(VS_DREQ_PIN, VS_DREQ_BIT));
00462 VsSdiPutByte(PRG_RDB(data));
00463 data++;
00464 }
00465 return try ? 0 : -1;
00466 }
00467
00474 static INLINE void VsSciPutByte(uint8_t data)
00475 {
00476 uint8_t mask = 0x80;
00477
00478
00479
00480
00481 while (mask) {
00482
00483
00484 if (data & mask)
00485 sbi(VS_SI_PORT, VS_SI_BIT);
00486 else
00487 cbi(VS_SI_PORT, VS_SI_BIT);
00488
00489
00490 sbi(VS_SCK_PORT, VS_SCK_BIT);
00491 mask >>= 1;
00492 cbi(VS_SCK_PORT, VS_SCK_BIT);
00493 }
00494 }
00495
00502 static INLINE uint8_t VsSciGetByte(void)
00503 {
00504 uint8_t mask = 0x80;
00505 uint8_t data = 0;
00506
00507
00508
00509
00510 while (mask) {
00511
00512 sbi(VS_SCK_PORT, VS_SCK_BIT);
00513 if (bit_is_set(VS_SO_PIN, VS_SO_BIT))
00514 data |= mask;
00515 mask >>= 1;
00516 cbi(VS_SCK_PORT, VS_SCK_BIT);
00517 }
00518 return data;
00519 }
00520
00526 static void VsRegWrite(uint8_t reg, uint16_t data)
00527 {
00528
00529 cbi(VS_XCS_PORT, VS_XCS_BIT);
00530
00531 #ifndef VS_NOSPI
00532
00533 cbi(SPCR, SPE);
00534 #endif
00535
00536 VsSciPutByte(VS_OPCODE_WRITE);
00537 VsSciPutByte(reg);
00538 VsSciPutByte((uint8_t) (data >> 8));
00539 VsSciPutByte((uint8_t) data);
00540
00541 #ifndef VS_NOSPI
00542
00543 outb(SPCR, BV(MSTR) | BV(SPE));
00544 outb(SPSR, inb(SPSR));
00545 #endif
00546
00547
00548 sbi(VS_XCS_PORT, VS_XCS_BIT);
00549 }
00550
00551
00552
00553
00554
00555
00556
00557
00558 static uint16_t VsRegRead(uint8_t reg)
00559 {
00560 uint16_t data;
00561
00562
00563 cbi(VS_XCS_PORT, VS_XCS_BIT);
00564
00565 #ifndef VS_NOSPI
00566
00567 cbi(SPCR, SPE);
00568 #endif
00569
00570 VsSciPutByte(VS_OPCODE_READ);
00571 VsSciPutByte(reg);
00572 data = (uint16_t)VsSciGetByte() << 8;
00573 data |= VsSciGetByte();
00574
00575 #ifndef VS_NOSPI
00576
00577 outb(SPCR, BV(MSTR) | BV(SPE));
00578 outb(SPSR, inb(SPSR));
00579 #endif
00580
00581
00582 sbi(VS_XCS_PORT, VS_XCS_BIT);
00583
00584 return data;
00585 }
00586
00598 uint8_t VsPlayerInterrupts(uint8_t enable)
00599 {
00600 static uint8_t is_enabled = 0;
00601 uint8_t rc;
00602
00603 rc = is_enabled;
00604 if(enable) {
00605 NutIrqEnable(&VS_SIGNAL);
00606 }
00607 else {
00608 NutIrqDisable(&VS_SIGNAL);
00609 }
00610 is_enabled = enable;
00611
00612 return rc;
00613 }
00614
00615
00616
00617
00618
00619
00620
00621
00622 static void VsPlayerFeed(void *arg)
00623 {
00624 uint8_t ief;
00625 uint8_t j = 32;
00626 size_t total = 0;
00627
00628 if (bit_is_clear(VS_DREQ_PIN, VS_DREQ_BIT)) {
00629 return;
00630 }
00631
00632
00633
00634
00635
00636 ief = VsPlayerInterrupts(0);
00637 sei();
00638
00639
00640
00641
00642 if (vs_status == VS_STATUS_RUNNING) {
00643 char *bp = 0;
00644 size_t consumed = 0;
00645 size_t available = 0;
00646 do {
00647 if(consumed >= available) {
00648
00649 if(consumed) {
00650 NutSegBufReadCommit(consumed);
00651 consumed = 0;
00652 }
00653
00654 bp = NutSegBufReadRequest(&available);
00655 if(available == 0) {
00656
00657 vs_status = VS_STATUS_EOF;
00658 break;
00659 }
00660 }
00661
00662 VsSdiPutByte(*bp);
00663 bp++;
00664 consumed++;
00665 total++;
00666 if (total > 4096) {
00667 vs_status = VS_STATUS_EOF;
00668 break;
00669 }
00670
00671
00672
00673 if (bit_is_set(VS_DREQ_PIN, VS_DREQ_BIT))
00674 j = 32;
00675 } while(j--);
00676
00677
00678 NutSegBufReadLast(consumed);
00679 }
00680
00681
00682
00683
00684 if(vs_status != VS_STATUS_RUNNING && vs_flush) {
00685 do {
00686 VsSdiPutByte(0);
00687 if (--vs_flush == 0) {
00688
00689 vs_status = VS_STATUS_EMPTY;
00690 break;
00691 }
00692
00693
00694 if (bit_is_set(VS_DREQ_PIN, VS_DREQ_BIT))
00695 j = 32;
00696 } while(j--);
00697 }
00698 VsPlayerInterrupts(ief);
00699 }
00700
00712 int VsPlayerKick(void)
00713 {
00714
00715
00716
00717 VsPlayerInterrupts(0);
00718 vs_status = VS_STATUS_RUNNING;
00719 VsPlayerFeed(NULL);
00720 VsPlayerInterrupts(1);
00721
00722 return 0;
00723 }
00724
00733 int VsPlayerStop(void)
00734 {
00735 uint8_t ief;
00736
00737 ief = VsPlayerInterrupts(0);
00738
00739 if (vs_status == VS_STATUS_RUNNING) {
00740 vs_status = VS_STATUS_STOPPED;
00741 }
00742 VsPlayerInterrupts(ief);
00743
00744 return 0;
00745 }
00746
00747
00760 int VsPlayerFlush(void)
00761 {
00762 VsPlayerInterrupts(0);
00763
00764 if (vs_status != VS_STATUS_EMPTY || NutSegBufUsed()) {
00765 if (vs_flush == 0)
00766 vs_flush = VS_FLUSH_BYTES;
00767
00768 if (vs_status != VS_STATUS_RUNNING)
00769 VsPlayerKick();
00770 }
00771 VsPlayerInterrupts(1);
00772 return 0;
00773 }
00774
00775
00781 int VsPlayerInit(void)
00782 {
00783
00784 VsPlayerInterrupts(0);
00785
00786
00787 cbi(VS_RESET_PORT, VS_RESET_BIT);
00788 sbi(VS_RESET_DDR, VS_RESET_BIT);
00789
00790
00791 cbi(VS_BSYNC_PORT, VS_BSYNC_BIT);
00792 sbi(VS_BSYNC_DDR, VS_BSYNC_BIT);
00793
00794
00795 sbi(VS_XCS_PORT, VS_XCS_BIT);
00796 sbi(VS_XCS_DDR, VS_XCS_BIT);
00797
00798
00799 sbi(VS_DREQ_PORT, VS_DREQ_BIT);
00800 cbi(VS_DREQ_DDR, VS_DREQ_BIT);
00801
00802
00803 sbi(VS_SI_DDR, VS_SI_BIT);
00804 sbi(VS_SS_DDR, VS_SS_BIT);
00805 cbi(VS_SO_DDR, VS_SO_BIT);
00806
00807
00808 cbi(VS_SCK_PORT, VS_SCK_BIT);
00809 sbi(VS_SCK_DDR, VS_SCK_BIT);
00810
00811 #ifndef VS_NOSPI
00812 {
00813 uint8_t dummy;
00814
00815
00816
00817
00818
00819
00820
00821 outb(SPCR, BV(MSTR) | BV(SPE));
00822 dummy = inb(SPSR);
00823 outb(SPDR, 0);
00824 }
00825 #endif
00826
00827
00828 if (NutRegisterIrqHandler(&VS_SIGNAL, VsPlayerFeed, NULL)) {
00829 return -1;
00830 }
00831
00832
00833 NutIrqSetMode(&VS_SIGNAL, NUT_IRQMODE_RISINGEDGE);
00834
00835
00836 sbi(VS_RESET_PORT, VS_RESET_BIT);
00837 NutDelay(4);
00838
00839
00840 VsRegWrite(VS_CLOCKF_REG, 0x9800);
00841 VsRegWrite(VS_INT_FCTLH_REG, 0x8008);
00842 NutDelay(200);
00843
00844
00845 outb(EIFR, BV(VS_DREQ_BIT));
00846
00847 return 0;
00848 }
00849
00865 int VsPlayerReset(uint16_t mode)
00866 {
00867
00868 VsPlayerInterrupts(0);
00869 vs_status = VS_STATUS_STOPPED;
00870
00871
00872 VsRegWrite(VS_MODE_REG, VS_SM_RESET | mode);
00873 NutDelay(2);
00874
00875
00876
00877
00878 if ((mode & VS_SM_RESET) != 0 || bit_is_clear(VS_DREQ_PIN, VS_DREQ_BIT)) {
00879
00880
00881 cbi(VS_RESET_PORT, VS_RESET_BIT);
00882 _NOP();
00883 sbi(VS_RESET_PORT, VS_RESET_BIT);
00884 NutDelay(4);
00885
00886
00887 VsRegWrite(VS_MODE_REG, VS_SM_RESET | mode);
00888 NutDelay(2);
00889 if (bit_is_clear(VS_DREQ_PIN, VS_DREQ_BIT))
00890 return -1;
00891 }
00892
00893
00894 VsRegWrite(VS_CLOCKF_REG, 0x9800);
00895 VsRegWrite(VS_INT_FCTLH_REG, 0x8008);
00896 NutDelay(2);
00897
00898
00899 outb(EIFR, BV(VS_DREQ_BIT));
00900
00901 return 0;
00902 }
00903
00916 int VsPlayerSetMode(uint16_t mode)
00917 {
00918 uint8_t ief;
00919
00920 ief = VsPlayerInterrupts(0);
00921 VsRegWrite(VS_MODE_REG, mode);
00922 VsPlayerInterrupts(ief);
00923
00924 return 0;
00925 }
00926
00932 uint16_t VsPlayTime(void)
00933 {
00934 uint16_t rc;
00935 uint8_t ief;
00936
00937 ief = VsPlayerInterrupts(0);
00938 rc = VsRegRead(VS_DECODE_TIME_REG);
00939 VsPlayerInterrupts(ief);
00940
00941 return rc;
00942 }
00943
00953 uint8_t VsGetStatus(void)
00954 {
00955 return vs_status;
00956 }
00957
00958 #ifdef __GNUC__
00959
00967 int VsGetHeaderInfo(VS_HEADERINFO * vshi)
00968 {
00969 uint16_t *usp = (uint16_t *) vshi;
00970 uint8_t ief;
00971
00972 ief = VsPlayerInterrupts(0);
00973 *usp = VsRegRead(VS_HDAT1_REG);
00974 *++usp = VsRegRead(VS_HDAT0_REG);
00975 VsPlayerInterrupts(ief);
00976
00977 return 0;
00978 }
00979 #endif
00980
00993 uint16_t VsMemoryTest(void)
00994 {
00995 uint16_t rc;
00996 uint8_t ief;
00997 static prog_char mtcmd[] = { 0x4D, 0xEA, 0x6D, 0x54, 0x00, 0x00, 0x00, 0x00 };
00998
00999 ief = VsPlayerInterrupts(0);
01000 VsSdiWrite_P(mtcmd, sizeof(mtcmd));
01001 NutDelay(40);
01002 rc = VsRegRead(VS_HDAT0_REG);
01003 VsPlayerInterrupts(ief);
01004
01005 return rc;
01006 }
01007
01016 int VsSetVolume(uint8_t left, uint8_t right)
01017 {
01018 uint8_t ief;
01019
01020 ief = VsPlayerInterrupts(0);
01021 VsRegWrite(VS_VOL_REG, (((uint16_t) left) << 8) | (uint16_t) right);
01022 VsPlayerInterrupts(ief);
01023
01024 return 0;
01025 }
01026
01035 int VsBeep(uint8_t fsin, uint8_t ms)
01036 {
01037 uint8_t ief;
01038 static prog_char on[] = { 0x53, 0xEF, 0x6E };
01039 static prog_char off[] = { 0x45, 0x78, 0x69, 0x74 };
01040 static prog_char end[] = { 0x00, 0x00, 0x00, 0x00 };
01041
01042
01043 ief = VsPlayerInterrupts(0);
01044
01045 fsin = 56 + (fsin & 7) * 9;
01046 VsSdiWrite_P(on, sizeof(on));
01047 VsSdiWrite(&fsin, 1);
01048 VsSdiWrite_P(end, sizeof(end));
01049 NutDelay(ms);
01050 VsSdiWrite_P(off, sizeof(off));
01051 VsSdiWrite_P(end, sizeof(end));
01052
01053
01054 VsPlayerInterrupts(ief);
01055
01056 return 0;
01057 }
01058
01059