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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑 : l5 k" Y1 E5 d9 _$ f7 q
  1. [code]EDMA sample test application# s  p7 ?# D3 K& z: M
  2. /*) c$ r+ N/ _/ p5 i9 W& G% f" ?. x4 U
  3. * edma_test.c
    - A4 K4 W% J- _
  4. *
    ; t4 o4 ]3 R- f& Q8 r4 w
  5. * brief  EDMA3 Test Application
    1 L' I3 B* K5 b# [; P% n
  6. *
    8 p7 ?# k* n$ S. {5 E9 T- E) W
  7. *   This file contains EDMA3 Test code.- W- }; o2 ?% W2 p: \2 @8 w6 O$ \' {
  8. *
    9 [2 {2 [! \4 U7 d" i5 N
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
    2 Y5 F1 `7 y; i2 R% i% `
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
    ) W" z1 j. ^' t' _4 J; c% T
  11. *         TO CHANGE.. }4 c( h! G; ~- X
  12. *" R& C2 d* l8 V. x" n
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
    6 V" ~* V7 j1 Z! K' j
  14. *  b% C* T- Z# z/ @# h: v
  15. * This program is free software; you can redistribute it and/or2 N) O5 X; g. _$ B8 y5 n5 a
  16. * modify it under the terms of the GNU General Public License as1 p  J; u# }% d" x$ @
  17. * published by the Free Software Foundation version 2.0 }# p) l* M! R) N- q
  18. *
    % s$ @" X5 Q* Z
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any$ b9 T- i' `1 N, Q$ ?& o/ d5 a
  20. * kind, whether express or implied; without even the implied warranty
    7 [% |9 V* e5 y, O2 x0 \% s
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    0 c  f# p4 o, ^& ~* j
  22. * GNU General Public License for more details.7 x  O: s6 ^- G
  23. */
    / v6 n3 {0 w& @3 G! S2 h
  24. ! \) |1 ]+ h' h
  25. #include <linux/module.h>
    & q0 n$ g1 v  I) w
  26. #include <linux/init.h>
    9 ?7 D% [% e" G3 a  T
  27. #include <linux/errno.h>
    ! R' k: E8 P9 `' m: a0 d- S& ]
  28. #include <linux/types.h>' x# }- q1 L, ~
  29. #include <linux/interrupt.h>2 s' W% y4 h& }( }. n& K: Y+ G
  30. #include <asm/io.h>
    $ c  ]+ y& b5 v+ R. ~
  31. #include <linux/moduleparam.h>6 k8 Z& w7 M1 a: _' }$ G/ W7 u
  32. #include <linux/sysctl.h>
    - D+ e  J4 }- P1 p
  33. #include <linux/mm.h>! W  Z( k- y) O; L
  34. #include <linux/dma-mapping.h>
    4 ?, m& J; M' V3 S% H: w- O( Q8 y
  35. ) a3 e6 M/ J3 {1 M4 O$ E9 s/ `
  36. #include <mach/memory.h>1 c4 c/ C4 d) M6 P: @' e" ?2 P
  37. #include <mach/hardware.h>+ Y3 }7 E* b+ T, _- `/ ]
  38. #include <mach/irqs.h>
    / _4 I. ]' _7 N( Z: A
  39. #include <asm/hardware/edma.h>& @2 _* B: `) Z) T7 Z
  40. 7 k1 q" ~! ^! `. t
  41. #undef EDMA3_DEBUG! ~2 d# S5 E. I# o" f/ @
  42. /*#define EDMA3_DEBUG*/
    # R) \' A# m5 ^& v/ f9 l( H

  43. $ _% v* p/ X. F
  44. #ifdef EDMA3_DEBUG: z( e6 Q7 R. a8 G9 a/ l/ u
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
    ' V3 R! U5 E$ ]( \. C
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
    : g3 G1 O4 N/ Q* A8 m0 p( G
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
    7 R' K: ~+ _6 D  C; V) C; C
  48. #else: S- a0 V: P0 Z
  49. #define DMA_PRINTK( x... )
    * O7 V% k! y% q  t4 ?& D
  50. #define DMA_FN_IN
    & N5 n2 ?) ]; u
  51. #define DMA_FN_OUT( q8 E; ~" l' Q
  52. #endif
    # g7 g: ^2 _6 N3 j

  53. 8 w4 L9 O3 G+ T2 ?( R
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)0 E9 t! [& N) p& j. U+ [( v
  55. #define STATIC_SHIFT                37 F& s6 ]' H& b8 i
  56. #define TCINTEN_SHIFT               20$ R; J7 t# V3 }# Y2 r9 p- J/ A  D
  57. #define ITCINTEN_SHIFT              21
    ; H7 I' \% q# w' \" f$ _
  58. #define TCCHEN_SHIFT                22
    % O9 x; b0 B1 m* u# j% ]
  59. #define ITCCHEN_SHIFT               234 o1 R2 N4 \; i- E. \
  60. 0 N8 {) s' }- U  B& G: e2 j; n# C8 K% @
  61. static volatile int irqraised1 = 0;# r7 g( c0 g/ Z& H0 {5 X
  62. static volatile int irqraised2 = 0;
    * ?$ I6 {# H+ y8 U# A

  63. . X7 _) a# y' H. u# Y
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    9 L+ O5 M6 m3 h* Z& p; V
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    & c3 z; o! [1 j1 \& f+ Y; b8 l% g
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    8 Y* j2 N; X4 E. M! p' H

  67. 1 w* o6 }9 F3 H( z
  68. dma_addr_t dmaphyssrc1 = 0;
    4 c/ q7 }2 [  B& o7 r, k
  69. dma_addr_t dmaphyssrc2 = 0;
    4 q6 s5 x- n  K& L
  70. dma_addr_t dmaphysdest1 = 0;) L9 m7 D" }& @) M' A: j
  71. dma_addr_t dmaphysdest2 = 0;9 r' o8 K+ n  L+ S/ N
  72. 4 L0 O: \- a/ R5 e' l. a
  73. char *dmabufsrc1 = NULL;7 [' V5 A8 [7 `
  74. char *dmabufsrc2 = NULL;
      v) q( l% I. V7 P9 \
  75. char *dmabufdest1 = NULL;
    ! G/ l( h! o( i" g, V; W
  76. char *dmabufdest2 = NULL;
    ' N% h) z/ Q- }. o, _& Q
  77. : L* t' ]. o' ~" n! Y
  78. static int acnt = 512;/ H; V( q" K, t: x
  79. static int bcnt = 8;
    ( W$ T3 D3 @3 e. }, G+ l! L9 l% m
  80. static int ccnt = 8;
    & A/ q2 S: P5 U' R- k, A2 t( y0 S

  81. ; o% O+ _/ d) k  L2 b4 F/ Q
  82. module_param(acnt, int, S_IRUGO);
    : K3 p. A4 U; U/ v% K4 @
  83. module_param(bcnt, int, S_IRUGO);$ o$ p# w* d& b$ M, ?6 [
  84. module_param(ccnt, int, S_IRUGO);
复制代码
! U# i) N5 K3 [/ n

0 ]2 H- k$ W% C4 k% _/ }6 u      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用: k1 w+ e5 m: L8 ^
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
: q2 w, z% Y6 U2 H) {2 @. y     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
2 e% Z4 o8 v; R  ]% B% Y. z3 \: W3 i& [6 T) @" k8 ~5 u' j
$ Y6 K6 y1 Y+ I: c  v; O1 o
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2026-3-25 16:59 , Processed in 0.041624 second(s), 26 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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