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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑
7 m* Q/ E) U7 S
  1. [code]EDMA sample test application6 v1 r1 P$ Q/ s: A* j% e
  2. /*9 ~, I2 h# E8 ?) f+ p" `7 k3 k" g7 f2 T
  3. * edma_test.c
    & ^$ X# m1 e2 Y3 |
  4. ** w1 b4 w" t7 L, v0 F0 I9 S
  5. * brief  EDMA3 Test Application7 N4 y& `' }7 u
  6. *7 }0 \* T3 o) h+ E7 G
  7. *   This file contains EDMA3 Test code.
    # h) q- o6 k' \0 m" h" @
  8. *, a2 S8 _$ h7 ^6 p3 N( z
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
    0 A( x% ?8 D; J6 E" f; t
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
    " e, @8 D  x1 C( J: R3 ~, ?8 U
  11. *         TO CHANGE.1 }/ Q; T5 N: R
  12. *
    4 N3 d6 G; f9 p. {* ^8 e# i
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/2 ]- X; d4 t3 A  _
  14. */ h! h, n  W1 g* e: W, R+ }1 ~7 `5 B" p
  15. * This program is free software; you can redistribute it and/or. V9 K& J% v! p) D# P" |2 i% d5 P
  16. * modify it under the terms of the GNU General Public License as
    $ Z1 w7 I- V# K: [
  17. * published by the Free Software Foundation version 2.1 I3 h- H; R! h
  18. *- V4 _$ e& J) T( V" f
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any' n* Q3 Q+ V# l
  20. * kind, whether express or implied; without even the implied warranty) x* O, J% x0 U
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the- M/ J% Z' a9 C; M! v5 O
  22. * GNU General Public License for more details.
      k9 Y- U4 [& {4 h; T' J) _
  23. */
    3 o2 e7 e' v' a+ d

  24. * f5 W+ j# X7 o. y/ V
  25. #include <linux/module.h>  E6 N$ t8 W* S* H: ?/ V6 J) Q
  26. #include <linux/init.h>
    ' W! t: R4 t2 K" p# P
  27. #include <linux/errno.h>
    : F/ [1 s' |. Z, g
  28. #include <linux/types.h>5 ~8 {  D# [$ |5 U8 t1 M2 V8 p
  29. #include <linux/interrupt.h>: ?+ |$ P) R! a/ _+ `
  30. #include <asm/io.h>$ M/ A1 f  j$ n
  31. #include <linux/moduleparam.h>
    " }2 p: ?! [9 b0 h, u4 D  s1 s0 M! E$ I
  32. #include <linux/sysctl.h>
    . J0 r' w' g' g
  33. #include <linux/mm.h>
    + M0 p% s/ I% `& E" I% _2 U9 Q$ e
  34. #include <linux/dma-mapping.h>  Z! ]4 M8 I0 H
  35. 6 A% t2 \. Z# |. o. J0 b9 v
  36. #include <mach/memory.h>
    - k8 k: f6 {, t9 [- K  }+ h
  37. #include <mach/hardware.h>
    4 g3 E# G7 c4 S* {2 b! F
  38. #include <mach/irqs.h>
    " B2 L  F0 a% Z8 W) M9 S5 D2 w
  39. #include <asm/hardware/edma.h>$ _" d8 Q' k2 A
  40. 2 [3 H6 H% A8 m+ u5 I: ~- N
  41. #undef EDMA3_DEBUG7 q& p; M9 W5 C# g# z
  42. /*#define EDMA3_DEBUG*/; K, T! s" Y" W

  43. $ E) n$ w2 N/ R' M  e7 @# p
  44. #ifdef EDMA3_DEBUG
    . {  w; Y/ j- y0 F! f
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
    ' N- }4 C: z' B( z9 G0 B
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)5 p* ]: N0 o3 q; r2 q
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
    4 H$ ?3 w& H1 V
  48. #else# W7 C& K  K, N. ~  C% C, l
  49. #define DMA_PRINTK( x... )
    6 ~/ c; K5 t- l$ t# L% p
  50. #define DMA_FN_IN
    , \9 t+ b1 L& [" r, N) a% i
  51. #define DMA_FN_OUT& b$ q1 s8 {  c* v" a
  52. #endif
    1 g+ ~& Y" @: G* n

  53. " D( p& n( [: x. p
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768); G+ k6 _" J) P0 b; P
  55. #define STATIC_SHIFT                3
    4 ^- z7 Z, a4 I
  56. #define TCINTEN_SHIFT               20  G; q/ v8 _. }
  57. #define ITCINTEN_SHIFT              21
    # |# |# r1 ]' J$ j" F6 K
  58. #define TCCHEN_SHIFT                22
    " y4 C5 q5 r6 X- O7 a
  59. #define ITCCHEN_SHIFT               23
    6 R) ~$ D/ R2 B3 Z: y
  60. $ e' j6 Q0 y% ?" O
  61. static volatile int irqraised1 = 0;- L" T9 {3 R$ m0 o+ \& z0 H9 G8 n
  62. static volatile int irqraised2 = 0;! c7 {/ Z: a7 r
  63. ; s% X6 }/ w+ T) U
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);; |9 O( _, ?; d: L  z
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);% \/ T& q8 N6 W
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    , d: x$ |4 t; y1 P; z9 z

  67. $ c( i3 y7 S" d4 M8 l
  68. dma_addr_t dmaphyssrc1 = 0;
    & K2 E" A) f. v. F) W
  69. dma_addr_t dmaphyssrc2 = 0;4 z% \! O0 @4 U' P( w* B
  70. dma_addr_t dmaphysdest1 = 0;
    . n6 X, C+ K6 A- y
  71. dma_addr_t dmaphysdest2 = 0;: ~8 ^3 Y1 F' N; G
  72. 8 R  o/ _2 K" t, x+ p
  73. char *dmabufsrc1 = NULL;
    7 `2 Y3 ^' R$ q2 M, i: U
  74. char *dmabufsrc2 = NULL;
    . ]% J- s/ e% D* R
  75. char *dmabufdest1 = NULL;! T+ h3 S7 S* r( [' V" V: I3 u
  76. char *dmabufdest2 = NULL;2 L6 \5 y8 V& P4 S

  77. . O0 U  N+ ~& Z2 `
  78. static int acnt = 512;& I/ R# V. Y3 ]# k2 @/ ]
  79. static int bcnt = 8;/ e) {/ u9 R( Q$ L
  80. static int ccnt = 8;  D1 r7 z: A& ~
  81. ' L! K; Z/ G, w' V: L4 ~
  82. module_param(acnt, int, S_IRUGO);
    # g7 u2 q7 L2 M4 E1 Y) _2 j+ _
  83. module_param(bcnt, int, S_IRUGO);
    # K4 \" t. n4 h8 p1 C0 ]5 P! }# t5 `
  84. module_param(ccnt, int, S_IRUGO);
复制代码

! c5 I1 K/ r# |# ^- a) n( c( ]1 A- V8 ^- y) ^( Q
      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
+ l7 z3 T4 U9 @: G7 P' q5 P* A$ [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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。7 C0 e$ j) f6 F
     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。0 G0 Y7 s$ ?, o6 U1 D
2 Q; p3 U: H; @$ `& }

" W4 _- ]0 J+ y( P- y; Y
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2026-2-16 05:46 , Processed in 0.040434 second(s), 25 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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