source: trunk/platform/generic/wrappers.c @ 625

Revision 625, 17.3 KB checked in by reyalp, 4 years ago (diff)

clean up a590, see http://chdk.setepontos.com/index.php/topic,2361.msg25686.html#msg25686

  • Property svn:eol-style set to native
Line 
1#include "camera.h"
2#include "lolevel.h"
3#include "platform.h"
4#include "conf.h"
5
6#if CAM_DRYOS
7#define _U      0x01    /* upper */
8#define _L      0x02    /* lower */
9#define _D      0x04    /* digit */
10#define _C      0x08    /* cntrl */
11#define _P      0x10    /* punct */
12#define _S      0x20    /* white space (space/lf/tab) */
13#define _X      0x40    /* hex digit */
14#define _SP     0x80    /* hard space (0x20) */
15unsigned char _ctype[] = {
16_C,_C,_C,_C,_C,_C,_C,_C,                        /* 0-7 */
17_C,_C|_S,_C|_S,_C|_S,_C|_S,_C|_S,_C,_C,         /* 8-15 */
18_C,_C,_C,_C,_C,_C,_C,_C,                        /* 16-23 */
19_C,_C,_C,_C,_C,_C,_C,_C,                        /* 24-31 */
20_S|_SP,_P,_P,_P,_P,_P,_P,_P,                    /* 32-39 */
21_P,_P,_P,_P,_P,_P,_P,_P,                        /* 40-47 */
22_D,_D,_D,_D,_D,_D,_D,_D,                        /* 48-55 */
23_D,_D,_P,_P,_P,_P,_P,_P,                        /* 56-63 */
24_P,_U|_X,_U|_X,_U|_X,_U|_X,_U|_X,_U|_X,_U,      /* 64-71 */
25_U,_U,_U,_U,_U,_U,_U,_U,                        /* 72-79 */
26_U,_U,_U,_U,_U,_U,_U,_U,                        /* 80-87 */
27_U,_U,_U,_P,_P,_P,_P,_P,                        /* 88-95 */
28_P,_L|_X,_L|_X,_L|_X,_L|_X,_L|_X,_L|_X,_L,      /* 96-103 */
29_L,_L,_L,_L,_L,_L,_L,_L,                        /* 104-111 */
30_L,_L,_L,_L,_L,_L,_L,_L,                        /* 112-119 */
31_L,_L,_L,_P,_P,_P,_P,_C,                        /* 120-127 */
320,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,                /* 128-143 */
330,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,                /* 144-159 */
340,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,                /* 160-175 */
350,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,                /* 176-191 */
360,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,                /* 192-207 */
370,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,                /* 208-223 */
380,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,                /* 224-239 */
390,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0};               /* 240-255 */
40#endif
41
42void msleep(long msec)
43{
44    _SleepTask(msec);
45}
46
47#ifndef CAM_DRYOS
48void task_lock()
49{
50    _taskLock();
51}
52
53void task_unlock()
54{
55    _taskUnlock();
56}
57
58const char *task_name(int id)
59{
60    return _taskName(id);
61}
62
63int task_id_list_get(int *idlist,int size)
64{
65    return _taskIdListGet(idlist,size);
66}
67#endif
68
69long get_property_case(long id, void *buf, long bufsize)
70{
71    return _GetPropertyCase(id, buf, bufsize);
72}
73
74long set_property_case(long id, void *buf, long bufsize)
75{
76    return _SetPropertyCase(id, buf, bufsize);
77}
78
79void remount_filesystem()
80{
81    _Unmount_FileSystem();
82    _Mount_FileSystem();
83}
84
85
86void mark_filesystem_bootable()
87{
88    _UpdateMBROnFlash(0, 0x40, "BOOTDISK");
89}
90
91void vid_bitmap_refresh()
92{
93    _RefreshPhysicalScreen(1);
94}
95
96
97long get_parameter_data(long id, void *buf, long bufsize)
98{
99    return _GetParameterData(id|0x4000, buf, bufsize);
100}
101
102long set_parameter_data(long id, void *buf, long bufsize)
103{
104    return _SetParameterData(id|0x4000, buf, bufsize);
105}
106
107long lens_get_zoom_pos()
108{
109    return _GetZoomLensCurrentPosition();
110}
111
112void lens_set_zoom_pos(long newpos)
113{
114}
115
116long lens_get_zoom_point()
117{
118    return _GetZoomLensCurrentPoint();
119}
120
121void lens_set_zoom_point(long newpt)
122{
123    if (newpt < 0) {
124        newpt = 0;
125    } else if (newpt >= zoom_points) {
126        newpt = zoom_points-1;
127    }
128    _MoveZoomLensWithPoint((short*)&newpt);
129    while (zoom_busy);
130}
131
132void lens_set_zoom_speed(long newspd)
133{
134    if (newspd < 5) {
135        newspd = 5;
136    } else if (newspd > 100) {
137        newspd = 100;
138    }
139    _SetZoomActuatorSpeedPercent((short*)&newspd);
140}
141
142void lens_set_focus_pos(long newpos)
143{
144    _MoveFocusLensToDistance((short*)&newpos);
145    //while (focus_busy);
146    while ((shooting_is_flash_ready()!=1) || (focus_busy));
147    newpos = _GetFocusLensSubjectDistance();
148    _SetPropertyCase(PROPCASE_SUBJECT_DIST1, &newpos, sizeof(newpos));
149    _SetPropertyCase(PROPCASE_SUBJECT_DIST2, &newpos, sizeof(newpos));
150}
151
152void play_sound(unsigned sound)
153{
154        static const int sounds[]={ 0x2001, //startup sound
155                                0x2002, //shutter sound
156                                0x2003, //button press sound
157                                0x2004, //self-timer sound
158                                0xC211, //short beep
159                                50000,  // AF confirmation
160                                0xC507, // error beep imo
161                                0x400D, // LONG ERROR BEEP CONTINIUOUS- warning, cannot be stopped (yet)
162                            };
163    if(sound >= sizeof(sounds)/sizeof(sounds[0]))
164        return;
165
166    _PT_PlaySound(sounds[sound], 0);
167}
168
169long stat_get_vbatt()
170{
171    return _VbattGet();
172}
173
174int get_battery_temp()
175{
176    return _GetBatteryTemperature();
177}
178
179int get_ccd_temp()
180{
181    return _GetCCDTemperature();
182}
183
184int get_optical_temp()
185{
186    return _GetOpticalTemperature();
187}
188
189long get_tick_count()
190{
191long t;
192#if !CAM_DRYOS
193    _GetSystemTime(&t);
194    return t;
195#else
196    return (int)_GetSystemTime(&t);
197#endif
198}
199
200/*int creat (const char *name, int flags)
201{
202    return _creat(name, flags);
203}*/
204int open (const char *name, int flags, int mode )
205{
206    return _Open(name, flags, mode);
207}
208int close (int fd)
209{
210    return _Close(fd);
211}
212int write (int fd, void *buffer, long nbytes)
213{
214    return _Write(fd, buffer, nbytes);
215}
216int read (int fd, void *buffer, long nbytes)
217{
218    return _Read(fd, buffer, nbytes);
219}
220int lseek (int fd, long offset, int whence)
221{
222    return _lseek(fd, offset, whence); /* yes, it's lower-case lseek here since Lseek calls just lseek (A610) */
223}
224long mkdir(const char *dirname)
225{
226    return _mkdir(dirname);
227}
228
229int remove(const char *name) {
230    return _Remove(name);
231}
232
233int errnoOfTaskGet(int tid) {
234#if !CAM_DRYOS
235    return _errnoOfTaskGet(tid);
236#else
237    return 0;
238#endif
239}
240
241int isdigit(int c) {
242#if !CAM_DRYOS
243    return _isdigit(c);
244#else
245    return _ctype[c]&_D;
246#endif
247}
248
249int isspace(int c) {
250#if !CAM_DRYOS
251    return _isspace(c);
252#else
253    return _ctype[c]&_S;
254#endif
255
256}
257
258int isalpha(int c) {
259#if !CAM_DRYOS
260    return _isalpha(c);
261#else
262    return _ctype[c]&(_U|_L);
263#endif
264}
265
266int isupper(int c) {
267#if !CAM_DRYOS
268    return _isupper(c);
269#else
270    return _ctype[c]&_U;
271#endif
272
273}
274
275int islower(int c) {
276#if !CAM_DRYOS
277    return _islower(c);
278#else
279    return _ctype[c]&_L;
280#endif
281
282}
283
284int ispunct(int c) {
285#if !CAM_DRYOS
286    return _ispunct(c);
287#else
288    return _ctype[c]&_P;
289#endif
290}
291
292int isxdigit(int c) {
293#if !CAM_DRYOS
294    return _isxdigit(c);
295#else
296    return _ctype[c]&(_X|_D);
297#endif
298}
299
300long strlen(const char *s) {
301    return _strlen(s);
302}
303
304int strcmp(const char *s1, const char *s2) {
305    return _strcmp(s1, s2);
306}
307
308int strncmp(const char *s1, const char *s2, long n) {
309    return _strncmp(s1, s2, n);
310}
311
312char *strchr(const char *s, int c) {
313    return _strchr(s, c);
314}
315
316char *strcpy(char *dest, const char *src) {
317    return _strcpy(dest, src);
318}
319
320char *strncpy(char *dest, const char *src, long n) {
321    return _strncpy(dest, src, n);
322}
323
324char *strcat(char *dest, const char *app) {
325    return _strcat(dest, app);
326}
327
328char *strrchr(const char *s, int c) {
329    return _strrchr(s, c);
330}
331
332long strtol(const char *nptr, char **endptr, int base) {
333    return _strtol(nptr, endptr, base);
334}
335
336char *strpbrk(const char *s, const char *accept) {
337#if !CAM_DRYOS
338    return _strpbrk(s, accept);
339#else
340    const char *sc1,*sc2;
341
342    for( sc1 = s; *sc1 != '\0'; ++sc1) {
343     for( sc2 = accept; *sc2 != '\0'; ++sc2) {
344      if (*sc1 == *sc2) return (char *) sc1;
345     }
346    }
347return (void*)0;
348#endif
349}
350
351long sprintf(char *s, const char *st, ...)
352{
353    long res;
354    __builtin_va_list va;
355    __builtin_va_start(va, st);
356    res = _vsprintf(s, st, va);
357    __builtin_va_end(va);
358    return res;
359}
360
361// strerror exists on vxworks cams,
362// but it does about the same thing as this
363const char *strerror(int en) {
364#if !CAM_DRYOS
365    static char msg[20];
366    sprintf(msg,"errno 0x%X",en);
367    return msg;
368#else
369    return "error";
370#endif
371}
372
373int tolower(int c) {
374#if !CAM_DRYOS
375        return _tolower(c);
376#else
377        return isupper(c) ? c - 'A' + 'a' : c;
378#endif
379}
380
381int toupper(int c) {
382#if !CAM_DRYOS
383        return _toupper(c);
384#else
385        return islower(c) ? c - 'a' + 'A' : c;
386#endif
387}
388
389unsigned long time(unsigned long *timer) {
390    return _time(timer);
391}
392
393int utime(char *file, void *newTimes) {
394#if !CAM_DRYOS
395  return _utime(file, newTimes);
396#else
397 int fd;
398 int res=0;
399 fd = _open(file, 0, 0);
400 if (fd>=0) {
401  res=_SetFileTimeStamp(fd, ((int*)newTimes)[0] , ((int*)newTimes)[1]);
402  _close(fd);
403 }
404 // return value compatibe with utime: ok=0 fail=-1
405 return (res)?0:-1;
406#endif
407}
408
409void *localtime(const unsigned long *_tod) {
410#if !CAM_DRYOS
411    return _localtime(_tod);
412#else
413// for DRYOS cameras do something with this!  - sizeof(x[]) must be >= sizeof(struct tm) :  'static int x[9];'
414  static int x[9];
415  return _LocalTime(_tod, &x);   
416#endif
417}
418
419long strftime(char *s, unsigned long maxsize, const char *format, /*const struct tm*/ void *timp) {
420        return _strftime(s,maxsize,format,timp);
421}
422
423/*time_t*/ long mktime(/*struct tm*/ void *timp) {
424#if !CAM_DRYOS
425        return _mktime(timp);
426#else
427        int timp_ext[10]; // struct tm + a ptr
428        _memcpy(timp_ext,timp,9*sizeof(int));
429        timp_ext[9]=0;
430        long retval = _mktime_ext(&timp_ext);
431        _memcpy(timp,timp_ext,9*sizeof(int));
432        return retval;
433#endif
434}
435
436double _log(double x) {
437    return __log(x);
438}
439
440double _log10(double x) {
441    return __log10(x);
442}
443
444double _pow(double x, double y) {
445    return __pow(x, y);
446}
447
448double _sqrt(double x) {
449    return __sqrt(x);
450}
451
452void *malloc(long size) {
453    return _malloc(size);
454}
455
456void free(void *p) {
457    return _free(p);
458}
459
460void *memcpy(void *dest, const void *src, long n) {
461    return _memcpy(dest, src, n);
462}
463
464void *memset(void *s, int c, int n) {
465    return _memset(s, c, n);
466}
467
468int memcmp(const void *s1, const void *s2, long n) {
469    return _memcmp(s1, s2, n);
470}
471
472void *memchr(const void *s, int c, int n) {
473#if !CAM_DRYOS
474        return _memchr(s,c,n);
475#else
476        while (n-- > 0) {
477                if (*(char *)s == c)
478                        return (void *)s;
479                s++;
480        }
481        return (void *)0;
482#endif
483}
484
485int rand(void) {
486    return _rand();
487}
488
489void *srand(unsigned int seed) {
490    return _srand(seed);
491}
492
493void qsort(void *__base, int __nelem, int __size, int (*__cmp)(const void *__e1, const void *__e2)) {
494    _qsort(__base, __nelem, __size, __cmp);
495}
496
497void *opendir(const char* name) {
498    return _opendir(name);
499}
500
501void* readdir(void *d) {
502# if !CAM_DRYOS
503    return _readdir(d);
504#else
505// for DRYOS cameras  A650, A720  do something with this!  - sizeof(de[]) must be >= sizeof(struct dirent): 'static char de[40];'
506  static char de[40];
507  _ReadFastDir(d, &de);
508  return de[0]? &de : (void*)0;
509#endif
510}
511
512int closedir(void *d) {
513    return _closedir(d);
514}
515
516void rewinddir(void *d) {
517    return _rewinddir(d);
518}
519
520int stat(char *name, void *pStat) {
521    return _stat(name, pStat);
522}
523
524void *umalloc(long size) {
525    return _AllocateUncacheableMemory(size);
526}
527
528void ufree(void *p) {
529    return _FreeUncacheableMemory(p);
530}
531
532static int shutdown_disabled = 0;
533void disable_shutdown() {
534    if (!shutdown_disabled) {
535        _LockMainPower();
536        shutdown_disabled = 1;
537    }
538}
539
540void enable_shutdown() {
541    if (shutdown_disabled) {
542        _UnlockMainPower();
543        shutdown_disabled = 0;
544    }
545}
546void camera_shutdown_in_a_second(void){
547int i;
548//#if CAM_DRYOS
549//#else
550_SetAutoShutdownTime(1); // 1 sec
551for (i=0;i<200;i++) _UnlockMainPower(); // set power unlock counter to 200 or more, because every keyboard function call try to lock power again ( if "Disable LCD off" menu is "alt" or "script").
552//#endif
553}
554long MakeDirectory_Fut(const char *dirname) {
555 return _MakeDirectory_Fut(dirname,-1); // meaning of second arg is not clear, firmware seems to use -1
556}
557
558long Fopen_Fut(const char *filename, const char *mode){
559 return _Fopen_Fut(filename,mode);
560}
561
562long Fclose_Fut(long file){
563 return _Fclose_Fut(file);
564}
565
566long Fread_Fut(void *buf, long elsize, long count, long f){
567 return _Fread_Fut(buf,  elsize,  count, f);
568}
569
570long Fwrite_Fut(const void *buf, long elsize, long count, long f){
571  return _Fwrite_Fut(buf, elsize, count, f);
572}
573
574long Fseek_Fut(long file, long offset, long whence){
575 return  _Fseek_Fut(file, offset, whence);
576}
577
578long Feof_Fut(long file) {
579 return _Feof_Fut(file);
580}
581
582long Fflush_Fut(long file) {
583 return _Fflush_Fut(file);
584}
585
586char *Fgets_Fut(char *buf, int n, long f) {
587 return _Fgets_Fut(buf,n,f);
588}
589
590long RenameFile_Fut(const char *oldname, const char *newname) {
591 return _RenameFile_Fut(oldname, newname);
592}
593
594int rename(const char *oldname, const char *newname){
595 // doesn't appear to work on a540
596 return _rename(oldname, newname);
597}
598
599long DeleteFile_Fut(const char *name) {
600 return _DeleteFile_Fut(name);
601}
602
603unsigned int GetFreeCardSpaceKb(void){
604 return (_GetDrive_FreeClusters(0)*(_GetDrive_ClusterSize(0)>>9))>>1;
605}
606
607unsigned int GetTotalCardSpaceKb(void){
608 return (_GetDrive_TotalClusters(0)*(_GetDrive_ClusterSize(0)>>9))>>1;
609}
610
611
612unsigned int GetJpgCount(void){
613
614 return strtol(camera_jpeg_count_str(),((void*)0),0);
615}
616
617unsigned int GetRawCount(void){
618 return GetFreeCardSpaceKb()/((hook_raw_size() / 1024)+GetFreeCardSpaceKb()/GetJpgCount());
619
620}
621
622void EnterToCompensationEVF(void)
623{
624  _EnterToCompensationEVF();
625}
626
627void ExitFromCompensationEVF()
628{
629  _ExitFromCompensationEVF();
630}
631
632#if CAM_MULTIPART
633
634#define SECTOR_SIZE 512
635char *mbr_buf;
636static unsigned long drive_sectors;
637
638int mbr_read(char* mbr_sector, unsigned long drive_total_sectors, unsigned long *part_start_sector,  unsigned long *part_length){
639// return value: 1 - success, 0 - fail
640 
641 int offset=0x10; // points to partition #2
642 int valid;
643 
644 if ((mbr_sector[0x1FE]!=0x55) || (mbr_sector[0x1FF]!=0xAA)) return 0; // signature check
645
646 mbr_buf=_AllocateUncacheableMemory(SECTOR_SIZE);
647 _memcpy(mbr_buf,mbr_sector,SECTOR_SIZE);
648 drive_sectors=drive_total_sectors;
649
650 while(offset>=0) {
651 
652  *part_start_sector=(*(unsigned short*)(mbr_sector+offset+0x1C8)<<16) | *(unsigned short*)(mbr_sector+offset+0x1C6);
653  *part_length=(*(unsigned short*)(mbr_sector+offset+0x1CC)<<16) | *(unsigned short*)(mbr_sector+offset+0x1CA);
654
655  valid= (*part_start_sector) && (*part_length) &&
656         (*part_start_sector<=drive_total_sectors) &&
657         (*part_start_sector+*part_length<=drive_total_sectors) &&
658         ((mbr_sector[offset+0x1BE]==0) || (mbr_sector[offset+0x1BE]==0x80)); // status: 0x80 (active) or 0 (non-active)
659
660  if (valid && ((mbr_sector[0x1C2+offset]==0x0B) || (mbr_sector[0x1C2+offset]==0x0C))) break;   // FAT32 secondary partition
661
662  offset-=0x10;
663
664 }
665
666 return valid;
667}
668
669
670
671
672
673
674
675int get_part_count(void){
676 unsigned long part_start_sector, part_length;
677 char part_status, part_type;
678 int i;
679 int count=0;
680 for (i=0; i<=1;i++){
681  part_start_sector=(*(unsigned short*)(mbr_buf+i*16+0x1C8)<<16) | *(unsigned short*)(mbr_buf+i*16+0x1C6);
682  part_length=(*(unsigned short*)(mbr_buf+i*16+0x1CC)<<16) | *(unsigned short*)(mbr_buf+i*16+0x1CA);
683  part_status=mbr_buf[i*16+0x1BE];
684  part_type=mbr_buf[0x1C2+i*16];
685  if ( part_start_sector && part_length && part_type && ((part_status==0) || (part_status==0x80)) ) count++;
686 }
687 return count;
688}
689
690void swap_partitions(void){
691 int i;
692 char c;
693 for(i=0;i<16;i++){
694  c=mbr_buf[i+0x1BE];
695  mbr_buf[i+0x1BE]=mbr_buf[i+0x1CE];
696  mbr_buf[i+0x1CE]=c;
697 }
698 _WriteSDCard(0,0,1,mbr_buf);
699}
700
701void create_partitions(void){
702 unsigned long start, length;
703 char type;
704
705 _memset(mbr_buf,0,SECTOR_SIZE);
706 
707 start=1; length=2*1024*1024/SECTOR_SIZE; //2 Mb
708 type=1; // FAT primary
709 mbr_buf[0x1BE + 4]=type;
710 mbr_buf[0x1BE + 8]=start;   mbr_buf[0x1BE + 9]=start>>8;   mbr_buf[0x1BE + 10]=start>>16;  mbr_buf[0x1BE + 11]=start>>24;
711 mbr_buf[0x1BE + 12]=length; mbr_buf[0x1BE + 13]=length>>8; mbr_buf[0x1BE + 14]=length>>16; mbr_buf[0x1BE + 15]=length>>24;
712
713 start=start+length; length=drive_sectors-start-1;
714 type=0x0B;  //FAT32 primary;
715 mbr_buf[0x1CE + 4]=type;
716 mbr_buf[0x1CE + 8]=start;   mbr_buf[0x1CE + 9]=start>>8;   mbr_buf[0x1CE + 10]=start>>16;  mbr_buf[0x1CE + 11]=start>>24;
717 mbr_buf[0x1CE + 12]=length; mbr_buf[0x1CE + 13]=length>>8; mbr_buf[0x1CE + 14]=length>>16; mbr_buf[0x1CE + 15]=length>>24;
718
719 mbr_buf[0x1FE]=0x55; mbr_buf[0x1FF]=0xAA; // signature;
720
721 _WriteSDCard(0,0,1,mbr_buf);
722}
723
724#endif
725
726int mute_on_zoom(int x){
727 static int old_busy=0;
728 int busy=zoom_busy||focus_busy;
729 if (old_busy!=busy) {
730  if (busy) {
731#if CAM_CAN_MUTE_MICROPHONE
732   if (conf.mute_on_zoom) _TurnOffMic();
733#endif
734   }
735   else {
736#if CAM_CAN_MUTE_MICROPHONE
737  if (conf.mute_on_zoom) _TurnOnMic();
738#endif
739#if CAM_EV_IN_VIDEO
740  if (get_ev_video_avail()) set_ev_video_avail(0);
741#endif
742  }
743  old_busy=busy;
744 }
745 return x; // preserve R0 if called from assembler
746}
747
748
749#if CAM_AF_SCAN_DURING_VIDEO_RECORD
750void MakeAFScan(void){
751 int a=0, save;
752 if (zoom_busy || focus_busy) return;
753 save=some_flag_for_af_scan;
754 some_flag_for_af_scan=0;
755#if CAM_AF_SCAN_DURING_VIDEO_RECORD == 2
756 parameter_for_af_scan=3;
757#endif
758 _MakeAFScan(&a, 3);
759 some_flag_for_af_scan=save;
760 _ExpCtrlTool_StartContiAE(0,0);
761}
762#endif
763
764long __attribute__((weak)) get_jogdial_direction(void){
765 return 0;
766}
767
768void reverse_bytes_order(char* start, int count){
769// note, we will go to count rounded up to the nearest 32
770asm volatile(
771        "ldr    r2, =0xFF00FF\n"        // r2 = mask
772        "add    r1, r0, r1\n"           // r1 = start + count
773"LOOP:\n"
774        "ldm    r0, {R4-R11}\n"         // load 8 words
775       
776        // out = ((in>>8) & 0xFF00FF) | ((in&0xFF00FF) << 8);
777        "mov    r3, r4, lsr #8\n"       // r3 = in >> 8
778        "and    r3, r3, r2\n"           // r3 &= 0xFF00FF
779        "and    r4, r4, r2\n"           // r4 = in & 0xFF00FF
780        "orr    r4, r3, r4, asl #8\n" // out = r3 | (r4 << 8)
781
782        "mov    r3, r5, lsr #8\n"
783        "and    r3, r3, r2\n"
784        "and    r5, r5, r2\n"
785        "orr    r5, r3, r5, asl #8\n"
786
787        "mov    r3, r6, lsr #8\n"
788        "and    r3, r3, r2\n"
789        "and    r6, r6, r2\n"
790        "orr    r6, r3, r6, asl #8\n"
791
792        "mov    r3, r7, lsr #8\n"
793        "and    r3, r3, r2\n"
794        "and    r7, r7, r2\n"
795        "orr    r7, r3, r7, asl #8\n"
796
797        "mov    r3, r8, lsr #8\n"
798        "and    r3, r3, r2\n"
799        "and    r8, r8, r2\n"
800        "orr    r8, r3, r8, asl #8\n"
801
802        "mov    r3, r9, lsr #8\n"
803        "and    r3, r3, r2\n"
804        "and    r9, r9, r2\n"
805        "orr    r9, r3, r9, asl #8\n"
806
807        "mov    r3, r10, lsr #8\n"
808        "and    r3, r3, r2\n"
809        "and    r10, r10, r2\n"
810        "orr    r10, r3, r10, asl #8\n"
811
812        "mov    r3, r11, lsr #8\n"
813        "and    r3, r3, r2\n"
814        "and    r11, r11, r2\n"
815        "orr    r11, r3, r11, asl #8\n"
816
817        "stmia  r0!, {r4-r11}\n"        // store and increment
818
819        "cmp    r0, r1\n"
820        "bcc    LOOP\n"
821        :::"r0","r1","r2","r3","r4","r5","r6","r7","r8","r9","r10","r11"
822 );
823}
824
Note: See TracBrowser for help on using the repository browser.