OMAPL138如何在Linux下使用EDMA3驱动 - OMAP-L138 - 嵌入式开发者社区 - 51ele.net
设为首页收藏本站

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑 0 s# Y$ \# R7 e; v: {9 w
  1. [code]EDMA sample test application
    8 g" D( \4 x5 S
  2. /*
    " P  m: |  N0 a; E
  3. * edma_test.c5 s3 f+ v# s5 w/ O
  4. *
    . a. F  m3 s% K, W# N
  5. * brief  EDMA3 Test Application
    & n) o' X  b! o4 y: }' y
  6. *
    5 Q3 F& x5 G3 R' q' ]  A
  7. *   This file contains EDMA3 Test code.
    & I5 \$ Z2 O- ?! O" P- s( z
  8. *
    ' S) X  b" O/ W3 u( U- y" M2 p
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
    7 {3 J9 \4 R3 b1 |7 d  u+ v
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT$ g) r9 F$ u% J) d
  11. *         TO CHANGE.7 z, l) U' M1 @3 \- E; J
  12. *
    2 S: y2 s5 ^2 ^: b( B1 i; y
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/7 Q) p) Z+ O5 u" g# t( ~
  14. *, }2 t: f# A5 a! u2 u. Q6 ]
  15. * This program is free software; you can redistribute it and/or* w; f' Z( K; Q
  16. * modify it under the terms of the GNU General Public License as
    ) Q' v0 h* x' _
  17. * published by the Free Software Foundation version 2.
    5 o& K2 h( m, a
  18. *
    2 q, a% r3 g" u: g
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any& |5 x( q) K. \; S
  20. * kind, whether express or implied; without even the implied warranty. r' K+ Y& C, J2 p& F9 Q
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the0 L. F: ]2 P. r; G
  22. * GNU General Public License for more details.3 b+ I0 L( e6 s$ W3 ~8 R" l+ |
  23. */
    : n( L; V' h- \* C7 i9 P! e9 @
  24. " {+ `* E; e9 v" P. N& }* w
  25. #include <linux/module.h>
    ! a. ~- W$ d2 B0 h
  26. #include <linux/init.h>, p5 E" y- ]& b4 r
  27. #include <linux/errno.h>
    " ?& m' C; I- O: C+ I
  28. #include <linux/types.h>
    1 ^, l1 X% k+ D5 W
  29. #include <linux/interrupt.h>6 s8 A9 ~  f& J/ B- m
  30. #include <asm/io.h>- _$ T2 L0 d- |# n& G9 F0 M
  31. #include <linux/moduleparam.h>
    + E* y# j4 {; J& }0 _
  32. #include <linux/sysctl.h>! s% I# S. g$ D1 p
  33. #include <linux/mm.h>1 Z% Y( x: ~5 G3 ]3 f( l# r! q
  34. #include <linux/dma-mapping.h>
    7 G/ [& p% P" j8 a/ z6 o1 p, q: }/ H

  35. # k$ C% j! _' R: P) q( g& h# J
  36. #include <mach/memory.h>& H3 a! v  g; R1 _$ `  B
  37. #include <mach/hardware.h>7 W$ N5 ?* F7 p* _
  38. #include <mach/irqs.h>
    4 q$ e2 d6 L# C) o1 ^6 E3 m" x
  39. #include <asm/hardware/edma.h>
    $ \( Q  `; c8 n$ Q) L" O" a6 P+ u

  40. 9 P% ]5 F9 Q! H. ^8 o
  41. #undef EDMA3_DEBUG2 g! m( e6 D6 f# z- d6 ?
  42. /*#define EDMA3_DEBUG*/7 `% o) Q( V! F8 `9 o+ b/ l' X
  43. 2 A* e0 F0 {: `6 W0 v1 `9 B
  44. #ifdef EDMA3_DEBUG
    ; Y. m' T0 U4 a6 b5 {. p
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)3 Z& Q* W9 p7 l0 }
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
    & @, L2 [! ?, i0 I
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
    : U' d+ o' \; @! I
  48. #else
    - G# L0 ]3 n' q
  49. #define DMA_PRINTK( x... )( v5 i4 ^9 x5 x0 z! x& m
  50. #define DMA_FN_IN
    5 ^3 f- n! _9 |, Q! K( e2 d5 ^
  51. #define DMA_FN_OUT
    + w' j$ ]# I+ q. N! j, W" @. d
  52. #endif: D! A4 q$ X5 p. O" o8 e

  53. $ I. ~. b8 E" a8 m( q% L8 w
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)
    " u4 u7 @7 ^1 t1 X6 l
  55. #define STATIC_SHIFT                32 O; J; E0 w+ l" i
  56. #define TCINTEN_SHIFT               20- u+ ~% C! [& D, P
  57. #define ITCINTEN_SHIFT              211 z0 Y- B. H! f1 h  U9 q
  58. #define TCCHEN_SHIFT                225 H4 f3 ~( n, o! {- D0 J; s
  59. #define ITCCHEN_SHIFT               23
    3 b' B* o/ F2 P# t! r" p
  60. " z! u  i8 W: K8 h$ T
  61. static volatile int irqraised1 = 0;
      M$ @9 k" W5 m
  62. static volatile int irqraised2 = 0;' f4 U, N, w! g7 O- |

  63. # V; d! Y( W9 |7 z4 n; d# z7 j
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);$ \+ ~$ }* m" A* F
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    7 h4 h5 M' D" A9 ~( \+ _
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);' X9 C, R/ Z5 V

  67. % R2 N# {, G, q  g. Y+ o4 j0 J
  68. dma_addr_t dmaphyssrc1 = 0;
    " @3 u7 l) j* T6 ?
  69. dma_addr_t dmaphyssrc2 = 0;
    $ a( k4 Y& Z8 R" F
  70. dma_addr_t dmaphysdest1 = 0;
    ; J) q9 X9 U) m  S  p
  71. dma_addr_t dmaphysdest2 = 0;; X8 g5 N3 u( b, n. j: S6 F9 v
  72. $ {5 \* n8 }1 b- y% j
  73. char *dmabufsrc1 = NULL;* Z0 F1 f2 @! o
  74. char *dmabufsrc2 = NULL;
    / J, C1 l2 I0 b6 ]) m, u4 t
  75. char *dmabufdest1 = NULL;( f3 G. K3 h% q% o( H+ Y, L& ~
  76. char *dmabufdest2 = NULL;: _' u7 H" J0 h; U6 I

  77. 4 {. O* L' z! {, p1 f
  78. static int acnt = 512;6 b# O, v# W$ Z' _
  79. static int bcnt = 8;
    ; C3 X9 z! `3 e, o9 b& \8 S" Y0 T2 Z
  80. static int ccnt = 8;
    7 M! L& j7 I6 ^: C" y! G" B) e' _# `
  81. $ o* @+ X6 w) h1 m
  82. module_param(acnt, int, S_IRUGO);$ |9 E' V) D: Z
  83. module_param(bcnt, int, S_IRUGO);
    * e. r$ Q7 ?, \3 ~$ f2 h# T6 l1 f
  84. module_param(ccnt, int, S_IRUGO);
复制代码
' c+ p$ t; s0 @! p6 A
- `9 R8 B; O9 v* h: d( \
      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用* r9 q. G- s" |( D9 A' 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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。# b5 _# R* [0 \/ j" @- _
     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
8 i/ c8 C+ Z& P% c) W4 U. b, N
2 K% V7 ], m; y1 \
; G+ m+ }* ~8 G
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

GMT+8, 2025-11-9 22:41 , Processed in 0.037298 second(s), 25 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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