static int sourcesel(int clock, int source) { struct owl_clocknode *node; int i; int clocksync; struct owl_clkreq *reg; node = &clocks[clock]; for (i = 0; i < node->source_lim; i++) { if (node->source_av[i] == source) { removeclock(clock); reg = node->reg_srcsel; write_clkreg_val(reg, i); node->source_sel = i; addclock(clock); changeclock(clock); switch (clock) { case CLOCK__DE1_CLK: clocksync = CLOCK__DE2_CLK; goto share_selbit_sync; case CLOCK__DE2_CLK: clocksync = CLOCK__DE1_CLK; goto share_selbit_sync; case CLOCK__SENSOR_CLKOUT0: clocksync = CLOCK__SENSOR_CLKOUT1; goto share_selbit_sync; case CLOCK__SENSOR_CLKOUT1: clocksync = CLOCK__SENSOR_CLKOUT0; goto share_selbit_sync; case CLOCK__NANDC_CLK: clocksync = CLOCK__ECC_CLK; goto share_selbit_sync; case CLOCK__ECC_CLK: clocksync = CLOCK__NANDC_CLK; goto share_selbit_sync; default: break; share_selbit_sync: /* share_selbit_sync to clocks[clocksync] */ node = &clocks[clocksync]; removeclock(clocksync); node->source_sel = i; addclock(clocksync); changeclock(clocksync); break; } return 0; } } return -1; }
static int loopit(void) { int b; unsigned int y=100; unsigned int x=100; unsigned int yy,xx; unsigned int i; unsigned int ysanke=0; unsigned int xsanke=0; char* rock="ROCKbox"; unsigned int rocklen = rb->strlen(rock); int show=0; int timeout=0; rb->lcd_clear_display(); while(1) { b = rb->button_get_w_tmo(HZ/10); if ( b == BOUNCE_QUIT ) return 0; if ( b == BOUNCE_MODE ) return 1; if ( rb->default_event_handler(b) == SYS_USB_CONNECTED ) return -1; if ( b != BUTTON_NONE ) timeout=20; y+= speed[ysanke&15] + values[NUM_YADD].num; x+= speed[xsanke&15] + values[NUM_XADD].num; rb->lcd_clear_display(); #if CONFIG_RTC addclock(); #endif if(timeout) { switch(b) { case BOUNCE_LEFT: case BOUNCE_LEFT|BUTTON_REPEAT: values[show].num--; break; case BOUNCE_RIGHT: case BOUNCE_RIGHT|BUTTON_REPEAT: values[show].num++; break; case BOUNCE_UP: case BOUNCE_UP|BUTTON_REPEAT: if(++show == NUM_LAST) show=0; break; case BOUNCE_DOWN: case BOUNCE_DOWN|BUTTON_REPEAT: if(--show < 0) show=NUM_LAST-1; break; } rb->lcd_putsxyf(0, LCD_HEIGHT - 8, "%s: %d", values[show].what, values[show].num); timeout--; } for(i=0, yy=y, xx=x; i<rocklen; i++, yy+=values[NUM_YDIST].num, xx+=values[NUM_XDIST].num) rb->lcd_mono_bitmap(char_gen_12x16[rock[i]-0x20], xtable[xx % TABLE_SIZE], ytable[yy % TABLE_SIZE], LETTER_WIDTH, LETTER_HEIGHT); rb->lcd_update(); ysanke+= values[NUM_YSANKE].num; xsanke+= values[NUM_XSANKE].num; } }
static int scrollit(void) { int b; unsigned int y=100; unsigned int yy; int x = LCD_WIDTH; int xx; unsigned int i; unsigned int textpos=0; char* rock="Rockbox! Pure pleasure. Pure fun. Oooh. What fun! ;-) "; unsigned int rocklen = rb->strlen(rock); int letter; #if LCD_DEPTH > 1 unsigned prev_color; #endif rb->lcd_clear_display(); while(1) { b = rb->button_get_w_tmo(HZ/10); switch(b) { #ifdef BOUNCE_RC_QUIT case BOUNCE_RC_QUIT : #endif case BOUNCE_QUIT : return 0; case BOUNCE_MODE : return 1; default: if ( rb->default_event_handler(b) == SYS_USB_CONNECTED ) return -1; } rb->lcd_clear_display(); #if CONFIG_RTC addclock(); #endif #if LCD_DEPTH > 1 prev_color = rb->lcd_get_foreground(); #endif for(i=0, yy=y, xx=x; xx < LCD_WIDTH; i++) { letter = rock[(i+textpos) % rocklen ]; #if LCD_DEPTH > 1 rb->lcd_set_foreground(face_colors[letter % 3]); #endif rb->lcd_mono_bitmap(char_gen_12x16[letter-0x20], xx, ytable[yy % TABLE_SIZE], LETTER_WIDTH, LETTER_HEIGHT); yy += YADD; xx += LETTER_WIDTH; } #if LCD_DEPTH > 1 rb->lcd_set_foreground(prev_color); #endif rb->lcd_update(); x-= XSPEED; if(x < -LETTER_WIDTH) { x += LETTER_WIDTH; y += YADD; textpos++; } y+=YSPEED; } }