[77] | 1 | /* |
---|
| 2 | * hal_drivers.c - Driver initializers for TSAR |
---|
| 3 | * |
---|
| 4 | * Copyright (c) 2017 Maxime Villard |
---|
| 5 | * |
---|
| 6 | * This file is part of ALMOS-MKH. |
---|
| 7 | * |
---|
| 8 | * ALMOS-MKH is free software; you can redistribute it and/or modify it |
---|
| 9 | * under the terms of the GNU General Public License as published by |
---|
| 10 | * the Free Software Foundation; version 2.0 of the License. |
---|
| 11 | * |
---|
| 12 | * ALMOS-MKH is distributed in the hope that it will be useful, but |
---|
| 13 | * WITHOUT ANY WARRANTY; without even the implied warranty of |
---|
| 14 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU |
---|
| 15 | * General Public License for more details. |
---|
| 16 | * |
---|
| 17 | * You should have received a copy of the GNU General Public License |
---|
| 18 | * along with ALMOS-MKH.; if not, write to the Free Software Foundation, |
---|
| 19 | * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA |
---|
| 20 | */ |
---|
| 21 | |
---|
| 22 | #include <hal_types.h> |
---|
| 23 | #include <chdev.h> |
---|
| 24 | #include <hal_drivers.h> |
---|
[238] | 25 | #include <printk.h> |
---|
[77] | 26 | |
---|
[130] | 27 | #include <soclib_tty.h> |
---|
[196] | 28 | #include <soclib_pic.h> |
---|
[238] | 29 | #include <soclib_bdv.h> |
---|
| 30 | #include <soclib_hba.h> |
---|
[130] | 31 | |
---|
[238] | 32 | /////////////////////////////////////////////////////////////////////////////// |
---|
| 33 | // TXT |
---|
| 34 | /////////////////////////////////////////////////////////////////////////////// |
---|
[77] | 35 | |
---|
[238] | 36 | ////////////////////////////////////////// |
---|
| 37 | void hal_drivers_txt_init( chdev_t * txt ) |
---|
[130] | 38 | { |
---|
[238] | 39 | soclib_tty_init( txt ); |
---|
[130] | 40 | } |
---|
| 41 | |
---|
[238] | 42 | /////////////////////////////////////////////////////////////////////////////// |
---|
| 43 | // PIC |
---|
| 44 | /////////////////////////////////////////////////////////////////////////////// |
---|
[136] | 45 | |
---|
[238] | 46 | ////////////////////////////////////////// |
---|
| 47 | void hal_drivers_pic_init( chdev_t * pic ) |
---|
[136] | 48 | { |
---|
[238] | 49 | soclib_pic_init( pic ); |
---|
[136] | 50 | |
---|
[190] | 51 | /* update the PIC chdev extension */ |
---|
[238] | 52 | pic->ext.pic.enable_timer = &soclib_pic_enable_timer; |
---|
| 53 | pic->ext.pic.enable_irq = &soclib_pic_enable_irq; |
---|
| 54 | pic->ext.pic.disable_irq = &soclib_pic_disable_irq; |
---|
| 55 | pic->ext.pic.bind_irq = &soclib_pic_bind_irq; |
---|
| 56 | pic->ext.pic.send_ipi = &soclib_pic_send_ipi; |
---|
| 57 | pic->ext.pic.extend_init = &soclib_pic_extend_init; |
---|
[190] | 58 | } |
---|
[213] | 59 | |
---|
[238] | 60 | /////////////////////////////////////////////////////////////////////////////// |
---|
| 61 | // IOC |
---|
| 62 | /////////////////////////////////////////////////////////////////////////////// |
---|
[213] | 63 | |
---|
[238] | 64 | ////////////////////////////////////////// |
---|
| 65 | void hal_drivers_ioc_init( chdev_t * ioc, |
---|
| 66 | uint32_t impl ) |
---|
[213] | 67 | { |
---|
[238] | 68 | if (impl == IMPL_IOC_BDV) |
---|
| 69 | { |
---|
| 70 | soclib_bdv_init( ioc ); |
---|
| 71 | } |
---|
| 72 | else if (impl == IMPL_IOC_HBA) |
---|
| 73 | { |
---|
| 74 | soclib_hba_init( ioc ); |
---|
| 75 | } |
---|
| 76 | else |
---|
| 77 | { |
---|
[216] | 78 | assert( false , __FUNCTION__ , "undefined IOC device implementation" ); |
---|
| 79 | } |
---|
[213] | 80 | } |
---|
| 81 | |
---|