Skip to content

Commit

Permalink
arch: cxd56xx: Fix SCU sensor data format
Browse files Browse the repository at this point in the history
Add offset setting for sensor data to be written to SCU math function.
Fix comments in function descriptions.
  • Loading branch information
SPRESENSE committed Aug 27, 2024
1 parent a6df724 commit e22f1e3
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 4 deletions.
2 changes: 1 addition & 1 deletion arch/arm/include/cxd56xx/scu.h
Original file line number Diff line number Diff line change
Expand Up @@ -443,7 +443,7 @@ int seq_setinstruction(struct seq_s *seq, const uint16_t *inst,
* param [in] seq : Sequencer instance
* param [in] sample : Bytes per sample
* param [in] offset : Start offset of sampling data
* param [in] elemsize : Bytes of 1 element in sample
* param [in] elemsize : Number of vector elements - 1 (e.g. 3 axis = 2)
* param [in] swapbyte : Enable/Disable byte swapping
*
* return OK(0) is success. negative value is failure.
Expand Down
10 changes: 7 additions & 3 deletions arch/arm/src/cxd56xx/cxd56_scu.c
Original file line number Diff line number Diff line change
Expand Up @@ -777,8 +777,8 @@ static void seq_setbus(int sid, int bustype)
* sid - Sequencer ID
* start - Sensor data start offset in sequencer picked
* bps - Bytes per sample
* swap - Wwap bytes
* elem - Number of elements in sample
* swap - Swap bytes
* elem - Number of vector elements - 1 in sample
*
****************************************************************************/

Expand All @@ -789,6 +789,7 @@ static void seq_setdataformat(int sid, int start,
val = start & 0xf;
val |= (bps & 0xf) << 4;
val |= (swap & 0x1) << 16;
val |= (start & 0xf) << 24;
val |= (elem & 0x3) << 28;
putreg32(val, SCUSEQ_OUT_FORMAT(sid));
}
Expand Down Expand Up @@ -2814,7 +2815,7 @@ int seq_setinstruction(struct seq_s *seq, const uint16_t *inst,
* seq - An instance of sequencer
* sample - Size of sample (e.g. 16 bit 3 axis data = 6)
* offset - Start offset of sampling data
* elemsize - Size of 1 element (e.g. 16 bit 3 axis data = 2)
* elemsize - Number of vector elements - 1 (e.g. 3 axis = 2)
* swapbyte - Enable/Disable byte swapping if available
*
****************************************************************************/
Expand All @@ -2823,6 +2824,9 @@ void seq_setsample(struct seq_s *seq, uint8_t sample, uint8_t offset,
uint8_t elemsize, bool swapbyte)
{
DEBUGASSERT(seq);
DEBUGASSERT(sample > 0 && sample <= 16);
DEBUGASSERT(offset >= 0 && offset < 15);
DEBUGASSERT(elemsize >= 0 && elemsize < 3);

seq->sample = sample;

Expand Down

0 comments on commit e22f1e3

Please sign in to comment.