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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑 # D9 L0 O8 }0 e7 F' s
  1. [code]EDMA sample test application5 [; E& |2 m; s1 D& S
  2. /*/ c* `: n* `" Y. }' }1 L
  3. * edma_test.c# e; p  ]9 `) p+ W
  4. *! ]8 e; |2 p7 o# @; m2 p
  5. * brief  EDMA3 Test Application
    : H  B* r- [0 D, x1 o5 }& k
  6. *
    ( x0 w9 V% S% c) i% C6 s- A
  7. *   This file contains EDMA3 Test code.+ B7 ~5 }5 q( H0 Q$ B# u6 }
  8. *
    + b; c% n2 `3 V# R0 Y. x- N
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE6 K; W( c: e6 w
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT5 R7 N. r$ a1 P1 f1 w8 U
  11. *         TO CHANGE.& X3 |# R: `$ m2 e7 q& s
  12. *
    % p% B3 ^% g9 q+ a, |, A
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
    4 K5 o' y7 a. }: x6 w- t
  14. *
    ; @  G/ V4 w% y+ q
  15. * This program is free software; you can redistribute it and/or9 Z1 L  b5 _) D/ Y7 A
  16. * modify it under the terms of the GNU General Public License as/ D4 e. j( x5 B6 A$ I. z
  17. * published by the Free Software Foundation version 2.2 ]; e5 Y, h+ H2 j) I) w- v+ l+ S
  18. *
    " H6 |/ y) B# o9 p0 N
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any# n/ J4 R, h# u# x8 S1 A
  20. * kind, whether express or implied; without even the implied warranty0 w, E  |( L# U/ |; p2 d, Q& T
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the( M, ~! J! H& @* ^  U  s
  22. * GNU General Public License for more details.
    * i# F, L# X, ~. h. D* m* h# L
  23. */
    1 N% `- [- p4 l9 _/ w! U( j

  24. " k/ `3 F; j; b0 L! Z
  25. #include <linux/module.h>, A, B$ E; P3 \5 w6 f
  26. #include <linux/init.h>
    ) R) @, E6 H# i' X0 H0 E, @4 L
  27. #include <linux/errno.h>
    # W  H& a/ e7 p6 e, I
  28. #include <linux/types.h>
    8 l( y/ v% T; W7 b8 @) T( O8 e
  29. #include <linux/interrupt.h>
    8 Y( y5 y6 o& S. j: o
  30. #include <asm/io.h>2 V7 A4 \' C* T# U# H
  31. #include <linux/moduleparam.h>2 i  f' A2 K* T6 \# ^. M
  32. #include <linux/sysctl.h>. A9 m6 j! Z7 U) c* |' b3 E
  33. #include <linux/mm.h>$ [4 [$ d8 D7 E: E4 q9 \2 b
  34. #include <linux/dma-mapping.h>2 s# d6 \1 {) @; @. M
  35. + {3 g. D9 {; ]& _. L
  36. #include <mach/memory.h>% C* h( U$ `  _$ Z
  37. #include <mach/hardware.h>
    - |/ @" M  @) A+ g( a
  38. #include <mach/irqs.h>
    3 o% X2 j# g' C
  39. #include <asm/hardware/edma.h>2 d9 G7 Q$ y$ g- x

  40. ; ?8 [9 G# q1 G
  41. #undef EDMA3_DEBUG0 ]- [& q  v. s; G4 d
  42. /*#define EDMA3_DEBUG*/" f4 F: _! Y6 S( u3 t

  43. # o' k! k2 B% f' R, H. g5 @! f1 W
  44. #ifdef EDMA3_DEBUG
    % p5 C; K+ z$ m; x
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)) j4 k' ?1 B$ H
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
    / c3 X0 `' {3 o; I! f- }
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)3 }; h2 W/ d( j$ q) H. `
  48. #else, V2 o1 e# g( M5 A, [, n8 R
  49. #define DMA_PRINTK( x... )' M# [: J: a  ~& y, E
  50. #define DMA_FN_IN
    ' I: S9 x7 d  U% t3 f  P8 \% G5 l
  51. #define DMA_FN_OUT
    4 J. W$ L! r1 m) i9 r: {
  52. #endif
    1 ]* p3 u0 w$ N
  53. # n( W- {0 r. B' U/ Y6 H& ^9 u+ A) P
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)
    ( z# [& G5 ?+ S+ d1 v. S/ ?
  55. #define STATIC_SHIFT                3
    ) A  z2 I" D7 R! a* J
  56. #define TCINTEN_SHIFT               20
    & f2 R  Z1 t7 ^' v
  57. #define ITCINTEN_SHIFT              21
    * b) Y0 y& ^( z! O/ @& E
  58. #define TCCHEN_SHIFT                22
    ; v+ w# t8 p: u, Z. ^, g& t5 R( A9 S1 T
  59. #define ITCCHEN_SHIFT               23
    $ q+ Z: O+ g9 p$ j7 ~" C& \. r1 D

  60. & ?  J9 F9 f/ m, R/ N6 e2 P& N7 p
  61. static volatile int irqraised1 = 0;
    0 R# s8 _8 z. w" P* \5 G3 {
  62. static volatile int irqraised2 = 0;. Y4 y8 b( ?2 k, a. t! A

  63. . g. Q0 w/ a# B/ c; ~2 B
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);2 e+ d4 I' H3 ~; O  e
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);9 D2 J1 [2 l2 ^/ v
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    . Z9 [3 p+ t, I+ h) r

  67. ' ~$ F4 {# L- y) F  Q* }
  68. dma_addr_t dmaphyssrc1 = 0;- L* P: Y7 ^. m% n
  69. dma_addr_t dmaphyssrc2 = 0;
    0 C* y/ V! x+ I) S" \, n! f5 v
  70. dma_addr_t dmaphysdest1 = 0;; z) i( w( O8 p) h2 K
  71. dma_addr_t dmaphysdest2 = 0;& E9 `, ]$ V' n2 y

  72. & v& B0 ]' j7 f/ Y- V( f0 N
  73. char *dmabufsrc1 = NULL;
    7 P5 b" Z% L0 A* `/ ~! u. d
  74. char *dmabufsrc2 = NULL;4 o9 X- O5 T# ~, P- u+ R8 r7 M( X  f4 X: d
  75. char *dmabufdest1 = NULL;: H& B4 T1 I+ B) D5 t3 A
  76. char *dmabufdest2 = NULL;
    : p4 [+ j: @3 ]; f) [  S
  77. ) V) T2 a- n( Y( c+ O6 N
  78. static int acnt = 512;
    6 y& U8 Q1 H: @
  79. static int bcnt = 8;
    0 ~2 s  {0 o4 x& M  l0 L
  80. static int ccnt = 8;
    , K* Y5 b6 {3 r" q" b

  81. / r' K0 L. g  Y! n) s, p
  82. module_param(acnt, int, S_IRUGO);
    . v6 G2 A% P- P4 ?5 Z$ X3 I- `
  83. module_param(bcnt, int, S_IRUGO);! S+ v6 o/ t# ?# n* P4 H
  84. module_param(ccnt, int, S_IRUGO);
复制代码

. L8 B) }( U, S1 O! V) V) w: t4 u/ E( i
      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
! M9 z0 J- y  w# H$ {+ k# W2 \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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。  i* ^0 w9 B- y9 p& Y
     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
9 F# u1 e" }* w$ W( z
9 p/ \  J! |( m: Y* r+ ~  D5 \( ^/ m+ c: J  r5 }
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2026-3-16 09:58 , Processed in 0.040908 second(s), 26 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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