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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |正序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑
9 E1 o# X, C9 H  A! a! d
  1. [code]EDMA sample test application& V; |8 _) D" e0 G- G; j
  2. /*
    * M& K  J9 V; Q$ N: f" E* h
  3. * edma_test.c
    3 g( W+ R" s+ U) b
  4. *; M# k, n' D# ^
  5. * brief  EDMA3 Test Application
    " l* k* ]  i9 ~' D6 `
  6. *
    6 ^7 q  {  w: v" g7 A* F9 k
  7. *   This file contains EDMA3 Test code.
    5 F. ?0 G. F' D5 H5 K% w9 |
  8. *5 X9 r9 {2 h6 F7 b
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE; d  d8 H9 }5 g1 }" U5 x  V# k4 h
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT0 t" p! z" t. {! g; `, @
  11. *         TO CHANGE./ A/ i  B$ H, b" o7 ^% D
  12. *! G+ c/ ?! q$ e' Q+ K
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
    6 I% A9 U  u+ z: K* v7 g0 Q' C, l
  14. *1 q3 Z: r% l; [0 R" u: G. }4 `
  15. * This program is free software; you can redistribute it and/or- ?- g. a- S# k. E1 r/ F( x& M
  16. * modify it under the terms of the GNU General Public License as
    6 O. K  y- b; ~7 V6 k, [
  17. * published by the Free Software Foundation version 2.% G; ^# X  C$ f" A5 a+ D% O
  18. *) v# b$ V  ^7 p+ ?  ^7 v
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any
    " X) s% |9 e* ~# `7 i& t4 i3 J
  20. * kind, whether express or implied; without even the implied warranty
    " @+ e3 T9 H: o) T
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the3 z* D4 j7 `/ g0 \" L  `
  22. * GNU General Public License for more details.
    ; t1 X6 o' P. r
  23. */+ Q% d- H% i& H6 C' E1 b% x6 h
  24. 1 l0 j3 Z6 F( Q/ X: @7 k
  25. #include <linux/module.h>; x0 `. U$ b/ d7 w! [1 q
  26. #include <linux/init.h>
    9 D& F+ B8 t6 ^& a4 H' S. }
  27. #include <linux/errno.h>
    ; g: l* m% e" }! H+ O
  28. #include <linux/types.h>
    % v( s/ c, D# Z. l
  29. #include <linux/interrupt.h>
    8 q9 e( g) H# t+ S# Q7 B7 t
  30. #include <asm/io.h>
    % n  y5 N. G6 M' P
  31. #include <linux/moduleparam.h>  }/ ?0 F5 m" |% c) t. ^
  32. #include <linux/sysctl.h>
    ; H# c+ V. H& d$ Y* C
  33. #include <linux/mm.h>3 C5 H0 B* }$ Q% a$ H3 m' Q3 \9 w
  34. #include <linux/dma-mapping.h>, F, P) g4 t. d* a3 n8 k* Z4 G

  35. + ~# N; x) n2 W' b  k
  36. #include <mach/memory.h>+ p$ \" \0 M6 C, S
  37. #include <mach/hardware.h>9 t6 K: u+ [7 ]& w1 p. I0 F4 B* ]
  38. #include <mach/irqs.h>
    7 r! ~$ y% {8 Q3 P9 Z# s7 c. k* Z
  39. #include <asm/hardware/edma.h>* D0 |" R6 |) a8 s. d2 q, Q

  40. ; q, f$ ~! |6 L) l7 r# @
  41. #undef EDMA3_DEBUG" ]1 T5 j# U4 e" {2 y- e3 W
  42. /*#define EDMA3_DEBUG*/
    3 U' V0 S5 a7 u( z4 d3 J$ ?
  43. $ G+ S8 H: Q) l* V+ E$ ?
  44. #ifdef EDMA3_DEBUG
    ! r/ }. n8 }1 s% c+ j) ^
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
    ( \7 |  @5 Q# P4 W; y; S1 ~# w
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
      C+ r0 t* ^' c' P8 N( I
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
    5 Y7 w8 b2 Y. }: b
  48. #else  q) b& J& a7 }! E
  49. #define DMA_PRINTK( x... )& v4 }0 Q/ ~1 K- R: l' m  S5 W
  50. #define DMA_FN_IN$ p: @" h! q% }0 C3 b
  51. #define DMA_FN_OUT
    9 y# {/ t' J/ y! ^! I
  52. #endif
    8 V( Q$ B/ ~% a/ N! ?
  53. $ N* }( u* a" ?# Z- _
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)
    4 C) b" ?0 b1 F, Z& q3 P
  55. #define STATIC_SHIFT                3
    , U4 R4 z% A7 d$ f( t
  56. #define TCINTEN_SHIFT               206 k9 \5 T( q$ O1 E% Y0 x
  57. #define ITCINTEN_SHIFT              21
    " R  F. l' s, X: A3 j
  58. #define TCCHEN_SHIFT                22
    + L( A- n# m  t9 l4 b: E2 W7 W
  59. #define ITCCHEN_SHIFT               23
    ( `9 p: G; d2 y) R1 G
  60. - V, O5 o  W9 f/ g2 e$ M1 X
  61. static volatile int irqraised1 = 0;
    1 `% x- j1 j9 P9 X
  62. static volatile int irqraised2 = 0;
    ! [+ u6 q$ h1 H. a

  63. : v8 w2 R! }. p; E
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    * r8 `8 {3 T6 e6 y% W
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);1 T* S' [. p+ N  e3 d# Z) L; g& |
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    - X+ J- b/ ^, y3 H- W

  67. ( T' u8 p: m5 j
  68. dma_addr_t dmaphyssrc1 = 0;+ {2 ~( d( L1 h7 V9 k0 [
  69. dma_addr_t dmaphyssrc2 = 0;9 b' q7 u* f; g5 c9 h3 L; @
  70. dma_addr_t dmaphysdest1 = 0;
    : p3 }( L# G3 y- U/ z
  71. dma_addr_t dmaphysdest2 = 0;
    2 S3 C+ c+ t  }
  72. ) S! f; ]5 {, `3 J" H& f
  73. char *dmabufsrc1 = NULL;' i8 b- z$ v; y3 Q1 V) a& \& @* t
  74. char *dmabufsrc2 = NULL;
    ! x2 j: Z  Y6 A8 s/ R& i
  75. char *dmabufdest1 = NULL;+ x$ S7 ~1 V, e1 A  W
  76. char *dmabufdest2 = NULL;2 V& a; E5 r/ H% ~0 F7 `! b! ]
  77. , a9 T! r! T$ b( q4 k/ n, j" ^
  78. static int acnt = 512;
    # x% P) R3 }' K& c5 X
  79. static int bcnt = 8;
    ) u# W. a/ D; F$ P$ X
  80. static int ccnt = 8;
    ' K# n( f0 Q) m. _7 d

  81. + ~/ Q0 ?  G; B  P7 V
  82. module_param(acnt, int, S_IRUGO);
    # u5 d5 b- c3 H) C0 T0 ^0 X# o# x2 y
  83. module_param(bcnt, int, S_IRUGO);! @2 U; ?8 C: @; q# [$ N% p# E
  84. module_param(ccnt, int, S_IRUGO);
复制代码

1 }) m( r& f3 l1 `. A$ M6 l: o; U4 \4 t' C8 n, B- }
      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
+ g* y) V4 Q. s& Q! Oarm-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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
- p( n1 C2 j' N: N( o; K; [$ K) Y  I5 s     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
+ c2 i1 W- n, \& P# t+ W. \: v" }$ ~, p$ ~2 `: V7 X  Q

6 K  y! ~' l4 X7 F
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

GMT+8, 2025-11-10 21:13 , Processed in 0.039739 second(s), 25 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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