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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑   I! H6 u# ?% v6 n; x8 B7 U; U
  1. [code]EDMA sample test application
    1 j0 a. |* {  {$ I( t) Z7 V: Y% i
  2. /*8 P$ o% }* ^5 f( e/ N& p
  3. * edma_test.c, u! W! K" z* M( b1 y5 T" V% S
  4. *
    . T5 f+ t) y" y" [6 @( s8 I- i6 f; I
  5. * brief  EDMA3 Test Application0 s+ y" {" u: N$ @' K5 U  q
  6. *( R, j  E2 w9 x6 t( [9 [
  7. *   This file contains EDMA3 Test code.
    , p4 ]; a# Q& x
  8. *
    2 j8 n* U! l0 X; M
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
    0 o& i+ W- A; |; ^6 ^% p, v) F" P1 C
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT  u) R% {8 w1 W7 G& i3 R2 b7 k
  11. *         TO CHANGE.4 y( [! m4 A  D
  12. *
    1 H7 p% M8 V5 V# g' l& b
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
    + e% W! t$ Z. ?0 {  s# N
  14. *8 N4 L$ P/ S/ H5 @  }
  15. * This program is free software; you can redistribute it and/or- c" i/ q* x' `9 c( Z  ~
  16. * modify it under the terms of the GNU General Public License as
    ) p. U9 K) Q7 _" Y/ C. e
  17. * published by the Free Software Foundation version 2.' m' }# v# t* c; D' e" O0 F
  18. *
    3 j8 P, g' m) z  U: V9 x- e" U
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any4 o9 v# f- B! A: N6 U  e
  20. * kind, whether express or implied; without even the implied warranty* b/ v" B4 s% Z* V
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    " u) H0 c6 \) P: j2 D! p1 o' G
  22. * GNU General Public License for more details.' Z! n* Q" N2 T0 M' ?
  23. */
    & x  u( Z# i5 e5 ^, a
  24. ; F; Q2 {3 `; w. z! g3 Q
  25. #include <linux/module.h>) x9 B( I% J8 G/ C' q
  26. #include <linux/init.h>0 e* m* O0 ?) X# E$ ]4 H
  27. #include <linux/errno.h>
    ; k+ O  i& k5 I8 U, k
  28. #include <linux/types.h>6 T, E- I! Y- K) u
  29. #include <linux/interrupt.h>
    % m) A- U% ?  }4 B/ x6 m3 [
  30. #include <asm/io.h>$ I1 m0 |; @+ X* r9 P) _2 e9 O
  31. #include <linux/moduleparam.h>
    5 E; D; g( h: D' G: O. x
  32. #include <linux/sysctl.h>
      y$ E2 w( M. ?2 M* N9 U" V2 \
  33. #include <linux/mm.h>
    5 _' }7 C( Y% e' v' T, l% W
  34. #include <linux/dma-mapping.h>
    - C5 g$ P. u( [3 G1 z2 I/ b; \
  35. ; ~2 d' V5 I7 P# _, Z! X
  36. #include <mach/memory.h>% W* k" m, E' {) A" U
  37. #include <mach/hardware.h>$ O, M% d' S* L  f( M# N5 F
  38. #include <mach/irqs.h>
    ! |4 K# Y  Q# O+ d- h) z
  39. #include <asm/hardware/edma.h>
    1 r; ^$ l- x/ j# b( }$ f( s- c& @
  40. 5 N' e, u' L) L
  41. #undef EDMA3_DEBUG  z$ |: r- i$ I- ~0 t
  42. /*#define EDMA3_DEBUG*/6 ~  o/ j% J* M9 B4 a9 b

  43. ' v1 G  F1 T, n) o9 g8 o
  44. #ifdef EDMA3_DEBUG9 ]( I" u  x' J0 T/ I& N
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
    " [  [) \1 s% V0 Z
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
      A" y) q) i& q+ B: R
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
    2 o: n* J; @# }- A% p6 t. D3 g
  48. #else
    / t" M" d6 W5 K0 Z
  49. #define DMA_PRINTK( x... )1 R! a( t7 d0 A, n/ P0 Z
  50. #define DMA_FN_IN# k- T. o* W. @/ i8 ^- ]. G# Y
  51. #define DMA_FN_OUT: I2 S9 u" x# w$ d% F/ Y5 T
  52. #endif6 w: B: O. o' H% m) i2 X; W, N

  53. ) j7 b0 i( O0 ?) \" q
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)/ R5 h1 L, c8 w& i( y; J  c
  55. #define STATIC_SHIFT                3. {% }2 \* ]4 M' `+ J8 y8 `6 Y
  56. #define TCINTEN_SHIFT               20
    + j9 S; B$ V2 c8 R' M* o& f: m
  57. #define ITCINTEN_SHIFT              21; n3 o5 [# j% i; g
  58. #define TCCHEN_SHIFT                22% ?. T5 l4 Q  K- D( b) h
  59. #define ITCCHEN_SHIFT               23% ~( g  ~  L( `; h% J9 N

  60. - t) M' v# x! G7 j( N
  61. static volatile int irqraised1 = 0;8 z5 q. D% c7 K5 \& w8 x
  62. static volatile int irqraised2 = 0;0 _" ?- p1 F4 t. l8 D! ]  p
  63. 9 u2 ~8 I1 u& Y) ?2 \9 a! K
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    : L- b1 m2 Y% E
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);5 k) r/ |# M8 r! c. E8 ?. k
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    2 g. t1 x% X8 i5 r1 s) B) N
  67. : G/ b3 w6 B  w& G6 A0 a  T
  68. dma_addr_t dmaphyssrc1 = 0;# Z1 J* i. k, U2 k
  69. dma_addr_t dmaphyssrc2 = 0;; }% ^; ^6 p% x, v# k
  70. dma_addr_t dmaphysdest1 = 0;! G' N" C' a, i6 |2 w3 N' P3 v
  71. dma_addr_t dmaphysdest2 = 0;
    . e  j/ d9 t) o. c* l% d( |

  72. 9 Q4 x8 A" G- Q8 N) x% _7 R" _
  73. char *dmabufsrc1 = NULL;9 y+ B/ w# Y) B& r2 ]
  74. char *dmabufsrc2 = NULL;
    $ a& q, O1 [: Y# ]' z
  75. char *dmabufdest1 = NULL;
    0 ^  f" f' e$ H  D+ t0 ~
  76. char *dmabufdest2 = NULL;
    2 o9 a3 O' G$ u3 I
  77. # r7 L2 L! j: z% v9 i; l5 H/ P
  78. static int acnt = 512;
    ; I& }( V4 f5 |, I( ~" C
  79. static int bcnt = 8;7 \* V0 w1 w; k/ Z0 I# H) X
  80. static int ccnt = 8;: U2 z9 c" Z- d  t) U
  81. 8 m* m/ e; B2 g, _+ O
  82. module_param(acnt, int, S_IRUGO);
    3 }- V! p# h- ~
  83. module_param(bcnt, int, S_IRUGO);8 Q1 i8 i" n& E# B& v. c+ l/ Z
  84. module_param(ccnt, int, S_IRUGO);
复制代码

$ o5 p3 J6 {. G8 Y9 k0 R* _( w, ^- i; u4 Z" s9 X8 M: b
      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用) V+ P: w. l  u, p9 {5 ^4 O
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/ k% O% l     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
/ B8 R. g6 D! s$ l- {5 {: p- @/ P( p

! |: s0 ?& \: W8 Y
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2026-8-31 07:12 , Processed in 0.040680 second(s), 26 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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