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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |正序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑
$ ]/ Q$ F/ h" a7 ~3 f& s, U. M
  1. [code]EDMA sample test application
    2 |( B3 a8 R9 n9 K3 d
  2. /*' q# b& e' s% ?) n$ v/ H  Z/ j
  3. * edma_test.c! ]8 O4 S  L: |; c6 N8 z
  4. *! K' ?5 t- K5 k% \2 R" g3 k% Y' F
  5. * brief  EDMA3 Test Application
      y: [& f, p# S' \0 z1 c: Z
  6. *
    , Z, c0 B; |+ L: s
  7. *   This file contains EDMA3 Test code.  i0 K5 R8 i, I, q
  8. *
    + j, s; W* {/ L4 N- j# P  M
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE% o3 Z4 _3 Q5 y+ Q3 e  j$ ?5 n& t
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT/ K5 f8 |( r3 H3 @- u3 a! u
  11. *         TO CHANGE.
      ]: N; o; |7 Q6 z3 l
  12. *
    ' f8 \* @1 U0 U% N" R# z) q
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/* A; v% `$ M9 t: j/ N, |2 [  s1 r; _
  14. *
    ) J* w! }! z9 u* ?  G1 }8 D
  15. * This program is free software; you can redistribute it and/or
    % E- B. F* n6 Y! X4 g0 t# h
  16. * modify it under the terms of the GNU General Public License as
    ' u$ j/ ?, V- P( z( Q5 ^
  17. * published by the Free Software Foundation version 2.3 N5 L+ m+ R) [& f$ Z5 @/ [) ~
  18. *
    % F5 B/ P( ~- ?
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any
    . Y4 I; X/ x) _* ]  u& v& [1 w9 g
  20. * kind, whether express or implied; without even the implied warranty
    % K0 A2 U7 E0 D; O
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    ) Z9 s) Q2 g. K# n  E" V, B" h3 k. B# n
  22. * GNU General Public License for more details.+ E& M* A: E  n6 H/ F$ z" ~
  23. */
    2 O! f! a- I( {, E5 H& c
  24. 7 X8 z. u9 ?# Q* S
  25. #include <linux/module.h>6 b- K" b8 J( m; N7 H9 \
  26. #include <linux/init.h>' A4 v# b" {& B1 i
  27. #include <linux/errno.h>4 x7 y# E  o) q" Z3 H' ^, T7 B
  28. #include <linux/types.h>* L0 t" y0 ?% W, O$ z
  29. #include <linux/interrupt.h>% x; |! Q- o& X! c/ O
  30. #include <asm/io.h>
    # H7 _6 m8 t- [, i; b; M+ p. y4 r
  31. #include <linux/moduleparam.h>) t' k, K' z! V2 m$ ]% r* T# V. u
  32. #include <linux/sysctl.h>
    ( D0 w! \' ~! P4 A" Y3 j7 T! b
  33. #include <linux/mm.h>5 O2 `, J, R, {/ i1 c
  34. #include <linux/dma-mapping.h>4 D5 `/ b. S+ Q7 r0 R! u

  35. 3 U& c8 H" n8 `: r
  36. #include <mach/memory.h>% [7 X( W* D. J. H
  37. #include <mach/hardware.h>
    . |+ D" V  t/ j
  38. #include <mach/irqs.h>  c' u; j9 G4 D! H+ q, @1 i
  39. #include <asm/hardware/edma.h>
    & \8 H+ i/ e0 x$ S, ?* v

  40. 1 {1 i$ `1 ?& \" A% m% t- I
  41. #undef EDMA3_DEBUG
    - j, a/ D9 m! L" g: m- A
  42. /*#define EDMA3_DEBUG*/4 a4 E4 b9 U' I6 d* j

  43. " x/ j7 ]- n, m  o& g. ~. J  e
  44. #ifdef EDMA3_DEBUG
    7 u. Y% |) [0 o8 f4 F
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
    ) w" N. h- L9 |5 Y
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)3 r) f+ b7 B5 p& n. g
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
    7 _7 l# c: ]1 l: i+ H9 \
  48. #else0 e$ [+ m0 g) S
  49. #define DMA_PRINTK( x... )( P- n7 Y) F+ a4 K6 }& w
  50. #define DMA_FN_IN( Y' D1 ~# [: `5 S% g8 B8 y
  51. #define DMA_FN_OUT
    " c) A: ?. `/ T. _4 f2 Y
  52. #endif- E* @% b) t; g+ f' k9 x

  53. : a: g' V7 W( X4 G- I
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)) d! {1 k/ u  Y! ^& R
  55. #define STATIC_SHIFT                3
    2 ]. z+ P: a1 E7 \! ]* A9 a
  56. #define TCINTEN_SHIFT               20; h% W% F6 g: K' j5 V9 p  r
  57. #define ITCINTEN_SHIFT              21
    1 h' z! Q# K! R! [8 d7 D* e
  58. #define TCCHEN_SHIFT                22
    ; l9 [4 {. M% R7 h6 r9 K9 [
  59. #define ITCCHEN_SHIFT               23) o& \) i( v, M  p

  60.   Z3 G4 l. Q7 G6 j( o* _
  61. static volatile int irqraised1 = 0;
    ) s  B# f( I0 p- g' w
  62. static volatile int irqraised2 = 0;. t  _* a+ y$ a. P( g
  63. 6 M3 s1 F7 N5 f7 U! r
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);( O& t3 E  H2 R  C# i2 R
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    1 j: i9 o3 Z6 Q
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);2 y0 j3 f: E1 E- B+ I1 Y: H9 o
  67. , P( O/ P( Q1 q+ M- S
  68. dma_addr_t dmaphyssrc1 = 0;3 c" I( }4 |; Q6 `# g, i$ b3 t
  69. dma_addr_t dmaphyssrc2 = 0;3 d+ k- }7 i( P( w$ t
  70. dma_addr_t dmaphysdest1 = 0;
    0 o1 Y, }3 u# |7 z& j
  71. dma_addr_t dmaphysdest2 = 0;
    ; {7 u% ]8 G1 N8 {& F1 B9 Z

  72. 4 S) U$ |" O. P; g
  73. char *dmabufsrc1 = NULL;9 I. ^/ }. ^3 X5 c4 x* {1 l  W2 Q1 R
  74. char *dmabufsrc2 = NULL;
    ( C/ g3 V; ], S
  75. char *dmabufdest1 = NULL;9 Z3 A6 A7 u- f3 X; J; V7 E
  76. char *dmabufdest2 = NULL;
    ; U# m2 {, B% z, g

  77. 6 O& }& N% Y, A' o
  78. static int acnt = 512;7 W5 f3 E2 j9 K% q3 V  o$ x
  79. static int bcnt = 8;' s  F0 u4 u, [; i' I0 T' K. p
  80. static int ccnt = 8;. F& F  F8 J, F

  81. & M" [- f$ J# X" I
  82. module_param(acnt, int, S_IRUGO);
    . ^+ W2 _! d) @$ k- T  k
  83. module_param(bcnt, int, S_IRUGO);
    - ?% u" A6 t, L+ d: D
  84. module_param(ccnt, int, S_IRUGO);
复制代码
2 [' J- N% p' O* ^5 U

2 }5 N/ q1 R- H# ?" e& ]      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
3 T$ I0 |/ U1 Q+ b! I* Z5 @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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。; Q7 j4 C, _& t- U% X' Z
     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
  n: L: q4 }/ D5 `1 D8 X  u+ l6 F1 Z. l* W1 M  D
! f1 V) Z- l- y1 J, J' T+ z! y+ R
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2026-2-21 16:42 , Processed in 0.050293 second(s), 26 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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