main.c

来自「ADI 公司的DSP ADSP21262 EZ-KIT LITE开发板的全部源代」· C语言 代码 · 共 108 行

C
108
字号
///////////////////////////////////////////////////////////////////////////////////////
//NAME:     main.c (AMD Parallel Flash Programmer)
//DATE:     9/18/03
//PURPOSE:  Program the Parallel Flash for the ADSP-21262 Ezkit
//
//USAGE:    This file contains the main code for programming the PP flash on the
//          ADSP-21262 Ezkit lite.
//
//          If more than one file is to be programmed, either include all files in the
//          same buffer (for contiguous location), or make sure that the files will not
//          occupy any common 64K sectors in the flash, as programming the subsequent
//          buffers will erase parts of the previously programmed buffers.
//
//          For the AMD Am29LV081B the sectors occupy the following byte addresses:
//          Sector                              Address Range
//          SA0                                 0x00000 - 0x0FFFF
//          SA1                                 0x10000 - 0x1FFFF
//          SA2                                 0x20000 - 0x2FFFF
//          SA3                                 0x30000 - 0x3FFFF
//          SA4                                 0x40000 - 0x4FFFF
//          SA5                                 0x50000 - 0x5FFFF
//          SA6                                 0x60000 - 0x6FFFF
//          SA7                                 0x70000 - 0x7FFFF
//          SA8                                 0x80000 - 0x8FFFF
//          SA9                                 0x90000 - 0x9FFFF
//          SA10                                0xA0000 - 0xAFFFF
//          SA11                                0xB0000 - 0xBFFFF
//          SA12                                0xC0000 - 0xCFFFF
//          SA13                                0xD0000 - 0xDFFFF
//          SA14                                0xE0000 - 0xEFFFF
//          SA15                                0xF0000 - 0xFFFFF
//
//
////////////////////////////////////////////////////////////////////////////////////////
#include "ppflash.h"
#include <signal.h>

//Declare the destination address in the flash of the file
#define LDR_START_ADDR  0x1000000
#define S1_START_ADDR   0x1040000
#define S2_START_ADDR   0x1060000

#define SRAM_MASK 0xFFFFF
//Declare the width of the data in the file to determine the number of bytes
//Change this declaration in the LDF file also for correct packing.
#define FILE_DATA_WIDTH 16


#define ALLSEGS


//Declare a semaphore variable to use in the parallel port interrupt
int ppInterruptFlag = 0;

//Declare a variable in external memory to hold the file data to program
#pragma section("seg_extA", DMAONLY)
	section("seg_extA") int ldr_source[] = {
#include                                            "..\Sample Playback.ldr"
                                                                                      };

#pragma section("seg_extB", DMAONLY)                                                                                   
        section("seg_extB") int s1_source[] = {
#include                                        "..\samples\scanner16-48-m.dat" 
                                                                                      };

#pragma section("seg_extC", DMAONLY)        
        section("seg_extC") int s2_source[] = {
#include                                        "..\samples\allsys16-48-m.dat"  
                                                                                      };

                              
//Main routine - add calls to blockWrite for each buffer holding file data
void main()
{
    
    int* addr1;
    int* addr2;
    //Set up the interrupt for the parallel port
     interrupt(SIG_PP,ppInterruptHandler);
    //Workaround for C Runtime problem (fixed with patch released 10/03/2003)
    interrupt(SIG_SP1, SIG_IGN);

    
    
    //Call the block for each buffer holding the file data, pass the address of the
    //buffer in SRAM, the address to program to in the flash, and the number of bytes to
    //program.
    blockWrite( ldr_source,
                (int*) LDR_START_ADDR,
                sizeof(ldr_source)*FILE_DATA_WIDTH/8);
                
    writeToLEDs( 1 );                

    blockWrite( s1_source , 
                (int*)S1_START_ADDR, 
                sizeof(s1_source)*FILE_DATA_WIDTH/8);

    writeToLEDs( 3 );                
                                
    blockWrite( s2_source , 
                (int*) S2_START_ADDR, 
                sizeof(s2_source)*FILE_DATA_WIDTH/8);
                
    writeToLEDs( 7 );                                
            
 }
 

⌨️ 快捷键说明

复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?