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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |正序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑
8 B/ k% M  E( b6 L7 |2 q4 D
  1. [code]EDMA sample test application2 g" u" S; K0 J0 D
  2. /*) u9 K) g' k" ?
  3. * edma_test.c
    + V, s0 g$ t: ?! y
  4. *
    ; q/ h1 L0 b$ u0 ~2 v+ d
  5. * brief  EDMA3 Test Application
    6 W, {! J' `8 U5 V9 b! ^
  6. *
    + k$ J% I0 ]6 T$ E& e
  7. *   This file contains EDMA3 Test code.$ d% G9 s) |! w/ E# w/ W
  8. *
    . Y, C: {1 \$ _! c5 {2 _; u+ T  J1 g
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
    & U( T. u* b/ c
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
    , J3 d# Y/ d; |8 E! l# E# m  t
  11. *         TO CHANGE.* e! G$ A9 V* d* k* k6 s
  12. *" C% L# ?( b  |& @9 n
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/8 T4 G: N8 @- i. t( A8 j! E
  14. *
    ' C" j0 I# f8 o$ \1 T
  15. * This program is free software; you can redistribute it and/or
    2 y  E* V$ k- A  f( \9 V$ Z. m9 D
  16. * modify it under the terms of the GNU General Public License as
    # ], r8 ~! H1 W. y& R# _
  17. * published by the Free Software Foundation version 2.
    & y6 @/ C6 }& }' H+ F* `6 l0 C
  18. *
    $ \: C- H: k1 _  q
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any: x- m* P; G( u) C- s
  20. * kind, whether express or implied; without even the implied warranty
    ! O' q) h. o$ x$ V9 H3 h
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the9 Q, Y) D7 r9 a# V& H: [$ r; i
  22. * GNU General Public License for more details.
    ) a4 [$ }* r9 F. W) F
  23. */2 f& s! ?* K- R; t* V0 y0 A

  24. . B9 Q. E6 u2 }4 x8 d5 z& I
  25. #include <linux/module.h>
    ; E; D5 k7 d$ b5 P
  26. #include <linux/init.h>
    3 ?- U# u* j  `0 i; t; B  m; i
  27. #include <linux/errno.h>: L6 i4 X3 z3 A
  28. #include <linux/types.h>& z4 S* t, G  K+ Z8 t, Y% M7 O, B
  29. #include <linux/interrupt.h>4 J* y& K# j( t) L8 b2 X+ Q9 e
  30. #include <asm/io.h>0 G  `& S2 N. X3 e4 r
  31. #include <linux/moduleparam.h>
    0 p8 c# X4 U4 \  S
  32. #include <linux/sysctl.h>
    , G! u+ N: N# P- l$ Z, c
  33. #include <linux/mm.h>% P! {7 v4 d$ P$ X' z" [* F
  34. #include <linux/dma-mapping.h>8 A1 R3 q$ J1 y. G7 a8 C! V0 U
  35. 5 }7 A: Q8 F; V" D
  36. #include <mach/memory.h>
    # Q; y  Y4 o0 u7 ?, d6 }6 w
  37. #include <mach/hardware.h>$ s1 ?! W6 w1 W1 ^# s
  38. #include <mach/irqs.h>
    + \& G+ J6 v5 ^" {4 `
  39. #include <asm/hardware/edma.h>' S2 {! J1 \+ v* Y

  40. 1 m, n: u  h7 a/ T
  41. #undef EDMA3_DEBUG  U# g- I/ X3 z$ \; I8 x9 n/ ?
  42. /*#define EDMA3_DEBUG*/5 w; t- B# K5 f) U* o

  43. ( `2 W0 o$ x- h7 S2 p& X) N
  44. #ifdef EDMA3_DEBUG# R" b$ f8 t# U# `  r! e% @
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS), f2 }) q3 }  p+ v2 j! U* T. V) w& X
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)& X3 W( R+ J0 R2 }! S+ \+ `" T2 X
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
    0 q% B0 H* M# v
  48. #else
    ! V+ e  G) B; [
  49. #define DMA_PRINTK( x... )
    " V) F% G. ~/ L9 i  n
  50. #define DMA_FN_IN
    - v+ c1 Q1 d8 f- t# z/ z
  51. #define DMA_FN_OUT/ {% Y4 {* b3 Z/ R$ z" t* J
  52. #endif
    0 q8 s! [: o2 C% O' n# N
  53. ' ~; P* i1 q5 B
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)  P) t0 m2 x- R
  55. #define STATIC_SHIFT                31 @1 i; J' C7 G8 S
  56. #define TCINTEN_SHIFT               20
    $ y, l) S+ p; x; e
  57. #define ITCINTEN_SHIFT              21
    " O7 ?4 w- M' v/ X$ r7 U7 ?9 R
  58. #define TCCHEN_SHIFT                22
    4 H' g6 z! N/ B; X% v- |
  59. #define ITCCHEN_SHIFT               23- a" z. v% x! c8 u: G
  60. ! D+ {. B- i/ ?& N. w9 q8 I4 {
  61. static volatile int irqraised1 = 0;
    % Z" T  i; P# E
  62. static volatile int irqraised2 = 0;3 Y. M8 H: ]" z1 c
  63. $ _" |" E  u5 C3 X
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
      v' j5 J& H( U9 w
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);7 @! j" R( W' |+ y% _2 Q
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    & l. Y  |# A8 f0 R- ]

  67. 4 S  g2 |0 Q; B
  68. dma_addr_t dmaphyssrc1 = 0;
    . C2 ^+ @$ F& M( b- B
  69. dma_addr_t dmaphyssrc2 = 0;
    " `- x+ w' p" X& c; {
  70. dma_addr_t dmaphysdest1 = 0;1 Y6 u! U2 Y7 c. v- j3 h2 O1 }
  71. dma_addr_t dmaphysdest2 = 0;5 z, J9 x2 ]0 y2 {$ g1 F7 M
  72. - m9 u! e! S0 ?+ L9 j- _
  73. char *dmabufsrc1 = NULL;/ R5 l, Z" b# d. [
  74. char *dmabufsrc2 = NULL;
      K8 }) j* _* `% C% u# j
  75. char *dmabufdest1 = NULL;: ^5 i  c, W7 V5 p3 M7 J
  76. char *dmabufdest2 = NULL;+ `  g# g) Q' i+ o; S9 ]
  77. ( C; h: z" O" q& ?# f; `
  78. static int acnt = 512;! P* w0 a4 _: n# J0 e6 t
  79. static int bcnt = 8;
      ]' ?  U2 r% j% a+ w- l
  80. static int ccnt = 8;
      d8 L7 U  x: b9 T, c/ f

  81. 9 N$ B4 v; |; r$ U7 u
  82. module_param(acnt, int, S_IRUGO);5 x# x6 q( _* W6 n
  83. module_param(bcnt, int, S_IRUGO);
    & d) L, p; q- A1 Z1 J$ n
  84. module_param(ccnt, int, S_IRUGO);
复制代码
+ l5 ^! y+ S( N* n
$ R( y  k$ D# a8 w
      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用3 h2 [4 a/ T9 }/ G' f( h: Y8 M" Z6 v  ~
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
0 ^: c6 m. u7 B4 z' T! L8 }     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
; a' m+ N' }1 Q5 I+ }0 K3 |1 O0 @8 d9 z9 \3 w' l
! J/ S8 w# A3 d; ]
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2026-3-22 05:58 , Processed in 0.039931 second(s), 26 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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