public inbox for ecos-discuss@sourceware.org
 help / color / mirror / Atom feed
* [ECOS] Does eCos work with SH7705 CPU
@ 2009-11-30 13:10 m mariga
  2009-12-06  6:35 ` [ECOS] How to send USB enumeration data to host m mariga
  0 siblings, 1 reply; 3+ messages in thread
From: m mariga @ 2009-11-30 13:10 UTC (permalink / raw)
  To: ecos-discuss

Hello everyone,

Our company develops printer-application product using SH7705 CPU and likes 
to port eCos on that board.
Now,as I previously succeeded in porting eCos on SH7709 target,I made a rash 
promise that it's no problem at all.
But when I checked eCos source I realized that there is no SH7705 reference 
whatsoever.
There are not even variant definitions in cdl files.
I began to be afraid that I should be called a liar.

Anyway I must to do it ,so as a starting point, I tried to create SH7705 
template.
Although I have not yet inquired detail differences,roughly I followed a 
easy way to copy SH7709 variant definitions in several cdl files.
For example I made SH7705 variants from SH7709 variants like below,and 
succeeded in creating SH7705 skelton template.

for example,
-- original SH7709 variants
    cdl_option CYGPKG_HAL_SH_7709S {
        display       "SH 7709S microprocessor"
        parent        CYGPKG_HAL_SH_CPU
        implements    CYGINT_HAL_SH_VARIANT
        implements    CYGINT_HAL_SH_CPG_T3
        implements    CYGINT_HAL_SH_DMA_CHANNELS
        implements    CYGINT_HAL_SH_DMA_CHANNELS
        implements    CYGINT_HAL_SH_DMA_CHANNELS
        implements    CYGINT_HAL_SH_DMA_CHANNELS
        default_value 0
        no_define
        define        -file=system.h CYGPKG_HAL_SH_7709S
        description "
            The SH3 7709S microprocessor. This is an embedded part that in
            addition to the SH3 processor core has built in peripherals
            such as memory controllers, DMA controllers, A/D and D/A
            converters, serial ports and timers/counters."
        define_proc {
            puts $cdl_system_header "#define CYGBLD_HAL_CPU_MODULES_H 
<cyg/hal/mod_7709s.h>"
        }
    }
-- my-concocted SH7705 variant. This is roughly simply copied from above.
    cdl_option CYGPKG_HAL_SH_7705 {
        display       "SH 7705 microprocessor"
        parent        CYGPKG_HAL_SH_CPU
        implements    CYGINT_HAL_SH_VARIANT
        implements    CYGINT_HAL_SH_CPG_T3
        implements    CYGINT_HAL_SH_DMA_CHANNELS
        implements    CYGINT_HAL_SH_DMA_CHANNELS
        implements    CYGINT_HAL_SH_DMA_CHANNELS
        implements    CYGINT_HAL_SH_DMA_CHANNELS
        default_value 1
        no_define
        define        -file=system.h CYGPKG_HAL_SH_7705
        description "
            The SH3 7705 microprocessor. This is an embedded part that in
            addition to the SH3 processor core has built in peripherals
            such as memory controllers, DMA controllers, A/D and D/A
            converters, serial ports and timers/counters."
        define_proc {
            puts $cdl_system_header "#define CYGBLD_HAL_CPU_MODULES_H 
<cyg/hal/mod_7705.h>"
        }
    }

But I feel strong anxiety whether it is possible to port eCos on SH7705 
target.
Is there a fundamental reason it does not work on SH7705 target anyway ?
And if there are any important things to remember,would you please teach me.

m mariga


-- 
Before posting, please read the FAQ: http://ecos.sourceware.org/fom/ecos
and search the list archive: http://ecos.sourceware.org/ml/ecos-discuss

^ permalink raw reply	[flat|nested] 3+ messages in thread

* [ECOS] How to send USB enumeration data to host
  2009-11-30 13:10 [ECOS] Does eCos work with SH7705 CPU m mariga
@ 2009-12-06  6:35 ` m mariga
  2009-12-09  9:25   ` [ECOS] Can not compile API file m mariga
  0 siblings, 1 reply; 3+ messages in thread
From: m mariga @ 2009-12-06  6:35 UTC (permalink / raw)
  To: ecos-discuss

Hello everyone,

I intend to implement USB driver into my target board.
So I am studying sa11x0 driver relying on Reference Manual,but I can't 
understand how to start communication to host PC.

According to Reference Manual,in order to start usb operation I should call 
usbs_start in application.
--- source code begin
usbs_start(usbs_control_endpoint* endpoint)
{
    CYG_CHECK_DATA_PTR( endpoint, "A valid USB endpoint must be supplied");
    CYG_CHECK_FUNC_PTR( endpoint->start_fn, "The USB endpoint should have a 
start function");

    (*endpoint->start_fn)(endpoint);
}
--- source code end

In case of sa11x0-driver,start_fn is usbs_sa11x0_ep0_start.

--- source code begin
static ep0_impl ep0 = {
        start_fn:               &usbs_sa11x0_ep0_start,

static void
usbs_sa11x0_ep0_start(usbs_control_endpoint* endpoint)
{
    CYG_ASSERT( endpoint == &ep0.common, "USB startup involves the wrong 
endpoint");

    // Activate the hardware. Write a 0 to the enable/disable bit 0.
    // Bit 1 is read-only. The other bits are set to 1 to disable
    // the corresponding interrupt source.
    usbs_sa11x0_poke(USBS_CONTROL, CONTROL_ALL_INTR, CONTROL_ALL_INTR, 0);
//#define CONTROL_ALL_INTR                0x00FC

    // If there is additional platform-specific initialization to
    // perform, do it now. This macro can come from the platform HAL.
#ifdef SA11X0_USB_PLATFORM_INIT
    SA11X0_USB_PLATFORM_INIT;
#endif

    // Clear any pending interrupts. There should not be any, but just
    // in case. Note: passing 0x00FF as the should_be_clear argument
    // is a race condition, an external event can happen at any time,
    // so we may loop unnecessarily and lose an interrupt. However
    // the initial reset should last for 10ms.
    usbs_sa11x0_poke(USBS_STATUS, 0x00FF, 0x00, 0x00FF);

    // The only interrupt really of interest right now is reset, but
    // it is likely to be preceded by a resume.
    usbs_sa11x0_poke(USBS_CONTROL,
                     CONTROL_INTR_ENABLE(CONTROL_RESET_INTR | 
CONTROL_RESUME_INTR),   // 01111000
                     0,
                     CONTROL_INTR_CLEAR(CONTROL_RESET_INTR | 
CONTROL_RESUME_INTR));   // 10000100
}
--- source code end

I understand, perusing SA11X0 manual, that it makes all interrupts but 
Reset-interrupt disable.
I searched where it makes interrupts enable,and found that 
usbs_sa11x0_init() makes USB-line interrupts enable.

--- source code begin
usbs_sa11x0_init(void)
{

    // It is also possible and desirable to install the interrupt
    // handler here, even though there will be no interrupts for a
    // while yet.
    cyg_drv_interrupt_create(SA11X0_IRQ_USB_SERVICE_REQUEST,
                             99,        // priority
                             0,         // data
                             &usbs_sa11x0_isr,
#ifdef CYGPKG_DEVS_USB_SA11X0_THREAD
                             &usbs_sa11x0_thread_dsr,
#else
                             &usbs_sa11x0_dsr,
#endif
                             &usbs_sa11x0_intr_handle,
                             &usbs_sa11x0_intr_data);
    cyg_drv_interrupt_attach(usbs_sa11x0_intr_handle);
    cyg_drv_interrupt_unmask(SA11X0_IRQ_USB_SERVICE_REQUEST);
}
--- source code end

I studied where usbs_sa11x0_init is called and knew that it is called by way 
of staic constructor like below,supposing devtab is not used.

--- source code begin
C:\cygwin\opt\el_sc1\ecos\packages\devs\usb\sa11x0\current\src\usbs_sa11x0_data.cxx
class usbs_sa11x0_initialization {
  public:
    usbs_sa11x0_initialization() {
        usbs_sa11x0_init();
    }
};
static usbs_sa11x0_initialization usbs_sa11x0_init_object 
CYGBLD_ATTRIB_INIT_PRI(CYG_INIT_IO);
--- source code end

Although I am not sure,but I think staic constructor is executed before 
main().
I think,in sa11x0 case,usbs_sa11x0_init() is executed previous to 
usbs_start() and set interrupts enable.
But after that, usbs_start() is executed and makes interrupts disable.

Where am I wrong and how to enable interrups and start communication to host 
?
Please enlighten me.

m mariga


-- 
Before posting, please read the FAQ: http://ecos.sourceware.org/fom/ecos
and search the list archive: http://ecos.sourceware.org/ml/ecos-discuss

^ permalink raw reply	[flat|nested] 3+ messages in thread

* [ECOS] Can not compile API file
  2009-12-06  6:35 ` [ECOS] How to send USB enumeration data to host m mariga
@ 2009-12-09  9:25   ` m mariga
  0 siblings, 0 replies; 3+ messages in thread
From: m mariga @ 2009-12-09  9:25 UTC (permalink / raw)
  To: ecos-discuss

Hello everyone,

I am in a very serious predicament, please help me.

I would like to implement USB driver for my target.
But by scarce schedule time,I cannot afford to implement it by normal 
way,which I mean, by using ecos-formal-sample and construct step by step.
Instead my way is to include others-developed-and-confirmed USB sources that 
have been developed on other OS.
I do not use devtab function.

I created \devs\usb\sh7705mod\v3_0\src and inserted next source files.
DoBulk.c
DoControl.c
DoInterrupt.c
DoRequest.c
DoRequestPrinterClass.c
PPOUT.C
UsbMain.c
usbs_sh7705mod_data.cxx

All of these except PPOUT.C deal with USB transfer.
Only PPOUT.C is different.This function is polling USB buffer and if there 
are data, outputs them to printer port.
In this file there is a user-calling routine(API). It shares only USB buffer 
and not calls any other USB functions.
I defined prototype in proto_ppout.h and enterd it in 
\devs\usb\sh7705mod\v3_0\include directory.

I included instructions in CDL file to compile these files.
    cdl_option CYGFUN_DEVS_USB_SH7705MOD_EP0 {
 display       "Support the control endpoint 0"
 default_value CYGINT_IO_USB_SLAVE_CLIENTS
 # And the USB support packages
 requires      CYGPKG_IO_USB CYGPKG_IO_USB_SLAVE
 compile       UsbMain.c DoBulk.c DoControl.c DoRequest.c 
DoRequestPrinterClass.c PPOUT.C
 compile       -library=libextras.a usbs_sh7705mod_data.cxx
 description "
     Enable support for endpoint 0. If this support is disabled
     then the entire USB port is unusable."
    }

Whenever I build using configtool.exe I cannot compile PPOUT.C.
Other files are compiled.
I do not know why only this file cannot be compiled.
Please help me.
I append build-log,PPOUT.C,proto_ppout.h,usbs_sh7705mod.cdl.

m mariga



-- 
Before posting, please read the FAQ: http://ecos.sourceware.org/fom/ecos
and search the list archive: http://ecos.sourceware.org/ml/ecos-discuss

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2009-12-09  9:25 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2009-11-30 13:10 [ECOS] Does eCos work with SH7705 CPU m mariga
2009-12-06  6:35 ` [ECOS] How to send USB enumeration data to host m mariga
2009-12-09  9:25   ` [ECOS] Can not compile API file m mariga

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).