七月份刚毕业,进入一家高通通讯公司。本人对通信方面没什么了解,更是在进公司之前没听说过高通平台。进公司到现在也已经一个多月了,对于这方面的知识还大多一知半解,还好老大给力,为了让我更快了解高通平台,给了我很多帮助。现在写这篇博文来记录自己的学习历程。
我是先从EFS出发的,当然都是从最简单的开始。学习使用高通工具QPST和QXDM是必修课,当然还有超级终端的AT命令了,一般公司都是自己扩展的自己的AT命令,当时还只会记住这些命令的作用,两天前老大给了我几篇文档和告诉我有关AT命令扩展的相关MODEM源码在什么地方,让我熟悉下怎么扩展,我自己研究了2天,感觉有点吃力,下面把我掌握的有限知识和大家分享下,希望有和我一样的小白能探讨下,更希望有大神能指点一二,感激不尽。
添加一个新的AT命令的入口结构体函数如下:
typedef struct dsati_cmd_struct
{
byte name[20];
uint32 attrib;
byte special;
byte compound;
uint32 cmd_id;
const void *val_ptr;
const void *val_ptr2;
const void *def_lim_ptr;
dsat_result_enum_type (*proc_func)( dsat_mode_enum_type,
const struct dsati_cmd_struct*,
const tokens_struct_type*,
dsm_item_type* );
boolean (*abort_func)( const struct dsati_cmd_struct* );
} dsati_cmd_type;
文档上面写的10部建立一个新的AT命令,因为本人英语水平有限,就不把文档翻译了,主要怕误导大家,如果哪位大神帮忙翻译一下,感激不尽。
1.Select a unique name for the command. The command name can be up to 10 characters in length, including the leading +, $, ^, or &.
2. Determine the command attributes. The various commands attributes and their meanings are listed in Table 3-3.
3. Create a unique command identity (cmd_id) for the command and add this command ID into the corresponding command index table.
4. Create a variable to store the argument value(s). If the command has one or more arguments, declare a variable of the appropriate type in dsatctab.c or dsatetsictab.c to store the argument values. The variable should be doubled for dual stack operations. The command variable should not export via extern, command variables must be accessed by get and set utilities defined in dsatutil.c. If the argument values are referenced by modules external to ATCoP, declare get and set utilities in dsat_v.h and protect it by critical section.
5. Define the default value and the allowed range for the command arguments. For commands with simple numeric arguments, use the dflm_type. Initialize the default value and the lower and upper bounds. For commands of type LIST, use the def_list_type. Create the list_v and list_t data structures, and initialize the default value. For commands of type mixed parameter, create and initialize the appropriate dflm_type and def_list_type for each parameter of this type. For string arguments, this is not applicable. All of these variables should be declared in dsatctab.c or dsatetsictab.c. For AT commands whose defaults and/or limits need to be initialized at runtime, this initialization may be performed in the function, dsatctab_data_init.
6. Make sure val_ptr2 is not set to NULL, if DUAL_STACK attribute is defined in the table entry. Usually, val_ptr2 would contain the address of the expanded variable.
7. Add the command execution function, if any. If the command requires special processing code outside the generic parameter processing functions defined in dsatparm.c, add a new command execution function to the appropriate command processing file (dsatparm.c, dsatact.c, dsatvend.c, dsatetsicall.c, dsatetsipkt.c, dsatetsime.c, dsatetsismsc.c, dsatgsmfax.c). Take advantage of any AT command processing utilities exported by dsati.h or parameter processing exported by dsatparm.h.
8. Add the abort command function, if any. If the command is abortable, an abort command function must be defined in the appropriate command processing file. The command processing files are the same as those identified in step 7.
9. Add the command to the appropriate command table. First, determine which command table the AT command belongs to, based on the command syntax and command type. Then, add the dsati_cmd_type entry to the selected command table. Initialize the dsati_cmd_type command table entry. Initialize the dsati_cmd_type command table entry to point to this new command execution function. If no new special processing code is required, initialize the command table entry to point to the appropriate parameter processing function or NULL, depending on the command response desired. Initialize the abort command function pointer to NULL if the command is not abortable; otherwise, initialize it to point to the abort command function.
10. Compile and test. The AT command is now ready to use.
根据上面的文档我试着自己添加了一个AT命令,当然我只是照着葫芦画瓢,用一个已知的AT命令改个名字,功能不变。编译出来和原来已知命令重叠了,就是改变一个的值,另一个也跟着改变。对于添加一个异步命令还有些力不从心。
上面就是我最近两天的学习成果,希望有志同道合的兄弟能和我一起探讨下,更希望大神能指点下,这是第一次发博客,主要是记录自己的工作学习经历。
希望有英语大牛能帮我把上面的英语翻译一下,感激不尽,因为我只能连猜戴蒙的看,也不知道对不对。
转载于:https://blog.51cto.com/10630988/1686755