Пример #1
0
void    CVBlkBeg( dbg_block *blk, offset lc )
/*******************************************/
{
    block_patch        *bpatch;
    dbg_patch          *dpatch;
    cv_out             out[1];
    offset             start;
    cg_sym_handle      sym;
    cs_block           *ptr;
    byte               *nm;


    bpatch = CGAlloc( sizeof( block_patch ) );
    blk->patches = bpatch;
    NewBuff( out, CVSyms );
    ptr = StartSym(  out, SG_BLOCK );
    ptr->pParent = 0;
    ptr->pEnd = 0;
    ptr->length = 0;
    ptr->offset = 0;
    ptr->segment = 0;
    nm = out->ptr;     /* mark name */
    CVPutNullStr( out );
    EndSym( out );
    dpatch = &blk->patches->patch;
    BuffPatchSet( CVSyms, dpatch );
    BuffWrite( out, &ptr->offset );
    sym = AskForLblSym( CurrProc->label );
    start = lc - CurrProc->targ.debug->blk->start;
    SymReloc( CVSyms, sym, start );
    BuffSkip( out, nm );      /* skip addr */
    buffEnd( out );
    DumpLocals( blk->locals );
}
Пример #2
0
void    CVProEnd( dbg_rtn *rtn, offset lc )
/*****************************************/
{
    cg_sym_handle       sym;
    dbg_type            tipe;
    fe_attr             attr;
    const char          *name;
    cs_gproc            *ptr;
    sg_index            kind;
    cv_out              out[1];

    /* unused parameters */ (void)lc;

    sym = AskForLblSym( CurrProc->label );
    attr = FEAttr( sym );
    if( attr & FE_GLOBAL ){
        kind = SG_GPROC;
    }else{
        kind = SG_LPROC;
    }
    NewBuff( out, CVSyms );
    ptr = StartSym(  out, kind );
    ptr->pParent = 0;
    ptr->pEnd = 0;
    ptr->pNext = 0;
    ptr->proc_length = 0;
    ptr->debug_start = rtn->pro_size;
    ptr->debug_end = 0;
    ptr->offset = 0;
    ptr->segment = 0;
    tipe = FEDbgType( sym );
    ptr->proctype = tipe;
    ptr->flags.s = 0;
#if _TARGET & ( _TARG_IAPX86 | _TARG_80386 )
    if( *(call_class *)FindAuxInfoSym( sym, CALL_CLASS ) & FAR_CALL ) {
        ptr->flags.f.far_ret = true;
    }
#endif
    if( rtn->obj_type != DBG_NIL_TYPE ) {
        name = FEAuxInfo( sym, CLASS_APPENDED_NAME );
    } else {
        name = FEName( sym );
    }
    CVPutStr( out, name );
    EndSym( out );
    BuffPatchSet( CVSyms, RtnPatch );
    BuffWrite( out, &ptr->offset );
    SymReloc( CVSyms, sym, 0 );
    BuffSkip( out, &ptr->proctype );
    buffEnd( out );
    DBLocFini( rtn->reeturn );
    DBLocFini( rtn->obj_loc );
    if( rtn->parms != NULL ){
        DumpParms( rtn->parms, &rtn->rtn_blk->locals );
    }
    DumpLocals( rtn->rtn_blk->locals );
}
Пример #3
0
void    CVOutBck( cv_out *out, back_handle bck, offset add, dbg_type tipe )
/*** Put a back sym out***************************************************/
{
    cs_ldata    *ptr;
    void        *ptr1;

    ptr1 = out->beg;
    out->beg = out->ptr;
    ptr = StartSym(  out, SG_LDATA );
    ptr->offset = 0;
    ptr->segment = 0;
    ptr->type = tipe;
    CVPutStr( out, "__bck" );
    EndSym( out );
    out->beg = ptr1;
    CVEndType( out );
    BuffWrite( out, &ptr->offset );
    LabelReloc( out->segid, bck, add );
    BuffSkip( out, &ptr->type );
    buffEnd( out );
}
Пример #4
0
void    CVGenStatic( cg_sym_handle sym, dbg_loc loc, bool mem )
/*************************************************************/
{
    dbg_type    tipe;
    cv_out      out[1];
    fe_attr     attr;
    cs_gdata    *ptr;
    sg_index    kind;
    const char  *name;

    attr = FEAttr( sym );
    tipe = FEDbgType( sym );
    NewBuff( out, CVSyms );
    attr = FEAttr( sym );
    if( attr & FE_GLOBAL ) {
        kind = SG_GDATA;
    } else {
        kind = SG_LDATA;
    }
    ptr = StartSym(  out, kind );
    ptr->offset = 0;
    ptr->segment = 0;
    ptr->type = tipe;
    if( mem ){
        name = FEAuxInfo( sym, CLASS_APPENDED_NAME );
    } else {
        name = FEName( sym );
    }
    CVPutStr( out, name );
    EndSym( out );
    if( LocSimpStatic( loc ) == sym ) {
        BuffWrite( out, &ptr->offset );
        SymReloc( CVSyms, sym, 0 );
        BuffSkip( out, &ptr->type );
    } else {
        /*TODO:can't handle locs */
    }
    buffEnd( out );
}
Пример #5
0
/*put bytes to tx buffer, return value is the actually put out bytes*/
static kal_uint16 USB2UART_PutBytes(UART_PORT port, kal_uint8 *buffaddr, kal_uint16 length, module_type ownerid)
{
    kal_uint16  real_count;
//	kal_uint16  index;
    kal_uint32  savedMask;
    kal_uint8  ep_num = 0;
    kal_bool  setup_dma = KAL_FALSE;
    kal_int32 	remain;
    BUFFER_INFO 	*tx_info = &(USB2UARTPort.Tx_Buffer);


    if(ownerid != USB2UARTPort.ownerid)
    {
#ifdef  __PRODUCTION_RELEASE__
        return 0;
#else /* __PRODUCTION_RELEASE__ */
        EXT_ASSERT( 0, (kal_uint32) ownerid, USB2UARTPort.ownerid, 0);
#endif
    }

    /* return directly if not match condition */
    if ( (gUsbDevice.device_type != USB_CDC_ACM) ||
            (USB2UARTPort.initialized == KAL_FALSE) || (gUsbDevice.nDevState!=DEVSTATE_CONFIG))
    {
        if(((gUsbDevice.device_type == USB_CDC_ACM)||(gUsbDevice.usb_comport_boot == KAL_TRUE))
                && (USB2UARTPort.initialized == KAL_TRUE)&&(gUsbDevice.nDevState != DEVSTATE_CONFIG))
        {
            g_UsbACM.config_send_Txilm = KAL_TRUE;  /* for PC set config later then can issue the first message */
        }
        return 0;
    }

    /* The same issue as USB2UART_GetBytes()
       The area to determine send_Txilm must also contain in critical section.
       Otherwise if DMA callback activated before send_Txilm setting as true,
       this message will be lost */
    savedMask = SaveAndSetIRQMask();

    Buf_GetRoomLeft(tx_info, real_count);

    /* determine real sent data count */
    if (real_count > length)
    {
        real_count = length;
    }
    else
    {
        g_UsbACM.send_Txilm = KAL_TRUE;  /*After this time put bytes, buffer will be full */
        g_UsbACM.config_send_Txilm = KAL_TRUE; /* if be reseted, then it can issue the message waited for*/
    }
    RestoreIRQMask(savedMask);


    if(g_UsbACM.send_Txilm == KAL_TRUE)
    {
        if(ownerid != MOD_TST_READER)
        {
            drv_trace1(TRACE_FUNC, USBACM_PUT_BYTES_BUF_FULL, ownerid);
//		kal_prompt_trace(MOD_USB, "RDY W %d", ownerid);
        }
    }


    if(real_count != 0)
    {
        remain = (BWrite(tx_info) + real_count) - BLength(tx_info);

        if(remain < 0)
        {
            /* dest, src, len */
            kal_mem_cpy(BuffWrite(tx_info), buffaddr, real_count);
            BWrite(tx_info) += real_count;
        }
        else
        {
            kal_mem_cpy(BuffWrite(tx_info), buffaddr, real_count-remain);
            kal_mem_cpy(BStartAddr(tx_info), (kal_uint8 *)(buffaddr+real_count-remain), remain);
            BWrite(tx_info) = remain;
        }
    }


    /* push data from caller buffer to ring buffer */
    /*
    	for (index = 0; index < real_count; index++)
    	{
    		Buf_Push(&(USB2UARTPort.Tx_Buffer), *(buffaddr+index));
    	}
    */

    savedMask = SaveAndSetIRQMask();
    /* in case usb is plugged out just before this critical section */
    if(gUsbDevice.device_type == USB_CDC_ACM)
    {
//		if(USB_DMA_Get_Run_Status(g_UsbACM.txpipe->byEP) == KAL_FALSE)
        if(g_UsbACM.setup_dma == KAL_FALSE)
        {
            g_UsbACM.setup_dma = KAL_TRUE;
            setup_dma = KAL_TRUE;
            ep_num = g_UsbACM.txpipe->byEP;
        }
    }
    RestoreIRQMask(savedMask);

    if(setup_dma == KAL_TRUE)
    {
        USB_Dbg_Trace(USB_ACM_DMA_SETUP_1, drv_get_current_time(), ep_num, 0);
        USB2UART_DMATransmit(ep_num, KAL_FALSE);
    }

#ifndef  __PRODUCTION_RELEASE__
    if(ownerid != USB2UARTPort.ownerid)
    {
        EXT_ASSERT( 0, (kal_uint32) ownerid, (kal_uint32)USB2UARTPort.ownerid, 0);
    }

    if(ownerid != MOD_TST_READER)
    {
        drv_trace1(TRACE_FUNC, USBACM_PUT_BYTES, real_count);
//		kal_prompt_trace(MOD_USB, "Put %d", real_count);
    }
#endif

    return real_count;
}
Пример #6
0
/* put bytes to ISR tx buffer, return value is the actually put out bytes */
static kal_uint16 USB2UART_PutISRBytes(UART_PORT port, kal_uint8 *buffaddr, kal_uint16 length, module_type ownerid)
{
    kal_uint16  real_count;
//	kal_uint16  index;
    kal_uint32  savedMask;
    kal_uint8  ep_num = 0;
    kal_bool  setup_dma = KAL_FALSE;
    kal_int32 	remain;
    BUFFER_INFO 	*tx_isr_info = &(USB2UARTPort.Tx_Buffer_ISR);


    if(ownerid != USB2UARTPort.ownerid)
    {
#ifdef  __PRODUCTION_RELEASE__
        return 0;
#else /* __PRODUCTION_RELEASE__ */
        EXT_ASSERT( 0, (kal_uint32) ownerid, USB2UARTPort.ownerid, 0);
#endif
    }

    if ( (gUsbDevice.device_type != USB_CDC_ACM) ||
            (USB2UARTPort.initialized == KAL_FALSE) || (gUsbDevice.nDevState!=DEVSTATE_CONFIG))
        return 0;

    savedMask = SaveAndSetIRQMask();
    Buf_GetRoomLeft(tx_isr_info, real_count);
    RestoreIRQMask(savedMask);

    /* determine real sent data count */
    if (real_count > length)
        real_count = length;

    if(real_count != 0)
    {
        remain = (BWrite(tx_isr_info) + real_count) - BLength(tx_isr_info);

        if(remain < 0)
        {
            /* dest, src, len */
            kal_mem_cpy(BuffWrite(tx_isr_info), buffaddr, real_count);
            BWrite(tx_isr_info) += real_count;
        }
        else
        {
            kal_mem_cpy(BuffWrite(tx_isr_info), buffaddr, real_count-remain);
            kal_mem_cpy(BStartAddr(tx_isr_info), (kal_uint8 *)(buffaddr+real_count-remain), remain);
            BWrite(tx_isr_info) = remain;
        }
    }

    /* push data from caller buffer to ring buffer */
    /*
    	for (index = 0; index < real_count; index++)
    	{
    		Buf_Push(tx_isr_info, *(buffaddr+index));
    	}
    */

    savedMask = SaveAndSetIRQMask();
    /* in case usb is plugged out just before this critical section */
    if(gUsbDevice.device_type == USB_CDC_ACM)
    {
//		if(USB_DMA_Get_Run_Status(g_UsbACM.txpipe->byEP) == KAL_FALSE)
        if(g_UsbACM.setup_dma == KAL_FALSE)
        {
            g_UsbACM.setup_dma = KAL_TRUE;
            setup_dma = KAL_TRUE;
            ep_num = g_UsbACM.txpipe->byEP;
        }
    }
    RestoreIRQMask(savedMask);

    if(setup_dma == KAL_TRUE)
    {
        USB_Dbg_Trace(USB_ACM_DMA_SETUP_2, drv_get_current_time(), ep_num, 0);
        USB2UART_DMATransmit(ep_num, KAL_FALSE);
    }

#ifndef  __PRODUCTION_RELEASE__
    if(ownerid != USB2UARTPort.ownerid)
    {
        EXT_ASSERT( 0, (kal_uint32) ownerid, (kal_uint32)USB2UARTPort.ownerid, 0);
    }

#endif

    if(ownerid != MOD_TST_READER)
    {
        drv_trace1(TRACE_FUNC, USBACM_PUT_ISR_BYTES, real_count);
//		kal_prompt_trace(MOD_USB, "PutISR %d", real_count);
    }

    return real_count;
}