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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |正序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑
6 L9 s- H& _$ v2 c5 Y3 a) _
  1. [code]EDMA sample test application
      g: ~" ?: r6 j
  2. /*
    , m& C0 K; N6 R+ \
  3. * edma_test.c
    1 [9 }# c7 Y: Z4 ^* y
  4. *+ w0 W- W" q7 T( D) g7 W& }
  5. * brief  EDMA3 Test Application
    + ^' C+ C' D2 o# p! T5 F
  6. *% u  t& ^. \# A: H
  7. *   This file contains EDMA3 Test code.
    & r0 M- p- w2 ^" M0 ~" [
  8. *# R1 [* ]5 j& ?% Z2 E
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE& H5 P, O8 q' n; ?% a. Z
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
    6 F; b. {2 V' D) n. u4 Y8 h& W
  11. *         TO CHANGE.
    7 U: T# x- |1 l2 \/ R
  12. *! @* p- b3 ~- b4 |: ?/ O
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
    - P1 r6 Z+ k) ?2 [. g) _2 b
  14. *
    1 \* N! d! Z) E3 X% O
  15. * This program is free software; you can redistribute it and/or5 a* S% ]0 X+ E6 R5 n/ \
  16. * modify it under the terms of the GNU General Public License as0 d" ~0 s+ J- `( r
  17. * published by the Free Software Foundation version 2.! b' K* _) ~# A) e
  18. *, ~: z8 ]& D/ ]8 m! m7 H# z% B8 B+ H1 A
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any
    & O2 F  y# i; r. m* A
  20. * kind, whether express or implied; without even the implied warranty* i9 A6 o+ L2 L3 |  d( d7 c% q3 f
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the- j7 {0 w  E7 r& ~
  22. * GNU General Public License for more details.
    ) {6 l% N5 k& W# B" |2 R6 R0 a
  23. */- u$ F  A) F9 W* G5 Z3 W$ E5 o
  24. 2 [8 p, K$ }& M8 A! [
  25. #include <linux/module.h>: N" O( l- o$ x, Y2 d7 V. j
  26. #include <linux/init.h>
    0 N8 e; R' i9 y1 L9 C) q
  27. #include <linux/errno.h>, t& G  h8 i( e* b, O& U5 n
  28. #include <linux/types.h>
    0 W# Q8 q; w/ ~7 \1 g+ B+ ^
  29. #include <linux/interrupt.h>
    6 |8 ?, ^1 w; ^8 L* R7 G$ e$ |
  30. #include <asm/io.h>
    & l9 o# B; R* _
  31. #include <linux/moduleparam.h>6 }" W. M& R) u/ W% G! D7 w
  32. #include <linux/sysctl.h>1 S4 j* C; H- m- v7 q7 m
  33. #include <linux/mm.h>/ j9 U' w6 H; D- @/ J: }
  34. #include <linux/dma-mapping.h>
    5 ?! @5 a) F' P8 {3 W, B4 K4 m
  35. 6 d) Q; ?9 P& z' c9 B" }( S6 t
  36. #include <mach/memory.h>( `4 Q; c, {. J4 w) D
  37. #include <mach/hardware.h>
    1 g7 B& J$ h/ E& A
  38. #include <mach/irqs.h>  b, H; I) v. L; N2 Y4 D) Q" o/ _% j
  39. #include <asm/hardware/edma.h>' c! A4 ]  `! B, `( F* B; B

  40. 1 u- B4 t# r; c$ w, G+ x! k" U# A4 p
  41. #undef EDMA3_DEBUG
    / l' a0 U& H) j9 u/ p& V, Q
  42. /*#define EDMA3_DEBUG*/
    % `6 G+ H, v4 ?0 H$ b+ X. e0 e

  43. / P) ~+ ~5 n. e, t
  44. #ifdef EDMA3_DEBUG5 d! Q! c9 n5 Q' _- W
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
    & X3 a" \/ w- J& c% @/ C$ x7 b
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
    " n9 ]- p8 d% N6 ^5 k
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)8 j7 Z& G9 d! ~7 B/ B
  48. #else
    / O8 {) B  T; T4 H
  49. #define DMA_PRINTK( x... ): \# V+ Q8 W) N! P8 N! H
  50. #define DMA_FN_IN4 P2 F! e/ L/ g* x
  51. #define DMA_FN_OUT- i$ d& O3 X$ ?7 b, E
  52. #endif+ c) R5 I& [+ C! g0 [9 Z
  53.   V) r! `, `* a9 _- @
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)
      }/ Y: |( H& G4 x4 l7 Q
  55. #define STATIC_SHIFT                3
    : w* \( Q, k: N5 P0 O6 V# Q
  56. #define TCINTEN_SHIFT               20( l/ o+ [/ }) c: ^, v% Y9 Q6 ]
  57. #define ITCINTEN_SHIFT              21
    . \* O+ V9 P; Q) A& F
  58. #define TCCHEN_SHIFT                223 L( ^1 V# f/ v/ Z
  59. #define ITCCHEN_SHIFT               23
    ! v) e* k( ^: l' z
  60. % k) ?4 {# ?" V+ ?; P4 G
  61. static volatile int irqraised1 = 0;
    5 D3 M5 q9 x# x3 t5 s' b
  62. static volatile int irqraised2 = 0;
    : V; j1 D" H- X% X: R
  63. * |: [0 M9 d* \  t
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    3 [, f* T% F; s; g1 k/ ]
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);1 Q! _, X" g" Y
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);  v2 R$ \( E# ?" \0 F
  67. 6 v" y6 X; g" T4 G- @% K3 A
  68. dma_addr_t dmaphyssrc1 = 0;. R( ^% r! C$ n. X
  69. dma_addr_t dmaphyssrc2 = 0;0 }) K( d5 `$ I: f4 N
  70. dma_addr_t dmaphysdest1 = 0;
    / X4 f  Y5 P2 w2 q5 B* d" Z+ @  b
  71. dma_addr_t dmaphysdest2 = 0;
    , M7 B& j/ {% u0 Z
  72. 8 w. s6 P, @/ D0 M1 L
  73. char *dmabufsrc1 = NULL;2 q( o$ l; c" g) }4 Y
  74. char *dmabufsrc2 = NULL;
    ! j6 E1 K1 _0 Z2 l+ L$ t* e, L1 C
  75. char *dmabufdest1 = NULL;
    6 j, F) p/ Z3 p/ p& d! {$ h' f1 r. g. w
  76. char *dmabufdest2 = NULL;. E3 C/ w/ n( s" F2 N+ v; F
  77. 4 M1 |) b% A6 Y: g2 H( ^0 S* ]
  78. static int acnt = 512;
    , X3 j* ?+ M; B8 A  |
  79. static int bcnt = 8;  y8 _9 C1 F$ ]5 i, @2 M8 c
  80. static int ccnt = 8;4 L% S  X% @9 [, y0 W! T- x: V" ?$ @
  81. % N4 ^8 {- T  q/ u
  82. module_param(acnt, int, S_IRUGO);
    ; {( n1 a9 c6 K% O, i2 [; l/ ]
  83. module_param(bcnt, int, S_IRUGO);/ w9 F+ r& q7 V" Y
  84. module_param(ccnt, int, S_IRUGO);
复制代码

" G" T, r# Z9 J' C: H* L/ p
, I0 ?  B: H6 J: p) S5 v6 J      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
0 A# r! L) H( \- q' s! h9 Y( P- ?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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
. }& e+ n& @5 u4 \: m1 F     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。3 H; [  Y& Q* R; `3 W$ L2 ?, s

% I3 A4 w8 j0 |. X8 E0 \2 V- p' W6 I" F& h
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2026-2-18 02:55 , Processed in 0.038582 second(s), 26 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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