Support PM67 voltage fields in UMP logger v3
This commit is contained in:
34
c/set-protocol/ports/tms320f28335/ump_tms28335.c
Normal file
34
c/set-protocol/ports/tms320f28335/ump_tms28335.c
Normal file
@@ -0,0 +1,34 @@
|
||||
#include "ump_tms28335.h"
|
||||
extern unsigned int ump_log_read(unsigned int address);
|
||||
extern int ump_log_write(unsigned int address, unsigned int value);
|
||||
static uint16_t read_word(void *context, uint16_t address)
|
||||
{ (void)context; return (uint16_t)ump_log_read(address); }
|
||||
static int write_word(void *context, uint16_t address, uint16_t value)
|
||||
{ (void)context; return ump_log_write(address,value); }
|
||||
unsigned ump_tms28335_prepare(unsigned fn, uint16_t a, uint16_t n,
|
||||
uint16_t *reply, unsigned *error)
|
||||
{
|
||||
const ump_backend backend = {0,read_word,write_word};
|
||||
return ump_prepare(&backend,fn,a,n,1,reply,error);
|
||||
}
|
||||
size_t ump_tms28335_rtu(unsigned device, unsigned fn, uint16_t a,
|
||||
uint16_t n, ump_octet *reply, size_t capacity)
|
||||
{
|
||||
const ump_backend backend = {0,read_word,write_word};
|
||||
return ump_rtu_response(&backend,device,fn,a,n,reply,capacity);
|
||||
}
|
||||
unsigned ump_tms28335_capture(unsigned fn, uint16_t a, uint16_t n,
|
||||
uint16_t *words, unsigned *error)
|
||||
{
|
||||
const ump_backend backend = {0,read_word,write_word};
|
||||
return ump_prepare(&backend,fn,a,n,0,words,error);
|
||||
}
|
||||
unsigned ump_tms28335_fragment(const uint16_t *words, unsigned count, unsigned index,
|
||||
unsigned token, unsigned error, uint32_t *mdl, uint32_t *mdh)
|
||||
{
|
||||
ump_octet frame[8];
|
||||
if (!mdl || !mdh || !ump_can_fragment(words,count,index,token,error,frame)) return 0;
|
||||
*mdl=((uint32_t)frame[0]<<24)|((uint32_t)frame[1]<<16)|(frame[2]<<8)|frame[3];
|
||||
*mdh=((uint32_t)frame[4]<<24)|((uint32_t)frame[5]<<16)|(frame[6]<<8)|frame[7];
|
||||
return 8;
|
||||
}
|
||||
Reference in New Issue
Block a user