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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑 7 H: W7 \9 i3 Z" y5 _& F
  1. [code]EDMA sample test application% t- B, R4 N) f
  2. /*9 @4 [" f8 a/ Y% `
  3. * edma_test.c
    ; _  _' F, u$ U; G- g; {
  4. *9 c5 ]% E. R4 g/ t" n) K1 h9 v& B1 Q
  5. * brief  EDMA3 Test Application
    # O( \0 ^% C3 g; o/ m% G
  6. *% d- H2 u$ _6 d# |7 n
  7. *   This file contains EDMA3 Test code.% @' O* y4 c8 _8 e3 V3 m) @" H- W
  8. *5 e4 a1 |! y% ~1 ?$ z/ J% A
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE1 u8 @3 l% @4 d$ _. P6 f
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT4 b: T" |) U% h9 ]- A: j
  11. *         TO CHANGE.
    - [1 d# e% l: E1 j1 d8 h
  12. *# N+ A: n: z7 Z: s
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/: |# h/ l" P0 z7 {8 N
  14. */ d# s4 \3 Q$ _( [6 Q0 a5 P
  15. * This program is free software; you can redistribute it and/or
    7 E  B# q( {2 a+ i: R0 \
  16. * modify it under the terms of the GNU General Public License as$ _) M2 h7 c2 K2 Q- w. L# M) r
  17. * published by the Free Software Foundation version 2.( ?2 K  q/ B, @# K) i2 j
  18. *
    ) u7 L* e3 u8 l+ F7 _% ?% x& I
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any
    * k8 L7 {8 k, b, r; |
  20. * kind, whether express or implied; without even the implied warranty( J* a% u) _# U3 s. ^& H
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the8 L! J  J, h. S& y, N- x
  22. * GNU General Public License for more details.
    1 l+ `: [. B* x& ~2 }
  23. */$ B: s8 I0 @' ?1 w: Q; Y
  24. 6 E# ^* t1 r0 ?: h
  25. #include <linux/module.h>/ w4 h4 I3 R1 T* K; @. m
  26. #include <linux/init.h>
    8 ]' i6 A' E# a0 l  D. A+ c
  27. #include <linux/errno.h>
    ! y5 i3 J& j7 L+ ~& A
  28. #include <linux/types.h>2 q1 o$ M& t- D
  29. #include <linux/interrupt.h>0 ?! `8 ?' v- c0 W2 G
  30. #include <asm/io.h>- z, _) z5 t  U& ^, A
  31. #include <linux/moduleparam.h>" Q! t9 O- Q2 p: q( A
  32. #include <linux/sysctl.h>" ?5 F0 c/ I+ L& K+ l9 o
  33. #include <linux/mm.h>( a7 v4 L% _4 ~8 s
  34. #include <linux/dma-mapping.h>
    / B; ^9 \9 L0 D- `
  35. ! n1 \/ z1 Y& _2 s9 K9 Y, J
  36. #include <mach/memory.h>! [' ~8 s3 {9 c+ v5 b
  37. #include <mach/hardware.h>! j2 Z  F4 d3 l7 M
  38. #include <mach/irqs.h>1 ^( p5 l6 @: c7 e* V; ]- f- L4 t
  39. #include <asm/hardware/edma.h>* M& ]8 N3 l, h; l/ S

  40. $ |) Z6 ~# ?& y  b
  41. #undef EDMA3_DEBUG% c% K8 x- h5 _/ {
  42. /*#define EDMA3_DEBUG*/
      q0 y! f( ]& [8 e. C/ \" U1 G1 G

  43. 6 t0 g; F9 l2 |; b9 s$ l. \
  44. #ifdef EDMA3_DEBUG" d! ]4 Z; H+ |5 t# \7 F& O( i
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS): M: {* n" {' N* S9 Z
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)4 W( U; h8 n4 P+ O$ O7 x
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
    ) L. v% N" d' k+ O: X. _  g
  48. #else2 Y: v! Z5 V% N# |6 @6 C* C4 k
  49. #define DMA_PRINTK( x... )/ t* a3 N7 l* Q  n: n
  50. #define DMA_FN_IN# R0 [, D* G6 ~1 z
  51. #define DMA_FN_OUT$ h9 X1 X- ], V  s+ p6 J9 o
  52. #endif1 V* H0 g  B! |; ~/ U0 Y

  53. - \; O5 J( X  t$ b, ]
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)
    ' h; \0 {, e0 Q8 t. d. x! s
  55. #define STATIC_SHIFT                3+ U: x5 z' V: R4 p& x/ \" U
  56. #define TCINTEN_SHIFT               200 v1 M) P5 ?1 i/ l8 g# ]* p( Q
  57. #define ITCINTEN_SHIFT              21& `4 x7 G$ u5 `8 B
  58. #define TCCHEN_SHIFT                22+ t" I) ?( ]5 g. A6 u
  59. #define ITCCHEN_SHIFT               23: @; l; x6 j  W2 W: m/ |
  60. 7 W% W! y, t* n" ?' ~
  61. static volatile int irqraised1 = 0;
    - H! q4 g: f: d! f
  62. static volatile int irqraised2 = 0;3 f; H% a- T" R2 m

  63. / N" \4 }1 u# \% G) {
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    # B  G; X. c9 r: z4 R6 q' G1 A9 ~
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    5 w- h( O. l) b) h8 g7 g$ v8 Y$ p
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);9 x' A4 t: u! V/ b, o
  67. % R: E& R" D$ J
  68. dma_addr_t dmaphyssrc1 = 0;7 O3 _& [4 G: {
  69. dma_addr_t dmaphyssrc2 = 0;4 ?$ b' Y, K% r
  70. dma_addr_t dmaphysdest1 = 0;
    ! M3 c/ I/ m) G, C1 V! M, D, D
  71. dma_addr_t dmaphysdest2 = 0;, t9 E! g/ C5 n( w
  72. 2 H0 Z; }8 P: i( u
  73. char *dmabufsrc1 = NULL;3 P, K* R2 G: a
  74. char *dmabufsrc2 = NULL;
    1 S, r% G* b1 p$ s5 r8 x
  75. char *dmabufdest1 = NULL;2 w1 [2 F( R* y( ]& k! d- G  f
  76. char *dmabufdest2 = NULL;; d# q& \% B" q$ X/ X, P
  77. 3 }1 J) C2 W7 b) s6 z
  78. static int acnt = 512;" }1 q0 A) g5 A5 Z" D/ T  P2 t8 h
  79. static int bcnt = 8;5 y) }# N7 F5 R5 P
  80. static int ccnt = 8;
    . R  b3 e  H& M

  81. : n: n& E" c# E7 ^
  82. module_param(acnt, int, S_IRUGO);
    / o7 x+ t% L+ g. y4 y
  83. module_param(bcnt, int, S_IRUGO);5 v4 A8 \7 `$ |' Z) H3 L
  84. module_param(ccnt, int, S_IRUGO);
复制代码

4 x3 C$ |3 p7 I, Q
% e  m# B5 {+ q1 J      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用4 |9 t- C: c* C* k% h, v
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。5 k1 ?! z) a% \$ A2 E
     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
8 z5 o) U5 H2 b" a
6 |8 `9 @. T/ F3 |
9 M$ x( X3 F$ X' x2 G. j: w. M8 t6 {) z
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

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

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

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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