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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑 / F! k- f6 ^/ p7 m. |
  1. [code]EDMA sample test application
    ' S7 ^* O, \! D1 r
  2. /*6 ^; `) l  L- W7 O
  3. * edma_test.c$ V6 x1 g! H$ D' @7 x0 e
  4. *% @' k/ ?* P' ^" ~9 n  Q$ m- E; o
  5. * brief  EDMA3 Test Application  n! @  a3 F' A) V' I5 B& P# P* h/ D. ^
  6. *
    / J7 _8 w% [5 O
  7. *   This file contains EDMA3 Test code.( ]# C: i% z: j2 @
  8. *+ V- u: U- J# }' \0 q; u& `
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE. N7 K3 Y7 ]: d0 B0 \
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
    2 C8 w) C2 O$ @( u0 u$ i
  11. *         TO CHANGE.
    ' ^7 k6 b, v+ z3 K0 [
  12. *
    # K  B5 a8 a$ F0 q) |+ @- z% H
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
    9 ^1 r: r9 ^# M; H7 s0 ]/ Y; A9 D' g
  14. *& F4 |: c+ \( n" W9 ~* ~( o
  15. * This program is free software; you can redistribute it and/or
    $ l4 b3 w6 S. d$ q
  16. * modify it under the terms of the GNU General Public License as
    ) _9 b* W, n9 w
  17. * published by the Free Software Foundation version 2.# {/ B$ c; [2 ^, z4 \
  18. *, o6 [) }: l" Y" j/ F: ?
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any7 s4 p: E1 x% Y. f
  20. * kind, whether express or implied; without even the implied warranty6 _. U8 }) x  b0 F" a5 v
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the3 w0 O3 Z' c) l6 i+ X  Q
  22. * GNU General Public License for more details.
    0 S2 m! ]9 W. {6 I1 M5 x# M
  23. */
    7 z1 }. }# V; K2 E7 Q! y' a% v
  24. 4 G# m% V- k  n- N
  25. #include <linux/module.h>* q* B7 ?9 ?4 ~% Y! [
  26. #include <linux/init.h>* Z) b" s6 e* e# q! K9 `
  27. #include <linux/errno.h>
    6 S- U# c, Q$ K3 D& }; B. b" z
  28. #include <linux/types.h>
    : W' b* W( y; ~: D% i4 e! a
  29. #include <linux/interrupt.h>3 Z3 [$ c% A. J7 p
  30. #include <asm/io.h>
    2 R. S! Z2 G8 R$ S# g
  31. #include <linux/moduleparam.h>9 x6 v8 J# r& K! |+ L
  32. #include <linux/sysctl.h>$ K" t# Z7 U7 Y' _+ h1 q( ^1 {
  33. #include <linux/mm.h>5 F- J0 Z3 Y9 Q3 \) M# q6 U  E
  34. #include <linux/dma-mapping.h>! T  L! i+ O) X% o1 D

  35. * p) c& e! H' U% B% J4 b+ l% ~9 w
  36. #include <mach/memory.h>7 |0 [( T5 d( o. ~2 k
  37. #include <mach/hardware.h>' W5 [6 J& y5 [0 @
  38. #include <mach/irqs.h>& g/ [: t8 ?3 C% v6 g# b
  39. #include <asm/hardware/edma.h>
    ! j. {1 k; |0 X  l

  40. ) U8 V+ l: p0 [  `, Z& ]- L
  41. #undef EDMA3_DEBUG5 A* u4 l6 D' W' X0 V" S$ F
  42. /*#define EDMA3_DEBUG*/
    ) c* u9 b2 c8 K
  43. 8 n4 W! R" C) z7 ?( }
  44. #ifdef EDMA3_DEBUG
    2 r$ q. W- E  R: w
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)1 n' Z# q* z3 k
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
    ! L! ]: ?+ V0 B5 K) w. U3 _% J8 V/ Y
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)7 Y- X5 i2 g3 r! }3 g5 u) e; |+ A4 b2 O
  48. #else. ]! c- T4 |9 S: \% K8 V# ~. h  \. C
  49. #define DMA_PRINTK( x... )' n# Q% U; m+ f
  50. #define DMA_FN_IN
    % w, A9 A4 p0 e! b" R
  51. #define DMA_FN_OUT9 k9 @. o. w0 q* k' T
  52. #endif: q* S4 A7 v) t4 ]

  53. 4 E0 Q+ ]. I7 W; `6 J
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)1 @( s+ z/ ~  W: g- ~
  55. #define STATIC_SHIFT                3
    - Y- N1 s( M& p; W
  56. #define TCINTEN_SHIFT               205 Y" ?  E+ Y0 ?- [1 n2 N' |
  57. #define ITCINTEN_SHIFT              210 l, C4 ]/ x+ j, C; n8 g
  58. #define TCCHEN_SHIFT                227 j1 e) g0 k* D# _5 b" H" ]8 C: t  F
  59. #define ITCCHEN_SHIFT               23
    & N" y2 M; O9 b" J( \/ t' _: N
  60. & f- E1 Y/ j8 @2 ?
  61. static volatile int irqraised1 = 0;
    2 q0 R6 k8 z! N# J) ?% _+ B
  62. static volatile int irqraised2 = 0;- R1 {* C  x7 \: A- S- G; \: I

  63. ' h! d: M# \$ d. V2 j* {# R4 T/ p
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);+ C7 q' ~: t( o0 Q8 t
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);" q, D- {+ e2 }5 C7 U/ z2 Q, k
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    ) d9 R3 I# U# s  O$ N4 `" y

  67. % Y7 A& V- d6 V; C0 e
  68. dma_addr_t dmaphyssrc1 = 0;
      \5 A/ c( J! K/ z1 S' F
  69. dma_addr_t dmaphyssrc2 = 0;
      U. g, I+ S! u5 a3 }
  70. dma_addr_t dmaphysdest1 = 0;" ]' D8 ?5 \: j+ |- ^, J, s
  71. dma_addr_t dmaphysdest2 = 0;
    ; J: H4 d# }  ~9 o( _6 w& F5 W

  72. : s7 W% y* {5 A5 y3 u! [
  73. char *dmabufsrc1 = NULL;; {5 V1 Q; X* Z1 |
  74. char *dmabufsrc2 = NULL;& _7 x7 {# t$ W# {. J
  75. char *dmabufdest1 = NULL;0 |1 A% F9 r% o5 W0 E* R- e+ J  \
  76. char *dmabufdest2 = NULL;1 c* M, G1 P' ^; L

  77. . v1 I7 d! A5 `/ I
  78. static int acnt = 512;
    ; _" W, A: O+ ^# k
  79. static int bcnt = 8;# B& J1 `8 o. x+ n5 c" U
  80. static int ccnt = 8;  j6 t% t# b2 Y; O2 s, j
  81. 8 L7 _9 j5 `0 i* `5 I
  82. module_param(acnt, int, S_IRUGO);( _  O. ?2 @$ s# C# l- I
  83. module_param(bcnt, int, S_IRUGO);
    0 I- h! z: v8 n- f( p
  84. module_param(ccnt, int, S_IRUGO);
复制代码

$ ?7 u* d0 n" I6 A
' N* l. U) ~* A0 I. d      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
& A5 N2 z3 H1 ~) Uarm-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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
3 V; T& h, r2 M- f     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。$ t1 ]# _: U# Q. m

- A) J' l2 t$ G4 ?; S# q& \4 x
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2026-3-17 02:35 , Processed in 0.047347 second(s), 25 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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