Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Next revision
Previous revision
en:software:arm-can:drivers:nokia6610 [2010/02/23 13:07] – created mikk.leinien:software:arm-can:drivers:nokia6610 [2020/07/20 09:00] (current) – external edit 127.0.0.1
Line 200: Line 200:
  unsigned long ulTemp;  unsigned long ulTemp;
   
-    // + // 
-    // Write the byte to the controller. + // Write the byte to the controller. 
-    // + // 
-    SSIDataPut(SSI0_BASE, ucBuffer & 0xFF); + SSIDataPut(SSI0_BASE, ucBuffer & 0xFF); 
- +  
-    // + // 
-    // Dummy read to drain the FIFO and time the GPIO signal. + // Dummy read to drain the FIFO and time the GPIO signal. 
-    // + // 
-    SSIDataGet(SSI0_BASE, &ulTemp); + SSIDataGet(SSI0_BASE, &ulTemp);
 } }
  
Line 225: Line 225:
  unsigned long ulTemp;  unsigned long ulTemp;
   
-    // + // 
-    // Write the byte to the controller. + // Write the byte to the controller. 
-    // + // 
-    SSIDataPut(SSI0_BASE, ucBuffer | 0x100); + SSIDataPut(SSI0_BASE, ucBuffer | 0x100); 
- +  
-    // + // 
-    // Dummy read to drain the FIFO and time the GPIO signal. + // Dummy read to drain the FIFO and time the GPIO signal. 
-    // + // 
-    SSIDataGet(SSI0_BASE, &ulTemp); + SSIDataGet(SSI0_BASE, &ulTemp);
 } }
  
Line 252: Line 252:
 { {
  unsigned long ulTemp;  unsigned long ulTemp;
- +  
-    // + // 
-    // Enable the SSI0 and GPIO port blocks as they are needed by this driver. + // Enable the SSI0 and GPIO port blocks as they are needed by this driver. 
-    //  + //  
-    SysCtlPeripheralEnable(SYSCTL_PERIPH_SSI0); + SysCtlPeripheralEnable(SYSCTL_PERIPH_SSI0); 
-    SysCtlPeripheralEnable(SYSCTL_PERIPH_GPIOA);     + SysCtlPeripheralEnable(SYSCTL_PERIPH_GPIOA);     
- +  
-    // + // 
-    // Configure the SSI0CLK and SSIOTX pins for SSI operation. + // Configure the SSI0CLK and SSIOTX pins for SSI operation. 
-    // + // 
-    GPIOPinTypeSSI(GPIO_PORTA_BASE, GPIO_PIN_2 | GPIO_PIN_3 | GPIO_PIN_4 | GPIO_PIN_5); + GPIOPinTypeSSI(GPIO_PORTA_BASE, GPIO_PIN_2 | GPIO_PIN_3 | GPIO_PIN_4 | GPIO_PIN_5); 
-    GPIOPadConfigSet(GPIO_PORTA_BASE, GPIO_PIN_2 | GPIO_PIN_3 | GPIO_PIN_4 | GPIO_PIN_5, + GPIOPadConfigSet(GPIO_PORTA_BASE, GPIO_PIN_2 | GPIO_PIN_3 | GPIO_PIN_4 | GPIO_PIN_5, 
-                     GPIO_STRENGTH_8MA, GPIO_PIN_TYPE_STD_WPU);+                  GPIO_STRENGTH_8MA, GPIO_PIN_TYPE_STD_WPU);
      
-    // + // 
-    // Configure the SSI0 port for master mode. + // Configure the SSI0 port for master mode. 
-    // + // 
-    SSIConfigSetExpClk(SSI0_BASE, SysCtlClockGet(), SSI_FRF_MOTO_MODE_0, + SSIConfigSetExpClk(SSI0_BASE, SysCtlClockGet(), SSI_FRF_MOTO_MODE_0, 
-                       SSI_MODE_MASTER, ulFrequency, 9); +                    SSI_MODE_MASTER, ulFrequency, 9); 
-         +      
-    // + // 
-    // Enable the SSI port. + // Enable the SSI port. 
-    // + // 
-    SSIEnable(SSI0_BASE); + SSIEnable(SSI0_BASE); 
- +  
-    // + // 
-    // Drain the receive fifo. + // Drain the receive fifo. 
-    // + // 
-    while(SSIDataGetNonBlocking(SSI0_BASE, &ulTemp) != 0) + while(SSIDataGetNonBlocking(SSI0_BASE, &ulTemp) != 0) 
-    +
-    +
- +  
-    // + // 
-    // Configure the GPIO port pin used as a D/Cn signal for LCD device, + // Configure the GPIO port pin used as a D/Cn signal for LCD device, 
-    // and the port pin used to enable power to the LCD panel. + // and the port pin used to enable power to the LCD panel. 
-    // + // 
-    GPIOPinTypeGPIOOutput(GPIO_LCD_BASE, GPIO_LCD_RST_PIN | GPIO_LCD_BL_PIN); + GPIOPinTypeGPIOOutput(GPIO_LCD_BASE, GPIO_LCD_RST_PIN | GPIO_LCD_BL_PIN); 
-    GPIOPadConfigSet(GPIO_LCD_BASE, GPIO_LCD_RST_PIN | GPIO_LCD_BL_PIN, + GPIOPadConfigSet(GPIO_LCD_BASE, GPIO_LCD_RST_PIN | GPIO_LCD_BL_PIN, 
-                     GPIO_STRENGTH_8MA, GPIO_PIN_TYPE_STD); +                  GPIO_STRENGTH_8MA, GPIO_PIN_TYPE_STD); 
-    GPIOPinWrite(GPIO_LCD_BASE, GPIO_LCD_RST_PIN | GPIO_LCD_BL_PIN, GPIO_LCD_RST_PIN);         + GPIOPinWrite(GPIO_LCD_BASE, GPIO_LCD_RST_PIN | GPIO_LCD_BL_PIN, GPIO_LCD_RST_PIN);         
- +  
-    // + // 
-    // Initialize the display controller. + // Initialize the display controller. 
-    // + //
  DelayMS(100);    DelayMS(100);  
 +
  //  //
  // Display control.  // Display control.
Line 306: Line 306:
  WriteData(0x20);  WriteData(0x20);
  WriteData(0x0A);  WriteData(0x0A);
 +
  //  //
  // COM scan 1-80.  // COM scan 1-80.
Line 373: Line 373:
  WriteData(0x00);   WriteData(0x00);
  WriteData(0x02);  WriteData(0x02);
 +
  //  //
  // Turn on the display.  // Turn on the display.
Line 420: Line 420:
  WriteData(lX + SCREEN_OFFSET_X);  WriteData(lX + SCREEN_OFFSET_X);
  WriteData(lX + SCREEN_OFFSET_X);  WriteData(lX + SCREEN_OFFSET_X);
 +
  //  //
  // Page address (Y) set.  // Page address (Y) set.
Line 427: Line 427:
  WriteData(lY + SCREEN_OFFSET_Y);  WriteData(lY + SCREEN_OFFSET_Y);
  WriteData(lY + SCREEN_OFFSET_Y);   WriteData(lY + SCREEN_OFFSET_Y);
 +
  //  //
  // Write memory.  // Write memory.
  //      //    
  WriteCommand(RAMWR);   WriteCommand(RAMWR);
 +  
 + // 
 + // Write the pixel value.
  //  //
-    // Write the pixel value. 
-    // 
  WriteData(ulValue >> 4);  WriteData(ulValue >> 4);
  WriteData((ulValue << 4) | (ulValue >> 8));  WriteData((ulValue << 4) | (ulValue >> 8));
Line 472: Line 472:
                                    const unsigned char *pucPalette)                                    const unsigned char *pucPalette)
 { {
-    unsigned long ulByte;+ unsigned long ulByte;
  unsigned long ucNextByte = 0;  unsigned long ucNextByte = 0;
 +
  //  //
  // Page column (X) set.  // Page column (X) set.
Line 481: Line 481:
  WriteData(lX + SCREEN_OFFSET_X);  WriteData(lX + SCREEN_OFFSET_X);
  WriteData(lX + SCREEN_OFFSET_X + lCount - 1);   WriteData(lX + SCREEN_OFFSET_X + lCount - 1);
 +
  //  //
  // Page address (Y) set.  // Page address (Y) set.
Line 488: Line 488:
  WriteData(lY + SCREEN_OFFSET_Y);  WriteData(lY + SCREEN_OFFSET_Y);
  WriteData(lY + SCREEN_OFFSET_Y);  WriteData(lY + SCREEN_OFFSET_Y);
- +  
-    //+ //
  // Write memory.  // Write memory.
  //  //
  WriteCommand(RAMWR);  WriteCommand(RAMWR);
- +  
-    // + // 
-    // Determine how to interpret the pixel data based on the number of bits + // Determine how to interpret the pixel data based on the number of bits 
-    // per pixel. + // per pixel. 
-    // + // 
-    switch(lBPP) + switch(lBPP) 
-    +
-        // + // 
-        // The pixel data is in 1 bit per pixel format.+ // The pixel data is in 1 bit per pixel format.
  //  //
  // NB! Not tested!  // NB! Not tested!
-        // + // 
-        case 1: + case 1: 
-        +
-            // + // 
-            // Loop while there are more pixels to draw. + // Loop while there are more pixels to draw. 
-            // + // 
-            while(lCount) + while(lCount) 
-            +
-                // + // 
-                // Get the next byte of image data. + // Get the next byte of image data. 
-                // + // 
-                ulByte = *pucData++; + ulByte = *pucData++; 
- +  
-                // + // 
-                // Loop through the pixels in this byte of image data. + // Loop through the pixels in this byte of image data. 
-                // + // 
-                while((lX0 < 8) && lCount) + while((lX0 < 8) && lCount) 
-                +
-                    // + // 
-                    // Draw this pixel in the appropriate color. + // Draw this pixel in the appropriate color. 
-                    // + // 
-                    lBPP = ((unsigned long *)pucPalette)[(ulByte >> + lBPP = ((unsigned long *)pucPalette)[(ulByte >> 
-                                                          (7 - lX0)) & 1]; +                                       (7 - lX0)) & 1]; 
-                    WriteData(lBPP >> 4);                    + WriteData(lBPP >> 4);                    
  ucNextByte = lBPP << 4;          ucNextByte = lBPP << 4;       
 +  
 + // 
 + // Decrement the count of pixels to draw.
  //  //
-                 // Decrement the count of pixels to draw. + lCount--;
-                 // +
-                 lCount--;+
  lX0++;   lX0++;
   
  //  //
-                 // See if there is another pixel to draw. + // See if there is another pixel to draw. 
-                 //+ //
  if((lX0 < 8) && lCount)  if((lX0 < 8) && lCount)
  {   {
  //  //
-                     // Draw this pixel in the appropriate color. + // Draw this pixel in the appropriate color. 
-                     //+ //
  lBPP = ((unsigned long *)pucPalette)[(ulByte >>  lBPP = ((unsigned long *)pucPalette)[(ulByte >>
-                                                           (7 - lX0)) & 1];+                                       (7 - lX0)) & 1];
  WriteData(ucNextByte | (lBPP >> 8));  WriteData(ucNextByte | (lBPP >> 8));
  WriteData(lBPP);  WriteData(lBPP);
 +
  //  //
-                 // Decrement the count of pixels to draw. + // Decrement the count of pixels to draw. 
-                 // + // 
-                 lCount--;+ lCount--;
  lX0++;  lX0++;
-                 }+ }
  else  else
  {  {
Line 563: Line 563:
  }  }
  }  }
- +  
-                // +     // 
-                // Start at the beginning of the next byte of image data. +     // Start at the beginning of the next byte of image data. 
-                // +     // 
-                lX0 = 0; +     lX0 = 0; 
-            +
- +  
-            // + // 
-            // The image data has been drawn. + // The image data has been drawn. 
-            // + // 
-            break; + break; 
-        +
- +  
-        // + // 
-        // The pixel data is in 4 bit per pixel format. + // The pixel data is in 4 bit per pixel format. 
-        // + // 
-        case 4: + case 4: 
-        +
-            // + // 
-            // Loop while there are more pixels to draw.  "Duff's device" is + // Loop while there are more pixels to draw.  "Duff's device" is 
-            // used to jump into the middle of the loop if the first nibble of + // used to jump into the middle of the loop if the first nibble of 
-            // the pixel data should not be used.  Duff's device makes use of + // the pixel data should not be used.  Duff's device makes use of 
-            // the fact that a case statement is legal anywhere within a + // the fact that a case statement is legal anywhere within a 
-            // sub-block of a switch statement.  See + // sub-block of a switch statement.  See 
-            // http://en.wikipedia.org/wiki/Duff's_device for detailed + // http://en.wikipedia.org/wiki/Duff's_device for detailed 
-            // information about Duff's device. + // information about Duff's device. 
-            // + // 
-            switch(lX0 & 1) + switch(lX0 & 1) 
-            +
-                case 0: +     case 0: 
-                    while(lCount) +         while(lCount) 
-                    +         
-                        // +             // 
-                        // Get the upper nibble of the next byte of pixel data +             // Get the upper nibble of the next byte of pixel data 
-                        // and extract the corresponding entry from the +             // and extract the corresponding entry from the 
-                        // palette. +             // palette. 
-                        // +             // 
-                        ulByte = (*pucData >> 4) * 3; +             ulByte = (*pucData >> 4) * 3; 
-                        ulByte = (*(unsigned long *)(pucPalette + ulByte) & +             ulByte = (*(unsigned long *)(pucPalette + ulByte) & 
-                                  0x00ffffff); +                       0x00ffffff); 
- +  
-                        // +             // 
-                        // Translate this palette entry and write it to the +             // Translate this palette entry and write it to the 
-                        // screen. +             // screen. 
-                        // +             // 
-                        ulByte = DPYCOLORTRANSLATE(ulByte);+             ulByte = DPYCOLORTRANSLATE(ulByte);
  WriteData(ulByte >> 4);  WriteData(ulByte >> 4);
  ucNextByte = ulByte << 4;          ucNextByte = ulByte << 4;       
- +  
-                        // +             // 
-                        // Decrement the count of pixels to draw. +             // Decrement the count of pixels to draw. 
-                        // +             // 
-                        lCount--; +             lCount--; 
- +  
-                        // +             // 
-                        // See if there is another pixel to draw. +             // See if there is another pixel to draw. 
-                        // +             // 
-                        if(lCount) +             if(lCount) 
-                        +             
-                case 1: +     case 1: 
-                            // +                 // 
-                            // Get the lower nibble of the next byte of pixel +                 // Get the lower nibble of the next byte of pixel 
-                            // data and extract the corresponding entry from +                 // data and extract the corresponding entry from 
-                            // the palette. +                 // the palette. 
-                            // +                 // 
-                            ulByte = (*pucData++ & 15) * 3; +                 ulByte = (*pucData++ & 15) * 3; 
-                            ulByte = (*(unsigned long *)(pucPalette + ulByte) & +                 ulByte = (*(unsigned long *)(pucPalette + ulByte) & 
-                                      0x00ffffff); +                           0x00ffffff); 
- +  
-                            // +                 // 
-                            // Translate this palette entry and write it to the +                 // Translate this palette entry and write it to the 
-                            // screen. +                 // screen. 
-                            // +                 // 
-                            ulByte = DPYCOLORTRANSLATE(ulByte); +                 ulByte = DPYCOLORTRANSLATE(ulByte); 
-                            WriteData(ucNextByte | (ulByte >> 8)); +                 WriteData(ucNextByte | (ulByte >> 8)); 
-                            WriteData(ulByte); +                 WriteData(ulByte); 
- +  
-                            // +                 // 
-                            // Decrement the count of pixels to draw. +                 // Decrement the count of pixels to draw. 
-                            // +                 // 
-                            lCount--; +                 lCount--; 
-                        }+             }
  else  else
  {  {
Line 652: Line 652:
  WriteData(ucNextByte);  WriteData(ucNextByte);
  }  }
-                    +         
-            +
- +  
-            // +     // 
-            // The image data has been drawn. +     // The image data has been drawn. 
-            // +     // 
-            break; +     break; 
-        +
- +  
-        // + // 
-        // The pixel data is in 8 bit per pixel format.+ // The pixel data is in 8 bit per pixel format.
  //  //
  // NB! Not tested!  // NB! Not tested!
-        // + // 
-        case 8: + case 8: 
-        +
-            // +     // 
-            // Loop while there are more pixels to draw. +     // Loop while there are more pixels to draw. 
-            // +     // 
-            while(lCount) +     while(lCount) 
-            {  +     {  
-                // +         // 
-                // Get the next byte of pixel data and extract the +         // Get the next byte of pixel data and extract the 
-                // corresponding entry from the palette. +         // corresponding entry from the palette. 
-                // +         // 
-                ulByte = *pucData++ * 3; +         ulByte = *pucData++ * 3; 
-                ulByte = *(unsigned long *)(pucPalette + ulByte) & 0x00ffffff; +         ulByte = *(unsigned long *)(pucPalette + ulByte) & 0x00ffffff; 
- +  
-                // +         // 
-                // Translate this palette entry and write it to the screen. +         // Translate this palette entry and write it to the screen. 
-                // +         // 
-                ulByte = DPYCOLORTRANSLATE(ulByte); +         ulByte = DPYCOLORTRANSLATE(ulByte); 
-                WriteData(ulByte >> 4);+         WriteData(ulByte >> 4);
  ucNextByte = ulByte << 4;    ucNextByte = ulByte << 4;  
 +
  //  //
-                // Decrement the count of pixels to draw. +         // Decrement the count of pixels to draw. 
-                // +         // 
-                lCount--;+         lCount--;
   
  //  //
-                // See if there is another pixel to draw. +         // See if there is another pixel to draw. 
-                //+         //
  if(lCount)  if(lCount)
  {  {
  //  //
-                 // Get the next byte of pixel data and extract the +             // Get the next byte of pixel data and extract the 
-                 // corresponding entry from the palette. +             // corresponding entry from the palette. 
-                 // +             // 
-                 ulByte = *pucData++ * 3; +             ulByte = *pucData++ * 3; 
-                 ulByte = *(unsigned long *)(pucPalette + ulByte) & 0x00ffffff; +             ulByte = *(unsigned long *)(pucPalette + ulByte) & 0x00ffffff; 
-  +  
-                 // +             // 
-                 // Translate this palette entry and write it to the screen. +             // Translate this palette entry and write it to the screen. 
-                 // +             // 
-                 ulByte = DPYCOLORTRANSLATE(ulByte);+             ulByte = DPYCOLORTRANSLATE(ulByte);
  WriteData(ucNextByte | (ulByte >> 8));  WriteData(ucNextByte | (ulByte >> 8));
  WriteData(ulByte);                  WriteData(ulByte);                
 +
  //  //
-                    // Decrement the count of pixels to draw. +             // Decrement the count of pixels to draw. 
-                    // +             // 
-                    lCount--;+             lCount--;
  }  }
  else  else
Line 723: Line 723:
  WriteData(ucNextByte);  WriteData(ucNextByte);
  }  }
-            +     
- +  
-            // +     // 
-            // The image data has been drawn. +     // The image data has been drawn. 
-            // +     // 
-            break; +     break; 
-        +
-    }+ }
 } }
  
en/software/arm-can/drivers/nokia6610.1266930426.txt.gz · Last modified: 2020/07/20 09:00 (external edit)
CC Attribution-Share Alike 4.0 International
www.chimeric.de Valid CSS Driven by DokuWiki do yourself a favour and use a real browser - get firefox!! Recent changes RSS feed Valid XHTML 1.0