]> oss.titaniummirror.com Git - tinyos-2.x.git/commitdiff
Some calls to underlying STM25 sector layer use cookie addresses, instead of the...
authorliang_mike <liang_mike>
Thu, 4 Sep 2008 17:20:59 +0000 (17:20 +0000)
committerliang_mike <liang_mike>
Thu, 4 Sep 2008 17:20:59 +0000 (17:20 +0000)
tos/chips/stm25p/Stm25pLogP.nc

index 12019b56577ae8cf36c5c5a2ec71df7fbb361627..35c1cb701acbc1f4527a2f2810402b84dc798717 100644 (file)
@@ -201,7 +201,7 @@ implementation {
   
   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;
+    return (uint8_t)(( addr >> STM25P_SECTOR_SIZE_LOG2 ) % sector);
   }
 
   stm25p_addr_t calcAddr( uint8_t client, stm25p_addr_t addr  ) {
@@ -342,7 +342,7 @@ implementation {
        else {
          log_info->write_addr += sizeof( m_addr );
          m_rw_state = S_SEARCH_RECORDS;
-         call Sector.read[ id ]( log_info->write_addr, &m_header,
+         call Sector.read[ id ]( calcAddr(id, log_info->write_addr), &m_header,
                                  sizeof( m_header ) );
        }
       }
@@ -373,7 +373,7 @@ implementation {
        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,
+         call Sector.read[ id ]( calcAddr(id, log_info->read_addr), &m_header,
                                  sizeof( m_header ) );
        }
        // at or passed cookie, stop