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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑 5 ~1 X% X# A& |4 q
  1. [code]EDMA sample test application
    + ]1 U$ H6 r- N" {! _
  2. /*. K& T: U- T/ A$ x9 ~
  3. * edma_test.c4 B' d; ?0 j* w+ w% y
  4. *
    8 ]; A8 r! y- E2 I# j
  5. * brief  EDMA3 Test Application" m' L5 Y( b$ \" s+ d
  6. *
    # `1 H( l# I7 Q& D8 z; u! n
  7. *   This file contains EDMA3 Test code.
    % ]2 _* V$ I9 v: K/ I
  8. *
    ( l: `; p# R' L% L1 A) w
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE9 }  m4 b+ y7 z9 b1 B5 b
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
    - [) [  Z& M5 R" ?, T* p" y4 z
  11. *         TO CHANGE.
    + c3 r! Q6 i: ]  z" W/ X; }$ F0 Y
  12. *
    5 b* X& [! ~8 ?- ~1 \  ~0 N
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
    2 p* Z, ~% {: e2 K
  14. *
    % g# A1 G8 k! g. q- e  L
  15. * This program is free software; you can redistribute it and/or! @" @$ P, ^: M: I, a
  16. * modify it under the terms of the GNU General Public License as9 x9 |# Z! l' s% B9 V1 A
  17. * published by the Free Software Foundation version 2.$ S+ ~2 d' K# b/ ]' e( v
  18. *. U; o1 w4 e6 q2 A) x
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any/ i; V# T; d* s0 S" r
  20. * kind, whether express or implied; without even the implied warranty
    9 v. ^5 w$ x2 w9 a' \
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the5 T1 F: z  p! \! }2 D0 ~
  22. * GNU General Public License for more details./ C0 R+ Q0 ]/ r; o4 D5 ?6 K
  23. */3 h+ ~) |- O# e* Y
  24. 9 O# D, ]: N& j2 ?
  25. #include <linux/module.h>
    + w8 _* P1 {5 C0 X! [$ m
  26. #include <linux/init.h>  B9 R3 e" l2 k: F; F
  27. #include <linux/errno.h>
    0 K8 R. @+ ?/ S* i; f( g3 A9 \; f
  28. #include <linux/types.h>
    * M2 X) ?! s+ Z. @
  29. #include <linux/interrupt.h>
    - {" N' J+ s, I1 i& t; b
  30. #include <asm/io.h>- w: x6 A% ^4 N+ }1 t0 t
  31. #include <linux/moduleparam.h>: e, V. I- H0 P3 S
  32. #include <linux/sysctl.h>9 x4 G+ U- A0 V+ v/ V$ l" J/ j2 p
  33. #include <linux/mm.h>
    . n7 O1 u3 p- I
  34. #include <linux/dma-mapping.h>
    1 A% d4 {2 a9 A2 [1 b
  35. , l0 @8 W8 f9 i( x1 S( s, y, W
  36. #include <mach/memory.h>/ g5 h' w: U4 p7 c% g
  37. #include <mach/hardware.h>! V" t+ @. n8 |
  38. #include <mach/irqs.h>
    3 t4 G/ K8 N' J: E
  39. #include <asm/hardware/edma.h>
    , O8 H5 @* I: j& b! m6 o9 l
  40. 7 k. o& _8 v) W
  41. #undef EDMA3_DEBUG' u. F. W" J& Q4 N1 e
  42. /*#define EDMA3_DEBUG*// x: I% a8 m3 K8 O& w

  43. : b) A; ~4 r; E' I# Q! Z4 S  B% K
  44. #ifdef EDMA3_DEBUG2 w$ \3 G1 {( Q5 U, |9 z$ v; P
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)$ B5 l) |! R& H: p  ~
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)8 J/ f; B! A: ]- c% ]
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)+ n" K' f0 G) z4 Q$ V" N
  48. #else
    9 L. R" [9 m3 D  r, F* u6 f+ s
  49. #define DMA_PRINTK( x... )) H. P0 w7 H3 l: ~0 N9 ?: ?1 `/ R  ^$ M
  50. #define DMA_FN_IN
    " h& X6 F2 B8 k
  51. #define DMA_FN_OUT
    ' J; G. f: b7 q5 n1 ~' B. b0 J
  52. #endif
    - j, J! X8 D$ J

  53. " p7 ^; X( L! z# D& Y( C
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)
    - n- Y% ^' {% d( \: C( ]- Q
  55. #define STATIC_SHIFT                3
    % N& W7 S% b3 U1 q* K7 C& _4 P
  56. #define TCINTEN_SHIFT               20
    $ p" L3 s' S4 L( Q$ j0 _. O
  57. #define ITCINTEN_SHIFT              21  }) B9 r  G; H
  58. #define TCCHEN_SHIFT                223 `! g2 T/ I8 k4 _: i0 p
  59. #define ITCCHEN_SHIFT               23
    / ]6 j9 H8 \7 C

  60. # h/ i- v1 x% S9 }, U) W# f5 Q
  61. static volatile int irqraised1 = 0;! u8 t& G' m- }4 ]
  62. static volatile int irqraised2 = 0;$ K# G# {' b+ ~2 R7 A9 Q+ {

  63.   y7 E6 w9 Z" C% p1 ~7 H6 D! D; M
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);# n( R& U6 `) p% c/ I9 \& P
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    . F- W" H2 o7 S5 r5 K( O" |
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);5 k# X( t, Q; ]; I. R
  67. % G* n. h& p; X; P0 M. P) r/ `
  68. dma_addr_t dmaphyssrc1 = 0;
    2 H: K- ^, c2 V2 a2 W
  69. dma_addr_t dmaphyssrc2 = 0;
    # t+ y! Y) [4 O( o
  70. dma_addr_t dmaphysdest1 = 0;: N3 g2 ^! _% l0 M# x4 M% o; h
  71. dma_addr_t dmaphysdest2 = 0;
    7 m* ^1 `0 N& S% y  l* j. i5 W7 d1 A

  72. * a$ x9 s6 M  `: ~, O
  73. char *dmabufsrc1 = NULL;
    1 @6 q" [2 C+ m9 P9 M4 B; S) W
  74. char *dmabufsrc2 = NULL;
    ; t, G+ q$ b  v4 H# }, q, D8 C" n
  75. char *dmabufdest1 = NULL;* A4 Z4 o9 y1 i5 J* x% }/ e0 r
  76. char *dmabufdest2 = NULL;
    / `9 g; E7 e0 K6 o3 N9 C
  77. * A4 E9 D" m2 `. Z  T6 J& R* m
  78. static int acnt = 512;4 f! D1 }3 N1 ~3 P/ F
  79. static int bcnt = 8;
    ) V# `+ o$ b) g
  80. static int ccnt = 8;6 G  [) ?! e3 s1 F+ t0 |
  81. , R& u+ r  x1 ^; V" w
  82. module_param(acnt, int, S_IRUGO);
    3 @' U' W4 P" j6 C! T$ T
  83. module_param(bcnt, int, S_IRUGO);- g7 \0 B1 Z4 B" H+ b: `
  84. module_param(ccnt, int, S_IRUGO);
复制代码

# m2 k8 D- Q$ M$ l* J4 y# t4 P3 @+ p) p: B1 M9 }1 N9 @
      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用* t3 F$ Y2 c1 r4 e/ Z- ]! h
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
9 d; Q/ u% y4 K+ c* y/ `     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
* n4 X! [! ~$ U# t
  d& M; |7 A% ]7 k; X3 U: v2 N) ]2 |5 w. }  S
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2026-2-27 11:15 , Processed in 0.042648 second(s), 25 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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