[Tinyos-2-commits] CVS: tinyos-2.x/tos/chips/stm25p
Stm25pSectorC.nc, 1.1.2.6, 1.1.2.7 Stm25pSectorP.nc, 1.1.2.8,
1.1.2.9 Stm25pSpiP.nc, 1.1.2.8, 1.1.2.9 Storage_chip.h,
1.1.2.5, 1.1.2.6
Jonathan Hui
jwhui at users.sourceforge.net
Fri Jun 2 10:23:51 PDT 2006
Update of /cvsroot/tinyos/tinyos-2.x/tos/chips/stm25p
In directory sc8-pr-cvs10.sourceforge.net:/tmp/cvs-serv1051
Modified Files:
Tag: tinyos-2_0_devel-BRANCH
Stm25pSectorC.nc Stm25pSectorP.nc Stm25pSpiP.nc Storage_chip.h
Log Message:
Remove unnecessary code/ram in Stm25pSectorP.
Define enums for command bytes in Stm25pSpiP.
Remove storage_cookie_t definition since it is now chip-independent.
Index: Stm25pSectorC.nc
===================================================================
RCS file: /cvsroot/tinyos/tinyos-2.x/tos/chips/stm25p/Attic/Stm25pSectorC.nc,v
retrieving revision 1.1.2.6
retrieving revision 1.1.2.7
diff -C2 -d -r1.1.2.6 -r1.1.2.7
*** Stm25pSectorC.nc 15 Mar 2006 16:49:54 -0000 1.1.2.6
--- Stm25pSectorC.nc 2 Jun 2006 17:23:49 -0000 1.1.2.7
***************
*** 54,59 ****
Sector = SectorP;
Volume = SectorP;
! MainC.SoftwareInit -> SectorP;
!
components new FcfsArbiterC( "Stm25p.Volume" ) as ArbiterC;
MainC.SoftwareInit -> ArbiterC;
--- 54,58 ----
Sector = SectorP;
Volume = SectorP;
!
components new FcfsArbiterC( "Stm25p.Volume" ) as ArbiterC;
MainC.SoftwareInit -> ArbiterC;
Index: Stm25pSectorP.nc
===================================================================
RCS file: /cvsroot/tinyos/tinyos-2.x/tos/chips/stm25p/Attic/Stm25pSectorP.nc,v
retrieving revision 1.1.2.8
retrieving revision 1.1.2.9
diff -C2 -d -r1.1.2.8 -r1.1.2.9
*** Stm25pSectorP.nc 15 Mar 2006 16:49:54 -0000 1.1.2.8
--- Stm25pSectorP.nc 2 Jun 2006 17:23:49 -0000 1.1.2.9
***************
*** 40,44 ****
module Stm25pSectorP {
- provides interface Init;
provides interface SplitControl;
provides interface Resource as ClientResource[ storage_volume_t volume ];
--- 40,43 ----
***************
*** 56,62 ****
enum {
- NUM_VOLUMES = uniqueCount( "Stm25p.Volume" ),
NO_CLIENT = 0xff,
- NOT_BOUND = 0xff,
};
--- 55,59 ----
***************
*** 77,82 ****
norace stm25p_power_state_t m_power_state;
- norace storage_volume_t m_volumes[ NUM_VOLUMES ];
-
norace storage_volume_t m_client;
norace stm25p_addr_t m_addr;
--- 74,77 ----
***************
*** 91,101 ****
task void signalDone_task();
- command error_t Init.init() {
- int i;
- for ( i = 0; i < NUM_VOLUMES; i++ )
- m_volumes[ i ] = NOT_BOUND;
- return SUCCESS;
- }
-
command error_t SplitControl.start() {
error_t error = call SpiResource.request();
--- 86,89 ----
***************
*** 134,137 ****
--- 122,129 ----
}
+ uint8_t getVolumeId( uint8_t client ) {
+ return signal Volume.getVolumeId[ client ]();
+ }
+
event void SpiResource.granted() {
error_t error;
***************
*** 150,155 ****
return;
}
- if ( m_volumes[ m_client ] == NOT_BOUND )
- m_volumes[ m_client ] = signal Volume.getVolumeId[ m_client ]();
signal ClientResource.granted[ m_client ]();
}
--- 142,145 ----
***************
*** 160,164 ****
stm25p_addr_t physicalAddr( storage_volume_t v, stm25p_addr_t addr ) {
! return addr + ( (stm25p_addr_t)STM25P_VMAP[ m_volumes[ v ] ].base
<< STM25P_SECTOR_SIZE_LOG2 );
}
--- 150,154 ----
stm25p_addr_t physicalAddr( storage_volume_t v, stm25p_addr_t addr ) {
! return addr + ( (stm25p_addr_t)STM25P_VMAP[ getVolumeId( v ) ].base
<< STM25P_SECTOR_SIZE_LOG2 );
}
***************
*** 174,178 ****
command uint8_t Sector.getNumSectors[ storage_volume_t v ]() {
! return STM25P_VMAP[ m_volumes[ v ] ].size;
}
--- 164,168 ----
command uint8_t Sector.getNumSectors[ storage_volume_t v ]() {
! return STM25P_VMAP[ getVolumeId( v ) ].size;
}
***************
*** 181,187 ****
stm25p_len_t len ) {
- if ( m_volumes[ v ] == NOT_BOUND )
- return FAIL;
-
m_state = S_READ;
m_addr = addr;
--- 171,174 ----
***************
*** 202,208 ****
stm25p_len_t len ) {
- if ( m_volumes[ v ] == NOT_BOUND )
- return FAIL;
-
m_state = S_WRITE;
m_addr = addr;
--- 189,192 ----
***************
*** 229,235 ****
uint8_t num_sectors ) {
- if ( m_volumes[ v ] == NOT_BOUND )
- return FAIL;
-
m_state = S_ERASE;
m_addr = sector;
--- 213,216 ----
***************
*** 237,241 ****
m_cur_len = 0;
! return call Spi.sectorErase( STM25P_VMAP[m_volumes[v]].base + m_addr +
m_cur_len );
--- 218,222 ----
m_cur_len = 0;
! return call Spi.sectorErase( STM25P_VMAP[ getVolumeId(v) ].base + m_addr +
m_cur_len );
***************
*** 244,248 ****
async event void Spi.sectorEraseDone( uint8_t sector, error_t error ) {
if ( ++m_cur_len < m_len )
! call Spi.sectorErase( STM25P_VMAP[m_volumes[m_client]].base + m_addr +
m_cur_len );
else
--- 225,229 ----
async event void Spi.sectorEraseDone( uint8_t sector, error_t error ) {
if ( ++m_cur_len < m_len )
! call Spi.sectorErase( STM25P_VMAP[getVolumeId(m_client)].base + m_addr +
m_cur_len );
else
***************
*** 254,260 ****
stm25p_len_t len ) {
- if ( m_volumes[ v ] == NOT_BOUND )
- return FAIL;
-
m_state = S_CRC;
m_addr = addr;
--- 235,238 ----
Index: Stm25pSpiP.nc
===================================================================
RCS file: /cvsroot/tinyos/tinyos-2.x/tos/chips/stm25p/Attic/Stm25pSpiP.nc,v
retrieving revision 1.1.2.8
retrieving revision 1.1.2.9
diff -C2 -d -r1.1.2.8 -r1.1.2.9
*** Stm25pSpiP.nc 15 Mar 2006 16:49:55 -0000 1.1.2.8
--- Stm25pSpiP.nc 2 Jun 2006 17:23:49 -0000 1.1.2.9
***************
*** 63,66 ****
--- 63,69 ----
S_SECTOR_ERASE = 0xd8,
S_BULK_ERASE = 0xc7,
+ S_WRITE_ENABLE = 0x6,
+ S_POWER_ON = 0xab,
+ S_DEEP_SLEEP = 0xb9,
} stm25p_cmd_t;
***************
*** 124,133 ****
async command error_t Spi.powerDown() {
! sendCmd( 0xb9, 1 );
return SUCCESS;
}
async command error_t Spi.powerUp() {
! sendCmd( 0xab, 5 );
return SUCCESS;
}
--- 127,136 ----
async command error_t Spi.powerDown() {
! sendCmd( S_DEEP_SLEEP, 1 );
return SUCCESS;
}
async command error_t Spi.powerUp() {
! sendCmd( S_POWER_ON, 5 );
return SUCCESS;
}
***************
*** 176,180 ****
m_cmd[ 3 ] = m_addr;
if ( write )
! sendCmd( 0x6, 1 );
call CSN.clr();
call SpiPacket.send( m_cmd, NULL, cmd_len );
--- 179,183 ----
m_cmd[ 3 ] = m_addr;
if ( write )
! sendCmd( S_WRITE_ENABLE, 1 );
call CSN.clr();
call SpiPacket.send( m_cmd, NULL, cmd_len );
***************
*** 205,209 ****
m_cur_len -= len;
if ( m_cur_len ) {
! call Spi.read( m_cur_addr, m_crc_buf, calcReadLen() );
break;
}
--- 208,212 ----
m_cur_len -= len;
if ( m_cur_len ) {
! call SpiPacket.send( NULL, m_crc_buf, calcReadLen() );
break;
}
Index: Storage_chip.h
===================================================================
RCS file: /cvsroot/tinyos/tinyos-2.x/tos/chips/stm25p/Attic/Storage_chip.h,v
retrieving revision 1.1.2.5
retrieving revision 1.1.2.6
diff -C2 -d -r1.1.2.5 -r1.1.2.6
*** Storage_chip.h 28 Jan 2006 01:08:25 -0000 1.1.2.5
--- Storage_chip.h 2 Jun 2006 17:23:49 -0000 1.1.2.6
***************
*** 39,43 ****
typedef uint8_t storage_block_t;
typedef uint8_t storage_log_t;
- typedef storage_addr_t storage_cookie_t;
#endif
--- 39,42 ----
More information about the Tinyos-2-commits
mailing list