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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑
' e3 e* T" z6 D9 [
  1. [code]EDMA sample test application" K5 h( D0 j" H
  2. /*! }4 s7 X& i6 V
  3. * edma_test.c
    - c  c0 Q+ ]7 Z4 q& M! H
  4. *' U0 k; d7 q0 k
  5. * brief  EDMA3 Test Application
    8 w! s( u8 k8 }% k3 ]9 |' _# e! I
  6. *- v7 I$ X* ^$ [" A& n% Y
  7. *   This file contains EDMA3 Test code.
    9 q+ q+ E2 g9 z8 L) @! T2 L0 f
  8. *, D8 X5 m4 Y7 w4 w
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE7 {' |1 u3 ^, C( Q/ C; d
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT4 A4 a, _1 [& `3 Y+ G
  11. *         TO CHANGE.
    0 H0 |2 ]1 e% g* }' c& \
  12. *
    ! v9 [5 K2 G3 h3 z$ K( U; a
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
    6 O  L; t! u' z
  14. *+ D. n# {! Z; {2 v* C
  15. * This program is free software; you can redistribute it and/or
    1 O2 |! \% ^" k
  16. * modify it under the terms of the GNU General Public License as
    ( ?, L$ u9 ?7 @! z' y
  17. * published by the Free Software Foundation version 2." Y( }5 v& v7 m: ?: o0 d
  18. *$ K4 O# g7 g+ w- S3 y
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any
    ) n) C, `4 A, Q' M$ r) p
  20. * kind, whether express or implied; without even the implied warranty
    ) K- m' D# C+ \3 A! r
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    7 R7 p7 l* P" m! y/ z* m
  22. * GNU General Public License for more details.5 b8 K" b+ _0 q) ]7 y
  23. */* |! K1 z9 \. O1 F: Y9 w9 D! N- W
  24. + p7 N1 n' V6 D1 y+ e
  25. #include <linux/module.h>
    & Z5 J* ~' ?4 f' z+ o9 J+ R+ M
  26. #include <linux/init.h>
    + d  U, Q4 P4 Z" P
  27. #include <linux/errno.h>5 E* r: U. W) W  U; C  o% y. q
  28. #include <linux/types.h>- o  L  H$ I  V  D% l7 \! n1 \
  29. #include <linux/interrupt.h>
    # n4 n+ r' U+ w( J) p% L& I" F2 }% b
  30. #include <asm/io.h>
    . n$ ~& L! i2 T8 G: p
  31. #include <linux/moduleparam.h>
    + N% q+ H- f2 V! ?3 \+ b( w
  32. #include <linux/sysctl.h>
    5 w% C* I' |2 B- g( m# l
  33. #include <linux/mm.h>
    9 Z* B  t0 \- x1 t
  34. #include <linux/dma-mapping.h>3 b8 v* u& B  Y* r; F4 @  Z

  35. 0 O2 \( U+ U2 c
  36. #include <mach/memory.h>
    " r; `: l4 Q# U
  37. #include <mach/hardware.h>! h5 p# q* d; N5 c: @$ d
  38. #include <mach/irqs.h>
    0 _# [. ~# x1 Q' C% W
  39. #include <asm/hardware/edma.h>& Z" I/ z/ R& u/ K; ?

  40. ! R7 R  ~( n0 Z) P3 w/ R
  41. #undef EDMA3_DEBUG$ i* J" q4 \9 Z& P# n
  42. /*#define EDMA3_DEBUG*/% A, T9 i! ^' r) N# \8 }

  43. ( S4 u$ G+ H. g& r5 }4 i8 U6 }
  44. #ifdef EDMA3_DEBUG- _  X, t1 ]4 }& M* O; B% Z  D
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
    5 I, c# m8 u# n8 q6 _, G
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)+ {0 P! v" ~7 o
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)+ [/ o. w, `3 i8 y" Y
  48. #else
    0 H/ U  k; \/ \1 a
  49. #define DMA_PRINTK( x... )
    2 N  K7 \" h" C5 C; T3 g  _
  50. #define DMA_FN_IN' @/ u/ }0 U+ N
  51. #define DMA_FN_OUT
    ' `$ q2 f: G; j) ?
  52. #endif
    9 P3 l! h- j7 n3 s# r" y
  53. , e" @+ O6 U2 p* v
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768); `# S  z5 C& ^4 l) S1 E& z1 n
  55. #define STATIC_SHIFT                3
    0 n7 o: x$ h# X2 J4 |* Q* ?+ Q/ w
  56. #define TCINTEN_SHIFT               20
    # }( H9 O/ a; p% i! L, [$ E/ c
  57. #define ITCINTEN_SHIFT              21- F9 P5 k) h7 Y4 W+ p
  58. #define TCCHEN_SHIFT                22# i! X) N0 i$ J0 x) J( v
  59. #define ITCCHEN_SHIFT               23
    6 r6 S2 G8 p2 _- I- ^7 `5 q" C: S
  60.   K3 r9 Y. m/ D+ d, R
  61. static volatile int irqraised1 = 0;
    % u7 l: f) I; ]# D( I" j/ J
  62. static volatile int irqraised2 = 0;
    0 c& Q: H( l! o
  63. ' H  J* ?( E6 }8 T1 a, V: J
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    " y+ ]$ V- s+ E, F
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    * ^+ k, r# ^4 i, N
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);3 n: s3 e/ V2 ^. m! s
  67. 0 e0 m3 G0 }! M
  68. dma_addr_t dmaphyssrc1 = 0;# h" V! X" P) i! _* v- |9 Q$ W: e
  69. dma_addr_t dmaphyssrc2 = 0;# v. y, A1 Y" c7 J0 v
  70. dma_addr_t dmaphysdest1 = 0;
    ) i& p: k1 _. x5 s5 j2 M0 t
  71. dma_addr_t dmaphysdest2 = 0;
    ; S( I3 \5 X2 _9 T# M* ^, G
  72. 3 {4 [0 g& }8 g! G
  73. char *dmabufsrc1 = NULL;
    ' i" [# D. B: }& R% v3 C
  74. char *dmabufsrc2 = NULL;( Z1 {1 |( g) h) W, Q. @$ ^6 ^" o
  75. char *dmabufdest1 = NULL;! L( w; k7 k0 G; x% x- ]
  76. char *dmabufdest2 = NULL;$ E2 @/ i6 V1 J% O$ D

  77. ! \3 `  t% F- S: ?
  78. static int acnt = 512;
    9 D6 O4 P: G5 e% N3 l
  79. static int bcnt = 8;9 `/ _3 P' T! ^6 D& g; R% X& G. e# l7 U
  80. static int ccnt = 8;
    + L3 z4 x( l, }3 G9 L2 w

  81. 5 }' U9 ~+ r4 k, w) t) r: g
  82. module_param(acnt, int, S_IRUGO);( I9 S5 H3 J1 Z$ }7 Q: ]' q
  83. module_param(bcnt, int, S_IRUGO);/ W) q( t7 b, g; [7 E
  84. module_param(ccnt, int, S_IRUGO);
复制代码
3 x% ^' b: R0 t& ^9 T
% d' P! `/ @% r
      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用4 T% d# \2 y; D% D4 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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
: ~4 M- ]3 j$ S: O3 t* O& M" c; g5 S     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。# {2 d; }" c) p5 f' l2 Y

6 Y' j$ F  F% M  C% M' I
1 B, I, ~+ T! B0 s& I9 p
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2026-2-4 06:48 , Processed in 0.040432 second(s), 26 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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