23 #include <asm/types.h>
28 #include "../../lms2012/source/lms2012.h"
29 #include "../../lms2012/source/am1808.h"
33 #define MODULE_NAME "bluetooth_module"
34 #define DEVICE1_NAME BT_DEVICE
35 #define DEVICE2_NAME UPDATE_DEVICE
37 static int ModuleInit(
void);
38 static void ModuleExit(
void);
42 #include <linux/kernel.h>
45 #include <linux/sched.h>
49 #include <linux/hrtimer.h>
52 #include <linux/hrtimer.h>
54 #include <linux/init.h>
55 #include <linux/uaccess.h>
56 #include <linux/debugfs.h>
58 #include <linux/ioport.h>
61 #include <linux/module.h>
62 #include <linux/miscdevice.h>
63 #include <asm/uaccess.h>
122 [
EP2] = (
INPIN*)&EP2_BluetoothPin[0],
126 static void __iomem *GpioBase;
127 static UBYTE *pLocalRam;
148 printk(
" GP%d_%-2d 0x%08X and 0x%08X or 0x%08X\n",(Pin >> 4),(Pin & 0x0F),(
u32)Reg,
MuxRegMap[Tmp].Mask,
MuxRegMap[Tmp].Mode);
154 printk(
" OUTPUT FUNCTION 0x%08X and 0x%08X or 0x%08X\n",(
u32)Reg,
MuxRegMap[Tmp].Mask,
MuxRegMap[Tmp].Mode);
160 printk(
" GP%d_%-2d Not found (Const no. %d, Tmp = %d)\n",(Pin >> 4),(Pin & 0x0F), Pin, Tmp);
173 pBluetoothPin[
Hw][Pin].
pGpio = (
struct gpio_controller *__iomem)(GpioBase + ((pBluetoothPin[
Hw][Pin].Pin >> 5) * 0x28) + 0x10);
174 pBluetoothPin[
Hw][Pin].
Mask = (1 << (pBluetoothPin[
Hw][Pin].
Pin & 0x1F));
183 #define BtFloat(pin) {\
184 (*pBluetoothPin[Hw][pin].pGpio).dir |= pBluetoothPin[Hw][pin].Mask;\
187 #define BtRead(pin) ((*pBluetoothPin[Hw][pin].pGpio).in_data & pBluetoothPin[Hw][pin].Mask)
189 #define BtHigh(pin) {\
190 (*pBluetoothPin[Hw][pin].pGpio).set_data = pBluetoothPin[Hw][pin].Mask;\
191 (*pBluetoothPin[Hw][pin].pGpio).dir &= ~pBluetoothPin[Hw][pin].Mask;\
194 #define BtLow(pin) {\
195 (*pBluetoothPin[Hw][pin].pGpio).clr_data = pBluetoothPin[Hw][pin].Mask;\
196 (*pBluetoothPin[Hw][pin].pGpio).dir &= ~pBluetoothPin[Hw][pin].Mask;\
204 static ssize_t Device1Write(
struct file *File,
const char *
Buffer,
size_t Count,loff_t *Data)
210 copy_from_user(Buf,Buffer,Count);
241 static ssize_t Device1Read(
struct file *File,
char *
Buffer,
size_t Count,loff_t *Offset)
257 static ssize_t Device2Write(
struct file *File,
const char *Buffer,
size_t Count,loff_t *Data)
259 *((
ULONG*)&(pLocalRam[2])) = 0x5555AAAA;
264 static ssize_t Device2Read(
struct file *File,
char *Buffer,
size_t Count,loff_t *Offset)
266 Buffer[0] = pLocalRam[0];
267 Buffer[1] = pLocalRam[1];
272 static const struct file_operations Device1Entries =
274 .owner = THIS_MODULE,
276 .write = Device1Write
280 static struct miscdevice Device1 =
288 static int Device1Init(
void)
292 Result = misc_register(&Device1);
308 static void Device1Exit(
void)
310 misc_deregister(&Device1);
319 static const struct file_operations Device2Entries =
321 .owner = THIS_MODULE,
323 .write = Device2Write
327 static struct miscdevice Device2 =
335 static int Device2Init(
void)
339 Result = misc_register(&Device2);
355 static void Device2Exit(
void)
357 misc_deregister(&Device2);
371 static int ModuleInit(
void)
389 if (request_mem_region(0xFFFF1FFC,0x00000004,
MODULE_NAME) >= 0)
392 pLocalRam = (
UBYTE*)ioremap(0xFFFF1FFA,0x00000006);
394 if (pLocalRam !=
NULL)
402 if (request_mem_region(DA8XX_GPIO_BASE,0xD8,
MODULE_NAME) >= 0)
404 GpioBase = (
void*)ioremap(DA8XX_GPIO_BASE,0xD8);
405 if (GpioBase !=
NULL)
424 static void ModuleExit(
void)
signed char SBYTE
Basic Type used to symbolise 8 bit signed values.
INPIN EP2_BluetoothPin[BLUETOOTH_PINS]
#define EP2
Schematics revision D.
INPIN FINALB_BluetoothPin[BLUETOOTH_PINS]
#define FINAL
Final prototype.
unsigned int ULONG
Basic Type used to symbolise 32 bit unsigned values.
INPIN FINAL_BluetoothPin[BLUETOOTH_PINS]
#define FINALB
Schematics revision B and C.
MODULE_DESCRIPTION(MODULE_NAME)
module_param(HwId, charp, 0)
MODULE_AUTHOR("The LEGO Group")
unsigned char UBYTE
Basic Type used to symbolise 8 bit unsigned values.
#define PLATFORM_END
Newest supported hardware (newer versions will use this)
MODULE_SUPPORTED_DEVICE(DEVICE1_NAME)
#define PLATFORM_START
Oldest supported hardware (older versions will use this)