示例#1
0
static urj_bus_t *
bf537_stamp_bus_new (urj_chain_t *chain, const urj_bus_driver_t *driver,
                     const urj_param_t *cmd_params[])
{
    urj_bus_t *bus;
    bfin_bus_params_t *params;
    int failed = 0;

    bus = urj_bus_generic_new (chain, driver, sizeof (bus_params_t));
    if (bus == NULL)
        return NULL;

    params = bus->params;
    params->async_size = 4 * 1024 * 1024;
    params->ams_cnt = 4;
    params->abe_cnt = 2;
    params->addr_cnt = 19;
    params->data_cnt = 16;
    params->sdram = 1;
    failed |= bfin_bus_new (bus, cmd_params, bf537_stamp_defaults);

    if (failed)
    {
        urj_bus_generic_free (bus);
        return NULL;
    }

    return bus;
}
示例#2
0
static urj_bus_t *
bf561_ezkit_bus_new (urj_chain_t *chain, const urj_bus_driver_t *driver,
                     const urj_param_t *cmd_params[])
{
    urj_bus_t *bus;
    urj_part_t *part;
    bfin_bus_params_t *params;
    int failed = 0;

    bus = urj_bus_generic_new (chain, driver, sizeof (bus_params_t));
    if (bus == NULL)
        return NULL;
    part = bus->part;

    params = bus->params;
    params->async_size = 64 * 1024 * 1024;
    params->ams_cnt = 4;
    params->abe_cnt = 4;
    params->addr_cnt = 24;
    params->data_cnt = 32;
    params->sdram = 1;
    params->sms_cnt = 4;
    failed |= bfin_bus_new (bus);

    if (failed)
    {
        urj_bus_generic_free (bus);
        return NULL;
    }

    return bus;
}
示例#3
0
static urj_bus_t *
bf533_stamp_bus_new (urj_chain_t *chain, const urj_bus_driver_t *driver,
                     const urj_param_t *cmd_params[])
{
    urj_bus_t *bus;
    urj_part_t *part;
    bfin_bus_params_t *params;
    int failed = 0;

    bus = urj_bus_generic_new (chain, driver, sizeof (bus_params_t));
    if (bus == NULL)
        return NULL;
    part = bus->part;

    params = bus->params;
    params->async_size = 4 * 1024 * 1024;
    params->ams_cnt = 4;
    params->abe_cnt = 2;
    params->addr_cnt = 19;
    params->data_cnt = 16;
    params->select_flash = bf533_stamp_select_flash;
    params->unselect_flash = bf533_stamp_unselect_flash;
    params->sdram = 1;
    failed |= bfin_bus_new (bus, cmd_params, NULL);

    failed |= urj_bus_generic_attach_sig (part, &PF[0], "PF0");
    failed |= urj_bus_generic_attach_sig (part, &PF[1], "PF1");

    if (failed)
    {
        urj_bus_generic_free (bus);
        return NULL;
    }

    return bus;
}
示例#4
0
文件: avr32.c 项目: klammerj/urjtag
/**
 * bus->driver->(*new_bus)
 *
 */
static urj_bus_t *
avr32_bus_new (urj_chain_t *chain, const urj_bus_driver_t *driver,
               const urj_param_t *cmd_params[])
{
    urj_bus_t *bus;
    urj_part_t *part;
    unsigned int mode = BUS_MODE_ERROR;

    if (cmd_params[0] == NULL)
    {
        urj_error_set (URJ_ERROR_SYNTAX, "no bus mode specified");
        return NULL;
    }

    if (cmd_params[1] != NULL)
    {
        urj_error_set (URJ_ERROR_SYNTAX, "invalid bus parameter: %s",
                       urj_param_string(&urj_bus_param_list, cmd_params[1]));
        return NULL;
    }

    bus = urj_bus_generic_new (chain, driver, sizeof (bus_params_t));
    if (bus == NULL)
        return NULL;
    part = bus->part;

    switch (cmd_params[0]->key)
    {
    case URJ_BUS_PARAM_KEY_OCD:
        mode = BUS_MODE_OCD;
        break;
    case URJ_BUS_PARAM_KEY_HSBC:
        mode = BUS_MODE_HSBC;
        break;
    case URJ_BUS_PARAM_KEY_HSBU:
        mode = BUS_MODE_HSBU;
        break;
    case URJ_BUS_PARAM_KEY_X8:          // see also: width=8
        mode = BUS_MODE_x8;
        break;
    case URJ_BUS_PARAM_KEY_X16:         // see also: width=16
        mode = BUS_MODE_x16;
        break;
    case URJ_BUS_PARAM_KEY_X32:         // see also: width=32
        mode = BUS_MODE_x32;
        break;

    // RFHH introduced 'width=8|16|32' as an alias for x8, x16, x32
    case URJ_BUS_PARAM_KEY_WIDTH:
        switch (cmd_params[0]->value.lu)
        {
        case 8:
            mode = BUS_MODE_x8;
            break;
        case 16:
            mode = BUS_MODE_x16;
            break;
        case 32:
            mode = BUS_MODE_x32;
            break;
        default:
            urj_bus_generic_free (bus);
            urj_error_set (URJ_ERROR_SYNTAX, "invalid bus width: %lu",
                           cmd_params[0]->value.lu);
            return NULL;
        }
        break;

    default:
        urj_bus_generic_free (bus);
        urj_error_set (URJ_ERROR_SYNTAX, "invalid bus mode: %s",
                       urj_param_string(&urj_bus_param_list, cmd_params[0]));
        return NULL;
    }

    switch (mode)
    {
    case BUS_MODE_OCD:
    case BUS_MODE_HSBC:
    case BUS_MODE_HSBU:
        if (check_instruction (part, "MEMORY_WORD_ACCESS"))
        {
            urj_bus_generic_free (bus);
            return NULL;
        }
        break;
    case BUS_MODE_x8:
    case BUS_MODE_x16:
    case BUS_MODE_x32:
        if (check_instruction (part, "NEXUS_ACCESS"))
        {
            urj_bus_generic_free (bus);
            return NULL;
        }
        break;
    default:
        urj_error_set (URJ_ERROR_INVALID, "need bus mode parameter");
        urj_bus_generic_free (bus);
        return NULL;
    }

    avr32_bus_setup (bus, chain, part, mode);

    return bus;
}
示例#5
0
文件: mpc837x.c 项目: cktben/urjtag
static urj_bus_t *
mpc837x_bus_new( urj_chain_t *chain, const urj_bus_driver_t *driver, const urj_param_t *cmd_params[] )
{
	urj_bus_t *bus;
	bus_params_t *bp;
	urj_part_t *part;
	char buff[10];
	int i;
	int failed = 0;


	bus = urj_bus_generic_new (chain, driver, sizeof (bus_params_t));
	if (bus == NULL)
		return NULL;

	part = bus->part;
	bp = bus->params;
	
	/* default values	*/	
	bp->lbc_muxed = 0;
	bp->lbc_num_d = 8;
	bp->lbc_num_ad = 25;
	
	for (i = 0; cmd_params[i] != NULL; i++)
	{
	    switch (cmd_params[i]->key)
	    {
	    case URJ_BUS_PARAM_KEY_HELP:
		urj_bus_generic_free (bus);
		urj_log (URJ_LOG_LEVEL_NORMAL,
			_("Usage: initbus mpc837x [mux] [width=WIDTH]\n"	\
			"            MUX        multiplexed data bus (default no)\n"	\
			"            WIDTH      data bus width - 8, 16, 32 (default 8)\n"));
		return NULL;
	    case URJ_BUS_PARAM_KEY_MUX:
		bp->lbc_muxed = 1;
		break;
	    case URJ_BUS_PARAM_KEY_WIDTH:
		switch (cmd_params[i]->value.lu)
		{
		case 8:
		    bp->lbc_num_d = 8;
		    break;
		case 16:
		    bp->lbc_num_d = 16;
		    break;
		case 32:
		    bp->lbc_num_d = 32;
		    break;
		default:
		    urj_error_set (URJ_ERROR_UNSUPPORTED,
				_("    Only 8, 16, 32 bus width are suported\n")); 
		}
		break;
	    default:
		urj_bus_generic_free (bus);
		urj_error_set (URJ_ERROR_SYNTAX, "unrecognised bus parameter '%s'",	\
			    urj_param_string(&urj_bus_param_list, cmd_params[i]));
		return NULL;
	    }
	}
	
	if ((!bp->lbc_muxed) && (bp->lbc_num_d > 16))
	{
	    urj_bus_generic_free (bus);
    	    urj_error_set (URJ_ERROR_UNSUPPORTED,
		_("    Only 8 and 16 non multiplexed bus width are suported\n")); 
	    return NULL;
	}
	
	if (bp->lbc_muxed)
	    bp->lbc_num_ad = 32;	

	/* Get the signals */
	if (bp->lbc_muxed) 
	{
	    failed |= urj_bus_generic_attach_sig( part, &(ALE), "LALE" );
	    for (i = 0; i < LBC_NUM_LAD; i++) {
		sprintf( buff, "LAD%d", i );
	        failed |= urj_bus_generic_attach_sig( part, &(LAD[i]), buff );
	    }	
	}
	else
	{
	    failed |= urj_bus_generic_attach_sig( part, &(LA[7]),  "LDP2" );
    	    failed |= urj_bus_generic_attach_sig( part, &(LA[8]),  "LDP3" );
	    failed |= urj_bus_generic_attach_sig( part, &(LA[9]),  "LGPL5" );
	    failed |= urj_bus_generic_attach_sig( part, &(LA[10]), "LALE" );
	    for (i = 11; i < 27; i++) {
	        sprintf( buff, "LAD%d", i + 5 );
	        failed |= urj_bus_generic_attach_sig( part, &(LA[i]), buff );		
	    }	    
	}
		
	for (i = 27; i < LBC_NUM_LAD; i++) {
		sprintf( buff, "LA%d", i );
		failed |= urj_bus_generic_attach_sig( part, &(LA[i]), buff );
	}

	for (i = 0; i < LBC_NUM_LCS; i++) {
		sprintf( buff, "LCS_B%d", i );
		failed |= urj_bus_generic_attach_sig( part, &(nCS[i]), buff );
	}

	for (i = 0; i < LBC_NUM_LWE; i++) {
		sprintf( buff, "LWE_B%d", i );
		failed |= urj_bus_generic_attach_sig( part, &(nWE[i]), buff );
	}

	failed |= urj_bus_generic_attach_sig( part, &(nOE), "LGPL2" );
	failed |= urj_bus_generic_attach_sig( part, &(BCTL), "LBCTL" );

	if (failed) {
	    urj_bus_generic_free (bus);
	    return NULL;
	}

	urj_log(URJ_LOG_LEVEL_NORMAL, 
		"%sMUXed %db address, %db data bus\n", 
		((bp->lbc_muxed) ? "" : "Non-"), bp->lbc_num_ad, bp->lbc_num_d);

	return bus;
}