| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081 |
- #include <linux/version.h>
- #include <linux/init.h>
- #include <linux/kernel.h>
- #include <linux/module.h>
- #include <linux/kobject.h>
- #include <linux/errno.h>
- #include <linux/sysfs.h>
- #include <linux/syscalls.h>
- #include "sfsattrib.h"
- /////////////////////////////////////////////////////////////////////////////
- int g_hw = 0, g_sw = 0;
- TIVA_ADC g_tadc;
- /////////////////////////////////////////////////////////////////////////////
- static ssize_t firmware_show(struct kobject *kobj, struct kobj_attribute *attr, char *buf)
- {
- // printk(KERN_ALERT "%s, Ctx: \"%s\"-(%d)\n", __FUNCTION__, current->comm, current->pid);
- return sprintf(buf, "HW: %08X SW: %08X", g_hw, g_sw);
- }
- /////////////////////////////////////////////////////////////////////////////
- static ssize_t UVers_show(struct kobject *kobj, struct kobj_attribute *attr, char *buf)
- {
- // printk(KERN_ALERT "%s, Ctx: \"%s\"-(%d)\n", __FUNCTION__, current->comm, current->pid);
- return sprintf(buf, "%d", g_tadc.UVers);
- }
- /////////////////////////////////////////////////////////////////////////////
- static ssize_t UBatV3_show(struct kobject *kobj, struct kobj_attribute *attr, char *buf)
- {
- // printk(KERN_ALERT "%s, Ctx: \"%s\"-(%d)\n", __FUNCTION__, current->comm, current->pid);
- return sprintf(buf, "%d", g_tadc.UBatV3);
- }
- /////////////////////////////////////////////////////////////////////////////
- static ssize_t Temp_show(struct kobject *kobj, struct kobj_attribute *attr, char *buf)
- {
- // printk(KERN_ALERT "%s, Ctx: \"%s\"-(%d)\n", __FUNCTION__, current->comm, current->pid);
- return sprintf(buf, "%d", g_tadc.Temp);
- }
- /////////////////////////////////////////////////////////////////////////////
- static ssize_t UV5Vsys_show(struct kobject *kobj, struct kobj_attribute *attr, char *buf)
- {
- // printk(KERN_ALERT "%s, Ctx: \"%s\"-(%d)\n", __FUNCTION__, current->comm, current->pid);
- return sprintf(buf, "%d", g_tadc.UV5Vsys);
- }
- /////////////////////////////////////////////////////////////////////////////
- static ssize_t UV3V6Bat_show(struct kobject *kobj, struct kobj_attribute *attr, char *buf)
- {
- // printk(KERN_ALERT "%s, Ctx: \"%s\"-(%d)\n", __FUNCTION__, current->comm, current->pid);
- return sprintf(buf, "%d", g_tadc.UV3V6Bat);
- }
- /////////////////////////////////////////////////////////////////////////////
- static ssize_t TempTIVA_show(struct kobject *kobj, struct kobj_attribute *attr, char *buf)
- {
- // printk(KERN_ALERT "%s, Ctx: \"%s\"-(%d)\n", __FUNCTION__, current->comm, current->pid);
- return sprintf(buf, "%d", g_tadc.TempTIVA);
- }
- /////////////////////////////////////////////////////////////////////////////
- struct kobj_attribute g_tivaFirmwareAtt = __ATTR_RO(firmware);
- struct kobj_attribute g_tivaUVersAtt = __ATTR_RO(UVers);
- struct kobj_attribute g_tivaUBatV3Att = __ATTR_RO(UBatV3);
- struct kobj_attribute g_tivaTempAtt = __ATTR_RO(Temp);
- struct kobj_attribute g_tivaUV5VsysAtt = __ATTR_RO(UV5Vsys);
- struct kobj_attribute g_tivaUV3V6BatAtt = __ATTR_RO(UV3V6Bat);
- struct kobj_attribute g_tivaTempTIVAAtt = __ATTR_RO(TempTIVA);
|