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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑
+ N/ w; H$ R, }! q$ D% k
  1. [code]EDMA sample test application
    4 X$ V* F; S+ h6 m
  2. /*
    + w! N0 L8 A- W& |8 v! P. K# |# X
  3. * edma_test.c; c/ C7 n; x) Y/ s1 `
  4. *" f9 n# h1 Y& P9 ]( u
  5. * brief  EDMA3 Test Application! ?0 I$ R! s  g; W/ G# ~8 T
  6. *
    3 u: O3 ~; f* R% f0 O8 H" Q0 M
  7. *   This file contains EDMA3 Test code.
    " L2 A  R" O( H
  8. *
    3 _+ }4 J, U, F7 {' ?
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
    % V* h: a4 T+ B: v3 a" K
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT% g) N! g* Z! b
  11. *         TO CHANGE.
    - d% z. p8 d: q" V' |( r) s7 ~
  12. ** U2 p8 K2 v& P. W. w
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
    ) H! O) d! q* ]# I. u1 a  g
  14. *
    ; f( [% I" ^  Z% L1 J7 G
  15. * This program is free software; you can redistribute it and/or
    " d: l& k. ^5 e. b$ L  |7 i; @
  16. * modify it under the terms of the GNU General Public License as
    + X3 _) F9 }' \, p/ @  x
  17. * published by the Free Software Foundation version 2.5 \2 b* f( O; y6 @2 t* _3 s
  18. *  |5 }. ]/ Q9 i( _2 m1 l' c- T$ z
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any
    9 ^! p8 H* M8 B/ H  N4 U
  20. * kind, whether express or implied; without even the implied warranty: y2 A& Y- F& y
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    6 ~  Q/ ~/ H  O
  22. * GNU General Public License for more details./ b; g* d0 j+ E2 d
  23. */1 [$ f" t$ O/ [
  24. & N/ B0 |% o1 p! Q. y
  25. #include <linux/module.h>
    0 J% l: @* n) |2 i( U/ v. T8 ^5 @
  26. #include <linux/init.h>4 O& o; F* ~. A  Y( a# y7 P7 S7 |
  27. #include <linux/errno.h>
    - V# }! \  R# N; |, i! E# U  S
  28. #include <linux/types.h>- l( G$ v8 ?* T$ V* c& U! K7 y
  29. #include <linux/interrupt.h>! }( ]; P$ a: F8 N
  30. #include <asm/io.h>
    9 m. {) J5 e) [" U  A
  31. #include <linux/moduleparam.h>4 N# l3 a0 Z$ U
  32. #include <linux/sysctl.h>6 e5 v5 B0 r$ P1 j. ~) g
  33. #include <linux/mm.h>
    / u* b" M, [4 T9 h* b: ?
  34. #include <linux/dma-mapping.h>
    1 F0 L' f2 _6 P& }; |2 q

  35. . ?2 h/ W$ K$ ~' p
  36. #include <mach/memory.h>$ n7 _, H0 ~% d& f5 z5 q* O
  37. #include <mach/hardware.h>
    - ]9 E- [2 v1 n9 _+ c
  38. #include <mach/irqs.h>
    2 o8 l9 ~0 |# z& e1 P
  39. #include <asm/hardware/edma.h>
    3 o' a, ~8 M0 T. R" K

  40. ' d" ~, W4 T5 K( a4 W+ x$ {
  41. #undef EDMA3_DEBUG7 y. ]. h0 T7 f3 K( S' u7 q
  42. /*#define EDMA3_DEBUG*/
    8 k, l, R" _1 P& ?8 S* U
  43. % O# v  Y& p  P5 F& m
  44. #ifdef EDMA3_DEBUG, v1 t* L: S5 x9 f! r/ Z7 y; t1 t
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS); F2 F6 l! ~- A
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)& R. }4 M9 B5 J% _5 _
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__), f; c! G+ R( ?/ z3 K' g5 p; `9 S
  48. #else
    * f  E, u) U- B+ V% T
  49. #define DMA_PRINTK( x... )
    9 P) m# G) ], q) p1 @. B
  50. #define DMA_FN_IN( J+ _( M- X$ ?) U4 d
  51. #define DMA_FN_OUT( n" F$ A8 V" P% D( Q" N* N1 I3 {2 v
  52. #endif: G6 {- {" ?6 ^: f9 Y+ O

  53. " s; O* Z. f& N0 d. B/ X
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)
    0 q- z5 K6 ]' Z, e" q2 e
  55. #define STATIC_SHIFT                31 C1 b8 Z4 ^" E
  56. #define TCINTEN_SHIFT               20  K7 E9 e0 c0 L1 e
  57. #define ITCINTEN_SHIFT              21
    ) z- e* g$ X9 [9 X5 ]5 y( e  }* y
  58. #define TCCHEN_SHIFT                22( \2 z1 u/ n9 G7 j( y
  59. #define ITCCHEN_SHIFT               23% l* A5 R* y& w( z2 J3 k4 K
  60. $ ^3 K; b/ m! K8 o+ S; l6 z6 j3 G% K
  61. static volatile int irqraised1 = 0;1 ^) _+ ]0 k% ~% a2 H7 L
  62. static volatile int irqraised2 = 0;% P& Q* k/ n* _7 A7 Y% \

  63. % A! g- G, R5 T! `! `
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);; x6 f1 G# }$ f) \1 A. t
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);5 ?: O4 h7 P, t# [& c
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    ( i) ]3 I6 f- P/ S3 A! \5 l% @3 b
  67. - `* i! }+ I6 v6 E
  68. dma_addr_t dmaphyssrc1 = 0;: I; X. d0 d4 R; u# J3 z, t& Y
  69. dma_addr_t dmaphyssrc2 = 0;  H% G" F7 p3 W8 I8 L
  70. dma_addr_t dmaphysdest1 = 0;. Q' t8 Z3 e! b( f9 a, N
  71. dma_addr_t dmaphysdest2 = 0;& _" M" o1 x* S  G& m. _6 e

  72. 4 y" W; z- M4 ~' P" F/ w( P
  73. char *dmabufsrc1 = NULL;; ?8 \2 `" d) ^- B7 q
  74. char *dmabufsrc2 = NULL;
    8 l% U3 l7 L. Z4 d/ \
  75. char *dmabufdest1 = NULL;
    3 ~6 l- I2 Z" |' I5 z; N$ j
  76. char *dmabufdest2 = NULL;
    3 D; ^9 T! j% G$ w
  77. 1 J4 o9 L# {: d) R% O4 J
  78. static int acnt = 512;2 i- n" ?1 s  x' `
  79. static int bcnt = 8;
    # h4 _" `; v' Y* p, Z% Z3 Q
  80. static int ccnt = 8;
    + n+ l  x) z) e" j% Y5 Y3 `/ w* `

  81.   [: K- d+ N' x
  82. module_param(acnt, int, S_IRUGO);) g. ^! M4 z7 i" @6 @, S
  83. module_param(bcnt, int, S_IRUGO);- b! l, c5 P+ W, c, O" V; z
  84. module_param(ccnt, int, S_IRUGO);
复制代码

& j4 w0 O1 l+ C% a4 f# C: W0 w; `* @( P. }
      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
# G* f) V: }. z4 _* larm-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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
% m4 |# [" F4 ^" z9 z: J, |     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
- K7 j+ L/ U9 Y( D' K3 n1 r' G) E2 i# Z# w9 r' w% L% K6 e3 m

" C" r: W. L* h: F
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2026-1-29 07:34 , Processed in 0.040612 second(s), 26 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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