Beispiel #1
0
bool I2C::ReceiveDMA (void* data_ptr, uint32_t data_size)
{
    EnableDMA(true);
    EnableAutoNACK(true);

    DMA1* dma1 = DMA1::GetInstance();
    if (!dma1->IsClockEnabled())
    {
        dma1->EnablePeripheralClock(true);
    }

    DMA_Channel* dmaCh = dma1->GetChannel(_dmaRxChannel);
    dmaCh->SetPeripheralAddress ((uint32_t)_pI2C_DR);
    dmaCh->SetMemoryAddress((uint32_t)data_ptr);
    dmaCh->SetDirection_PeripheralToMemory();
    dmaCh->SetMemorySize_8bits();
    dmaCh->SetPeripheralSize_8bits();
    dmaCh->SetNumberOfData(data_size);
    dmaCh->SetMemoryIncrementMode();
    dmaCh->SetPriorityHigh();

    dmaCh->EnableChannel(true);
    bool rc = true;

    while (!dma1->IsTransferComplete(dmaCh))
    {
        if  (dma1->IsTransferError(dmaCh))
        {
            ++_errorCount;
            ++_errorDMARX;
            rc = false;
            dma1->ClearTransferError(dmaCh);
            break;
        }
        if (IsError())
        {
            ++_errorCount;
            rc = false;
            break;
        }
    }

    SendStop(true);

    dmaCh->EnableChannel(false);
    dma1->ClearTransferComplete(dmaCh);

    EnableDMA(false);
    EnableAutoNACK(false);

    return rc;

}
Beispiel #2
0
static void Init() {
  EnableDMA(DMAF_BLITTER);
  BitmapClear(screen);

  cp = NewCopList(100);
  CopInit(cp);
  CopSetupGfxSimple(cp, MODE_LORES, DEPTH, X(0), Y(0), WIDTH, HEIGHT);
  CopSetupBitplanes(cp, bplptr, screen, DEPTH);
  CopLoadPal(cp, palette, 0);
  CopEnd(cp);

  CopListActivate(cp);
  EnableDMA(DMAF_RASTER);
}
Beispiel #3
0
bool I2C::SendDMA (void* data_ptr, uint32_t data_size)
{
    EnableDMA(true);

    DMA1* dma1 = DMA1::GetInstance();
    if (!dma1->IsClockEnabled())
    {
        dma1->EnablePeripheralClock(true);
    }

    DMA_Channel* dmaCh = dma1->GetChannel(_dmaTxChannel);
    dmaCh->SetPeripheralAddress ((uint32_t)_pI2C_DR);
    dmaCh->SetMemoryAddress((uint32_t)data_ptr);
    dmaCh->SetDirection_MemoryToPeripheral();
    dmaCh->SetMemorySize_8bits();
    dmaCh->SetPeripheralSize_8bits();
    dmaCh->SetNumberOfData(data_size);
    dmaCh->SetMemoryIncrementMode();
    dmaCh->SetPriorityHigh();

    dmaCh->EnableChannel(true);

    bool rc = true;
    while (!dma1->IsTransferComplete(dmaCh))
    {
        if  (dma1->IsTransferError(dmaCh))
        {
            rc = false;
            ++_errorDMATX;
            ++_errorCount;
            dma1->ClearTransferError(dmaCh);
            break;
        }

    }

    if (!WaitStatus(I2C::MASTER_EV8_2, true))  //TRA, BUSY, MSL, TXE and BTF
        rc = false;


    SendStop(true);

    dmaCh->EnableChannel(false);
    dma1->ClearTransferComplete(dmaCh);
    EnableDMA(false);

    return rc;
}
Beispiel #4
0
static void Init() {
  CopListActivate(cp);
  EnableDMA(DMAF_BLITTER | DMAF_RASTER | DMAF_BLITHOG);

  {
    WORD i;
    LONG lines = ReadLineCounter();

#if CPULINE == 1
    CpuLineSetup(screen, 0);
#else
    BlitterLineSetup(screen, 0, LINE_OR|LINE_SOLID);
#endif

    for (i = 0; i < screen->width; i += 2) {
#if CPULINE == 1
      CpuLine(i, 0, screen->width - 1 - i, screen->height - 1);
#else
      BlitterLine(i, 0, screen->width - 1 - i, screen->height - 1);
#endif
    }

    for (i = 0; i < screen->height; i += 2) {
#if CPULINE == 1
      CpuLine(0, i, screen->width - 1, screen->height - 1 - i);
#else
      BlitterLine(0, i, screen->width - 1, screen->height - 1 - i);
#endif
    }

    Log("lines: %ld\n", ReadLineCounter() - lines);
  }
}
int video_init(void *dst)
{

#ifdef CONFIG_MK_BF527_EZKIT_REV_2_1
	lq035q1_control(LQ035_SHUT_CTL, LQ035_ON);
	lq035q1_control(LQ035_DRIVER_OUTPUT_CTL, (CONFIG_LQ035Q1_LCD_MODE &
		LQ035_DRIVER_OUTPUT_MASK) | LQ035_DRIVER_OUTPUT_DEFAULT);
#endif
	Init_Ports();
	Init_DMA(dst);
	EnableDMA();
	InitTIMER0();
	InitTIMER1();
	Init_PPI();
	EnablePPI();

#ifdef CONFIG_MK_BF527_EZKIT_REV_2_1
	EnableTIMER12();
#else
	/* Frame sync 2 (VS) needs to start at least one PPI clk earlier */
	EnableTIMER1();
	/* Add Some Delay ... */
	SSYNC();
	SSYNC();
	SSYNC();
	SSYNC();

	/* now start frame sync 1 */
	EnableTIMER0();
#endif

	return 0;
}
Beispiel #6
0
int video_init(void *dst)
{
	Init_Ports();
	Init_DMA(dst);
	EnableDMA();
	Init_PPI();
	EnablePPI();

	return 0;
}
Beispiel #7
0
static void Init() {
  WORD w = bitmap->width;
  WORD h = bitmap->height;
  WORD xs = X((320 - w) / 2);
  WORD ys = Y((256 - h) / 2);

  {
    LONG lines = ReadLineCounter();
    BitmapUnpack(bitmap, BM_DISPLAYABLE);
    lines = ReadLineCounter() - lines;
    Log("Bitmap unpacking took %ld raster lines.\n", (LONG)lines);
  }

  CopInit(cp);
  CopSetupGfxSimple(cp, MODE_LORES, bitmap->depth, xs, ys, w, h);
  CopSetupBitplanes(cp, NULL, bitmap, bitmap->depth);
  CopLoadPal(cp, bitmap->palette, 0);
  CopEnd(cp);

  CopListActivate(cp);
  EnableDMA(DMAF_RASTER);
}
Beispiel #8
0
static void Init() {
  {
    LONG lines = ReadLineCounter();
    pixmap = PixmapFromPNG(image, MEMF_PUBLIC);
    lines = ReadLineCounter() - lines;
    Log("Png decoding took %ld raster lines.\n", (LONG)lines);
  }

  bitmap = NewBitmap(pixmap->width, pixmap->height, 4);
  bitmap->palette = PaletteFromPNG(image);

  {
    LONG lines = ReadLineCounter();
    c2p_1x1_4(pixmap->pixels, bitmap->planes[0], 
              pixmap->width, pixmap->height, bitmap->bplSize);
    lines = ReadLineCounter() - lines;
    Log("Chunky to planar took %ld raster lines.\n", (LONG)lines);
  }

  cp = NewCopList(100);

  {
    WORD w = bitmap->width;
    WORD h = bitmap->height;
    WORD xs = X((320 - w) / 2);
    WORD ys = Y((256 - h) / 2);

    CopInit(cp);
    CopSetupGfxSimple(cp, MODE_LORES, bitmap->depth, xs, ys, w, h);
    CopSetupBitplanes(cp, NULL, bitmap, bitmap->depth);
    CopLoadPal(cp, bitmap->palette, 0);
    CopEnd(cp);

    CopListActivate(cp);
    EnableDMA(DMAF_RASTER);
  }
}
Beispiel #9
0
int video_init(void *dst)
{

	Init_Ports();
	Init_DMA(dst);
	EnableDMA();
	InitTIMER0();
	InitTIMER1();
	Init_PPI();
	EnablePPI();

	/* Frame sync 2 (VS) needs to start at least one PPI clk earlier */
	EnableTIMER1();
	/* Add Some Delay ... */
	SSYNC();
	SSYNC();
	SSYNC();
	SSYNC();

	/* now start frame sync 1 */
	EnableTIMER0();

	return 0;
}
Beispiel #10
0
static void Init() {
  CopListActivate(cp);
  EnableDMA(DMAF_RASTER | DMAF_SPRITE);
}