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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑 % u+ K) z/ G# }( i
  1. [code]EDMA sample test application  k7 }" m" Z' v. B
  2. /*
    & U  y( g9 B# V1 }( X7 l- J
  3. * edma_test.c. z: c+ B. ^7 e' F5 X8 i
  4. *- o8 t, t% }% {' b7 H4 H
  5. * brief  EDMA3 Test Application" Z+ S/ T9 y" r4 H
  6. *
    " K( h4 r/ h$ Q) I
  7. *   This file contains EDMA3 Test code.
    $ O$ U5 h& p* F! H6 I
  8. *
    " E' k- S& P$ R- P
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
    * M$ w" W' O) e( e+ h8 s
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT* a$ p, F8 _  a% e
  11. *         TO CHANGE.
    6 X( O* I: k3 p4 g1 ~7 ?0 F
  12. *
    ' c, M8 y3 @4 W5 n2 a7 ^  f
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/1 \7 h" m. T! z# q7 W
  14. *
    2 B  e* D& z1 E, e! y
  15. * This program is free software; you can redistribute it and/or
    % }- f$ v, |) M1 N, Z
  16. * modify it under the terms of the GNU General Public License as) e& _7 G( Z  V; z, {# E
  17. * published by the Free Software Foundation version 2.$ N1 u: q) l% j% y5 q
  18. *
    ; L  J8 q; w7 D$ @; I
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any
      S( M+ C& X% D- A2 r! f
  20. * kind, whether express or implied; without even the implied warranty2 Z% W: i  W- R
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    . A4 Q  v/ Y4 Z1 L) m5 a
  22. * GNU General Public License for more details.1 b" D+ m& A" ~! c$ G" w) C
  23. */
    ; {  P( ~, h. @. P0 l5 ]
  24. + N. l' K. m) p  p$ W
  25. #include <linux/module.h>6 Q% N- B" Y$ i) B
  26. #include <linux/init.h>
    , v7 h3 t9 j* j0 G# o
  27. #include <linux/errno.h>
    , @* ]2 l& ]$ y5 l  O# q/ E- I
  28. #include <linux/types.h>( e& o/ _: Y& i5 K  t2 E8 Q
  29. #include <linux/interrupt.h>
    " z% z& f( f" Q. m4 o
  30. #include <asm/io.h>  Z. ]  f5 w, G1 h5 \
  31. #include <linux/moduleparam.h>
    . D2 H0 @7 {' H; Z& E9 y
  32. #include <linux/sysctl.h>
    3 ?$ D8 f6 d$ z' d
  33. #include <linux/mm.h>
    % O0 H% L, a0 b0 g7 ^
  34. #include <linux/dma-mapping.h>
    4 c- c6 t3 P8 s
  35. . U8 B/ ~  \5 X# I6 A6 ^& n
  36. #include <mach/memory.h>% [5 V. |, T: G  r
  37. #include <mach/hardware.h>$ O' F( G" y3 p4 U) p: y* ?4 {1 T7 h
  38. #include <mach/irqs.h>
    ! d+ f9 [& a" L: \( @8 y
  39. #include <asm/hardware/edma.h>! r' b! s$ w; T# W% G

  40. / p( M! t  D2 k" b1 h  x
  41. #undef EDMA3_DEBUG- u% I, ^  a( F2 l
  42. /*#define EDMA3_DEBUG*/( c" ?: q8 h7 n6 ~. [9 R

  43. " {9 l1 x7 g; k9 `1 {, J, q
  44. #ifdef EDMA3_DEBUG
    , p: c1 v" f, w: p2 S
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)1 M6 U. [2 p; ?# z2 i. I# u
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
    . u2 Q: z% J" h) R. Q! R
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
    * e$ @  t# i. a* e" s
  48. #else1 {2 z  |$ s( E5 c# ?/ E+ d; T/ z
  49. #define DMA_PRINTK( x... )+ ~  C: p; l3 S% q- i3 \& [
  50. #define DMA_FN_IN
    # X/ l' p4 y/ Q6 o# y1 W
  51. #define DMA_FN_OUT
    . v* B# k! l& `' C/ V. h! o
  52. #endif
    3 F2 a9 e+ n: V6 V* O  V7 l7 U
  53. 7 K0 E" R7 `6 C5 I" \+ |
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)
    7 ^8 l# q3 ?4 ^2 L+ u
  55. #define STATIC_SHIFT                3
    8 g7 O0 |. `  W7 v. j, q' M
  56. #define TCINTEN_SHIFT               20& L2 u( A( x" n+ ^3 a6 q
  57. #define ITCINTEN_SHIFT              21
    9 O4 g- P, ~' I- l% e4 u
  58. #define TCCHEN_SHIFT                22, c/ V1 X5 q, a: E
  59. #define ITCCHEN_SHIFT               23
    " x8 d& e8 F- H+ K  D
  60. 7 h2 `+ k% Z0 ^  [$ e
  61. static volatile int irqraised1 = 0;- R! U, Y# }) q' A. x
  62. static volatile int irqraised2 = 0;
    5 J+ Z  g8 K4 R6 A$ k

  63. 5 j3 @* b1 f; Y; X
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);8 Y$ z" ?2 d/ e6 s
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);; F3 G8 S# B4 V) e
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    3 X* P; m2 r- F, o$ k1 E
  67. 8 \4 j$ h- z  Y& w2 V8 j7 e4 F% U
  68. dma_addr_t dmaphyssrc1 = 0;
    3 g5 T7 k7 l" x# C8 n, a
  69. dma_addr_t dmaphyssrc2 = 0;( j3 u# p7 C. P, ]/ y& s
  70. dma_addr_t dmaphysdest1 = 0;7 j* [/ Y0 g. v# U' k* B/ l
  71. dma_addr_t dmaphysdest2 = 0;
    1 r. S! j! i: V' P

  72. 9 h! A1 n5 E, {) @4 {
  73. char *dmabufsrc1 = NULL;: A: G" g2 p6 ]1 _* b& a
  74. char *dmabufsrc2 = NULL;% b: r+ u& U6 ~, J- C0 R
  75. char *dmabufdest1 = NULL;) @* x' ~. X; @) w* T9 C$ T
  76. char *dmabufdest2 = NULL;
    % ]7 `; x5 [7 Z0 s0 l# y! h
  77. / t! I1 ]# Q6 e: W, m
  78. static int acnt = 512;1 F# J/ V# m  [5 K1 |3 j3 [) |% V
  79. static int bcnt = 8;
    7 \+ \7 n; P0 c' o% f, l+ _4 c
  80. static int ccnt = 8;, g. k& X, u3 p# H! \, p! e! M) e
  81. 7 `( O7 y1 H* @( Y
  82. module_param(acnt, int, S_IRUGO);, s- K5 Z1 ~- |: Z
  83. module_param(bcnt, int, S_IRUGO);! ~/ _+ h% @* i. v
  84. module_param(ccnt, int, S_IRUGO);
复制代码
( f  n, Z- k+ W7 N) G
# x8 f: o& Q/ P1 v# l5 C9 ]
      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用" v& |+ k7 Z# c
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。. C$ r6 u. g) R0 ^5 |
     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。9 C# u- e" G" O! o/ T: x3 H
# v! D& _6 K& M* |' |6 S, t

* t% y( t( w  n, E- c2 Z
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2026-2-16 10:49 , Processed in 0.050316 second(s), 25 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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