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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑
$ c: X! P- W8 r3 Q
  1. [code]EDMA sample test application
    6 h" W: L- o( a2 ?1 U& D- ?) L3 C$ C
  2. /*
    ' E# C4 D8 @, z& b) X  @. m; p3 H
  3. * edma_test.c" [8 a1 ^. ]' l8 S* R
  4. *0 U# ], v* D9 W
  5. * brief  EDMA3 Test Application6 T2 W8 G# b' d& E. j
  6. *8 @9 \# ^1 ~4 U
  7. *   This file contains EDMA3 Test code.0 r' z5 m  J5 m/ v: w
  8. *
    8 r  b9 b$ S$ J+ F- |* A1 L9 j
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE% V7 U- [  \! b- c: E
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
    ( d- ]7 z8 q* ^9 @) \4 V* m
  11. *         TO CHANGE.
    0 W7 N5 b* b' Q% I2 |
  12. *' P4 w# P2 \2 |+ ?* e, l2 ~
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
    5 x& R: M5 u. n4 }- ?
  14. *
    3 O' k3 M+ V) A2 w0 D
  15. * This program is free software; you can redistribute it and/or
    * [$ P6 G0 U+ B% @# ~% ^
  16. * modify it under the terms of the GNU General Public License as
    5 s" V: _3 @' K! R$ U6 r
  17. * published by the Free Software Foundation version 2.! L# ?7 L( Q0 P. O! D  o
  18. *- H6 C1 l( c1 o* H% P4 Q
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any5 F/ p- o8 @. E4 B
  20. * kind, whether express or implied; without even the implied warranty
    ( @9 o- D+ G  N& Z- E
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the- n0 f- y9 E+ }! ]9 ^9 c
  22. * GNU General Public License for more details.
    : l- B+ P! u: Z
  23. */
    1 M0 l9 B1 d: I. k: h- S- y5 C

  24. / H7 s2 _: V" d" E& x+ q
  25. #include <linux/module.h>$ F' ^/ Z* a4 e5 e" f
  26. #include <linux/init.h>
    : l) v6 [/ C* a1 w
  27. #include <linux/errno.h>% V5 n% n- M% p& p
  28. #include <linux/types.h>  m) A! k3 V6 ~. G: B
  29. #include <linux/interrupt.h># D+ m, U  M7 ]1 l& |# o. Y0 m# Q
  30. #include <asm/io.h>/ H, I5 b8 {) v
  31. #include <linux/moduleparam.h>
    1 r9 ~' B+ U) G+ \% _) \( _' h
  32. #include <linux/sysctl.h>
    2 o: ~; T5 U# c0 Z, ]
  33. #include <linux/mm.h>  w5 t6 A5 k: j) {8 u- R
  34. #include <linux/dma-mapping.h>" C: I$ ]9 G8 b' {* ^% ?
  35. 2 Q. q* S: w- G3 p3 v0 V
  36. #include <mach/memory.h>1 b. P+ J% Y; x% {! ?
  37. #include <mach/hardware.h>
    6 R/ C8 m+ e* N4 ]6 q9 c* h+ Z+ Q
  38. #include <mach/irqs.h>
    0 c* o1 A. t& A+ h* A$ [
  39. #include <asm/hardware/edma.h>* o1 ]/ \( i. B8 o- L- }$ R# I
  40. 8 ]. B) n3 O& u  S  y7 D1 o
  41. #undef EDMA3_DEBUG
    & s/ Y5 c) P4 ~3 J/ B/ h. O5 \
  42. /*#define EDMA3_DEBUG*/
    ( L5 k  R& f& Q$ p
  43. 4 \3 B3 u; ~6 T, S7 ~# ~
  44. #ifdef EDMA3_DEBUG
    ! B) c. G' n4 I, k3 C  z$ F
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)" F4 y6 q8 F( c7 B% r) F/ n
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
    . n1 m0 B0 f/ Y$ \/ p+ a: a
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
    / F. r* v/ d& j7 f+ X4 V
  48. #else
    8 c; A0 R$ \3 W0 j
  49. #define DMA_PRINTK( x... )
    6 y4 C* m# e# b# o# X* Y, @
  50. #define DMA_FN_IN
    7 K- n) u2 R8 k; Z/ m3 n8 H
  51. #define DMA_FN_OUT
    $ T0 l9 X8 p, Q) t; U& j
  52. #endif4 `( y% Q" L7 |7 w: t3 t3 ?

  53. : Y* w6 W+ l$ i1 l# m( d
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)
    % `& H- A6 W9 k5 ^: }
  55. #define STATIC_SHIFT                30 M7 S9 ?" |( j* o1 @* O8 B
  56. #define TCINTEN_SHIFT               20( E: s* K; s4 N$ D4 Y; S0 c5 w
  57. #define ITCINTEN_SHIFT              21
    ' V4 M8 L& D: q- @0 @
  58. #define TCCHEN_SHIFT                22- U8 I5 l/ J8 V, R
  59. #define ITCCHEN_SHIFT               23
    , r3 K/ n- b8 Y' l  h
  60. ' Y6 r( w+ C$ u3 E; y# t
  61. static volatile int irqraised1 = 0;
    0 K$ m. B8 g. m  m5 q  r# k6 T
  62. static volatile int irqraised2 = 0;
    ; u9 n' [2 h5 \; q* X; g5 a

  63.   E! b& H' Q0 N, Q8 B
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);- g% y+ R5 a, d4 ?+ j
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    * a9 l# I; X  m9 I4 z- J- @5 k
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    . W, A; N. |, P( a: l8 a4 p

  67. ' o& w4 e3 O" ~  q$ D0 {( T
  68. dma_addr_t dmaphyssrc1 = 0;
    5 [0 r& v0 ^+ d( i$ g
  69. dma_addr_t dmaphyssrc2 = 0;
    3 _' n  H$ j' m1 \
  70. dma_addr_t dmaphysdest1 = 0;* Q( ~% k2 d  J4 j. F
  71. dma_addr_t dmaphysdest2 = 0;
    : u$ s2 V$ c' o

  72. 7 w0 g' P9 `, R7 _
  73. char *dmabufsrc1 = NULL;1 Q- l5 Z: l4 ?3 V
  74. char *dmabufsrc2 = NULL;
    $ `) t4 `1 y- r/ ?4 y
  75. char *dmabufdest1 = NULL;
    ! _6 ~3 e0 j; F: s5 K: l: v
  76. char *dmabufdest2 = NULL;0 L6 c' r& A  [1 \0 `

  77. $ B% d+ V; y% \- I
  78. static int acnt = 512;/ f' p; Y( |2 ^6 a0 e+ e
  79. static int bcnt = 8;4 ]- \# ]8 K# M. ^$ k2 ~
  80. static int ccnt = 8;8 b- C$ l' C7 E4 D
  81. 4 K& a% Y( J3 I2 q' u% Q
  82. module_param(acnt, int, S_IRUGO);9 d( ~- `4 G3 v& C4 _. i# R! ~: ]" `
  83. module_param(bcnt, int, S_IRUGO);; t9 R% @8 ?, ~; y, U' x# l
  84. module_param(ccnt, int, S_IRUGO);
复制代码

8 L* h% j8 |7 `/ B% n' x
9 a& n3 N4 w; y$ @      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用' r1 [* f. ^( n% K
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
1 O) F8 L, e' T3 ~3 j( C     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
9 D) e  l0 P7 L0 n! w# o! |* |5 r" x2 Q: ]9 G& n. f  ^

5 ]2 O8 Z  ]- N! D: u% R0 J
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2026-2-18 15:00 , Processed in 0.041653 second(s), 26 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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