Test initialisation of MUIA_List_AdjustWidth and MUIA_List_AdjustHeight, and
[AROS.git] / arch / arm-native / soc / broadcom / 2708 / hidd / i2c / i2c-bcm2708.c
blob48c28cfbbad03b8d0745753bbf4e10f74715e1bb
1 /*
2 Copyright © 2010-2015, The AROS Development Team. All rights reserved.
3 $Id$
4 */
6 #include <aros/symbolsets.h>
7 #include <aros/debug.h>
8 #include <proto/exec.h>
9 #include <proto/kernel.h>
11 #include <hidd/i2c.h>
13 static IPTR __arm_periiobase;
14 #define ARM_PERIIOBASE __arm_periiobase
15 #include <hardware/bcm2708.h>
16 #include <asm/io.h>
18 #include "i2c-bcm2708.h"
20 APTR KernelBase __attribute__((used)) = NULL;
22 void METHOD(I2CBCM2708, Hidd_I2C, PutByte)
24 while (!((*(volatile UBYTE *)BSC0_STATUS) & BSC_STATUS_DONE))
26 asm volatile ("mov r2,r2\n");
29 *(volatile UBYTE *)BSC0_DATALEN = 1;
30 *(volatile UBYTE *)BSC0_FIFO = msg->data;
32 *(volatile UBYTE *)BSC0_STATUS = BSC_CLEAR;
33 *(volatile UBYTE *)BSC0_CONTROL = BSC_WRITE;
36 void METHOD(I2CBCM2708, Hidd_I2C, GetByte)
38 while (!((*(volatile UBYTE *)BSC0_STATUS) & BSC_STATUS_DONE))
40 asm volatile ("mov r2,r2\n");
43 *(volatile UBYTE *)BSC0_DATALEN = 1;
44 *(volatile UBYTE *)BSC0_STATUS = BSC_CLEAR;
45 *(volatile UBYTE *)BSC0_CONTROL = BSC_READ;
47 *msg->data = *(volatile UBYTE *)BSC0_FIFO;
50 void I2CBCM2708_Init(void)
52 KernelBase = OpenResource("kernel.resource");
53 __arm_periiobase = KrnGetSystemAttr(KATTR_PeripheralBase);
55 /* BSC0 is on GPIO 0 & 1 */
56 *(volatile UBYTE *)GPFSEL0 &= ~0x3f; // Mask out bits 0-5
57 *(volatile UBYTE *)GPFSEL0 |= 0x24; // Set bits 0-5 to binary '100100'
60 ADD2LIBS((STRPTR)"i2c.hidd", 0, static struct Library *, I2CBase);