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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑 & }) l- n+ b" Z3 u" f3 x7 d; d5 w
  1. [code]EDMA sample test application
    3 l7 q$ l; t: U5 G, _
  2. /*
    7 [6 ~+ m- B/ {: z" s, K" [" n2 m
  3. * edma_test.c
    ! n  l5 H& {9 c( \, ]1 _" _
  4. *
    9 n* T7 l+ E6 N% n, B4 F$ t
  5. * brief  EDMA3 Test Application
    8 p0 i% ^9 y" u" f; L! e
  6. *
    " [5 A- e  P8 O, ]2 a3 e; e
  7. *   This file contains EDMA3 Test code.9 v3 Z6 h7 d6 {: c0 ~
  8. *' ?; T( h  _" H5 c; k3 J" s4 r0 a2 E
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE4 A  O9 w% R7 }* N
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
    ! Q9 c/ I" E! I  q5 W
  11. *         TO CHANGE.
    # V, F: N* E2 d
  12. *
    1 E7 n- h- {' n# y
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
    - h7 r8 S  k3 \/ p; F: a
  14. *. v7 {' D! f3 u/ B) b
  15. * This program is free software; you can redistribute it and/or
    ( j2 r5 l; N! i) N  O1 Y: o
  16. * modify it under the terms of the GNU General Public License as# |* A4 |# N4 a2 o8 u
  17. * published by the Free Software Foundation version 2.
    . N7 j9 |% o8 m  Q+ j, N: ^* [
  18. *
    . t, Z' N' ]% u+ C/ J2 ^- ]
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any4 H. ]# w$ a. S5 o" B
  20. * kind, whether express or implied; without even the implied warranty5 g% y, r% J8 l) ^3 r4 l
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the* L" x2 ~6 S  c" x" l/ q
  22. * GNU General Public License for more details.: U1 t* R6 C- u, A% O
  23. */
    $ a6 f6 G- C' g+ w7 K

  24. ; e' D9 B' X3 P! g; s) C
  25. #include <linux/module.h>
    8 |: |) [. {' |
  26. #include <linux/init.h>
    / G; A  r/ W; e+ R8 }
  27. #include <linux/errno.h>
    ' v' u5 z. u8 D$ x% w. H) ?
  28. #include <linux/types.h>8 h' s- E1 d0 T0 ?1 x' d2 t
  29. #include <linux/interrupt.h>! d4 D" T+ q5 `1 E4 w
  30. #include <asm/io.h>
    4 ^, ]6 D& ], |' n( `* E0 {/ F
  31. #include <linux/moduleparam.h>$ ]$ d# Q3 U# k3 ?. Y# s
  32. #include <linux/sysctl.h>5 w0 _0 H5 K; j4 K- f! T3 t2 I; P
  33. #include <linux/mm.h>
    ( ~5 ~) c8 o" p* ?# d9 C: z1 F
  34. #include <linux/dma-mapping.h>
    3 |$ y# Z8 q, c& {: Z! r( n& g

  35. 2 a' u- ?+ H- Q- w+ m
  36. #include <mach/memory.h>
    6 J, A: @3 |. ?4 k8 S
  37. #include <mach/hardware.h>& S, K+ I+ `. q; m
  38. #include <mach/irqs.h>: v6 w7 y' [7 R+ H" z
  39. #include <asm/hardware/edma.h>& I& V/ A9 x# ^
  40. 3 ]: X; ?" s/ z  e
  41. #undef EDMA3_DEBUG. n2 f# D  p+ a
  42. /*#define EDMA3_DEBUG*/
    0 ~* Z. A. H* z0 ~% |) s
  43. & v8 j  A! l( j
  44. #ifdef EDMA3_DEBUG
    $ a- u3 t& Q3 z/ d* z
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)  b( \8 r/ F4 p6 G, @/ K
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
    , Y! n7 ^* Q& |
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
    . }/ I& |7 E* Q/ J4 H
  48. #else
    8 Q) H: x9 j4 }
  49. #define DMA_PRINTK( x... )4 z7 T% V* E! @
  50. #define DMA_FN_IN
    & ]* @4 M/ X; g) r
  51. #define DMA_FN_OUT3 q7 [" O, i, h/ C3 P
  52. #endif
    ( `& h* ^  m! j7 v/ _

  53. ; @6 B0 t2 Q2 }9 @7 K
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)$ d# W0 ]4 k( W) W4 C# m8 e. K$ T
  55. #define STATIC_SHIFT                34 m" k* I/ u* x: L+ b# A" n) Y* ?. }
  56. #define TCINTEN_SHIFT               20
    - r- s7 E, n. o. R5 H) x" x8 j
  57. #define ITCINTEN_SHIFT              21
    3 q) X1 C. j* T6 }* S+ v1 ?0 k
  58. #define TCCHEN_SHIFT                228 p1 p* x6 o8 q& m+ b0 r
  59. #define ITCCHEN_SHIFT               236 O) N; ]( w% `+ k5 ~* P

  60. ; V! d* T) C* u5 A8 T' K; @  d
  61. static volatile int irqraised1 = 0;" u# \' y+ i% P5 T
  62. static volatile int irqraised2 = 0;$ c5 I7 j* B$ q% l# [# w

  63.   w( s( B) I0 z3 h
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
      E/ v( p5 C) c
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);5 H" r8 Y5 [. x& m
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);* j( F6 u& ?4 y# e. n3 `6 _) N7 r

  67. " m0 @* G2 i* f* r+ v
  68. dma_addr_t dmaphyssrc1 = 0;
    " D' o  K3 z' m! ]
  69. dma_addr_t dmaphyssrc2 = 0;
    * s7 `! D* G% n- q5 e, _) y; w0 y
  70. dma_addr_t dmaphysdest1 = 0;7 y9 W6 W+ b) n7 M7 \6 G5 l
  71. dma_addr_t dmaphysdest2 = 0;; p/ A% h; H$ s1 A2 k. Q
  72. 3 R1 J. ~9 B7 A9 F6 D
  73. char *dmabufsrc1 = NULL;
    ; G. y% M/ Q* b1 {
  74. char *dmabufsrc2 = NULL;
    & n. m+ j8 O! }- h2 }( s8 }7 b
  75. char *dmabufdest1 = NULL;
    1 b7 F8 O2 B  {  i7 L+ [0 q* e! x
  76. char *dmabufdest2 = NULL;9 s7 B% J. l! u4 l' H
  77. . o$ Y3 \3 b3 u" _
  78. static int acnt = 512;
    # W: K0 n* ]" G" N
  79. static int bcnt = 8;- B% |# |, i7 h* A+ f
  80. static int ccnt = 8;  j& J6 G2 n( {5 I2 i1 y/ q! g
  81. / i" r) o, Z) F! }! R/ q
  82. module_param(acnt, int, S_IRUGO);. W+ [% c1 B2 ^
  83. module_param(bcnt, int, S_IRUGO);
    : Z: L7 ]5 ^1 o" \5 x8 ?. }  Q
  84. module_param(ccnt, int, S_IRUGO);
复制代码
& U8 A) D2 T- R6 k* T
, s0 k2 f0 t0 E
      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用. b  V" q. c  ?/ f$ I2 f& I" V! C
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 a) L' U# _5 H1 Q5 Z     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。% {( g9 d: G- v" ?8 U# S
; R% e# t' A# H( [* H& z
, z% B, [8 v& t3 y
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2026-3-7 15:53 , Processed in 0.039553 second(s), 26 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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