1 /* 2 * Copyright 2018 Haiku, Inc. All rights reserved. 3 * Distributed under the terms of the MIT License. 4 * 5 * Authors: 6 * B Krishnan Iyer, krishnaniyer97@gmail.com 7 */ 8 #ifndef MMC_BUS_H 9 #define MMC_BUS_H 10 11 12 #include <new> 13 #include <stdio.h> 14 #include <string.h> 15 16 #include <lock.h> 17 #include <util/AutoLock.h> 18 #include "mmc.h" 19 20 21 #define MMCBUS_TRACE 22 #ifdef MMCBUS_TRACE 23 # define TRACE(x...) dprintf("\33[33mmmc_bus:\33[0m " x) 24 #else 25 # define TRACE(x...) 26 #endif 27 #define TRACE_ALWAYS(x...) dprintf("\33[33mmmc_bus:\33[0m " x) 28 #define ERROR(x...) dprintf("\33[33mmmc_bus:\33[0m " x) 29 #define CALLED() TRACE("CALLED %s\n", __PRETTY_FUNCTION__) 30 31 extern device_manager_info *gDeviceManager; 32 33 34 class MMCBus; 35 36 class MMCBus { 37 public: 38 39 MMCBus(device_node *node); 40 ~MMCBus(); 41 status_t InitCheck(); 42 43 private: 44 status_t ExecuteCommand(uint8_t command, 45 uint32_t argument, uint32_t* response); 46 static status_t WorkerThread(void*); 47 48 private: 49 50 device_node* fNode; 51 mmc_bus_interface* fController; 52 void* fCookie; 53 status_t fStatus; 54 thread_id fWorkerThread; 55 }; 56 57 58 #endif /*MMC_BUS_H*/ 59