[Tinyos-contrib-commits]
CVS: tinyos-1.x/contrib/imote2/tos/sensorboards/BasicSensorboard
BPAppDSPM.nc, NONE, 1.1 SensorboardC.nc, NONE,
1.1 BasicSensorboardAccelDataM.nc, 1.1,
1.2 BasicSensorboardManagerM.nc, 1.1, 1.2
Lama Nachman
lnachman at users.sourceforge.net
Sun Mar 4 23:29:21 PST 2007
- Previous message: [Tinyos-contrib-commits]
CVS: tinyos-1.x/contrib/imote2/tos/sensorboards/Common
CoarseDecimationM.nc, 1.1, 1.2
- Next message: [Tinyos-contrib-commits]
CVS: tinyos-1.x/contrib/imote2/tos/sensorboards/Framework
SensorboardFrameworkC.nc, NONE, 1.1 SensorboardFrameworkM.nc,
NONE, 1.1 BoardManager.nc, 1.1, 1.2 ChannelManager.nc, 1.1,
1.2 ChannelManagerM.nc, 1.1, 1.2 ChannelParamsManagerM.nc, 1.1,
1.2 SensorData.nc, 1.1, 1.2 TriggerManager.nc, 1.1,
1.2 TriggerManagerM.nc, 1.1, 1.2 sensorTypes.h, 1.1, 1.2
- Messages sorted by:
[ date ]
[ thread ]
[ subject ]
[ author ]
Update of /cvsroot/tinyos/tinyos-1.x/contrib/imote2/tos/sensorboards/BasicSensorboard
In directory sc8-pr-cvs10.sourceforge.net:/tmp/cvs-serv1178/BasicSensorboard
Modified Files:
BasicSensorboardAccelDataM.nc BasicSensorboardManagerM.nc
Added Files:
BPAppDSPM.nc SensorboardC.nc
Log Message:
Pushed out internal tree
--- NEW FILE: BPAppDSPM.nc ---
#define NUM_DSP_CHANNELS (2)
module BPAppDSPM{
provides {
interface StdControl;
interface BulkTxRx[uint8_t instance] as ProcessedData;
interface DSPManager[uint8_t instance];
}
uses {
interface BulkTxRx[uint8_t instance] as Data;
}
}
implementation {
#include "postprocessingFunctions.h"
vibStates_t gVibStates[NUM_DSP_CHANNELS];
result_t parseTypeValItem(vibStates_t *vs,sampleHeader_t *psh,TypeValItem* paramList, uint16_t whichFunction);
result_t parsePostProcessingFunction(vibStates_t *vs, sampleHeader_t *sh,TypeValItem *paramList,uint32_t function);
command result_t StdControl.init() {
return SUCCESS;
}
command result_t StdControl.start() {
return SUCCESS;
}
command result_t StdControl.stop() {
return SUCCESS;
}
command result_t DSPManager[uint8_t instance].initPostProcessing(uint8_t channel,
uint32_t samplingRate,
uint32_t numSamples,
uint8_t sampleWidth,
bool streaming,
uint32_t warmup,
uint32_t type,
uint32_t function,
TypeValItem *other){
trace(DBG_USR1,"initVibration: NumOutputPts=%d NumCaptPts=%d\r\n",
gVibState[instance].NumOutputPts, gVibState[instance].NumCaptPts);
initVibration(&gVibStates[instance], 1);
trace(DBG_USR1,"initVibration: NumRtCaptPts=%d ResampFactor=%f\r\n",
gVibState[instance].NumRtCaptPts, gVibState[instance].ResampFactor);
return FAIL;
}
command result_t DSPManager.isSupportedFunction[uint8_t instance](uint32_t function){
}
command result_t DSPManager.getDataStorageSize(uint32_t *requestedSize, uint32_t *minimumSize){
}
command result_t ProcessedData.BulkTxRx[uint8_t instance](BulkTxRxBuffer_t *TxRxBuffer, uint16_t NumBytes){
return FAIL;
}
command result_t ProcessedData.BulkTransmit[uint8_t instance](uint8_t *TxBuffer, uint16_t NumBytes){
return FAIL;
}
command result_t ProcessedData.BulkReceive[uint8_t instance](uint8_t *RxBuffer, uint16_t NumBytes){
return FAIL;
}
async event uint8_t *Data.BulkReceiveDone[uint8_t instance](uint8_t *RxBuffer, uint16_t NumBytes){
return NULL;
}
async event uint8_t *Data.BulkTransmitDone[uint8_t instance](uint8_t *TxBuffer, uint16_t NumBytes){
return NULL;
}
async event BulkTxRxBuffer_t *Data.BulkTxRxDone[uint8_t instance](BulkTxRxBuffer_t *TxRxBuffer, uint16_t NumBytes){
return NULL;
}
result_t parsePostProcessingFunction(vibStates_t *vs, sampleHeader_t *sh, TypeValItem *paramList,uint32_t function){
//make sure that things are zero'd out to help prevent again left over state and for cleanness below
vs->FftFlag = 0;
vs->GseFlag = 0;
vs->Navg = 1; //default to 1....0 and 1 averages are the same...but postprocessing code is broken at 0
switch(GET_SPECTRUM_CALC(function)){
case SPECTRUM_NONE:
break;
case SPECTRUM_FFT:
trace(DBG_USR1,"doing FFT\r\n");
vs->FftFlag = 1;
vs->GseFlag = 0;
//get FFT parameters...this will fill in NumOutputPoints
parseTypeValItem(vs,sh,paramList,FI_FUNCTION_FFT);
parseTypeValItem(vs,sh,paramList,FI_FUNCTION_AVG);
vs->WinFunc = GET_WINDOW_CALC(function);
if(vs->WinFunc > 2){
trace(DBG_USR1,"WARNING: GenericSampling.prepare passed unknown window function %d...defaulting to rect%d\r\n",
GET_WINDOW_CALC(function));
vs->WinFunc = WIN_RECTANGULAR;
}
break;
case SPECTRUM_GSE:
vs->FftFlag = 1;
vs->GseFlag = 1;
//get GSE parameters...this will fill in NumOutputPoints and the filterfrequency
parseTypeValItem(vs,sh,paramList,FI_FUNCTION_GSE);
//this will fil in the number of averages
parseTypeValItem(vs,sh,paramList,FI_FUNCTION_AVG);
vs->NumCaptPts = vs->NumOutputPts*2.56;
vs->WinFunc = GET_WINDOW_CALC(function);
if(vs->WinFunc > 2){
trace(DBG_USR1,"WARNING: GenericSampling.prepare passed unknown window function %d...defaulting to rect%d\r\n",
GET_WINDOW_CALC(function));
vs->WinFunc = WIN_RECTANGULAR;
}
break;
default:
trace(DBG_USR1,"WARNING: GenericSampling.prepare postprocessing function contains invalid SpectrumCalc %d\r\n",
GET_SPECTRUM_CALC(function));
}
return SUCCESS;
}
#endif
result_t parseTypeValItem(vibStates_t *vs,sampleHeader_t *sh,TypeValItem* paramList, uint16_t whichFunction){
int i;
for(i=0; i<paramList->count;i++){
switch(paramList->functionInfo[i].function){
case FI_FUNCTION_BOARD:
if(whichFunction == FI_FUNCTION_BOARD){
default:
break; //ignore FI_FUNCTION_BOARD parameters here
}
}
break;
case FI_FUNCTION_FFT:
if(whichFunction == FI_FUNCTION_FFT){
if(vs==NULL){
trace(DBG_USR1,"ASSERT: GenericSampling.parseTypeValItem passed NULL VibrationState pointer\r\n");
return FAIL;
}
if(sh==NULL){
trace(DBG_USR1,"ASSERT: GenericSampling.parseTypeValItem passed NULL SamplingHeader pointer\r\n");
return FAIL;
}
switch(paramList->functionInfo[i].paramname) {
case FIF_FFT_NUMOUTPUTSAMPLES:
vs->NumOutputPts = paramList->functionInfo[i].paramval;
sh->numSamples = paramList->functionInfo[i].paramval;
trace(DBG_USR1,"FFT will have %d outputpoints\r\n",vs->NumOutputPts);
break;
default:
}
}
break;
case FI_FUNCTION_GSE:
if(whichFunction == FI_FUNCTION_GSE){
if(vs==NULL){
trace(DBG_USR1,"ASSERT: GenericSampling.parseTypeValItem passed NULL vibStates pointer\r\n");
return FAIL;
}
if(sh==NULL){
trace(DBG_USR1,"ASSERT: GenericSampling.parseTypeValItem passed NULL sampleHeader pointer\r\n");
return FAIL;
}
switch(paramList->functionInfo[i].paramname) {
case FIF_GSE_FILTERFREQ:
trace(DBG_USR1,"WARNING: GenericSampling.prepare unable to utilize filterfreq %d for gSE measurement\r\n",
paramList->functionInfo[i].paramval);
sh->gSEFilterType = paramList->functionInfo[i].paramval;
break;
default:
}
}
break;
case FI_FUNCTION_AVG:
if(whichFunction == FI_FUNCTION_AVG){
if(vs==NULL){
trace(DBG_USR1,"ASSERT: GenericSampling.parseTypeValItem passed NULL SamplingHeader pointer\r\n");
return FAIL;
}
switch(paramList->functionInfo[i].paramname) {
case FIF_AVG_NUMAVERAGES:
vs->Navg = paramList->functionInfo[i].paramval;
trace(DBG_USR1,"PostProcessing will do %d averages\r\n",vs->Navg);
break;
default:
}
}
break;
default:
trace(DBG_USR1,"WARNING: GenericSampling.prepare passed unknown TypeValItem.functionInfo[i].function");
}
}
return SUCCESS;
}
}
--- NEW FILE: SensorboardC.nc ---
/**
*
*@author Robbie Adler
*
**/
configuration SensorboardC{
provides {
interface StdControl;
interface GenericSampling;
}
uses{
interface BufferManagement;
interface WriteData;
}
}
implementation {
components SensorboardFrameworkC,
BasicSensorboardAccelDataC as DataChan1,
//BasicSensorboardADCDataC as DataChan2,
PMICC,
BasicSensorboardManagerM as BoardManagerM;
StdControl = SensorboardFrameworkC;
GenericSampling = SensorboardFrameworkC;
BufferManagement = SensorboardFrameworkC;
WriteData = SensorboardFrameworkC;
SensorboardFrameworkC.BoardManager -> BoardManagerM;
BoardManagerM.AccelDataControl -> DataChan1;
BoardManagerM.PMIC -> PMICC;
//data channel components get wired into the parameterized
//SensorData interface instance that corresponds to their
//data channel #. Typically, SensorData[0] will be wired into
//a dummyData Component, but this is usage defined.
SensorboardFrameworkC.SensorData[1] -> DataChan1;
}
Index: BasicSensorboardAccelDataM.nc
===================================================================
RCS file: /cvsroot/tinyos/tinyos-1.x/contrib/imote2/tos/sensorboards/BasicSensorboard/BasicSensorboardAccelDataM.nc,v
retrieving revision 1.1
retrieving revision 1.2
diff -C2 -d -r1.1 -r1.2
*** BasicSensorboardAccelDataM.nc 25 Oct 2006 15:03:50 -0000 1.1
--- BasicSensorboardAccelDataM.nc 5 Mar 2007 07:29:19 -0000 1.2
***************
*** 19,23 ****
#define ACCEL_CMD_BLOCK_SIZE 1
#define SPEED 0
!
--- 19,23 ----
#define ACCEL_CMD_BLOCK_SIZE 1
#define SPEED 0
! #define LSB_SIZE (1/1024.0)
***************
*** 63,67 ****
uint8_t gTotalInitCommands = sizeof(AccelInitCmds)/sizeof(AccelCmd_t);
uint8_t gTotalReadCommands = sizeof(AccelReadCmds)/sizeof(AccelCmd_t);
!
void AccelInit();
void AccelRead();
--- 63,67 ----
uint8_t gTotalInitCommands = sizeof(AccelInitCmds)/sizeof(AccelCmd_t);
uint8_t gTotalReadCommands = sizeof(AccelReadCmds)/sizeof(AccelCmd_t);
!
void AccelInit();
void AccelRead();
***************
*** 107,110 ****
--- 107,118 ----
}
}
+
+ task void stopAcquisitionTask(){
+ //this code does not directly call StdControl.stop() in order to protect against separate paths through
+ //that function
+ trace(DBG_USR1,"AccelDataM.stopping acquisition...changing clk to 13M\r\n");
+ call RDYInterrupt.disable();
+ signal SensorData.getSensorDataStopped();
+ }
command result_t StdControl.stop() {
***************
*** 198,202 ****
AccelRead();
}
-
}
--- 206,209 ----
***************
*** 270,278 ****
if((gAccelRxBufferPos*2) >= gAccelRxNumBytes){
//we're done
! if((gAccelRxBuffer = (uint16_t *) signal SensorData.getSensorDataDone((uint8_t *)gAccelRxBuffer, gAccelRxNumBytes/6, OSCR0, 1.0, 0.0)) != NULL){
gAccelRxBufferPos = 0;
}
else{
! call StdControl.stop();
}
}
--- 277,288 ----
if((gAccelRxBufferPos*2) >= gAccelRxNumBytes){
//we're done
! if((gAccelRxBuffer = (uint16_t *) signal SensorData.getSensorDataDone((uint8_t *)gAccelRxBuffer, gAccelRxNumBytes/6, OSCR0, LSB_SIZE, 0.0)) != NULL){
gAccelRxBufferPos = 0;
}
else{
! //the fact that we're not init'ed any more means that we will no longer receive any sample interrupts...
! //this will allow us to post a task to stop the acqusition
! gAccelInitDone = FALSE;
! post stopAcquisitionTask();
}
}
Index: BasicSensorboardManagerM.nc
===================================================================
RCS file: /cvsroot/tinyos/tinyos-1.x/contrib/imote2/tos/sensorboards/BasicSensorboard/BasicSensorboardManagerM.nc,v
retrieving revision 1.1
retrieving revision 1.2
diff -C2 -d -r1.1 -r1.2
*** BasicSensorboardManagerM.nc 25 Oct 2006 15:03:51 -0000 1.1
--- BasicSensorboardManagerM.nc 5 Mar 2007 07:29:19 -0000 1.2
***************
*** 20,28 ****
implementation{
#include "pmic.h"
command result_t BoardManager.enableChannelsToBeSampled(uint8_t numChannels, uint8_t *channelList){
int i;
-
for(i=0;i<numChannels;i++){
switch(channelList[i]){
--- 20,49 ----
implementation{
+ #include "paramtask.h"
#include "pmic.h"
+ void signalEnableChannelsToBeSampledDone(uint32_t arg);
+ DEFINE_PARAMTASK(signalEnableChannelsToBeSampledDone);
+
+ typedef struct{
+ uint8_t numChannels;
+ uint8_t *channelList;
+ } channelList_t;
+
+ channelList_t gChannelList;
+ bool gChannelListInUse;
+
+ void signalEnableChannelsToBeSampledDone(uint32_t arg){
+ channelList_t *pCL = (channelList_t *)arg;
+ assert(pCL->channelList);
+ assert(pCL->numChannels > 0);
+ signal BoardManager.enableChannelsToBeSampledDone(pCL->numChannels, pCL->channelList);
+ free(pCL->channelList);
+ pCL->channelList = NULL;
+ gChannelListInUse = FALSE;
+ }
+
command result_t BoardManager.enableChannelsToBeSampled(uint8_t numChannels, uint8_t *channelList){
int i;
for(i=0;i<numChannels;i++){
switch(channelList[i]){
***************
*** 31,37 ****
--- 52,73 ----
break;
default:
+ trace(DBG_USR1,
+ "ERROR: BasicSensorboardMangerM.enableChannelsToBeSampled passed unknown channel %d\r\n",
+ channelList[i]);
+ return FAIL;
break;
}
}
+
+ //save the channelList for later so that we can signal out of this path just in case there is a dependency
+ assert(gChannelListInUse == FALSE);
+ gChannelList.numChannels = numChannels;
+ gChannelList.channelList = malloc(numChannels);
+ assert(gChannelList.channelList);
+ memcpy(gChannelList.channelList,channelList,numChannels);
+ gChannelListInUse = TRUE;
+
+ POST_PARAMTASK(signalEnableChannelsToBeSampledDone,&gChannelList);
+
return SUCCESS;
}
- Previous message: [Tinyos-contrib-commits]
CVS: tinyos-1.x/contrib/imote2/tos/sensorboards/Common
CoarseDecimationM.nc, 1.1, 1.2
- Next message: [Tinyos-contrib-commits]
CVS: tinyos-1.x/contrib/imote2/tos/sensorboards/Framework
SensorboardFrameworkC.nc, NONE, 1.1 SensorboardFrameworkM.nc,
NONE, 1.1 BoardManager.nc, 1.1, 1.2 ChannelManager.nc, 1.1,
1.2 ChannelManagerM.nc, 1.1, 1.2 ChannelParamsManagerM.nc, 1.1,
1.2 SensorData.nc, 1.1, 1.2 TriggerManager.nc, 1.1,
1.2 TriggerManagerM.nc, 1.1, 1.2 sensorTypes.h, 1.1, 1.2
- Messages sorted by:
[ date ]
[ thread ]
[ subject ]
[ author ]
More information about the Tinyos-contrib-commits
mailing list