OMAPL138如何在Linux下使用EDMA3驱动 - OMAP-L138 - 嵌入式开发者社区 - 51ele.net
设为首页收藏本站
点击跳转“创龙科技服务通”

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

查看: 10584|回复: 0
打印 上一主题 下一主题

[未解决] OMAPL138如何在Linux下使用EDMA3驱动

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |正序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑 ' A) s' L! L7 I+ r: B5 W1 H
  1. [code]EDMA sample test application
    9 F, |1 i" l" M; e  y
  2. /*
    6 _1 E9 R! C! P+ M) V$ ]
  3. * edma_test.c$ \; |* |, v/ l1 s0 c" C
  4. ** b7 F. `5 K8 k! {3 `# Q$ D
  5. * brief  EDMA3 Test Application
    ! u& k% P5 d/ s+ Z; `* ]; O% p
  6. *+ ~6 p% c+ v( l& b( O- k# ?
  7. *   This file contains EDMA3 Test code.2 D  h! e" g- w+ g- h
  8. *4 t' j5 y$ ~7 ~2 [- D2 m
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
    ) \4 t& Q5 S6 g6 V' P% M  ~
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT. @0 ^: L' D9 G* ?# P1 x# O0 W% _9 H
  11. *         TO CHANGE.
    ) m6 h8 v# t9 j/ x
  12. *
    % b2 ~% \9 \8 g' Q0 P. I
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/7 L7 {+ e4 T5 h. @
  14. *, `; R, O0 U' z5 T1 \
  15. * This program is free software; you can redistribute it and/or
    4 a) W8 ]( v" A: k# w# v
  16. * modify it under the terms of the GNU General Public License as
    4 V% O* p$ w: q; I1 K
  17. * published by the Free Software Foundation version 2.
    : ?& F1 i: ^  p. D$ @( i
  18. *
    ! n9 t& d; O- g& c
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any9 ^1 _' `7 p7 M! r
  20. * kind, whether express or implied; without even the implied warranty
    1 A: I5 z; B* ]4 A3 h. R% v9 S
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    ) h( ^0 B' n0 C* Z: h7 g# D
  22. * GNU General Public License for more details.
    7 W( M5 w: ~$ Y( a0 w) X
  23. */) [" l$ E8 \. w# ]; ~5 ]( o

  24. + L+ x- h& i8 _; O# z9 T
  25. #include <linux/module.h>% ^4 |: I% i: j6 D8 u: l, L
  26. #include <linux/init.h>
    % i, e1 q* {7 r' @0 S7 n
  27. #include <linux/errno.h>( C( R! n/ G  t, N# @  }& w# `0 f
  28. #include <linux/types.h>
    # y2 h, q) ^. f; `9 `7 {
  29. #include <linux/interrupt.h>
    ( Q* w& ]* F* I7 I4 y1 x
  30. #include <asm/io.h>! u3 d" \' B( M& Q+ a* Q
  31. #include <linux/moduleparam.h>
    # W4 ^$ V3 S6 e" ~
  32. #include <linux/sysctl.h>
    0 l! N* E. z0 n) y0 Y5 K
  33. #include <linux/mm.h>& s. }, D: L% I! Y
  34. #include <linux/dma-mapping.h>
    5 o, o  q! A. J7 D# |3 Z: n1 l
  35. 1 H8 |0 }  H5 h) M; P
  36. #include <mach/memory.h>
    8 X3 U3 j( t! M" M. @
  37. #include <mach/hardware.h>7 ~1 l+ @$ k* ?6 q9 _
  38. #include <mach/irqs.h>
    ! {* v$ d3 l  J& L
  39. #include <asm/hardware/edma.h>" n* ^9 A' b$ @) Y
  40. * r9 }& b- p! e  v0 X1 e
  41. #undef EDMA3_DEBUG8 P" _4 j  J8 o. x8 @- C$ L
  42. /*#define EDMA3_DEBUG*/
    8 Y, A- ?* N# [9 y! r
  43. ! t) H0 R1 z0 J  q
  44. #ifdef EDMA3_DEBUG4 E2 b/ A/ q) {, t7 e1 i# K$ U
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
    8 W4 I/ ^8 Q9 ~% l
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)2 d! W- t2 }; p$ y# V4 K
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
    6 w# U4 j' f$ K9 H9 P7 {9 q
  48. #else
    ) A; b. {+ b  D- E3 N, R
  49. #define DMA_PRINTK( x... ). R( `) E3 d8 S
  50. #define DMA_FN_IN
    1 p8 R9 N5 D3 x6 [$ F' v& A
  51. #define DMA_FN_OUT! ^6 r' t! O& W* |& S. M6 ]' g  ^
  52. #endif
    - ^- d8 [7 c; _& X7 ]. N
  53. 1 ~+ f2 N  f7 Y4 K: L
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)$ q$ I0 ?+ U1 o1 q- I
  55. #define STATIC_SHIFT                3- Y( y" x( N/ ]" O! m
  56. #define TCINTEN_SHIFT               20( p, S! [' l" M" ?* Z6 z# n! K' [
  57. #define ITCINTEN_SHIFT              21* S  Q' J: n! v! I0 [6 Q1 {3 B, o5 ]
  58. #define TCCHEN_SHIFT                222 }! ^) V* e3 \3 E! G
  59. #define ITCCHEN_SHIFT               235 L  C! J) P. o8 K, k
  60. 4 |( j9 e% H. k/ c2 b/ W$ R' `
  61. static volatile int irqraised1 = 0;
    1 H; N0 Z% G9 j
  62. static volatile int irqraised2 = 0;
    # J7 K; j! j3 m2 {$ K

  63. / Q: y4 I2 K6 _  e
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    6 V8 W6 q! v/ x9 c- ?5 @5 y) ]
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);+ }5 r) B, K% z# E1 Z/ W8 G
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);, N6 Y/ L  o6 J" R# Q( v; ~9 u9 b
  67. $ ?3 j2 Y; p' w! \1 A2 C
  68. dma_addr_t dmaphyssrc1 = 0;; N7 U. f5 I1 F, S
  69. dma_addr_t dmaphyssrc2 = 0;  I% a% n8 u2 H2 v  C4 f
  70. dma_addr_t dmaphysdest1 = 0;
    ( ]  n' t, j3 c. G) k7 r
  71. dma_addr_t dmaphysdest2 = 0;
    & S+ v/ J/ U" l' b* i9 C# U; k* K+ M
  72. 9 M1 P5 @- s- m9 N2 u
  73. char *dmabufsrc1 = NULL;
    , L8 b% t4 E4 k
  74. char *dmabufsrc2 = NULL;7 U/ M9 |% h3 v- N2 ^0 D
  75. char *dmabufdest1 = NULL;" j' p1 T' I& I2 n: Y
  76. char *dmabufdest2 = NULL;
    ; b. O2 Z1 Z# B6 a0 c8 h
  77. ' }. z7 _5 v* {& [7 b% t, ?
  78. static int acnt = 512;3 _$ N- @8 l) Y8 x7 v
  79. static int bcnt = 8;
    ' n/ w7 t$ y" x, O
  80. static int ccnt = 8;# G' o; ~) U) G- C

  81. " Y9 ?, C* x4 ?' E. M+ h
  82. module_param(acnt, int, S_IRUGO);
    ( K1 r+ L( \5 _) W: o
  83. module_param(bcnt, int, S_IRUGO);( i* w1 C% K6 G; t5 B+ D- G! ^
  84. module_param(ccnt, int, S_IRUGO);
复制代码
# }1 a3 B1 z- {
- B. V; z! G- h, H$ K  P& o& _
      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
+ H! G2 B9 m5 Z6 ^$ |arm-none-linux-gnueabi-gcc  -I /home/tl/omapl138/linux-3.3/arch/arm/include -I /home/tl/omapl138/linux-3.3/include  EDMA3test.cpp -o EDMA3这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
4 C0 M/ F  _6 c) z     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
, E7 v2 q; t: C: Y
5 v/ Y7 V( y! K  L/ ~
; Q3 h: M4 @# z, {6 v# @: O0 h
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

点击跳转“创龙科技服务通”

QQ|手机版|小黑屋|嵌入式开发者社区 ( 粤ICP备15055271号

GMT+8, 2026-1-27 09:44 , Processed in 0.040268 second(s), 26 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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