static void _bsp_io_pcb_shm_tx_isr ( /* [IN] the info structure */ pointer handle ) { IO_PCB_SHM_INFO_STRUCT_PTR info_ptr = (IO_PCB_SHM_INFO_STRUCT_PTR)handle; _qintc_clear_sw_interrupt(info_ptr->INIT.TX_VECTOR); _io_pcb_shm_tx_isr(handle); }
static void _bsp_io_pcb_shm_tx_isr ( /* [IN] the info structure */ void *handle ) { IO_PCB_SHM_INFO_STRUCT_PTR info_ptr = (IO_PCB_SHM_INFO_STRUCT_PTR)handle; /* clear the inter-core interrupt */ #if PSP_MQX_CPU_IS_VYBRID_A5 MSCM_IRCP0IR = (1 << (info_ptr->INIT.TX_VECTOR - GIC_CPU_to_CPU_int0)); #else MSCM_IRCP1IR = (1 << (info_ptr->INIT.TX_VECTOR - NVIC_CPU_to_CPU_int0)); #endif _io_pcb_shm_tx_isr(handle); }
void _io_pcb_shm_rx_isr ( /* [IN] the info structure */ pointer handle ) { IO_PCB_SHM_INFO_STRUCT_PTR info_ptr; IO_PCB_SHM_INIT_STRUCT_PTR init_ptr; IO_PCB_STRUCT_PTR local_pcb_ptr; IO_PCB_STRUCT_PTR remote_pcb_ptr; IO_PCB_FRAGMENT_STRUCT_PTR frag_ptr; IO_PCB_SHM_BUFFER_STRUCT_PTR bd_ptr; uchar_ptr data_addr; uint_32 data_length; uint_32 cntrl; uint_16 num_frags; uint_32 max_size; boolean discard; info_ptr = (IO_PCB_SHM_INFO_STRUCT_PTR)handle; init_ptr = &info_ptr->INIT; /* Get the next RX buffer descriptor */ bd_ptr = &info_ptr->RX_RING_PTR[info_ptr->RXNEXT]; _DCACHE_INVALIDATE_LINE(bd_ptr); cntrl = bd_ptr->CONTROL; remote_pcb_ptr = (IO_PCB_STRUCT_PTR) _bsp_ptov(bd_ptr->PACKET_PTR); _DCACHE_INVALIDATE_MBYTES(remote_pcb_ptr, sizeof(*remote_pcb_ptr)); num_frags = remote_pcb_ptr->NUMBER_OF_FRAGMENTS; /* Disable interrupts */ _int_disable(); while(cntrl == (IO_PCB_SHM_BUFFER_OWN|IO_PCB_SHM_BUFFER_ALOCATED)){ discard = FALSE; /* Get a PCB */ local_pcb_ptr = _io_pcb_alloc(info_ptr->READ_PCB_POOL, FALSE); if ((local_pcb_ptr == NULL)) { break; } data_addr = local_pcb_ptr->FRAGMENTS[0].FRAGMENT; data_length = ((IO_PCB_SHM_INIT_STRUCT_PTR) &info_ptr->INIT)->INPUT_MAX_LENGTH; max_size = ((IO_PCB_SHM_INIT_STRUCT_PTR) &info_ptr->INIT)->INPUT_MAX_LENGTH; /* Copy packet */ for(frag_ptr = (IO_PCB_FRAGMENT_STRUCT_PTR) &(remote_pcb_ptr->FRAGMENTS[0]); num_frags; num_frags--, frag_ptr++) { if(frag_ptr->LENGTH > max_size){ discard = TRUE; break; } _DCACHE_INVALIDATE_MBYTES(frag_ptr->FRAGMENT, frag_ptr->LENGTH); _mem_copy(_bsp_ptov((pointer)frag_ptr->FRAGMENT), (pointer)data_addr, frag_ptr->LENGTH); data_addr += frag_ptr->LENGTH; data_length -= frag_ptr->LENGTH; } local_pcb_ptr->FRAGMENTS[0].LENGTH = max_size - data_length; if (info_ptr->READ_CALLBACK_FUNCTION) { (*info_ptr->READ_CALLBACK_FUNCTION)(info_ptr->FD, local_pcb_ptr); } else { _queue_enqueue((QUEUE_STRUCT_PTR)&info_ptr->READ_QUEUE, (QUEUE_ELEMENT_STRUCT_PTR)&local_pcb_ptr->QUEUE); _lwsem_post(&info_ptr->READ_LWSEM); } /* Set the buffer pointer and control bits */ bd_ptr->CONTROL &= IO_PCB_SHM_BUFFER_ALOCATED; _DCACHE_FLUSH_LINE(bd_ptr); /* Update Info structure */ info_ptr->RXNEXT = NEXT_INDEX(info_ptr->RXNEXT, info_ptr->RX_LENGTH); info_ptr->RXENTRIES--; /* Get the next RX buffer descriptor */ bd_ptr = &info_ptr->RX_RING_PTR[info_ptr->RXNEXT]; _DCACHE_INVALIDATE_LINE(bd_ptr); cntrl = bd_ptr->CONTROL; remote_pcb_ptr = (IO_PCB_STRUCT_PTR) _bsp_ptov(bd_ptr->PACKET_PTR); _DCACHE_INVALIDATE_MBYTES(remote_pcb_ptr, sizeof(*remote_pcb_ptr)); num_frags = remote_pcb_ptr->NUMBER_OF_FRAGMENTS; } if (init_ptr->TX_VECTOR == 0) { _io_pcb_shm_tx_isr(handle); } /* Reception successful */ if (!discard) { /* Trigger remote side */ (*init_ptr->INT_TRIGGER)(init_ptr->REMOTE_TX_VECTOR); } _int_enable(); }