~ [ source navigation ] ~ [ diff markup ] ~ [ identifier search ] ~ [ freetext search ] ~ [ file search ] ~

Minix Cross Reference
Minix/kernel/driver.h


  1 /* Types and constants shared between the generic and device dependent
  2  * device driver code.
  3  */
  4 
  5 #include <minix/callnr.h>
  6 #include <minix/com.h>
  7 #include "proc.h"
  8 #include <minix/partition.h>
  9 
 10 /* Info about and entry points into the device dependent code. */
 11 struct driver {
 12   _PROTOTYPE( char *(*dr_name), (void) );
 13   _PROTOTYPE( int (*dr_open), (struct driver *dp, message *m_ptr) );
 14   _PROTOTYPE( int (*dr_close), (struct driver *dp, message *m_ptr) );
 15   _PROTOTYPE( int (*dr_ioctl), (struct driver *dp, message *m_ptr) );
 16   _PROTOTYPE( struct device *(*dr_prepare), (int device) );
 17   _PROTOTYPE( int (*dr_schedule), (int proc_nr, struct iorequest_s *request) );
 18   _PROTOTYPE( int (*dr_finish), (void) );
 19   _PROTOTYPE( void (*dr_cleanup), (void) );
 20   _PROTOTYPE( void (*dr_geometry), (struct partition *entry) );
 21 };
 22 
 23 #if (CHIP == INTEL)
 24 
 25 /* Number of bytes you can DMA before hitting a 64K boundary: */
 26 #define dma_bytes_left(phys)    \
 27    ((unsigned) (sizeof(int) == 2 ? 0 : 0x10000) - (unsigned) ((phys) & 0xFFFF))
 28 
 29 #endif /* CHIP == INTEL */
 30 
 31 /* Base and size of a partition in bytes. */
 32 struct device {
 33   unsigned long dv_base;
 34   unsigned long dv_size;
 35 };
 36 
 37 #define NIL_DEV         ((struct device *) 0)
 38 
 39 /* Functions defined by driver.c: */
 40 _PROTOTYPE( void driver_task, (struct driver *dr) );
 41 _PROTOTYPE( int do_rdwt, (struct driver *dr, message *m_ptr) );
 42 _PROTOTYPE( int do_vrdwt, (struct driver *dr, message *m_ptr) );
 43 _PROTOTYPE( char *no_name, (void) );
 44 _PROTOTYPE( int do_nop, (struct driver *dp, message *m_ptr) );
 45 _PROTOTYPE( int nop_finish, (void) );
 46 _PROTOTYPE( void nop_cleanup, (void) );
 47 _PROTOTYPE( void clock_mess, (int ticks, watchdog_t func) );
 48 _PROTOTYPE( int do_diocntl, (struct driver *dr, message *m_ptr) );
 49 
 50 /* Parameters for the disk drive. */
 51 #define SECTOR_SIZE      512    /* physical sector size in bytes */
 52 #define SECTOR_SHIFT       9    /* for division */
 53 #define SECTOR_MASK      511    /* and remainder */
 54 
 55 /* Size of the DMA buffer buffer in bytes. */
 56 #define DMA_BUF_SIZE    (DMA_SECTORS * SECTOR_SIZE)
 57 
 58 #if (CHIP == INTEL)
 59 extern u8_t *tmp_buf;                   /* the DMA buffer */
 60 #else
 61 extern u8_t tmp_buf[];                  /* the DMA buffer */
 62 #endif
 63 extern phys_bytes tmp_phys;             /* phys address of DMA buffer */
 64 

~ [ source navigation ] ~ [ diff markup ] ~ [ identifier search ] ~ [ freetext search ] ~ [ file search ] ~

This page was automatically generated by the LXR engine.
Visit the LXR main site for more information.