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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑 ' F9 o/ T$ ~! l! I* x# n& w: n8 I
  1. [code]EDMA sample test application
    . l) S, a. b3 V3 k4 V
  2. /*/ W: `9 I0 Y# B( ]! }" m1 [; i
  3. * edma_test.c) `* v7 G/ z6 O: I2 v
  4. *# n! f% ?$ h4 V4 J; i' @
  5. * brief  EDMA3 Test Application1 M! A. O2 S  Q% \9 P* N
  6. *
    % Q5 |& ~+ J5 f! L4 b7 _. ]
  7. *   This file contains EDMA3 Test code.$ ]" e. w9 [$ y3 D- `; r
  8. *, Y# e4 K# U2 d9 o1 S0 `
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE3 G3 A, x: e2 [( X3 O
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
    9 E( y; U+ n7 l" E& z
  11. *         TO CHANGE.$ `: ]4 i* l7 j
  12. *
    0 o7 G+ {8 i7 K; d. S9 Z+ @$ m, M0 o
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
    . Y  _+ D8 `7 h" L: G
  14. *8 Q% ^( B7 o% g
  15. * This program is free software; you can redistribute it and/or
    . {( f  e( d+ P
  16. * modify it under the terms of the GNU General Public License as! V. `' F- a; h" l
  17. * published by the Free Software Foundation version 2." u3 D( `2 W4 t" `- k* {
  18. *
    3 E1 w2 v0 S0 r
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any& E! D: q* \$ t) z
  20. * kind, whether express or implied; without even the implied warranty- }, ^& r3 x# {# M
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    # o/ c/ C* D! Y$ ~' e% [4 z3 {
  22. * GNU General Public License for more details.) R: Y/ g" U& h# ?7 S, O
  23. */
    1 B% [; Y+ F$ S0 V$ _
  24. 4 @6 H; B- b8 _% [; s, l
  25. #include <linux/module.h>
    4 t3 D# l! O5 Q
  26. #include <linux/init.h>
    + O: m! |' ~' s; m  s
  27. #include <linux/errno.h>
      t: [! ?4 m; G( U! `4 c
  28. #include <linux/types.h>
    / |; r% f- \! u. h) W
  29. #include <linux/interrupt.h>5 V# Z( c( I* K: a  Q! @( e
  30. #include <asm/io.h>$ J/ d& v, [5 c7 ^7 \' ~
  31. #include <linux/moduleparam.h>6 c* I- X: Q9 K# r3 H. [# c& ]3 h
  32. #include <linux/sysctl.h>
    # ~0 @" H7 t8 ]7 E1 }
  33. #include <linux/mm.h>/ y4 ], T" U" }; Y5 K# `
  34. #include <linux/dma-mapping.h>' s' Y" N" A6 c

  35. % d, ?# G. q- c9 I
  36. #include <mach/memory.h>" a) Z$ G# e2 f3 `6 ^, O0 M: Y
  37. #include <mach/hardware.h>3 V. v% ?0 f9 P; {7 N, E3 B4 U
  38. #include <mach/irqs.h>
    4 U; T( I4 b/ @4 C0 {( h
  39. #include <asm/hardware/edma.h>/ w; `/ D2 A( H" @+ W  {7 E
  40. 5 W8 q4 d  C0 G- H
  41. #undef EDMA3_DEBUG, j( ~7 j  E" v( g6 v& a1 Q$ |
  42. /*#define EDMA3_DEBUG*/
    ( ?  e( p: I# M+ M* q4 U6 y% b
  43. ' `3 {0 P$ t' G5 f8 ^0 G
  44. #ifdef EDMA3_DEBUG  s% Z# |5 H# i
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)0 E, C! \* O( K
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
    - P9 N3 _0 \2 C, s" b1 m
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
    * q# S1 B+ ^# W* T5 }& `
  48. #else
    & x% M9 U& J1 d8 t9 j$ P8 H
  49. #define DMA_PRINTK( x... )
    9 Q/ `: y, _, o8 S! p
  50. #define DMA_FN_IN  m+ h0 V( a; K
  51. #define DMA_FN_OUT' L5 q0 @5 x1 \( q4 r# n% K
  52. #endif; I  n! ]6 p, V9 W: L( y
  53. ) N$ ?; ]' [* v. H/ x
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)
    ) a  _6 u2 f+ @3 Q( }
  55. #define STATIC_SHIFT                3
    7 U( K# t* u/ J, D+ m
  56. #define TCINTEN_SHIFT               20
    0 b1 e; m5 k3 J9 B5 ^; B
  57. #define ITCINTEN_SHIFT              21
    # A9 w/ Y! K: x3 o0 w
  58. #define TCCHEN_SHIFT                220 Z) z1 h/ d: \% c2 g
  59. #define ITCCHEN_SHIFT               23
    0 H  O: J6 Y5 [$ J: o; ]) w
  60. 3 E( _, u. Q$ `2 S& n0 Y+ y
  61. static volatile int irqraised1 = 0;/ z0 ^: ~5 `* I$ |  u! p
  62. static volatile int irqraised2 = 0;
      d. v  F" P$ X* o0 l! q4 a
  63. 7 o" ^& u$ F5 k$ p) j" z- W8 F
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    9 z. N( Q7 \$ H$ N
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    2 q. l, h) D) q4 U& t0 w
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    8 `3 m* ]. P; ]" h/ W4 X& b9 x
  67. . j% r) o2 @* w; H  B  e
  68. dma_addr_t dmaphyssrc1 = 0;/ y" }& V% i8 [4 }
  69. dma_addr_t dmaphyssrc2 = 0;
    % b! f% E; z4 a4 p
  70. dma_addr_t dmaphysdest1 = 0;# }3 W0 K& B% r: |1 u% }- `
  71. dma_addr_t dmaphysdest2 = 0;* l. n9 {+ p1 q! i

  72. " ]/ e8 x' B8 N" m/ w
  73. char *dmabufsrc1 = NULL;+ e9 ?# k# |7 ^8 f$ h1 c
  74. char *dmabufsrc2 = NULL;; O- J. M7 ^; [9 }3 P
  75. char *dmabufdest1 = NULL;5 N3 c: I) l$ P/ e, q
  76. char *dmabufdest2 = NULL;/ d  q! I% l9 _! T, h

  77. 1 |: m/ {$ ^! A! T
  78. static int acnt = 512;
    $ f- S! V/ O+ q$ I! k2 a& ?
  79. static int bcnt = 8;" m- i8 V3 H; x5 Z8 c, W9 \
  80. static int ccnt = 8;; i% g$ _% y& l5 Z5 O
  81. 9 X1 S) n5 Q) r6 \3 m1 N7 f
  82. module_param(acnt, int, S_IRUGO);
    " Z+ O1 D3 i5 y2 Y
  83. module_param(bcnt, int, S_IRUGO);& v( |. k4 O9 ]3 V" e% b$ {5 g
  84. module_param(ccnt, int, S_IRUGO);
复制代码

1 f% m/ d; K: [& K* G
, d, a+ D8 S+ w) u      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
2 {6 s8 N: m; u  t  k% U4 [! iarm-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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。3 w6 F; \: h$ D+ Q, k  q' z4 b
     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
2 e3 U3 ~8 h) y4 a! N2 J) ^9 W/ w/ J: L- Q

4 A2 s) |5 Z9 C7 _3 y
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

GMT+8, 2025-11-27 20:03 , Processed in 0.041558 second(s), 27 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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