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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑 , B* x$ s( ^7 L6 z
  1. [code]EDMA sample test application
    5 z7 _3 q4 V" [" S
  2. /*3 r3 U' f- L  ~9 I+ \7 `5 ?1 r
  3. * edma_test.c
    " @; i/ c; @" W7 |* K, I4 J
  4. *# A- i% N6 y8 {; j% _8 \8 G
  5. * brief  EDMA3 Test Application
    . U: E" F/ T) `7 K0 v
  6. */ p/ B+ ?2 o9 X- Y
  7. *   This file contains EDMA3 Test code.* O3 j) B1 P- S) H6 J( O
  8. *
    : b& O# j! [) \' P
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE# Z' n$ P$ i" q8 W- s! B
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
    - O' H& V7 v8 n
  11. *         TO CHANGE.0 w# A/ }! f3 d/ p
  12. *
    $ g; O5 ~# ~$ [# N9 G: Q' J
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
    8 n( x# P8 Q& }9 ]1 S" b& U/ R. A
  14. *1 m. ~. R; q/ S& X
  15. * This program is free software; you can redistribute it and/or% O" \/ P2 c5 u1 T0 F) y
  16. * modify it under the terms of the GNU General Public License as
    ! l9 @* e+ J& y  F
  17. * published by the Free Software Foundation version 2.8 D% }. {. w8 L2 N  f4 j
  18. *
    - c3 x" G; ~) U' t3 u# H
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any
    + `9 N5 |% _% b7 E4 s. ^9 D2 u
  20. * kind, whether express or implied; without even the implied warranty) B9 G" F1 e! d+ n
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    / o$ I9 j1 l* R) L
  22. * GNU General Public License for more details.1 C& @( ~, Y$ D2 t: y( `5 C
  23. */
    + T& H! u3 ~3 R0 `+ y
  24. ) t- d# W. k) A4 Z0 ^" k
  25. #include <linux/module.h>
    7 ~' O3 r% r+ m9 C
  26. #include <linux/init.h>
    , x6 [, g/ L- o' P* M
  27. #include <linux/errno.h>
    * o& Z1 p/ V5 ~* e8 g+ p/ H
  28. #include <linux/types.h>3 j% E2 Q0 o' m9 G! S, a3 z  v0 f
  29. #include <linux/interrupt.h># ~& x. t* U1 b! [' V+ e" M
  30. #include <asm/io.h>
    . u) Y5 k: L5 l) z( ]0 S# ?
  31. #include <linux/moduleparam.h>" G( |( Y* a6 D9 l+ H+ L
  32. #include <linux/sysctl.h>
    6 q& A; L; w1 R& L6 ]" M- P& \: r, }
  33. #include <linux/mm.h>
    & t0 |, @6 H8 W, K! Z1 }1 R
  34. #include <linux/dma-mapping.h>$ P& o9 g5 h8 ^# S
  35. 7 y0 [" S+ i1 g2 H- I) F
  36. #include <mach/memory.h>
    0 T5 B  |) o+ I9 F7 ?$ ?
  37. #include <mach/hardware.h>
    0 O  `5 k5 x  J5 K
  38. #include <mach/irqs.h>* s. Z3 G: s. q! p4 D
  39. #include <asm/hardware/edma.h>
    " A# v4 \0 }: a8 P9 T' o' G

  40. + f% M- H  K6 m2 I. i9 C  {
  41. #undef EDMA3_DEBUG6 q" r) J, O+ j) F( o
  42. /*#define EDMA3_DEBUG*/
    9 D# I& r, {+ R, C% T/ Z

  43. - D% z" I0 \! [3 d: \/ e/ M
  44. #ifdef EDMA3_DEBUG& D# k" j! T7 C
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
    6 D4 I7 h. o( H0 C9 ?$ m- m/ u
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)9 y5 G2 }% G& Z
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)  z4 E! z+ Y; \2 N2 r
  48. #else+ u$ a8 ^( ~! t% Y
  49. #define DMA_PRINTK( x... )- `& ?& c+ n& G7 @
  50. #define DMA_FN_IN1 V: Y6 P/ i; D! [) t8 ]
  51. #define DMA_FN_OUT5 O. [* O) i$ P2 \" U' Y: M/ ^
  52. #endif5 ^! k. _+ v1 j6 r8 c5 Z
  53. 1 z2 l) P& D1 z) Q
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)
    ; ?. \. [9 p8 S5 C+ }1 ]1 Y
  55. #define STATIC_SHIFT                30 D: A  n4 E" a2 Z# ~; D$ Z
  56. #define TCINTEN_SHIFT               20- A1 x. K8 q7 K% A7 b" S
  57. #define ITCINTEN_SHIFT              21
    1 G# H% t  F" `
  58. #define TCCHEN_SHIFT                22
    , V9 C4 v  y. u% f
  59. #define ITCCHEN_SHIFT               23- F, u# i7 r7 X# w! t; q

  60. 4 V2 F! @0 D) K, n9 w
  61. static volatile int irqraised1 = 0;
    # k- Q* F, R; N, I' ^4 `3 Y: f# w
  62. static volatile int irqraised2 = 0;
    % Z# p/ H8 f  j: N# B
  63. + ~& F1 t- Y7 w) g0 F  f9 z' x0 A
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    8 ^* A" {7 |6 Y3 k
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    9 P* A$ V9 O1 Y$ a
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);  ^3 V) d- P  M7 b7 d$ T) i" I! R
  67. 4 I& h3 M  M* a( L$ d
  68. dma_addr_t dmaphyssrc1 = 0;
    + I6 F5 p: t  y- K5 A5 x: I: i2 b
  69. dma_addr_t dmaphyssrc2 = 0;3 `  O' v# D3 U$ ~' g: @( g
  70. dma_addr_t dmaphysdest1 = 0;
    6 T) o, K5 T/ y+ w+ f
  71. dma_addr_t dmaphysdest2 = 0;
    ) u7 ~$ _$ h! f9 d# l& Z/ }; x
  72. " Q3 [! r+ @: ~( t" f2 G8 F
  73. char *dmabufsrc1 = NULL;! E: o7 B  l7 @$ p
  74. char *dmabufsrc2 = NULL;+ Y) F3 U1 m( m% ?8 T
  75. char *dmabufdest1 = NULL;( U" r1 `9 e9 o/ l" @
  76. char *dmabufdest2 = NULL;6 I' j0 O. C' M  D3 D7 D0 r

  77. + n2 e$ R0 R# o0 ~: g
  78. static int acnt = 512;
    ' {* s1 s) _: a  ^" w& r$ M* ~
  79. static int bcnt = 8;. Q% z/ _& b8 B0 m. l
  80. static int ccnt = 8;
    1 w- c1 m3 _4 \9 @% u' x+ w* Y

  81. 2 p, G/ C  t9 ^( t8 ^. U& ]1 \+ L: b0 {- ^
  82. module_param(acnt, int, S_IRUGO);
    . a3 C  G) q  p6 U: J# R
  83. module_param(bcnt, int, S_IRUGO);
    9 r8 e: ?0 \7 a/ h% P2 L
  84. module_param(ccnt, int, S_IRUGO);
复制代码

" b8 A* N) j* Q2 ~& T" J* `7 n: \: W- ?+ B0 Y- N0 I
      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
7 U# t7 p& n+ z. X5 t* ^8 Jarm-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! U* \1 y5 A+ W2 z
     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。  Q+ ^, b% d8 W7 G9 o
* ^5 H9 U' [+ [: v

# Q: x2 c7 Y, H" m
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2026-3-8 00:59 , Processed in 0.040375 second(s), 25 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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