GitLab has been upgraded to 13.3.6. If you encounter any issues mail code@riscosopen.org

Commit 3e8f7ee2 authored by ROOL's avatar ROOL 🤖

Remove HAL library variant

Detail:
  Simplify the makefile by not building a HAL variant.
  cmodule.c: 2 fewer warnings
  musb.c/musb_debug.c/musb_peri.c/musb_root.c/musb_util.c/tps.c: remove usbhal.h include
  cmodule.h/musb_usb.c: USBHAL is no longer defined
  CMHG file changed to make Makefile
Admin:
  Submission for USB bounty.

Version 0.32. Tagged as 'MUSBDriver-0_32'
parent bd563b29
| Copyright 2011 Castle Technology Ltd
|
| Licensed under the Apache License, Version 2.0 (the "License");
| you may not use this file except in compliance with the License.
| You may obtain a copy of the License at
|
| http://www.apache.org/licenses/LICENSE-2.0
|
| Unless required by applicable law or agreed to in writing, software
| distributed under the License is distributed on an "AS IS" BASIS,
| WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
| See the License for the specific language governing permissions and
| limitations under the License.
|
Dir <Obey$Dir>
amu_machine export PHASE=hdrs THROWBACK=-throwback
amu_machine export PHASE=libs THROWBACK=-throwback
......@@ -19,55 +19,25 @@
COMPONENT = MUSBDriver
RES_AREA = resource_files
OBJS = cmodule call_veneer musb musb_debug musb_peri musb_root musb_usb musb_util bsd_fns triggercbs tps
OBJS_HAL = o_hal.musb o_hal.musb_peri o_hal.musb_root o_hal.musb_usb o_hal.musb_util o_hal.tps o_hal.musb_hal
LIBS = ${CALLXLIB} ${ASMUTILS} ${TBOXINTLIB}
CMHGFILE = modhead
HDRS =
USBDIR = <Lib$Dir>.USB
CUSTOMEXP = custom
CMHGDEPENDS = cmodule musb tps
ROMCDEFINES = -DROM
CINCLUDES = -ITCPIPLibs:,C:USB,OS:
CFLAGS += -wp -wc
CDEFINES += -DKERNEL -D_KERNEL -Dpaddr_t=int -D__P(A)=A -DKLD_MODULE -DDISABLE_PACKED
#
# Debug switch
#
DEBUG ?= FALSE
DEBUG ?= FALSE
ifeq (${DEBUG},TRUE)
CFLAGS += -DDEBUGLIB -DMUSB_DEBUG -DUSB_DEBUG
CFLAGS += -DDEBUGLIB -DMUSB_DEBUG
CMHGDEFINES += -DMUSB_DEBUG
LIBS += ${NET5LIBS}
endif
CFLAGS += -wp -wc
CDEFINES += -DKERNEL -D_KERNEL -Dpaddr_t=int -D__P(A)=A -DKLD_MODULE -DDISABLE_PACKED
ROMCDEFINES = -DROM
CINCLUDES = -ITCPIPLibs:,C:USB,OS:
CMHGDEFINES += -DCOMPONENT=${COMPONENT}
CMHGDEPENDS = cmodule musb tps
LDFLAGS = -Symbols rm.sym${TARGET}
include CModule
${DIRS}::
${MKDIR} o_hal
clean::
@IfThere o_hal Then ${ECHO} ${WIPE} o_hal ${WFLAGS}
@IfThere o_hal Then ${WIPE} o_hal ${WFLAGS}
export: export_${PHASE}
export_hdrs:
@${NOP}
export_libs: ${USBDIR}.o.${COMPONENT}
@echo ${COMPONENT}: export complete (libs)
# HAL libraries:
.SUFFIXES: .o_hal
.c.o_hal:; ${CC} -APCS 3/nofp/noswst -wp -ff -DUSBHAL -c -depend !Depend -DKERNEL -D_KERNEL -Dpaddr_t=int -D__P(A)=A -DKLD_MODULE -DDISABLE_PACKED ${CINCLUDES} ${THROWBACK} -o $@ $<
.s.o_hal:; ${AS} ${ASFLAGS} -APCS 3/nofp/noswst -o $@ $<
${USBDIR}.o.${COMPONENT}: ${OBJS_HAL} ${DIRS}
${MKDIR} ${USBDIR}.o
${AR} ${ARFLAGS} ${USBDIR}.o.${COMPONENT} ${OBJS_HAL}
# Dynamic dependencies:
/* (0.31)
/* (0.32)
*
* This file is automatically maintained by srccommit, do not edit manually.
* Last processed by srccommit version: 1.1.
*
*/
#define Module_MajorVersion_CMHG 0.31
#define Module_MajorVersion_CMHG 0.32
#define Module_MinorVersion_CMHG
#define Module_Date_CMHG 19 Aug 2017
#define Module_Date_CMHG 23 Sep 2017
#define Module_MajorVersion "0.31"
#define Module_Version 31
#define Module_MajorVersion "0.32"
#define Module_Version 32
#define Module_MinorVersion ""
#define Module_Date "19 Aug 2017"
#define Module_Date "23 Sep 2017"
#define Module_ApplicationDate "19-Aug-17"
#define Module_ApplicationDate "23-Sep-17"
#define Module_ComponentName "MUSBDriver"
#define Module_ComponentPath "mixed/RiscOS/Sources/HWSupport/USB/Controllers/MUSBDriver"
#define Module_FullVersion "0.31"
#define Module_HelpVersion "0.31 (19 Aug 2017)"
#define Module_LibraryVersionInfo "0:31"
#define Module_FullVersion "0.32"
#define Module_HelpVersion "0.32 (23 Sep 2017)"
#define Module_LibraryVersionInfo "0:32"
......@@ -167,7 +167,7 @@ static _kernel_oserror* new_instance (_kernel_swi_regs* r, void* pw, void* h)
return NULL;
}
static void init_driver()
static void init_driver(void)
{
if(driver_init)
return;
......@@ -190,7 +190,7 @@ static void init_driver()
driver_init = true;
}
static void shutdown_driver()
static void shutdown_driver(void)
{
if(!driver_init)
return;
......
......@@ -35,13 +35,9 @@
* POSSIBILITY OF SUCH DAMAGE.
*/
#ifdef USBHAL
#include <dev/usb/usbhal.h>
#else
#include "modhead.h"
#include "swis.h"
#include "callx/callx.h"
#endif
#include <limits.h>
#include <machine/bus.h>
......@@ -55,7 +51,6 @@
#include <dev/usb/usbdivar.h>
#include "Global/RISCOS.h"
#include "Global/Services.h"
#include "Global/HALEntries.h"
#include "cmodule.h"
......
......@@ -13,13 +13,9 @@
* limitations under the License.
*/
#ifdef USBHAL
#include <dev/usb/usbhal.h>
#else
#include "modhead.h"
#include "swis.h"
#include "callx/callx.h"
#endif
#include <stdlib.h>
#include <string.h>
#include <stdlib.h>
......@@ -36,7 +32,6 @@
#include <dev/usb/usbdivar.h>
#include "Global/RISCOS.h"
#include "Global/Services.h"
#include "Global/HALEntries.h"
#include "cmodule.h"
......
/* Copyright 2011 Castle Technology Ltd
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
/* HAL version of cmodule.c */
#include <dev/usb/usbhal.h>
#include <stdlib.h>
#include <string.h>
#include <stdlib.h>
#include <limits.h>
#include <stddef.h>
#include <machine/bus.h>
#include <sys/queue.h>
#include <sys/types.h>
#include <sys/systm.h>
#include <dev/usb/usb.h>
#include <dev/usb/usbdi.h>
#include <dev/usb/usbdivar.h>
#include "Global/RISCOS.h"
#include "Global/Services.h"
#include "Global/HALEntries.h"
#include "Global/OSEntries.h"
#include "cmodule.h"
/* Have to avoid including stdio as there's a clash with the BSD stuff */
#define __stdio_h
#include "DebugLib/DebugLib.h"
#include "musb.h"
#include "tps.h"
#include "musb_usb.h"
typedef struct
{
int type;
int flags;
void *hw;
int devno;
} usbinfo;
extern size_t HAL_USBControllerInfo(int idx,usbinfo *info,size_t size);
extern int HAL_IRQEnable(int device);
extern int HAL_IRQDisable(int device);
extern device_ptr_t register_bus(device_ptr_t bus);
static void init_device(usbinfo *info,int idx)
{
musb_softc_t *musb = malloc(sizeof(musb_softc_t));
memset(musb,0,sizeof(musb_softc_t));
sprintf(musb->sc_bus.bdev.dv_xname,"MUSB%d",idx);
musb->musb_base = info->hw;
musb->devno = info->devno;
tps_init(&musb->tps,musb);
musb_init(musb);
/* Enable IRQ */
HAL_IRQEnable(musb->devno);
/* Register with USBDriver */
register_bus((device_ptr_t) musb);
}
void USBHAL_MUSBDriver_Init(void)
{
/* Find and initialise all controllers */
int idx=0;
do {
usbinfo info;
size_t usbinfolen = HAL_USBControllerInfo(idx,&info,sizeof(info));
if((usbinfolen == sizeof(info)) && (info.type == 2))
init_device(&info,idx);
else if(!usbinfolen)
return;
idx++;
} while(1);
}
typedef int (*os_iicopv_function)(iic_transfer *tran,int count);
int do_iicop(iic_transfer *tran,int count)
{
os_iicopv_function os_iicopv = (os_iicopv_function) (OSentries[OS_IICOpV]);
return os_iicopv(tran,count);
}
void abort_pipe(void *addr)
{
musb_abort_xfer((usbd_xfer_handle) addr,USBD_TIMEOUT);
}
int usbhal_musb_do_intr(struct usbd_bus *bus,int irqdevno)
{
struct musb_softc *sc = (struct musb_softc *)bus;
if(irqdevno != sc->devno)
return 0;
HAL_IRQDisable(irqdevno);
int ret = musb_intr(sc);
HAL_IRQEnable(irqdevno);
return !ret;
}
void usbhal_musb_shutdown(struct usbd_bus *bus)
{
struct musb_softc *sc = (struct musb_softc *)bus;
/* Disable IRQ */
HAL_IRQDisable(sc->devno);
/* Reset controller */
sc->musb_base->otg_sysconfig = OTG_SYSCONFIG_SOFTRESET;
}
/* Technically returns _kernel_oserror, but pretend void to avoid HAL file depending on kernel.h */
void *messages_file_lookup(char *token, char *buffer, int *buffer_size, int num_args, ...)
{
/* Assume that buffer is large enough, and output doesn't really matter */
memcpy(buffer, token, strlen(token)+1);
return NULL;
}
......@@ -35,13 +35,9 @@
* POSSIBILITY OF SUCH DAMAGE.
*/
#ifdef USBHAL
#include <dev/usb/usbhal.h>
#else
#include "modhead.h"
#include "swis.h"
#include "callx/callx.h"
#endif
#include <limits.h>
#include <machine/bus.h>
......@@ -55,7 +51,6 @@
#include <dev/usb/usbdivar.h>
#include "Global/RISCOS.h"
#include "Global/Services.h"
#include "Global/HALEntries.h"
#include "cmodule.h"
#include "tboxlibint/messages.h"
......
......@@ -35,13 +35,9 @@
* POSSIBILITY OF SUCH DAMAGE.
*/
#ifdef USBHAL
#include <dev/usb/usbhal.h>
#else
#include "modhead.h"
#include "swis.h"
#include "callx/callx.h"
#endif
#include <limits.h>
#include <machine/bus.h>
......@@ -55,7 +51,6 @@
#include <dev/usb/usbdivar.h>
#include "Global/RISCOS.h"
#include "Global/Services.h"
#include "Global/HALEntries.h"
#include "cmodule.h"
#include "tboxlibint/messages.h"
......
......@@ -35,13 +35,9 @@
* POSSIBILITY OF SUCH DAMAGE.
*/
#ifdef USBHAL
#include <dev/usb/usbhal.h>
#else
#include "modhead.h"
#include "swis.h"
#include "callx/callx.h"
#endif
#include <limits.h>
#include <machine/bus.h>
......@@ -55,7 +51,6 @@
#include <dev/usb/usbdivar.h>
#include "Global/RISCOS.h"
#include "Global/Services.h"
#include "Global/HALEntries.h"
#include "cmodule.h"
......@@ -104,10 +99,6 @@ static struct usbd_bus_methods musb_bus_methods = {
/* Free usbd_xfer (just add to free list?) */
NULL, NULL, NULL, NULL,
/* 4x unused HC overrides */
#ifdef USBHAL
usbhal_musb_do_intr,
usbhal_musb_shutdown,
#endif
};
static struct usbd_pipe_methods musb_root_ctrl_methods = {
......@@ -138,7 +129,7 @@ static struct usbd_pipe_methods musb_device_methods = {
musb_device_done,
};
#if defined (__riscos) && !defined(USBHAL)
#ifdef __riscos
static int veneers_built = 0;
static struct {
struct usbd_bus_methods methods;
......@@ -166,7 +157,7 @@ musb_init(musb_softc_t *sc)
volatile musb_regs *musb_base = sc->musb_base;
DPRINTF(("musb_init: start\n"));
#if defined (__riscos) && !defined(USBHAL)
#ifdef __riscos
if (!veneers_built)
{
build_veneer((int*)&musb_bus_methods_entry,
......
......@@ -34,13 +34,9 @@
* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
* POSSIBILITY OF SUCH DAMAGE.
*/
#ifdef USBHAL
#include <dev/usb/usbhal.h>
#else
#include "modhead.h"
#include "swis.h"
#include "callx/callx.h"
#endif
#include <limits.h>
#include <machine/bus.h>
......@@ -54,7 +50,6 @@
#include <dev/usb/usbdivar.h>
#include "Global/RISCOS.h"
#include "Global/Services.h"
#include "Global/HALEntries.h"
#include "cmodule.h"
......
......@@ -34,12 +34,8 @@
* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
* POSSIBILITY OF SUCH DAMAGE.
*/
#ifdef USBHAL
#include <dev/usb/usbhal.h>
#else
#include "modhead.h"
#include "swis.h"
#endif
#include <limits.h>
#include <machine/bus.h>
......@@ -53,7 +49,6 @@
#include <dev/usb/usbdivar.h>
#include "Global/RISCOS.h"
#include "Global/Services.h"
#include "Global/HALEntries.h"
#include "cmodule.h"
......
......@@ -24,9 +24,9 @@ service-call-handler: module_services Service_USB,
Service_PreReset,
Service_ResourceFSStarting
title-string: COMPONENT
title-string: Module_ComponentName
help-string: COMPONENT Module_MajorVersion_CMHG
help-string: Module_ComponentName Module_MajorVersion_CMHG
date-string: Module_Date_CMHG
......
......@@ -23,10 +23,8 @@
#define ErrorNumber_MUSB_ClaimVeneer (ErrorBase_MUSBDriver+2)
#define ErrorNumber_MUSB_USBTooOld (ErrorBase_MUSBDriver+3)
#ifndef USBHAL
extern void* private_word;
extern void build_veneer (int* vn, int* st, size_t sz);
#endif
typedef struct iic_transfer
{
......@@ -45,16 +43,6 @@ typedef struct iic_transfer
extern int do_iicop(iic_transfer *tran,int count); /* Returns nonzero on success */
#ifdef USBHAL
/* HAL interface */
extern void USBHAL_MUSBDriver_Init(void);
extern void abort_pipe(void *addr);
#define riscos_abort_pipe(ADDR) USBHAL_AddCallback(abort_pipe,ADDR)
#define riscos_cancel_abort_pipe(ADDR) USBHAL_RemoveCallback(abort_pipe,ADDR)
extern int usbhal_musb_do_intr(struct usbd_bus *,int irqdevno);
extern void usbhal_musb_shutdown(struct usbd_bus *);
#else
extern void riscos_cancel_abort_pipe (void* v);
#endif
#endif
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment