Synergy Software Package User's Manual
2D Drawing Engine Support Framework

Functions

d1_device * d1_opendevice (d1_long_t flags)
 Creates a device handle to access hardware. This function initializes the D1 device handle, supply module clock to D/AVE 2D hardware and enables the D/AVE 2D interrupt. It is called by the D/AVE 2D driver function d2_inithw() to initialize the D/AVE 2D hardware. More...
 
d1_int_t d1_closedevice (d1_device *handle)
 Close a device handle. It is called by the D/AVE 2D driver function d2_deinithw to de-initialize the D/AVE 2D hardware. Disables the D/AVE 2D interrupt and stop the module clock supply. More...
 
void d1_setregister (d1_device *handle, d1_int_t deviceid, d1_int_t index, d1_long_t value)
 Write data to the D/AVE 2D hardware register. More...
 
d1_long_t d1_getregister (d1_device *handle, d1_int_t deviceid, d1_int_t index)
 Read data from hardware register. Reading a register from an invalid or unsupported device ID will always return 0. More...
 
d1_int_t d1_devicesupported (d1_device *handle, d1_int_t deviceid)
 Check if the specified device ID is valid for the D/AVE 2D implemented for Synergy. Use this function to verify that a specific hardware interface is available on the current host system. More...
 
void drw_int_isr (void)
 DRW ISR. More...
 
d1_int_t d1_initirq_intern (d1_device_synergy *handle)
 Initialize IRQ for D/AVE 2D hardware. More...
 
d1_int_t d1_shutdownirq_intern (d1_device_synergy *handle)
 De-initialize IRQ for D/AVE 2D hardware. More...
 
d1_int_t d1_queryirq (d1_device *handle, d1_int_t irqmask, d1_int_t timeout)
 Wait for next IRQ being happened. More...
 
void * d1_allocmem (d1_uint_t size)
 Allocates memory in the driver heap. More...
 
void d1_freemem (void *ptr)
 Free the specified memory area in the driver heap. More...
 
d1_uint_t d1_memsize (void *ptr)
 This function intends to return the size of the given memory block but we don't return valid value. This function returns always 1. More...
 
void * d1_allocvidmem (d1_device *handle, d1_int_t memtype, d1_uint_t size)
 Allocate video memory. Synergy does not use the virtual memory space so this function exactly works same as d1_allocmem. More...
 
void d1_freevidmem (d1_device *handle, d1_int_t memtype, void *ptr)
 Free video memory. Synergy does not use the virtual memory space so this function exactly works same as d1_freemem. More...
 
d1_int_t d1_queryvidmem (d1_device *handle, d1_int_t memtype, d1_int_t query)
 Get current memory status. This function does not do anything special. More...
 
d1_int_t d1_queryarchitecture (d1_device *handle)
 Return hints about systems memory architecture. More...
 
void * d1_mapvidmem (d1_device *handle, void *ptr, d1_int_t flags)
 Map video memory for direct CPU access. Synergy does not use the virtual memory space so this function does not do anything special. More...
 
d1_int_t d1_unmapvidmem (d1_device *handle, void *ptr)
 Release memory mapping. Synergy does not use the virtual memory space so this function does not do anything special. More...
 
void * d1_maptovidmem (d1_device *handle, void *ptr)
 Map CPU accessible address of a video memory block back to video memory address. Synergy does not use the virtual memory space so this function does not do anything special. More...
 
void * d1_mapfromvidmem (d1_device *handle, void *ptr)
 Map already allocated video memory address to an address for direct CPU access. More...
 
d1_int_t d1_copytovidmem (d1_device *handle, void *dst, const void *src, d1_uint_t size, d1_int_t flags)
 Copy data to video memory. Destination (video) memory area has to be allocated by d1_allocvidmem. More...
 
d1_int_t d1_copyfromvidmem (d1_device *handle, void *dst, const void *src, d1_uint_t size, d1_int_t flags)
 Copy data from video memory. Source (video) memory area has to be allocated by d1_allocvidmem. More...
 
d1_int_t d1_cacheflush (d1_device *handle, d1_int_t memtype)
 Flush CPU data caches. Synergy does not have a cache memory so does not do anything special. More...
 
d1_int_t d1_cacheblockflush (d1_device *handle, d1_int_t memtype, const void *ptr, d1_uint_t size)
 Flush part of CPU data caches. Synergy does not have a cache memory so does not do anything special. More...
 

Detailed Description

Function Documentation

◆ d1_allocmem()

void* d1_allocmem ( d1_uint_t  size)

Allocates memory in the driver heap.

Parameters
[in]sizeSize of the memory to be allocated.
Return values
Non-NULLThe function returns the pointer to memory chunk if memory allocation was successful.
NULLThe function returns NULL if memory allocation was failed.

Create a byte memory pool in the driver heap if this function call is the first time.

Allocate memory from a byte memory pool.

◆ d1_allocvidmem()

void* d1_allocvidmem ( d1_device *  handle,
d1_int_t  memtype,
d1_uint_t  size 
)

Allocate video memory. Synergy does not use the virtual memory space so this function exactly works same as d1_allocmem.

Parameters
[in]handlePointer to the d1_device object.
[in]memtypeType of memory.
[in]sizeNumber of bytes.
Return values
Non-NULLThe function returns the pointer to memory chunk if memory allocation was successful.
NULLThe function returns Null if memory allocation was failed.

◆ d1_cacheblockflush()

d1_int_t d1_cacheblockflush ( d1_device *  handle,
d1_int_t  memtype,
const void *  ptr,
d1_uint_t  size 
)

Flush part of CPU data caches. Synergy does not have a cache memory so does not do anything special.

Parameters
[in]handlePointer to the d1_device object.
[in]memtypeMemory pools to flush (can be ored together).
[in]ptrStart address of memory to be flushed.
[in]sizeSize of memory to be flushed.
Return values
1The function always return 1.

◆ d1_cacheflush()

d1_int_t d1_cacheflush ( d1_device *  handle,
d1_int_t  memtype 
)

Flush CPU data caches. Synergy does not have a cache memory so does not do anything special.

Parameters
[in]handlePointer to the d1_device object.
[in]memtypeMemory pools to flush (can be ored together).
Return values
1The function always return 1.

◆ d1_closedevice()

d1_int_t d1_closedevice ( d1_device *  handle)

Close a device handle. It is called by the D/AVE 2D driver function d2_deinithw to de-initialize the D/AVE 2D hardware. Disables the D/AVE 2D interrupt and stop the module clock supply.

Parameters
[in]handlePointer to the d1_device object.
Return values
0The function returns 0 if error occurred, NULL is passed to the argument handle.
1The function returns 1 if successfully device handle was closed.

Disable the D/AVE 2D interrupt.

Stop clock supply to the D/AVE 2D hardware.

Delete used semaphore

◆ d1_copyfromvidmem()

d1_int_t d1_copyfromvidmem ( d1_device *  handle,
void *  dst,
const void *  src,
d1_uint_t  size,
d1_int_t  flags 
)

Copy data from video memory. Source (video) memory area has to be allocated by d1_allocvidmem.

Parameters
[in]handlePointer to the d1_device object.
[in]dstpointer into system memory (destination).
[in]srcPointer into video memory (source).
[in]sizeNumber of bytes to copy.
[in]flagsReserved for future use.
Return values
1The function always return 1.

Simply use C standard memcpy.

◆ d1_copytovidmem()

d1_int_t d1_copytovidmem ( d1_device *  handle,
void *  dst,
const void *  src,
d1_uint_t  size,
d1_int_t  flags 
)

Copy data to video memory. Destination (video) memory area has to be allocated by d1_allocvidmem.

Parameters
[in]handlePointer to the d1_device object.
[in]dstpointer into video memory (destination).
[in]srcPointer into system memory (source).
[in]sizeNumber of bytes to copy.
[in]flagsBitfield containing additional information on data to be copied.
Return values
1The function always return 1.

Simply use C standard memcpy.

◆ d1_devicesupported()

d1_int_t d1_devicesupported ( d1_device *  handle,
d1_int_t  deviceid 
)

Check if the specified device ID is valid for the D/AVE 2D implemented for Synergy. Use this function to verify that a specific hardware interface is available on the current host system.

Parameters
[in]handlePointer to a device handle.
[in]deviceidD1_DAVE2D(Rendering core). The others are ignored.
Return values
0The function returns 0 if specified device ID not supported.
1The function returns 1 if specified device ID supported.

Check the deviceid.

Return 1 in case of valid deviceid.

Return 0 in case of Unknown device ID.

◆ d1_freemem()

void d1_freemem ( void *  ptr)

Free the specified memory area in the driver heap.

Parameters
[in]ptrPointer to the memory area to be freed.

Free specified memory allocated by d1_allocmem.

◆ d1_freevidmem()

void d1_freevidmem ( d1_device *  handle,
d1_int_t  memtype,
void *  ptr 
)

Free video memory. Synergy does not use the virtual memory space so this function exactly works same as d1_freemem.

Parameters
[in]handlePointer to the d1_device object.
[in]memtypeType of memory.
[in]ptrAddress returned by d1_allocvidmem.

◆ d1_getregister()

d1_long_t d1_getregister ( d1_device *  handle,
d1_int_t  deviceid,
d1_int_t  index 
)

Read data from hardware register. Reading a register from an invalid or unsupported device ID will always return 0.

Parameters
[in]handlePointer to a device handle.
[in]deviceidD1_DAVE2D(Rendering core) or D1_DLISTINDIRECT(Lists of dlist support). The others are ignored.
[in]indexRegister index (starts with 0).
Return values
ValueThe function returns 32-bit value of the register.

Check the deviceid to see whether Register addressing or dlist mode is being used.

If Register addressing is used return the value stored in specified D/AVE 2D register.

If dlist mode is used return the dlist address.

If neither Register addressing nor dlist mode is used return 0.

◆ d1_initirq_intern()

d1_int_t d1_initirq_intern ( d1_device_synergy handle)

Initialize IRQ for D/AVE 2D hardware.

Parameters
[in]handlePointer to the d1_device object.
Return values
0The function returns 0 if failed in the IRQ initialization.
1The function returns 1 if successfully IRQ is initialized.

Clear all the D/AVE 2D IRQs and enable Display list IRQ.

Access to FMI through the eventInfoGet interface and get the D/AVE 2D IRQ information.

Check return value of eventInfoGet API, if SUCCESS Enable the D/AVE 2D IRQ Vector

Set D/AVE 2D interrupt priority in NVIC if the IRQ vector is valid.

Enable D/AVE 2D interrupt in NVIC if the IRQ vector is valid.

◆ d1_mapfromvidmem()

void* d1_mapfromvidmem ( d1_device *  handle,
void *  ptr 
)

Map already allocated video memory address to an address for direct CPU access.

Parameters
[in]handlePointer to the d1_device object.
[in]ptrVideo memory address returned by d1_allocvidmem.
Return values
ptrThe function just returns ptr back since no mapping required for Synergy.

◆ d1_maptovidmem()

void* d1_maptovidmem ( d1_device *  handle,
void *  ptr 
)

Map CPU accessible address of a video memory block back to video memory address. Synergy does not use the virtual memory space so this function does not do anything special.

Parameters
[in]handlePointer to the d1_device object.
[in]ptrCPU accessible address pointing to a video memory block originally allocated using d1_allocvidmem.
Return values
ptrThe function just returns ptr back since no mapping required for Synergy.

◆ d1_mapvidmem()

void* d1_mapvidmem ( d1_device *  handle,
void *  ptr,
d1_int_t  flags 
)

Map video memory for direct CPU access. Synergy does not use the virtual memory space so this function does not do anything special.

Parameters
[in]handlePointer to the d1_device object.
[in]ptrVideo memory address returned by d1_allocvidmem.
[in]flagsMemory mapping flags.
Return values
ptrThe function just returns ptr back since no mapping required for Synergy.

◆ d1_memsize()

d1_uint_t d1_memsize ( void *  ptr)

This function intends to return the size of the given memory block but we don't return valid value. This function returns always 1.

Parameters
[in]ptrPointer to a memory block in Heap.
Return values
1The function always return 1.

Always return 1.

◆ d1_opendevice()

d1_device* d1_opendevice ( d1_long_t  flags)

Creates a device handle to access hardware. This function initializes the D1 device handle, supply module clock to D/AVE 2D hardware and enables the D/AVE 2D interrupt. It is called by the D/AVE 2D driver function d2_inithw() to initialize the D/AVE 2D hardware.

Parameters
[in]flagsReserved. Not used in this function.
Return values
Non-NULLThe function returns the pointer to a d1_device object if the D1 device handle was successfully initialized.
NULLThe function returns NULL if failed to create the display list synchronization semaphore.

Get new device handle.

Initialize device data.

Access to FMI through the productFeatureGet interface and get the D/AVE 2D hardware information.

If failed to get the D/AVE 2D information from FMI, set NULL to handle and return.

Initialize the D/AVE 2D hardware bass address in the device context.

Supply clock to the D/AVE 2D hardware.

Create the semaphore to notify the completion of display list execution.

Enable the D/AVE 2D interrupt if semaphore creation was successful.

If failed to enable the D/AVE 2D interrupt, set NULL to handle.

If failed to create the semaphore, set NULL to handle.

Returns the pointer to the d1_device object.

◆ d1_queryarchitecture()

d1_int_t d1_queryarchitecture ( d1_device *  handle)

Return hints about systems memory architecture.

Parameters
[in]handlePointer to the d1_device object.
Return values
d1_ma_unifiedThe function always return d1_ma_unified (Unified memory architecture).

Return d1_ma_unified as Memory architecture is such that CPU can directly access pointers returned by allocvidmem.

◆ d1_queryirq()

d1_int_t d1_queryirq ( d1_device *  handle,
d1_int_t  irqmask,
d1_int_t  timeout 
)

Wait for next IRQ being happened.

Parameters
[in]handlePointer to the d1_device object (Not used).
[in]irqmaskInterrupt ID (Not used. Synergy only uses Display list IRQ).
[in]timeoutTimeout value.
Return values
0The function returns 0 if wait through semaphore is not successful
1The function returns 1 if wait through semaphore is successful.

Wait for dlist processing to complete.

◆ d1_queryvidmem()

d1_int_t d1_queryvidmem ( d1_device *  handle,
d1_int_t  memtype,
d1_int_t  query 
)

Get current memory status. This function does not do anything special.

Parameters
[in]handlePointer to the d1_device object.
[in]memtypeType of memory.
[in]queryType of requested information.
Return values
0The function always return 0.

◆ d1_setregister()

void d1_setregister ( d1_device *  handle,
d1_int_t  deviceid,
d1_int_t  index,
d1_long_t  value 
)

Write data to the D/AVE 2D hardware register.

Parameters
[in]handlePointer to a device handle.
[in]deviceidD1_DAVE2D(Rendering core) or D1_DLISTINDIRECT(Lists of dlist support). The others are ignored.
[in]indexRegister index (word offset from the D/AVE 2D base address).
[in]value32-bit value to write.

Write data to specified D/AVE 2D register.

◆ d1_shutdownirq_intern()

d1_int_t d1_shutdownirq_intern ( d1_device_synergy handle)

De-initialize IRQ for D/AVE 2D hardware.

Parameters
[in]handlePointer to the d1_device object.
Return values
0The function returns 0 if failed in the IRQ de-initialization.
1The function returns 1 if successfully IRQ is de-initialized.

Access to FMI through the eventInfoGet interface and get the D/AVE 2D IRQ information.

Check return value of eventInfoGet API, if SUCCESS disable the D/AVE 2D IRQ Vector

Disable D/AVE 2D interrupt in NVIC if the IRQ vector is valid.

Clear all the D/AVE 2D IRQs and disable Display list IRQ.

◆ d1_unmapvidmem()

d1_int_t d1_unmapvidmem ( d1_device *  handle,
void *  ptr 
)

Release memory mapping. Synergy does not use the virtual memory space so this function does not do anything special.

Parameters
[in]handlePointer to the d1_device object.
[in]ptrMapped video memory address returned by d1_mapvidmem.
Return values
1The function always return 1.

◆ drw_int_isr()

void drw_int_isr ( void  )

DRW ISR.

Just in case, check if the driver initialization done.

Get D/AVE 2D interrupt status.

Clear all the D/AVE 2D interrupts (keep the Display list interrupt enable).

Display list interrupt?

Signal semaphore for driver.

Clear IRQ status.