[Tinyos-2-commits] CVS: tinyos-2.x/tos/chips/stm25p Stm25pLogP.nc, 1.5, 1.6

Jonathan Hui jwhui at users.sourceforge.net
Thu Jun 7 09:14:24 PDT 2007


Update of /cvsroot/tinyos/tinyos-2.x/tos/chips/stm25p
In directory sc8-pr-cvs10.sourceforge.net:/tmp/cvs-serv21140

Modified Files:
	Stm25pLogP.nc 
Log Message:

- Check in fixes made by Guillermo De Cesco.



Index: Stm25pLogP.nc
===================================================================
RCS file: /cvsroot/tinyos/tinyos-2.x/tos/chips/stm25p/Stm25pLogP.nc,v
retrieving revision 1.5
retrieving revision 1.6
diff -C2 -d -r1.5 -r1.6
*** Stm25pLogP.nc	18 Apr 2007 15:12:45 -0000	1.5
--- Stm25pLogP.nc	7 Jun 2007 16:14:22 -0000	1.6
***************
*** 200,203 ****
--- 200,215 ----
    }
    
+   uint8_t calcSector( uint8_t client, stm25p_addr_t addr ) {
+     uint8_t sector = call Sector.getNumSectors[ client ]();
+     return (uint8_t)( addr >> STM25P_SECTOR_SIZE_LOG2 ) % sector;
+   }
+ 
+   stm25p_addr_t calcAddr( uint8_t client, stm25p_addr_t addr  ) {
+     stm25p_addr_t result = calcSector( client, addr );
+     result <<= STM25P_SECTOR_SIZE_LOG2;
+     result |= addr & STM25P_SECTOR_MASK;
+     return result;
+   }
+ 
    event void ClientResource.granted[ uint8_t id ]() {
  
***************
*** 229,238 ****
  		<<STM25P_SECTOR_SIZE_LOG2;
  	  }
! 	  m_log_info[ id ].read_addr = m_log_state[ id ].cookie & BLOCK_MASK;
  	  m_log_info[ id ].remaining = 0;
  	  m_rw_state = S_SEARCH_SEEK;
  	  if ( m_log_info[ id ].read_addr != m_log_state[ id ].cookie )
! 	    call Sector.read[ id ]( m_log_info[ id ].read_addr, &m_header,
! 				    sizeof( m_header ) );
  	  else
  	    signalDone( id, SUCCESS );
--- 241,250 ----
  		<<STM25P_SECTOR_SIZE_LOG2;
  	  }
! 	  m_log_info[ id ].read_addr = m_log_state[ id ].cookie & ~BLOCK_MASK;
  	  m_log_info[ id ].remaining = 0;
  	  m_rw_state = S_SEARCH_SEEK;
  	  if ( m_log_info[ id ].read_addr != m_log_state[ id ].cookie )
! 	    call Sector.read[ id ]( calcAddr( id, m_log_info[ id ].read_addr ),
! 				    &m_header, sizeof( m_header ) );
  	  else
  	    signalDone( id, SUCCESS );
***************
*** 256,271 ****
    }
  
-   uint8_t calcSector( uint8_t client, stm25p_addr_t addr ) {
-     uint8_t sector = call Sector.getNumSectors[ client ]();
-     return (uint8_t)( addr >> STM25P_SECTOR_SIZE_LOG2 ) % sector;
-   }
- 
-   stm25p_addr_t calcAddr( uint8_t client, stm25p_addr_t addr  ) {
-     stm25p_addr_t result = calcSector( client, addr );
-     result <<= STM25P_SECTOR_SIZE_LOG2;
-     result |= addr & STM25P_SECTOR_MASK;
-     return result;
-   }
- 
    void continueReadOp( uint8_t client ) {
      
--- 268,271 ----
***************
*** 318,322 ****
      case S_SEARCH_BLOCKS: 
        {
! 	uint8_t block = addr >> BLOCK_SIZE_LOG2;
  	// record potential starting and ending addresses
  	if ( m_addr != STM25P_INVALID_ADDRESS ) {
--- 318,322 ----
      case S_SEARCH_BLOCKS: 
        {
! 	uint16_t block = addr >> BLOCK_SIZE_LOG2;
  	// record potential starting and ending addresses
  	if ( m_addr != STM25P_INVALID_ADDRESS ) {
***************
*** 356,361 ****
  	if ( m_header != INVALID_HEADER && cur_block == new_block ) {
  	  log_info->write_addr += sizeof( m_header ) + m_header;
! 	  call Sector.read[ id ]( log_info->write_addr, &m_header,
! 				  sizeof( m_header ) );
  	}
  	// found last record
--- 356,361 ----
  	if ( m_header != INVALID_HEADER && cur_block == new_block ) {
  	  log_info->write_addr += sizeof( m_header ) + m_header;
! 	  call Sector.read[ id ]( calcAddr( id, log_info->write_addr ), 
! 				  &m_header, sizeof( m_header ) );
  	}
  	// found last record
***************
*** 371,375 ****
  	log_info->read_addr += sizeof( m_header ) + m_header;
  	// if not yet at cookie, keep searching
! 	if ( log_info->read_addr < m_log_state->cookie ) {
  	  call Sector.read[ id ]( log_info->read_addr, &m_header,
  				  sizeof( m_header ) );
--- 371,375 ----
  	log_info->read_addr += sizeof( m_header ) + m_header;
  	// if not yet at cookie, keep searching
! 	if ( log_info->read_addr < m_log_state[ id ].cookie ) {
  	  call Sector.read[ id ]( log_info->read_addr, &m_header,
  				  sizeof( m_header ) );
***************
*** 455,459 ****
        stm25p_addr_t volume_size = 
  	STM25P_SECTOR_SIZE * ( call Sector.getNumSectors[ id ]() - 1 );
!       if ( m_log_info[ id ].write_addr >= volume_size ) {
  	stm25p_addr_t read_addr = m_log_info[ id ].write_addr - volume_size;
  	if ( m_log_info[ id ].read_addr < read_addr )
--- 455,459 ----
        stm25p_addr_t volume_size = 
  	STM25P_SECTOR_SIZE * ( call Sector.getNumSectors[ id ]() - 1 );
!       if ( m_log_info[ id ].write_addr > volume_size ) {
  	stm25p_addr_t read_addr = m_log_info[ id ].write_addr - volume_size;
  	if ( m_log_info[ id ].read_addr < read_addr )



More information about the Tinyos-2-commits mailing list