root/platform/s80/lib.c

/* [<][>][^][v][top][bottom][index][help] */

DEFINITIONS

This source file includes following definitions.
  1. shutdown
  2. debug_led
  3. camera_set_led
  4. get_flash_params_count
  5. JogDial_CW
  6. JogDial_CCW
  7. vid_get_viewport_width
  8. vid_get_viewport_height
  9. vid_get_palette_type
  10. vid_get_palette_size
  11. vid_get_viewport_fullscreen_height
  12. vid_get_viewport_fullscreen_width
  13. vid_get_viewport_display_xoffset
  14. vid_get_viewport_display_yoffset

   1 #include "platform.h"
   2 #include "lolevel.h"
   3 
   4 void shutdown()
   5 {
   6     volatile long *p = (void*)0xc02200dc;
   7         
   8     asm(
   9          "MRS     R1, CPSR\n"
  10          "AND     R0, R1, #0x80\n"
  11          "ORR     R1, R1, #0x80\n"
  12          "MSR     CPSR_cf, R1\n"
  13          :::"r1","r0");
  14         
  15     *p = 0x46;          // should this be 0x46 or 0x44?
  16 
  17     while(1);
  18 }
  19 
  20 
  21 #define LED_PR  0xc0220084
  22 #define LED_AF  0xc022008c
  23 
  24 void debug_led(int state)
  25 {
  26     volatile long *p = (void*)LED_PR;
  27     //volatile long *p = (void*)LED_AF;
  28 
  29     if (state) {
  30         p[0]=0x47;
  31     }
  32     else {
  33         p[0]=0x44;
  34     }
  35 }
  36 
  37 void camera_set_led(int led, int state, int bright)
  38 {
  39 /*
  40 0 upper green
  41 1 upper orange (red?)
  42 2 lower orange
  43 4 power green
  44 5 power orange
  45 8 blue (print)
  46 9..11 af
  47 */
  48  struct led_control led_c;
  49 
  50  led_c.led_num=led%16;
  51  led_c.action=state<=1 ? !state : state;
  52  led_c.brightness=bright;
  53  led_c.blink_count=255;
  54  _PostLEDMessage(&led_c);
  55 }
  56  
  57 
  58 int get_flash_params_count(void){
  59  return 94; // @FF96AD60
  60 }
  61 
  62 /*
  63 int Get_JogDial(void){
  64  return (*(int*)0xC0220304)>>16;
  65 }
  66 */
  67 
  68 
  69 void JogDial_CW(void){
  70  _PostLogicalEventForNotPowerType(0x864, 2);  // RotateJogDialRight
  71 }
  72 
  73 void JogDial_CCW(void){
  74  _PostLogicalEventForNotPowerType(0x865, 2);  // RotateJogDialLeft
  75 }
  76 
  77 //---------------------------------------------------------
  78 
  79 int vid_get_viewport_width() {
  80     return vid_get_viewport_width_proper()>>1;
  81 }
  82 
  83 long vid_get_viewport_height()
  84 {
  85     return vid_get_viewport_height_proper();
  86 }
  87 
  88 int vid_get_palette_type() { return 1; }
  89 int vid_get_palette_size() { return 16*4; }
  90 
  91 int vid_get_viewport_fullscreen_height() {
  92     // except for stitch, always full screen
  93     int m = mode_get();
  94     if((m&MODE_MASK) != MODE_PLAY && ((m&MODE_SHOOTING_MASK) == MODE_STITCH)) {
  95         return 240;
  96     }
  97     return vid_get_viewport_height_proper();
  98 }
  99 
 100 int vid_get_viewport_fullscreen_width() {
 101     // except for stitch, always full screen
 102     int m = mode_get();
 103     if((m&MODE_MASK) != MODE_PLAY && ((m&MODE_SHOOTING_MASK) == MODE_STITCH)) {
 104         return 720;
 105     }
 106     return vid_get_viewport_width_proper();
 107 }
 108 
 109 int vid_get_viewport_display_xoffset() {
 110     int m = mode_get();
 111     if((m&MODE_MASK) == MODE_PLAY) {
 112         return 0;
 113     } else if((m&MODE_SHOOTING_MASK) == MODE_STITCH) {
 114         short dir=0;
 115         short seq=0;
 116         get_property_case(PROPCASE_STITCH_DIRECTION,&dir,sizeof(dir));
 117         get_property_case(PROPCASE_STITCH_SEQUENCE,&seq,sizeof(seq));
 118         // overall stitch window is 3/4 screen width, centered
 119         // live part is 1/2, so margin is either 1/8th or 3/8th
 120         if(dir==0) {
 121             return seq?132:44;
 122         } else {
 123             return seq?44:132;
 124         }
 125     }
 126     return 0;
 127 }
 128 
 129 int vid_get_viewport_display_yoffset() {
 130     int m = mode_get();
 131     if((m&MODE_MASK) == MODE_PLAY) {
 132         return 0;
 133     }
 134     return ((m&MODE_SHOOTING_MASK) == MODE_STITCH)?60:0; // window is 120, centered in 240 screen
 135 }
 136 
 137 /*
 138 int switch_mode_usb(int mode) // not working
 139 {
 140     if ( mode == 0 ) {
 141         levent_set_play();
 142     } else if ( mode == 1 ) {
 143         levent_set_record();
 144     } else return 0;
 145     return 1;
 146 }

/* [<][>][^][v][top][bottom][index][help] */