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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑 0 Q% a' N8 D. n0 U3 S  ]$ @$ }# d
  1. [code]EDMA sample test application
    . _% {6 k  i8 Q8 x" M9 q, q
  2. /*" m/ A! S4 M; U( O
  3. * edma_test.c/ h4 d- K4 m" S* O
  4. *  n8 [8 I1 k( A! Y' f3 \( }: u
  5. * brief  EDMA3 Test Application! f. F9 Z. f! O0 u3 @, U
  6. *
    ; Z* g% C: J9 R: J$ X% f0 f
  7. *   This file contains EDMA3 Test code.
    4 r9 n$ ~7 q* l- l; x
  8. *
    # h8 H, v0 C- s2 ^. Q7 I; s
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE: j; x2 J5 r, ~/ _' r
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
    ' Q7 U3 q5 u+ a( Q# X- t6 S" L* E
  11. *         TO CHANGE.
    8 h8 s/ ?; M, u& ~
  12. *% ^: E0 o/ V+ q) m" d
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
    " v' D; `; K% v- t! `
  14. *) A( C. R( J5 \
  15. * This program is free software; you can redistribute it and/or3 k  T6 S# q! a
  16. * modify it under the terms of the GNU General Public License as% x5 K' p% Z7 J& [; W: @+ b
  17. * published by the Free Software Foundation version 2.8 w3 ^' i1 Q3 K9 u" {
  18. *
    - d3 O$ T5 e8 g( V% H
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any% l; E5 O' r8 u
  20. * kind, whether express or implied; without even the implied warranty6 f0 k1 r, N0 O+ x1 Z) n
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    ; T; _! u. l0 i/ \3 V& ?
  22. * GNU General Public License for more details.
    9 g3 u" y. |7 I+ {+ c, ]6 m/ Y' H0 G
  23. */
    # \$ x2 }, {6 ?4 }  H2 h* K
  24. ' C2 R4 b0 h( }) O, r9 o4 O; `
  25. #include <linux/module.h>
    3 c1 |3 C2 c8 I3 j: C, O6 k
  26. #include <linux/init.h>
    / M, L# F' j% Y* _4 h3 {# [
  27. #include <linux/errno.h>
    & b& C7 d# U, O1 J; Q8 h# x3 u
  28. #include <linux/types.h>+ m$ `5 q) P7 y( w
  29. #include <linux/interrupt.h>
      {/ f' q1 q% X! r3 R9 @
  30. #include <asm/io.h>
    8 h0 m2 X2 p! t4 K8 ?
  31. #include <linux/moduleparam.h>
    " Z2 r5 k( ?+ j
  32. #include <linux/sysctl.h>! N- B, I4 `* v- i
  33. #include <linux/mm.h>
    $ ?9 ~; e) P' B; g
  34. #include <linux/dma-mapping.h>" b1 h& c1 o1 R+ u& Q
  35. 8 U( X6 [; R3 b* [0 B8 T2 w5 ^
  36. #include <mach/memory.h>$ @% {- ~" G& p4 C4 {% x3 f
  37. #include <mach/hardware.h>
    4 |) f+ o6 d  l* }# U0 a
  38. #include <mach/irqs.h>
    4 Q- j+ g9 @3 t1 F/ p
  39. #include <asm/hardware/edma.h>: ]2 ]$ g, n6 z" P. a8 Q
  40. 8 S- m, X: R1 E# s& c& f
  41. #undef EDMA3_DEBUG
    * e, f, u8 P* Y5 S  U
  42. /*#define EDMA3_DEBUG*/9 P! p- n4 b! |) C8 s, I0 w

  43. 5 ~: \. @! H* ~
  44. #ifdef EDMA3_DEBUG. l$ |/ T$ d0 m: P, p2 C0 Z) o- X
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
    ! S. X, H) ~; @3 r0 m
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__), L% F$ v8 g- [* @( c
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)9 w* L4 i9 _$ m6 ~7 r8 G( w5 I
  48. #else
    4 I# c1 c! @4 b
  49. #define DMA_PRINTK( x... )
    % h, N/ x, I8 q8 _" `  t
  50. #define DMA_FN_IN: P4 T# ~  h& h8 X! l
  51. #define DMA_FN_OUT
    / z. S# O2 V- |
  52. #endif
    - B; J/ X0 c+ e+ s  N1 Q9 K# ?

  53. 2 h/ K6 C# U: Y/ C! V
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)
    / Z# l5 e; R0 O! P
  55. #define STATIC_SHIFT                3
    % P; h9 ]0 x! t% M0 A( E
  56. #define TCINTEN_SHIFT               20
    9 k2 [3 H) @  k4 C
  57. #define ITCINTEN_SHIFT              21
    7 N% U, K. `( n$ R
  58. #define TCCHEN_SHIFT                22
    8 R9 e# [  ]3 @$ z. J2 p
  59. #define ITCCHEN_SHIFT               23
    ( H7 O* D3 R- z% |

  60. ) V) ?1 y- y. Z
  61. static volatile int irqraised1 = 0;
    ( h/ R  ~/ Q# q% `2 U
  62. static volatile int irqraised2 = 0;
    + S; A0 d" Q$ ^( |) g* G
  63. / C- a  V. {& X) a
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    ) p: A+ o: l* j$ a  y: I" k
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);' e9 o9 i9 {9 R4 ]) z5 @) c4 `. K
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);6 @- l3 J: ]$ r, h% f$ z7 ?$ X, l4 Z

  67. % Z/ ^# E2 b2 v2 P/ k
  68. dma_addr_t dmaphyssrc1 = 0;3 A- `, N8 P% T7 c1 t0 e- M
  69. dma_addr_t dmaphyssrc2 = 0;
    4 ~. ~% n0 |8 p3 @! m
  70. dma_addr_t dmaphysdest1 = 0;( Y. |/ n: S; ^8 V
  71. dma_addr_t dmaphysdest2 = 0;3 o) p7 j5 s" T+ h( \

  72. , x/ {0 M0 W5 d6 |
  73. char *dmabufsrc1 = NULL;
    ' e; d: Z. p9 S9 |4 D/ ~" Y
  74. char *dmabufsrc2 = NULL;
    * o7 @6 s1 D2 R9 }3 F2 w
  75. char *dmabufdest1 = NULL;/ R8 L- ]% N7 i3 y! p1 m
  76. char *dmabufdest2 = NULL;) o2 ^/ H  P$ \; v

  77. + v# x4 M: n9 L, b& R) f5 i
  78. static int acnt = 512;
    ; N! S8 i: C; A. z+ v6 I, t
  79. static int bcnt = 8;
    / h) v/ U8 h. V) ~
  80. static int ccnt = 8;3 e4 S% x! F$ Y6 g" W
  81. % x; n2 v+ l! w# R9 C/ Y7 Z" l7 e# ]
  82. module_param(acnt, int, S_IRUGO);
    ) x5 @7 o2 H" O. ~" B, B" A
  83. module_param(bcnt, int, S_IRUGO);
    $ L' j( _! [# L% Y, O; C+ i  B
  84. module_param(ccnt, int, S_IRUGO);
复制代码
) c9 k& k9 ], v6 H8 [% `; d% N

) c+ P( x: l+ n. [9 V$ h" n% c      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用; u* |$ }1 y0 L& k2 x
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 e8 U9 C' \4 T     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
( }  [. ?" T( t6 O7 ?
  n4 u& b( E  W$ j" [/ z
8 y. S; m: H$ ^3 X5 ^2 q
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2026-3-12 00:42 , Processed in 0.043008 second(s), 26 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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