OMAPL138如何在Linux下使用EDMA3驱动 - OMAP-L138 - 嵌入式开发者社区 - 51ele.net
设为首页收藏本站

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑
& m' p& x) l. H) W
  1. [code]EDMA sample test application) M; F3 }% U3 H; K8 [' [
  2. /*) {% P5 z* k7 l$ ~
  3. * edma_test.c
    7 N. j4 [* i& I3 b: O
  4. *8 {4 }, B3 R5 ^
  5. * brief  EDMA3 Test Application
    2 _# w  c8 D$ X* f. k7 ^
  6. *4 }# y5 U, X3 v5 s
  7. *   This file contains EDMA3 Test code.3 B, E( v3 J: E; A
  8. *
    # e+ |1 a6 L) r+ W, C# |
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
    ! e8 n: E- L, K9 l2 d' N: D
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT1 j5 G& E! J0 {" g4 S; ?
  11. *         TO CHANGE.
    / b5 [9 d" T% e% N6 G$ P6 d
  12. *6 ?* |+ D' S$ h4 ]) z
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
    6 w# l5 _' z5 i9 C3 Z: R
  14. *
    % d3 Z* X5 H- G- Z
  15. * This program is free software; you can redistribute it and/or7 q0 I$ \* F7 {1 l) N- ]) b) N; o6 H
  16. * modify it under the terms of the GNU General Public License as: w' o2 Y2 h0 ]) P3 k7 W3 [* z
  17. * published by the Free Software Foundation version 2.& X% E6 e! b8 l4 g7 ~; D) B5 w$ c
  18. *  |2 a: [$ a7 l: f6 _9 g
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any
      z  _9 \' [3 I  ?2 K7 q  b
  20. * kind, whether express or implied; without even the implied warranty
    ) i4 |$ H  S9 V7 k6 B
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    & \% ?( x, p- k. ?0 I; k7 d
  22. * GNU General Public License for more details.+ C! n/ D# A+ j5 T- B0 b
  23. */9 t  F# R' @6 E. D7 W
  24. * y# u; V7 S1 R5 M: {8 \* H
  25. #include <linux/module.h>% D0 b) I9 |8 z$ m  A0 y
  26. #include <linux/init.h>
    ' U0 V9 J) n* F$ a5 m
  27. #include <linux/errno.h>
    , k* I% o/ k6 g  ?
  28. #include <linux/types.h>$ x9 G# G7 y: c
  29. #include <linux/interrupt.h>9 Z8 r* Q9 ~- j$ G% L9 d7 W
  30. #include <asm/io.h>5 P: Z7 M; C$ S3 H5 m9 c5 \& Y
  31. #include <linux/moduleparam.h>5 c( Y4 u8 y) w" ~9 J
  32. #include <linux/sysctl.h>
    $ D# ?3 l4 k) e% o7 r9 p# \
  33. #include <linux/mm.h>
    " g2 _" u5 S2 p! k$ c9 U1 X& ^5 W0 \
  34. #include <linux/dma-mapping.h>
    $ b7 b6 M& V7 J7 |$ L; p; V
  35. " m" s( o: n) F# M  p2 D
  36. #include <mach/memory.h>
    ' v* F! E7 p' w6 V, I' j7 ~
  37. #include <mach/hardware.h>  T( h+ t6 {8 h0 U2 c: M0 J) U' p
  38. #include <mach/irqs.h>( ?2 E( x3 M! j. _9 ^- O
  39. #include <asm/hardware/edma.h>
    4 r5 S/ k+ W2 a3 J' E& m* T' Y
  40. & [! H' B* A: X7 v6 W' W" V
  41. #undef EDMA3_DEBUG
    & k! s$ y% u9 u. W% m* E9 X9 F  {
  42. /*#define EDMA3_DEBUG*/! t$ Q3 P8 d! i; C) C, l, {, o& s
  43. * B7 ~! L. J6 v# a7 g
  44. #ifdef EDMA3_DEBUG; a5 U; b4 ?' h. Z) b( g: L  @- o4 ?
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)4 T7 d% {: p+ {4 J
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)0 ~7 T  N* ?2 f0 _+ ^
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)0 b& U' X- G: ]
  48. #else2 [4 H5 g7 ?* u7 F6 P5 n' Z
  49. #define DMA_PRINTK( x... )
    % p/ f6 o9 r. J, e1 i; E
  50. #define DMA_FN_IN
    ; R; |- R: O# t6 H( @4 ?
  51. #define DMA_FN_OUT# O/ l1 K9 J: y$ p3 M
  52. #endif
    ' ]* H+ T9 U: @& a' r* V
  53. * y2 y( w/ u6 f6 l& m
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)
    / d0 }5 U; e, t$ r1 z$ y7 y
  55. #define STATIC_SHIFT                3; _# G' A: C; T6 |5 c8 Q' O; q
  56. #define TCINTEN_SHIFT               20
      q3 p4 m& ~& b0 r2 P1 |
  57. #define ITCINTEN_SHIFT              21
      q, g8 m& [# J7 {
  58. #define TCCHEN_SHIFT                22
    8 p# t. K# C7 ]8 q' Z3 T
  59. #define ITCCHEN_SHIFT               237 [! E: Z1 l8 \; Z. o1 C

  60. # H' k7 i$ m( S- E' Q
  61. static volatile int irqraised1 = 0;6 E+ `6 P1 f% c: u6 [3 w2 K; A
  62. static volatile int irqraised2 = 0;' y% ]2 p6 |- D* |
  63. ! I! Y8 b- p( [& v5 L) \
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);( ]" r7 \! H0 S7 a9 D. A! x
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    : l' y) B& Y* U1 O* [2 x# ]$ {
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);  ~  {* ~6 _9 l4 K# H  x0 D

  67. * G, }0 U& v! C/ T+ e
  68. dma_addr_t dmaphyssrc1 = 0;% P& u# L4 s9 N
  69. dma_addr_t dmaphyssrc2 = 0;2 @* _; k3 s( I" J7 G9 {0 k
  70. dma_addr_t dmaphysdest1 = 0;1 f6 S9 Q; C, T1 ]
  71. dma_addr_t dmaphysdest2 = 0;
    ! r9 B! ?1 S% u# v3 y
  72. - W$ H2 k5 R4 |, [$ P
  73. char *dmabufsrc1 = NULL;
    - D( J9 i! L! d
  74. char *dmabufsrc2 = NULL;" J& d7 c2 t3 P- S0 V
  75. char *dmabufdest1 = NULL;
    8 r1 k# y4 p/ n' `, E
  76. char *dmabufdest2 = NULL;8 k# R) c  x# f: q) ]+ N
  77. . `, m& ~# z; `' [5 b, x5 s& r
  78. static int acnt = 512;& i1 Z& V6 f2 C2 ^* M, d0 D: `6 `
  79. static int bcnt = 8;# W% j3 @: m; c0 v' @
  80. static int ccnt = 8;
    ' E3 M# d1 ?1 I$ o7 I0 z

  81. + a! r" L! J2 G
  82. module_param(acnt, int, S_IRUGO);2 x# i# F* x" I+ ^
  83. module_param(bcnt, int, S_IRUGO);
    6 l7 g7 i7 C) U4 ?7 _
  84. module_param(ccnt, int, S_IRUGO);
复制代码
, p$ K: t/ ?/ a: l1 b
3 W0 X1 N( ~& w9 s
      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
  D* F6 t5 d. G! H  F8 jarm-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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。* u4 T7 W6 Z8 Y3 V" A
     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
* z1 S) F" {/ u* r7 J
  Q+ |1 \: r8 f  E. [
3 ^) C, X2 ~* `- Z- H- A: r
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

GMT+8, 2025-11-27 04:47 , Processed in 0.043083 second(s), 26 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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