OMAPL138如何在Linux下使用EDMA3驱动 - OMAP-L138 - 嵌入式开发者社区 - 51ele.net
设为首页收藏本站

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑
1 v% z4 {( P; j& e, {$ F' w9 p
  1. [code]EDMA sample test application
    . w+ L: v* }& r' ?9 i6 b! I3 u- e& v
  2. /*
    : }9 H7 f/ M4 q  w
  3. * edma_test.c
    0 A0 j5 C/ j- c# @
  4. *
    - h8 y4 M& H7 _% W) _
  5. * brief  EDMA3 Test Application$ x5 e( ]( b' P: p, L+ s
  6. *
    ( y0 v' x. V& `1 f  @  ?7 y
  7. *   This file contains EDMA3 Test code., U. y! q6 j% h- e. m$ f# I
  8. ** O2 E0 }3 X) Y1 O$ `
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE0 {; ~  T7 E0 J" F# ]) C
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
    ; H2 C2 g- f; \
  11. *         TO CHANGE., |. x2 d, M. s
  12. *
    0 @* \6 O& G- {2 I$ e* v# J
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
    ' y" ]  z% R2 [) ?- |6 b
  14. *
    8 _8 m7 ]7 _  d# W( c
  15. * This program is free software; you can redistribute it and/or
    & o/ u: x: r: y: d+ K
  16. * modify it under the terms of the GNU General Public License as( D+ G; r7 n& h* X0 ^
  17. * published by the Free Software Foundation version 2." ?9 z, A  Q3 g' \7 F% d
  18. *
    , S5 h) u4 h, v2 u- T' `* ^
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any$ \6 J  N! B0 H$ W# {6 y
  20. * kind, whether express or implied; without even the implied warranty. _$ L: Y; P5 ?- r6 j
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    + f. z7 f7 S* M1 Y- f: Q  X
  22. * GNU General Public License for more details.
    9 n* k. O1 V& [4 y" n
  23. */, U# w8 w# \4 J2 Z

  24. 1 N+ Q0 k" ~! C, x+ z; e
  25. #include <linux/module.h>
    ' G6 \9 H+ Q7 X! C# ?8 d
  26. #include <linux/init.h>+ g) E* R6 ?, M, M) m& j
  27. #include <linux/errno.h>
    # G6 Z8 a+ a& y! t  |7 o
  28. #include <linux/types.h>
    ! m0 v9 M5 n9 ]& j/ J1 N6 ?! _
  29. #include <linux/interrupt.h>9 }! l! ^8 l. D, N/ |
  30. #include <asm/io.h>* K0 n! J' \) f0 B: l1 J1 L0 j
  31. #include <linux/moduleparam.h>8 m* T6 c7 n9 w
  32. #include <linux/sysctl.h>4 o: D2 X) {8 v& t% N
  33. #include <linux/mm.h>7 }5 |  A$ k/ ?2 x) u
  34. #include <linux/dma-mapping.h>7 g) h) u! d* T) @- e7 R* O

  35. + ?" ~5 D5 R- `4 m
  36. #include <mach/memory.h>
    7 \% Q* b& m/ d8 X- ^! H
  37. #include <mach/hardware.h>
    ) A. r( L0 w9 O8 r8 R+ R
  38. #include <mach/irqs.h>
    7 Q& I) T( h4 Y5 P! L. R( k
  39. #include <asm/hardware/edma.h># |7 M3 k. F  f! {1 k

  40. ! n) f# Y6 W; o, I' Y3 ?6 [, `
  41. #undef EDMA3_DEBUG
    / w2 }6 a' I3 [- A
  42. /*#define EDMA3_DEBUG*/
    , ?& d1 S7 M% F8 u( Q; I  P5 |

  43. 8 j: e) k# Z" C; n* q* ^
  44. #ifdef EDMA3_DEBUG, r4 f) l' r) A
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)* T& a$ e# r4 D% t' D  f1 z
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)/ C% J3 s2 t" p, F; }/ }5 r
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)* \) S& F6 P9 T5 T' c. Q7 _
  48. #else( V$ j- J4 @! c: P: w
  49. #define DMA_PRINTK( x... )
    ! e, O- n5 Y7 l  K6 k
  50. #define DMA_FN_IN
    2 G! L2 _5 G& Z
  51. #define DMA_FN_OUT+ v4 }0 m7 z+ H* P2 P  R
  52. #endif
    # \( n& p" m' X6 k1 R

  53. $ {9 M, l$ v7 c# s
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)
    6 N$ n; U  L8 |
  55. #define STATIC_SHIFT                34 [& m1 C" X8 L  Q- A& F
  56. #define TCINTEN_SHIFT               20; J* g0 q& d/ M' v: D; C
  57. #define ITCINTEN_SHIFT              21) I% A3 Q# B8 R# `3 F0 [
  58. #define TCCHEN_SHIFT                22" j( l+ Y* z) f4 c6 {
  59. #define ITCCHEN_SHIFT               23
      B3 C$ g2 }% F4 S

  60.   Z3 v3 v3 ?/ D5 u  _7 p
  61. static volatile int irqraised1 = 0;
    9 o! S! k5 w* e* E% \! ]9 x- [% F
  62. static volatile int irqraised2 = 0;
    5 B) e! t: j8 E- Q7 M5 w0 @

  63. 8 n7 _; @. I0 \$ f1 x
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);! G0 e/ x5 W8 Y/ _( J
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);- k" U4 q% `% x( }$ t  a0 B1 E; {
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    5 i, ~- K2 t% i+ Q9 \

  67. ' T! ?; Q+ \; o$ z
  68. dma_addr_t dmaphyssrc1 = 0;- K5 D* V* o9 A9 n
  69. dma_addr_t dmaphyssrc2 = 0;
    # v/ S6 t1 l1 e3 }. {
  70. dma_addr_t dmaphysdest1 = 0;
    2 r  N9 c% H$ ?$ ~/ N7 K% [
  71. dma_addr_t dmaphysdest2 = 0;
    ( w% _1 B1 \; f0 |8 D5 k% E! ~

  72. 6 k4 p1 a! ^& `, b8 l4 c7 {; S
  73. char *dmabufsrc1 = NULL;! ]9 ?  f2 b  I! `- D) _
  74. char *dmabufsrc2 = NULL;/ @4 E: O) z2 H6 Y2 O6 t; z
  75. char *dmabufdest1 = NULL;, D9 W, b' G: D: a( r# g* A2 t& x& c4 e
  76. char *dmabufdest2 = NULL;1 W8 G) `2 p* k, f& j& q, U# @% ~

  77. 0 E4 V; l, ]5 c1 s4 W3 p, L
  78. static int acnt = 512;% Z/ `' T  m! p0 S! T5 Y  W
  79. static int bcnt = 8;
    9 |9 i5 W' v' r* ^8 ^1 z
  80. static int ccnt = 8;2 O' I' l1 Z( U5 p% Y+ p/ X
  81. " o, N# }% E, M" [
  82. module_param(acnt, int, S_IRUGO);4 ?9 M' g& G& H% a6 w
  83. module_param(bcnt, int, S_IRUGO);! |) j& H3 |; |1 B
  84. module_param(ccnt, int, S_IRUGO);
复制代码

; Q7 ?. n: i3 T$ N- I4 p2 D8 n) E, R& K: w, I
      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
7 N1 X1 ]" r) o6 }# g# G9 garm-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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
, x* b+ o; D0 i7 R0 b; x. S     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
- A) e- U( n  k1 k2 t1 E
# q  U1 J7 g& [; L" C4 `" J4 o. i) Q3 N- j! c& F  {% y( ?
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

GMT+8, 2025-11-28 19:22 , Processed in 0.038108 second(s), 24 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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