[Tinyos-2-commits] CVS: tinyos-2.x/apps/BaseStationCC2420 CC2420ControlP.nc, 1.1.2.1, 1.1.2.2

Ben Greenstein bengreenstein at users.sourceforge.net
Mon Oct 30 17:07:20 PST 2006


Update of /cvsroot/tinyos/tinyos-2.x/apps/BaseStationCC2420
In directory sc8-pr-cvs10.sourceforge.net:/tmp/cvs-serv18587

Modified Files:
      Tag: tinyos-2_0_devel-BRANCH
	CC2420ControlP.nc 
Log Message:
Modified to conform to tep 3 variable naming conventions


Index: CC2420ControlP.nc
===================================================================
RCS file: /cvsroot/tinyos/tinyos-2.x/apps/BaseStationCC2420/Attic/CC2420ControlP.nc,v
retrieving revision 1.1.2.1
retrieving revision 1.1.2.2
diff -C2 -d -r1.1.2.1 -r1.1.2.2
*** CC2420ControlP.nc	30 Oct 2006 21:53:03 -0000	1.1.2.1
--- CC2420ControlP.nc	31 Oct 2006 01:07:18 -0000	1.1.2.2
***************
*** 79,90 ****
    } cc2420_control_state_t;
  
!   uint8_t m_channel = CC2420_DEF_CHANNEL;
!   uint8_t m_tx_power = CC2420_DEF_RFPOWER;
!   uint16_t m_pan = TOS_AM_GROUP;
!   uint16_t m_short_addr;
!   bool m_sync_busy;
!   task void syncDone_task();
  
!   norace cc2420_control_state_t m_state = S_VREG_STOPPED;
  
    command error_t Init.init() {
--- 79,90 ----
    } cc2420_control_state_t;
  
!   uint8_t channel = CC2420_DEF_CHANNEL;
!   uint8_t txPower = CC2420_DEF_RFPOWER;
!   uint16_t pan = TOS_AM_GROUP;
!   uint16_t shortAddress;
!   bool syncBusy;
!   task void syncDoneTask();
  
!   norace cc2420_control_state_t state = S_VREG_STOPPED;
  
    command error_t Init.init() {
***************
*** 92,96 ****
      call RSTN.makeOutput();
      call VREN.makeOutput();
!     m_short_addr = call AMPacket.address();
      return SUCCESS;
    }
--- 92,96 ----
      call RSTN.makeOutput();
      call VREN.makeOutput();
!     shortAddress = call AMPacket.address();
      return SUCCESS;
    }
***************
*** 125,131 ****
    async command error_t CC2420Power.startVReg() {
      atomic {
!       if ( m_state != S_VREG_STOPPED )
  	return FAIL;
!       m_state = S_VREG_STARTING;
      }
      call VREN.set();
--- 125,131 ----
    async command error_t CC2420Power.startVReg() {
      atomic {
!       if ( state != S_VREG_STOPPED )
  	return FAIL;
!       state = S_VREG_STARTING;
      }
      call VREN.set();
***************
*** 135,140 ****
  
    async event void StartupTimer.fired() {
!     if ( m_state == S_VREG_STARTING ) {
!       m_state = S_VREG_STARTED;
        call RSTN.clr();
        call RSTN.set();
--- 135,140 ----
  
    async event void StartupTimer.fired() {
!     if ( state == S_VREG_STARTING ) {
!       state = S_VREG_STARTED;
        call RSTN.clr();
        call RSTN.set();
***************
*** 144,148 ****
  
    async command error_t CC2420Power.stopVReg() {
!     m_state = S_VREG_STOPPED;
      call RSTN.clr();
      call VREN.clr();
--- 144,148 ----
  
    async command error_t CC2420Power.stopVReg() {
!     state = S_VREG_STOPPED;
      call RSTN.clr();
      call VREN.clr();
***************
*** 153,160 ****
    async command error_t CC2420Power.startOscillator() {
      atomic {
!       if ( m_state != S_VREG_STARTED )
  	return FAIL;
  	
!       m_state = S_XOSC_STARTING;
        call IOCFG1.write( CC2420_SFDMUX_XOSC16M_STABLE << 
  			 CC2420_IOCFG1_CCAMUX );
--- 153,160 ----
    async command error_t CC2420Power.startOscillator() {
      atomic {
!       if ( state != S_VREG_STARTED )
  	return FAIL;
  	
!       state = S_XOSC_STARTING;
        call IOCFG1.write( CC2420_SFDMUX_XOSC16M_STABLE << 
  			 CC2420_IOCFG1_CCAMUX );
***************
*** 164,168 ****
  			 ( 127 << CC2420_IOCFG0_FIFOP_THR ) );
        call FSCTRL.write( ( 1 << CC2420_FSCTRL_LOCK_THR ) |
! 			 ( ( (m_channel - 11)*5+357 ) 
  			   << CC2420_FSCTRL_FREQ ) );
        call MDMCTRL0.write( ( 1 << CC2420_MDMCTRL0_RESERVED_FRAME_MODE ) |
--- 164,168 ----
  			 ( 127 << CC2420_IOCFG0_FIFOP_THR ) );
        call FSCTRL.write( ( 1 << CC2420_FSCTRL_LOCK_THR ) |
! 			 ( ( (channel - 11)*5+357 ) 
  			   << CC2420_FSCTRL_FREQ ) );
        call MDMCTRL0.write( ( 1 << CC2420_MDMCTRL0_RESERVED_FRAME_MODE ) |
***************
*** 177,183 ****
    async event void InterruptCCA.fired() {
      nxle_uint16_t id[ 2 ];
!     m_state = S_XOSC_STARTED;
!     id[ 0 ] = m_pan;
!     id[ 1 ] = m_short_addr;
      call InterruptCCA.disable();
      call IOCFG1.write( 0 );
--- 177,183 ----
    async event void InterruptCCA.fired() {
      nxle_uint16_t id[ 2 ];
!     state = S_XOSC_STARTED;
!     id[ 0 ] = pan;
!     id[ 1 ] = shortAddress;
      call InterruptCCA.disable();
      call IOCFG1.write( 0 );
***************
*** 190,196 ****
    async command error_t CC2420Power.stopOscillator() {
      atomic {
!       if ( m_state != S_XOSC_STARTED )
  	return FAIL;
!       m_state = S_VREG_STARTED;
        call SXOSCOFF.strobe();
      }
--- 190,196 ----
    async command error_t CC2420Power.stopOscillator() {
      atomic {
!       if ( state != S_XOSC_STARTED )
  	return FAIL;
!       state = S_VREG_STARTED;
        call SXOSCOFF.strobe();
      }
***************
*** 200,204 ****
    async command error_t CC2420Power.rxOn() {
      atomic {
!       if ( m_state != S_XOSC_STARTED )
  	return FAIL;
        call SRXON.strobe();
--- 200,204 ----
    async command error_t CC2420Power.rxOn() {
      atomic {
!       if ( state != S_XOSC_STARTED )
  	return FAIL;
        call SRXON.strobe();
***************
*** 209,213 ****
    async command error_t CC2420Power.rfOff() {
      atomic {  
!       if ( m_state != S_XOSC_STARTED )
  	return FAIL;
        call SRFOFF.strobe();
--- 209,213 ----
    async command error_t CC2420Power.rfOff() {
      atomic {  
!       if ( state != S_XOSC_STARTED )
  	return FAIL;
        call SRFOFF.strobe();
***************
*** 217,252 ****
  
    command uint8_t CC2420Config.getChannel() {
!     atomic return m_channel;
    }
  
!   command void CC2420Config.setChannel( uint8_t channel ) {
!     atomic m_channel = channel;
    }
  
    command uint16_t CC2420Config.getShortAddr() {
!     atomic return m_short_addr;
    }
  
    command void CC2420Config.setShortAddr( uint16_t addr ) {
!     atomic m_short_addr = addr;
    }
  
    command uint16_t CC2420Config.getPanAddr() {
!     return m_pan;
    }
  
!   command void CC2420Config.setPanAddr( uint16_t pan ) {
!     atomic m_pan = pan;
    }
  
    command error_t CC2420Config.sync() {
      atomic {
!       if ( m_sync_busy )
          return FAIL;
!       m_sync_busy = TRUE;
!       if ( m_state == S_XOSC_STARTED )
          call SyncResource.request();
        else
!         post syncDone_task();
      }
      return SUCCESS;
--- 217,252 ----
  
    command uint8_t CC2420Config.getChannel() {
!     atomic return channel;
    }
  
!   command void CC2420Config.setChannel( uint8_t chan ) {
!     atomic channel = chan;
    }
  
    command uint16_t CC2420Config.getShortAddr() {
!     atomic return shortAddress;
    }
  
    command void CC2420Config.setShortAddr( uint16_t addr ) {
!     atomic shortAddress = addr;
    }
  
    command uint16_t CC2420Config.getPanAddr() {
!     return pan;
    }
  
!   command void CC2420Config.setPanAddr( uint16_t p ) {
!     atomic pan = p;
    }
  
    command error_t CC2420Config.sync() {
      atomic {
!       if ( syncBusy )
          return FAIL;
!       syncBusy = TRUE;
!       if ( state == S_XOSC_STARTED )
          call SyncResource.request();
        else
!         post syncDoneTask();
      }
      return SUCCESS;
***************
*** 256,280 ****
  
      nxle_uint16_t id[ 2 ];
!     uint8_t channel;
  
      atomic {
!       channel = m_channel;
!       id[ 0 ] = m_pan;
!       id[ 1 ] = m_short_addr;
      }
  
      call CSN.clr();
      call FSCTRL.write( ( 1 << CC2420_FSCTRL_LOCK_THR ) |
! 		       ( ( (channel - 11)*5+357 ) << CC2420_FSCTRL_FREQ ) );
      call PANID.write( 0, (uint8_t*)id, sizeof( id ) );
      call CSN.set();
      call SyncResource.release();
      
!     post syncDone_task();
      
    }
  
!   task void syncDone_task() {
!     atomic m_sync_busy = FALSE;
      signal CC2420Config.syncDone( SUCCESS );
    }
--- 256,280 ----
  
      nxle_uint16_t id[ 2 ];
!     uint8_t chan;
  
      atomic {
!       chan = channel;
!       id[ 0 ] = pan;
!       id[ 1 ] = shortAddress;
      }
  
      call CSN.clr();
      call FSCTRL.write( ( 1 << CC2420_FSCTRL_LOCK_THR ) |
! 		       ( ( (chan - 11)*5+357 ) << CC2420_FSCTRL_FREQ ) );
      call PANID.write( 0, (uint8_t*)id, sizeof( id ) );
      call CSN.set();
      call SyncResource.release();
      
!     post syncDoneTask();
      
    }
  
!   task void syncDoneTask() {
!     atomic syncBusy = FALSE;
      signal CC2420Config.syncDone( SUCCESS );
    }



More information about the Tinyos-2-commits mailing list