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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑   _. w3 h2 d0 E
  1. [code]EDMA sample test application
    $ Y) O8 p+ b4 C/ c: r
  2. /*/ N& a* l) o) D( u; `
  3. * edma_test.c  }) p$ v* P3 I
  4. */ ~( v. j( N1 u" [& v; C9 b
  5. * brief  EDMA3 Test Application
    + O/ O; M/ w1 f
  6. *& `1 @' r3 U4 U' @# Q+ O
  7. *   This file contains EDMA3 Test code.+ Q9 i2 R. X7 [4 [
  8. *9 c3 o' @  j: y: o% B
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
    ( B8 Z5 B* c' j* K: @0 {
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
      u/ G9 g+ ]2 q4 O" z
  11. *         TO CHANGE.
    4 ~$ i; P; [% A0 u5 C1 i
  12. *( I3 \" Q0 ?0 `+ Y' S6 b& u- I
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/1 [7 c" [. q0 _' O6 o$ P
  14. *6 U) _  O; v5 ~( {2 K
  15. * This program is free software; you can redistribute it and/or
      h* ~1 M2 a& p: [
  16. * modify it under the terms of the GNU General Public License as& Y: d5 F- A8 Z& x( ]7 I8 U! R
  17. * published by the Free Software Foundation version 2.; ~+ S5 f) Z3 \- d
  18. *( P4 ^+ T/ E# g* Y: E: u
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any
      F! ^) R8 n4 Q6 n) r' l  A8 R0 r
  20. * kind, whether express or implied; without even the implied warranty
      y% @1 R3 h+ G$ q
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    * I) {% A, t. X+ O
  22. * GNU General Public License for more details.; W- F5 ]# |. T# g/ ^- [% v
  23. */: |: x( W  B+ D+ O6 V) [

  24. ' F' S; \2 P+ ]! {$ X
  25. #include <linux/module.h>- f3 N& U8 M0 G4 E7 P
  26. #include <linux/init.h>% q: ~  ?- I9 h1 Z& q
  27. #include <linux/errno.h>7 O/ O; o% @4 l/ C3 f+ q8 B0 j- B
  28. #include <linux/types.h>
    8 B5 j. b# i3 C% w: v4 Q% M3 ^
  29. #include <linux/interrupt.h>8 q8 G% V4 h- A- O& V1 u8 H
  30. #include <asm/io.h>0 G( a& g2 O2 }: _
  31. #include <linux/moduleparam.h>
    % b! [; Y- p, o7 [2 {( W
  32. #include <linux/sysctl.h>% R  H" N* V& @# ~2 A2 J
  33. #include <linux/mm.h># w7 A" V: c6 q, q# G
  34. #include <linux/dma-mapping.h>
    * e3 x9 M/ s3 O, a8 V" h! U
  35. 6 e% A# H- b) E6 i# m
  36. #include <mach/memory.h>
    % E6 y1 C, B- I4 D9 I
  37. #include <mach/hardware.h>
    - E9 G% ]# s$ @, T, w$ U
  38. #include <mach/irqs.h>
    ; E" Y! o# [) X4 I( t
  39. #include <asm/hardware/edma.h>+ B6 `  b! n6 D$ D9 u" S$ \

  40. $ ?! X  J; j0 v) T% V+ d
  41. #undef EDMA3_DEBUG
    ' ~1 l. j  Y( x9 D+ W% g
  42. /*#define EDMA3_DEBUG*/
    ) M/ T* |/ X9 B- a3 {  `, k
  43. & J/ e0 q' q+ |' F! X  j* S
  44. #ifdef EDMA3_DEBUG' E2 A$ U1 i& M" W* ?9 a6 [7 [! D2 M
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)4 p* |( b+ b) i% h
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
    5 l7 F+ N: X: G7 ~$ s, Q- Q. j
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)  y' W3 b+ j! p3 T/ t5 b7 D. L
  48. #else$ ~+ f, Y. d4 y' w
  49. #define DMA_PRINTK( x... )
    . `$ A% N7 s1 N( n8 S
  50. #define DMA_FN_IN) h  p* A& |/ H. |% l/ ~* Q0 d8 A
  51. #define DMA_FN_OUT
    1 H; h* {1 G4 V) n/ P+ f
  52. #endif
    ! v, Y9 L; s' b' j4 a

  53. , i! _2 h; v, t; _% }
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)0 S5 e9 Q8 U' f. g9 G
  55. #define STATIC_SHIFT                3! ]; G+ K7 r9 t. ]; o! h7 n7 h
  56. #define TCINTEN_SHIFT               20
    ) X9 t0 C! f# |6 o% f" a8 F3 E
  57. #define ITCINTEN_SHIFT              21
    1 ?" J; p9 S3 E
  58. #define TCCHEN_SHIFT                22
    3 p1 N  Q: c* b' P$ _
  59. #define ITCCHEN_SHIFT               23" L8 H" A" [; E( `& m4 G' T9 R+ E2 A
  60. / f& X) d" b, B' x: }
  61. static volatile int irqraised1 = 0;8 ]# w7 F: j# B8 N3 i  N
  62. static volatile int irqraised2 = 0;1 h; r; ?/ x" N8 K

  63. - l2 F. B* }0 u
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);% I- ^" g5 D3 x8 o6 a+ F
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);4 {* S3 m# Q4 n+ Y
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    : h* w' X4 q- {6 c

  67. . g" {; P3 y) p: L
  68. dma_addr_t dmaphyssrc1 = 0;
    % `5 W$ u: z! S) }/ t4 @# x2 X
  69. dma_addr_t dmaphyssrc2 = 0;6 Z4 w+ L( ~+ Z7 B- F
  70. dma_addr_t dmaphysdest1 = 0;
    . n+ s9 N) ^! N4 S5 _
  71. dma_addr_t dmaphysdest2 = 0;
    8 y4 O" ^8 F( h! w1 g
  72. 4 f1 m3 d7 u0 A8 t
  73. char *dmabufsrc1 = NULL;
    7 q7 k; t; f$ S: f5 u+ `8 O5 n* B4 L
  74. char *dmabufsrc2 = NULL;
    " Y& I3 l7 [8 Z9 K
  75. char *dmabufdest1 = NULL;
    4 {  S* x" f  G; N9 s
  76. char *dmabufdest2 = NULL;% G! F' e6 X* p+ Y' P2 Z9 e0 h
  77. ' F) {: A1 n. F' R
  78. static int acnt = 512;
    % l$ c! k. O- s) A  f' F/ k
  79. static int bcnt = 8;
    ! n  L* _& l. L; V
  80. static int ccnt = 8;( v5 `, T7 a* _6 [3 u2 t8 f

  81. 3 G+ @! {8 l$ N+ G& A
  82. module_param(acnt, int, S_IRUGO);+ \( S# d$ O; Q2 n% d. j- o
  83. module_param(bcnt, int, S_IRUGO);
    ' W) R' U' p. k, Q1 a! Y
  84. module_param(ccnt, int, S_IRUGO);
复制代码

% N# `  S% Y  {6 f* s) x! u
( P# C1 d3 S+ H3 E      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
+ w- I  V* n. w1 {4 Z# S0 warm-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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
  t- g7 l$ S0 U9 x/ P- [) Q     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。0 U2 C. k) m1 b6 f) f2 f. U: j9 }( ?

: s1 Q/ b6 R+ L
6 z$ |7 h* B; G, M* \# w
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2026-1-28 23:56 , Processed in 0.039175 second(s), 26 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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