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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑 / }: P  Z6 C( U. k) Z7 I
  1. [code]EDMA sample test application
    3 @* v  d; j% G: o% m# E5 t! e4 n
  2. /*
    0 \3 i9 Z3 F' q) `, }
  3. * edma_test.c7 Y6 p: F5 q# t" w
  4. *) d! E0 U- o, J) q- R
  5. * brief  EDMA3 Test Application9 u+ P" y5 e0 g; L: }" S+ u
  6. *
    + D1 u* v5 \$ |" i9 q
  7. *   This file contains EDMA3 Test code.; l3 A1 _8 ~5 \3 e2 g; K
  8. */ R: r, m/ n5 f6 B
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE  v1 W# @9 U  ~; I: c
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
    - x, N6 }) S) \
  11. *         TO CHANGE.
    & }1 _; N% V4 J/ w0 C
  12. *
    / d$ ]4 ]9 Y( Y0 G, c
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/4 u0 M/ Z. Q: _5 {' A9 p
  14. *5 w: s$ C7 V  }' j% s/ V7 R
  15. * This program is free software; you can redistribute it and/or: K/ k! x3 i; H) J7 c  o
  16. * modify it under the terms of the GNU General Public License as1 s' J2 m  Z& P( D' ]" k+ L
  17. * published by the Free Software Foundation version 2.$ A9 n) a4 o, l7 z0 h) N- \7 [( ^
  18. *
    * ~1 i$ \# X4 H7 l' ?( E9 I: t
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any6 n" w% O7 u3 V# q* m! x
  20. * kind, whether express or implied; without even the implied warranty* L7 y- A$ u; W5 R4 Q5 e" \% Q
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    : |9 l& ]; w/ P) N/ ?+ b, M5 e( w
  22. * GNU General Public License for more details.
    - z8 M- |4 T8 _- @& G( [
  23. */
    - L1 ~4 u' D& Q) ?
  24. $ S$ w4 i% u9 J% F- f
  25. #include <linux/module.h>* d( j# G; k8 b+ |  E
  26. #include <linux/init.h>9 h: F6 J5 }# ]" A- ^& `
  27. #include <linux/errno.h>
    0 I6 o/ t9 {, m0 B- m% b( M
  28. #include <linux/types.h>
    ' S' T# Z" D0 _* }% j! `2 f6 G
  29. #include <linux/interrupt.h>
    9 y! v( ]4 E1 E& Q( Y
  30. #include <asm/io.h>
    ) [, o8 ]1 i) ]7 |& g& G4 p2 |
  31. #include <linux/moduleparam.h>2 h) {5 s( ~7 u* u, w
  32. #include <linux/sysctl.h>9 y, w5 o( {0 }1 q$ R
  33. #include <linux/mm.h>
    / w6 x: C( I4 z: f/ S- A' c- n
  34. #include <linux/dma-mapping.h>
    " U# r* ?+ g4 l3 C4 U- Z
  35.   |: P7 m! H' w+ S  y, x) e
  36. #include <mach/memory.h>
    & T5 ]3 Z- R: m; g5 l" J
  37. #include <mach/hardware.h>
    1 [5 p) V6 {& @7 M( |
  38. #include <mach/irqs.h>
    ! S* R4 u) Q5 V0 x: x
  39. #include <asm/hardware/edma.h># I# Q5 w- j8 U
  40. 8 u6 k! L7 S- W9 m% r7 W
  41. #undef EDMA3_DEBUG4 b  n  E2 w' d4 H3 c: O
  42. /*#define EDMA3_DEBUG*/6 _( A3 ~/ N$ F3 |- F2 i

  43. . u* f3 {  ^2 C$ e) J& x( S
  44. #ifdef EDMA3_DEBUG
    $ [- \0 c+ T! E$ h1 s, @
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)4 w4 Y: C  y3 K- A8 e) u  k
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)3 J+ f! l* K. @8 G5 l3 K3 ]3 H( h
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__): A/ m% j0 w* Y6 r* m7 d$ u
  48. #else! M7 r/ H" ?, r5 k! \( i
  49. #define DMA_PRINTK( x... )7 ~7 B3 e( e( p; K
  50. #define DMA_FN_IN
    5 Y$ w, ?. R2 b7 t5 Y5 C
  51. #define DMA_FN_OUT6 X/ x% O& U1 g! o/ a* K
  52. #endif
    . z/ V8 S' ?# W+ W

  53. + H- v/ x6 `9 p6 w
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)6 B/ A0 o6 z+ Y0 k$ x
  55. #define STATIC_SHIFT                31 J6 D& A- c3 ^7 L
  56. #define TCINTEN_SHIFT               20
    . k  i( w# l( F8 Z
  57. #define ITCINTEN_SHIFT              21  Z3 E4 p3 F2 W$ |4 u2 M2 e
  58. #define TCCHEN_SHIFT                22! w3 ?" e/ k! Y" |& y: L
  59. #define ITCCHEN_SHIFT               23
    ! [3 Q* ^7 I0 ?7 T0 p, c
  60. ) N6 M) s6 F& K* Z
  61. static volatile int irqraised1 = 0;
    * `0 P, O+ J# f! {- e
  62. static volatile int irqraised2 = 0;! I# X" i/ n. I: `2 T+ o; c
  63. ! M: o$ M5 i/ A% e
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    % y8 W! l$ t2 f# N# F8 D1 e
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);: S3 ]6 U& P' N" V! r6 M
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    4 M& w+ H2 V$ R
  67. * Y+ [9 d  s" A: b0 f
  68. dma_addr_t dmaphyssrc1 = 0;& @% L' M% S4 m' u/ [
  69. dma_addr_t dmaphyssrc2 = 0;
    . V: B+ b: o7 I/ ?, Z
  70. dma_addr_t dmaphysdest1 = 0;
    9 B$ g% e- V' B( X, j( |0 I" G. O
  71. dma_addr_t dmaphysdest2 = 0;/ K% P4 U: }6 k$ s
  72. 6 s  t  d. a" z6 G
  73. char *dmabufsrc1 = NULL;
    * Z8 Q5 d( K+ N
  74. char *dmabufsrc2 = NULL;& W4 J$ N" O2 S; v* d4 t( D, l
  75. char *dmabufdest1 = NULL;& q% k3 @% h( B8 Y+ P  m
  76. char *dmabufdest2 = NULL;+ @5 v9 o0 V& {) N" D! k2 J7 E2 g
  77. 9 }# b/ x: p# A) @' Z0 U4 j9 g
  78. static int acnt = 512;
    : ~& u: t# O# j
  79. static int bcnt = 8;( Y6 i- o/ _& }3 _+ E0 g3 F8 T! E% w
  80. static int ccnt = 8;
    ) q: @- S: I# h2 y$ E; W5 z9 v
  81. 6 Z( h; v: A% i* Y6 X
  82. module_param(acnt, int, S_IRUGO);( g: e9 f8 z- y4 C! ?+ W  @
  83. module_param(bcnt, int, S_IRUGO);( T7 g* `$ ?% h2 e' ~8 O, c0 {
  84. module_param(ccnt, int, S_IRUGO);
复制代码
9 ?4 O& P. O1 }

% v3 H8 c. [: y/ g2 A& B4 ~      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用' p3 f1 r. ?, Q' w; r& S3 K
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
  |+ t2 S  e/ Z; u* ^, ~     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。$ I0 A2 n. g" F; W# E6 A* E' T
! z) u9 ~( z! u' ?" E2 U3 o

) p( h$ P" j* {6 W
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2026-7-21 13:47 , Processed in 0.062614 second(s), 26 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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