static void usblp_cleanup (struct usblp *usblp)
{
//	devfs_unregister (usblp->devfs);

	cyg_semaphore_destroy(usblp->wait);	//ZOT716u2
	free(usblp->wait);	//ZOT716u2

	usblp_table [usblp->minor] = NULL;
//{{MARK_DEBUG
//	info ("usblp%d: removed", usblp->minor);
//}}MARK_DEBUG

//615wu	kfree (usblp->writeurb.transfer_buffer);
	kfree (usblp->device_id_string, 0);
	kfree (usblp, 0);
}
void USB_init(cyg_addrword_t data)
{
	cyg_sem_t	sem;

	cyg_semaphore_init(&sem, 0);
	
	ppause(200);	//20 Ticks, 200m seconds
	
	//init memory
	pci_usb_pool_init();
	//usb
	usb_init();
	//ohci
	ohci_hcd_init(0x5C, SYSPA_USB11_OPERATION_BASE_ADDR);
	//ehci
	ehci_hcd_init(0x6B, SYSPA_USB20_OPERATION_BASE_ADDR);	
	//Printer Class
	usblp_init();	

	cyg_semaphore_wait(&sem);
	cyg_semaphore_destroy(&sem);	
}
Пример #3
0
CECOSTimerHandler::~CECOSTimerHandler(){
  cyg_semaphore_destroy(&m_stSemaphore);
}
Пример #4
0
/* 
 * Destroy the semaphore and release the space it took up in the pool 
 */
void sys_sem_free(sys_sem_t sem)
{
	cyg_semaphore_destroy(sem);
	cyg_mempool_var_free(var_mempool_h,(void*)sem);
}
Пример #5
0
int main(int argc, char *argv[])
{
    int       i;
    int       disk;
    int       fd[NUM_DISKS];

    // Initialize the ISP Fibre Channel Controller
    isp_controller_init(0);

    // Create test complete semaphore
    cyg_semaphore_init(&test_cmpl_sema, 0);

    /* Open a connection to the first NUM_DISKS found.
    */
    for (i = 0, disk = 0; (disk < NUM_DISKS) && (i < MAX_NUM_DISKS); ++i)
    {
        cyg_io_handle_t handle;
        Cyg_ErrNo       status;
        char            device[10];

        sprintf(device, "/dev/sd%d", i);

        /* See if this device is present */
        status = cyg_io_lookup(device, &handle);
        if (status == ENOERR)
        {
            fd[disk] = open(device, O_RDWR, 0);
            if (fd[disk] == -1)
            {
                printf ("disktest: open() failed for %s - ", device);
                perror("open");
                return(-1);
            }
            ++disk;
        }
    }

    printf("\nPerforming disktest on %d disk(s)\n", disk);

    // Create tasks to perform disk testing.  Each task tests one disk.
    for (i = 0; i < disk; ++i)
    {
        cyg_thread_create(15, &disktest, fd[i], "disktest", &stack[i][0],
                          CYGNUM_HAL_STACK_SIZE_TYPICAL, 
                          &disktest_handle[i], &disktest_thread[i]);
        cyg_thread_resume(disktest_handle[i]);
    }

    // Wait for test to complete
    for (i = 0; i < disk; ++i)
        cyg_semaphore_wait(&test_cmpl_sema);

    // Close all the files 
    for (i = 0; i < disk; ++i)
        close(fd[i]);

    // Delete semaphore
    cyg_semaphore_destroy(&test_cmpl_sema);

    printf("disktest completed.\n");

    cyg_thread_exit();

    // Should never get here
    return(0);
}