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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑 $ u& Z, r$ J4 ?0 S
  1. [code]EDMA sample test application# }- R7 c* K: \( P+ K5 C7 x: L% S
  2. /*( Q/ R: P* F* F5 \9 W8 H/ p$ G
  3. * edma_test.c
    / R& s- l6 J4 s" D1 \
  4. *
    ; [& z* o. e/ v# Q& ^
  5. * brief  EDMA3 Test Application8 r( o  ]8 R" a
  6. *& W' [1 g! x: J6 p  v5 d+ G# H
  7. *   This file contains EDMA3 Test code.: c  J; m, M5 n6 i
  8. *- o: o5 e  m+ {" h
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE1 Q, E# U3 m) u$ J& {% u
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT- r/ t+ ?# d5 [1 V
  11. *         TO CHANGE.2 v( G0 y. I! ]4 r& q0 K% ~5 L
  12. *
    ; R: v; n5 X1 O/ A5 K- c7 c) W
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/' J; u  s4 J* Q- @; H; A
  14. *
    * h1 c1 N  j7 X" {* z
  15. * This program is free software; you can redistribute it and/or0 Z( r" ~! M1 T* D" ?. P
  16. * modify it under the terms of the GNU General Public License as
    ; ?6 H3 w+ }, P8 e9 L- C6 ~0 G3 s
  17. * published by the Free Software Foundation version 2.
    . d2 }' M4 c( F9 ^' ]
  18. *; ~# k9 j5 X, j+ C& r/ T
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any8 e1 h9 K% x- W  Z' G& Q
  20. * kind, whether express or implied; without even the implied warranty
    ' ~1 c1 K3 O! A
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    . N, H% A! g+ q! n
  22. * GNU General Public License for more details.% I9 n: v) N5 m, c! ^+ l$ d
  23. */" L9 S* g& @$ I
  24. ) |0 `4 r- h0 `# }  @" Z
  25. #include <linux/module.h>
    0 Q) g2 a8 i9 m3 z, O
  26. #include <linux/init.h>( d! {6 G* ~8 |# U2 x
  27. #include <linux/errno.h>5 r$ }( f' d( d) X
  28. #include <linux/types.h>4 g/ f! y4 K# j* N
  29. #include <linux/interrupt.h>
    ) t8 U* ~2 G/ q( M/ s8 S: g0 {
  30. #include <asm/io.h>" n6 p) o6 r+ h0 J4 i
  31. #include <linux/moduleparam.h>9 Q; |; n/ x& J- m8 G' O! p$ i
  32. #include <linux/sysctl.h>
      d, v$ B( V5 h  r
  33. #include <linux/mm.h>
    9 |& V! }" }% S3 e4 ]1 U4 {1 A6 e
  34. #include <linux/dma-mapping.h>
    - x# r6 V  b3 Y; ?! \. p5 d
  35. - e- N+ ?. s0 |. @
  36. #include <mach/memory.h>7 Y1 F7 U5 O6 T- x1 v
  37. #include <mach/hardware.h>: e5 W, i+ F6 \8 x9 X) k
  38. #include <mach/irqs.h>
    $ ^/ b! m+ g0 f: w) \7 K" k/ D, @5 K
  39. #include <asm/hardware/edma.h>0 J1 o0 j. v8 s0 ^

  40. ! N1 q/ C9 v7 c; O8 k0 V0 u# A
  41. #undef EDMA3_DEBUG
    3 ?) O# W5 x+ @, t1 ^* M
  42. /*#define EDMA3_DEBUG*/1 m& h0 B  Q! M2 \0 k( {
  43. ; C- P+ d' W& p
  44. #ifdef EDMA3_DEBUG4 f4 A8 _$ R5 c
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)0 v9 F  B9 p6 _: e9 L
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
    # L8 R  c9 F0 F. b1 X! b: y/ A3 I
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
    $ j, T/ e5 Y$ c: W' q9 t
  48. #else* Y+ m; B- u! c$ L( a
  49. #define DMA_PRINTK( x... )1 [+ E* A9 K8 O. T2 f$ f8 `
  50. #define DMA_FN_IN% ^" [" ]% F7 a* `, O# R7 @
  51. #define DMA_FN_OUT: ]& Y1 P7 c6 d$ J, x
  52. #endif
    " k& b2 G: D& _* J

  53. : U$ K9 M( \4 z) @! n& |* S2 y
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)3 |4 `" h$ l; L: w) W6 @
  55. #define STATIC_SHIFT                3
    9 c3 u7 b6 Z* C9 }$ F, p
  56. #define TCINTEN_SHIFT               20  E$ V! r( _. S0 G" J& m
  57. #define ITCINTEN_SHIFT              21
    ( n3 A/ H; U9 R- |# \- c
  58. #define TCCHEN_SHIFT                223 a  O/ H# w3 x3 h" M
  59. #define ITCCHEN_SHIFT               23; b3 x4 }0 J- w$ J/ r0 Y

  60.   ^7 N4 w+ T; u% t
  61. static volatile int irqraised1 = 0;
    4 a, a% s) Y* N8 B) y+ I% K9 ~( A
  62. static volatile int irqraised2 = 0;0 T/ n) U  D  o# b+ T8 w
  63. ' A% F) [% J' X, E6 a5 _! o% j
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    6 [. j' g* N0 q+ O( c6 c
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    9 U2 z. M8 ^+ l
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    $ M1 z0 V5 G  Y) F
  67. $ C0 h* P$ h' s" b6 E+ I  \0 R. B
  68. dma_addr_t dmaphyssrc1 = 0;; n/ @# j4 G- M
  69. dma_addr_t dmaphyssrc2 = 0;
    ) i0 [* V9 o" Z2 ], U( g
  70. dma_addr_t dmaphysdest1 = 0;2 e% H; ?2 W% d- X# H
  71. dma_addr_t dmaphysdest2 = 0;( c1 x9 n( D+ e& b. v
  72. ( y& C, z4 M' ]6 J
  73. char *dmabufsrc1 = NULL;! ?3 q2 G! U( u
  74. char *dmabufsrc2 = NULL;' N, n$ F2 L4 i
  75. char *dmabufdest1 = NULL;9 ?! D- h. Q) u8 ~
  76. char *dmabufdest2 = NULL;" r/ b) v6 r9 j: ?% i8 V1 t
  77. 7 F8 ]1 w0 S7 ~2 w6 w9 d4 d. E9 C
  78. static int acnt = 512;( c' b" v9 S7 {+ [- O$ L4 {
  79. static int bcnt = 8;4 @/ l* z% l6 `( \
  80. static int ccnt = 8;1 f  c5 r* Q1 `8 J) z: ]( e, L: m
  81. : Q: e+ |3 z) L7 w3 q- P1 A& `
  82. module_param(acnt, int, S_IRUGO);
    8 B8 j: _4 H+ [: h$ R8 c+ |
  83. module_param(bcnt, int, S_IRUGO);
    ) B+ Z$ p! K8 [2 U1 e# g) |
  84. module_param(ccnt, int, S_IRUGO);
复制代码
0 B, Y% I. x3 K. A. G5 s$ y
6 V, l7 Q3 Y, L* z7 Q& k* w
      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用- h! z, N6 ~0 f1 I, C
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
4 H. ?: n* F' b; Q9 o4 L5 S     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。2 G1 T- f- ~* Z$ u; l8 C* D% E* `

8 M* I0 a4 A- f! R- Z  q% |% c* y- B# T+ O
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2026-2-5 15:12 , Processed in 0.039602 second(s), 25 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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