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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑
3 }3 p; e% R) V0 D
  1. [code]EDMA sample test application' O2 j) I/ }. e: u$ `" Y: l, {! o8 _
  2. /*
    + P% r7 `5 l8 @4 Z
  3. * edma_test.c
    ! F: w1 o- {* t, d' |% t5 ~
  4. *# ~) a  c- L/ c. x
  5. * brief  EDMA3 Test Application: t5 j! k( F* U1 @2 Y2 l
  6. *8 r! q$ f! ^! |5 |
  7. *   This file contains EDMA3 Test code., t  B: y: D% q! p8 a; O
  8. *' y/ h% o0 |3 W# ]
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE: c' J7 x% N$ s! x
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
    & O  S7 T8 s2 i+ Z" g3 P
  11. *         TO CHANGE.
    ) d; @8 K, I9 U' U) ~
  12. ** Q5 b( r9 C( Z; n2 q( l
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
    8 U- v1 \* A, h" B2 B2 M; L
  14. *' a3 X! v9 y2 k" o
  15. * This program is free software; you can redistribute it and/or
    ! L8 D8 h6 _, D  `+ j7 W
  16. * modify it under the terms of the GNU General Public License as
    & q* Q$ L/ p' r& @# H& |
  17. * published by the Free Software Foundation version 2.
    6 Z% t. Y" u/ K$ Y) |; F
  18. */ N3 X' e$ a( {, ^
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any
      C- t& T1 K' X3 f. q
  20. * kind, whether express or implied; without even the implied warranty
    2 q. u% A! H- _% E" [7 e( v
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
      a/ b) e3 O0 a6 @8 k
  22. * GNU General Public License for more details.
    ' k& p7 B) ?, h; m, J
  23. *// r+ o9 j! C" V

  24. % W0 o" Y6 z" \
  25. #include <linux/module.h>" M! [  x+ ], c( X9 p$ @" h. G
  26. #include <linux/init.h>
    " i. W5 z  o0 w4 ]+ {9 S, x* K; J
  27. #include <linux/errno.h>2 ]( {, k6 U! u( b1 z+ `+ d
  28. #include <linux/types.h>8 e- J% e' w* p) J
  29. #include <linux/interrupt.h>
    ( U2 c$ h% Y* M: x0 J$ E5 _( K: N: g; t
  30. #include <asm/io.h>" t6 A' q4 y9 }: K# V$ D8 }
  31. #include <linux/moduleparam.h>
    8 x/ A" S8 n4 c2 X! M0 X
  32. #include <linux/sysctl.h>
    6 P! L$ ^9 r7 M
  33. #include <linux/mm.h>
    6 a  N5 _% [& Q! G
  34. #include <linux/dma-mapping.h>
    ( ?/ R9 k4 s7 z, {) I2 u

  35. * |/ B/ |  ]3 a2 K+ O7 K8 g/ h8 m
  36. #include <mach/memory.h>* C% ~$ v7 P! P& H/ G$ X7 ?
  37. #include <mach/hardware.h>
    # c) k  R  K) \5 f0 f
  38. #include <mach/irqs.h>
    5 v+ [5 P- B! S+ m" F
  39. #include <asm/hardware/edma.h>
    ! t' ?, s; l' O. _- z% e, \/ n
  40. ) g! ^% b  v8 w7 Z  X5 e
  41. #undef EDMA3_DEBUG9 r- k& i- y6 Q
  42. /*#define EDMA3_DEBUG*/
    " A$ J& ]6 S6 F. O  o2 w# a
  43. 1 f. ^" E% _  ~# i! f2 U
  44. #ifdef EDMA3_DEBUG, F3 k) _% q. q5 Q  S# v$ W1 s
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)- |5 M# S4 W- o4 @8 O6 }3 u, G
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
    / S8 L/ z) W4 O' `) @2 i$ r
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)5 `8 y1 q3 q9 h. D9 L/ k
  48. #else. @8 }* e( a2 ^  J) }' |6 s
  49. #define DMA_PRINTK( x... )) |& E$ |$ u% U# r" c0 A5 a
  50. #define DMA_FN_IN
    8 l# V" y7 h1 v
  51. #define DMA_FN_OUT
    $ y8 F9 ?1 o6 m0 d, f
  52. #endif' D3 K5 ~( @+ w. Q

  53. 1 ~% ^2 r- Y9 Y5 \
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)1 C, ?" g3 c' O9 ?4 P/ f& q' W, ~
  55. #define STATIC_SHIFT                32 c$ ?, f9 ?+ j$ {1 X' b  g+ F/ L
  56. #define TCINTEN_SHIFT               20$ B4 Y- q+ I! ]
  57. #define ITCINTEN_SHIFT              21. S) n5 N4 b5 b; u  U( ^
  58. #define TCCHEN_SHIFT                22) b5 r7 _! I( g, o: R2 c
  59. #define ITCCHEN_SHIFT               23
    2 g& t. ~* ^8 K+ W! u$ O. Y& O* n: d

  60. ( S. U6 X/ S2 B% \
  61. static volatile int irqraised1 = 0;
    ( v2 H/ g# P6 x% |* G
  62. static volatile int irqraised2 = 0;
    6 }. k6 i, b9 j- B

  63.   K: a1 F# T( D7 G% l; ^6 W
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);# k; R. H' }: p3 y
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);1 q' ?  z& y. p7 U
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    % @: `) c' d$ W7 g# s

  67. / q+ Z, H. d) C5 b
  68. dma_addr_t dmaphyssrc1 = 0;
    % `6 S& T3 _* Y
  69. dma_addr_t dmaphyssrc2 = 0;
    4 U$ h4 o7 B) ?- a- _$ m4 g
  70. dma_addr_t dmaphysdest1 = 0;
    ' R, G7 t2 c: K! r# E# S$ K
  71. dma_addr_t dmaphysdest2 = 0;
    & o; E# l; T1 ^5 J5 P8 E

  72. 0 f. b- l# g1 x6 e6 B% Y* i
  73. char *dmabufsrc1 = NULL;
    . D% ^, ?! @/ a$ ^* l
  74. char *dmabufsrc2 = NULL;" Z7 ^. Q  u  j: v& m) |; X
  75. char *dmabufdest1 = NULL;
    * c' C7 ~5 z/ v. P  d
  76. char *dmabufdest2 = NULL;3 q9 D3 K: c  `( ]* v

  77. * r' ]' |: G8 X8 _' ~
  78. static int acnt = 512;$ |  S4 }! D9 s
  79. static int bcnt = 8;
    - H7 g0 M& {8 ~8 m9 O* S5 H
  80. static int ccnt = 8;  B# }! W/ h/ z2 g: o& Y

  81. + Q4 _4 P! V( _2 F+ F+ t
  82. module_param(acnt, int, S_IRUGO);9 M3 Y9 f# X0 T
  83. module_param(bcnt, int, S_IRUGO);
    8 _# ^- g1 k& Z% r4 y+ H
  84. module_param(ccnt, int, S_IRUGO);
复制代码

& V4 c. g! X4 D' E; N4 v% o) J4 O3 g' E+ x9 q. m  T# k$ P
      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
* I5 U9 `, h2 a, karm-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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
' H3 \# a2 x% l  Q     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
9 p1 H" S3 i: R/ B3 K' T& F9 c8 q% {+ B3 W

. U0 X/ {; E) A) S% G
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2026-3-21 13:55 , Processed in 0.046149 second(s), 28 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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