PXA310的电源管理(1)
来源:互联网 发布:华泰证券 网络金融部 编辑:程序博客网 时间:2024/06/10 03:52
PXA310的电源管理(1)
2011-6-30 20:42:24
ipmc.c
相关驱动是作为一个杂项设备注册到系统中的,对应的设备节点为 /dev/ipmc
杂项设备(misc device)
杂项设备也是在嵌入式系统中用得比较多的一种设备驱动。在 Linux 内核的include/linux目录下有Miscdevice.h文件,
是一种主设备号为10的特殊字符设备。
cat /proc/devices
可以看到ipmc的主设备号为 10
cat /proc/misc
可以看到ipmc的次设备号为90
关注一下ipmc 对应的操作方法
static struct file_operations ipmc_fops = {
owner: THIS_MODULE,
open: ipmc_open,
read: ipmc_read,
write: ipmc_write,
poll: ipmc_poll,
ioctl: ipmc_ioctl,
release:ipmc_close,
};
性能资源管理 PRM(Performance Resources Managemen)
使用prm_resource 来描述一个性能资源
struct prm_resource {
struct prm_client *access; /* Only one client can access it */
prm_resource_id id;
struct prm_resource_state priority[MAX_PRIORITIES];
struct proc_dir_entry *dir;
};
每个资源都有一个资源状态数组
/* resources state */
struct prm_resource_state {
struct prm_client *allocate; /* which client allocate the resources. In every priority, there can be only one client allocate the resource*/
struct prm_group *group; /* which group it belongs to */
int active;
struct prm_resource *resource;
struct list_head entry; /* used by prm_group->resources for link the resources into the group */
struct proc_dir_entry *dir;
};
所有资源都存放在一个静态数组中
static struct prm_resource prm_resources[RESOURCE_NUM];
那么谁来使用性能资源?一个资源使用者,作为一个客户端
struct prm_client {
unsigned int id; /* client id */
unsigned int pid; /* process id for the client */
prm_priority priority; /* priority for the client.(LOW or HIGH) */
char *name; /* name of the client */
unsigned int group_cnt; /* How many groups in the client */
struct prm_group *groups[MAX_GROUPS]; /* support MAXGROUP groups, some may be NULL */
void *client_data;
clientcallback notify; /* notifier for resource appropriate and ready */
irq_handler_t handler;
void *dev_id;
struct proc_dir_entry *dir;
};
在初试化的时候,注册了软中断
#define IRQ_PMU PXA_IRQ(12) /* Performance Monitoring Unit */
软中断的处理函数就是就是调用prm_client的hanlder 方法 。
接下来回调ipmc的操作方法
open
1 创建一个会话,优先级为IPMC_CLI_PRI
对于PRM 来说就是在 prm_clients中找一个空闲位来存放新分配的prm_client地址
返回数组中的下标。
2 分配资源
根据前面返回的数组下标,资源ID和组ID来分配资源
PRM可以根据资源ID,找到对应资源和对应于该优先级的资源状态
查找资源状态信息,看资源是否已经被分配了,
如果没有就继续,否则返回失败
分配一个prm_group
把资源状态加入到组中
3 提交资源
- PXA310的电源管理(1)
- PXA310的电源管理(2)
- PXA310的电源管理(3)
- PXA310系统电源管理
- SOC电源[1] soc 处理的电源管理系统设计
- Android 的电源管理
- WINCE的电源管理
- Android 的电源管理
- Android的电源管理
- WINCE的电源管理
- FT5206的电源管理
- WIFI的电源管理
- android的电源管理
- Android 的电源管理
- WINCE的电源管理
- Android的电源管理
- Android的电源管理
- Android的电源管理
- Android周学习Step By Step(5)--常用widget组件
- Android周学习Step By Step(6)--Android的数据库SQLite
- 孙子兵法-始计
- 【2011.06.30】 第四次期末总结
- vc 托盘封装
- PXA310的电源管理(1)
- TCP超时重传算法
- frameset属性
- yntf
- 一直都没记录LK里写文件,记下来吧
- 开源协议BSD的汉化版
- j2se 数组的创建
- iPhone NSUserDefaults 保存数据
- 利用钩子函数来注入DLL的一个具体应用:点击桌面不同图标,播放相应音符