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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑 ; Z6 Q8 \8 ^6 F5 W9 Y$ J
  1. [code]EDMA sample test application' C7 _+ B  i3 [
  2. /*2 M9 @$ w% \9 \- q' O- m1 `7 k" D
  3. * edma_test.c
    7 X+ k: [, J- c# o. N: z" ~8 _
  4. *6 D! s) I" L! m2 y& y' S2 A
  5. * brief  EDMA3 Test Application& ~! b. G3 [: b8 n* s
  6. *! C) ], E' |7 y7 Q1 N0 S, G
  7. *   This file contains EDMA3 Test code.$ k$ S5 w4 R9 s* X  N4 _& M
  8. *
    ! J; R  g# e& e2 |$ j- V, D
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
    & g- q8 E' O6 k1 ?, ^: \; l" R
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT; T5 X& l2 [+ H! B% s
  11. *         TO CHANGE.
    . g/ y- j- P& o1 p
  12. *
    0 r9 M$ h* f: z
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
    " A3 _7 r/ v* S: P* z
  14. *
    # E& \/ {' d  u# \' U
  15. * This program is free software; you can redistribute it and/or; p7 n: j( a3 t, D
  16. * modify it under the terms of the GNU General Public License as1 ?* T$ Q( F  e" N+ n+ P5 {9 F
  17. * published by the Free Software Foundation version 2.
    % l4 B9 R9 m$ C" Y2 n3 Q' Y: z) t/ R
  18. *
    ( _, |6 R4 P) H3 ]* u/ p
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any
    $ f5 c" D/ K& P* k
  20. * kind, whether express or implied; without even the implied warranty
    . o! W0 ^9 _' X- k% k) L
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the/ E) P% N5 v2 j% M( G
  22. * GNU General Public License for more details.
    - W. o: r* L" D6 b0 [
  23. */# P" Q: T. A5 _: C% x

  24. 6 S  J3 R1 p% q3 ^9 ~; G) |
  25. #include <linux/module.h>
    $ H1 F# B' ^0 ^+ t4 c9 ?+ h4 P  t
  26. #include <linux/init.h>7 G1 y, b' x. b
  27. #include <linux/errno.h>2 C! H. z: u7 C
  28. #include <linux/types.h>
    ; `7 x- }( {, P, q$ h
  29. #include <linux/interrupt.h>
    7 g, A5 z2 p% E, J5 y
  30. #include <asm/io.h>2 X$ g- u+ m4 w' I
  31. #include <linux/moduleparam.h>
    ) j) }! g3 \& l" |3 e
  32. #include <linux/sysctl.h>
    : \% B0 E9 k; ?
  33. #include <linux/mm.h>5 K: K6 {- |5 W" d
  34. #include <linux/dma-mapping.h>
    " ^# v! W: j- j4 P* n9 w- {
  35. / m  e$ O' y8 S, I
  36. #include <mach/memory.h>7 M0 |, m0 A. Y
  37. #include <mach/hardware.h>
    1 f5 r/ q0 ]3 n2 {
  38. #include <mach/irqs.h>
    3 E* ^! H8 n2 W
  39. #include <asm/hardware/edma.h>
    * t# d* q5 D- ~

  40. & Y2 `# p, U1 n9 \
  41. #undef EDMA3_DEBUG- F0 J6 o+ P  \/ m! W' n7 v2 a
  42. /*#define EDMA3_DEBUG*/
    5 k4 J, s. [* j  b: h# C
  43. 9 T6 K/ k  g% P
  44. #ifdef EDMA3_DEBUG
    6 f( T1 o, s8 s0 @
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
    8 X) b3 N- ?/ Q) Z7 Y3 i$ X; y
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
    / a3 w) d; Z8 ?
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
    & y& |: H( U8 B% |: ?
  48. #else4 w* x" f6 @7 G9 _" P, R
  49. #define DMA_PRINTK( x... )6 S# `" ?1 N: N1 f6 z: ^
  50. #define DMA_FN_IN
    6 A; e( F' j9 {3 L8 O' U. Q
  51. #define DMA_FN_OUT9 t6 l# @. `. ^) ]
  52. #endif: o: |  j+ W1 ?# W1 a3 b

  53. ( [; l5 j- r/ ~5 k6 c
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)" k1 R* Q6 y2 J
  55. #define STATIC_SHIFT                3
    : Z( i8 @" v9 V! {! J
  56. #define TCINTEN_SHIFT               20
    1 J+ C' L7 H' ^' l$ x; a
  57. #define ITCINTEN_SHIFT              21
    1 d" R0 S( i8 Z! ~8 J
  58. #define TCCHEN_SHIFT                22+ z, z6 y6 s1 l6 C8 S* A
  59. #define ITCCHEN_SHIFT               23
    ' L4 P+ s5 P7 a8 H

  60.   N: Y; k1 E9 Q9 X  q
  61. static volatile int irqraised1 = 0;. y! \' a" E+ A+ x+ k8 j4 \
  62. static volatile int irqraised2 = 0;# s% ~" _" P% x8 O! z( ^& T! x) s
  63. 5 y; L$ J* A7 e5 o8 c) D
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    9 Z& J2 ~) T1 o' q
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    6 n& t9 ~. f8 Q: U1 h0 a
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    7 k% d% n  O' K' k( U6 d$ y( x2 A
  67. . Z1 g7 d3 L* `* {& E9 Q' W4 R9 `- \
  68. dma_addr_t dmaphyssrc1 = 0;
    1 J% s0 Z0 f+ X; N0 W2 v/ v  Y2 U
  69. dma_addr_t dmaphyssrc2 = 0;* J% Q7 Y* s6 X) w( t
  70. dma_addr_t dmaphysdest1 = 0;; t; W% }* `% K1 g9 D* n8 Y
  71. dma_addr_t dmaphysdest2 = 0;
    % c8 B* S6 R/ v; W" e4 b
  72. / s* m' R: H4 b2 q# L4 j& G
  73. char *dmabufsrc1 = NULL;
    , g2 L7 m! |" t1 i1 j
  74. char *dmabufsrc2 = NULL;3 p0 |1 v' G/ f  R- ^7 u5 L
  75. char *dmabufdest1 = NULL;
    6 e4 j% r5 @# K
  76. char *dmabufdest2 = NULL;
    6 W9 D3 G0 J' }
  77. ! d$ Z" D3 U  }
  78. static int acnt = 512;5 h+ |. i% n1 H. ]5 C
  79. static int bcnt = 8;
    # r& E( J" e! s& U
  80. static int ccnt = 8;/ J  z! u1 ~  n
  81. * o3 a! [3 _3 ]) `* z" A7 R
  82. module_param(acnt, int, S_IRUGO);
    9 V7 h# j% n6 y9 |, Z
  83. module_param(bcnt, int, S_IRUGO);
    . L' {- r  {/ g) ^+ F; ^
  84. module_param(ccnt, int, S_IRUGO);
复制代码
1 h" b# i# ~2 G0 g( O% M
8 z# M+ i0 D+ H* Q8 m
      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用! z6 D9 n+ ^% p- T, u
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
  L; p2 Z) C% a1 }, z0 l1 I     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
- X9 B! }8 ^1 C# V7 K2 h! E" Q  Z0 ?% \/ s9 N  [0 Y* y
5 ^1 ?2 U* j$ d$ G, P0 }; B8 B
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2026-3-27 21:02 , Processed in 0.038023 second(s), 25 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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