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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑 3 F7 x. B/ [; B
  1. [code]EDMA sample test application0 z' k! }6 b8 B0 b6 h% U
  2. /*
    ) `  ]7 J+ R$ Z2 `  v! y
  3. * edma_test.c
    , \3 Z$ t, Y) ~- O
  4. ** _3 Y2 U6 |# s4 r7 m* T
  5. * brief  EDMA3 Test Application
    ( t6 }( L2 s3 i/ u' `- s* G, q& M
  6. *
    5 s  c* m2 Q8 N5 [
  7. *   This file contains EDMA3 Test code.
    4 k. \& x3 {) ?5 C. ?' U" Y3 @. R: J+ G
  8. */ N: l5 \2 e! g& S( e" ^4 B& N
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE  a. i+ n9 K* F$ s" n! b
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT1 y. T* H) p7 ?( |
  11. *         TO CHANGE.
    ) G- t- o% N$ f. t. P5 h
  12. *
    1 |# @# B- l8 k, q  y
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/8 ?+ a& B  I$ y; \  x
  14. *
    . m6 G) s$ X( L! s8 x8 }
  15. * This program is free software; you can redistribute it and/or
    * |2 k5 \0 n$ }5 C4 H$ T8 U1 V& M2 X* i
  16. * modify it under the terms of the GNU General Public License as7 G5 u1 \, H( Q
  17. * published by the Free Software Foundation version 2.
    ! D( J0 ^# [0 {3 `4 f, j; O- x
  18. *
    * g6 K8 e6 T& R5 w0 K$ r7 r
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any
    9 P9 C$ K! e5 V6 i" f
  20. * kind, whether express or implied; without even the implied warranty* k( u5 s: m( \- y
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the) ?% P8 X  j- n
  22. * GNU General Public License for more details.
    , Y- V& u/ h( D8 W
  23. */
    $ ~9 T$ J' m2 v2 h9 A& _' z
  24. # O/ g/ n5 B6 g: Y, m$ a
  25. #include <linux/module.h>5 L4 n* N; B1 }  f1 A
  26. #include <linux/init.h>+ ?  ]5 b  {4 N* _, ~6 F( T
  27. #include <linux/errno.h>
    ) ^) L2 n- z8 o9 {, D: `
  28. #include <linux/types.h>1 l  t( i& H' B) X
  29. #include <linux/interrupt.h>
    ; L8 k1 S4 H9 q+ E: u7 r
  30. #include <asm/io.h>; \3 M/ k. B* A3 k
  31. #include <linux/moduleparam.h>! [$ E: f% M& v3 j9 ?
  32. #include <linux/sysctl.h>, t9 [7 j; y0 E1 d* U# l4 j
  33. #include <linux/mm.h>5 v- f+ U' I. n7 |9 x- v
  34. #include <linux/dma-mapping.h>
    % B7 G1 g* @3 O

  35. 3 f& H  ~# F! [# A' V8 J
  36. #include <mach/memory.h>$ F$ h/ Y/ {8 z( d
  37. #include <mach/hardware.h>: S7 j0 a. @: g* S# X& B
  38. #include <mach/irqs.h>+ `; U# V' E0 ~. L
  39. #include <asm/hardware/edma.h>* O  w7 e2 x, a8 p5 s

  40. * F3 P: Z, F% u. b
  41. #undef EDMA3_DEBUG
    7 }, n3 y& D( c+ b7 Z# g* O4 H* C
  42. /*#define EDMA3_DEBUG*/
    * S7 ]) }( b& z( i; Z0 A/ o

  43. 3 Y4 A& k- l: I5 E! X4 y4 ?# C
  44. #ifdef EDMA3_DEBUG
    9 @3 X: t) S! V" ]+ [; V1 {
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)( t. G7 t2 g/ n: F$ r
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
    + O& D, W- P' U9 a" p% E: i
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)1 L: \0 ^1 S& d
  48. #else' {* P+ I  E( x' A2 N5 b
  49. #define DMA_PRINTK( x... )' [& s! ]1 A2 j  l
  50. #define DMA_FN_IN8 b3 ]! j+ X" O( h9 X' O8 Z
  51. #define DMA_FN_OUT% w( V/ x- t# Z7 u/ Q: }
  52. #endif* S* T! [6 J) Z2 U. D
  53. ! v( ]. H' S* H
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)
    ) k& A6 @# `) e9 c
  55. #define STATIC_SHIFT                3* k7 S, h0 i& v5 v6 a
  56. #define TCINTEN_SHIFT               20
    - M% e) N5 i/ P2 Z# {1 p; O9 h( v
  57. #define ITCINTEN_SHIFT              21
    " M8 s* ~% A" O( I2 B: v2 c# V6 D6 |
  58. #define TCCHEN_SHIFT                22; E4 L( J8 }+ o: |8 `- Q
  59. #define ITCCHEN_SHIFT               23( w3 l6 }6 U/ S, Z9 M7 R
  60. 0 f- ^4 D/ w3 t: h- \
  61. static volatile int irqraised1 = 0;
    9 S# {8 y3 I/ e! e
  62. static volatile int irqraised2 = 0;
    * b2 ?& E$ G$ Q
  63. 8 s. @" i6 Y5 u6 Q) E; h
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);2 Q5 _" @3 y& L8 \
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);/ g% `* |, [; }2 {
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    9 X' |$ T! K1 M% z
  67. 5 W7 X: o; h* U9 m
  68. dma_addr_t dmaphyssrc1 = 0;! }3 z) b5 b9 @: u+ E
  69. dma_addr_t dmaphyssrc2 = 0;
    4 j2 P1 J% X9 _+ {8 _
  70. dma_addr_t dmaphysdest1 = 0;
    9 @$ U: s- N" l; C. `3 n
  71. dma_addr_t dmaphysdest2 = 0;9 B2 N+ r+ C4 @, O) {0 R3 Q

  72. 4 `3 y1 p; ~8 I7 e" |8 f" f# w+ D
  73. char *dmabufsrc1 = NULL;
    * d5 Z4 J# J' c8 q" p
  74. char *dmabufsrc2 = NULL;
    ! k5 p* d% L. \" D' ]3 ?
  75. char *dmabufdest1 = NULL;3 c* Z, S! N2 D) Y$ ^. ^4 p" K! @: G# l
  76. char *dmabufdest2 = NULL;; H; m# c7 s. Y" T, G
  77. 4 N: K0 R9 p% r- P1 x0 |
  78. static int acnt = 512;
    8 b0 t* ^6 h" P! f
  79. static int bcnt = 8;$ U* X; E( ~: a: ?3 m
  80. static int ccnt = 8;
    6 f5 e) q, H3 `$ E; ?- p

  81. ( L9 C2 r, N. ~$ h; t
  82. module_param(acnt, int, S_IRUGO);9 }) P8 c; n1 ~( Z0 U" C3 t% W
  83. module_param(bcnt, int, S_IRUGO);  H! ?5 W. m( R2 W
  84. module_param(ccnt, int, S_IRUGO);
复制代码
( T% N' X3 p* T: w, B' \( ^( J
. E1 _0 @3 o: C- n
      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
; S. F1 m) {+ L1 k3 darm-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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
/ b* H! ]8 v# r" L; t     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。# A; u3 S# D8 ^
4 ~( Y/ _" o4 W' z$ N
/ T/ x+ Z9 O* y8 L/ V
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2026-2-16 16:32 , Processed in 0.039894 second(s), 25 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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