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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑 ( o& l: p+ z" y/ |6 `
  1. [code]EDMA sample test application8 F1 E# ?* l7 h
  2. /*
    ( E) B  y5 r- N. k: |8 u6 Q3 A" X0 O
  3. * edma_test.c
    ) d8 A! Z: l+ V; J1 ~2 H$ q* _* d
  4. *# H' I* M: o# @+ K' C: G
  5. * brief  EDMA3 Test Application
    7 D+ X1 B9 f' G2 ], Q; n+ H& @
  6. *
    % _$ Y* c& X! L1 K: R
  7. *   This file contains EDMA3 Test code.' h$ P; a5 b7 |) r2 n# D% J* Z
  8. *
    4 W' T; G& }0 B1 w
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
    & _2 I9 R" G" w% H
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
    $ p4 u" v) ?9 [- y( F
  11. *         TO CHANGE.
    4 ]. Q' }1 i# ?& K) }2 O8 l: O
  12. *" B+ t5 y+ Y# X
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/$ C2 N) \/ B! Y* x
  14. *
    % \# w; @% e" H+ {' m% e
  15. * This program is free software; you can redistribute it and/or9 N- l: B6 }7 m! A- D
  16. * modify it under the terms of the GNU General Public License as
    - W2 G5 e' `2 y9 H. \- e
  17. * published by the Free Software Foundation version 2.4 g. R. q  p/ r9 g3 c
  18. *: |1 |% o5 r$ c
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any- o7 _6 _* C! g$ q
  20. * kind, whether express or implied; without even the implied warranty
    4 K7 S: m# F2 p5 U; {' s0 V1 G
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    - T5 C" U) Z/ `
  22. * GNU General Public License for more details.
    9 S: I$ a( V! C9 y8 |6 m$ t- _) M
  23. */) Z  a# n3 }* d# j

  24.   Y# g2 `6 `. |2 l: X/ W6 P
  25. #include <linux/module.h>+ s$ I0 ?7 s% K9 T
  26. #include <linux/init.h>
    $ {& u0 \6 E. c6 ^1 J$ y' j
  27. #include <linux/errno.h>7 L( p9 k. R2 v$ D
  28. #include <linux/types.h>
    & u2 p6 m! M* P
  29. #include <linux/interrupt.h>
    2 r( B2 i; _0 P* r$ a+ ?
  30. #include <asm/io.h>
    ! j% A0 t2 h$ K; q! O+ B" T, C
  31. #include <linux/moduleparam.h>' }1 f/ m- }# D% Z! z0 }6 c4 f8 a
  32. #include <linux/sysctl.h>" g4 W9 T1 m/ O9 G8 n$ A4 v$ A
  33. #include <linux/mm.h>
    + p& m$ r5 n1 r
  34. #include <linux/dma-mapping.h>8 h" y1 Q0 V" [0 z; ^' `1 N$ u# R
  35. - M6 @+ o% G! P7 S4 y8 ?' w/ s
  36. #include <mach/memory.h>
    6 |# j# R, J( B1 m" d% F0 l
  37. #include <mach/hardware.h>; G( _  T- U8 J" R8 O0 a
  38. #include <mach/irqs.h>
    ; O- C' u  ~$ I9 E3 `$ Q4 q' q
  39. #include <asm/hardware/edma.h>
    / ^2 ]/ i6 |$ O* g( Q
  40. 6 X: e' B- g* ^' r
  41. #undef EDMA3_DEBUG; S( I8 r2 H$ k$ l
  42. /*#define EDMA3_DEBUG*/
    4 w3 s( X; Q) l1 z
  43. 0 z; W. A6 Z9 a: ^3 {6 u3 x
  44. #ifdef EDMA3_DEBUG1 r' F5 Q' m, x: R* ^: A; s" S( H6 u
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
    " {! e: M4 ^, N8 K7 J& O+ p% f
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
    5 H4 r4 i$ |+ q  c3 [1 n4 E
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
    2 |7 j* \' f9 Y. m5 M4 Q6 Y
  48. #else$ W; |, M2 L! v; d3 V- T
  49. #define DMA_PRINTK( x... )* R7 f( y, F8 `3 p9 Q
  50. #define DMA_FN_IN
    : M: M/ c, h  m5 g+ w; r0 `
  51. #define DMA_FN_OUT
    3 N8 }: b( p7 |# j/ Y; c2 P
  52. #endif
    : g4 a, Y. t7 X8 D8 f; p

  53. # l. g" ]% [/ y" y
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)
    - A2 ]% \% v* O8 B
  55. #define STATIC_SHIFT                3
    & T, o. `: V# e  ^
  56. #define TCINTEN_SHIFT               203 R0 A1 t$ H  M( U. T
  57. #define ITCINTEN_SHIFT              21
    + z2 ]7 O& ^  B
  58. #define TCCHEN_SHIFT                22- K' I. U% O3 D' Q! i
  59. #define ITCCHEN_SHIFT               233 @2 ^# C/ q! G
  60. . z# g# e# S6 d. G; b
  61. static volatile int irqraised1 = 0;! c- S# @( j# L- b! G$ C4 }
  62. static volatile int irqraised2 = 0;
    5 t1 l8 ?. L' f! q" z# \
  63. 5 H5 |, Q& @) I& }# j; W2 y/ d
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);4 D# y( q/ R! u. x- b) n
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    * K9 V4 s3 V2 ]) a4 S$ [
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    0 I& K/ s6 p4 f. \4 I; n7 A

  67. ) w( a" @3 l7 t( ^
  68. dma_addr_t dmaphyssrc1 = 0;! S3 l- \* {; H% R2 X# W
  69. dma_addr_t dmaphyssrc2 = 0;; Z1 c/ _' U8 e) b8 J! X. u
  70. dma_addr_t dmaphysdest1 = 0;
    + e, m! q# [: h/ E* G( g
  71. dma_addr_t dmaphysdest2 = 0;
    8 j2 Z8 T0 K. y/ Z
  72. 7 z0 f  z' ?) ]
  73. char *dmabufsrc1 = NULL;
    0 U7 t; i: K6 t1 h
  74. char *dmabufsrc2 = NULL;3 V( S/ l1 m: ~% e5 B1 U' N
  75. char *dmabufdest1 = NULL;7 K% o9 ~9 t* y) J
  76. char *dmabufdest2 = NULL;2 s/ }  w7 i( H8 Y+ o7 Z

  77. : ?7 j( _6 q2 o9 \% t: w1 h* d- Y& r
  78. static int acnt = 512;
    ' B( Z. H6 P) d9 L
  79. static int bcnt = 8;
    & V6 a; E2 J; y7 ~2 h
  80. static int ccnt = 8;
    / Q, n" X. |, Y, f

  81. 3 ~8 [6 d; I: I; x+ l  x# l
  82. module_param(acnt, int, S_IRUGO);
    ( M2 J9 z* m; O
  83. module_param(bcnt, int, S_IRUGO);
    ) h9 Y' S4 y; v* I. ^7 Y: F
  84. module_param(ccnt, int, S_IRUGO);
复制代码
( o% f& j/ \: s# y9 Q2 r1 L) C  @5 W
$ p) l6 U9 V: [; b/ P
      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用/ @" S3 N# R6 e  p
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
3 o7 ?3 V, f% U' U     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
6 ]* `; a" K0 |* `' u2 t$ V+ ^/ Y% a- y. c0 q) F: C6 I
* f4 a9 [. y9 K* y8 r. b
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2026-2-9 10:44 , Processed in 0.060786 second(s), 25 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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