Beispiel #1
0
/**
**  @brief
**    ROM/SRAM/FlashPage Write Access Timing
*/
static void
s3c4510_bus_write( bus_t *bus, uint32_t adr, uint32_t data )
{
        /* see Figure 4-21 in [1] */
        part_t *p = PART;
        chain_t *chain = CHAIN;

        part_set_signal( p, nRCS[0], 1, 0 );
        part_set_signal( p, nRCS[1], 1, 1 );
        part_set_signal( p, nRCS[2], 1, 1 );
        part_set_signal( p, nRCS[3], 1, 1 );
        part_set_signal( p, nRCS[4], 1, 1 );
        part_set_signal( p, nRCS[5], 1, 1 );
        part_set_signal( p, nWBE[0], 1, 1 );
        part_set_signal( p, nWBE[1], 1, 1 );
        part_set_signal( p, nWBE[2], 1, 1 );
        part_set_signal( p, nWBE[3], 1, 1 );
        part_set_signal( p, nOE, 1, 1 );

        setup_address( bus, adr );
        setup_data( bus, data );

        chain_shift_data_registers( chain, 0 );

        part_set_signal( p, nWBE[0], 1, 0 );
        chain_shift_data_registers( chain, 0 );
        part_set_signal( p, nWBE[0], 1, 1 );
        part_set_signal( p, nRCS[0], 1, 1 );
        part_set_signal( p, nRCS[1], 1, 1 );
        part_set_signal( p, nRCS[2], 1, 1 );
        part_set_signal( p, nRCS[3], 1, 1 );
        part_set_signal( p, nRCS[4], 1, 1 );
        part_set_signal( p, nRCS[5], 1, 1 );
        chain_shift_data_registers( chain, 0 );
}
Beispiel #2
0
void
sa1110_bus_write( parts *ps, uint32_t adr, uint32_t data )
{
	/* see Figure 10-16 in SA doc */
	part *p = ps->parts[0];

	if ( (adr==0x49000000) && (data==1) ) {
		part_set_signal( p, "nCS0", 1, 1 );
		part_set_signal( p, "nCS5", 1, 0 );
	} else {
		part_set_signal( p, "nCS0", 1, 0 );
		part_set_signal( p, "nCS5", 1, 1 );
	}
	part_set_signal( p, "nCS1", 1, 1 );
	part_set_signal( p, "nCS2", 1, 1 );
	part_set_signal( p, "nCS3", 1, 1 );
	part_set_signal( p, "nCS4", 1, 1 );
	part_set_signal( p, "RD_nWR", 1, 0 );
	part_set_signal( p, "nWE", 1, 1 );
	part_set_signal( p, "nOE", 1, 1 );

	setup_address( p, adr );
	setup_data( p, data );

	parts_shift_data_registers( ps );

	part_set_signal( p, "nWE", 1, 0 );
	parts_shift_data_registers( ps );
	part_set_signal( p, "nWE", 1, 1 );
	parts_shift_data_registers( ps );
	part_set_signal( p, "nCS0", 1, 1 );
	part_set_signal( p, "nCS5", 1, 1 );
	parts_shift_data_registers( ps );
}
Beispiel #3
0
/**
 * bus->driver->(*read_next)
 *
 */
static uint32_t
jopcyc_bus_read_next( bus_t *bus, uint32_t adr )
{
	part_t *p = PART;
	chain_t *chain = CHAIN;
	int i;
	uint32_t d = 0;
	bus_area_t area;
	component_t *comp;

	comp_bus_area( bus, adr, &area, &comp );
	if (!comp) {
		printf( _("Address out of range\n") );
		LAST_ADDR = adr;
		return 0;
	}

	setup_address( bus, adr, comp );
	chain_shift_data_registers( chain, 1 );

	for (i = 0; i < area.width; i++)
		d |= (uint32_t) (part_get_signal( p, D[i] ) << i);

	return d;
}
Beispiel #4
0
/**
 * bus->driver->(*read_start)
 *
 */
static void
sh7750r_bus_read_start( bus_t *bus, uint32_t adr )
{
    part_t *p = PART;
    int cs[8];
    int i;

    for (i = 0; i < 8; i++)
        cs[i] = 1;
    cs[(adr & 0x1C000000) >> 26] = 0;

    part_set_signal( p, CS[0], 1, cs[0] );
    part_set_signal( p, CS[1], 1, cs[1] );
    part_set_signal( p, CS[2], 1, cs[2] );
    part_set_signal( p, CS[3], 1, cs[3] );
    part_set_signal( p, CS[4], 1, cs[4] );
    part_set_signal( p, CS[5], 1, cs[5] );
    part_set_signal( p, CS[6], 1, cs[6] );
    part_set_signal( p, RDWR, 1, 1 );
    part_set_signal( p, RDWR2, 1, 1 );
    part_set_signal( p, WE[0], 1, 1 );
    part_set_signal( p, WE[1], 1, 1 );
    part_set_signal( p, WE[2], 1, 1 );
    part_set_signal( p, WE[3], 1, 1 );
    part_set_signal( p, RD, 1, 0 );
    part_set_signal( p, RD2, 1, 0 );

    setup_address( bus, adr );
    set_data_in( bus );
    chain_shift_data_registers( CHAIN, 0 );
}
Beispiel #5
0
/**
 * bus->driver->(*read_start)
 *
 */
static void
jopcyc_bus_read_start( bus_t *bus, uint32_t adr )
{
	part_t *p = PART;
	chain_t *chain = CHAIN;
	bus_area_t area;
	component_t *comp;

	comp_bus_area( bus, adr, &area, &comp );
	if (!comp) {
		printf( _("Address out of range\n") );
		LAST_ADDR = adr;
		return;
	}

	part_set_signal( p, nCS, 1, 0 );
	part_set_signal( p, nWE, 1, 1 );
	part_set_signal( p, nOE, 1, 0 );
	if (comp->ctype == RAM) {
		part_set_signal( p, nLB, 1, 0 );
		part_set_signal( p, nUB, 1, 0 );
	}

	setup_address( bus, adr, comp );
	set_data_in( bus, comp );

	chain_shift_data_registers( chain, 0 );
}
Beispiel #6
0
/**
 * bus->driver->(*read_next)
 *
 */
static uint32_t
sharc_21065L_bus_read_next( bus_t *bus, uint32_t adr )
{
	part_t *p = PART;
	chain_t *chain = CHAIN;
	uint32_t d;
	//uint32_t old_last_adr = LAST_ADR;

	LAST_ADR = adr;

	if (adr < UINT32_C(0x080000)) {
		int i;
		bus_area_t area;

		sharc_21065L_bus_area( bus, adr, &area );


		setup_address( bus, adr );
		chain_shift_data_registers( chain, 1 );

		d = 0;
		for (i = 0; i < area.width; i++)
			d |= (uint32_t) (part_get_signal( p, MD[i] ) << i);

		return d;
	}
	return 0;
}
Beispiel #7
0
/**
 * bus->driver->(*read_start)
 *
 */
static void
s3c4510_bus_read_start( bus_t *bus, uint32_t adr )
{
        /* see Figure 4-19 in [1] */
        chain_t *chain = CHAIN;

	s3c4510_bus_setup_ctrl( bus, 0x00fffe);  /* nOE=0, nRCS0 =0 */
        setup_address( bus, adr );
        set_data_in( bus );
        chain_shift_data_registers( chain, 0 );
}
Beispiel #8
0
/**
 * bus->driver->(*write)
 *
 *  @brief
 *    ROM/SRAM/FlashPage Write Access Timing
 */
static void
s3c4510_bus_write( bus_t *bus, uint32_t adr, uint32_t data )
{
        /* see Figure 4-21 in [1] */
        chain_t *chain = CHAIN;

	s3c4510_bus_setup_ctrl( bus, 0x01fffe);  /* nOE=1, nRCS0 =0 */
        setup_address( bus, adr );
        setup_data( bus, data );

        chain_shift_data_registers( chain, 0 );

	switch (dbus_width)
	{
	    default:
	    case 8:
		    s3c4510_bus_setup_ctrl( bus, 0x01fefe);  /* nOE=1, nRCS0 =0, nWBE0=0 */
		    break;
	    case 16:
		    s3c4510_bus_setup_ctrl( bus, 0x01fcfe);  /* nOE=1, nRCS0 =0, nWBE0-1=0 */
		    break;

	    case 32:
		    s3c4510_bus_setup_ctrl( bus, 0x01f0fe);  /* nOE=1, nRCS0 =0, nWBE0-3=0 */
		    break;
	}

        setup_address( bus, adr );
        setup_data( bus, data );

        chain_shift_data_registers( chain, 0 );

	s3c4510_bus_setup_ctrl( bus, 0x01ffff);  /* nOE=1, nRCS0 =1 */
        chain_shift_data_registers( chain, 0 );

	DEBUG_LVL2( printf("bus_write %08x @ %08x\n", data, adr); )
}
Beispiel #9
0
/**
 * bus->driver->(*read_next)
 *
 */
static uint32_t
sh7750r_bus_read_next( bus_t *bus, uint32_t adr )
{
    part_t *p = PART;
    int i;
    uint32_t d = 0;

    setup_address( bus, adr );
    chain_shift_data_registers( CHAIN, 1 );

    for (i = 0; i < 32; i++)
        d |= (uint32_t) (part_get_signal( p, D[i] ) << i);

    return d;
}
Beispiel #10
0
static void
ppc440gx_ebc8_bus_read_start( bus_t *bus, uint32_t adr )
{
	part_t *p = PART;
	chain_t *chain = CHAIN;

	part_set_signal( p, nCS, 1, 0 );
	part_set_signal( p, nWE, 1, 1 );
	part_set_signal( p, nOE, 1, 0 );

	setup_address( bus, adr );
	set_data_in( bus );

	chain_shift_data_registers( chain, 0 );
}
t_std_error std_server_client_connect(std_event_client_handle * handle, const char *event_channel_name) {
    std_socket_address_t addr;
    setup_address(&addr,event_channel_name);

    int sock = -1;

    t_std_error rc = std_sock_connect(&addr,&sock);
    if (rc!=STD_ERR_OK) return rc;

    std_sock_set_sndbuf(sock,SOCKET_BUFFER_SIZE);

    *handle = sock;

    return STD_ERR_OK;
}
Beispiel #12
0
/**
 * bus->driver->(*read_start)
 *
 */
static void
bf533_ezkit_bus_read_start( bus_t *bus, uint32_t adr )
{
	part_t *p = PART;
	chain_t *chain = CHAIN;

	select_flash( bus );
	part_set_signal( p, AOE, 1, 0 );
	part_set_signal( p, AWE, 1, 1 );

	setup_address( bus, adr );
	set_data_in( bus );

	chain_shift_data_registers( chain, 0 );
}
Beispiel #13
0
/**
 * bus->driver->(*read_next)
 *
 */
static uint32_t
bf533_ezkit_bus_read_next( bus_t *bus, uint32_t adr )
{
	part_t *p = PART;
	chain_t *chain = CHAIN;
	int i;
	uint32_t d = 0;

	setup_address( bus, adr );
	chain_shift_data_registers( chain, 1 );

	for (i = 0; i < 16; i++)
		d |= (uint32_t) (part_get_signal( p, DATA[i] ) << i);

	return d;
}
Beispiel #14
0
static uint32_t
s3c4510_bus_read_next( bus_t *bus, uint32_t adr )
{
        /* see Figure 4-20 in [1] */
        part_t *p = PART;
        chain_t *chain = CHAIN;
        int i;
        uint32_t d = 0;

        setup_address( bus, adr );
        chain_shift_data_registers( chain, 1 );

        for (i = 0; i < dbus_width; i++)
                d |= (uint32_t) (part_get_signal( p, D[i] ) << i);

        return d;
}
Beispiel #15
0
/**
 * bus->driver->(*write)
 *
 */
static void
sh7727_bus_write( bus_t *bus, uint32_t adr, uint32_t data )
{
	chain_t *chain = CHAIN;
	part_t *p = PART;
	int cs[8];
	int i;

	for (i = 0; i < 8 ; i++)
		cs[i] = 1;
	cs[(adr & 0x1C000000) >> 26] = 0;

	part_set_signal( p, CS[0], 1, cs[0] );
	part_set_signal( p, CS[2], 1, cs[2] );
	part_set_signal( p, CS[3], 1, cs[3] );
	part_set_signal( p, CS[4], 1, cs[4] );
	part_set_signal( p, CS[5], 1, cs[5] );
	part_set_signal( p, CS[6], 1, cs[6] );

	part_set_signal( p, RDWR, 1, 0 );
	part_set_signal( p, WE[0], 1, 1 );
	part_set_signal( p, WE[1], 1, 1 );
	part_set_signal( p, WE[2], 1, 1 );
	part_set_signal( p, WE[3], 1, 1 );
	part_set_signal( p, RD, 1, 1 );

	setup_address( bus, adr );
	setup_data( bus, data );

	chain_shift_data_registers( chain, 0 );

	part_set_signal( p, WE[0], 1, 0 );
	part_set_signal( p, WE[1], 1, 0 );
	part_set_signal( p, WE[2], 1, 0 );
	part_set_signal( p, WE[3], 1, 0 );

	chain_shift_data_registers( chain, 0 );

	part_set_signal( p, WE[0], 1, 1 );
	part_set_signal( p, WE[1], 1, 1 );
	part_set_signal( p, WE[2], 1, 1 );
	part_set_signal( p, WE[3], 1, 1 );

	chain_shift_data_registers( chain, 0 );
}
Beispiel #16
0
/**
 * bus->driver->(*read_next)
 *
 */
static uint32_t
sh7727_bus_read_next( bus_t *bus, uint32_t adr )
{
	part_t *p = PART;
	int i;
	uint32_t d = 0;
	bus_area_t area;

	sh7727_bus_area( bus, 0, &area );

	setup_address( bus, adr );
	chain_shift_data_registers( CHAIN, 1 );

	for (i = 0; i < area.width; i++)
		d |= (uint32_t) (part_get_signal( p, D[i] ) << i);

	return d;
}
Beispiel #17
0
static uint32_t
ppc440gx_ebc8_bus_read_next( bus_t *bus, uint32_t adr )
{
	part_t *p = PART;
	chain_t *chain = CHAIN;
	int i;
	uint32_t d = 0;
	bus_area_t area;

	ppc440gx_ebc8_bus_area( bus, adr, &area );

	setup_address( bus, adr );
	chain_shift_data_registers( chain, 1 );

	for (i = 0; i < area.width; i++)
		d |= (uint32_t) (part_get_signal( p, D[PPC440GX_DATA_LINES-1-i] ) << i);

	return d;
}
Beispiel #18
0
/**
 * bus->driver->(*read_start)
 *
 */
static void
sharc_21065L_bus_read_start( bus_t *bus, uint32_t adr )
{
	chain_t *chain = CHAIN;
	part_t *p = PART;

	LAST_ADR = adr;
	if (adr >= 0x080000)
		return;


	part_set_signal( p, BMS, 1, 0 );
	part_set_signal( p, nWE, 1, 1 );
	part_set_signal( p, nOE, 1, 0 );

	setup_address( bus, adr );
	set_data_in( bus, adr );

	chain_shift_data_registers( chain, 0 );
}
Beispiel #19
0
void
sa1110_bus_read_start( parts *ps, uint32_t adr )
{
	/* see Figure 10-12 in SA doc */
	part *p = ps->parts[0];

	part_set_signal( p, "nCS0", 1, 0 );
	part_set_signal( p, "nCS1", 1, 1 );
	part_set_signal( p, "nCS2", 1, 1 );
	part_set_signal( p, "nCS3", 1, 1 );
	part_set_signal( p, "nCS4", 1, 1 );
	part_set_signal( p, "nCS5", 1, 1 );
	part_set_signal( p, "RD_nWR", 1, 1 );
	part_set_signal( p, "nWE", 1, 1 );
	part_set_signal( p, "nOE", 1, 0 );

	setup_address( p, adr );
	set_data_in( p );

	parts_shift_data_registers( ps );
}
Beispiel #20
0
/**
 * bus->driver->(*write)
 *
 */
static void
bf533_ezkit_bus_write( bus_t *bus, uint32_t adr, uint32_t data )
{
	part_t *p = PART;
	chain_t *chain = CHAIN;

//	printf("Writing %04X to %08X...\n", data, adr);

	select_flash( bus );
	part_set_signal( p, AOE, 1, 1 );

	setup_address( bus, adr );
	setup_data( bus, data );

	chain_shift_data_registers( chain, 0 );

	part_set_signal( p, AWE, 1, 0 );
	chain_shift_data_registers( chain, 0 );
	part_set_signal( p, AWE, 1, 1 );
	unselect_flash( bus );
	chain_shift_data_registers( chain, 0 );
}
t_std_error std_event_server_init(std_event_server_handle_t *handle,
        const char * event_channel_name, size_t threads) {

    std_socket_event_server_t    * p = new std_socket_event_server_t;

    if (p==NULL) {
        EV_LOG(ERR,COM,0,"COM-EVENT-INIT-FAILED","Failed to initialize the event service");
        return STD_ERR(COM,NOMEM,0);
    }

    std_socket_server_t serv;
    memset(&serv,0,sizeof(serv));
    serv.context = p;
    serv.name = COM_EVT_SERV_NAME;
    serv.thread_pool_size = threads;
    serv.new_client = event_new_client;
    serv.del_client = event_del_client;
    serv.some_data = event_some_data;

    setup_address(&serv.address, event_channel_name);

    if (std_socket_service_init(&p->m_sock_service,&serv)!=STD_ERR_OK) {
        delete p;
        return STD_ERR(COM,FAIL,0);
    }

    t_std_error rc =  STD_ERR(COM,FAIL,0);

    do {
        if ((rc=std_rw_lock_create_default(&p->m_tree_lock))!=STD_ERR_OK) break;
        if (std_socket_service_run(p->m_sock_service)!=STD_ERR_OK) break;

        *handle = p;
        return rc;
    } while (0);

    delete p;
    return rc;
}
Beispiel #22
0
uint32_t
sa1110_bus_read_next( parts *ps, uint32_t adr )
{
	/* see Figure 10-12 in SA doc */
	part *p = ps->parts[0];

	setup_address( p, adr );
	parts_shift_data_registers( ps );

	{
		int i;
		char buff[10];
		uint32_t d = 0;

		for (i = 0; i < 32; i++) {
			sprintf( buff, "D%d", i );
			d |= (uint32_t) (part_get_signal( p, buff ) << i);
		}

		return d;
	}
}
Beispiel #23
0
/**
 * bus->driver->(*write)
 *
 */
static void
sharc_21065L_bus_write( bus_t *bus, uint32_t adr, uint32_t data )
{
	part_t *p = PART;
	chain_t *chain = CHAIN;

	if (adr >= 0x080000)
		return;


	part_set_signal( p, BMS, 1, 0 );
	part_set_signal( p, nWE, 1, 1 );
	part_set_signal( p, nOE, 1, 1 );

	setup_address( bus, adr );
	setup_data( bus, adr, data );

	chain_shift_data_registers( chain, 0 );

	part_set_signal( p, nWE, 1, 0 );
	chain_shift_data_registers( chain, 0 );
	part_set_signal( p, nWE, 1, 1 );
	chain_shift_data_registers( chain, 0 );
}
Beispiel #24
0
  RF24Network::RF24Network( RF24& _radio ): radio(_radio), frame_size(MAX_FRAME_SIZE)
  #else
  RF24Network::RF24Network( RF24& _radio, RF24& _radio1 ): radio(_radio), radio1(_radio1),frame_size(MAX_FRAME_SIZE)
  #endif
{
}
#elif !defined (DUAL_HEAD_RADIO)
RF24Network::RF24Network( RF24& _radio ): radio(_radio), next_frame(frame_queue) 
{
  #if !defined ( DISABLE_FRAGMENTATION )
  frag_queue.message_buffer=&frag_queue_message_buffer[0];
  frag_ptr = &frag_queue;
  #endif
}
#else
RF24Network::RF24Network( RF24& _radio, RF24& _radio1 ): radio(_radio), radio1(_radio1), next_frame(frame_queue)
{
  #if !defined ( DISABLE_FRAGMENTATION )
  frag_queue.message_buffer=&frag_queue_message_buffer[0];
  frag_ptr = &frag_queue;
  #endif
}
#endif
/******************************************************************/

void RF24Network::begin(uint8_t _channel, uint16_t _node_address )
{
  if (! is_valid_address(_node_address) )
    return;

  node_address = _node_address;

  if ( ! radio.isValid() ){
    return;
  }

  // Set up the radio the way we want it to look
  if(_channel != USE_CURRENT_CHANNEL){
    radio.setChannel(_channel);
  }
  //radio.enableDynamicAck();
  radio.setAutoAck(0,0);
  
  #if defined (ENABLE_DYNAMIC_PAYLOADS)
  radio.enableDynamicPayloads();
  #endif
  
  // Use different retry periods to reduce data collisions
  uint8_t retryVar = (((node_address % 6)+1) *2) + 3;
  radio.setRetries(retryVar, 5); // max about 85ms per attempt
  txTimeout = 25;
  routeTimeout = txTimeout*3; // Adjust for max delay per node within a single chain


#if defined (DUAL_HEAD_RADIO)
  radio1.setChannel(_channel);
  radio1.enableDynamicAck();
  radio1.enableDynamicPayloads();
#endif

  // Setup our address helper cache
  setup_address();

  // Open up all listening pipes
  uint8_t i = 6;
  while (i--){
    radio.openReadingPipe(i,pipe_address(_node_address,i));	
  }
  radio.startListening();

}

/******************************************************************/

#if defined ENABLE_NETWORK_STATS
void RF24Network::failures(uint32_t *_fails, uint32_t *_ok){
	*_fails = nFails;
	*_ok = nOK;
}
Beispiel #25
0
  RF24Network::RF24Network( RF24& _radio ): radio(_radio), frame_size(MAX_FRAME_SIZE)
  #else
  RF24Network::RF24Network( RF24& _radio, RF24& _radio1 ): radio(_radio), radio1(_radio1),frame_size(MAX_FRAME_SIZE)
  #endif
{
}
#elif !defined (DUAL_HEAD_RADIO)
RF24Network::RF24Network( RF24& _radio ): radio(_radio), next_frame(frame_queue) 
{

}
#else
RF24Network::RF24Network( RF24& _radio, RF24& _radio1 ): radio(_radio), radio1(_radio1), next_frame(frame_queue)
{
}
#endif
/******************************************************************/

void RF24Network::begin(uint8_t _channel, uint16_t _node_address )
{
  if (! is_valid_address(_node_address) )
    return;

  node_address = _node_address;

  if ( ! radio.isValid() ){
    return;
  }
  
  //radio.stopListening();
  // Set up the radio the way we want it to look
  radio.setChannel(_channel);
  radio.enableDynamicAck();
  radio.enableDynamicPayloads();

  // Use different retry periods to reduce data collisions
  uint8_t retryVar = (((node_address % 6)+1) *2) + 3;
  radio.setRetries(retryVar, 5);
  txTimeout = 25;
  routeTimeout = txTimeout*9; // Adjust for max delay per node


#if defined (DUAL_HEAD_RADIO)
  radio1.setChannel(_channel);
  radio1.enableDynamicAck();
  radio1.enableDynamicPayloads();
#endif

  // Setup our address helper cache
  setup_address();

  // Open up all listening pipes
  uint8_t i = 6;
  while (i--){
    radio.openReadingPipe(i,pipe_address(_node_address,i));	
  }

  radio.startListening();

}

/******************************************************************/

#if defined ENABLE_NETWORK_STATS
void RF24Network::failures(uint32_t *_fails, uint32_t *_ok){
	*_fails = nFails;
	*_ok = nOK;
}