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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑 ; l* Z5 `& x( H- z5 w
  1. [code]EDMA sample test application
    ( m9 _- [1 d& u
  2. /*5 K- ~% M; g+ m% L
  3. * edma_test.c) X- P& T: r7 ^. p( d( u
  4. *3 p- d6 m0 [/ d6 H# j" S
  5. * brief  EDMA3 Test Application/ K: a6 v1 U/ i) \5 r
  6. *
    $ V9 q' _* v: m9 o6 j$ ~8 k8 l  }$ N
  7. *   This file contains EDMA3 Test code.- g( I1 ^% b; T5 o0 O1 S
  8. *
    3 P7 y/ v$ @$ q6 x4 n
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE% h$ K! l$ U; X& q! s
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
    8 ?, W: n: u8 ~
  11. *         TO CHANGE.
    + ^' [( J/ d  V: Y
  12. *4 n# c* X% n3 ^0 z0 J
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/# I. @% h& `% ^5 R$ J
  14. *% u1 l+ p) N7 ]6 t
  15. * This program is free software; you can redistribute it and/or; v5 U7 E2 n* Y# B/ Y
  16. * modify it under the terms of the GNU General Public License as* s% B  b# r& H3 |9 e9 V( q7 E
  17. * published by the Free Software Foundation version 2.
    & q  p, ~! a& O! V6 {" I
  18. *, \2 l5 Y$ D# [% p3 g
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any
    8 f$ `& ?& W. k3 _( H
  20. * kind, whether express or implied; without even the implied warranty; ~' n. A6 q4 k$ S5 c
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    2 `$ U+ I, V7 J' p+ E+ ~
  22. * GNU General Public License for more details./ e( L9 v3 H, k8 ^5 W0 m
  23. */' x7 f, d/ H/ i
  24. 0 Y3 i' Q1 j9 Z! C! Y& ~0 m
  25. #include <linux/module.h>8 X. x% ?" E2 t( \+ R+ E5 s- i8 M
  26. #include <linux/init.h>
    6 D) {( y, q5 G
  27. #include <linux/errno.h>
    4 ]$ g2 k8 P0 R4 i. x
  28. #include <linux/types.h>" c5 x8 A1 H7 c* [7 J9 S
  29. #include <linux/interrupt.h>) S- m! [- H  P6 g. g
  30. #include <asm/io.h>! C! |  D: N7 s) q( Y
  31. #include <linux/moduleparam.h>
    % `) X; B; v- v; u! d
  32. #include <linux/sysctl.h>3 c4 U9 X( K! t8 Q" l& @7 X, v4 _
  33. #include <linux/mm.h>+ K7 y" S+ h3 K/ g
  34. #include <linux/dma-mapping.h>
    9 r" |$ o" }( X1 }

  35. ' s. X; |! J" V" u- [
  36. #include <mach/memory.h>; ]6 c! u1 G. y
  37. #include <mach/hardware.h>
    2 D; e$ I# l. c0 z
  38. #include <mach/irqs.h>! ^( j% h9 j; T( n9 E
  39. #include <asm/hardware/edma.h>& y2 p, o, T) y9 @1 V
  40. 2 ^' _1 Z) i7 D2 i- r( N5 h$ \+ ]
  41. #undef EDMA3_DEBUG
    / m9 ~9 X! |5 u: S; t& C
  42. /*#define EDMA3_DEBUG*/
    ! j  i% s3 h' n0 ]& X

  43. * l9 H* r6 Z% _& W5 {
  44. #ifdef EDMA3_DEBUG$ f& A# ?: K- b$ B; h6 i9 r! Y7 F! E
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
    9 p- P4 v1 X' Q9 \5 @5 |& b
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
    * \1 X' I8 |% \0 g7 d5 C
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
    * J( o+ L- v' U, z  j( h- w# A
  48. #else
    # g  k& ?# w9 P( W
  49. #define DMA_PRINTK( x... )
    $ x& |' j& f% ^& P1 X
  50. #define DMA_FN_IN7 f7 H, c* M! F  V2 B3 V' J
  51. #define DMA_FN_OUT4 F2 E1 [" T2 E( J0 i- ?  N
  52. #endif% ~; g1 g& D5 [. [5 A0 Z

  53. # }$ r0 d4 `' q- g4 C4 l
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)
    % N. J8 p  R) k$ Z/ d' Y
  55. #define STATIC_SHIFT                3
    0 g0 P0 R/ \7 K" D
  56. #define TCINTEN_SHIFT               20$ |0 D8 a8 N- v/ F4 `
  57. #define ITCINTEN_SHIFT              21$ f' G; g7 G6 y2 ]
  58. #define TCCHEN_SHIFT                221 E9 s7 l# O* J# H! O
  59. #define ITCCHEN_SHIFT               23, E0 p+ M4 Y5 w$ M7 S& y; u

  60. ) m, `' M* c5 D: U5 @* M4 o
  61. static volatile int irqraised1 = 0;+ ^; G* R$ d: p2 M6 T
  62. static volatile int irqraised2 = 0;' c; Q# M2 i9 n7 i/ x) [( ]8 x! j
  63. * {1 o3 ~# |2 x7 k2 \
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);$ t( L$ @/ T% I+ z) j7 ]) s
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    ) P1 O/ q& {( P. ]1 v* V) g
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);( r- P* C1 t! e! }

  67. ! @* s' s7 W, A; G# y( w: }4 M
  68. dma_addr_t dmaphyssrc1 = 0;
    / K) i  Z- h1 J+ y' l. u7 F8 @6 D
  69. dma_addr_t dmaphyssrc2 = 0;
    5 E& a& ~' w. v, s3 N  S
  70. dma_addr_t dmaphysdest1 = 0;
    $ ^8 H4 O2 ~& k6 l$ d0 D
  71. dma_addr_t dmaphysdest2 = 0;
    / m& K  M9 x5 R0 Q! Y$ X% j
  72. ' K8 }) H, E# N
  73. char *dmabufsrc1 = NULL;) E3 s6 V2 z! ~" M0 H
  74. char *dmabufsrc2 = NULL;
    + x- U2 I9 W6 U( r5 H3 j# N) k
  75. char *dmabufdest1 = NULL;# m% {9 W1 B* J' r2 a0 H  `
  76. char *dmabufdest2 = NULL;; J  x# f5 l% H  O* Q3 ]' Y  f9 o* Z2 y# `; {
  77. . Y+ [" v. c2 I% W3 S
  78. static int acnt = 512;9 d8 u4 ^# W! J$ d4 S1 e8 E
  79. static int bcnt = 8;
    ! e" U5 {% q' z1 U  L! J" v
  80. static int ccnt = 8;
    0 B, S# P) y, }3 w; h8 v

  81. + ^- d2 J( m. X" |
  82. module_param(acnt, int, S_IRUGO);
    8 X# |2 U( Z; I9 f" A" ?# Z
  83. module_param(bcnt, int, S_IRUGO);
    3 _# d: n& r" v2 U. Y. }/ p
  84. module_param(ccnt, int, S_IRUGO);
复制代码

# G5 a: o& b2 |0 s% j+ O; K* o  y7 F$ K5 N, J
      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
' q3 _" Y/ d5 ~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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
$ d2 w8 d$ L  O     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
; R/ A: r, _( \6 T: i
0 Z5 Z1 B" A$ f) w% {# M0 S
5 E; Z/ J* c" M
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

GMT+8, 2025-11-14 03:30 , Processed in 0.057445 second(s), 25 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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