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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑   T. W3 ?! w' ?0 w0 w6 L
  1. [code]EDMA sample test application3 b' F) \& j) M- K- z3 u# V
  2. /*
    * R& D2 K) m1 R* |. l5 w) E
  3. * edma_test.c
    8 Z$ |; g. F7 m& \5 j
  4. *5 o; u3 b! t  e3 O2 {) K
  5. * brief  EDMA3 Test Application
    ! V  f4 U0 w# M, W9 p/ {2 w+ r
  6. *# J; g; S5 L# }% d6 X1 E7 S
  7. *   This file contains EDMA3 Test code.
    0 m3 k; O  N, q0 B  g' g. w
  8. *" c7 j. E4 K9 [( D1 ^+ w0 ?
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
    : m8 T$ u' M9 e+ d
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
    3 y; m# C! J2 N5 w" n& R# X
  11. *         TO CHANGE.2 F2 @6 \  s1 g6 C3 r
  12. *0 x2 j' \" J$ k& {, D# o' h
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/4 ~( w$ O% x0 q0 z/ b/ r/ K
  14. *% u' H2 Y8 |0 m+ _9 K- c1 r' ~
  15. * This program is free software; you can redistribute it and/or0 d& x2 N9 U, z' J
  16. * modify it under the terms of the GNU General Public License as
    4 L# q9 n2 {( s* A, q* {
  17. * published by the Free Software Foundation version 2.
    ! g, V5 S$ Y/ s8 S) ~
  18. *
    $ W/ B1 N' h2 e5 f0 {+ D' i
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any" o$ C$ `' k6 L+ k( {/ [+ R
  20. * kind, whether express or implied; without even the implied warranty
    3 ]1 \7 J! y' e& J# G, I
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the! [% S! A1 A, K: K9 v4 c$ N. l
  22. * GNU General Public License for more details.
    0 J( P. k, Z, O$ T+ i
  23. */' w4 p0 L: q4 k* E) D" W: z
  24.   f" h- ?/ Y& q. X5 a2 `
  25. #include <linux/module.h>
    ) O/ s$ F- |) a  g  c% a
  26. #include <linux/init.h>) p$ x( z, |( Q( P+ k7 V7 }
  27. #include <linux/errno.h>5 I5 F& [" F! J+ O; f1 S# {7 p
  28. #include <linux/types.h>( ]# k+ i2 P; ?9 a9 Y( ?
  29. #include <linux/interrupt.h>9 V" q% x/ s+ w
  30. #include <asm/io.h>, P: `0 q" I5 c. y
  31. #include <linux/moduleparam.h>1 T7 z4 Y8 X+ V) X) A6 g7 W
  32. #include <linux/sysctl.h>
    ' z, l, x+ x# D
  33. #include <linux/mm.h>
    8 M1 Z, K: _* u! b( t: n. y
  34. #include <linux/dma-mapping.h>3 k4 ?: \9 [2 [" ^! }* q; o" K/ g
  35. * V$ [2 K, O0 r
  36. #include <mach/memory.h>
    % u* ?! D0 d+ ]; a- M! a
  37. #include <mach/hardware.h># J6 ^5 M( i1 a2 ]
  38. #include <mach/irqs.h>8 U3 L9 a* |8 B; V- e
  39. #include <asm/hardware/edma.h>
    , j, f0 C$ ?7 r9 u

  40. , N5 N" e) L! ^4 j
  41. #undef EDMA3_DEBUG
    - ]4 X9 D6 n3 P$ E# d: f
  42. /*#define EDMA3_DEBUG*/
    " I5 o: v% n0 Y7 j3 D! w/ a: G
  43. ( G( M& [0 M4 y7 ?) b. H9 n8 R3 h; v
  44. #ifdef EDMA3_DEBUG2 v0 a& P) I) E' x3 U% q2 s# v# Q9 v
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
    ( J. ?$ |3 c- F# c4 Z
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
    + \$ Q( p1 l6 m. ]( J# o7 j
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)+ h* g  ]2 ~5 l$ m" y2 F: j% b
  48. #else- E  l" N. O1 |# E7 ?& e9 q
  49. #define DMA_PRINTK( x... )* S+ ^! c% H5 Z( b1 |$ _
  50. #define DMA_FN_IN7 c3 p3 R, i( i  s7 u
  51. #define DMA_FN_OUT0 G6 p8 B  h; T+ R2 I" Z  P' Y) S3 P
  52. #endif
    8 c- z# w9 O4 I
  53. & A% j% |4 E$ y
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)
    * Z: T+ B: y3 c6 K7 z, R
  55. #define STATIC_SHIFT                32 @: w9 B7 K; ^
  56. #define TCINTEN_SHIFT               204 @# |' K4 i( A! ~9 z
  57. #define ITCINTEN_SHIFT              218 b! k3 g, v7 Q1 |
  58. #define TCCHEN_SHIFT                22) ?: `9 P8 V3 E, o" G% v
  59. #define ITCCHEN_SHIFT               23
    + P, ^4 r% \7 S$ y& `+ z  s
  60. 8 i$ j4 v+ L$ |" M, |
  61. static volatile int irqraised1 = 0;; h4 F0 j1 }( |! {, n( U; x
  62. static volatile int irqraised2 = 0;$ B4 [; u: N- |2 k
  63. ; v, o. c4 G, G$ V6 w2 q
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    : I( o8 {4 c' d: g2 i
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    6 l/ M# B' s, M3 p1 p( _4 Y
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    / V+ o1 m4 I9 C: g0 B

  67. 5 R# u" V$ U1 {1 }. m* g
  68. dma_addr_t dmaphyssrc1 = 0;) U! b" b# d+ ?4 f9 X* r
  69. dma_addr_t dmaphyssrc2 = 0;
    ' N* x1 {: g) c, `
  70. dma_addr_t dmaphysdest1 = 0;
    ! s/ j* S, |; Q
  71. dma_addr_t dmaphysdest2 = 0;% Z! \8 @1 Q6 `+ [" _9 F  d  }
  72. 4 T2 a! h' {7 V# {
  73. char *dmabufsrc1 = NULL;
    6 \- Y) X3 E) z! C
  74. char *dmabufsrc2 = NULL;
    ' U1 N$ C8 r( _& A/ d( T
  75. char *dmabufdest1 = NULL;9 |# |8 Y$ j6 O' I" H
  76. char *dmabufdest2 = NULL;
    : h1 d7 o* L& D( b
  77. : Z, r+ _4 ^3 G& f, |
  78. static int acnt = 512;
    0 p- K0 D" I% y
  79. static int bcnt = 8;
    ) n8 F% f0 Q$ a; k( s! \
  80. static int ccnt = 8;
    ; D4 z4 C& N* P: k4 J8 ~: u3 F3 v6 D3 }

  81. # q# Y% N, |0 u8 T- G# h1 \# ]
  82. module_param(acnt, int, S_IRUGO);
    3 n; y& o) P- a6 D, f
  83. module_param(bcnt, int, S_IRUGO);
    " |7 ]! Y* a. `! L5 f
  84. module_param(ccnt, int, S_IRUGO);
复制代码

& r& E# W6 S& k8 k: o6 `: L7 q/ P$ P! [6 n1 E5 B7 I! N9 S7 |9 R7 _& y! ~
      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用9 H" T: [, |. D4 a3 N; \2 A
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。; d3 ?5 @7 Q! t3 s. m
     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。1 O9 G2 r, N& C/ d
+ U0 C4 h+ g7 l, r# Q4 Z

& o) Q. K  f3 n, e# @  \! V+ O+ @
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2026-5-27 16:59 , Processed in 0.042187 second(s), 26 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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