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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑 " Z/ }5 T. Z: e2 |( z, \0 T
  1. [code]EDMA sample test application
    8 n- T+ ^0 V0 t( k+ c1 ~0 z# p
  2. /*
    " C8 u9 e9 l) @) e
  3. * edma_test.c
    6 G# t% a! Z& p& B8 H+ c
  4. *# @% h2 O9 o6 [/ P7 U
  5. * brief  EDMA3 Test Application
    , l2 S  O+ c; o, q  |  `% {& V4 j
  6. *
    ' u; a# _3 C; Z9 {6 R$ x$ s: J
  7. *   This file contains EDMA3 Test code./ Q$ \9 f; u$ p/ x
  8. *
    0 b% m* i& A- h, {4 {* n+ [/ B3 _
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
    ) ]% \2 k7 M1 L3 n0 M6 M
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
    2 f0 i7 o5 ]- ?& s; P
  11. *         TO CHANGE.
    2 f4 w8 u. o+ Z- T) P
  12. *
    : @  X& Y8 Z  O
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/, u6 a4 `, Z# c; L4 J7 f' H
  14. *
    9 S1 C0 C5 _$ J# @- J5 c
  15. * This program is free software; you can redistribute it and/or3 D6 I$ A0 U$ m; I
  16. * modify it under the terms of the GNU General Public License as
    ' ~3 y) D4 z  c7 m1 m  j3 r% a0 g
  17. * published by the Free Software Foundation version 2.( z1 D) S" o9 _7 ?
  18. *
    9 b& E! c& z& `; h8 u. k/ |) U
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any* q& E9 [7 e( _; l  @
  20. * kind, whether express or implied; without even the implied warranty; M; X  p& S8 N' D% N# ^0 B
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the1 @# D; g4 x; K: d! h% w
  22. * GNU General Public License for more details.
    , M# k$ Z8 ?3 }4 C0 x# X- q
  23. */, ~4 y1 C  _& w! \- h0 G* L9 _

  24. $ d, _" v" |: `- Q1 v
  25. #include <linux/module.h>
    3 f$ K- r+ {3 \, P7 I- u
  26. #include <linux/init.h>4 h, H0 }2 |7 d
  27. #include <linux/errno.h>: b  g4 x( z# q/ r
  28. #include <linux/types.h>
    * a0 o! e" X( o) I* C
  29. #include <linux/interrupt.h>
    * z+ x7 k& g( T0 p" u% [. S
  30. #include <asm/io.h>
    1 }, T9 t. l5 h5 s" z! {
  31. #include <linux/moduleparam.h>, Q& q0 Q" d5 R& C2 v; |  c3 c
  32. #include <linux/sysctl.h>) E5 t$ O* A, f: V, U" x0 E# h
  33. #include <linux/mm.h>
    ; Y: q% X4 _: o
  34. #include <linux/dma-mapping.h>3 ~4 x& D4 o7 d9 [8 _9 V
  35. 7 Z# p- a1 q8 Z0 h# n
  36. #include <mach/memory.h>8 w% Q+ O! m1 @, q2 Y
  37. #include <mach/hardware.h>  ~' [  U2 b: L" C5 M
  38. #include <mach/irqs.h># |( s: h+ R# K3 p8 b6 Y" y# s( M
  39. #include <asm/hardware/edma.h>; [" F$ L8 R) @# ]: [

  40. 2 ]( H- Q! p/ k5 t$ U" i3 C- d
  41. #undef EDMA3_DEBUG' e2 n- j5 T1 k4 T/ N
  42. /*#define EDMA3_DEBUG*/
    ' N7 z$ |% a9 j% S4 M% l
  43. ( Y6 k6 _) K! v2 o/ m" z5 i- Y
  44. #ifdef EDMA3_DEBUG/ v8 l4 }( Z7 S6 {' i2 W
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)/ U: t9 Z2 a( Q
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__), U3 C+ X; l$ r3 g* G4 x& E
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)4 L! v8 S8 t/ G) ]1 I; C
  48. #else& X! H2 U9 \  @( X' D1 c
  49. #define DMA_PRINTK( x... )
    8 P+ k3 _, M8 @' k0 T
  50. #define DMA_FN_IN
    ( W5 W5 ]" d7 p( K; }1 |2 s- m
  51. #define DMA_FN_OUT8 [! x# _. [3 v1 d1 D
  52. #endif$ T4 p9 g) j' \9 Y/ I
  53. 9 |2 K) }  V! m$ W, ]7 E3 M
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)
    7 ^+ I1 a2 `; Q0 M" x
  55. #define STATIC_SHIFT                3
    ( e) O  F3 y- u# l5 \
  56. #define TCINTEN_SHIFT               20/ x1 V* U; o& `/ l# [0 O( E* u! `
  57. #define ITCINTEN_SHIFT              21
    , I. a$ F2 I4 E+ y6 j, {$ |' U
  58. #define TCCHEN_SHIFT                22/ G0 J4 ?7 U1 @& v4 E# x, J0 S
  59. #define ITCCHEN_SHIFT               23
    ! `. v. U( T. p/ K) N2 B

  60.   e+ p: \  Z0 f+ c2 k7 ?1 |
  61. static volatile int irqraised1 = 0;
    ! `$ G1 _1 L7 `
  62. static volatile int irqraised2 = 0;5 N, c, q) I" V( a% H
  63. 1 L0 Z0 t3 W1 u, v: ~. a
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);4 E* e+ B9 W/ J' T( N: S% O) O
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    ! O6 {9 }0 s% d# K* A2 c  P8 P8 m
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    3 x3 v& J+ f! H6 f  w
  67. 6 a! j" l6 K* C$ B1 @# j
  68. dma_addr_t dmaphyssrc1 = 0;4 G% d/ M9 m( u! f/ l
  69. dma_addr_t dmaphyssrc2 = 0;
    6 q6 C. H. F6 G
  70. dma_addr_t dmaphysdest1 = 0;* s  a1 u6 {6 r# D# y
  71. dma_addr_t dmaphysdest2 = 0;: j5 q3 H" n9 \. s* H: D

  72.   t" P/ q% k4 Z  g
  73. char *dmabufsrc1 = NULL;
    . t1 [: y) P1 x
  74. char *dmabufsrc2 = NULL;4 v' a  V/ U& H5 B
  75. char *dmabufdest1 = NULL;& i* n; g2 E% L& n5 [4 r
  76. char *dmabufdest2 = NULL;) X" {. W5 l# V3 Z% f

  77. % E5 j, J  i; ~5 A5 E8 x/ G
  78. static int acnt = 512;9 X* z; }8 x, E* Y. m2 K
  79. static int bcnt = 8;
    + f4 G, I( v$ J9 O6 n+ w
  80. static int ccnt = 8;
    1 S4 a% l; r. U

  81. 1 q! ~6 |+ B2 a7 O3 N
  82. module_param(acnt, int, S_IRUGO);
    5 }' s/ |! x; E
  83. module_param(bcnt, int, S_IRUGO);+ u. m3 [+ w+ d/ ^8 A
  84. module_param(ccnt, int, S_IRUGO);
复制代码

& |! I4 {, F% o2 v$ l4 n+ x! \* A% x* D- l0 L% t. I
      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
5 d3 p( `0 D& }2 ]0 \; Narm-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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
$ R) y/ X! _/ a     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。8 h* N0 y+ @8 T  W5 E: N
6 F0 v1 P& Z( @, _

& P$ O# G; N: K  f, ?9 F
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2026-2-1 05:08 , Processed in 0.039308 second(s), 26 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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