MAC OS SUPPORT FOR DEVELOPERS

1. Introduction

We realize the enormous popularity of the Apple's products, and have created software support for:

  • USB2ISA family of products , and USB2PCMCIA products
    under Mac OS X operating system .

    The software support contains of core install binaries and the developer's support files. We are providing a basic API (application programming interface) set for developers allowing building of applications that can access i/o ports and physical memory areas.

    An additional api set is available in our SDKBUS kit allowing

  • Dealing with IRQ and DMA channels
  • Managing the hardware - issuing hardware reset , adjusting read/write cycle ...

    for ISA / PCMCIA cards mounted on our USB2 family of products .

    We have geared our Mac OS X product release specifically for developers and programmers, who can take the source code of a specific ISA, PCMCIA card , and make it working with USB2 products.

    The current release is for Apple computers based on Intel processors - running Mac OS X 10.7 and later.

    2. Where is the source code?

    We have developed an independent USB2 device support. Originally developed under Windows operating systems and ported for Linux, it is currently working under Mac OS X operating system.

    We do not share our source code with developers or users - it is our company proprietary and confidential code. We are providing instead an easy to use interface to our products , together with samples.

    3. Core binaries use

    3.1. ARS Technologies software

    The Mac OS X release files are packed in a single .run file. The file name includes our release number - for ex. macosx-2-113.run. Every time any of the files are updated, the release number is increased to reflect the change.

    You can copy the .run file to a disk, run it, and ir will install files to a folder on your Mac OS X system.

    The binaries have been built and tested for x64 type processors , including the 64bit families of :

  • Intel based Mac computers, running Mac OS X

    3.2. ARS Technologies enumerator

    3.2.1. Finding the correct binary

    The Mac OS X 'arsenum' is in the main folder.

    You can load the enumerator on command line as -

    ./arsenum3

    If needed, please change the mode of arsenum to allow execution -

    chmod u+x arsenum3

    The program scans and reports the computer system's i/o and memory spaces.

    When an USB2ISA / USB2PCMCIA product is connected / disconnected there is text messages. When inserted, the enumerator reports the type of the card - USB2ISA or USB2PCMCIA, the usb port where it was connected. A scanning of the hardware resources is performed and the found i/o ports, and physical memory areas are reported.

    The scanning of the hardware resources is not ideal, and some hidden ports / memory areas may not be recognized or reported.

    There may be a need to add manually resources which were not detected. To add resources, select the resource type : i/o ports, memory area, irq channel, or dma channel, and type the addresses or the channel number.

    The main command prompt of the enumerator contains a selection of commands for manual read/write of i/o & physical memory spaces. Please use for an initial check / test of the ISA / PCMCIA cards - manual reading/writing of/to the detected resources.

    Next, a developer of an application, based on our API set, for an ISA, or PCMCIA card can run the application.

    The enumerator - 'arsenum' has to be running, in order to use the above application and the ISA, or PCMCIA card.

    4. Developer's support

    4.1 Basic API set

    Here is the commands list :

    Standard commands used by application for direct access to i/o ports -

  • BYTE in8(WORD port) - returns 1byte of data read from the i/o address in 'port'

  • WORD in16(WORD port) - returns 2bytes of data read from the i/o address in 'port'

  • void out8(WORD port, BYTE data) - writes 1byte of data to i/o address in 'port'

  • void out16(WORD port, WORD data) - writes 2bytes of data to i/o address in 'port'

    Standard commands used by application for direct access to physical memory -

  • BYTE rd8(DWORD phaddr) - returns 1byte of data read from the physical memory address in 'phaddr'

  • WORD rd16(DWORD phaddr) - returns 2bytes of data read from the physical memory address in 'phaddr'

  • void wr8(DWORD phaddr, BYTE data) - writes 1byte of data to physical memory address in 'phaddr'

  • void wr16(DWORD phaddr, WORD data) - writes 2bytes of data to physical memory address in 'phaddr'

    - Where

  • BYTE = unsigned char
  • WORD = unsigned short
  • DWORD = unsigned long

    i/o port read/write - port range 0-ffff (64 kB space)

    physical memory read/write - address range 0-fffff (1mB space)

    !!! Note1: In order to read/write meaningful values , the ARSTech enumerator should be running , the USB2ISA / USB2PCMCIA, card needs to be connected and recognized by the enumerator, and the mounted ISA / PCMCIA card need to actually have the i/o port or the physical memory area being accessed.

    !!! Note2: Please note the calling convention of the api set - outb/outw , writeb/writew commands. The first parameter in our api set is the address of the port or physical memory , compared to other operating systems where the address is the second parameter. Please replace if needed, as for ex. -

    #define outb(a, b) out8(b, a)

    !!! Note3: An additional API set is available in our SDKBUS kit allowing the additional possibilities of -

  • building of kernel drivers which use the kernel level api set

  • dealing with IRQ and DMA channels and events based on them

  • managing the hardware - issuing hardware reset , adjusting read/write cycle ...

    for ISA / PCMCIA cards mounted on our USB2 family of products , or SSI2 family of products.

    4.2 Samples for using our API set

    There is a sample located in 'isarw' directory, showing reading of sector 1 - partition table of a hard disk , connected to an ISA I/O card mounted on USB2ISA - the type that has one floppy , one ide controllers , 2 serial and one parallel ports . The disk needs to be connected and powered on.

    In addition the ARSTech enumerator should be running, the USB2ISA / USB2PCMCIA card needs to be connected and recognized by the enumerator, and the mounted ISA / PCMCIA card need to actually have the i/o port or the physical memory area being accessed.

    To build the samples you can run the script file -

    ./mk.bat

    The api set in 'isarw' is obtained from the dynamic library file - libarsusb4.so. You will need to place this file in a common directory, for ex. in '/usr/lib' .

    5. Developing new and porting existing software

    Apple Computer provides an excellent support for developers, they can find extensive information online on - http://developer.apple.com.

    In general, for accessing hardware Apple provides the IOKit which is a collection of interfaces, each for a particular device group - like for USB, PCI, FireWire, PC Card, etc.

    The way of getting access to the actual hardware resources is quite complex, with a developer having to deal with -

  • identifying the particular IOKit device family the hardware belongs to
  • developing a property list
  • building an IOKit driver
  • a 'nub' for connection and dynamic configuration of the driver
  • a service - to provide capabilities for other IoKit objects
  • device interface - application level library allowing an application to communicate or control the hardware
  • a 'user client' - kernel object providing connection between device driver and an application
  • I/O registry - representing the particular hardware in an entry
  • driver personality - specific settings related to the driver
  • driver matching - boot time identifying and loading of the driver
  • matching dictionary - describing device properties
  • device matching - I/O registry search
  • device file - specific entry created in the /dev

    We are providing a very easy and straightforward way of dealing with hardware - similar to the way used in the BSD family of operating systems, or Linux operating system.

    Our basic api set provided with the installation software, and the advanced api set - provided in sdkbus, allows quick building of simple command line / Terminal applications, as well as beautiful 'Carbon' and 'Cocoa' graphical applications.

    6. Running DOS programs with USB2ISA / USB2PCMCIA

    You can run DOS applications and drivers under Mac OS X using DOS emulators.

    There is a variety of choices with one well maintained and supported one - DosBox, which provides support not only on Linux , but on Windows , Mac OS X , and number of other environments.

    You can run the enumerator , connect USB2ISA / USB2PCMCIA , 'dosbox' is run, run the DOS application and test.