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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |正序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑
; ^+ Z1 x" M' K! l! Q3 B+ _
  1. [code]EDMA sample test application
    0 Z7 X% u) S2 X# M- x2 E0 a
  2. /*
    - ?$ c7 |& ?, D+ Q9 ^  v. Z* l
  3. * edma_test.c6 |1 d+ X) T# [% A- H0 a
  4. *
    4 k& m3 y* E' |; X: ]2 S( q
  5. * brief  EDMA3 Test Application/ {" U4 V' I+ V' x7 {% r; K6 y
  6. *9 k* M4 r/ i( U7 w6 P
  7. *   This file contains EDMA3 Test code.
    ; J% p! ^. |; k' K( @$ |. {' @
  8. *! v" F1 B, R+ W# X6 u; f7 k3 C
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE. P! T3 u; g+ {/ A$ h: O8 G8 l
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT1 Y# J' F' c& h7 E& K) j) Y, e
  11. *         TO CHANGE.
    " h$ }: @: Q+ Q: {7 L7 b
  12. *
    * M# Q! I1 T1 {7 u; X+ j( i% x
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/; O$ v& Y. Q2 W8 d" P. l9 ]
  14. *0 |  ]7 F1 u/ b
  15. * This program is free software; you can redistribute it and/or0 s, c% [0 E1 S/ U( F7 U
  16. * modify it under the terms of the GNU General Public License as
    * u3 m# L6 }. B  S) c7 m& y
  17. * published by the Free Software Foundation version 2.
    : C# a, K0 f) B3 q$ j2 F
  18. *, _' k/ H' z. T, p" C& r' z2 P' O
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any) X0 y7 \3 V+ f' {" i+ t* z' S+ m
  20. * kind, whether express or implied; without even the implied warranty/ N; Z4 T3 O/ ?/ ~" I1 G2 F
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the: H, q& l& P$ X4 _8 v
  22. * GNU General Public License for more details.! O- b" O* y% |5 o9 f% P& o: A9 p
  23. */
    ' H. Q0 v' S; y/ a

  24. 4 @% c3 o/ i. g
  25. #include <linux/module.h>
    ) D$ Z) b) f. b+ X* x6 b. h, x
  26. #include <linux/init.h>
    - U: |% u& R  F# d& k' X9 k
  27. #include <linux/errno.h>" L( O1 X) u6 V5 i
  28. #include <linux/types.h>4 D& O1 V0 [0 r2 X, }' N# c
  29. #include <linux/interrupt.h>
    3 }0 N9 U5 p" f
  30. #include <asm/io.h>
    " f8 R, F$ T. t8 v0 M
  31. #include <linux/moduleparam.h>
    2 Q; U) C/ }. q# l4 W  u# n
  32. #include <linux/sysctl.h>
    $ u% f( ?! Q+ z. h
  33. #include <linux/mm.h>3 \; V7 N& ]/ p  l
  34. #include <linux/dma-mapping.h>" p4 t; ^2 D( O# |6 ?  _: [2 k

  35. 9 Z. B4 ]2 x( o- W# `
  36. #include <mach/memory.h>
    + g5 q6 G; m9 W5 m3 v
  37. #include <mach/hardware.h>
    + b+ S9 c: C$ l& ^  X
  38. #include <mach/irqs.h>
    5 o; B6 G' g( {  g8 R" {
  39. #include <asm/hardware/edma.h>
    0 [0 f- r: A$ \
  40. : X+ |1 d6 ^. x
  41. #undef EDMA3_DEBUG
    ! w' S! i3 t" f5 g6 ]
  42. /*#define EDMA3_DEBUG*/3 l0 }9 n* d7 ]) q- Q

  43. $ C9 |1 o- [% z8 A
  44. #ifdef EDMA3_DEBUG
    / j" ~7 G. P' H4 q( O" J- z
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
    9 W! }7 h4 C: `/ x7 c
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
    * ~8 E8 \- X$ T) l/ g/ D% L
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)# X) I$ w" _: z2 P
  48. #else
    : q' ^8 S$ y* g% ^
  49. #define DMA_PRINTK( x... )
    - }& X# o8 f6 ~4 m: p' Y
  50. #define DMA_FN_IN
    + E) M& w1 R' e3 f( m! [( z
  51. #define DMA_FN_OUT
    . p. p$ a+ Q0 `+ g
  52. #endif
    / m7 o; a, s9 w; t& o

  53. ; H, h8 N$ u. m0 d5 P& m+ P) d/ j1 I
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)
    - A* f2 [1 V# s* Z
  55. #define STATIC_SHIFT                3
    & M+ @" I5 F6 s. `
  56. #define TCINTEN_SHIFT               20
    ! u1 z: s9 G7 N
  57. #define ITCINTEN_SHIFT              21/ o- j( z  I) p. l+ [$ R
  58. #define TCCHEN_SHIFT                22
    0 W! t( m5 H% ^, {0 l/ z
  59. #define ITCCHEN_SHIFT               23# I  p" {: b: G
  60. 8 B5 n" x+ v+ V2 B; ^
  61. static volatile int irqraised1 = 0;1 ]  D& p8 C/ k7 W0 L
  62. static volatile int irqraised2 = 0;8 `$ W3 R6 B5 e( o3 |  g( |
  63. " Q& ~- B) H- s: c
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);+ E: N* L5 q3 M: R
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    4 `4 O1 X# Y1 `) Q! I/ L0 f+ I
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);: G: B: Z- W. J% w
  67. " f! a# j) ^7 k8 B0 A
  68. dma_addr_t dmaphyssrc1 = 0;
    8 V5 p  j' H$ \* I, @- p' [
  69. dma_addr_t dmaphyssrc2 = 0;/ l; z( R, V' [& _0 j
  70. dma_addr_t dmaphysdest1 = 0;
    ' [6 ?+ \% W2 K% s2 m  t
  71. dma_addr_t dmaphysdest2 = 0;
    . K% Y6 D3 f, ^& b
  72. ) e: `+ T7 W0 I5 n
  73. char *dmabufsrc1 = NULL;
    6 f# d7 x3 `, C  m
  74. char *dmabufsrc2 = NULL;
    ; [% e2 H# Q; L- Y* r
  75. char *dmabufdest1 = NULL;
    ) m/ d" i2 b5 C" p" F. {5 Q
  76. char *dmabufdest2 = NULL;
    9 L: ?/ }  c' A% J5 _

  77. ( ?+ D3 M* j! E6 @' K
  78. static int acnt = 512;
    9 }- g/ Q1 A0 ^/ m4 E
  79. static int bcnt = 8;: x8 S1 O+ {, j* [5 O" R% J% \
  80. static int ccnt = 8;
    4 a" t9 d. ?! c' ~$ f8 X# Q& a

  81. ) o/ a8 t. y) l5 {8 U
  82. module_param(acnt, int, S_IRUGO);( }, Y- B6 o# T% s! o. y
  83. module_param(bcnt, int, S_IRUGO);0 Q; t8 Y3 A1 Q7 E& v
  84. module_param(ccnt, int, S_IRUGO);
复制代码

0 M! m; s0 G: w+ p3 d: M4 ~3 `
& R! O! v; P/ z0 p* }! L      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
8 B- N' z# `1 Y. @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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
" {, d. t* {8 A3 Z     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。9 x5 n5 ^* P+ Y
; t0 ~' q& e7 p5 U+ T( u" N1 z

2 A" n/ s2 C+ h7 m, H! L
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2026-2-17 13:01 , Processed in 0.044517 second(s), 26 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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