libero ProASIC3 A3P250 JTAG-DirectC 源码分析三 dp_program_from

 

这里有个小发现,  通过 JTAG 接口 控制 A3P250 ,读取 idcode ,usercode  等等 指令 ,存在  BSDL 文件中 ;

image

 

https://ww1.microchip.com/downloads/aemdocuments/documents/fpga/ProductDocuments/BoardDesignFiles/a3p250_vq100.bsd

image

但是 我没有找到 编程 相关指令 ! 

只能  在  JTAG C代码 中 找到, 实现文档说明  JTAG-DirectC v2022.1 User Guide , 源码下载 DirectC | Microchip Technology  

 

/* General opcodes */
#define ISC_NOOP                    0x84u
#define DESELECT_ALL_TILES       0xC0u
/* Erase opcodes */              
#define ISC_ERASE                   0x85u

/* UROW opcodes */              
#define ISC_PROGRAM_UROW          0xA7u
#define ISC_READ_UROW              0xA8u
#define ISC_PROGRAM_RLOCK         0x8Cu

#define HIGHZ                        0x07u
#define BYPASS                     0xFFu
#define LDVPROP                  0xB4u
/* Factory row opcodes */
#define FACTORY_ADDRESS_SHIFT    0xF9u
#define READ_FACTORY                   0xBFu
 
#define ISC_PROGRAM              0x83u
#define ISC_VERIFY0                 0x8Du
#define ISC_VERIFY1                 0x8Eu
#define ISC_INCREMENT           0x87u
#define ISC_DATA_SHIFT           0x89u
#define ISC_ADDRESS_SHIFT   0xA9u
#define ISC_PROGRAM              0x83u
#define ISC_VERIFY0              0x8Du
#define ISC_VERIFY1              0x8Eu
#define ISC_INCREMENT            0x87u
#define ISC_DATA_SHIFT           0x89u
#define ISC_ADDRESS_SHIFT   0xA9u

1、

void dp_program_from(void)
{
    
    #ifdef ENABLE_DISPLAY
    dp_display_text("\r\nProgramming FlashROM...");
    #endif
    DataIndex=0U;
    global_uint1 = 0x80U; /* global_uint1 could be used in place if FromAddressMaskIndex */
    
    ucFRomAddressMask = (DPUCHAR) dp_get_bytes(FRomAddressMask_ID,0U,1U);
    /* Since RowNumber could be an 8 bit variable or 16 bit, it will wrap around */
    for (FromRowNumber = 7; FromRowNumber >= 0 ;FromRowNumber--)
    {
        if (ucFRomAddressMask & global_uint1)
        {
            global_uchar1 = (DPUCHAR)FromRowNumber;
            opcode = ISC_UFROM_ADDR_SHIFT;
            IRSCAN_in();
            DRSCAN_in(0u,3u,&global_uchar1);
            goto_jtag_state(JTAG_UPDATE_DR,0u);        
            
            
            opcode = ISC_PROGRAM_UFROM;
            IRSCAN_in();
            dp_get_and_DRSCAN_in(FRomStream_ID, FROM_ROW_BIT_LENGTH, DataIndex);
            goto_jtag_state(JTAG_RUN_TEST_IDLE,ISC_PROGRAM_UFROM_CYCLES);
            DataIndex = DataIndex + FROM_ROW_BIT_LENGTH;
            
            dp_poll_device();
            if (error_code != DPE_SUCCESS)
            {
                break;
            }
        }
        global_uint1>>=1;
    }
    
    return;
}

 

posted on 2026-01-20 14:24  所长  阅读(1)  评论(0)    收藏  举报

导航