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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑
- g0 p; _" B, i: x' [
  1. [code]EDMA sample test application+ b5 V0 c! }( H; x# o- ^
  2. /*
    0 Q5 R  z, K* D$ h: a+ K
  3. * edma_test.c
    0 h+ F/ V' T- Y' \6 z
  4. *' y" j: F6 q9 B; f
  5. * brief  EDMA3 Test Application
    % P$ q4 U7 u/ ~# Y: c* B  |" K
  6. *
      B6 E9 U# V+ T1 G3 m+ o% d
  7. *   This file contains EDMA3 Test code.$ U% P7 c4 Q8 T. e" R1 Z
  8. *3 V* o8 @# N) B; b/ q/ W
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE$ ~8 }& A' ]6 [$ u" Z: v
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT( z* k0 [! P* k$ v1 m
  11. *         TO CHANGE.1 Z4 f3 g9 n7 u6 W6 {4 n4 Q
  12. *' V3 O" D' F& ^4 s4 y# g
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/# [8 o" v( r) }: A  Q" x
  14. *6 l7 I6 r5 Z& R
  15. * This program is free software; you can redistribute it and/or
    , k. z4 V& z4 R
  16. * modify it under the terms of the GNU General Public License as
    ! q! f( s: @$ b7 M( t6 X
  17. * published by the Free Software Foundation version 2.3 r6 ^! v- ]% X% d# t0 m4 j9 X4 s! ?# b
  18. *
    6 t. h& q$ E# `
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any
    ! M5 q6 H' b4 N8 [
  20. * kind, whether express or implied; without even the implied warranty
    * x* r$ p& f* J& b
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    + f  O/ D6 ]. ]' F; W
  22. * GNU General Public License for more details.
    8 N2 u; d! j+ G
  23. */
    . |. G+ F. n" r' @3 _  X
  24. 5 e# a8 K4 ]! _* H
  25. #include <linux/module.h>
    9 M! ^% H3 s5 W$ Y# P* r( P
  26. #include <linux/init.h>6 D, V9 g0 a2 z+ s; d( `
  27. #include <linux/errno.h>
    9 E1 r, X% f6 a$ r1 V3 c8 a5 N; Z
  28. #include <linux/types.h>3 M3 w3 f: e9 e- Y
  29. #include <linux/interrupt.h>9 S/ E" G1 f' r. m3 _1 P
  30. #include <asm/io.h>
    - a- T$ Y7 f% v2 ^" H( s
  31. #include <linux/moduleparam.h>
      W8 w: }& [, ^# |1 g) r9 m8 F+ U) E
  32. #include <linux/sysctl.h>7 [. Y2 n: b( O3 l9 i3 X0 V
  33. #include <linux/mm.h>  s& f  y4 i7 V6 v, S
  34. #include <linux/dma-mapping.h>8 J" x) l# N9 Q" G
  35. 9 i+ l* e+ T4 y+ p& M
  36. #include <mach/memory.h>) E5 ?9 o; P+ f8 x$ a! J6 L3 A
  37. #include <mach/hardware.h>/ l* k" M- L- T7 s6 H4 ~1 E
  38. #include <mach/irqs.h>
    8 i8 x, c. G+ U, h
  39. #include <asm/hardware/edma.h>
    6 F& q- N. |( k3 v3 ~
  40. ; i: N( I! D) C, z3 U+ a
  41. #undef EDMA3_DEBUG$ v& X2 d0 ~* H9 i% G
  42. /*#define EDMA3_DEBUG*// N. O/ m8 x2 O
  43. ' v7 u, x) n0 I- u; E* V. I
  44. #ifdef EDMA3_DEBUG- R2 ~- ~7 w2 ]7 d) P2 n
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS); |7 ~* @; q4 G4 E( I
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
    ; z' o- [/ _, j3 f0 Y4 A) `3 @
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
    8 f7 j5 e/ l6 |2 N/ F0 l/ G" ]7 M* g7 Z
  48. #else0 H* H% f' @) B% a; `
  49. #define DMA_PRINTK( x... )" f; `9 I3 ]9 O) Y/ ~& Y4 j
  50. #define DMA_FN_IN
    7 B' S) c0 k. P& Y* E
  51. #define DMA_FN_OUT. u$ I/ \; Z5 E8 ~& W3 N
  52. #endif' J( Y) O9 P4 ]
  53. 8 a# M4 Z- ]" S8 K8 L
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)5 \* h# R7 V/ P: x
  55. #define STATIC_SHIFT                3# v, b: i2 H7 X& ~& x# `
  56. #define TCINTEN_SHIFT               20
    1 N5 z4 E5 o! E4 j6 ^1 u, a. S+ w9 l" \
  57. #define ITCINTEN_SHIFT              21
    . f$ y. n$ P4 y: T- E( D7 t" |
  58. #define TCCHEN_SHIFT                22
    3 j3 J4 y+ I1 {2 ]' D, F: E
  59. #define ITCCHEN_SHIFT               23
    5 g$ Y# F0 |8 T9 Q8 n( S! v
  60. 1 R# n" }/ a1 `4 z+ E; o! r
  61. static volatile int irqraised1 = 0;
    % f7 ^# M! I6 ^  C3 q+ r
  62. static volatile int irqraised2 = 0;$ V2 S3 p* t4 U9 q2 ?

  63. - H# k# T% J& X) `' u
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);8 h1 h5 q' [2 q! {* m4 `* G
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);6 g$ c2 W9 U, b( ~" H* N
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    & [6 O6 v# Q' m3 J

  67. $ d' O( Y! j$ H0 {2 M: [% k
  68. dma_addr_t dmaphyssrc1 = 0;
    2 U4 }" m$ M6 w3 [
  69. dma_addr_t dmaphyssrc2 = 0;7 t6 w9 u+ f/ {- X& k% b
  70. dma_addr_t dmaphysdest1 = 0;
    4 m/ [8 {* i& o# f% J7 a7 @
  71. dma_addr_t dmaphysdest2 = 0;
    ; Z8 j" t. j: R! Z1 R' V  i
  72. ! v7 O* x* F, E9 N% }$ k9 L
  73. char *dmabufsrc1 = NULL;* S7 D9 `* e) {, I& M
  74. char *dmabufsrc2 = NULL;. r- _* X& O1 [
  75. char *dmabufdest1 = NULL;
    0 G. R- g" ?0 ?: Y% D
  76. char *dmabufdest2 = NULL;
    & l& _! ?- x1 b" f
  77. , A. @$ `+ G2 d0 N
  78. static int acnt = 512;( x: e- Y0 H1 v, B% U/ `
  79. static int bcnt = 8;
    9 H8 K9 m( J, i' g; d4 P9 z- q
  80. static int ccnt = 8;0 J: `1 n/ M( h" \

  81. $ S& p; ]6 F- G4 }( Y
  82. module_param(acnt, int, S_IRUGO);
    : t7 M: ?1 a1 b8 [! u9 O
  83. module_param(bcnt, int, S_IRUGO);
    3 {* a8 V* v) d! _$ c% ?
  84. module_param(ccnt, int, S_IRUGO);
复制代码
! t, Z' u0 |6 J/ J
6 E/ H7 {4 a; F' P8 a8 D4 f
      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
  F6 @$ U1 i" X3 L# M& K  ]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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。) b* R0 y6 M9 q+ ]1 Q
     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
$ H1 s5 r- T; U
  f1 v2 Q! W! H4 Y$ n5 W' j! s0 ^1 K8 \3 W  r% n
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2026-3-5 05:06 , Processed in 0.049354 second(s), 26 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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