Add shared emulator services, waveform generation and STM32 USB boot ports
This commit is contained in:
@@ -0,0 +1,30 @@
|
||||
#include "ump_stm32f407.h"
|
||||
size_t ump_stm32f407_rtu(const ump_backend *b, unsigned device,
|
||||
const uint8_t *request, size_t length, uint8_t *reply, size_t capacity)
|
||||
{
|
||||
ump_octet r[8],out[UMP_RTU_CAPACITY];
|
||||
size_t i,n;
|
||||
if (!request || !reply || length!=8 || capacity<UMP_RTU_CAPACITY) return 0;
|
||||
for (i=0;i<8;i++) r[i]=request[i];
|
||||
n=ump_rtu(b,device,r,8,out,UMP_RTU_CAPACITY);
|
||||
for (i=0;i<n;i++) reply[i]=(uint8_t)out[i];
|
||||
return n;
|
||||
}
|
||||
unsigned ump_stm32f407_can(const ump_backend *b, const uint8_t *request,
|
||||
size_t length, uint16_t *words, unsigned *token, unsigned *error)
|
||||
{
|
||||
ump_octet r[8];
|
||||
unsigned i;
|
||||
if (!request || length!=8) return 0;
|
||||
for (i=0;i<8;i++) r[i]=request[i];
|
||||
return ump_can_request(b,r,8,words,token,error);
|
||||
}
|
||||
unsigned ump_stm32f407_fragment(const uint16_t *words, unsigned count,
|
||||
unsigned index, unsigned token, unsigned error, uint8_t reply[8])
|
||||
{
|
||||
ump_octet out[8];
|
||||
unsigned i;
|
||||
if (!reply || !ump_can_fragment(words,count,index,token,error,out)) return 0;
|
||||
for (i=0;i<8;i++) reply[i]=(uint8_t)out[i];
|
||||
return 8;
|
||||
}
|
||||
Reference in New Issue
Block a user