佳礼资讯网

 找回密码
 注册

ADVERTISEMENT

查看: 1401|回复: 10

C code 疑问

[复制链接]
发表于 10-12-2008 12:42 PM | 显示全部楼层 |阅读模式
#include <stdio.h>
#include <timer.h>
#include <stblib.h>
#include <string.h>
#include <chan.h>
#include <application.h>


// Do not alter the text between the begin and end tags
#include "..\n21\smt349_control.h"
#include "..\n19\smt349.h"


static UINT32 BlockOfRegisters[] = {        
SMT349_REG_RESET_0x00 | IFRF_SYNTH_RESET(1), // 0=Normal Mode ofOperation ; 1=Puts the IF/RF Synthesizer in power down mode.
SMT349_REG_RESET_0x00 | IFRF_SYNTH_RESET(0), // 0=Normal Mode ofOperation ; 1=Puts the IF/RF Synthesizer in power down mode.
        SMT349_REG_TRANS1_0x01    | SWITCH_TRANS1(TX)             // "00"="11"=TX and RX OFF ; "10"=TX ON ; "01"=RX ON (Transceiver1)
                                  | ATTENUATION_TRANS1_RX_RF(0x1) // Attenuation factor 0...31dBs for Receiver RF (Transceiver1)
                                  | ATTENUATION_TRANS1_RX_IF(0x0) // Attenuation factor 0...31dBs for Receiver IF (Transceiver1)
                                  | ATTENUATION_TRANS1_TX(0x1),   // Attenuation factor 0...31dBs for Transmitter (Transceiver1)
        SMT349_REG_TRANS2_0x02    | SWITCH_TRANS2(RX)             // "00"="11"=TX and RX OFF ; "10"=TX ON ; "01"=RX ON (Transceiver2)
                                  | ATTENUATION_TRANS2_RX_RF(0x2) // Attenuation factor 0...31dBs for Receiver RF (Transceiver2)
                                  | ATTENUATION_TRANS2_RX_IF(0x2) // Attenuation factor 0...31dBs for Receiver IF (Transceiver2)
                                  | ATTENUATION_TRANS2_TX(0x1),   // Attenuation factor 0...31dBs for Transmitter (Transceiver2)
SMT349_REG0_IFRF_0x03 | AUTO_PDB(1) // '0'=Software Powerdown iscontrolled by REG2_IFRF ; '1'=equivalent to setting all bit ofREG2_IFRF to 1
                                  | LPWR(0)      // '0'=Normal Power Mode (rload<500R) ; '1'=Low Power Mode (rload>500R)
                                  | XIN_DIV2(0)  // '0'=Xin is not div by 2 ; '1'=Xin is divided by 2
                                  | IF_DIV(0x1)  // "00"=IFvco freq ; "01"=IFvco freq/2 ; "10"=IFvco freq/4 ; "11"=IFvco freq/8
                                  | AUX_SEL(0x3),// "00"=Reserved ; "01"=Force Output Low ; "10"=Reserved ; "11"=Lock Detect (LDETB)
SMT349_REG1_IFRF_0x04 | KP1(0) // "00"=N Value <4096 ; "01"=N valuebetween 2048 and 4095 ; "10"=N value between 8192 and 16383 ; "11"=Nvalue > 16383
| KP2(0) // "00"=N Value <2048 ; "01"=N valuebetween 4096 and 8191 ; "10"=N value between 4096 and 8191 ; "11"=Nvalue > 8191
| KPL(0), // "00"=N Value <2048 ; "01"=N valuebetween 4096 and 8191 ; "10"=N value between 4096 and 8191 ; "11"=Nvalue > 8191
        SMT349_REG2_IFRF_0x05     | PDRB(1)       // '0'=RF Synthesizer powred down ; '1'=RF Synthesizer ON
                                  | PDIB(1),      // '0'=IF Synthesizer powred down ; '1'=IF Synthesizer ON
        SMT349_REG3_IFRF_0x06     | NRF1(0),       // N Divider for RF1 (>992)
        SMT349_REG4_IFRF_0x07     | NRF2(0x40E),   // N Divider for RF2 (>240)
        SMT349_REG5_IFRF_0x08     | NIF(0x260),    // N Divider for IF  (>56)
SMT349_REG6_IFRF_0x09 | RRF1(0), // R Divider for RF1 ; 7 to 8189 ifkp1='00' ; 8 to 8189 if kp1='01' ; 10 to 8189 if kp1='10' ; 14 to 8189if kp1='11'
SMT349_REG7_IFRF_0x0A | RRF2(0x10), // R Divider forRF2 ; 7 to 8189 if kp2='00' ; 8 to 8189 if kp2='01' ; 10 to 8189 ifkp2='10' ; 14 to 8189 if kp2='11'
SMT349_REG8_IFRF_0x0B |RIF(0x10), // R Divider for IF ; 7 to 8189 if kpl='00' ; 8 to 8189 ifkpl='01' ; 10 to 8189 if kpl='10' ; 14 to 8189 if kpl='11'
SMT349_REG_UPDATE_0x0D | UPDATE_IF_RF_SYNTH(1) // '0'=No action ;'1'=Passes FPGA registers to RF/IF chip via its serial interface
};       






请问深黑色的#include "..\n21\smt349_control.h"
#include "..\n19\smt349.h" 那是什么意识呢?为什么有 \n21\, \n19\ 之类的东西呢?
哪个大大有经验的可告知吗?谢谢。
回复

使用道具 举报


ADVERTISEMENT

发表于 10-12-2008 12:48 PM | 显示全部楼层
那个是 folder 名来的
回复

使用道具 举报

发表于 10-12-2008 12:50 PM | 显示全部楼层
应该是load自己define 的header file,\n21,\n19应该是folder location之类的东西。
回复

使用道具 举报

发表于 10-12-2008 12:51 PM | 显示全部楼层
汗颜
看来你不知道include 是干什么的??
回复

使用道具 举报

发表于 10-12-2008 01:20 PM | 显示全部楼层
那两个点(dot) ".."是parent directory/folder 来的。。。
就是讲那个header file 在你current directory 的parent directory 的另一个child directory

-Parent Directory
  -n21
   +smt349_control.h
  -n19
   +smt349.h
  -Current Directory
   +stdio.h
   +timer.h
   +stblib.h
   +string.h
   +chan.h
   +application.h

大概是酱吧。。。
希望不会混淆

评分

参与人数 1积分 +10 收起 理由
pic + 10 我很赞同

查看全部评分

回复

使用道具 举报

发表于 10-12-2008 04:02 PM | 显示全部楼层
原帖由 世界飞 于 10-12-2008 01:20 PM 发表
那两个点(dot) ".."是parent directory/folder 来的。。。
就是讲那个header file 在你current directory 的parent directory 的另一个child directory

-Parent Directory
  -n21
   +smt349_control.h
...


基本上对了。 加以补充一点。
   +stdio.h
   +timer.h
   +stblib.h
   +string.h
   +chan.h
   +application.h
这几个files未必是current directory的files.可能在compiler default include directory,或者user在compiler里面setting 让compiler search header file的directory
回复

使用道具 举报

Follow Us
发表于 10-12-2008 09:03 PM | 显示全部楼层
原帖由 fritlizt 于 10-12-2008 04:02 PM 发表


基本上对了。 加以补充一点。
   +stdio.h
   +timer.h
   +stblib.h
   +string.h
   +chan.h
   +application.h
这几个files未必是current directory的files.可能在compiler default include directory ...


嗯。对的。
忘了这一点
好久没有动了
回复

使用道具 举报

 楼主| 发表于 30-12-2008 04:22 PM | 显示全部楼层
UINT32 Read(UINT32 a)
{
  UINT32 data =  READ | a;
  chan_out_word(data, &CONTROL);
  chan_in_word(&data, &STATUS);
  data = data & 0xFFFFF;
  return data;
}



想请问有哪位大大知道那个 "|" (深黑)代表甚莫意识?
回复

使用道具 举报


ADVERTISEMENT

发表于 30-12-2008 05:17 PM | 显示全部楼层
原帖由 canonforest 于 30-12-2008 04:22 PM 发表
UINT32 Read(UINT32 a)
{
  UINT32 data =  READ | a;
  chan_out_word(data, &CONTROL);
  chan_in_word(&data, &STATUS);
  data = data & 0xFFFFF;
  return data;
}

想请问有哪位大大知道那个 "| ...


在 C 语言中,这 “|” 是“OR” 的意思。。“&” 是 “AND ”的意思。。。。

[ 本帖最后由 rothmans 于 30-12-2008 06:22 PM 编辑 ]
回复

使用道具 举报

发表于 30-12-2008 11:15 PM | 显示全部楼层
原帖由 canonforest 于 30-12-2008 04:22 PM 发表
UINT32 Read(UINT32 a)
{
  UINT32 data =  READ | a;
  chan_out_word(data, &CONTROL);
  chan_in_word(&data, &STATUS);
  data = data & 0xFFFFF;
  return data;
}



想请问有哪位大大知道那个 "| ...


这里有详细地解释。 希望能帮到你。
http://www.cprogramming.com/tutorial/bitwise_operators.html
回复

使用道具 举报

 楼主| 发表于 31-12-2008 09:29 AM | 显示全部楼层
谢谢各位的回复!
回复

使用道具 举报

您需要登录后才可以回帖 登录 | 注册

本版积分规则

 

ADVERTISEMENT



ADVERTISEMENT



ADVERTISEMENT

ADVERTISEMENT


版权所有 © 1996-2023 Cari Internet Sdn Bhd (483575-W)|IPSERVERONE 提供云主机|广告刊登|关于我们|私隐权|免控|投诉|联络|脸书|佳礼资讯网

GMT+8, 29-3-2024 04:26 PM , Processed in 0.079355 second(s), 28 queries , Gzip On.

Powered by Discuz! X3.4

Copyright © 2001-2021, Tencent Cloud.

快速回复 返回顶部 返回列表