The Design and Implementation of the FreeBSD Operating System, Second Edition
Now available: The Design and Implementation of the FreeBSD Operating System (Second Edition)


[ source navigation ] [ diff markup ] [ identifier search ] [ freetext search ] [ file search ] [ list types ] [ track identifier ]

FreeBSD/Linux Kernel Cross Reference
sys/i386/xbox/pic16l.s

Version: -  FREEBSD  -  FREEBSD-13-STABLE  -  FREEBSD-13-0  -  FREEBSD-12-STABLE  -  FREEBSD-12-0  -  FREEBSD-11-STABLE  -  FREEBSD-11-0  -  FREEBSD-10-STABLE  -  FREEBSD-10-0  -  FREEBSD-9-STABLE  -  FREEBSD-9-0  -  FREEBSD-8-STABLE  -  FREEBSD-8-0  -  FREEBSD-7-STABLE  -  FREEBSD-7-0  -  FREEBSD-6-STABLE  -  FREEBSD-6-0  -  FREEBSD-5-STABLE  -  FREEBSD-5-0  -  FREEBSD-4-STABLE  -  FREEBSD-3-STABLE  -  FREEBSD22  -  l41  -  OPENBSD  -  linux-2.6  -  MK84  -  PLAN9  -  xnu-8792 
SearchContext: -  none  -  3  -  10 

    1 /*-
    2  * Copyright (c) 2005 Rink Springer
    3  * All rights reserved.
    4  *
    5  * Redistribution and use in source and binary forms, with or without
    6  * modification, are permitted provided that the following conditions
    7  * are met:
    8  * 1. Redistributions of source code must retain the above copyright
    9  *    notice, this list of conditions and the following disclaimer.
   10  * 2. Redistributions in binary form must reproduce the above copyright
   11  *    notice, this list of conditions and the following disclaimer in the
   12  *    documentation and/or other materials provided with the distribution.
   13  * 3. The name of the author may not be used to endorse or promote products
   14  *    derived from this software without specific prior written permission
   15  *
   16  * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
   17  * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
   18  * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
   19  * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
   20  * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
   21  * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
   22  * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
   23  * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
   24  * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
   25  * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
   26  *
   27  * $FreeBSD: releng/10.3/sys/i386/xbox/pic16l.s 152219 2005-11-09 03:55:40Z imp $
   28  */
   29 #include <machine/asmacros.h>
   30 
   31 .text
   32 
   33 /*
   34  * send a command to the PIC16L
   35  *
   36  * void pic16l_setbyte (int addr, int reg, int data)
   37  *
   38  */
   39 ENTRY(pic16l_setbyte)
   40         push    %ebp
   41         mov     %esp,%ebp
   42 
   43         push    %ebx
   44 
   45         movw    $0xc000,%dx
   46 
   47 1:      xor     %eax,%eax
   48         inw     %dx,%ax
   49         shr     $0x0b,%eax
   50         and     $0x01,%eax
   51         test    %eax,%eax
   52         jne     1b
   53         
   54         mov     $50,%ecx
   55 2:      movw    $0xc004,%dx
   56         movl    0x8(%ebp),%eax
   57         outb    %al,%dx
   58         movw    $0xc008,%dx
   59         movl    0xc(%ebp),%eax
   60         outb    %al,%dx
   61         movw    $0xc006,%dx
   62         movl    0x10(%ebp),%eax
   63         outw    %ax,%dx
   64         
   65         movw    $0xc000,%dx
   66         inw     %dx,%ax
   67         outw    %ax,%dx
   68         
   69         movw    $0xc002,%dx
   70         movb    $0x1a,%al
   71         outb    %al,%dx
   72         
   73         movw    $0xc000,%dx
   74 3:
   75         inb     %dx,%al
   76         movb    %al,%bl
   77         orb     $0x36,%al
   78         jz      3b
   79 
   80         orb     $0x10,%bl
   81         jnz     5f
   82         
   83 4:
   84         push    %ecx
   85         xor     %ecx,%ecx
   86 l:      loop    l
   87         pop     %ecx
   88 
   89         dec     %ecx
   90         jz      5f
   91         jmp     2b
   92 5:
   93 
   94         pop     %ebx
   95 
   96         leave
   97         ret
   98 
   99 /*
  100  * instructs the pic16l to reboot the xbox
  101  *
  102  * void pic16l_reboot();
  103  *
  104  */
  105 ENTRY(pic16l_reboot)
  106         pushl   $0x01
  107         pushl   $0x02
  108         pushl   $0x20
  109         call    pic16l_setbyte
  110         addl    $12,%esp
  111         ret
  112 
  113 /*
  114  * instructs the pic16l to power-off the xbox
  115  *
  116  * void pic16l_poweroff();
  117  *
  118  */
  119 ENTRY(pic16l_poweroff)
  120         pushl   $0x80
  121         pushl   $0x02
  122         pushl   $0x20
  123         call    pic16l_setbyte
  124         addl    $12,%esp
  125         ret
  126 
  127 pic16l_ledhlp:
  128         movw    $0xc000,%dx
  129 1:      xor     %eax,%eax
  130         inw     %dx,%ax
  131         shr     $0x0b,%eax
  132         and     $0x01,%eax
  133         test    %eax,%eax
  134         jne     1b
  135         
  136         mov     $400,%ecx
  137         
  138 2:
  139         movw    $0xc004,%dx
  140         movb    $0x20,%al
  141         outb    %al,%dx
  142 
  143         movw    $0xc008,%dx
  144         movb    %bh,%al
  145         outb    %al,%dx
  146 
  147         movw    $0xc006,%dx
  148         movb    %bl,%al
  149         outb    %al,%dx
  150 
  151         movw    $0xc000,%dx
  152         inw     %dx,%ax
  153         outw    %ax,%dx
  154         
  155         movw    $0xc002,%dx
  156         movb    $0x1a,%al
  157         outb    %al,%dx
  158         
  159         movw    $0xc000,%dx
  160 3:
  161         inb     %dx,%al
  162         movb    %al,%bl
  163         orb     $0x36,%al
  164         jz      3b
  165         
  166         orb     $0x10,%bl
  167         jz      4f
  168         
  169         ret
  170         
  171 4:
  172         push    %ecx
  173         xor     %ecx,%ecx
  174 l2:     loop    l2
  175         pop     %ecx
  176         dec     %ecx
  177         jz      5f
  178         jmp     2b
  179 5:
  180         ret
  181 
  182 /*
  183  * changes the front led
  184  *
  185  * void pic16l_setled (int val);
  186  */
  187 ENTRY(pic16l_setled)
  188         push    %ebp
  189         mov     %esp,%ebp
  190 
  191         push    %ebx
  192 
  193         movl    0x8(%ebp),%ebx
  194         orl     $0x800,%ebx
  195         call    pic16l_ledhlp
  196         movl    $0x701,%ebx
  197         call    pic16l_ledhlp
  198 
  199         pop     %ebx
  200 
  201         leave
  202         ret

Cache object: 1f2a05cfeaea3a781f485be7ce617896


[ source navigation ] [ diff markup ] [ identifier search ] [ freetext search ] [ file search ] [ list types ] [ track identifier ]


This page is part of the FreeBSD/Linux Linux Kernel Cross-Reference, and was automatically generated using a modified version of the LXR engine.