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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |正序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑 ; U$ S$ _* S7 W/ n6 m) s
  1. [code]EDMA sample test application/ j- `8 ~: a, g& a1 A" C: x5 U+ [" _
  2. /*6 r& t! J$ o# Z+ X3 I" {0 G0 D0 |2 B& [
  3. * edma_test.c
    " g3 O7 o% e5 P) K. I
  4. *
    8 c3 k6 B( j7 F
  5. * brief  EDMA3 Test Application
    9 x( |7 c. Y+ q$ T  O) k/ n
  6. *
    0 V0 p) f) Y2 ~( G, D  f$ C# V
  7. *   This file contains EDMA3 Test code.
    8 A9 |& Q- {. h' d; D) `$ y1 ~
  8. *
    - b+ B- I* s' h5 ~5 Z, [
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
    * e6 ]7 D: R, j( e, R
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
    3 G$ o& j+ L% T# @) P: p
  11. *         TO CHANGE.
    ) u: F0 `5 I; T) t4 g
  12. *% w" S  l4 E+ d& a0 D: y0 w6 q4 c
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
    & y, B9 E* J# A3 |+ ?+ b
  14. *4 w" V5 N% N- g% K% V
  15. * This program is free software; you can redistribute it and/or/ U2 X) O. q- ?: [' k# [! m( J
  16. * modify it under the terms of the GNU General Public License as5 m9 S/ A) b& A' X% ]' ]* {
  17. * published by the Free Software Foundation version 2.% v$ p, ]2 o" y
  18. *
    / P( `3 {1 p5 c6 C* [
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any
    , N! Y" r1 o' U) w, i$ p! R
  20. * kind, whether express or implied; without even the implied warranty
    7 Q& z% ~# u! x8 x! H( X  f  \  ~
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    9 O* X% P: d1 U3 F, N) f
  22. * GNU General Public License for more details.! z9 O' t2 j; o+ W
  23. */
    % q5 ~( O! y, j1 }! j6 g; k/ X
  24. 8 ~% Z1 b9 D- k( }9 F
  25. #include <linux/module.h>, m: e7 K7 e4 @' h! a7 ?, M. p8 u/ O
  26. #include <linux/init.h>
    6 [3 A4 f9 r$ M6 X& z
  27. #include <linux/errno.h>0 {6 ^5 V: K3 P6 l# P7 R  I9 e8 I
  28. #include <linux/types.h># }1 [# X" w8 n8 @, [2 l7 l7 Z9 h. ?  ?
  29. #include <linux/interrupt.h>
    4 \* I* |; N; t5 Y
  30. #include <asm/io.h>
    7 ]& v2 B8 f* }; P
  31. #include <linux/moduleparam.h>5 ?& u' \7 S6 U" B6 c) i2 i
  32. #include <linux/sysctl.h>
    7 d9 l3 A7 {8 `, R; W) Q8 C
  33. #include <linux/mm.h>" O' ~4 `. k% ]
  34. #include <linux/dma-mapping.h>$ K, I& N/ G8 V! }; @0 L3 t

  35. - I6 k" l+ p& m  K" a1 {
  36. #include <mach/memory.h>8 [+ Y( }  J1 ^# h
  37. #include <mach/hardware.h>
    9 m+ E; R* b/ U2 N7 k1 O: h
  38. #include <mach/irqs.h>
    6 L6 g( A& |  }$ V1 D
  39. #include <asm/hardware/edma.h>
    # q6 Y$ m" F: Y. Z3 p
  40. 7 z8 C5 L2 ~* u4 |, z
  41. #undef EDMA3_DEBUG
    ; l0 x9 d) p4 l
  42. /*#define EDMA3_DEBUG*/$ ?* B. w! y: z! Z8 f

  43. * [# @7 t* E, x8 u
  44. #ifdef EDMA3_DEBUG; n, s+ h( P- K( m; u, h& q
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)* ~! s) g6 Y6 u3 P* x% ?' S  j' C
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
    ' K# {0 e% g5 p1 k* B
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
    4 `) X4 n( X# L2 _7 I9 r6 ]
  48. #else
    & H7 @, w9 ?/ K( v
  49. #define DMA_PRINTK( x... ); a6 s/ y0 h) K) f
  50. #define DMA_FN_IN
    " g0 r7 C& U  i9 T' @
  51. #define DMA_FN_OUT6 ^7 f& k, W1 J
  52. #endif4 M8 S) s5 c) Y% H+ c0 n
  53. " `) T$ b& u3 }
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)
    : S  R% O/ o7 Q6 o9 K
  55. #define STATIC_SHIFT                3" L8 b, R# H5 V9 e7 |2 o
  56. #define TCINTEN_SHIFT               20
    # R" v" Z. b0 c1 r8 u1 j4 D# h
  57. #define ITCINTEN_SHIFT              21: m' M2 P% Y8 ]$ ?
  58. #define TCCHEN_SHIFT                22; W. ~: p1 l8 e8 }/ j2 n
  59. #define ITCCHEN_SHIFT               23
    2 I) i7 G" z) _

  60. & j' K7 C; s$ b0 ~
  61. static volatile int irqraised1 = 0;* m' K- X: u: W9 C' A
  62. static volatile int irqraised2 = 0;/ I5 g) }$ g0 A- O/ T
  63. " P2 J* ^' n+ D% Q6 j5 ^3 j
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    & O. F. y% M' w. C) |/ u, P. N
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);$ p' j) w( B" x6 `9 |% s7 X
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);, b$ r% @9 {" ]5 ^) w0 [8 ~
  67. 1 q6 t  ]$ J& ^9 `9 A4 \
  68. dma_addr_t dmaphyssrc1 = 0;' n( x8 ?& |$ E! L2 G/ {1 K
  69. dma_addr_t dmaphyssrc2 = 0;
    , @: P' c) {$ ]7 M
  70. dma_addr_t dmaphysdest1 = 0;0 g) b$ d1 ]# B8 D' Y4 R( o% W# \( l  y
  71. dma_addr_t dmaphysdest2 = 0;
    " l. B. ^' x; R  d7 C( K5 o$ k

  72. , b) J6 J" w+ J8 F
  73. char *dmabufsrc1 = NULL;
    , |3 A4 e- r2 w$ \( i3 k, K( P0 `
  74. char *dmabufsrc2 = NULL;: M2 N- c2 Y! F! f+ U3 B
  75. char *dmabufdest1 = NULL;/ p, F5 a; P, `
  76. char *dmabufdest2 = NULL;
    - x# Z& c- ~; D* I
  77. 2 H9 n2 A$ m8 M7 o1 B' R6 w
  78. static int acnt = 512;
    3 A& ?. Q2 |  I0 o
  79. static int bcnt = 8;1 Y. C! k4 g/ {1 d; w( L
  80. static int ccnt = 8;6 o7 p7 R% v7 R; a/ F! }: g/ s
  81. ) y7 |% T8 M: ~4 c3 n6 P; [  p4 C
  82. module_param(acnt, int, S_IRUGO);
    " T' Q6 ~/ g5 Z; h; q& C+ c; N
  83. module_param(bcnt, int, S_IRUGO);* O! i" G# x5 U) J/ w
  84. module_param(ccnt, int, S_IRUGO);
复制代码

1 z, o4 u% g7 r( a( _7 A8 y$ M" ^' q
      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用- m$ G) @/ T6 L; D; |1 f
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
/ N2 t0 D! Z7 p6 e+ X     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
# H3 [9 w& m7 h& _" ?' v1 q7 `8 S
0 f/ b+ z, O0 x4 O" V$ T  H- J
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

GMT+8, 2025-12-15 20:27 , Processed in 0.038535 second(s), 25 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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