Changeset 50cd285 in mainline


Ignore:
Timestamp:
2011-05-13T14:45:09Z (13 years ago)
Author:
Jan Vesely <jano.vesely@…>
Branches:
lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
Children:
72cd53d, d83bf51
Parents:
8fcaeed (diff), a29529b (diff)
Note: this is a merge changeset, the changes displayed below correspond to the merge itself.
Use the (diff) links above to see all the changes relative to each parent.
Message:

Fix bug #98 Initialization of devices

Doxygen fixes
Adds new SYS_THREAD_DELAY syscall

Files:
26 edited

Legend:

Unmodified
Added
Removed
  • kernel/generic/include/proc/thread.h

    r8fcaeed r50cd285  
    259259extern sysarg_t sys_thread_get_id(thread_id_t *);
    260260extern sysarg_t sys_thread_usleep(uint32_t);
     261extern sysarg_t sys_thread_udelay(uint32_t);
    261262
    262263#endif
  • kernel/generic/include/syscall/syscall.h

    r8fcaeed r50cd285  
    4444        SYS_THREAD_GET_ID,
    4545        SYS_THREAD_USLEEP,
     46        SYS_THREAD_UDELAY,
    4647       
    4748        SYS_TASK_GET_ID,
  • kernel/generic/src/proc/thread.c

    r8fcaeed r50cd285  
    918918}
    919919
     920sysarg_t sys_thread_udelay(uint32_t usec)
     921{
     922        asm_delay_loop(usec * CPU->delay_loop_const);
     923        return 0;
     924}
     925
    920926/** @}
    921927 */
  • kernel/generic/src/syscall/syscall.c

    r8fcaeed r50cd285  
    127127        (syshandler_t) sys_thread_get_id,
    128128        (syshandler_t) sys_thread_usleep,
     129        (syshandler_t) sys_thread_udelay,
    129130       
    130131        (syshandler_t) sys_task_get_id,
  • uspace/drv/ohci/batch.h

    r8fcaeed r50cd285  
    2626 * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
    2727 */
    28 /** @addtogroup drvusbuhcihc
     28/** @addtogroup drvusbohci
    2929 * @{
    3030 */
    3131/** @file
    32  * @brief UHCI driver USB transaction structure
     32 * @brief OHCI driver USB transaction structure
    3333 */
    34 #ifndef DRV_UHCI_BATCH_H
    35 #define DRV_UHCI_BATCH_H
     34#ifndef DRV_OHCI_BATCH_H
     35#define DRV_OHCI_BATCH_H
    3636
    3737#include <usbhc_iface.h>
  • uspace/drv/ohci/endpoint_list.h

    r8fcaeed r50cd285  
    4141#include "utils/malloc32.h"
    4242
    43 typedef struct endpoint_list
    44 {
     43typedef struct endpoint_list {
    4544        fibril_mutex_t guard;
    4645        ed_t *list_head;
  • uspace/drv/ohci/iface.h

    r8fcaeed r50cd285  
    2626 * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
    2727 */
    28 
    2928/** @addtogroup drvusbohci
    3029 * @{
  • uspace/drv/ohci/ohci.h

    r8fcaeed r50cd285  
    2626 * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
    2727 */
    28 
    2928/** @addtogroup drvusbohci
    3029 * @{
  • uspace/drv/ohci/ohci_regs.h

    r8fcaeed r50cd285  
    2626 * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
    2727 */
    28 
    2928/** @addtogroup drvusbohcihc
    3029 * @{
  • uspace/drv/ohci/pci.h

    r8fcaeed r50cd285  
    2626 * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
    2727 */
    28 
    2928/** @addtogroup drvusbohci
    3029 * @{
  • uspace/drv/ohci/root_hub.h

    r8fcaeed r50cd285  
    2626 * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
    2727 */
    28 
    2928/** @addtogroup drvusbohci
    3029 * @{
  • uspace/drv/ohci/utils/malloc32.h

    r8fcaeed r50cd285  
    2626 * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
    2727 */
    28 /** @addtogroup usb
     28/** @addtogroup drvusbohci
    2929 * @{
    3030 */
    3131/** @file
    32  * @brief UHCI driver
     32 * @brief OHCI driver
    3333 */
    34 #ifndef DRV_UHCI_TRANSLATOR_H
    35 #define DRV_UHCI_TRANSLATOR_H
     34#ifndef DRV_OHCI_UTILS_MALLOC32_H
     35#define DRV_OHCI_UTILS_MALLOC32_H
    3636
    3737#include <assert.h>
     
    4040#include <mem.h>
    4141#include <as.h>
    42 
    43 #define UHCI_REQUIRED_PAGE_SIZE 4096
    4442
    4543/** Get physical address translation
     
    6159 *
    6260 * @param[in] size Size of the required memory space
    63  * @return Address of the alligned and big enough memory place, NULL on failure.
     61 * @return Address of the aligned and big enough memory place, NULL on failure.
    6462 */
    6563static inline void * malloc32(size_t size)
     
    7270static inline void free32(void *addr)
    7371        { if (addr) free(addr); }
    74 /*----------------------------------------------------------------------------*/
    75 /** Create 4KB page mapping
    76  *
    77  * @return Address of the mapped page, NULL on failure.
    78  */
    79 static inline void * get_page(void)
    80 {
    81         void * free_address = as_get_mappable_page(UHCI_REQUIRED_PAGE_SIZE);
    82         assert(free_address);
    83         if (free_address == 0)
    84                 return NULL;
    85         void* ret =
    86           as_area_create(free_address, UHCI_REQUIRED_PAGE_SIZE,
    87                   AS_AREA_READ | AS_AREA_WRITE);
    88         if (ret != free_address)
    89                 return NULL;
    90         return ret;
    91 }
    92 
    9372#endif
    9473/**
  • uspace/drv/uhci-hcd/batch.c

    r8fcaeed r50cd285  
    7070 * @param[in] ep Communication target
    7171 * @param[in] buffer Data source/destination.
    72  * @param[in] size Size of the buffer.
     72 * @param[in] buffer_size Size of the buffer.
    7373 * @param[in] setup_buffer Setup data source (if not NULL)
    7474 * @param[in] setup_size Size of setup_buffer (should be always 8)
  • uspace/drv/uhci-hcd/hc.c

    r8fcaeed r50cd285  
    6161 * @param[in] instance Memory place to initialize.
    6262 * @param[in] regs Address of I/O control registers.
    63  * @param[in] size Size of I/O control registers.
     63 * @param[in] reg_size Size of I/O control registers.
     64 * @param[in] interrupts True if hw interrupts should be used.
    6465 * @return Error code.
    6566 * @note Should be called only once on any structure.
  • uspace/drv/uhci-hcd/hc.h

    r8fcaeed r50cd285  
    3333 * @brief UHCI host controller driver structure
    3434 */
    35 #ifndef DRV_UHCI_UHCI_HC_H
    36 #define DRV_UHCI_UHCI_HC_H
     35#ifndef DRV_UHCI_HC_H
     36#define DRV_UHCI_HC_H
    3737
    3838#include <fibril.h>
  • uspace/drv/uhci-hcd/hw_struct/link_pointer.h

    r8fcaeed r50cd285  
    3232 * @brief UHCI driver
    3333 */
    34 #ifndef DRV_UHCI_LINK_POINTER_H
    35 #define DRV_UHCI_LINK_POINTER_H
     34#ifndef DRV_UHCI_HW_STRUCT_LINK_POINTER_H
     35#define DRV_UHCI_HW_STRUCT_LINK_POINTER_H
    3636
    3737/* UHCI link pointer, used by many data structures */
  • uspace/drv/uhci-hcd/hw_struct/queue_head.h

    r8fcaeed r50cd285  
    2626 * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
    2727 */
    28 /** @addtogroup drv usbuhcihc
     28/** @addtogroup drvusbuhcihc
    2929 * @{
    3030 */
     
    3232 * @brief UHCI driver
    3333 */
    34 #ifndef DRV_UHCI_QH_H
    35 #define DRV_UHCI_QH_H
     34#ifndef DRV_UHCI_HW_STRUCT_QH_H
     35#define DRV_UHCI_HW_STRUCT_QH_H
    3636#include <assert.h>
    3737
     
    6565 *
    6666 * @param[in] instance qh_t structure to use.
    67  * @param[in] pa Physical address of the next queue head.
     67 * @param[in] next Address of the next queue.
    6868 *
    6969 * Adds proper flag. If the pointer is NULL, sets next to terminal NULL.
     
    8181/** Set queue head element pointer
    8282 *
    83  * @param[in] instance qh_t structure to initialize.
    84  * @param[in] pa Physical address of the TD structure.
     83 * @param[in] instance qh_t structure to use.
     84 * @param[in] td Transfer descriptor to set as the first element.
    8585 *
    8686 * Adds proper flag. If the pointer is NULL, sets element to terminal NULL.
  • uspace/drv/uhci-hcd/hw_struct/transfer_descriptor.h

    r8fcaeed r50cd285  
    3232 * @brief UHCI driver
    3333 */
    34 #ifndef DRV_UHCI_TRANSFER_DESCRIPTOR_H
    35 #define DRV_UHCI_TRANSFER_DESCRIPTOR_H
     34#ifndef DRV_UHCI_HW_STRUCT_TRANSFER_DESCRIPTOR_H
     35#define DRV_UHCI_HW_STRUCT_TRANSFER_DESCRIPTOR_H
    3636
    3737#include <mem.h>
  • uspace/drv/uhci-hcd/root_hub.h

    r8fcaeed r50cd285  
    3333 * @brief UHCI driver
    3434 */
    35 #ifndef DRV_UHCI_UHCI_RH_H
    36 #define DRV_UHCI_UHCI_RH_H
     35#ifndef DRV_UHCI_RH_H
     36#define DRV_UHCI_RH_H
    3737
    3838#include <ddf/driver.h>
  • uspace/drv/uhci-hcd/uhci.c

    r8fcaeed r50cd285  
    161161/** Initialize hc and rh DDF structures and their respective drivers.
    162162 *
    163  * @param[in] instance UHCI structure to use.
    164163 * @param[in] device DDF instance of the device to use.
    165164 *
     
    167166 *  - gets device's hw resources
    168167 *  - disables UHCI legacy support (PCI config space)
    169  *  - asks for interrupt
     168 *  - attempts to enable interrupts
    170169 *  - registers interrupt handler
    171170 */
  • uspace/drv/uhci-hcd/utils/malloc32.h

    r8fcaeed r50cd285  
    2626 * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
    2727 */
    28 /** @addtogroup usb
     28/** @addtogroup drvusbuhci
    2929 * @{
    3030 */
     
    3232 * @brief UHCI driver
    3333 */
    34 #ifndef DRV_UHCI_TRANSLATOR_H
    35 #define DRV_UHCI_TRANSLATOR_H
     34#ifndef DRV_UHCI_UTILS_MALLOC32_H
     35#define DRV_UHCI_UTILS_MALLOC32_H
    3636
    3737#include <assert.h>
  • uspace/drv/uhci-hcd/utils/slab.c

    r8fcaeed r50cd285  
    2626 * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
    2727 */
    28 /** @addtogroup usb
     28/** @addtogroup drvusbuhcihc
    2929 * @{
    3030 */
  • uspace/drv/uhci-hcd/utils/slab.h

    r8fcaeed r50cd285  
    2626 * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
    2727 */
    28 /** @addtogroup usb
     28/** @addtogroup drvusbuhcihc
    2929 * @{
    3030 */
     
    3232 * @brief UHCI driver
    3333 */
    34 #ifndef DRV_UHCI_SLAB_H
    35 #define DRV_UHCI_SLAB_H
     34#ifndef DRV_UHCI_UTILS_SLAB_H
     35#define DRV_UHCI_UTILS_SLAB_H
    3636
    3737#include <bool.h>
  • uspace/drv/uhci-rhd/port.c

    r8fcaeed r50cd285  
    3636#include <errno.h>
    3737#include <str_error.h>
     38#include <time.h>
    3839
    3940#include <usb/usb.h>    /* usb_address_t */
     
    6566 *
    6667 * @param[in] port Structure to use.
    67  * @param[in] value New register value.
     68 * @param[in] val New register value.
    6869 * @return Error code. (Always EOK)
    6970 */
     
    7778 *
    7879 * @param[in] port Memory structure to use.
    79  * @param[in] addr Address of I/O register.
     80 * @param[in] address Address of I/O register.
    8081 * @param[in] number Port number.
    8182 * @param[in] usec Polling interval.
     
    224225                uhci_port_write_status(port, port_status);
    225226                while (uhci_port_read_status(port) & STATUS_IN_RESET);
    226                 // TODO: find a better way to waste time (it should be less than
    227                 // 10ms, if we reschedule it takes too much time (random
    228                 // interrupts can be solved by multiple attempts).
    229                 usb_log_debug2("%s: Reset Signal stop.\n", port->id_string);
    230         }
     227        }
     228        udelay(10);
    231229        /* Enable the port. */
    232230        uhci_port_set_enabled(port, true);
  • uspace/lib/c/generic/time.c

    r8fcaeed r50cd285  
    207207}
    208208
     209void udelay(useconds_t time)
     210{
     211        (void) __SYSCALL1(SYS_THREAD_UDELAY, (sysarg_t) time);
     212}
     213
     214
    209215/** Wait unconditionally for specified number of seconds
    210216 *
  • uspace/lib/c/include/sys/time.h

    r8fcaeed r50cd285  
    6262extern int gettimeofday(struct timeval *tv, struct timezone *tz);
    6363
     64extern void udelay(useconds_t);
     65
    6466#endif
    6567
Note: See TracChangeset for help on using the changeset viewer.