Rockbox open source high quality audio player as a Music Player Daemon
mpris rockbox mpd libadwaita audio rust zig deno
2
fork

Configure Feed

Select the types of activity you want to include in your feed.

Untested attempt at a Clip+ LCD driver using SSP (PrimeCell PL022)

git-svn-id: svn://svn.rockbox.org/rockbox/trunk@24523 a1c6a512-1295-4272-9138-f99709370657

+69 -7
+14
firmware/export/as3525.h
··· 497 497 #define I2SOUT_CLEAR (*(volatile unsigned char*)(I2SOUT_BASE+0x10)) 498 498 #define I2SOUT_DATA (volatile unsigned long*)(I2SOUT_BASE+0x14) 499 499 500 + 501 + /* SSP registers (PrimeCell PL022) */ 502 + 503 + #define SSP_CR0 (*(volatile unsigned short*)(SSP_BASE+0x00)) 504 + #define SSP_CR1 (*(volatile unsigned char*)(SSP_BASE+0x04)) 505 + #define SSP_DATA (*(volatile unsigned short*)(SSP_BASE+0x08)) 506 + #define SSP_SR (*(volatile unsigned char*)(SSP_BASE+0x0C)) 507 + #define SSP_CPSR (*(volatile unsigned char*)(SSP_BASE+0x10)) 508 + #define SSP_IMSC (*(volatile unsigned char*)(SSP_BASE+0x14)) 509 + #define SSP_IRS (*(volatile unsigned char*)(SSP_BASE+0x18)) 510 + #define SSP_MIS (*(volatile unsigned char*)(SSP_BASE+0x1C)) 511 + #define SSP_ICR (*(volatile unsigned char*)(SSP_BASE+0x20)) 512 + #define SSP_DMACR (*(volatile unsigned char*)(SSP_BASE+0x24)) 513 + 500 514 /* PCM addresses for obtaining buffers will be what DMA is using (physical) */ 501 515 #define HAVE_PCM_DMA_ADDRESS 502 516
+55 -7
firmware/target/arm/as3525/sansa-clip/lcd-ssd1303.c
··· 73 73 #define LCD_CNTL_HIGHCOL 0x10 /* Upper column address */ 74 74 #define LCD_CNTL_LOWCOL 0x00 /* Lower column address */ 75 75 76 + 77 + static void lcd_hw_init(void) 78 + { 79 + #if defined(SANSA_CLIP) 76 80 /* DBOP initialisation, do what OF does */ 77 - static void ams3525_dbop_init(void) 78 - { 79 - #ifdef SANSA_CLIP 80 81 CGU_DBOP = (1<<3) | AS3525_DBOP_DIV; 81 82 82 83 GPIOB_AFSEL = 0x08; /* DBOP on pin 3 */ ··· 85 86 DBOP_CTRL = 0x51008; 86 87 DBOP_TIMPOL_01 = 0x6E167; 87 88 DBOP_TIMPOL_23 = 0xA167E06F; 88 - #else /* SANSA_CLIPV2 */ 89 + #elif defined(SANSA_CLIPV2) 90 + /* DBOP initialisation, do what OF does */ 89 91 CCU_IO |= (1<<12); /* ?? */ 90 92 CGU_DBOP |= /*(1<<3)*/ 0x18 | AS3525_DBOP_DIV; 91 93 92 94 DBOP_CTRL = 0x51004; 93 95 DBOP_TIMPOL_01 = 0x36A12F; 94 96 DBOP_TIMPOL_23 = 0xE037E037; 97 + #elif defined(SANSA_CLIPPLUS) 98 + CGU_PERI |= CGU_SSP_CLOCK_ENABLE; 99 + 100 + SSP_CPSR; /* No clock prescale */ 101 + SSP_CR0 = 0 | 7; /* Motorola SPI frame format, 8 bits */ 102 + SSP_CR1 = 1<<1; /* SSP Operation enabled */ 103 + SSP_IMSC = 0; /* No interrupts */ 95 104 #endif 96 105 } 97 106 ··· 101 110 #define LCD_DELAY 10 102 111 #endif 103 112 113 + #if defined(SANSA_CLIP) || defined(SANSA_CLIPV2) 104 114 void lcd_write_command(int byte) 105 115 { 106 116 volatile int i = 0; ··· 126 136 DBOP_TIMPOL_23 = 0xE037E037; 127 137 #endif 128 138 } 139 + #elif defined(SANSA_CLIPPLUS) 140 + void lcd_write_command(int byte) 141 + { 142 + while(SSP_SR & (1<<4)) /* BSY flag */ 143 + ; 144 + 145 + GPIOB_PIN(2) = 0; 146 + SSP_DATA = byte; 147 + 148 + while(SSP_SR & (1<<4)) /* BSY flag */ 149 + ; 150 + } 151 + #endif 129 152 153 + #if defined(SANSA_CLIP) || defined(SANSA_CLIPV2) 130 154 void lcd_write_data(const fb_data* p_bytes, int count) 131 155 { 132 156 volatile int i = 0; ··· 152 176 /* While push fifo is not empty */ 153 177 while ((DBOP_STAT & (1<<10)) == 0); 154 178 } 179 + #elif defined(SANSA_CLIPPLUS) 180 + void lcd_write_data(const fb_data* p_bytes, int count) 181 + { 182 + GPIOB_PIN(2) = (1<<2); 183 + 184 + SSP_CR0 = 0 | 15; /* Motorola SPI frame format, 16 bits */ 185 + while (count--) 186 + { 187 + while(SSP_SR & (1<<1)) /* Transmit FIFO is not full */ 188 + SSP_DATA = *p_bytes++; 189 + 190 + while(!(SSP_SR & (1<<0))) /* Transmit FIFO is not empty */ 191 + ; 192 + } 193 + SSP_CR0 = 0 | 7; /* Motorola SPI frame format, 8 bits */ 194 + } 195 + #endif 155 196 156 197 157 198 /** globals **/ ··· 234 275 #define LCD_FULLSCREEN (128+4) 235 276 fb_data p_bytes[LCD_FULLSCREEN]; /* framebuffer used to clear the screen */ 236 277 237 - ams3525_dbop_init(); 278 + lcd_hw_init(); 238 279 239 - #ifdef SANSA_CLIP 280 + #if defined(SANSA_CLIP) 240 281 GPIOA_DIR |= 0x33; /* pins 5:4 and 1:0 out */ 241 282 GPIOB_DIR |= 0x40; /* pin 6 out */ 242 283 ··· 244 285 GPIOA_PIN(0) = (1<<0); 245 286 GPIOA_PIN(4) = 0; 246 287 GPIOB_PIN(6) = (1<<6); 247 - #else /* SANSA_CLIPV2 */ 288 + #elif defined(SANSA_CLIPV2) 248 289 GPIOB_DIR |= (1<<2)|(1<<5); 249 290 GPIOB_PIN(5) = (1<<5); 291 + #elif defined(SANSA_CLIPPLUS) 292 + GPIOA_DIR |= (1<<5); 293 + GPIOB_DIR |= (1<<2) | (1<<7); 294 + GPIOA_PIN(5) = 0; 295 + GPIOA_DIR &= (1<<0); 296 + GPIOA_PIN(0) = (1<<0); 297 + GPIOB_PIN(7) = (1<<7); 250 298 #endif 251 299 252 300 /* Set display clock (divide ratio = 1) and oscillator frequency (1) */