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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑
" s' q3 }# O$ Y& A$ U
  1. [code]EDMA sample test application
    8 V( k2 I8 G+ \' i
  2. /*
    + l4 H3 c1 {# b- y8 @0 S2 a& O
  3. * edma_test.c
    3 r% {0 O* g/ j+ G
  4. *: A3 ?7 v# T1 }7 X- m1 |
  5. * brief  EDMA3 Test Application; d1 ^2 u+ ~1 Y" ]$ t
  6. *
    # t  ?; w! H; U& y
  7. *   This file contains EDMA3 Test code.
    / E9 o  `4 F4 ?+ K( m2 S$ }
  8. *9 i8 h  X/ f+ o8 R# m
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE! L/ n( T( b; q5 X3 }' z2 X
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
    : }# u% j' f0 W4 V8 @  k% p5 T
  11. *         TO CHANGE.
    % A: q9 q5 l5 ?- y' F4 c( n
  12. *
    ( Z' o3 c8 q8 i- a& Y
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
    : ~2 |7 _2 n" ~! C' {
  14. *
    ! w: i: K9 Q- Q1 R7 C; K
  15. * This program is free software; you can redistribute it and/or
    0 y$ j3 [( i+ m# c8 b+ V: Z* W
  16. * modify it under the terms of the GNU General Public License as, \% @) c7 X9 I" n3 _, K: ^( O+ u
  17. * published by the Free Software Foundation version 2.
    # z- O4 W8 `, o, t1 m* B
  18. *2 |; I0 |- |0 V
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any# c+ m% R4 F2 K5 P  U
  20. * kind, whether express or implied; without even the implied warranty- y% L, A& ]' ~* ^& n
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    1 t+ F& z, G$ s# y6 T
  22. * GNU General Public License for more details.( z, S/ q& {( R; L8 j; L
  23. */
    0 j6 ~! F2 ]3 b% }
  24.   L, a" ~$ }; R* p! W
  25. #include <linux/module.h>) R6 \4 T( _( G9 u" `6 ~
  26. #include <linux/init.h>
    6 v6 s1 Y" f' z4 Z& g" I0 t
  27. #include <linux/errno.h>7 O1 N  k5 O( W1 H! t* f( Y* T
  28. #include <linux/types.h>
    ' z: f  _3 J& e6 R  t
  29. #include <linux/interrupt.h>- u# }+ d1 S! {2 ^: Q  T! R
  30. #include <asm/io.h>
    # `2 o; i  \% _6 D
  31. #include <linux/moduleparam.h>" _5 ?7 S. J+ j" l5 T
  32. #include <linux/sysctl.h>
      C# m& [' c( f8 k! ]
  33. #include <linux/mm.h>- i) g+ B& n- C1 i8 r" ^
  34. #include <linux/dma-mapping.h>& b3 p' }  P0 P5 t  w
  35. . k, E4 b( B! q
  36. #include <mach/memory.h>
    5 ?& d0 _0 I& y9 d. j
  37. #include <mach/hardware.h>7 L  n9 `0 |" Q8 T
  38. #include <mach/irqs.h>
    2 P+ d$ H$ `* M6 I
  39. #include <asm/hardware/edma.h>
    ' H* t/ T3 e3 o6 _2 y7 Y8 r, l

  40.   `5 _$ {) W/ }( s$ ]7 z, d+ X
  41. #undef EDMA3_DEBUG' h( L7 d% p7 m9 Z7 h
  42. /*#define EDMA3_DEBUG*/
    5 {0 m1 B+ z$ ]8 z7 P

  43. / Z: w' a% I) u9 ~0 u$ M( n+ h
  44. #ifdef EDMA3_DEBUG
    , O+ M6 h6 H8 B/ A3 @
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)' Y, K2 x  ~$ o! y! u
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)! X+ i8 p3 P1 G3 j4 B# ~
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)1 p4 i4 r8 R) ?1 b" A0 }) p, n0 k2 ?
  48. #else
    * k" ~' p/ ]4 @; ]3 a
  49. #define DMA_PRINTK( x... )- a* E2 U0 W6 u1 F8 M# |
  50. #define DMA_FN_IN
    ) O1 y$ \+ {6 G+ g
  51. #define DMA_FN_OUT- D+ ^; x4 l; U+ J
  52. #endif: x( R3 x8 Y' K8 z6 N5 ?

  53. 9 K. e$ X" w3 M- u( z# h2 R- x
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)  b8 t4 r2 u6 B5 Y: m
  55. #define STATIC_SHIFT                3$ {6 J0 f! n* V
  56. #define TCINTEN_SHIFT               207 s/ {2 ?0 y9 }4 }
  57. #define ITCINTEN_SHIFT              214 r0 o! k( }! Y
  58. #define TCCHEN_SHIFT                22
    + Z  p6 }8 W+ U+ k/ G3 z9 }
  59. #define ITCCHEN_SHIFT               23+ ^  ~' a5 T4 C

  60. 1 w* c" }+ |, T$ g) r
  61. static volatile int irqraised1 = 0;
    9 t; T- M  ]4 K9 K' h  n
  62. static volatile int irqraised2 = 0;
    8 M$ ]8 g% W; p2 y, C+ o8 k
  63. 5 \: o/ f0 A; K( `
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    " k  X2 f1 P% k
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    7 ]0 n; T8 H6 m+ k& v" \' s/ H
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);- \: I/ A* o) e4 y* ]
  67. 7 q! L/ g! J+ @/ c3 N
  68. dma_addr_t dmaphyssrc1 = 0;1 q4 v  l5 U2 t+ A' U4 Q0 _
  69. dma_addr_t dmaphyssrc2 = 0;
    ; T7 \' ^9 m& g* v4 B; x
  70. dma_addr_t dmaphysdest1 = 0;
    . @, x" |" }5 S# ?& T4 N1 A$ `
  71. dma_addr_t dmaphysdest2 = 0;# B' N; D5 \: C8 j/ m
  72. 2 H+ W" U, d9 \5 u0 Y# F7 x, O
  73. char *dmabufsrc1 = NULL;
    - D7 z6 ^7 `' o7 y7 `& o
  74. char *dmabufsrc2 = NULL;
    # z0 a2 m" i+ R9 a
  75. char *dmabufdest1 = NULL;9 d2 d* \4 n  {" Z7 g
  76. char *dmabufdest2 = NULL;* ~+ I3 A9 l$ w8 @
  77. # v. V8 @2 l+ p" P+ T
  78. static int acnt = 512;
    , e% \9 a, L$ h7 {* K6 B$ I
  79. static int bcnt = 8;9 s3 g  M1 M# s8 }
  80. static int ccnt = 8;
    & ?4 X, @, ]0 z$ E

  81. 9 a6 i. l; E6 [3 u2 u
  82. module_param(acnt, int, S_IRUGO);
    ! }6 b5 L' F6 j' a8 J% p8 A
  83. module_param(bcnt, int, S_IRUGO);1 s1 k. A% t( a
  84. module_param(ccnt, int, S_IRUGO);
复制代码

6 O( K' t3 ~0 a* n( W' @
+ S: w; P7 @# a* G1 I      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用5 d  u' \/ b" T# ^
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。2 ~$ ^4 f  R2 I$ \# Q" p, v0 N
     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。7 t  l5 j1 ]- E! w! k- \; A
  K" a& S/ i4 b$ w9 @
8 h* M/ G1 O4 [3 [  t
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2026-3-18 17:49 , Processed in 0.047362 second(s), 28 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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