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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑   g1 Y) g% A! F
  1. [code]EDMA sample test application* T# s( o" U3 R/ r5 P" U! A
  2. /*$ r/ f3 z& I2 F2 l; c, Z
  3. * edma_test.c5 t- X% s- h  b1 ~0 w
  4. *  ?0 M/ t4 f/ F  r, q& o
  5. * brief  EDMA3 Test Application
    5 V) @5 C/ e" {/ ^4 p+ {
  6. *6 @/ g4 x* y4 q2 \8 X3 G
  7. *   This file contains EDMA3 Test code.
    1 T6 h  e/ d2 `4 I3 N  g
  8. *
    , f' L9 P4 B0 R8 a* s5 c: ^0 `
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE* K) a$ z# E% T/ ?$ i# q1 I! c# q
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
    3 L; X! C6 S' `( V3 J% a
  11. *         TO CHANGE.: t' \: E1 H* x2 s
  12. *
    ' {  D; H/ s6 L
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
    # M, l( t2 N+ w+ t8 |; K* f4 U' m1 Z" m
  14. *( P, N, G0 d& `! f: N* z5 I3 z
  15. * This program is free software; you can redistribute it and/or* X8 X$ i2 t; L' ?4 |% @
  16. * modify it under the terms of the GNU General Public License as6 X# v. [* T" G' u; R& Z4 ]
  17. * published by the Free Software Foundation version 2.
    7 d1 X7 U3 ^' `  v: u; R; Z: m8 R
  18. *
    ( S" A# ]# r+ H
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any
    $ a6 [! H2 H# R% Y$ u' z
  20. * kind, whether express or implied; without even the implied warranty
    ' l* u5 p9 v5 \2 b) I
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    # w: t, v2 Z* S  s
  22. * GNU General Public License for more details.
    * _* u2 \* \9 }2 l
  23. */
    , T" k! r- X3 e3 g0 g1 B

  24. 8 D# M' H! I9 K
  25. #include <linux/module.h>
    + x7 Q: [* }. I$ C
  26. #include <linux/init.h>
    6 U! l; y$ d  J+ y
  27. #include <linux/errno.h>' V" Y& s/ G* Y/ c' L5 v# z
  28. #include <linux/types.h>
    / M3 u7 [4 b# x/ T
  29. #include <linux/interrupt.h>3 m" X) k* r8 Q% d
  30. #include <asm/io.h>
    ( r# ~$ Q0 b" v: z/ p+ s
  31. #include <linux/moduleparam.h>0 _0 u( E& c( r1 n- o* `& t6 X
  32. #include <linux/sysctl.h>+ K9 H4 W/ g; T; E( s% t, S
  33. #include <linux/mm.h>) r8 M( a& R3 {$ a5 @' A
  34. #include <linux/dma-mapping.h>
    4 a3 s  @$ W" h7 j3 L) I8 x4 |5 D

  35. ( S3 z" E# ^4 ]* j! J/ ~& E6 g/ p
  36. #include <mach/memory.h>
    - t$ N6 ^# k9 K. x1 {" B9 m/ X! d
  37. #include <mach/hardware.h>7 F4 j2 m8 F9 j4 p" f
  38. #include <mach/irqs.h>
    5 P( y& Z/ q2 ?- }& K- F
  39. #include <asm/hardware/edma.h>& d; J6 [& \( @  ]4 N* d# D1 M
  40. 0 X+ m& D& u2 h1 k+ V- s% Q
  41. #undef EDMA3_DEBUG
    4 z0 L0 T) l0 l2 U) d9 W; u' c# M
  42. /*#define EDMA3_DEBUG*/
    " ]4 L& }2 C' h6 N& t% e

  43. & z6 }, r* U+ e- P- j: W* H
  44. #ifdef EDMA3_DEBUG; u6 t* @4 b4 |/ Z* ~. j
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS), _! X% c7 k& b
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)6 v% w8 J6 y, H: k/ @8 t
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
    : [( w  ?% o* T3 b( }& |+ m
  48. #else7 v+ v/ I2 Q; P% Y8 X  B3 t
  49. #define DMA_PRINTK( x... )
    - w4 _' X- i( k
  50. #define DMA_FN_IN( H$ a: Q$ X" I9 o# R
  51. #define DMA_FN_OUT+ C$ f; J! ^& b, [
  52. #endif  y7 P8 I0 a% t# ?) w  f& F# w; l( C, @

  53. / k3 D3 s, Q( C
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)
    ( L% ~2 H( `* [) r$ g
  55. #define STATIC_SHIFT                3
    & e  B+ d# a' z$ a$ \
  56. #define TCINTEN_SHIFT               20% p8 y5 |  P$ P9 y0 m- S2 y4 ]
  57. #define ITCINTEN_SHIFT              21
    8 u2 g8 M9 A- `( p& }
  58. #define TCCHEN_SHIFT                22! {8 L% o  j) _7 j8 l6 S0 t1 h
  59. #define ITCCHEN_SHIFT               237 Y0 `4 r, A9 x7 n3 |

  60. ) c# z" \- E. m4 f8 x
  61. static volatile int irqraised1 = 0;5 _' z+ g* p' q/ g: J; p
  62. static volatile int irqraised2 = 0;$ R; [+ S! z- J4 v5 z2 _" a

  63. 9 ?5 f$ \5 a! P( b7 y, f
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    & n1 f8 E% _- j% ?
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);! E0 h: }' S& e1 \, o" |  A
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);3 l  ^6 R4 A/ ^- Q) R

  67. 2 {+ `0 u/ W! e. j
  68. dma_addr_t dmaphyssrc1 = 0;
    ! D8 w, K& m! g. L9 W! C% g
  69. dma_addr_t dmaphyssrc2 = 0;4 m* `+ F! C5 L( `
  70. dma_addr_t dmaphysdest1 = 0;
    - j; E: o6 ^9 v. \
  71. dma_addr_t dmaphysdest2 = 0;& J* Q. N2 d0 z9 C

  72. ; v. ?. b& E4 x1 U4 J; {5 ~$ j
  73. char *dmabufsrc1 = NULL;
    . [& u/ q! D7 p6 w1 m! q$ b# m) c
  74. char *dmabufsrc2 = NULL;
    $ e! {5 o+ z4 ^9 N6 L( O. }# Q
  75. char *dmabufdest1 = NULL;7 L6 V9 f: A8 ^' s# h: z0 \" @- a, z
  76. char *dmabufdest2 = NULL;
    + S# p7 e$ B; h* `' |

  77. , \2 h7 e5 d/ y! L* Q8 s$ ~6 I
  78. static int acnt = 512;  b0 h9 a* {- J0 T! P# B1 }- Z. c
  79. static int bcnt = 8;$ }  a. l- m0 H, Z: J
  80. static int ccnt = 8;" U% v( v2 E2 ?' o! ^3 i
  81. 1 V2 a/ n1 n  ]8 u6 o- R
  82. module_param(acnt, int, S_IRUGO);& @- h2 ]1 Q$ m% _/ |. \
  83. module_param(bcnt, int, S_IRUGO);# L$ w8 X( w" e. t6 \
  84. module_param(ccnt, int, S_IRUGO);
复制代码
% L' s8 G, C* j" O5 `2 V

# A& K8 U7 e) y0 g* H      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
/ b% N. n0 v+ y' w* zarm-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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。" \2 k2 T4 c* \' a* c4 f) R* N
     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
7 g, o  }4 r" d6 I/ J+ p4 g# p" p; O- P% G: m1 w
; d6 a+ ]1 ]' |3 ?6 Q/ z
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2026-4-27 22:27 , Processed in 0.043904 second(s), 28 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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