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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑
4 L2 ?) h! l/ s4 S4 x2 j
  1. [code]EDMA sample test application
    4 C3 \, R6 g+ G5 ]: K  H
  2. /*
    $ h0 n1 q& v4 o# d6 P% c
  3. * edma_test.c
    7 z/ z0 ~; D& R5 Z) H% `
  4. *( K4 O, R2 H) L  U' h
  5. * brief  EDMA3 Test Application
    0 T, ?6 J. \& x3 g' ?* [5 W: a4 k
  6. *
    8 u2 x3 R' H+ N1 I5 ^
  7. *   This file contains EDMA3 Test code.
    " C( o1 z# Y; n1 q4 ?0 }
  8. *+ h5 W, ^5 p, C( ^% _: X
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
    / O, F/ k* b' D" ^/ ~
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
    . ]0 q9 E. N% K5 a$ M. ~
  11. *         TO CHANGE.
    # L" _& w+ W1 a- ^* X
  12. *
    3 v* @- C5 ^; B1 I
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
    ' R+ Z  I5 c) x- |$ I
  14. *
    # }3 w$ g% _3 m/ R1 b# M
  15. * This program is free software; you can redistribute it and/or" \, \6 y  p- [" Q* B
  16. * modify it under the terms of the GNU General Public License as
    2 \; U! m$ V2 L7 B, }/ ?! n
  17. * published by the Free Software Foundation version 2.
    ) V, R' ?8 C4 h
  18. *
    ( [0 K0 r9 Z2 T/ Z/ X& {/ J  y% x
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any7 w4 A7 w0 b, _# r2 Z. o
  20. * kind, whether express or implied; without even the implied warranty
    # c- I' L% v* |2 F& {" Y
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the+ E5 ~# S; r/ ~! @- u
  22. * GNU General Public License for more details.3 X7 _4 a4 N7 t3 p
  23. */
    8 r, u  }- x# U2 ~
  24. * J. [6 s% U  Q& j' M& D9 m
  25. #include <linux/module.h>+ `! G; }2 U& H) r! H# ?1 w
  26. #include <linux/init.h>
    ) U& D) {" k7 O* H0 [7 W- _
  27. #include <linux/errno.h>
    7 S8 A7 [+ c( l$ d, n
  28. #include <linux/types.h>- b' ^+ o* h* t, Z! ]
  29. #include <linux/interrupt.h>- ~  [% U7 Z# Q8 j$ u
  30. #include <asm/io.h>+ \5 c. t. I" [! T+ n9 y( z
  31. #include <linux/moduleparam.h>; l) S8 O" Y& v( D$ L& I5 A
  32. #include <linux/sysctl.h># h9 f& T! P& C9 U* V: b2 d
  33. #include <linux/mm.h>
    " S- G) A: Z1 f+ ^( c6 y! x
  34. #include <linux/dma-mapping.h>5 r! W: p+ V. V9 _% r( W

  35. 9 C# \$ P& o5 W6 b. w
  36. #include <mach/memory.h>. z% Z! K- J+ L- \5 [3 t
  37. #include <mach/hardware.h>" ]( _  r2 ~7 N$ t- d# o
  38. #include <mach/irqs.h># L3 Q% y" c% H9 s1 C5 k
  39. #include <asm/hardware/edma.h>
    7 f. P$ y1 }5 r- K- ~. T

  40. 2 u# e% Q, @6 _9 k, |$ ?, d
  41. #undef EDMA3_DEBUG
    / @, p- Q) E* `. T/ V: `4 W3 Z
  42. /*#define EDMA3_DEBUG*/; ?0 z; E4 U. ?) H

  43. + P+ h. _- H. X. l
  44. #ifdef EDMA3_DEBUG
    - E5 F( |* d% Z0 Q2 k* b% C& G  A
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
    3 W( p" N' O5 s" n+ r7 R4 k
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
    ' a; G3 k! [$ Q- ?0 y
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
    ; W& @% H9 f* [5 b
  48. #else: V8 `) v5 m/ `. M* _
  49. #define DMA_PRINTK( x... )
    : E) p4 m; J9 Z% P2 Y0 `9 N
  50. #define DMA_FN_IN
    7 @  n& G# E/ A3 Z
  51. #define DMA_FN_OUT
    % E. j+ i, i7 {" V
  52. #endif
    4 f$ ~- v- ~; s2 W+ Y# }/ i/ S) y

  53. & \8 w& j8 h6 m# E! _) P/ x3 x; j1 @
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)
    7 y2 m: |$ t& S3 u4 v; `+ Z0 b5 E
  55. #define STATIC_SHIFT                3
    ( n. T& f3 I9 w9 }3 @
  56. #define TCINTEN_SHIFT               20
    9 @4 q9 q6 S: X
  57. #define ITCINTEN_SHIFT              21: w1 W; [; l9 `& @6 {8 _
  58. #define TCCHEN_SHIFT                22
    5 k1 W8 v/ i& o. h) \0 t0 I# U
  59. #define ITCCHEN_SHIFT               230 y3 {$ T+ r4 H% d
  60. 0 n, b$ I8 O6 z6 W( ]+ y
  61. static volatile int irqraised1 = 0;
    / W) W( V' b, X  K0 L
  62. static volatile int irqraised2 = 0;
    8 S8 t9 ^+ `7 ]

  63. 9 N# M' X9 ?5 z# L7 f$ _( s. x
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    5 b3 Y) I: R1 ^( \: m( ?5 g3 n
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    4 ?5 N3 S$ f) _5 @
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    8 a6 ~. s0 a! [7 T$ x$ E/ q6 g+ d
  67. # z3 k9 K! d6 p7 z1 e4 `5 @
  68. dma_addr_t dmaphyssrc1 = 0;; x. m5 a; N9 E- U; N: L' C
  69. dma_addr_t dmaphyssrc2 = 0;
    9 L' \8 z9 M) v; [
  70. dma_addr_t dmaphysdest1 = 0;+ b# E1 q1 p* n2 P1 k! p
  71. dma_addr_t dmaphysdest2 = 0;: {. g. ~0 b8 O6 r* v

  72. 8 [  I7 r/ O7 ?& t. }- P
  73. char *dmabufsrc1 = NULL;+ c' P! Y! q0 E; Z4 n% R. ^
  74. char *dmabufsrc2 = NULL;
    9 X( w& |: {) c" k  A6 P
  75. char *dmabufdest1 = NULL;
    & ^8 N" Z( f2 O2 G9 Q4 D( a" c: i. F
  76. char *dmabufdest2 = NULL;
    5 v8 u/ B- d5 }: ~; t: e! @
  77. , K9 s! N5 V" E) b7 L
  78. static int acnt = 512;
    3 Z) J5 e8 M+ E( {7 Y* z5 D
  79. static int bcnt = 8;. l# y! ]4 w# t/ N$ t- j, k
  80. static int ccnt = 8;, x, {# b; x$ @3 z

  81. % Y1 P9 M, t& H, T
  82. module_param(acnt, int, S_IRUGO);5 Q3 e! y% b. G4 t. i1 L+ R
  83. module_param(bcnt, int, S_IRUGO);
    ! }* B6 l% _, q& _2 P' p% i
  84. module_param(ccnt, int, S_IRUGO);
复制代码
) ?( t/ H* f2 J: s, S, K! _- \- H

, G) [  h; h0 a( h1 L% ^- ?      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用# M% p" ?* h! J; \0 b
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
# H+ T5 g$ q: `9 e, p2 r     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。3 A) N; y5 @0 k

/ R7 A* C% X) T# Q" k) o! a( j8 G! C& S0 R: q* U; O/ H/ D& D( f& T
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2026-2-12 01:54 , Processed in 0.039551 second(s), 25 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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