Add support for tx stream counter polling
parent
7cb0fe0e8f
commit
49d3f54fcc
|
@ -217,7 +217,7 @@ void capi_DivaStreamingOn(struct capi_pvt *i, byte streamCommand, _cword message
|
|||
ret = diva_stream_create (&pE->diva_stream, NULL, 255, divaStreamingMessageRx, pE, trace_ident);
|
||||
|
||||
if (ret == 0) {
|
||||
static byte addie[] = { 0x2d, 0x01, 0x00, 0x00 };
|
||||
static byte addie[] = { 0x2d /* UID */, 0x01, 0x00, 0x04 /* BC */, 0x04, 0x0, 0x0, 0x0, 0x00 /* 0x20 DMA polling */, 0 /* END */};
|
||||
byte* description = (byte*)pE->diva_stream->description (pE->diva_stream, addie, (byte)sizeof(addie));
|
||||
MESSAGE_EXCHANGE_ERROR error;
|
||||
|
||||
|
@ -225,27 +225,6 @@ void capi_DivaStreamingOn(struct capi_pvt *i, byte streamCommand, _cword message
|
|||
|
||||
description[3] |= 0x01;
|
||||
|
||||
#if 0 /*! \todo create function to add info elements to stream description */
|
||||
byte* start = &description[3];
|
||||
|
||||
start[0] |= 2U;
|
||||
start = start + start[-1];
|
||||
*start++ = 0x2c;
|
||||
*start++ = 8;
|
||||
*start++ = 1;
|
||||
*start++ = 2;
|
||||
*start++ = 3;
|
||||
*start++ = 4;
|
||||
*start++ = 'a';
|
||||
*start++ = 'b';
|
||||
*start++ = 'c';
|
||||
*start++ = 'd';
|
||||
*start++ = 0;
|
||||
|
||||
description[2] += 11;
|
||||
description[0] += 11;
|
||||
#endif
|
||||
|
||||
if (streamCommand == 0) {
|
||||
messageNumber = get_capi_MessageNumber();
|
||||
effectivePLCI = i->PLCI;
|
||||
|
|
|
@ -99,6 +99,9 @@ int diva_streaming_idi_host_ifc_create (struct _diva_streaming_idi_host_ifc_w**
|
|||
DBG_TRC(("alloc %p %08x:%08x [%s]", ifc_w->segments[i], ifc_w->segment_lo[i], ifc_w->segment_hi[i], trace_ident))
|
||||
|
||||
ifc_w->segment_length[i] = (*(segment_alloc_access->get_segment_length))(segment_alloc);
|
||||
if (i == 0) {
|
||||
*(volatile dword*)(ifc_w->segments[i]+ifc_w->segment_length[i]-sizeof(dword)) = 0;
|
||||
}
|
||||
|
||||
ifc_w->state.length += ifc_w->segment_length[i];
|
||||
}
|
||||
|
@ -325,17 +328,26 @@ static byte description (diva_streaming_idi_host_ifc_w_t* ifc, byte* dst, byte m
|
|||
static int init (struct _diva_streaming_idi_host_ifc_w* ifc, dword version, dword counter, dword info) {
|
||||
diva_segment_alloc_access_t* segment_alloc_access = diva_get_segment_alloc_ifc (ifc->segment_alloc);
|
||||
|
||||
ifc->remote_counter_offset = counter % (4*1024);
|
||||
ifc->remote_counter_base = counter - ifc->remote_counter_offset;
|
||||
if ((info & DIVA_STREAMING_MANAGER_TX_COUNTER_IN_TX_PAGE) != 0) {
|
||||
ifc->segment_length[0] -= sizeof(dword);
|
||||
ifc->state.length -= sizeof(dword);
|
||||
ifc->state.write_buffer_free -= sizeof(dword);
|
||||
ifc->state.free_length -= sizeof(dword);
|
||||
ifc->remote_counter_mapped = (dword*)(ifc->segments[0]+ifc->segment_length[0]);
|
||||
ifc->remote_counter_mapped_base = 0;
|
||||
} else {
|
||||
ifc->remote_counter_offset = counter % (4*1024);
|
||||
ifc->remote_counter_base = counter - ifc->remote_counter_offset;
|
||||
|
||||
ifc->remote_counter_mapped_base = segment_alloc_access->map_address (ifc->segment_alloc,
|
||||
ifc->remote_counter_mapped_base = segment_alloc_access->map_address (ifc->segment_alloc,
|
||||
ifc->remote_counter_base, 0,
|
||||
(info & DIVA_STREAMING_MANAGER_HOST_USER_MODE_STREAM) != 0);
|
||||
if (ifc->remote_counter_mapped_base != 0) {
|
||||
byte* p = ifc->remote_counter_mapped_base;
|
||||
ifc->remote_counter_mapped = (dword*)&p[ifc->remote_counter_offset];
|
||||
} else {
|
||||
DBG_TRC(("stream uses system call [%s]", ifc->trace_ident))
|
||||
if (ifc->remote_counter_mapped_base != 0) {
|
||||
byte* p = ifc->remote_counter_mapped_base;
|
||||
ifc->remote_counter_mapped = (dword*)&p[ifc->remote_counter_offset];
|
||||
} else {
|
||||
DBG_TRC(("stream uses system call [%s]", ifc->trace_ident))
|
||||
}
|
||||
}
|
||||
|
||||
return (0);
|
||||
|
|
|
@ -58,6 +58,7 @@ typedef struct _diva_stream {
|
|||
#define DIVA_STREAM_MESSAGE_RELEASED 0x00000008 /** Not message, used internally */
|
||||
|
||||
#define DIVA_STREAMING_MANAGER_HOST_USER_MODE_STREAM 0x40000000U
|
||||
#define DIVA_STREAMING_MANAGER_TX_COUNTER_IN_TX_PAGE 0x20000000U /* Tx counter is located at end of TX page */
|
||||
|
||||
diva_streaming_idi_result_t diva_stream_create_with_user_segment_alloc (struct _diva_stream** ifc,
|
||||
void* os_context,
|
||||
|
|
Loading…
Reference in New Issue