From e1bc2d5b71bd424325e852b0ef9a89252dac1471 Mon Sep 17 00:00:00 2001 From: Daniel Stenberg Date: Fri, 25 Apr 2008 21:44:18 +0000 Subject: minor code policing and some warning removals git-svn-id: svn://svn.rockbox.org/rockbox/trunk@17249 a1c6a512-1295-4272-9138-f99709370657 --- .../arm/tms320dm320/creative-zvm/ata-creativezvm.c | 52 ++++++++-------- .../arm/tms320dm320/creative-zvm/lcd-creativezvm.c | 70 +++++++++++++--------- .../arm/tms320dm320/creative-zvm/pic-creativezvm.c | 30 +++++++--- 3 files changed, 91 insertions(+), 61 deletions(-) (limited to 'firmware/target') diff --git a/firmware/target/arm/tms320dm320/creative-zvm/ata-creativezvm.c b/firmware/target/arm/tms320dm320/creative-zvm/ata-creativezvm.c index 5cbcd72415..331803360f 100644 --- a/firmware/target/arm/tms320dm320/creative-zvm/ata-creativezvm.c +++ b/firmware/target/arm/tms320dm320/creative-zvm/ata-creativezvm.c @@ -26,7 +26,8 @@ #include "panic.h" #include "ata-target.h" -void ide_power_enable(bool on){ +void ide_power_enable(bool on) +{ #if 0 IO_INTC_EINT1 &= ~INTR_EINT1_EXT2; if(on) @@ -37,13 +38,16 @@ void ide_power_enable(bool on){ else IO_GIO_BITCLR0 = (1 << 14); IO_INTC_EINT1 |= INTR_EINT1_EXT2; - return; + return; +#else + (void)on; #endif } -inline bool ide_powered(){ +inline bool ide_powered() +{ #if 0 - return (IO_GIO_BITSET0 & (1 << 14)); + return (IO_GIO_BITSET0 & (1 << 14)); #else return true; #endif @@ -52,31 +56,31 @@ inline bool ide_powered(){ void ata_reset(void) { /* Disabled until figured out what's wrong */ - IO_INTC_EINT1 &= ~INTR_EINT1_EXT2; //disable GIO2 interrupt - if(!ide_powered()) - { + IO_INTC_EINT1 &= ~INTR_EINT1_EXT2; /*disable GIO2 interrupt */ + if(!ide_powered()) + { ide_power_enable(true); - sleep(150); - } - else - { - IO_GIO_BITSET0 = (1 << 5); - IO_GIO_BITCLR0 = (1 << 3); - sleep(1); - } - IO_GIO_BITCLR0 = (1 << 5); - sleep(10); - IO_GIO_BITSET0 = (1 << 3); - while(!(ATA_COMMAND & STATUS_RDY)) - sleep(10); - IO_INTC_EINT1 |= INTR_EINT1_EXT2; //enable GIO2 interrupt - return; + sleep(150); + } + else + { + IO_GIO_BITSET0 = (1 << 5); + IO_GIO_BITCLR0 = (1 << 3); + sleep(1); + } + IO_GIO_BITCLR0 = (1 << 5); + sleep(10); + IO_GIO_BITSET0 = (1 << 3); + while(!(ATA_COMMAND & STATUS_RDY)) + sleep(10); + IO_INTC_EINT1 |= INTR_EINT1_EXT2; //enable GIO2 interrupt + return; } void ata_enable(bool on) { - (void)on; - return; + (void)on; + return; } bool ata_is_coldstart(void) diff --git a/firmware/target/arm/tms320dm320/creative-zvm/lcd-creativezvm.c b/firmware/target/arm/tms320dm320/creative-zvm/lcd-creativezvm.c index dec20ad72f..a96f9c4f5f 100644 --- a/firmware/target/arm/tms320dm320/creative-zvm/lcd-creativezvm.c +++ b/firmware/target/arm/tms320dm320/creative-zvm/lcd-creativezvm.c @@ -30,7 +30,14 @@ /* Power and display status */ static bool display_on = true; /* Is the display turned on? */ -static bool direct_fb_access = false; /* Does the DM320 has direct access to the FB? */ +static bool direct_fb_access = false; /* Does the DM320 has direct access to + the FB? */ + +/* Copies a rectangle from one framebuffer to another. Can be used in + single transfer mode with width = num pixels, and height = 1 which + allows a full-width rectangle to be copied more efficiently. */ +extern void lcd_copy_buffer_rect(fb_data *dst, const fb_data *src, + int width, int height); int lcd_default_contrast(void) { @@ -46,17 +53,17 @@ void lcd_set_contrast(int val) void lcd_set_invert_display(bool yesno) { (void) yesno; - // TODO: + /* TODO: */ } void lcd_set_flip(bool yesno) { (void) yesno; - // TODO: + /* TODO: */ } /* LTV250QV panel functions */ - +#ifdef ENABLE_DISPLAY_FUNCS static void lcd_write_reg(unsigned char reg, unsigned short val) { unsigned char block[3]; @@ -88,7 +95,7 @@ static void lcd_display_on(void) IO_GIO_BITSET2 = (1 << 8); sleep_ms(1); - //Init SPI here... + /*Init SPI here... */ sleep_ms(32); IO_GIO_BITSET2 = (1 << 0); @@ -98,7 +105,7 @@ static void lcd_display_on(void) IO_GIO_BITSET2 = (1 << 4); sleep_ms(5); IO_GIO_BITCLR2 = (1 << 8); - //TODO: figure out what OF does after this... + /*TODO: figure out what OF does after this... */ IO_GIO_BITSET2 = (1 << 8); sleep_ms(1); @@ -155,7 +162,7 @@ static void lcd_display_on(void) lcd_write_reg(10, 0x111A); sleep_ms(10); - //TODO: other stuff! + /*TODO: other stuff! */ /* tell that we're on now */ display_on = true; @@ -193,6 +200,7 @@ static void lcd_display_off(void) IO_GIO_BITCLR2 |= (1 << 3); } +#endif /* ENABLE_DISPLAY_FUNCS */ void lcd_enable(bool on) @@ -202,13 +210,13 @@ void lcd_enable(bool on) if (on) { - display_on = true; //TODO: remove me! + display_on = true; /*TODO: remove me! */ //lcd_display_on(); /* Turn on display */ lcd_update(); /* Resync display */ } else { - display_on = false; //TODO: remove me! + display_on = false; /*TODO: remove me! */ //lcd_display_off(); /* Turn off display */ } } @@ -268,17 +276,23 @@ void lcd_init_device(void) IO_OSD_OSDWIN0XL = LCD_WIDTH; IO_OSD_OSDWIN0YL = LCD_HEIGHT; #if 0 - //TODO: set LCD clock! - IO_CLK_MOD1 &= ~0x18; // disable OSD clock and VENC clock + /*TODO: set LCD clock! */ + IO_CLK_MOD1 &= ~0x18; /* disable OSD clock and VENC clock */ IO_CLK_02DIV = 3; - IO_CLK_OSEL = (IO_CLK_OSEL & ~0xF00) | 0x400; // reset 'General purpose clock output (GIO26, GIO34)' and set to 'PLLIN clock' - IO_CLK_SEL1 = (IO_CLK_SEL1 | 7) | 0x1000; // set to 'GP clock output 2 (GIO26, GIO34)' and turn on 'VENC clock' - IO_CLK_MOD1 |= 0x18; // enable OSD clock and VENC clock + + /* reset 'General purpose clock output (GIO26, GIO34)' and set to 'PLLIN + clock' */ + IO_CLK_OSEL = (IO_CLK_OSEL & ~0xF00) | 0x400; + + /* set to 'GP clock output 2 (GIO26, GIO34)' and turn on 'VENC clock' */ + IO_CLK_SEL1 = (IO_CLK_SEL1 | 7) | 0x1000; + IO_CLK_MOD1 |= 0x18; /* enable OSD clock and VENC clock */ /* Set LCD values in OSD */ - IO_VID_ENC_VMOD = ( ( (IO_VID_ENC_VMOD & 0xFFFF8C00) | 0x14) | 0x2400 ); // disable NTSC/PAL encoder & set mode to RGB666 parallel 18 bit + /* disable NTSC/PAL encoder & set mode to RGB666 parallel 18 bit */ + IO_VID_ENC_VMOD = ( ( (IO_VID_ENC_VMOD & 0xFFFF8C00) | 0x14) | 0x2400 ); IO_VID_ENC_VDCTL = ( ( (IO_VID_ENC_VDCTL & 0xFFFFCFE8) | 0x20) | 0x4000 ); - //TODO: finish this... + /* TODO: finish this... */ #endif } @@ -293,21 +307,21 @@ void lcd_update_rect(int x, int y, int width, int height) register fb_data *dst, *src; if (!display_on || direct_fb_access) - return; + return; if (x + width > LCD_WIDTH) - width = LCD_WIDTH - x; /* Clip right */ + width = LCD_WIDTH - x; /* Clip right */ if (x < 0) - width += x, x = 0; /* Clip left */ + width += x, x = 0; /* Clip left */ if (width <= 0) return; /* nothing left to do */ if (y + height > LCD_HEIGHT) - height = LCD_HEIGHT - y; /* Clip bottom */ + height = LCD_HEIGHT - y; /* Clip bottom */ if (y < 0) - height += y, y = 0; /* Clip top */ + height += y, y = 0; /* Clip top */ if (height <= 0) - return; /* nothing left to do */ + return; /* nothing left to do */ #if CONFIG_ORIENTATION == SCREEN_PORTAIT dst = (fb_data *)FRAME + LCD_WIDTH*y + x; @@ -348,10 +362,10 @@ This must be called after all other LCD functions that change the display. */ void lcd_update(void) { if (!display_on || direct_fb_access) - return; + return; #if CONFIG_ORIENTATION == SCREEN_PORTAIT lcd_copy_buffer_rect((fb_data *)FRAME, &lcd_framebuffer[0][0], - LCD_WIDTH*LCD_HEIGHT, 1); + LCD_WIDTH*LCD_HEIGHT, 1); #else lcd_update_rect(0, 0, LCD_WIDTH, LCD_HEIGHT); #endif @@ -367,17 +381,17 @@ int stride); /* For the Gigabeat - show it rotated */ /* So the LCD_WIDTH is now the height */ void lcd_blit_yuv(unsigned char * const src[3], -int src_x, int src_y, int stride, -int x, int y, int width, int height) + int src_x, int src_y, int stride, + int x, int y, int width, int height) { /* Caches for chroma data so it only need be recalculated every other - line */ + line */ unsigned char chroma_buf[LCD_HEIGHT/2*3]; /* 480 bytes */ unsigned char const * yuv_src[3]; off_t z; if (!display_on || direct_fb_access) - return; + return; /* Sorry, but width and height must be >= 2 or else */ width &= ~1; diff --git a/firmware/target/arm/tms320dm320/creative-zvm/pic-creativezvm.c b/firmware/target/arm/tms320dm320/creative-zvm/pic-creativezvm.c index 35e6bd31fb..09d3cf7c67 100644 --- a/firmware/target/arm/tms320dm320/creative-zvm/pic-creativezvm.c +++ b/firmware/target/arm/tms320dm320/creative-zvm/pic-creativezvm.c @@ -73,7 +73,10 @@ #define BTN_HOLD 0x9F06 #define BTN_UNHOLD 0xAF06 /* TODO: other values -First number is just pressing it, second is when you release it or keep it pressed a bit longer + +First number is just pressing it, second is when you release it or keep it +pressed a bit longer + On/Off = 0F00 && 0F01 Hold = 9F06 && AF06 Volume Up = 6F00 && 6F01 @@ -235,10 +238,14 @@ void GIO0(void) #ifdef BOOTLOADER lcd_set_foreground((sw ? LCD_RGBPACK(255,0,0) : LCD_RGBPACK(0,255,0) )); #endif - snprintf(weergvn, sizeof(char)*10, "%x", (unsigned int)((msg[3] << 24) | (msg[2] << 16) | (msg[1] << 8) | msg[0])); - lcd_putsxy(LCD_WIDTH-SYSFONT_WIDTH*10, LCD_HEIGHT-SYSFONT_HEIGHT*10, weergvn); + snprintf(weergvn, sizeof(char)*10, "%x", + (unsigned int)((msg[3] << 24) | + (msg[2] << 16) | (msg[1] << 8) | msg[0])); + lcd_putsxy(LCD_WIDTH-SYSFONT_WIDTH*10, LCD_HEIGHT-SYSFONT_HEIGHT*10, + weergvn); snprintf(weergvn, sizeof(char)*10, "%x", btn); - lcd_putsxy(LCD_WIDTH-SYSFONT_WIDTH*10, LCD_HEIGHT-SYSFONT_HEIGHT*7, weergvn); + lcd_putsxy(LCD_WIDTH-SYSFONT_WIDTH*10, LCD_HEIGHT-SYSFONT_HEIGHT*7, + weergvn); #ifdef BOOTLOADER lcd_set_foreground(LCD_BLACK); #endif @@ -249,7 +256,8 @@ void GIO0(void) IO_INTC_IRQ1 = INTR_IRQ1_EXT0; } -void send_command_to_pic(unsigned char in, unsigned char* out, unsigned int length) +void send_command_to_pic(unsigned char in, unsigned char* out, + unsigned int length) { /* Disable GIO0 interrupt */ IO_INTC_EINT1 &= ~INTR_EINT1_EXT0; @@ -280,13 +288,17 @@ bool headphones_inserted(void) void button_init_device(void) { - /* TODO: I suppose GIO0 has to be set to input and enable interrupts on it? */ + /* TODO: I suppose GIO0 has to be set to input and enable interrupts on + it? */ /* Enable GIO0 interrupt */ IO_INTC_EINT1 |= INTR_EINT1_EXT0; - btn = nonbtn = pic_init_value = pic_init2_value = last_btn = hold_switch = 0; + btn = nonbtn = pic_init_value = pic_init2_value = last_btn = hold_switch = + 0; /* Initialize PIC */ - send_command_to_pic(1, &pic_init_value, sizeof(pic_init_value)); - send_command_to_pic(2, &pic_init2_value, sizeof(pic_init2_value)); + send_command_to_pic(1, (unsigned char *)&pic_init_value, + sizeof(pic_init_value)); + send_command_to_pic(2, (unsigned char *)&pic_init2_value, + sizeof(pic_init2_value)); } int get_debug_info(int choice) -- cgit v1.2.3