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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑
* S- Y! J6 x9 M/ y2 h# V
  1. [code]EDMA sample test application/ I: |* [+ ]0 g+ t4 B. f
  2. /*# w: g, J; \7 {
  3. * edma_test.c
    $ r( n# O: k7 Y1 \% F
  4. *
    / c6 d4 x8 C, P
  5. * brief  EDMA3 Test Application
    7 A# W# {0 P- F" ?, h
  6. *  W+ O% \7 u6 V5 v! b5 t" ^
  7. *   This file contains EDMA3 Test code.+ i. U5 f6 Q6 R2 e' i; X6 q6 `& c
  8. *0 Q( Q  y7 E+ Z! s% `3 B' E. c6 u
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE8 ?) b  X4 p3 W" m- g8 `5 W2 j
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT  b) ~* `. e6 `! D, a( |
  11. *         TO CHANGE.
    . p( L) N7 W- w3 L( A/ z4 c
  12. *
    1 ?  k3 d  m4 H, q
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/6 d4 Z# H/ k4 h) O$ L" R+ e
  14. *
    - l/ M) F+ M! a4 b& D# W  ~+ Q
  15. * This program is free software; you can redistribute it and/or0 ~! Y9 F. M; V' V- r; w5 K9 [; r
  16. * modify it under the terms of the GNU General Public License as& b2 j5 V0 X( {4 C
  17. * published by the Free Software Foundation version 2.) q+ k) E( R/ `2 M8 q9 l, \
  18. *
    6 H1 y# X* X3 q2 g6 p
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any
    # s! D2 L3 X+ d! Y9 K
  20. * kind, whether express or implied; without even the implied warranty
    ! q  [! i& L" h. a) a" ~
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    : }+ \2 P; v6 G. {" O  X7 Q
  22. * GNU General Public License for more details.9 M, k: v  n5 D' Q& p
  23. */, K4 p3 t/ K0 `0 \
  24. - c6 E% j3 J' G  Z8 ~" j  P' T
  25. #include <linux/module.h>
    9 v$ |4 `# _$ }1 L
  26. #include <linux/init.h>
    & h1 ]! y5 J/ o% Q8 R* d% J7 k
  27. #include <linux/errno.h># _# U/ f6 t. q( a
  28. #include <linux/types.h>
    . t5 o" q. O4 D+ H
  29. #include <linux/interrupt.h>
    1 i5 H+ a. N+ ?  r$ W: `/ S
  30. #include <asm/io.h>
    0 _, H. K  r8 W$ {# E  _  u' Q
  31. #include <linux/moduleparam.h>$ B. G4 [; m) X" {; w
  32. #include <linux/sysctl.h>9 o/ t! a3 c, n4 k
  33. #include <linux/mm.h>
    3 d1 U9 D3 `, S( w  n# s! g  G$ e
  34. #include <linux/dma-mapping.h>
    # h0 s, e. j$ w/ O8 @  r$ C

  35. & ?2 Q* r# E: [# h9 z
  36. #include <mach/memory.h>/ @' J8 {; ]4 g/ r- X
  37. #include <mach/hardware.h>* ?) N* k# v9 ]8 B3 \- {+ n
  38. #include <mach/irqs.h>
    ) }0 G% p/ N& [* U0 r7 Y6 O6 n
  39. #include <asm/hardware/edma.h>2 [- y8 b9 n. p# j& i" J% s

  40. ' ?+ m2 ?% U2 s! g6 [
  41. #undef EDMA3_DEBUG* w% H$ |, Y8 v) a7 e. Z4 n
  42. /*#define EDMA3_DEBUG*/
    ( R' x/ ~% N( b/ @1 P/ L& [
  43. - Z) T$ v4 t! m
  44. #ifdef EDMA3_DEBUG
    * y8 G6 t8 K3 H. n( _5 o
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)& W0 w: V& ]- U* J& f
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
    " D# v# |' c2 I! N! v
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)/ E0 D. J. m% ^( }
  48. #else
    ' n' I$ `+ D- ]6 i& ?( C
  49. #define DMA_PRINTK( x... )% ]6 B+ k8 T- ?/ @+ T8 Q! Q- j
  50. #define DMA_FN_IN
    - E# Q* O8 e) y6 x9 J6 [3 t
  51. #define DMA_FN_OUT
    ' M2 d% _" W% L, I
  52. #endif
    3 s7 Q6 f5 U+ w$ T# t' E% N
  53. ( W# ^& j6 K- W6 G
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)
    * g3 G7 F- ~: D; d# v! Y) U
  55. #define STATIC_SHIFT                3
    9 u) r* l" x3 d2 x9 |; l+ k  \
  56. #define TCINTEN_SHIFT               20- T# j0 ?" ^2 s: h. U
  57. #define ITCINTEN_SHIFT              21
    5 f" _  N0 Y& r7 [4 O1 A
  58. #define TCCHEN_SHIFT                22
    : v3 T4 I% i" t  C1 I' O( S
  59. #define ITCCHEN_SHIFT               23. f) |  j; v8 P! X$ ~$ Y8 H; j
  60. 7 P* }2 B( ?* G2 O
  61. static volatile int irqraised1 = 0;2 L$ k& m6 [' ?7 U  D$ V6 b
  62. static volatile int irqraised2 = 0;4 F6 S" O9 U% W9 n$ a4 A
  63. 8 z$ S" K/ {  Y3 L/ t; a. e
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    5 o- Q( R9 k7 W: x  o
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);; n% W! i# p. z% O6 g8 b+ [  e
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
      b4 q$ @9 ?! D8 I8 S
  67. * A# j9 [' c  B( M
  68. dma_addr_t dmaphyssrc1 = 0;
    5 _' _. I! z# A  K
  69. dma_addr_t dmaphyssrc2 = 0;" n! r0 P. N8 o% b+ D& _3 N
  70. dma_addr_t dmaphysdest1 = 0;
    & }$ |2 {, n! t( L( P
  71. dma_addr_t dmaphysdest2 = 0;  m2 x9 c8 X4 {/ T- {/ t

  72. 7 g/ {4 N2 N2 s7 R
  73. char *dmabufsrc1 = NULL;2 K! j. a5 m' d) u, _" L, Q: U' v& ?
  74. char *dmabufsrc2 = NULL;" i0 W- D8 C% Q: v" ~$ R  t
  75. char *dmabufdest1 = NULL;
    # x( V, F5 b2 B( x
  76. char *dmabufdest2 = NULL;
    1 f% g: Q0 F1 g0 H
  77. # W  t7 c, N4 n, P- e6 q
  78. static int acnt = 512;5 f4 B% W9 Y8 v
  79. static int bcnt = 8;3 p6 b. ^" w  L$ @( |) `. L3 q
  80. static int ccnt = 8;1 m" V) n, c! R, A3 f  W
  81. 8 l1 J0 d) i) h6 b' R8 w( s+ L
  82. module_param(acnt, int, S_IRUGO);
    $ ~0 L# L$ Q" Q$ U& w
  83. module_param(bcnt, int, S_IRUGO);" z  k# j6 Q3 Z/ J5 A' o9 I
  84. module_param(ccnt, int, S_IRUGO);
复制代码

( h' r: r4 @" |( S. f# \, {0 h1 M+ F3 {" s+ v5 l
      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
: D) j, U" u1 Y3 X+ ]" karm-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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
) o2 m7 |) p5 m- N9 p     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
" F3 J# Q, @, q  j7 A5 E8 {* t+ U/ m) y' M( O' k4 f
! V, Q0 x: e, Q5 Q7 C+ @) H
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2026-1-28 23:37 , Processed in 0.036625 second(s), 25 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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