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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑
2 A5 Q4 q* d  ?
  1. [code]EDMA sample test application
    3 @  Q0 L9 X' U# w2 M
  2. /*2 X" ~2 f3 X( }2 X, B7 y; T
  3. * edma_test.c8 A9 [2 g$ e' j* h6 E
  4. *8 }, I1 R3 }* n
  5. * brief  EDMA3 Test Application
    , z5 U0 r0 K) `. |8 H
  6. *
    5 V. ]; `& j" y1 U7 m1 z+ Q$ x
  7. *   This file contains EDMA3 Test code.. S4 r9 W- B7 [8 m2 E2 {
  8. *5 Y7 r, J* w9 G* w8 }7 H0 a3 M& {
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
    . o5 n" K9 h( S6 l
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT& \- C: @5 \6 e8 i
  11. *         TO CHANGE.
    " E2 j/ f; ]4 [4 f+ R/ q2 {
  12. ** d- F; Q, L3 Q- N
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/0 h/ U1 w* L9 X/ \4 n
  14. *
    8 ~$ q* g8 T+ T; {
  15. * This program is free software; you can redistribute it and/or( ?) I3 S! ~( L' V/ v; L8 m2 }
  16. * modify it under the terms of the GNU General Public License as
      u2 u! Y3 z- i3 q: x) d3 S" L  O
  17. * published by the Free Software Foundation version 2.
    * J, G/ D; A" Z0 U) Y
  18. *
    - E4 J( l% E$ G/ y  Z
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any- K' X% w# S: U( |
  20. * kind, whether express or implied; without even the implied warranty& O* c4 s  S5 K( a5 b: R
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the% N, W7 e# k" `9 S3 Y, L/ `9 \" |
  22. * GNU General Public License for more details.5 R1 W' Z; }5 T6 F: e
  23. */
    ; ?% Z4 x$ z. N* }# Q2 H

  24. & I; u( @0 U" V( s! u% n
  25. #include <linux/module.h>
    $ E9 U" d, j8 Y+ t
  26. #include <linux/init.h>1 x6 k& H/ ]  Z
  27. #include <linux/errno.h>- C5 _. z) p7 u8 H# A7 L
  28. #include <linux/types.h>: H1 n& U! V9 x# g, H+ u. j" K, y
  29. #include <linux/interrupt.h>
    ; o/ L1 W$ r, S5 G2 |# {- X3 U6 X+ x
  30. #include <asm/io.h>/ m( f  O6 \7 o; c+ z
  31. #include <linux/moduleparam.h>; T* |$ k+ g9 O3 V% a3 K
  32. #include <linux/sysctl.h>
    0 `& r9 A' o4 w! g# K- i: l4 W
  33. #include <linux/mm.h>; w. b2 d) B& Q: i! g: [( A) f% d
  34. #include <linux/dma-mapping.h>& _- t# |6 ]. L8 \9 P/ q
  35. 4 I1 ^- j$ Q/ K+ }% G" v: E
  36. #include <mach/memory.h>, z7 k4 d5 ?& D+ q$ _1 E* v
  37. #include <mach/hardware.h>4 b& z+ }. _* X; J* T- l
  38. #include <mach/irqs.h>% m1 d$ |* A% k1 Q2 q# D1 j0 D( i" U
  39. #include <asm/hardware/edma.h>
    5 k: r; W* z% \$ h- Z& L* D" B+ Q/ T

  40. ) \3 f- Y7 e, D; i- W5 |
  41. #undef EDMA3_DEBUG
    7 `: u0 \) B2 [/ \- E  [
  42. /*#define EDMA3_DEBUG*/
    ( m# J! U' t; w, f5 z# Z
  43. . Y) f$ s( @2 u2 j
  44. #ifdef EDMA3_DEBUG
      @7 b: L3 @5 f4 m6 K* w$ ~
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)7 V2 t/ M7 ?0 z- `8 d4 x/ T- ?% p1 a
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)1 @( s3 t4 S2 v, w3 A6 ?% @9 L
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)1 H9 N# A$ {+ o
  48. #else+ w% w" y2 k# y# a. J
  49. #define DMA_PRINTK( x... )! J7 |: J- z# f# l
  50. #define DMA_FN_IN, W# K4 o! V6 s% N6 Y
  51. #define DMA_FN_OUT
    & @0 |$ N/ `9 y, D$ w
  52. #endif; Y; h5 B" s8 z' f  j2 V. C5 ?: e

  53. , b7 c6 B1 W1 ?7 S* q! k
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)
    ! L+ a: V4 Y3 v; v
  55. #define STATIC_SHIFT                3* f/ _7 c' F& d2 P! o: ?; {
  56. #define TCINTEN_SHIFT               204 u" w  a! s1 Q: E7 C8 ]
  57. #define ITCINTEN_SHIFT              21
    + o- z8 R/ T' d4 z
  58. #define TCCHEN_SHIFT                22
    0 V$ e* b$ n, h2 I2 m1 q8 w
  59. #define ITCCHEN_SHIFT               23
    ' v4 a. E! y- x8 l, d

  60. 8 [+ e/ q0 w) h: i8 |/ W
  61. static volatile int irqraised1 = 0;
    1 w/ a' R; T9 ~4 H) _4 ?
  62. static volatile int irqraised2 = 0;
    . Z0 d; Q8 d' v/ R6 C4 n
  63. 4 |$ w! g' E4 F; o4 y2 X
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);9 N( K9 c! i4 Q! z
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    3 Z) |7 G/ H6 C" C8 K
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);: M$ q6 E+ u, w5 v- S& V6 V3 G7 w

  67. / M/ U+ ?( K/ K
  68. dma_addr_t dmaphyssrc1 = 0;& T, L. U7 w$ |' D; c$ ^
  69. dma_addr_t dmaphyssrc2 = 0;  W+ g9 k! J# h
  70. dma_addr_t dmaphysdest1 = 0;- b/ C& n/ T( V1 Z% V4 l9 a
  71. dma_addr_t dmaphysdest2 = 0;/ G! |% a# V0 q+ n/ _! t9 Y

  72. 5 r! p6 b3 }5 j. b  ^- p! b
  73. char *dmabufsrc1 = NULL;
    : j9 u4 c. A0 w( b9 ?$ R
  74. char *dmabufsrc2 = NULL;
    1 n1 I' w8 A. ?0 E% D  S
  75. char *dmabufdest1 = NULL;& h: D2 t' Y' f$ N! b& C
  76. char *dmabufdest2 = NULL;
    $ O5 ?5 ^( O. H  s  f5 e

  77. ) t- n, O  Q0 |" G
  78. static int acnt = 512;2 G+ j& n3 ?* b* }7 H  S% d; G
  79. static int bcnt = 8;9 n0 u( O2 J7 m6 X
  80. static int ccnt = 8;
      i4 D7 A: l8 H& K* W$ M# K
  81. % O+ d* ^; U- ]5 |
  82. module_param(acnt, int, S_IRUGO);  T2 H3 E2 X0 g
  83. module_param(bcnt, int, S_IRUGO);
    + N9 B6 o' B& a' _/ I) {
  84. module_param(ccnt, int, S_IRUGO);
复制代码
9 g& C. ^1 h! e" [& t9 \3 _
7 @7 b* D! Z, B0 p. H' C' |; |* H
      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
3 D% U3 q8 e  Yarm-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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。) e4 }9 t+ G" }4 J5 \
     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。% C4 o% ^! M7 v0 q$ X0 S

& k# O. w% e* p9 s& |# `: b0 w# P: B8 V
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

GMT+8, 2025-4-30 09:02 , Processed in 0.036880 second(s), 24 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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