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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑
% n, G8 p: j; F! Z! S" t
  1. [code]EDMA sample test application6 |$ E5 g3 L( ?) N! Y
  2. /*
    8 l/ q0 S' j2 f/ ?3 k: O
  3. * edma_test.c4 _# k+ H; M" n. Y
  4. *
    3 ?# y  X6 Y  Q
  5. * brief  EDMA3 Test Application3 C' d7 X' |2 E
  6. *
    6 ^# D$ ~. M; K( a% I6 r
  7. *   This file contains EDMA3 Test code.
    3 q  W5 c; N5 {! t5 X
  8. *
    1 q+ |9 q( ]) O* v' l1 M1 Q. v
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE) t+ |! L/ [: }
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT- {8 }0 ~" M" o' b3 b. c! ?1 J
  11. *         TO CHANGE.8 g0 U! L- j% ^
  12. *
    6 b% f. G( M8 M$ `) k+ v
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
    & ~& ^3 g& o, ]# ^( i
  14. *  L8 q5 p  `3 r$ |' l5 c+ W4 A
  15. * This program is free software; you can redistribute it and/or
    5 }7 p: k' s( P5 `9 R: q7 U
  16. * modify it under the terms of the GNU General Public License as
    9 W2 R  v+ }6 I" l, t
  17. * published by the Free Software Foundation version 2.% `$ p/ q" R- k8 Y
  18. *
    8 S2 u& u0 T) I2 Q% S3 j8 ~% b
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any
    1 L( q& x2 Z2 ^9 x  h! \
  20. * kind, whether express or implied; without even the implied warranty
    9 Y1 y* B. @% ^- c
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the1 n. N: D5 d+ O: F( S
  22. * GNU General Public License for more details.
    . g# Q8 H$ p& v. x8 }& \/ ~
  23. */% E6 ^& i& }4 }$ B4 \

  24. 5 ]4 k; X3 B7 H8 u9 R
  25. #include <linux/module.h>
    : {% c; p5 X; J# n6 G
  26. #include <linux/init.h>* H/ I( C$ L5 y( ^
  27. #include <linux/errno.h>
      Z8 I  r* J) k, F6 y
  28. #include <linux/types.h>
    7 `& _* y+ f) I# T$ A
  29. #include <linux/interrupt.h>
    $ t( Y% [4 w; Y6 B; {3 U
  30. #include <asm/io.h>
    * p$ Z; I. V% A
  31. #include <linux/moduleparam.h>3 _) T3 m+ i& \! }6 e
  32. #include <linux/sysctl.h>
    3 x$ t+ @$ m! r- N+ o5 `
  33. #include <linux/mm.h>" |6 u0 R/ |+ Y4 M3 U9 ?
  34. #include <linux/dma-mapping.h>
    4 Q- x  V1 z3 c- a

  35.   P9 z# X8 y8 p# u. W" }4 n
  36. #include <mach/memory.h>
    ! C3 V7 _' T( }" F0 |8 U9 h
  37. #include <mach/hardware.h>
    1 ]# ?; e. ]$ w
  38. #include <mach/irqs.h>
    2 ^6 p! S- H( i# w* f$ ]- I3 R$ d8 ~
  39. #include <asm/hardware/edma.h>/ |0 {- \0 |" P( X, @( O

  40. . X$ q! _3 k$ x- p
  41. #undef EDMA3_DEBUG
    + q0 C& j7 K9 R: M
  42. /*#define EDMA3_DEBUG*/
      T) M$ O% b2 S  u" K/ c, F

  43. 2 Y: U3 n. U& E
  44. #ifdef EDMA3_DEBUG0 ^/ I6 E* o9 ~  k) D/ \! X
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)) ?6 L- l7 d* e
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
    9 Q2 A: a- u0 T3 j
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
    ! x4 }' G( e/ n2 Y, D3 j( r. A+ r
  48. #else
    : ^( S' w' e% @) c' C- z! u
  49. #define DMA_PRINTK( x... ), E/ k4 L$ [) r) c8 X5 T
  50. #define DMA_FN_IN
    + P$ E8 S. h! R" W" T  f  a" j
  51. #define DMA_FN_OUT7 {4 _  d0 I; T
  52. #endif
    7 B+ y8 q: A. B& g
  53. 4 f2 C8 U: c% T+ O
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)
    : U* V2 @, k* D% I! N0 U
  55. #define STATIC_SHIFT                31 d5 x% z) G; D( J
  56. #define TCINTEN_SHIFT               20
    9 y: d) X& o6 w( i( K, h& B' e
  57. #define ITCINTEN_SHIFT              21
    $ X" o' Y0 d) r4 H& i, t& o
  58. #define TCCHEN_SHIFT                22
    3 V7 {, Q) Y) m# Q) {0 R( {7 O
  59. #define ITCCHEN_SHIFT               23
    5 v9 E: B. V8 e1 u9 k" N
  60. " ^3 o0 b3 r" x; }
  61. static volatile int irqraised1 = 0;5 p4 B  |5 p8 d  U5 Q3 r6 m/ [) u2 ?
  62. static volatile int irqraised2 = 0;
    & F+ f6 t# G) J. d: s8 g
  63. ; Z$ O/ q# X/ s( Z* h
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);9 l: s! P" v  W" h& ^6 x3 {
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);& }: D5 ^+ r1 f; t+ m
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    5 L. e" \  a* l+ M& s5 J

  67. ( G1 ?* g* q# s4 y* K4 b
  68. dma_addr_t dmaphyssrc1 = 0;# I% i+ f' V. d7 i$ p! I0 V0 H6 @
  69. dma_addr_t dmaphyssrc2 = 0;
      d3 h  F+ ^" U3 r9 _& L' K  B
  70. dma_addr_t dmaphysdest1 = 0;" |, t+ @! B; e& k$ u( x
  71. dma_addr_t dmaphysdest2 = 0;
    " @0 [0 B+ ?8 M% {
  72. 8 Z! k& ^. X$ i, m2 ~
  73. char *dmabufsrc1 = NULL;
    + _# O1 h4 F% w! d5 r- o; m
  74. char *dmabufsrc2 = NULL;
    # ~# W$ f, C# i1 h6 n  T
  75. char *dmabufdest1 = NULL;' C. @2 ~, ^4 s3 n- ~8 x* q) U- a
  76. char *dmabufdest2 = NULL;4 N0 ]) w# f- |, K5 Q- l

  77. : U8 p" i- H" o5 i8 L! I' E+ J
  78. static int acnt = 512;6 M* }. y  J/ Y& B- c# M
  79. static int bcnt = 8;+ r  W% P* Y* D& w
  80. static int ccnt = 8;1 u2 d" }* U/ _

  81. $ I3 M4 D$ j  B: T; l! K/ |8 M
  82. module_param(acnt, int, S_IRUGO);
    3 u6 n0 x. M; M  P# F
  83. module_param(bcnt, int, S_IRUGO);
    : a7 U$ N) {0 X
  84. module_param(ccnt, int, S_IRUGO);
复制代码
+ c0 H& @" R7 \; g/ X' Z. d: s' ^
  a% ~: s+ O0 _* m* Q* T% y
      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
) w1 }' j) o0 _3 ?" t% Q! P- G# Barm-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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。) V  W# q4 P- o) H4 d6 c
     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。% r+ M4 S: I$ n) C

6 p) U* b$ L( k) o9 b. F$ g! c
' V5 a+ Z* ?' Y9 b
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2026-1-26 17:18 , Processed in 0.040060 second(s), 26 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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