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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑 , g' E/ S" D7 R; f5 e
  1. [code]EDMA sample test application" l" ^. y5 e& j7 \: g
  2. /*
    8 q8 c3 i5 c& R$ _9 P: e" F& {
  3. * edma_test.c
    ; \  ~+ C% C5 b; E
  4. *; c$ r+ A- S0 P$ I6 Y  E
  5. * brief  EDMA3 Test Application
    " P# F) H# B4 g# r
  6. *
    ; f, Z9 c9 i3 e4 ?
  7. *   This file contains EDMA3 Test code.2 p  f. C1 K7 m" L& H
  8. *
    3 r' V: X% A/ Q3 f5 [. }- q8 Z
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE2 g/ H% B5 m8 E( k- s. c
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT. ~/ X$ x% C* W3 c! @# G
  11. *         TO CHANGE.
    2 y' \$ ^. x3 ~
  12. *
    . o4 Q- D* a; |+ V' a
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
    * N* o8 k0 s' ]. Q
  14. *
    - Y4 O# _: ^. c9 K% V
  15. * This program is free software; you can redistribute it and/or
    : U% p, T- v/ K3 g8 z* i7 D
  16. * modify it under the terms of the GNU General Public License as$ K( `6 |: R. n9 t
  17. * published by the Free Software Foundation version 2./ Q* L! u" v, Y1 D! U) ?2 o3 k
  18. *; j, e" x' G  N" `$ N- s# ~
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any' u+ u6 o* \4 F2 g* ~& S
  20. * kind, whether express or implied; without even the implied warranty; A6 {  |+ O6 i! |/ N
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the$ G" l* P9 u; {0 F3 o4 w' T. j% f2 V
  22. * GNU General Public License for more details." m  Z4 l* ]9 h1 d
  23. */$ {, b) T1 E' x2 c* r  M5 U( [
  24. $ J8 }. j" v! ?
  25. #include <linux/module.h>: Z% w4 I) {/ h5 [1 J6 N
  26. #include <linux/init.h>
    2 ?. h, b* H% H; K4 O
  27. #include <linux/errno.h>. O  u0 j' s( K1 w2 U
  28. #include <linux/types.h>
    8 s" R4 n0 x/ Q. u) C
  29. #include <linux/interrupt.h>2 d. p' r& [- |: f4 l
  30. #include <asm/io.h>
    9 H5 P9 q% A0 L) y2 l
  31. #include <linux/moduleparam.h>0 V( q( D3 w. u6 Q  s$ N4 E# n8 S
  32. #include <linux/sysctl.h>
    ( z9 n. m2 f6 l# D
  33. #include <linux/mm.h>7 O: Z) J6 ]3 b: t# N
  34. #include <linux/dma-mapping.h>
    " S) H: w0 k# f! {7 g* K
  35. 5 }- R0 J, r6 {+ }7 ]. F3 d: F
  36. #include <mach/memory.h>9 E$ |' g8 W+ }+ T; _: L
  37. #include <mach/hardware.h>
    # u! \$ I9 q' a  v* P# W
  38. #include <mach/irqs.h>
    0 b/ ?7 f- X- D7 `- m% r
  39. #include <asm/hardware/edma.h>
    ! l% e1 b& k7 @1 f" y
  40. ( \- E3 x& \0 ~4 q; x
  41. #undef EDMA3_DEBUG# O/ b; o# f6 @) Z$ x: t% y' z
  42. /*#define EDMA3_DEBUG*/& b. u3 s1 l7 a) ?. l
  43. 4 F- A# _+ K5 ?
  44. #ifdef EDMA3_DEBUG
    2 F  u! x& ]3 e0 `: A$ M0 Y
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
    3 D" e5 J+ a' q$ y0 p( K
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__): a9 v; k- h+ D' _6 q9 \
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)0 w  t& T0 ~( s
  48. #else
    1 W# m; G/ Z3 q9 N
  49. #define DMA_PRINTK( x... ); q1 F" f. p0 M4 M
  50. #define DMA_FN_IN/ l! ^3 s" e4 A# b
  51. #define DMA_FN_OUT
    5 a# Y5 O& I6 P) u+ m* ]8 ]
  52. #endif' R. G; S2 p8 q+ y# _

  53. + E5 j# u8 D8 E- f  _6 b
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)" d4 d1 T9 p) ]- w* t. o
  55. #define STATIC_SHIFT                3
    + X. s# ~; F! ^6 e6 U, h
  56. #define TCINTEN_SHIFT               20/ S  ]- S. j! ]. A* o7 `
  57. #define ITCINTEN_SHIFT              21
    3 T( X: i9 x/ P  w
  58. #define TCCHEN_SHIFT                22
    8 l7 V+ m4 |3 K+ }
  59. #define ITCCHEN_SHIFT               23# ]. v: ]4 _  e( l( i& g2 q% \
  60.   t  j$ N! o4 I* c( l0 t; n: q
  61. static volatile int irqraised1 = 0;+ n+ G( ~: r8 O
  62. static volatile int irqraised2 = 0;6 f1 Z$ D7 O4 C6 S% T' q0 P7 r. T! n

  63. ! j' T& y; q/ \! J8 i% X
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);' u0 A7 l3 i* t3 K
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);/ I" O4 L4 v" d" Y
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);# |. j2 q" X( g: ?6 l6 @

  67. " t5 H+ `) h4 A# E" E
  68. dma_addr_t dmaphyssrc1 = 0;9 p% [$ R; d% B' F0 N
  69. dma_addr_t dmaphyssrc2 = 0;
    4 ]3 y6 i" M0 F( b7 X# h9 d0 J+ E
  70. dma_addr_t dmaphysdest1 = 0;% I( R5 W8 W, ~) J
  71. dma_addr_t dmaphysdest2 = 0;) e# A) `$ j/ X

  72. 9 \$ [5 |% u3 [
  73. char *dmabufsrc1 = NULL;" _& O4 ^* ?/ D5 x, X8 l: k
  74. char *dmabufsrc2 = NULL;
    5 Y6 s# L! {* U* s( [4 _7 Q3 R0 l
  75. char *dmabufdest1 = NULL;
    8 c6 a1 r0 A, @$ c
  76. char *dmabufdest2 = NULL;' c6 e+ f6 t! ~- Z# r' {6 z

  77. ' f4 {; H! V) e+ V
  78. static int acnt = 512;
    . k  Y0 j! R0 r5 t: l" o7 e
  79. static int bcnt = 8;
    ) Q/ u1 X0 s) I# b& h$ o
  80. static int ccnt = 8;
    3 t) h8 U, W: H7 S5 R4 J# {3 P9 J* Y

  81. * ]' Z' u" i/ r; y
  82. module_param(acnt, int, S_IRUGO);/ @8 N+ E+ p/ r/ N0 R# D# R
  83. module_param(bcnt, int, S_IRUGO);3 x4 ?& L3 n5 J' Q; \, `0 }" h7 S* K
  84. module_param(ccnt, int, S_IRUGO);
复制代码
# D/ M- m- |7 ]3 q

. k; i# w) G% F+ Q$ v      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
9 [4 i5 n  S  a" varm-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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
) k. ]& V& B1 j) T/ J! P- M! F     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。# R% f, @) d4 N) q7 N9 }/ e

6 v6 P3 }: @+ ]& [; n
* p0 X( [, S# g  o8 z% y
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2026-1-14 19:07 , Processed in 0.046819 second(s), 25 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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