📄 devmacro.tpl
字号:
@dnl /***************************************************************************
@dnl *
@dnl * Copyright (c) 1995 MICROTEC RESEARCH INC.
@dnl *
@dnl * All rights reserved. MICROTEC's source code is an unpublished
@dnl * work and the use of a copyright notice does not imply otherwise.
@dnl * This source code contains confidential, trade secret material of
@dnl * MICROTEC. Any attempt or participation in deciphering, decoding,
@dnl * reverse engineering or in any way altering the source code is
@dnl * strictly prohibited, unless the prior written consent of
@dnl * MICROTEC is obtained.
@dnl *
@dnl *
@dnl * Module Name: boardcmn.tpl
@dnl *
@dnl * Identification: @(#) 1.7 boardcmn.tpl
@dnl *
@dnl * Date: 12/14/93 15:00:02
@dnl *
@dnl ****************************************************************************
@dnl */
@dnl For every device, say zi8530, do the following after replacing zi8530
@dnl with whatever is appropriate:
@dnl 1) create the .def file zi8530.def containing the default values for the
@dnl device.
@dnl 2) include the following line in the zi8530 file:
@dnl bsp.zi8530.devices: `@dev_make_dev_list(`,',zi8530,@(ppp.devices))'
@dnl where ppp is either "board" or "sys"
@dnl 3) include the following line in the board .def file (e.g. mo147.def):
@dnl @include(zi8530.def)
@dnl 4) create the .tpl file zi8530.tpl. zi8530.tpl will be included in the
@dnl board.c file. The xconfig variable @(bsp.zi8530.devices) can be accessed
@dnl from the file. @(bsp.zi8530.devices) contains the list of all the
@dnl configured devices whose type is zi8530 (for example it will contain
@dnl serial_1 if the declaration "dev.serial_1.type: zi8530" is present and
@dnl serial_1 is in @(ppp.devices).
@dnl -------------------------------------------------------------------------
@dnl
@dnl macro: dev_extern_list
@dnl usage: @dev_extern_list(list)
@dnl description: for every element elmt in "list" it creates the line
@dnl extern logio_method_t @(dev.elmt.method);
@dnl It assumes that @(dev.elmt.method) exists for every "elmt" in "list".
@dnl
@define(dev_extern_list, `@ifelse($1,,,`extern logio_method_t @(dev.$1.method);
'`@dev_extern_list(@shift($@))')')@dnl
@dnl
@dnl macro: dev_device_list
@dnl usage: @dev_device_list(list)
@dnl description: for every element elmt in "list" it creates the line
@dnl "@(dev.elmt.name)", &@(dev.elmt.method),
@dnl for initialization of a structure. It assumes both @(dev.elmt.name)
@dnl and @(dev.elmt.method) exist for every "elmt" in "list".
@dnl
@define(dev_device_list, `@ifelse($1,,,`` '"@(dev.$1.name)", &@(dev.$1.method),
'`@dev_device_list(@shift($@))')')@dnl
@dnl
@dnl macro: dev_list_is_empty
@dnl usage: @dev_list_is_empty(list)
@dnl description: returns yes if "list" is empty, no otherwise
@dnl
@define(dev_list_is_empty,`@ifelse($1,,yes,no)')
@dnl
@dnl macro: dev_is_in_list
@dnl usage: @dev_is_in_list(elmt,list)
@dnl description: returns yes if "elmt" is in "list", no otherwise.
@dnl
@define(dev_is_in_list,`@ifelse($2,,no,`@ifelse($1,$2,yes,`@dev_is_in_list($1,@shift(@shift($@)))')')')@dnl
@dnl
@dnl macro: dev_make_type_list
@dnl usage: @dev_make_type_list(separator,list)
@dnl description: returns the list of all the "newelmt" such that there
@dnl exists an element "elmt" in "list" such that @(dev.elmt.type) is
@dnl "newelmt". Elements in the new list are separated by "separator".
@dnl
@define(dev_previous_type_list,`@dev_make_type_list(`$1',@shift(@shift($@)))')@dnl
@define(dev_make_type_list,`@ifelse($2,,,`@ifelse(@(dev.$2.type),,,`@ifelse(@dev_is_in_list(@(dev.$2.type),@dev_previous_type_list($@)),no,`@(dev.$2.type)'`@ifelse(@dev_list_is_empty(@dev_previous_type_list($@)),no,`$1')')')'`@dev_previous_type_list($@)')')@dnl
@dnl
@dnl macro: dev_include_list
@dnl usage: @dev_include_list(list)
@dnl description: for every element "elmt" in "list" creates the line
@dnl #include <elmt.h>
@dnl
@define(dev_include_list, `@ifelse($1,,,`#include <$1.h>'
`@dev_include_list(@shift($@))')')@dnl
@dnl
@dnl macro: dev_dottmpl_list
@dnl usage: @dev_dottmpl_list(list)
@dnl description: for every element "elmt" in "list" creates the line
@dnl @include(elmt.tpl)
@dnl
@define(dev_dottmpl_list, `@ifelse($1,,,`@include($1.tpl)'
`@dev_dottmpl_list(@shift($@))')')@dnl
@dnl
@dnl macro: dev_make_dev_list
@dnl usage: @dev_make_dev_list(separator,type,list)
@dnl description: returns the list of all the elements "elmt" such that
@dnl @(dev.elmt.type) is "type".
@dnl Elements in the new list are separated by "separator".
@dnl
@define(dev_previous_dev_list,`@dev_make_dev_list(`$1',$2,@shift(@shift(@shift($@))))')@dnl
@define(dev_make_dev_list,`@ifelse($3,,,`@ifelse(@(dev.$3.type),$2,$3`@ifelse(@dev_list_is_empty(@dev_previous_dev_list($@)),no,`$1')')'`@dev_previous_dev_list($@)')')@dnl
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -