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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑
5 \# y, Z4 @' G8 f
  1. [code]EDMA sample test application* s- H- Y) Z2 t8 i$ |# i" T/ `1 t9 V
  2. /*& ]) P8 M0 W' m; E
  3. * edma_test.c9 N7 Y/ s8 I9 S3 L3 a
  4. *
    ( X! s0 Z3 c# o( V6 s
  5. * brief  EDMA3 Test Application
    + {, e) q5 i) s* ~1 K# R3 M: J
  6. *
    7 z: v! A8 y3 B% b- h
  7. *   This file contains EDMA3 Test code.
    " q2 f& ]+ U. L! }" M
  8. *
    # N/ l0 A$ ^- Z0 d* c6 g/ J7 O- ]
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE9 \! W" W  M7 P1 O' b; ~
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
    / E8 P# _% F0 @1 m% @8 ]  t# c
  11. *         TO CHANGE.  d" z* w; L9 X" c  m4 x! \
  12. *& @- R. n  M2 }+ r" E( z7 @# ~3 ~
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/; _& y$ T5 I" g! H( U! ]( S
  14. *
    * u/ h0 \- c4 N- T( Q
  15. * This program is free software; you can redistribute it and/or! b0 @" o$ i) ], a9 Y! e. A8 y
  16. * modify it under the terms of the GNU General Public License as
    9 t5 |+ N% C& D( D) `
  17. * published by the Free Software Foundation version 2.2 Y6 S1 D7 p# ~+ e6 [! R- N! z
  18. *3 s# B* D! o1 v: f
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any
    4 s7 O* i+ |1 v$ b
  20. * kind, whether express or implied; without even the implied warranty
    , R4 {; G0 [2 q2 _$ H
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    , z3 H) d- I, ]0 |
  22. * GNU General Public License for more details.7 y0 E7 j* ^' C" B" P& J/ J
  23. */
    . i) P% k9 j1 |' g4 g
  24. . J+ l6 h3 n. J: O
  25. #include <linux/module.h>
    ! j  v) P  Y' F! Q/ q
  26. #include <linux/init.h>* b* j% c. Q- j1 V
  27. #include <linux/errno.h>
    / w" ^. K: _- q# O3 v( R
  28. #include <linux/types.h>
    ! v3 a, r, F& V& l& a, L2 W
  29. #include <linux/interrupt.h>' }6 P$ X. y( J& X) N
  30. #include <asm/io.h>
    ( c) l% i1 M- g
  31. #include <linux/moduleparam.h>6 G+ u7 w4 R% t8 D  f
  32. #include <linux/sysctl.h>
    4 U1 {  f8 r! i: l) i. l% o
  33. #include <linux/mm.h>
    2 n/ R! {! s  S# B; V
  34. #include <linux/dma-mapping.h>! D: s+ K2 ^: W, ^# f# b
  35. : u/ q# E# h" v8 m
  36. #include <mach/memory.h>
    - T# p% N7 m8 [1 [. w8 O
  37. #include <mach/hardware.h>8 r! ^1 E/ H* _1 O6 f3 Z
  38. #include <mach/irqs.h>
    - A+ c! l9 _. \+ {( ]2 l
  39. #include <asm/hardware/edma.h>: \# K4 g, m; F0 Y$ Y2 ^

  40.   m- }  B9 u& r& [, L, z
  41. #undef EDMA3_DEBUG4 c% E; M, r# p+ ]! S+ b
  42. /*#define EDMA3_DEBUG*/
    & g/ S4 ~) t) B3 ~3 r: i3 D3 _

  43. / x/ g! O: E! ^( c5 O
  44. #ifdef EDMA3_DEBUG
    4 I* h- K4 U1 ~* }% j! S( x( l
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)7 v. o! S- U1 E) V# s9 I
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)( t1 G3 h+ m$ m% i! a/ w
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)7 {. k- {' j( U5 v7 z* C
  48. #else+ l* ?) H. ]7 ~
  49. #define DMA_PRINTK( x... )" H8 ~9 j3 f$ P
  50. #define DMA_FN_IN
    ) c# [4 H3 l# o7 e" i+ f2 x* v
  51. #define DMA_FN_OUT
    . w& Q- @9 H- c& ^
  52. #endif
    9 q9 [2 J* u" v4 A( ~+ h7 x( d& h/ `

  53. 9 @7 @- {/ K7 w" Z( ^- \
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)
    * X1 E) Z& O1 S% E% N
  55. #define STATIC_SHIFT                33 l% Q8 I$ P9 D$ Q* e* A
  56. #define TCINTEN_SHIFT               20! \1 J* w9 E; g( k8 h$ t7 H
  57. #define ITCINTEN_SHIFT              218 }! H7 Z+ ~# l1 I: H$ \1 P
  58. #define TCCHEN_SHIFT                22
    , H9 H- X. n" _* K* O
  59. #define ITCCHEN_SHIFT               23* z% m% x/ @- P2 L# G* F( ~

  60. $ ~4 F/ V$ Q. x; d) P9 c: E& ^
  61. static volatile int irqraised1 = 0;! \& O* y7 R' n, G0 q4 W9 d
  62. static volatile int irqraised2 = 0;0 o) _& e2 l1 m5 Y4 p
  63. 2 t3 u3 b- L( a) @" y& x, Z
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    2 a4 U. B( G% y7 z: Q: I3 S" O5 D
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);& o" F7 l3 Q, f0 P7 ]
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    ) m7 p  h6 F6 F3 [' f! _

  67. * z. r- J* v) q' V) M8 U# T
  68. dma_addr_t dmaphyssrc1 = 0;! c6 W( `% r3 S0 [' |8 r( L
  69. dma_addr_t dmaphyssrc2 = 0;6 Z  H$ N  [8 D! m& Y' m9 Z# l
  70. dma_addr_t dmaphysdest1 = 0;
    , M% o# f  A! A3 ]
  71. dma_addr_t dmaphysdest2 = 0;
    7 _& `9 k* ]& h, t7 M
  72. 1 @/ o, P4 r, L
  73. char *dmabufsrc1 = NULL;7 P0 ^5 r; d- |. G
  74. char *dmabufsrc2 = NULL;
    ! q& D; y" b$ ~' d9 d; y5 M% W
  75. char *dmabufdest1 = NULL;! H; c1 v/ y0 R# H% B
  76. char *dmabufdest2 = NULL;
    . |4 h) c# M3 e) H! j- r# N

  77.   ?9 Y9 w7 S8 y1 v/ e) E2 e+ ~# l
  78. static int acnt = 512;
    $ R2 f# e) m! ^4 l( D1 {
  79. static int bcnt = 8;, @0 B' k1 _. P0 T5 D- J9 |, N5 b
  80. static int ccnt = 8;
    1 H) x& L9 S  e3 V* s+ X+ u# X! J$ c
  81. 2 i9 {3 [5 U# U2 W; _6 H3 {
  82. module_param(acnt, int, S_IRUGO);
    ) F* u* X6 x9 V& B& G1 i
  83. module_param(bcnt, int, S_IRUGO);) h) l' v( V% \5 F7 L- I: K
  84. module_param(ccnt, int, S_IRUGO);
复制代码

! ], J3 G$ G0 \0 j% A& H; Z/ ^; s' F% @7 F% E
      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
) o8 q' t$ t& J) i7 k) j+ e1 \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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
8 S  N' V9 \9 m2 \; Y% ~     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
, K( v2 U8 q) y- `+ n
, ^" w4 n% d! G2 l+ `+ o0 E9 q6 P& _. D1 K
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2026-3-24 09:21 , Processed in 0.039427 second(s), 25 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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