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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑
+ U/ I4 B: C  N; o+ n
  1. [code]EDMA sample test application
    / {$ S$ [5 \7 \! F' N
  2. /*2 A" E- p6 c( S  M0 b& W
  3. * edma_test.c' l2 e( B& N5 W
  4. *
    3 x- A( Q, J0 |" G" @
  5. * brief  EDMA3 Test Application5 W- f0 _/ g: h' S0 |6 B
  6. *0 T$ B7 z3 u3 @! ]6 I$ v2 ^+ ?
  7. *   This file contains EDMA3 Test code.
    , O; O5 V0 g; d9 t3 K) G; ^% H& G4 Z
  8. *9 P, d1 f4 B6 L# c% J' D" Z% q/ u
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
    3 {* P) Y( n2 I* w. m
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT( P0 M& |: F! q+ B3 a
  11. *         TO CHANGE.& y  Z7 I0 j9 i" U: v( ~
  12. *
    & n" `8 I2 U* a0 O" t- t
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/( Z9 e. ^9 ^9 D/ R
  14. *4 H7 F" j$ a6 V3 |/ _, V$ @& b9 a
  15. * This program is free software; you can redistribute it and/or2 Q: ~5 |4 K0 e/ V9 h* z* T6 a
  16. * modify it under the terms of the GNU General Public License as& c9 i4 L9 O4 H+ g" }/ S9 R: n8 t
  17. * published by the Free Software Foundation version 2.& @' E1 F# c; Q' p# I
  18. *6 {: G9 p  N% f3 m$ R# W( }9 ]
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any
    8 B+ U+ a( [$ X/ [2 o4 _$ D, i* n8 ^4 ~
  20. * kind, whether express or implied; without even the implied warranty
    " e3 _" I/ H* r$ N: S( M% x- i
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    - \1 U; x9 |/ Z! {" V+ Z3 D
  22. * GNU General Public License for more details.
    - K: m1 ]3 _. X" k. B
  23. */0 ]6 z1 |' A, K

  24. 7 j/ E# `5 \  t6 a, h( t
  25. #include <linux/module.h>1 ~8 ]8 T1 m4 X* V+ l
  26. #include <linux/init.h>! V, x( G+ x; O) q, W. K
  27. #include <linux/errno.h>
    9 \) s8 o" u; Z. x/ s
  28. #include <linux/types.h>- Q' _+ t+ }. P/ v; ]% T- f/ O
  29. #include <linux/interrupt.h>
    7 m3 w3 @* B2 t# E( `0 C5 F" `
  30. #include <asm/io.h>& S9 ]9 @  l5 A, J6 i
  31. #include <linux/moduleparam.h>
    9 K8 j1 t' [/ j! t5 `) R
  32. #include <linux/sysctl.h>1 P4 y" U' E6 {  Z" K6 H1 G/ j" R3 e
  33. #include <linux/mm.h>) @2 p- ~" {5 g0 E0 P
  34. #include <linux/dma-mapping.h>
    $ ]  `- h& w6 ^; M
  35. + p$ ?" z+ z& d1 W. h# k- Q
  36. #include <mach/memory.h>; R/ s, ]; H4 b1 s0 r1 J
  37. #include <mach/hardware.h>
    3 }/ C/ U, u9 P5 m+ O) V
  38. #include <mach/irqs.h>
      u- n% P$ n  B$ T
  39. #include <asm/hardware/edma.h>$ b( T; j* P4 W# D0 i
  40. 5 ]& w6 {% G  L  ]
  41. #undef EDMA3_DEBUG' D5 i# C) h; \7 h9 V4 X
  42. /*#define EDMA3_DEBUG*/
    2 r! h( F7 h  \/ |/ B

  43. % i, f. @2 V! K: D1 X7 L
  44. #ifdef EDMA3_DEBUG- T: Y' F& n! c2 L9 r  c& E
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)# p# o  j) u1 f; Y, v$ f
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
    9 ]( ]1 I" k+ ?% Y9 D! M! B5 a/ W
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
    " ]* f; s( V8 e  J6 q: X8 w, E/ H
  48. #else( i3 O# m- q' X
  49. #define DMA_PRINTK( x... )- b. l* w' b0 q2 |* [
  50. #define DMA_FN_IN
    . J( ]$ R3 x% ]
  51. #define DMA_FN_OUT+ ]3 w! V7 Y# E5 F) r
  52. #endif# o5 q8 e! M2 h" R, }1 U

  53. 1 s2 o; L( m  B8 M& a0 i) v
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)6 `$ Z. _' E2 u5 Y
  55. #define STATIC_SHIFT                3, Y5 m" ?) k' S9 J& U& k: k' t! @
  56. #define TCINTEN_SHIFT               20" p' m: c6 L7 e: O
  57. #define ITCINTEN_SHIFT              21( |: k# t  O8 b& x% ^5 B( f
  58. #define TCCHEN_SHIFT                22' U  y1 B1 O' q0 C8 t$ _4 x
  59. #define ITCCHEN_SHIFT               23% S  p5 Y' {+ v0 w

  60. 5 l: l! ]6 m' R4 R% g2 W6 n1 F
  61. static volatile int irqraised1 = 0;9 W. w5 N0 O9 y. g: X) B" h6 E+ _
  62. static volatile int irqraised2 = 0;! k7 ]# C+ Z* I* q2 `0 C) p

  63. 8 E" k2 L  r/ u) B5 K
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);1 ~) ~$ _& G! ]
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    0 ]- {& h$ S8 }2 Q
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);  U6 @- ^- ]) G
  67. 5 q; Y1 D( x5 G+ p
  68. dma_addr_t dmaphyssrc1 = 0;$ z4 a1 t6 @3 d! {
  69. dma_addr_t dmaphyssrc2 = 0;  S( {3 O7 z; O- Z
  70. dma_addr_t dmaphysdest1 = 0;, ~$ p  S" }# i  t) j* Q3 W$ R
  71. dma_addr_t dmaphysdest2 = 0;
    : G. {* e4 i% [6 \  S! l
  72. % e- h8 D& S- d6 l  s
  73. char *dmabufsrc1 = NULL;5 i+ c3 }, j) f- o
  74. char *dmabufsrc2 = NULL;
    0 H. R! _7 `+ W1 u
  75. char *dmabufdest1 = NULL;* `, o. |$ B3 H( M/ }& @
  76. char *dmabufdest2 = NULL;2 s. b3 D, m& ?  y

  77. 9 c9 N7 q$ \9 w% V
  78. static int acnt = 512;" T5 S6 ?$ f  X
  79. static int bcnt = 8;
    - g$ T4 R6 F4 ]8 y8 w
  80. static int ccnt = 8;9 z; T6 O- n  a- z
  81. + s7 e  J- ?4 C; r2 B/ M6 _# ~
  82. module_param(acnt, int, S_IRUGO);& ^7 D: @1 x" U9 T5 d
  83. module_param(bcnt, int, S_IRUGO);
    . f5 `! g, U1 s, j# U0 O6 I. r5 B
  84. module_param(ccnt, int, S_IRUGO);
复制代码

' f& w2 M' t  l' ]* n/ G6 ?/ X( Z: J4 X7 c
      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
* Y* O4 |4 Q3 ~$ n8 \! T& A6 `0 aarm-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. R' R$ n4 `4 B9 M! k( Y
     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。+ e9 {% w: V5 q- w# e+ D, a
- |( y' P0 P# p1 o8 J6 i, W' l. y
5 y1 f# n! q% ^* X7 Q) `
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2026-3-26 07:35 , Processed in 0.042209 second(s), 25 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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