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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑
% J9 B& I- t/ z9 A
  1. [code]EDMA sample test application
    ! ~; O1 H  J; P0 r
  2. /*
    7 a: _8 R* c+ Y# [, K
  3. * edma_test.c
    , V) Y; y  g2 ?/ R/ m8 c
  4. *( S; L, d0 B/ x% u# O# ]; V" Y
  5. * brief  EDMA3 Test Application
    ; Q0 h8 ~! S9 r% P2 g2 d
  6. *4 C& s8 o) [* Q7 L+ T6 {& @
  7. *   This file contains EDMA3 Test code.
    + I5 }" v8 H9 k
  8. *: d: I1 M/ V) @# U+ w( j
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
    1 ^7 `( Q) {* ?
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
    2 [4 q' ~# k) [2 S% m! L5 b
  11. *         TO CHANGE.
    ) T0 x. m, J8 H$ ?7 Q$ A
  12. *
    : p- X" U' l6 z. T6 g* U
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
    ' }* c, w/ w* z
  14. *
    9 M& I  h  s# }9 f9 D* W
  15. * This program is free software; you can redistribute it and/or+ E$ k7 e9 K- _' R6 `' e
  16. * modify it under the terms of the GNU General Public License as
    " E& x- Z) `( c$ h
  17. * published by the Free Software Foundation version 2., y4 f( z% C. X, e" z; g' O
  18. *  ^4 t% G1 P. @% E) P! m" A4 m% F8 h
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any
    . C. R. R& b0 M/ h7 m, s
  20. * kind, whether express or implied; without even the implied warranty2 @2 W* r$ Y" ?; y
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
      W4 E/ @5 i, ~; i6 b
  22. * GNU General Public License for more details.' u9 o6 U" [, E: O
  23. */" @4 o; M2 ~% X8 ]% u1 t

  24. 8 F( D$ M; ]; A4 o, ]$ V. z$ M- n
  25. #include <linux/module.h>
      N! Z9 a. l6 l7 k
  26. #include <linux/init.h>
    7 G+ G7 g4 d5 |; X9 _( u
  27. #include <linux/errno.h>
    5 T! |8 Y4 N. F/ e' H! x! v) f9 Y
  28. #include <linux/types.h>
    # s1 g4 H/ e$ `, a8 e
  29. #include <linux/interrupt.h>
    * g2 [. |$ z& a# P# h* p/ W  g4 a/ r
  30. #include <asm/io.h>  {! x7 Y! [, q9 H
  31. #include <linux/moduleparam.h>
    " Z. e, n) Y4 D2 ?# p
  32. #include <linux/sysctl.h>) A( Q: B' v+ I# W! A( Y
  33. #include <linux/mm.h>
    2 ^. F0 ?2 X! Q( r+ X  r
  34. #include <linux/dma-mapping.h>
    $ n: s( j1 H+ u" D9 S
  35. 6 a) a$ M; q- O1 ]$ @
  36. #include <mach/memory.h>) y: D: B" Y2 ?3 h
  37. #include <mach/hardware.h>
    " A& \5 r/ S% `
  38. #include <mach/irqs.h>! b9 T+ O& E7 `$ D
  39. #include <asm/hardware/edma.h>
    0 v- w. g4 a) h: P
  40. 3 C  b* f! t  ]2 @8 `  z4 J
  41. #undef EDMA3_DEBUG- b' q% A2 M1 w. W4 v8 [
  42. /*#define EDMA3_DEBUG*/
    : K, X+ K& |% `- p: A

  43. . a0 N+ G" I! R9 F  P, J
  44. #ifdef EDMA3_DEBUG! y& `# X, @9 R1 h- o: j+ a
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
    " t# {! D# S5 L3 \2 H! y4 Y) ^
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)$ M4 D+ @2 ~5 X' N
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
    % ^) S: J9 i7 `4 h
  48. #else
    + v, p2 {7 `; M: |7 c0 N
  49. #define DMA_PRINTK( x... )
    3 W" W7 ]8 j& l$ a: E% @+ o
  50. #define DMA_FN_IN
    % M# }- V6 q7 @* p) C. B. O
  51. #define DMA_FN_OUT
    9 s- }6 H( z; e  s( K0 N
  52. #endif
    ( @& |( l3 \8 G
  53. / k. [  M4 D/ J$ Z6 d* P5 m6 a
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)
    / }( t. [0 Y( K* x+ G* ~
  55. #define STATIC_SHIFT                3
    + ]$ e5 T- F# e3 ^
  56. #define TCINTEN_SHIFT               20
    # o5 P! g8 `$ n
  57. #define ITCINTEN_SHIFT              21' A6 n! ]0 }! G/ X* o$ j8 }1 _
  58. #define TCCHEN_SHIFT                22
    3 _# U- P: c& m* r! t
  59. #define ITCCHEN_SHIFT               237 \4 Y! `# U, Y5 B3 e, \
  60. * n' s. E! g9 a
  61. static volatile int irqraised1 = 0;
    1 [% |9 N- }, D0 z! \3 w9 L
  62. static volatile int irqraised2 = 0;! D2 f) ]8 |4 N0 h, I1 u' o! r7 p

  63. $ M7 N. Q; D& V% T& ?
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    . Q8 f) U! e& _1 r0 P- E! a5 W
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    6 Q" K; U. b" p; a# a3 C% z  i! }
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    9 j; A1 h! F" U; [* U

  67. % \/ k& p8 z# M5 W% N0 w$ J
  68. dma_addr_t dmaphyssrc1 = 0;
    , Y' f9 b0 _$ t! d0 S, I
  69. dma_addr_t dmaphyssrc2 = 0;* A" V5 h) f% F, j" U, Q
  70. dma_addr_t dmaphysdest1 = 0;
    % Z; J$ k: Q: `/ F6 C3 ^
  71. dma_addr_t dmaphysdest2 = 0;
    0 R6 |) I" k* ^4 ~6 W& X

  72. * C. e5 r  Y0 i2 B& k; N- ]8 E
  73. char *dmabufsrc1 = NULL;
    - F: N4 `6 {6 g/ E/ d
  74. char *dmabufsrc2 = NULL;  r5 S6 O% d+ p* u) d* e$ W
  75. char *dmabufdest1 = NULL;
    8 _2 T( t4 ?/ X5 L
  76. char *dmabufdest2 = NULL;
    + L8 {$ }- C- s. S
  77. + p4 e# A1 c0 c  V: b& |% }) z$ u# }
  78. static int acnt = 512;* X& ^: G) H" X0 \, o
  79. static int bcnt = 8;" f) g! p/ l- ~: ]# w4 n. I
  80. static int ccnt = 8;
    2 D9 b2 p  z. |# e: b

  81. ; d) x8 y) E1 B5 _0 t
  82. module_param(acnt, int, S_IRUGO);; z4 e7 L( x! A8 B5 v
  83. module_param(bcnt, int, S_IRUGO);
    ! e  y. P$ y0 \, N! b
  84. module_param(ccnt, int, S_IRUGO);
复制代码

( n" J( `; m! P" p0 B+ R, e0 V. D" Q6 X  O6 W
      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
/ m, B! K6 L; m4 U2 r% S* harm-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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
1 r) o7 o  F. U     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。/ ?& g- S' L; W% G5 p

# l3 J9 P9 a- ^  K3 z1 n( S2 C, [4 y3 p5 u0 L1 T
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2026-2-26 05:35 , Processed in 0.037900 second(s), 25 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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