[Tinyos-2-commits] CVS: tinyos-2.x/tos/chips/stm25p Stm25pLogP.nc,
1.1.2.3, 1.1.2.4
Jonathan Hui
jwhui at users.sourceforge.net
Tue Aug 29 08:04:50 PDT 2006
Update of /cvsroot/tinyos/tinyos-2.x/tos/chips/stm25p
In directory sc8-pr-cvs10.sourceforge.net:/tmp/cvs-serv28320
Modified Files:
Tag: tinyos-2_0_devel-BRANCH
Stm25pLogP.nc
Log Message:
Fix bug in writing data that aligns with block boundary.
Fix bug noted by Steve McKown where len returned is always zero.
Index: Stm25pLogP.nc
===================================================================
RCS file: /cvsroot/tinyos/tinyos-2.x/tos/chips/stm25p/Stm25pLogP.nc,v
retrieving revision 1.1.2.3
retrieving revision 1.1.2.4
diff -C2 -d -r1.1.2.3 -r1.1.2.4
*** Stm25pLogP.nc 15 Aug 2006 11:59:08 -0000 1.1.2.3
--- Stm25pLogP.nc 29 Aug 2006 15:04:47 -0000 1.1.2.4
***************
*** 89,93 ****
stm25p_addr_t m_addr;
uint8_t m_header;
- uint8_t m_remaining;
uint8_t m_len;
--- 89,92 ----
***************
*** 163,167 ****
if ( len > MAX_RECORD_SIZE )
return ESIZE;
!
// move to next block if current block doesn't have enough space
if ( sizeof( m_header ) + len > bytes_left )
--- 162,166 ----
if ( len > MAX_RECORD_SIZE )
return ESIZE;
!
// move to next block if current block doesn't have enough space
if ( sizeof( m_header ) + len > bytes_left )
***************
*** 173,177 ****
call Sector.getNumSectors[ id ]() ) )
return ESIZE;
!
m_req.req = S_APPEND;
m_req.buf = buf;
--- 172,176 ----
call Sector.getNumSectors[ id ]() ) )
return ESIZE;
!
m_req.req = S_APPEND;
m_req.buf = buf;
***************
*** 280,284 ****
buf = &m_header;
! len = sizeof( len );
if ( m_rw_state == S_DATA ) {
--- 279,283 ----
buf = &m_header;
! len = sizeof( m_header );
if ( m_rw_state == S_DATA ) {
***************
*** 292,298 ****
buf = m_log_state[ client ].buf;
// truncate if record is shorter than requested length
! if ( m_remaining < m_len )
! m_log_state[ client ].len = m_remaining;
! len = m_len;
}
}
--- 291,298 ----
buf = m_log_state[ client ].buf;
// truncate if record is shorter than requested length
! if ( m_log_info[ client ].remaining < m_len )
! len = m_log_info[ client ].remaining;
! else
! len = m_len;
}
}
***************
*** 300,304 ****
// if on block boundary
if ( !((uint16_t)read_addr & BLOCK_MASK ) )
! read_addr += sizeof( storage_addr_t );
m_log_info[ client ].read_addr = read_addr;
--- 300,304 ----
// if on block boundary
if ( !((uint16_t)read_addr & BLOCK_MASK ) )
! read_addr += sizeof( m_addr );
m_log_info[ client ].read_addr = read_addr;
***************
*** 416,420 ****
stm25p_addr_t write_addr = m_log_info[ client ].write_addr;
! uint8_t* buf;
uint8_t len;
--- 416,420 ----
stm25p_addr_t write_addr = m_log_info[ client ].write_addr;
! void* buf;
uint8_t len;
***************
*** 423,427 ****
}
else {
! if ( m_rw_state == S_HEADER ) {
buf = &m_log_state[ client ].len;
len = sizeof( m_log_state[ client ].len );
--- 423,431 ----
}
else {
! if ( !((uint16_t)write_addr & BLOCK_MASK) ) {
! buf = &m_log_info[ client ].write_addr;
! len = sizeof( m_addr );
! }
! else if ( m_rw_state == S_HEADER ) {
buf = &m_log_state[ client ].len;
len = sizeof( m_log_state[ client ].len );
More information about the Tinyos-2-commits
mailing list