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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |正序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑 " u& Z2 ^, Y9 i9 {
  1. [code]EDMA sample test application1 m# \1 [. g, d, |0 ~' o6 ?
  2. /*/ a. l: q- ~2 q# G, S0 N
  3. * edma_test.c
    # [' D% W$ [0 u, X, l
  4. *
    ! b1 G, I" l& `7 O
  5. * brief  EDMA3 Test Application" _8 j2 G0 u- m1 L/ ~/ S
  6. *
    ) a9 U! U1 s5 O, f8 C
  7. *   This file contains EDMA3 Test code.
    7 h) u/ Q  _, G: S
  8. *
    8 Z5 {$ ^; n1 s
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
    4 H5 ^: W7 R: V  ~1 ]/ ?
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT& v* f; u, ]! s5 x7 k* ]1 I1 Z
  11. *         TO CHANGE.% C0 b& j# Q+ o) C4 ?
  12. *
    ( o3 K9 z  D& C+ d1 o1 ^) m2 `0 Q
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
    : @. {; F) T# z0 ]
  14. *
    * N  F& `3 C* m. B& k
  15. * This program is free software; you can redistribute it and/or' M0 q& a  ]$ r3 w# G/ x
  16. * modify it under the terms of the GNU General Public License as9 m5 p* W; ~+ \! e3 n( x
  17. * published by the Free Software Foundation version 2.- |6 Z7 _) W; }/ n
  18. *. P4 Y: r( W6 c2 ?) ^% S% `# E5 ?
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any; C( {' U/ v. R& W
  20. * kind, whether express or implied; without even the implied warranty& m- q! i; r& f8 I! @  U
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    . s6 o0 V) _- b) b! o
  22. * GNU General Public License for more details.3 ]5 Y# o( }* Z. Z
  23. */# \" C' j( x: U( p+ q1 m
  24. & F% w1 R) a) T8 s  s
  25. #include <linux/module.h>' b6 [+ N2 f( M1 r, Z, m1 `$ @
  26. #include <linux/init.h>
    . g9 h. K. a! `3 x9 e
  27. #include <linux/errno.h>
      G9 U# b2 p+ {- O/ P/ a. E
  28. #include <linux/types.h>0 a7 ^/ C! M$ w* ~
  29. #include <linux/interrupt.h>0 T( p2 z9 c& T
  30. #include <asm/io.h>5 y2 r) r1 L5 ]) R- [, E8 [& R* O0 a
  31. #include <linux/moduleparam.h>
    ) O/ }. d, p- C$ B7 F) f% D
  32. #include <linux/sysctl.h>3 C# `1 W7 ^6 a% |; z
  33. #include <linux/mm.h>; o  h3 T  q( W: ^$ P
  34. #include <linux/dma-mapping.h>4 B, e8 }) p: k! H

  35. & t4 N, h$ O$ \( c+ Y, d9 }( \% |
  36. #include <mach/memory.h>
    & p& I* \8 M% t+ U+ Y& f
  37. #include <mach/hardware.h>1 h: U# w4 Z- y& J" V( c8 U
  38. #include <mach/irqs.h>
    - U0 Q) \+ Y* n+ E1 K0 Q
  39. #include <asm/hardware/edma.h>
    / a1 y* s( d. C2 P
  40. - U1 R1 y$ N/ A1 l" B1 _) n! J
  41. #undef EDMA3_DEBUG3 T' A( P6 R( b2 v6 B+ F
  42. /*#define EDMA3_DEBUG*/
    " ]$ Z6 R( ^9 Q- X, i! `( y
  43. 7 S. V( X  B+ b  K
  44. #ifdef EDMA3_DEBUG
    ! w4 Z0 `3 E1 g& T4 }# s8 [
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
    0 H2 u+ `4 m. M" l- u$ M+ f
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)7 u0 D; T% H) S, c3 A
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
      r3 H$ ^" J$ g  @# k6 W
  48. #else$ \& [" {& c5 `4 F
  49. #define DMA_PRINTK( x... )( E* ~* G, U  O/ g# O4 P
  50. #define DMA_FN_IN
    5 @  r6 ?+ ^# w+ z3 B) j" _* y
  51. #define DMA_FN_OUT( B# s. D. o- M$ p* D
  52. #endif
    0 }- |+ l! \* {7 `9 c- a, c7 a

  53. : d% ^$ J$ d. A" y5 ^) x
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)
    ' H' r  G& \8 ~. ]% M/ a
  55. #define STATIC_SHIFT                3" q. }# B8 B( D5 x7 ?
  56. #define TCINTEN_SHIFT               20; R: U' |3 i; R8 {  I
  57. #define ITCINTEN_SHIFT              21
    # P5 C" M! U+ ~" t( a
  58. #define TCCHEN_SHIFT                224 |' i' E, e: M" Z" X: \% X
  59. #define ITCCHEN_SHIFT               23: H$ w  T9 y/ V0 U
  60. 3 ~5 W. _* V/ _' [& `7 `# t: t8 z/ @
  61. static volatile int irqraised1 = 0;
    7 o* M4 f, K* q
  62. static volatile int irqraised2 = 0;" {! h3 T' w/ o
  63. 7 `& d/ s. r/ y0 b7 M
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);* Z+ o; p2 \+ `
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);; X( }1 H6 ^5 g# J$ @" u1 t
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);  x% A/ ?, K: x- R9 S

  67. 5 x  _4 x3 v9 \( r4 o5 q
  68. dma_addr_t dmaphyssrc1 = 0;
    ; b( {2 J; g' x. a1 `8 x' k" S
  69. dma_addr_t dmaphyssrc2 = 0;
    9 v7 w: U# D1 M, T0 z
  70. dma_addr_t dmaphysdest1 = 0;
      N$ b$ H/ L/ E  C, Z& F
  71. dma_addr_t dmaphysdest2 = 0;1 j, t! z. F8 l( @  b. {) X
  72. / L9 |& u9 s4 b4 P
  73. char *dmabufsrc1 = NULL;
    , D2 q! V& [+ d6 v, Q) ]! Q2 |: `) z. `
  74. char *dmabufsrc2 = NULL;
    " A8 [; g, Z9 {- _8 }
  75. char *dmabufdest1 = NULL;
    " Z  U% r0 h: G' N$ C
  76. char *dmabufdest2 = NULL;! H/ m  f6 |  z# f

  77. + r: q- w8 {8 Q8 E6 ?
  78. static int acnt = 512;$ @/ m+ f( ]- i7 m' x
  79. static int bcnt = 8;: n/ m3 ?8 M! d3 [8 m4 v
  80. static int ccnt = 8;+ ]* e) t9 @2 L1 [8 ^/ Q
  81. & h+ d7 H5 g* S0 R
  82. module_param(acnt, int, S_IRUGO);
    9 l2 |8 [2 Q5 `! H5 g4 f1 t
  83. module_param(bcnt, int, S_IRUGO);" W7 w' b8 I" C; z' k3 c
  84. module_param(ccnt, int, S_IRUGO);
复制代码

0 g( n  Z" h, {8 d* y6 H
: X; T# |* {: g0 q- w      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
  I' O9 k3 r9 d/ Sarm-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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
! _1 E0 r: L/ r     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
0 n; ]. p- l4 V' Q6 n% M% c& e6 D8 c9 B/ C

+ l4 }  Y; n2 b/ m8 t
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2026-4-7 22:08 , Processed in 0.048761 second(s), 26 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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