#include "sep_driver_config.h"
#include "sep_driver_api.h"
#include "sep_driver_ext_api.h"
+#include "sep_dev.h"
#if SEP_DRIVER_ARM_DEBUG_MODE
irqreturn_t sep_inthandler(int irq , void* dev_id);
+/* Keep this a single static object for now to keep the conversion easy */
-/* io memory (register area) */
-static unsigned long io_memory_start_physical_address;
-static unsigned long io_memory_end_physical_address;
-static unsigned long io_memory_size;
-void *io_memory_start_virtual_address;
-
-/* restricted access region */
-static unsigned long rar_physical_address;
-static void *rar_virtual_address;
-
-/* shared memory region */
-static unsigned long shared_physical_address;
-static void *shared_virtual_address;
-
-/* firmware regions */
-static unsigned long cache_physical_address;
-static unsigned long cache_size;
-static void *cache_virtual_address;
-
-static unsigned long resident_physical_address;
-static unsigned long resident_size;
-static void *resident_virtual_address;
-
-/* device interrupt (as retrieved from PCI) */
-int sep_irq;
+static struct sep_device sep_instance;
+struct sep_device *sep_dev = &sep_instance;
/* temporary */
unsigned long jiffies_future;
MODULE_DEVICE_TABLE(pci, sep_pci_id_tbl);
-static unsigned long rar_region_addr;
/* field for registering driver to PCI device */
.probe = sep_probe
};
-/* pointer to pci dev received during probe */
-struct pci_dev *sep_pci_dev_ptr;
/*
This functions locks the area of the resisnd and cache sep code
DEBUG_PRINT_1(SEP_DEBUG_LEVEL_EXTENDED,
"SEP Driver:rar_virtual is %p\n",
- rar_virtual_address);
+ sep_dev->rar_virtual_address);
DEBUG_PRINT_1(SEP_DEBUG_LEVEL_EXTENDED,
"SEP Driver:rar_physical is %08lx\n",
- rar_physical_address);
+ sep_dev->rar_physical_address);
- rar_region_addr = (unsigned long)rar_virtual_address;
+ sep_dev->rar_region_addr = (unsigned long)sep_dev->rar_virtual_address;
- cache_physical_address = rar_physical_address;
- cache_virtual_address = rar_virtual_address;
+ sep_dev->cache_physical_address = sep_dev->rar_physical_address;
+ sep_dev->cache_virtual_address = sep_dev->rar_virtual_address;
/* load cache */
- error = request_firmware(&fw, cache_name, &sep_pci_dev_ptr->dev);
+ error = request_firmware(&fw, cache_name, &sep_dev->sep_pci_dev_ptr->dev);
if (error) {
DEBUG_PRINT_0(SEP_DEBUG_LEVEL_EXTENDED,
"SEP Driver:cant request cache fw\n");
"SEP Driver:cache data size is %08Zx\n",
fw->size);
- memcpy((void *)cache_virtual_address, (void *)fw->data, fw->size);
+ memcpy((void *)sep_dev->cache_virtual_address, (void *)fw->data, fw->size);
- cache_size = fw->size;
+ sep_dev->cache_size = fw->size;
- cache_addr = (unsigned long)cache_virtual_address;
+ cache_addr = (unsigned long)sep_dev->cache_virtual_address;
release_firmware(fw);
- resident_physical_address = cache_physical_address+cache_size;
- resident_virtual_address = cache_virtual_address+cache_size;
+ sep_dev->resident_physical_address = sep_dev->cache_physical_address
+ + sep_dev->cache_size;
+ sep_dev->resident_virtual_address = sep_dev->cache_virtual_address
+ + sep_dev->cache_size;
/* load resident */
- error = request_firmware(&fw, res_name, &sep_pci_dev_ptr->dev);
+ error = request_firmware(&fw, res_name, &sep_dev->sep_pci_dev_ptr->dev);
if (error) {
DEBUG_PRINT_0(SEP_DEBUG_LEVEL_EXTENDED,
"SEP Driver:cant request res fw\n");
"SEP Driver:res data size is %08Zx\n",
fw->size);
- memcpy((void *)resident_virtual_address, (void *)fw->data, fw->size);
+ memcpy((void *)sep_dev->resident_virtual_address, (void *)fw->data, fw->size);
- resident_size = fw->size;
+ sep_dev->resident_size = fw->size;
release_firmware(fw);
- resident_addr = (unsigned long)resident_virtual_address;
+ resident_addr = (unsigned long)sep_dev->resident_virtual_address;
DEBUG_PRINT_1(SEP_DEBUG_LEVEL_EXTENDED,
"SEP Driver:resident_addr (physical )is %08lx\n",
- resident_physical_address);
+ sep_dev->resident_physical_address);
DEBUG_PRINT_1(SEP_DEBUG_LEVEL_EXTENDED,
"SEP Driver:cache_addr (physical) is %08lx\n",
- cache_physical_address);
+ sep_dev->cache_physical_address);
DEBUG_PRINT_1(SEP_DEBUG_LEVEL_EXTENDED,
"SEP Driver:resident_addr (logical )is %08lx\n",
cache_addr);
DEBUG_PRINT_1(SEP_DEBUG_LEVEL_EXTENDED,
- "SEP Driver:resident_size is %08lx\n", resident_size);
+ "SEP Driver:resident_size is %08lx\n", sep_dev->resident_size);
DEBUG_PRINT_1(SEP_DEBUG_LEVEL_EXTENDED,
- "SEP Driver:cache_size is %08lx\n", cache_size);
+ "SEP Driver:cache_size is %08lx\n", sep_dev->cache_size);
/* physical addresses */
- *dst_new_cache_addr_ptr = cache_physical_address;
- *dst_new_resident_addr_ptr = resident_physical_address;
+ *dst_new_cache_addr_ptr = sep_dev->cache_physical_address;
+ *dst_new_resident_addr_ptr = sep_dev->resident_physical_address;
end_function:
unsigned long *phys_shared_area_addr_ptr)
{
// shared_virtual_address = ioremap_nocache(0xda00000,shared_area_size);
- shared_virtual_address = kmalloc(shared_area_size, GFP_KERNEL);
- if (!shared_virtual_address) {
+ sep_dev->shared_virtual_address = kmalloc(shared_area_size, GFP_KERNEL);
+ if (!sep_dev->shared_virtual_address) {
DEBUG_PRINT_0(SEP_DEBUG_LEVEL_EXTENDED,
"sep_driver:shared memory kmalloc failed\n");
return -1;
}
- shared_physical_address = __pa(shared_virtual_address);
+ /* FIXME */
+ sep_dev->shared_physical_address = __pa(sep_dev->shared_virtual_address);
// shared_physical_address = 0xda00000;
- *kernel_shared_area_addr_ptr = (unsigned long)shared_virtual_address;
+ *kernel_shared_area_addr_ptr = (unsigned long)sep_dev->shared_virtual_address;
/* set the physical address of the shared area */
- *phys_shared_area_addr_ptr = shared_physical_address;
+ *phys_shared_area_addr_ptr = sep_dev->shared_physical_address;
DEBUG_PRINT_1(SEP_DEBUG_LEVEL_EXTENDED,
"SEP Driver:shared_virtual_address is %p\n",
- shared_virtual_address);
+ sep_dev->shared_virtual_address);
DEBUG_PRINT_1(SEP_DEBUG_LEVEL_EXTENDED,
"SEP Driver:shared_region_size is %08lx\n",
shared_area_size);
virt_address);
DEBUG_PRINT_1(SEP_DEBUG_LEVEL_EXTENDED,
"SEP Driver:sh virt to phys p %08lx\n",
- shared_physical_address
- + (virt_address - (unsigned long)shared_virtual_address));
+ sep_dev->shared_physical_address
+ + (virt_address - (unsigned long)sep_dev->shared_virtual_address));
- return (unsigned long)shared_physical_address +
- (virt_address - (unsigned long)shared_virtual_address);
+ return (unsigned long)sep_dev->shared_physical_address +
+ (virt_address - (unsigned long)sep_dev->shared_virtual_address);
}
/*
*/
unsigned long sep_shared_area_phys_to_virt(unsigned long phys_address)
{
- return (unsigned long)shared_virtual_address
- + (phys_address - shared_physical_address);
+ return (unsigned long)sep_dev->shared_virtual_address
+ + (phys_address - sep_dev->shared_physical_address);
}
}
/* set the pci dev pointer */
- sep_pci_dev_ptr = pdev;
+ sep_dev->sep_pci_dev_ptr = pdev;
/* get the io memory start address */
- io_memory_start_physical_address = pci_resource_start(pdev, 0);
- if (!io_memory_start_physical_address) {
+ sep_dev->io_memory_start_physical_address = pci_resource_start(pdev, 0);
+ if (!sep_dev->io_memory_start_physical_address) {
DEBUG_PRINT_0(SEP_DEBUG_LEVEL_EXTENDED,
"SEP Driver error pci resource start\n");
goto end_function;
}
/* get the io memory end address */
- io_memory_end_physical_address = pci_resource_end(pdev, 0);
- if (!io_memory_end_physical_address) {
+ sep_dev->io_memory_end_physical_address = pci_resource_end(pdev, 0);
+ if (!sep_dev->io_memory_end_physical_address) {
DEBUG_PRINT_0(SEP_DEBUG_LEVEL_EXTENDED,
"SEP Driver error pci resource end\n");
goto end_function;
}
- io_memory_size = io_memory_end_physical_address -
- io_memory_start_physical_address + 1;
+ sep_dev->io_memory_size = sep_dev->io_memory_end_physical_address -
+ sep_dev->io_memory_start_physical_address + 1;
DEBUG_PRINT_1(SEP_DEBUG_LEVEL_EXTENDED,
"SEP Driver:io_memory_start_physical_address is %08lx\n",
- io_memory_start_physical_address);
+ sep_dev->io_memory_start_physical_address);
DEBUG_PRINT_1(SEP_DEBUG_LEVEL_EXTENDED,
"SEP Driver:io_memory_end_phyaical_address is %08lx\n",
- io_memory_end_physical_address);
+ sep_dev->io_memory_end_physical_address);
DEBUG_PRINT_1(SEP_DEBUG_LEVEL_EXTENDED,
"SEP Driver:io_memory_size is %08lx\n",
- io_memory_size);
+ sep_dev->io_memory_size);
- io_memory_start_virtual_address =
- ioremap_nocache(io_memory_start_physical_address,
- io_memory_size);
- if (!io_memory_start_virtual_address) {
+ sep_dev->io_memory_start_virtual_address =
+ ioremap_nocache(sep_dev->io_memory_start_physical_address,
+ sep_dev->io_memory_size);
+ if (!sep_dev->io_memory_start_virtual_address) {
DEBUG_PRINT_0(SEP_DEBUG_LEVEL_EXTENDED,
"SEP Driver error ioremap of io memory\n");
goto end_function;
DEBUG_PRINT_1(SEP_DEBUG_LEVEL_EXTENDED,
"SEP Driver:io_memory_start_virtual_address is %p\n",
- io_memory_start_virtual_address);
+ sep_dev->io_memory_start_virtual_address);
- g_sep_reg_base_address = (unsigned long)io_memory_start_virtual_address;
+ sep_dev->reg_base_address = (unsigned long)sep_dev->io_memory_start_virtual_address;
/* set up system base address and shared memory location */
- rar_virtual_address = kmalloc(2 * SEP_RAR_IO_MEM_REGION_SIZE,
+ sep_dev->rar_virtual_address = kmalloc(2 * SEP_RAR_IO_MEM_REGION_SIZE,
GFP_KERNEL);
- if (!rar_virtual_address) {
+ if (!sep_dev->rar_virtual_address) {
DEBUG_PRINT_0(SEP_DEBUG_LEVEL_EXTENDED,
"SEP Driver:cant kmalloc rar\n");
goto end_function;
}
-
- rar_physical_address = __pa(rar_virtual_address);
+ /* FIXME */
+ sep_dev->rar_physical_address = __pa(sep_dev->rar_virtual_address);
DEBUG_PRINT_1(SEP_DEBUG_LEVEL_EXTENDED,
"SEP Driver:rar_physical is %08lx\n",
- rar_physical_address);
+ sep_dev->rar_physical_address);
DEBUG_PRINT_1(SEP_DEBUG_LEVEL_EXTENDED,
"SEP Driver:rar_virtual is %p\n",
- rar_virtual_address);
+ sep_dev->rar_virtual_address);
#if !SEP_DRIVER_POLLING_MODE
"SEP Driver: about to write IMR and ICR REG_ADDR\n");
/* clear ICR register */
- SEP_WRITE_REGISTER(g_sep_reg_base_address + HW_HOST_ICR_REG_ADDR,
+ SEP_WRITE_REGISTER(sep_dev->reg_base_address + HW_HOST_ICR_REG_ADDR,
0xFFFFFFFF);
/* set the IMR register - open only GPR 2 */
- SEP_WRITE_REGISTER(g_sep_reg_base_address + HW_HOST_IMR_REG_ADDR,
+ SEP_WRITE_REGISTER(sep_dev->reg_base_address + HW_HOST_IMR_REG_ADDR,
(~(0x1 << 13)));
/* figure out our irq */
- error = pci_read_config_byte(pdev, PCI_INTERRUPT_LINE, (u8 *)&sep_irq);
+ /* FIXME: */
+ error = pci_read_config_byte(pdev, PCI_INTERRUPT_LINE, (u8 *)&sep_dev->sep_irq);
DEBUG_PRINT_1(SEP_DEBUG_LEVEL_EXTENDED,
"SEP Driver: my irq is %d\n", sep_irq);
"SEP Driver: about to call request_irq\n");
/* get the interrupt line */
error = request_irq(sep_irq, sep_inthandler, IRQF_SHARED,
- "sep_driver", &g_sep_reg_base_address);
+ "sep_driver", &sep_dev->reg_base_address);
if (error)
goto end_function;
"SEP Driver: about to write IMR REG_ADDR");
/* set the IMR register - open only GPR 2 */
- SEP_WRITE_REGISTER(g_sep_reg_base_address + HW_HOST_IMR_REG_ADDR,
+ SEP_WRITE_REGISTER(sep_dev->reg_base_address + HW_HOST_IMR_REG_ADDR,
(~(0x1 << 13)));
#endif /* SEP_DRIVER_POLLING_MODE */
-void sep_load_rom_code()
+void sep_load_rom_code(void)
{
#if SEP_DRIVER_ARM_DEBUG_MODE
/* Index variables */
DEBUG_PRINT_1(SEP_DEBUG_LEVEL_EXTENDED,
"SEP Driver: k is %lu\n", k);
DEBUG_PRINT_1(SEP_DEBUG_LEVEL_EXTENDED,
- "SEP Driver: g_sep_reg_base_address is %p\n",
- g_sep_reg_base_address);
+ "SEP Driver: sep_dev->reg_base_address is %p\n",
+ sep_dev->reg_base_address);
DEBUG_PRINT_1(SEP_DEBUG_LEVEL_EXTENDED,
"SEP Driver: CRYS_SEP_ROM_start_address_offset is %p\n",
CRYS_SEP_ROM_start_address_offset);
for (i = 0; i < 4; i++) {
/* write bank */
- SEP_WRITE_REGISTER(g_sep_reg_base_address
+ SEP_WRITE_REGISTER(sep_dev->reg_base_address
+ SEP_ROM_BANK_register_offset, i);
for (j = 0; j < CRYS_SEP_ROM_length / 4; j++) {
- SEP_WRITE_REGISTER(g_sep_reg_base_address +
+ SEP_WRITE_REGISTER(sep_dev->reg_base_address +
CRYS_SEP_ROM_start_address_offset + 4*j,
CRYS_SEP_ROM[i * 0x1000 + j]);
}
/* reset the SEP*/
- SEP_WRITE_REGISTER(g_sep_reg_base_address
+ SEP_WRITE_REGISTER(sep_dev->reg_base_address
+ HW_HOST_SEP_SW_RST_REG_ADDR, 0x1);
/* poll for SEP ROM boot finish */
do {
- SEP_READ_REGISTER(g_sep_reg_base_address
+ SEP_READ_REGISTER(sep_dev->reg_base_address
+ HW_HOST_SEP_HOST_GPR3_REG_ADDR, regVal);
} while (!regVal);
switch (regVal) {
case 0x1:
/* fatal error - read erro status from GPRO */
- SEP_READ_REGISTER(g_sep_reg_base_address
+ SEP_READ_REGISTER(sep_dev->reg_base_address
+ HW_HOST_SEP_HOST_GPR0_REG_ADDR, Error);
DEBUG_PRINT_0(SEP_DEBUG_LEVEL_EXTENDED,
"SEP Driver: ROM polling case 1\n");
break;
case 0x2:
/* Boot First Phase ended */
- SEP_READ_REGISTER(g_sep_reg_base_address
+ SEP_READ_REGISTER(sep_dev->reg_base_address
+ HW_HOST_SEP_HOST_GPR0_REG_ADDR, warning);
DEBUG_PRINT_0(SEP_DEBUG_LEVEL_EXTENDED,
"SEP Driver: ROM polling case 2\n");
break;
case 0x4:
/* Cold boot ended successfully */
- SEP_READ_REGISTER(g_sep_reg_base_address
+ SEP_READ_REGISTER(sep_dev->reg_base_address
+ HW_HOST_SEP_HOST_GPR0_REG_ADDR, warning);
DEBUG_PRINT_0(SEP_DEBUG_LEVEL_EXTENDED,
"SEP Driver: ROM polling case 4\n");
break;
case 0x8:
/* Warmboot ended successfully */
- SEP_READ_REGISTER(g_sep_reg_base_address
+ SEP_READ_REGISTER(sep_dev->reg_base_address
+ HW_HOST_SEP_HOST_GPR0_REG_ADDR, warning);
DEBUG_PRINT_0(SEP_DEBUG_LEVEL_EXTENDED,
"SEP Driver: ROM polling case 8\n");
break;
case 0x10:
/* ColdWarm boot ended successfully */
- SEP_READ_REGISTER(g_sep_reg_base_address
+ SEP_READ_REGISTER(sep_dev->reg_base_address
+ HW_HOST_SEP_HOST_GPR0_REG_ADDR, warning);
DEBUG_PRINT_0(SEP_DEBUG_LEVEL_EXTENDED,
"SEP Driver: ROM polling case 16\n");
#include "sep_driver_config.h"
#include "sep_driver_api.h"
#include "sep_driver_ext_api.h"
+#include "sep_dev.h"
/*----------------------------------------
DEFINES
INT_MODULE_PARM(sepDebug, 0x0);
MODULE_PARM_DESC(sepDebug, "Flag to enable SEP debug messages");
-/* address of the shared memory allocated during init for SEP driver */
-static unsigned long g_sep_shared_area_addr;
-
-/* the physical address of the shared area */
-static unsigned long g_sep_phys_shared_area_addr;
-
-/* Message Shared Area start address - will be allocated during init */
-static unsigned long g_message_shared_area_addr;
-
/* major and minor device numbers */
static dev_t g_sep_device_number;
/* wait queue head (event) of the driver */
-DECLARE_WAIT_QUEUE_HEAD(g_sep_event);
-
-
-/* start address of the access to the SEP registers from driver */
-unsigned long g_sep_reg_base_address;
-
-/* transaction counter that coordinates the transactions between SEP and HOST */
-static unsigned long sep_host_to_sep_send_counter;
-
-/* counter for the messages from sep */
-static unsigned long sep_sep_to_host_reply_counter;
-
-/* counter for the number of bytes allocated in the pool for the current
-transaction */
-static unsigned long sep_data_pool_bytes_allocated;
-
-/* array of pointers to the pages that represent input data for the synchronic
-DMA action */
-struct page **sep_in_page_array;
-
-/* array of pointers to the pages that represent out data for the synchronic
-DMA action */
-struct page **sep_out_page_array;
-
-/* number of pages in the sep_in_page_array */
-unsigned long sep_in_num_pages;
-
-/* number of pages in the sep_out_page_array */
-unsigned long sep_out_num_pages;
-
-/* global data for every flow */
-static struct sep_flow_context_t g_sep_flows_data_array[SEP_DRIVER_NUM_FLOWS];
+static DECLARE_WAIT_QUEUE_HEAD(g_sep_event);
-/* flag for API mode - 1 -is blocking, 0 is non-blocking */
-static unsigned long g_sep_block_mode_flag;
-/* pointer to the workqueue that handles the flow done interrupts */
-static struct workqueue_struct *g_sep_flow_wq_ptr;
/*------------------------------------------------
PROTOTYPES
*/
void sep_map_shared_area(unsigned long *mappedAddr_ptr)
{
- *mappedAddr_ptr = g_sep_shared_area_addr;
+ *mappedAddr_ptr = sep_dev->shared_area_addr;
}
/*
#ifdef SEP_DRIVER_POLLING_MODE
- while (sep_host_to_sep_send_counter != (retVal & 0x7FFFFFFF))
- SEP_READ_REGISTER(g_sep_reg_base_address +
+ while (sep_dev->host_to_sep_send_counter != (retVal & 0x7FFFFFFF))
+ SEP_READ_REGISTER(sep_dev->reg_base_address +
HW_HOST_SEP_HOST_GPR2_REG_ADDR,
retVal);
- sep_sep_to_host_reply_counter++;
+ sep_dev->sep_to_host_reply_counter++;
#else
/* poll, until reply from sep */
wait_event(g_sep_event,
- (sep_host_to_sep_send_counter == sep_sep_to_host_reply_counter));
+ (sep_dev->host_to_sep_send_counter == sep_dev->sep_to_host_reply_counter));
#endif
}
error = 0;
/* check the blocking mode */
- if (g_sep_block_mode_flag)
+ if (sep_dev->block_mode_flag)
/* lock mutex */
mutex_lock(&sep_mutex);
else
}
/* release data pool allocations */
- sep_data_pool_bytes_allocated = 0;
+ sep_dev->data_pool_bytes_allocated = 0;
end_function:
#if 0/*!SEP_DRIVER_POLLING_MODE*/
/* close IMR */
- SEP_WRITE_REGISTER(g_sep_reg_base_address + HW_HOST_IMR_REG_ADDR, 0x7FFF);
+ SEP_WRITE_REGISTER(sep_dev->reg_base_address + HW_HOST_IMR_REG_ADDR, 0x7FFF);
/* release IRQ line */
- free_irq(SEP_DIRVER_IRQ_NUM, &g_sep_reg_base_address);
+ free_irq(SEP_DIRVER_IRQ_NUM, &sep_dev->reg_base_address);
#endif
DEBUG_PRINT_1(SEP_DEBUG_LEVEL_EXTENDED,
"SEP Driver:g_message_shared_area_addr is %08lx\n",
- g_message_shared_area_addr);
+ sep_dev->message_shared_area_addr);
/* get physical address */
- phys_addr = g_sep_phys_shared_area_addr;
+ phys_addr = sep_dev->phys_shared_area_addr;
DEBUG_PRINT_1(SEP_DEBUG_LEVEL_EXTENDED, "SEP Driver: phys_addr is %08lx\n",
phys_addr);
#if SEP_DRIVER_POLLING_MODE
- while (sep_host_to_sep_send_counter != (retVal & 0x7FFFFFFF)) {
- SEP_READ_REGISTER(g_sep_reg_base_address +
+ while (sep_dev->host_to_sep_send_counter != (retVal & 0x7FFFFFFF)) {
+ SEP_READ_REGISTER(sep_dev->reg_base_address +
HW_HOST_SEP_HOST_GPR2_REG_ADDR,
retVal);
DEBUG_PRINT_2(SEP_DEBUG_LEVEL_EXTENDED,
"Poll Debug Word %lu of the message is %lu\n",
count,
- *((unsigned long *)(g_sep_shared_area_addr +
+ *((unsigned long *)(sep_dev->shared_area_addr +
SEP_DRIVER_MESSAGE_SHARED_AREA_SIZE_IN_BYTES + count)));
}
- sep_sep_to_host_reply_counter++;
+ sep_dev->sep_to_host_reply_counter++;
#else
/* add the event to the polling wait table */
poll_wait(filp, &g_sep_event, wait);
#endif
DEBUG_PRINT_1(SEP_DEBUG_LEVEL_EXTENDED,
- "sep_host_to_sep_send_counter is %lu\n",
- sep_host_to_sep_send_counter);
+ "sep_dev->host_to_sep_send_counter is %lu\n",
+ sep_dev->host_to_sep_send_counter);
DEBUG_PRINT_1(SEP_DEBUG_LEVEL_EXTENDED,
- "sep_sep_to_host_reply_counter is %lu\n",
- sep_sep_to_host_reply_counter);
+ "sep_dev->sep_to_host_reply_counter is %lu\n",
+ sep_dev->sep_to_host_reply_counter);
/* check if the data is ready */
- if (sep_host_to_sep_send_counter == sep_sep_to_host_reply_counter) {
+ if (sep_dev->host_to_sep_send_counter == sep_dev->sep_to_host_reply_counter) {
for (count = 0; count < 12 * 4; count += 4)
DEBUG_PRINT_2(SEP_DEBUG_LEVEL_EXTENDED,
"Sep Mesg Word %lu of the message is %lu\n",
- count, *((unsigned long *)(g_sep_shared_area_addr + count)));
+ count, *((unsigned long *)(sep_dev->shared_area_addr + count)));
for (count = 0; count < 10 * 4; count += 4)
DEBUG_PRINT_2(SEP_DEBUG_LEVEL_EXTENDED,
"Debug Data Word %lu of the message is %lu\n",
count,
- *((unsigned long *)(g_sep_shared_area_addr + 0x1800 + count)));
+ *((unsigned long *)(sep_dev->shared_area_addr + 0x1800 + count)));
- SEP_READ_REGISTER(g_sep_reg_base_address +
+ SEP_READ_REGISTER(sep_dev->reg_base_address +
HW_HOST_SEP_HOST_GPR2_REG_ADDR,
retVal);
DEBUG_PRINT_1(SEP_DEBUG_LEVEL_EXTENDED, "retVal is %lu\n", retVal);
"SEP Driver:-------->Init start\n");
DEBUG_PRINT_1(SEP_DEBUG_LEVEL_BASIC,
"g_sep_shared_area_addr = %lx\n",
- (unsigned long)&g_sep_shared_area_addr);
+ (unsigned long)&sep_dev->shared_area_addr);
ret_val = 0;
/* transaction counter that coordinates the transactions between SEP
and HOST */
- sep_host_to_sep_send_counter = 0;
+ sep_dev->host_to_sep_send_counter = 0;
/* counter for the messages from sep */
- sep_sep_to_host_reply_counter = 0;
+ sep_dev->sep_to_host_reply_counter = 0;
/* counter for the number of bytes allocated in the pool
for the current transaction */
- sep_data_pool_bytes_allocated = 0;
+ sep_dev->data_pool_bytes_allocated = 0;
/* set the starting mode to blocking */
- g_sep_block_mode_flag = 1;
+ sep_dev->block_mode_flag = 1;
ret_val = sep_register_driver_to_device();
/* allocate the shared area */
if (sep_map_and_alloc_shared_area(size,
- &g_sep_shared_area_addr,
- &g_sep_phys_shared_area_addr)) {
+ &sep_dev->shared_area_addr,
+ &sep_dev->phys_shared_area_addr)) {
ret_val = -ENOMEM;
/* allocation failed */
goto end_function_unmap_io_memory;
}
/* now set the memory regions */
- g_message_shared_area_addr = g_sep_shared_area_addr;
+ sep_dev->message_shared_area_addr = sep_dev->shared_area_addr;
DEBUG_PRINT_1(SEP_DEBUG_LEVEL_EXTENDED,
"SEP Driver: g_message_shared_area_addr is %08lx\n",
- g_message_shared_area_addr);
+ sep_dev->message_shared_area_addr);
#if (SEP_DRIVER_RECONFIG_MESSAGE_AREA == 1)
/* send the new SHARED MESSAGE AREA to the SEP */
- SEP_WRITE_REGISTER(g_sep_reg_base_address + HW_HOST_HOST_SEP_GPR1_REG_ADDR,
- g_sep_phys_shared_area_addr);
+ SEP_WRITE_REGISTER(sep_dev->reg_base_address + HW_HOST_HOST_SEP_GPR1_REG_ADDR,
+ sep_dev->phys_shared_area_addr);
/* poll for SEP response */
- SEP_READ_REGISTER(g_sep_reg_base_address + HW_HOST_SEP_HOST_GPR1_REG_ADDR,
+ SEP_READ_REGISTER(sep_dev->reg_base_address + HW_HOST_SEP_HOST_GPR1_REG_ADDR,
retVal);
- while (retVal != 0xffffffff && retVal != g_sep_phys_shared_area_addr)
- SEP_READ_REGISTER(g_sep_reg_base_address +
+ while (retVal != 0xffffffff && retVal != sep_dev->phys_shared_area_addr)
+ SEP_READ_REGISTER(sep_dev->reg_base_address +
HW_HOST_SEP_HOST_GPR1_REG_ADDR,
retVal);
/* check the return value (register) */
- if (retVal != g_sep_phys_shared_area_addr) {
+ if (retVal != sep_dev->phys_shared_area_addr) {
ret_val = -ENOMEM;
goto end_function_deallocate_message_area;
}
/* init the flow contextes */
for (counter = 0; counter < SEP_DRIVER_NUM_FLOWS; counter++)
- g_sep_flows_data_array[counter].flow_id = SEP_FREE_FLOW_ID;
+ sep_dev->flows_data_array[counter].flow_id = SEP_FREE_FLOW_ID;
- g_sep_flow_wq_ptr = create_singlethread_workqueue("sepflowwq");
- if (g_sep_flow_wq_ptr == 0) {
+ sep_dev->flow_wq_ptr = create_singlethread_workqueue("sepflowwq");
+ if (sep_dev->flow_wq_ptr == 0) {
ret_val = -ENOMEM;
DEBUG_PRINT_0(SEP_DEBUG_LEVEL_EXTENDED,
"sep_driver:flow queue creation failed\n");
/* de-allocate shared area */
sep_unmap_and_free_shared_area(size,
- g_sep_shared_area_addr,
- g_sep_phys_shared_area_addr);
+ sep_dev->shared_area_addr,
+ sep_dev->phys_shared_area_addr);
end_function_unmap_io_memory:
- iounmap((void *)g_sep_reg_base_address);
+ iounmap((void *)sep_dev->reg_base_address);
/* release io memory region */
release_mem_region(SEP_IO_MEM_REGION_START_ADDRESS, SEP_IO_MEM_REGION_SIZE);
/* free shared area */
sep_unmap_and_free_shared_area(size,
- g_sep_shared_area_addr,
- g_sep_phys_shared_area_addr);
+ sep_dev->shared_area_addr,
+ sep_dev->phys_shared_area_addr);
DEBUG_PRINT_0(SEP_DEBUG_LEVEL_EXTENDED,
"SEP Driver: free pages SEP SHARED AREA \n");
- iounmap((void *)g_sep_reg_base_address);
+ iounmap((void *)sep_dev->reg_base_address);
DEBUG_PRINT_0(SEP_DEBUG_LEVEL_EXTENDED, "SEP Driver: iounmap \n");
int_error = IRQ_HANDLED;
/* read the IRR register to check if this is SEP interrupt */
- SEP_READ_REGISTER(g_sep_reg_base_address + HW_HOST_IRR_REG_ADDR, reg_val);
+ SEP_READ_REGISTER(sep_dev->reg_base_address + HW_HOST_IRR_REG_ADDR, reg_val);
DEBUG_PRINT_1(SEP_DEBUG_LEVEL_EXTENDED, "SEP Interrupt - reg is %08lx\n",
reg_val);
/* check if this is the flow interrupt */
if (0/*reg_val & (0x1 << 11)*/) {
/* read GPRO to find out the which flow is done */
- SEP_READ_REGISTER(g_sep_reg_base_address + HW_HOST_IRR_REG_ADDR,
+ SEP_READ_REGISTER(sep_dev->reg_base_address + HW_HOST_IRR_REG_ADDR,
flow_id);
/* find the contex of the flow */
INIT_WORK(&flow_context_ptr->flow_wq, sep_flow_done_handler);
/* queue the work */
- queue_work(g_sep_flow_wq_ptr, &flow_context_ptr->flow_wq);
+ queue_work(sep_dev->flow_wq_ptr, &flow_context_ptr->flow_wq);
} else {
/* check if this is reply interrupt from SEP */
if (reg_val & (0x1 << 13)) {
/* update the counter of reply messages */
- sep_sep_to_host_reply_counter++;
+ sep_dev->sep_to_host_reply_counter++;
/* wake up the waiting process */
wake_up(&g_sep_event);
end_function_with_error:
/* clear the interrupt */
- SEP_WRITE_REGISTER(g_sep_reg_base_address + HW_HOST_ICR_REG_ADDR, reg_val);
+ SEP_WRITE_REGISTER(sep_dev->reg_base_address + HW_HOST_ICR_REG_ADDR, reg_val);
end_function:
block_size);
/* initialize the pages pointers */
- sep_in_page_array = 0;
- sep_in_num_pages = 0;
+ sep_dev->in_page_array = 0;
+ sep_dev->in_num_pages = 0;
if (data_size == 0) {
/* special case - created 2 entries table with zero data */
- in_lli_table_ptr = (struct sep_lli_entry_t *)(g_sep_shared_area_addr +
+ in_lli_table_ptr = (struct sep_lli_entry_t *)(sep_dev->shared_area_addr +
SEP_DRIVER_SYNCHRONIC_DMA_TABLES_AREA_OFFSET_IN_BYTES);
- in_lli_table_ptr->physical_address = g_sep_shared_area_addr +
+ in_lli_table_ptr->physical_address = sep_dev->shared_area_addr +
SEP_DRIVER_SYNCHRONIC_DMA_TABLES_AREA_OFFSET_IN_BYTES;
in_lli_table_ptr->block_size = 0;
in_lli_table_ptr->physical_address = 0xFFFFFFFF;
in_lli_table_ptr->block_size = 0;
- *lli_table_ptr = g_sep_phys_shared_area_addr +
+ *lli_table_ptr = sep_dev->phys_shared_area_addr +
SEP_DRIVER_SYNCHRONIC_DMA_TABLES_AREA_OFFSET_IN_BYTES;
*num_entries_ptr = 2;
*table_data_size_ptr = 0;
/* lock the pages of the kernel buffer and translate them to pages */
result = sep_lock_kernel_pages(app_virt_addr,
data_size,
- &sep_in_num_pages,
+ &sep_dev->in_num_pages,
&lli_array_ptr,
- &sep_in_page_array);
+ &sep_dev->in_page_array);
else
/* lock the pages of the user buffer and translate them to pages */
result = sep_lock_user_pages(app_virt_addr,
data_size,
- &sep_in_num_pages,
+ &sep_dev->in_num_pages,
&lli_array_ptr,
- &sep_in_page_array);
+ &sep_dev->in_page_array);
if (result)
return result;
DEBUG_PRINT_1(SEP_DEBUG_LEVEL_EXTENDED,
- "SEP Driver:output sep_in_num_pages is %lu\n",
- sep_in_num_pages);
+ "SEP Driver:output sep_dev->in_num_pages is %lu\n",
+ sep_dev->in_num_pages);
current_entry = 0;
info_entry_ptr = 0;
- sep_lli_entries = sep_in_num_pages;
+ sep_lli_entries = sep_dev->in_num_pages;
/* initiate to point after the message area */
- lli_table_alloc_addr = g_sep_shared_area_addr +
+ lli_table_alloc_addr = sep_dev->shared_area_addr +
SEP_DRIVER_SYNCHRONIC_DMA_TABLES_AREA_OFFSET_IN_BYTES;
/* loop till all the entries in in array are not processed */
result = 0;
/* initialize the pages pointers */
- sep_in_page_array = 0;
- sep_out_page_array = 0;
+ sep_dev->in_page_array = 0;
+ sep_dev->out_page_array = 0;
/* check if the pages are in Kernel Virtual Address layout */
if (isKernelVirtualAddress == true) {
/* lock the pages of the kernel buffer and translate them to pages */
result = sep_lock_kernel_pages(app_virt_in_addr,
data_size,
- &sep_in_num_pages,
+ &sep_dev->in_num_pages,
&lli_in_array,
- &sep_in_page_array);
+ &sep_dev->in_page_array);
if (result) {
DEBUG_PRINT_0(SEP_DEBUG_LEVEL_EXTENDED,
"SEP Driver: sep_lock_kernel_pages for input virtual buffer failed\n");
/* lock the pages of the user buffer and translate them to pages */
result = sep_lock_user_pages(app_virt_in_addr,
data_size,
- &sep_in_num_pages,
+ &sep_dev->in_num_pages,
&lli_in_array,
- &sep_in_page_array);
+ &sep_dev->in_page_array);
if (result) {
DEBUG_PRINT_0(SEP_DEBUG_LEVEL_EXTENDED,
"SEP Driver: sep_lock_user_pages for input virtual buffer failed\n");
if (isKernelVirtualAddress == true) {
result = sep_lock_kernel_pages(app_virt_out_addr,
data_size,
- &sep_out_num_pages,
+ &sep_dev->out_num_pages,
&lli_out_array,
- &sep_out_page_array);
+ &sep_dev->out_page_array);
if (result) {
DEBUG_PRINT_0(SEP_DEBUG_LEVEL_EXTENDED,
"SEP Driver: sep_lock_kernel_pages for output virtual buffer failed\n");
} else {
result = sep_lock_user_pages(app_virt_out_addr,
data_size,
- &sep_out_num_pages,
+ &sep_dev->out_num_pages,
&lli_out_array,
- &sep_out_page_array);
+ &sep_dev->out_page_array);
if (result) {
DEBUG_PRINT_0(SEP_DEBUG_LEVEL_EXTENDED,
"SEP Driver: sep_lock_user_pages for output virtual buffer failed\n");
DEBUG_PRINT_1(SEP_DEBUG_LEVEL_EXTENDED,
- "sep_in_num_pages is %lu\n", sep_in_num_pages);
+ "sep_dev->in_num_pages is %lu\n", sep_dev->in_num_pages);
DEBUG_PRINT_1(SEP_DEBUG_LEVEL_EXTENDED,
- "sep_out_num_pages is %lu\n", sep_out_num_pages);
+ "sep_dev->out_num_pages is %lu\n", sep_dev->out_num_pages);
DEBUG_PRINT_1(SEP_DEBUG_LEVEL_EXTENDED,
"SEP_DRIVER_ENTRIES_PER_TABLE_IN_SEP is %x\n",
SEP_DRIVER_ENTRIES_PER_TABLE_IN_SEP);
/* call the fucntion that creates table from the lli arrays */
result = sep_construct_dma_tables_from_lli(lli_in_array,
- sep_in_num_pages,
+ sep_dev->in_num_pages,
lli_out_array,
- sep_out_num_pages,
+ sep_dev->out_num_pages,
block_size,
lli_table_in_ptr,
lli_table_out_ptr,
"SEP Driver:--------> sep_construct_dma_tables_from_lli start\n");
/* initiate to pint after the message area */
- lli_table_alloc_addr = g_sep_shared_area_addr +
+ lli_table_alloc_addr = sep_dev->shared_area_addr +
SEP_DRIVER_SYNCHRONIC_DMA_TABLES_AREA_OFFSET_IN_BYTES;
current_in_entry = 0;
DEBUG_PRINT_2(SEP_DEBUG_LEVEL_EXTENDED,
"Word %lu of the message is %lu\n",
count,
- *((unsigned long *)(g_sep_shared_area_addr + count)));
+ *((unsigned long *)(sep_dev->shared_area_addr + count)));
/* update counter */
- sep_host_to_sep_send_counter++;
+ sep_dev->host_to_sep_send_counter++;
/* send interrupt to SEP */
- SEP_WRITE_REGISTER(g_sep_reg_base_address +
+ SEP_WRITE_REGISTER(sep_dev->reg_base_address +
HW_HOST_HOST_SEP_GPR0_REG_ADDR, 0x2);
DEBUG_PRINT_0(SEP_DEBUG_LEVEL_BASIC,
DEBUG_PRINT_2(SEP_DEBUG_LEVEL_EXTENDED,
"Word %lu of the message is %lu\n",
count,
- *((unsigned long *)(g_sep_shared_area_addr + count)));
+ *((unsigned long *)(sep_dev->shared_area_addr + count)));
/* update counter */
- sep_host_to_sep_send_counter++;
+ sep_dev->host_to_sep_send_counter++;
/* send the interrupt to SEP */
- SEP_WRITE_REGISTER(g_sep_reg_base_address + HW_HOST_HOST_SEP_GPR2_REG_ADDR,
- sep_host_to_sep_send_counter);
+ SEP_WRITE_REGISTER(sep_dev->reg_base_address + HW_HOST_HOST_SEP_GPR2_REG_ADDR,
+ sep_dev->host_to_sep_send_counter);
/* update both counters */
- sep_host_to_sep_send_counter++;
+ sep_dev->host_to_sep_send_counter++;
- sep_sep_to_host_reply_counter++;
+ sep_dev->sep_to_host_reply_counter++;
DEBUG_PRINT_0(SEP_DEBUG_LEVEL_BASIC,
"SEP Driver:<-------- sep_send_reply_command_handler end\n");
/* allocate memory */
if (
- (sep_data_pool_bytes_allocated + command_args.num_bytes) >
+ (sep_dev->data_pool_bytes_allocated + command_args.num_bytes) >
SEP_DRIVER_DATA_POOL_SHARED_AREA_SIZE_IN_BYTES) {
error = -ENOTTY;
goto end_function;
/* set the virtual and physical address */
command_args.offset = SEP_DRIVER_DATA_POOL_AREA_OFFSET_IN_BYTES +
- sep_data_pool_bytes_allocated;
- command_args.phys_address = g_sep_phys_shared_area_addr +
+ sep_dev->data_pool_bytes_allocated;
+ command_args.phys_address = sep_dev->phys_shared_area_addr +
SEP_DRIVER_DATA_POOL_AREA_OFFSET_IN_BYTES +
- sep_data_pool_bytes_allocated;
+ sep_dev->data_pool_bytes_allocated;
/* write the memory back to the user space */
error = copy_to_user((void *)arg,
goto end_function;
/* set the allocation */
- sep_data_pool_bytes_allocated += command_args.num_bytes;
+ sep_dev->data_pool_bytes_allocated += command_args.num_bytes;
end_function:
goto end_function;
/* calculate the start of the data pool */
- data_pool_area_addr = g_sep_shared_area_addr +
+ data_pool_area_addr = sep_dev->shared_area_addr +
SEP_DRIVER_DATA_POOL_AREA_OFFSET_IN_BYTES;
goto end_function;
/* calculate the start of the data pool */
- data_pool_area_addr = g_sep_shared_area_addr +
+ data_pool_area_addr = sep_dev->shared_area_addr +
SEP_DRIVER_DATA_POOL_AREA_OFFSET_IN_BYTES;
/* check that the range of the virtual kernel address is correct */
"SEP Driver:--------> sep_free_dma_table_data_handler start\n");
/* free input pages array */
- sep_free_dma_pages(sep_in_page_array,
- sep_in_num_pages,
+ sep_free_dma_pages(sep_dev->in_page_array,
+ sep_dev->in_num_pages,
0);
/* free output pages array if needed */
- if (sep_out_page_array)
- sep_free_dma_pages(sep_out_page_array,
- sep_out_num_pages,
+ if (sep_dev->out_page_array)
+ sep_free_dma_pages(sep_dev->out_page_array,
+ sep_dev->out_num_pages,
1);
/* reset all the values */
- sep_in_page_array = 0;
- sep_out_page_array = 0;
- sep_in_num_pages = 0;
- sep_out_num_pages = 0;
+ sep_dev->in_page_array = 0;
+ sep_dev->out_page_array = 0;
+ sep_dev->in_num_pages = 0;
+ sep_dev->out_num_pages = 0;
DEBUG_PRINT_0(SEP_DEBUG_LEVEL_BASIC,
"SEP Driver:--------> sep_get_static_pool_addr_handler start\n");
/*prepare the output parameters in the struct */
- command_args.physical_static_address = g_sep_phys_shared_area_addr +
+ command_args.physical_static_address = sep_dev->phys_shared_area_addr +
SEP_DRIVER_STATIC_AREA_OFFSET_IN_BYTES;
- command_args.virtual_static_address = g_sep_shared_area_addr +
+ command_args.virtual_static_address = sep_dev->shared_area_addr +
SEP_DRIVER_STATIC_AREA_OFFSET_IN_BYTES;
DEBUG_PRINT_2(SEP_DEBUG_LEVEL_EXTENDED,
if (error)
goto end_function;
- if (command_args.physical_address < g_sep_phys_shared_area_addr) {
+ if (command_args.physical_address < sep_dev->phys_shared_area_addr) {
error = -ENOTTY;
goto end_function;
}
/*prepare the output parameters in the struct */
command_args.offset = command_args.physical_address -
- g_sep_phys_shared_area_addr;
+ sep_dev->phys_shared_area_addr;
DEBUG_PRINT_2(SEP_DEBUG_LEVEL_EXTENDED,
"SEP Driver:physical_address is %08lx, offset is %lu\n",
/* wait in polling for message from SEP */
do {
- SEP_READ_REGISTER(g_sep_reg_base_address +
+ SEP_READ_REGISTER(sep_dev->reg_base_address +
HW_HOST_SEP_HOST_GPR3_REG_ADDR, reg_val);
} while (!reg_val);
/* check the value */
if (reg_val == 0x1) {
/* fatal error - read erro status from GPRO */
- SEP_READ_REGISTER(g_sep_reg_base_address +
+ SEP_READ_REGISTER(sep_dev->reg_base_address +
HW_HOST_SEP_HOST_GPR0_REG_ADDR, error);
goto end_function;
}
message_ptr = (unsigned long *)command_args.message_addr;
/* set the base address of the SRAM */
- SEP_WRITE_REGISTER(g_sep_reg_base_address +
+ SEP_WRITE_REGISTER(sep_dev->reg_base_address +
HW_SRAM_ADDR_REG_ADDR,
HW_CC_SRAM_BASE_ADDRESS);
get_user(message_word, message_ptr);
/* write data to SRAM */
- SEP_WRITE_REGISTER(g_sep_reg_base_address + HW_SRAM_DATA_REG_ADDR,
+ SEP_WRITE_REGISTER(sep_dev->reg_base_address + HW_SRAM_DATA_REG_ADDR,
message_word);
DEBUG_PRINT_1(SEP_DEBUG_LEVEL_EXTENDED,
"SEP Driver:--------> sep_init_handler - finished getting messages from user space\n");
/* signal SEP */
- SEP_WRITE_REGISTER(g_sep_reg_base_address + HW_HOST_HOST_SEP_GPR0_REG_ADDR,
+ SEP_WRITE_REGISTER(sep_dev->reg_base_address + HW_HOST_HOST_SEP_GPR0_REG_ADDR,
0x1);
do {
- SEP_READ_REGISTER(g_sep_reg_base_address +
+ SEP_READ_REGISTER(sep_dev->reg_base_address +
HW_HOST_SEP_HOST_GPR3_REG_ADDR, reg_val);
} while (!(reg_val & 0xFFFFFFFD));
DEBUG_PRINT_0(SEP_DEBUG_LEVEL_EXTENDED,
"SEP Driver:init failed\n");
- SEP_READ_REGISTER(g_sep_reg_base_address + 0x8060, error);
+ SEP_READ_REGISTER(sep_dev->reg_base_address + 0x8060, error);
DEBUG_PRINT_1(SEP_DEBUG_LEVEL_EXTENDED,
"SEP Driver:sw monitor is %lu\n",
error);
/* fatal error - read erro status from GPRO */
- SEP_READ_REGISTER(g_sep_reg_base_address +
+ SEP_READ_REGISTER(sep_dev->reg_base_address +
HW_HOST_SEP_HOST_GPR0_REG_ADDR,
error);
DEBUG_PRINT_1(SEP_DEBUG_LEVEL_EXTENDED,
/* lock the area (if needed) */
sep_lock_cache_resident_area();
- command_args.new_base_addr = g_sep_phys_shared_area_addr;
+ command_args.new_base_addr = sep_dev->phys_shared_area_addr;
/* find the new base address according to the lowest address between
cache, resident and shared area */
/* set the new shared area */
- command_args.new_shared_area_addr = g_sep_phys_shared_area_addr;
+ command_args.new_shared_area_addr = sep_dev->phys_shared_area_addr;
DEBUG_PRINT_1(SEP_DEBUG_LEVEL_EXTENDED,
"SEP Driver:command_args.new_shared_area_addr is %08lx\n",
goto end_function;
/* set the global flag */
- g_sep_block_mode_flag = mode_flag;
+ sep_dev->block_mode_flag = mode_flag;
end_function:
#if 0/*!SEP_DRIVER_POLLING_MODE*/
/* close IMR */
- SEP_WRITE_REGISTER(g_sep_reg_base_address + HW_HOST_IMR_REG_ADDR, 0x7FFF);
+ SEP_WRITE_REGISTER(sep_dev->reg_base_address + HW_HOST_IMR_REG_ADDR, 0x7FFF);
/* release IRQ line */
- free_irq(SEP_DIRVER_IRQ_NUM, &g_sep_reg_base_address);
+ free_irq(SEP_DIRVER_IRQ_NUM, &sep_dev->reg_base_address);
/* lock the sep mutex */
mutex_unlock(&sep_mutex);
if (flow_data_ptr->input_tables_flag) {
/* copy the message to the shared RAM and signal SEP */
memcpy((void *)flow_data_ptr->message,
- (void *)g_sep_shared_area_addr,
+ (void *)sep_dev->shared_area_addr,
flow_data_ptr->message_size_in_bytes);
- SEP_WRITE_REGISTER(g_sep_reg_base_address +
+ SEP_WRITE_REGISTER(sep_dev->reg_base_address +
HW_HOST_HOST_SEP_GPR2_REG_ADDR,
0x2);
}
when 2 flows are with default flag
*/
for (count = 0; count < SEP_DRIVER_NUM_FLOWS; count++) {
- if (g_sep_flows_data_array[count].flow_id == flow_id) {
- *flow_data_ptr = &g_sep_flows_data_array[count];
+ if (sep_dev->flows_data_array[count].flow_id == flow_id) {
+ *flow_data_ptr = &sep_dev->flows_data_array[count];
break;
}
}
error = 0;
/* find the start address of the flow DMA table area */
- flow_dma_area_start_addr = g_sep_shared_area_addr +
+ flow_dma_area_start_addr = sep_dev->shared_area_addr +
SEP_DRIVER_FLOW_DMA_TABLES_AREA_OFFSET_IN_BYTES;
/* set end address of the flow table area */
do_gettimeofday(&time);
/* set value in the SYSTEM MEMORY offset */
- time_addr = g_message_shared_area_addr +
+ time_addr = sep_dev->message_shared_area_addr +
SEP_DRIVER_SYSTEM_TIME_MEMORY_OFFSET_IN_BYTES;
*(unsigned long *)time_addr = SEP_TIME_VAL_TOKEN;
time_addr);
DEBUG_PRINT_1(SEP_DEBUG_LEVEL_EXTENDED,
"SEP Driver:g_message_shared_area_addr is %lu\n",
- g_message_shared_area_addr);
+ sep_dev->message_shared_area_addr);
/* set the output parameters if needed */
if (address_ptr)
"SEP Driver:<-------- sep_configure_dma_burst start \n");
/* request access to registers from SEP */
- SEP_WRITE_REGISTER(g_sep_reg_base_address +
+ SEP_WRITE_REGISTER(sep_dev->reg_base_address +
HW_HOST_HOST_SEP_GPR0_REG_ADDR, 0x2UL);
DEBUG_PRINT_0(SEP_DEBUG_LEVEL_BASIC,
"SEP Driver:<-------- sep_configure_dma_burst finished request access to registers from SEP (write reg) \n");
- SEP_READ_REGISTER(g_sep_reg_base_address +
+ SEP_READ_REGISTER(sep_dev->reg_base_address +
HW_HOST_SEP_BUSY_REG_ADDR, regVal);
while (regVal)
- SEP_READ_REGISTER(g_sep_reg_base_address +
+ SEP_READ_REGISTER(sep_dev->reg_base_address +
HW_HOST_SEP_BUSY_REG_ADDR, regVal);
DEBUG_PRINT_0(SEP_DEBUG_LEVEL_BASIC,
"SEP Driver:<-------- sep_configure_dma_burst finished request access to registers from SEP (while(revVal) wait loop) \n");
/* set the DMA burst register to single burst*/
- SEP_WRITE_REGISTER(g_sep_reg_base_address +
+ SEP_WRITE_REGISTER(sep_dev->reg_base_address +
HW_AHB_RD_WR_BURSTS_REG_ADDR, 0x0UL);
/* release the sep busy */
- SEP_WRITE_REGISTER(g_sep_reg_base_address +
+ SEP_WRITE_REGISTER(sep_dev->reg_base_address +
HW_HOST_HOST_SEP_GPR0_REG_ADDR, 0x0UL);
- SEP_READ_REGISTER(g_sep_reg_base_address +
+ SEP_READ_REGISTER(sep_dev->reg_base_address +
HW_HOST_SEP_BUSY_REG_ADDR, regVal);
while (regVal != 0x0)
- SEP_READ_REGISTER(g_sep_reg_base_address +
+ SEP_READ_REGISTER(sep_dev->reg_base_address +
HW_HOST_SEP_BUSY_REG_ADDR, regVal);
DEBUG_PRINT_0(SEP_DEBUG_LEVEL_BASIC,