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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑
3 F% r, F& W/ _& h, r( v9 G( ~
  1. [code]EDMA sample test application* t4 q( V8 z5 G2 ~3 s
  2. /*) K2 u+ Q" K! Y$ l/ N! g# J
  3. * edma_test.c2 ?  H$ Y& ^! |8 Q
  4. *
    % F2 a, w- ?5 \
  5. * brief  EDMA3 Test Application
    $ J; _8 ?# e+ y" @' e, `
  6. *. U" m$ z2 A$ W% |
  7. *   This file contains EDMA3 Test code.: B/ r$ U& ^- [! j
  8. *
      o6 O$ Z' O' B5 [
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
    5 ~/ ]& D5 M, W1 o1 H
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT% ]$ _+ q8 X) w4 |* f
  11. *         TO CHANGE.4 h2 f( d4 c. _$ f) H) g7 B
  12. *
    ! o- |. ?1 Q( F
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
    ; {9 T6 K  _& ]4 u
  14. *: q, o% r/ k- j- \" y6 p
  15. * This program is free software; you can redistribute it and/or: l9 `* P0 i% T; l3 ]
  16. * modify it under the terms of the GNU General Public License as
    ) G: c6 Z5 C! [/ D  O% X9 [
  17. * published by the Free Software Foundation version 2.
    + W% J% h+ k+ t" ~) D5 C$ T
  18. *0 {3 @) q5 Y' u2 U; q
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any
    6 q/ ]# c+ s. D0 N) h, L
  20. * kind, whether express or implied; without even the implied warranty& I$ H- ~9 {( x, W4 J' l3 K( O
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    6 F; @# x6 b, o3 o3 t4 n3 ]0 K3 H2 j
  22. * GNU General Public License for more details.
    % P0 D2 j  ~- O. V( [2 A5 C
  23. */
    % m: D/ _& Q- t' L" c" a7 a: i& G7 S

  24. 5 S$ u+ `5 O' e  M
  25. #include <linux/module.h>8 {( K* L( t/ h+ m% J
  26. #include <linux/init.h>: S  U8 S% }8 ]5 ^8 h4 E
  27. #include <linux/errno.h>4 q% @" G8 Q$ X4 I4 Y' |( ~- D: G
  28. #include <linux/types.h>
    * l( `) e5 j+ \' D- Z4 D8 {
  29. #include <linux/interrupt.h>" @( n, k+ K) Y# K  _; g
  30. #include <asm/io.h>3 d" ^( l1 z: L! i
  31. #include <linux/moduleparam.h>2 F5 b+ N" a" x
  32. #include <linux/sysctl.h>5 w; k3 H2 e/ G. n9 L8 \$ T) K
  33. #include <linux/mm.h>
    5 d6 b  j2 i' z. \. n
  34. #include <linux/dma-mapping.h>
    , `% V5 i' u* T8 S2 i

  35. - h% `9 G* r3 o) b0 D  j  j, p
  36. #include <mach/memory.h>
    8 d1 L1 F% O$ ]
  37. #include <mach/hardware.h>5 l/ D: ?" K3 P. A3 Q* Z* X
  38. #include <mach/irqs.h>. h) `$ }7 u8 d- k7 m
  39. #include <asm/hardware/edma.h>, {5 z6 ~6 B2 ]1 }. K* E

  40. : w$ B  ^5 G9 n) W8 h8 U
  41. #undef EDMA3_DEBUG! H4 G2 r6 W( G
  42. /*#define EDMA3_DEBUG*/
    5 v' G% p" @" K/ n
  43. + D# |4 T( d0 D
  44. #ifdef EDMA3_DEBUG" A. I" Y7 o% j/ k7 q6 @6 [
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
    . g9 H  X# c# V$ o# {
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)+ M  {' n5 k+ Z7 R
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)' j" Y% ?1 E! ^9 k
  48. #else
    ) n" Q: \& v6 N$ h. Y$ _8 o2 E
  49. #define DMA_PRINTK( x... )9 K: G% e3 z. y. p7 h" l
  50. #define DMA_FN_IN8 i- O1 v+ @7 c: [3 x' ^, S) V) p
  51. #define DMA_FN_OUT1 d( @3 g" a3 p* Z2 s
  52. #endif* }9 d" |, i  X/ @- G1 x' ?
  53. ) L2 B5 F2 ^8 P. B9 x, T
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)
    0 ^& K" C# o" N7 @( U
  55. #define STATIC_SHIFT                3
    . J' B! r& E  @" Q
  56. #define TCINTEN_SHIFT               20
    ) v" ^8 ]$ E) C+ M' Y% Q
  57. #define ITCINTEN_SHIFT              21
    , d- a/ C4 n' r
  58. #define TCCHEN_SHIFT                22
    9 p% G, r) D! i% t& O5 J5 H! I7 U3 ?
  59. #define ITCCHEN_SHIFT               233 ?; H5 C/ \: u1 c
  60. 4 Q( g/ B. J& Q7 [' Q' S
  61. static volatile int irqraised1 = 0;9 {- `# n: h  i" g' [$ c( }; K
  62. static volatile int irqraised2 = 0;
    # d9 A8 W0 ]$ E2 l6 [# f/ J9 s3 @) e
  63. 1 T7 `# J. u/ Y
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);2 C2 T1 D, ^, I; ?3 c
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    & r: ^$ g+ U3 q0 u
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);) ~! }( J5 n. _" I& q$ j$ \+ i/ B
  67. / S% T  O( y" y$ ]! a0 T
  68. dma_addr_t dmaphyssrc1 = 0;
    ( @0 m  Z, k  j
  69. dma_addr_t dmaphyssrc2 = 0;- p2 x' q4 B& @
  70. dma_addr_t dmaphysdest1 = 0;
    - i5 O% _" Z- o; {) n% H
  71. dma_addr_t dmaphysdest2 = 0;
    ) y% G7 J' U* i: v- K
  72. # ~3 K0 [0 j/ O) R' f# s
  73. char *dmabufsrc1 = NULL;( N/ Q/ L, {: q2 w  \, Y0 Z
  74. char *dmabufsrc2 = NULL;
    % P' S7 r. N! H. [0 c2 ^
  75. char *dmabufdest1 = NULL;
    " l, C3 T4 S1 ~9 d1 U4 `4 H( M- h2 f
  76. char *dmabufdest2 = NULL;8 m9 D) v0 a$ W- q* V" m, E. m
  77. & m6 y9 u8 c( s- k0 E7 Y6 G. X% Z+ c
  78. static int acnt = 512;
    + W" T- d; c, @6 c8 Z
  79. static int bcnt = 8;
    # Z' z+ }7 `5 ]5 T5 Q; B/ `) ^% s1 v
  80. static int ccnt = 8;6 ?+ F( r9 z. }7 ]" u/ Z& U1 W/ Z3 x  P

  81. + y# }1 C6 K. U0 m  s5 x
  82. module_param(acnt, int, S_IRUGO);
    $ J* e0 k% F: J0 e4 l) p/ a
  83. module_param(bcnt, int, S_IRUGO);
    3 \+ T) b" v0 a) F& {; a' Z, k* T" b
  84. module_param(ccnt, int, S_IRUGO);
复制代码
! b+ ]2 X4 J+ j% |% t0 C: d! z$ Q

: R  N: E  U* t9 a      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
: N+ v8 [4 j6 A" X0 ]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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。/ E$ W4 `/ a+ j* I
     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。- u2 N( g1 M  G- R1 g9 L. K

7 M$ ^4 Z2 S6 H0 x+ B& m# T# _0 f- a0 a; s& s
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2026-1-30 21:00 , Processed in 0.040563 second(s), 26 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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