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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑 + R6 m& B1 B) @3 v
  1. [code]EDMA sample test application# b9 F# Y9 p2 Y, K: T
  2. /*# V; ?7 x0 `  K3 k/ W
  3. * edma_test.c
    * o. m$ ]+ b  H, g4 c* v' C  }
  4. *
    1 s* {: O9 s2 W( w3 z; D  h
  5. * brief  EDMA3 Test Application
    . x0 m5 F! F+ v& v$ v, V
  6. *4 D' z4 K- ]& @; I& A: T7 y
  7. *   This file contains EDMA3 Test code.
    9 z( k& x. X6 N& Y
  8. ** P) b6 j. V2 e
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
    : N7 `7 u8 {) {: `
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT0 w4 [$ [- W& \  i) n# H# P
  11. *         TO CHANGE.
    ' r6 g+ r4 j4 |; r  O, s: k9 ~
  12. *" ]7 R) C* a3 Q' S- Y% Q5 o# v
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
      t: ~8 s$ R& n( S, ]
  14. *$ }1 {" |+ B4 g
  15. * This program is free software; you can redistribute it and/or
    ( ]0 S; z1 T! C0 [7 D
  16. * modify it under the terms of the GNU General Public License as* R% W2 n% U% g7 [
  17. * published by the Free Software Foundation version 2.
    ' T+ _- Q# ^, n9 C
  18. *
    ) k3 g( U- [! ]# }+ B
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any
    4 u% C/ v2 @% q7 Y' T2 V6 y
  20. * kind, whether express or implied; without even the implied warranty- E1 `% c. c* d
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the) r; S: x9 \$ a5 T! u2 u3 m# m
  22. * GNU General Public License for more details.- G' E( A8 i2 e  Z4 t7 [& A% |- b
  23. */5 T6 E% U' b) r; v3 Z

  24. 8 S4 {. z9 W6 ^
  25. #include <linux/module.h>( m* p4 {+ a8 z$ |
  26. #include <linux/init.h>1 Y5 Y! R2 q. j1 a
  27. #include <linux/errno.h>2 }! U/ \! n" d1 M3 L* p
  28. #include <linux/types.h>7 K' L1 {" c0 _8 w
  29. #include <linux/interrupt.h>
    " Q, g3 }9 E0 C3 o
  30. #include <asm/io.h>
    ; O, B' J+ ?% b6 w# A
  31. #include <linux/moduleparam.h>
    : t& q+ o! C/ s. F" N9 v
  32. #include <linux/sysctl.h>+ N# u" ^7 J) A; @" l  I4 U5 G
  33. #include <linux/mm.h>0 ^7 t9 h" G, v* X
  34. #include <linux/dma-mapping.h>
    " w2 W/ i; o' M" Y7 c
  35. + n7 I; D) s$ @. U
  36. #include <mach/memory.h>
    4 Z- H- O+ |) ^& r+ q  J
  37. #include <mach/hardware.h>) X" w  F# m7 J9 V, _
  38. #include <mach/irqs.h>
    6 k/ e4 M, {* E" g5 X/ D" ~% N8 Q
  39. #include <asm/hardware/edma.h>$ Y% n7 ]) M) }6 e3 Z& |. e

  40. 9 H" c6 Q( F! @5 e' Y( s0 R& H
  41. #undef EDMA3_DEBUG$ O; W  K1 I4 v* r+ _4 a
  42. /*#define EDMA3_DEBUG*/& i( v3 c6 z! O% \
  43. * y& V8 ?7 w8 I6 {! O9 h  |
  44. #ifdef EDMA3_DEBUG' D) P$ \! m- ~( K$ k" s
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS). T* E) R: ]1 l* W( O; S
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
    - f/ q/ e) ?7 j( ?. H4 c. L5 q3 d% P
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)/ z: R1 Q$ J" V! Q6 R
  48. #else
    2 s7 s5 l1 [% m
  49. #define DMA_PRINTK( x... )
    ( Q- t8 l( w4 {. Y7 }
  50. #define DMA_FN_IN
    , t1 L; ~: j3 u. U
  51. #define DMA_FN_OUT
    8 o1 S3 j! Q9 l
  52. #endif2 G* D) o' d" a6 ~5 y
  53. # l4 h) v3 v" ~7 O. S
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)
    # s+ G$ d; f, e& ^8 M4 x* T
  55. #define STATIC_SHIFT                3( f  j% I2 x; q! s3 n
  56. #define TCINTEN_SHIFT               20
    : i3 g1 O- u+ [* f1 a& Z+ q$ Y4 {
  57. #define ITCINTEN_SHIFT              21
    ) ^8 w$ }$ x3 T8 T3 ^% r
  58. #define TCCHEN_SHIFT                22
    : E0 A) p; Y/ s  Y- ~
  59. #define ITCCHEN_SHIFT               23
    : h- B/ U1 Y) e/ j8 a8 K
  60. 5 \% k# n7 ^! F+ `) g; }
  61. static volatile int irqraised1 = 0;
    ' J+ D2 D) d1 W3 E- K$ p$ Q
  62. static volatile int irqraised2 = 0;
    / @! k$ B0 M& d7 W: v
  63. ; X( E0 X% R4 E6 K; m
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);) G# f/ M% B7 X; t% N
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);% t. q+ V$ E8 @7 o8 K
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    6 a4 G' y) v. P/ U
  67. , v' B  E1 i# m, W
  68. dma_addr_t dmaphyssrc1 = 0;% D! l/ E& S) }* ?
  69. dma_addr_t dmaphyssrc2 = 0;$ Z, }$ Q( O* R
  70. dma_addr_t dmaphysdest1 = 0;+ s# @9 s% N  [3 {, N5 x
  71. dma_addr_t dmaphysdest2 = 0;
    0 z+ w6 L5 ?3 A

  72. 7 L/ ]) D+ K, P
  73. char *dmabufsrc1 = NULL;; N1 t; |9 ~2 G4 H% B( D/ C
  74. char *dmabufsrc2 = NULL;1 |- t. y4 m: |, q, |$ |/ t) ^
  75. char *dmabufdest1 = NULL;
    , J( b& [- `! z6 C$ S/ o# x
  76. char *dmabufdest2 = NULL;5 d! o  X0 y4 ^* R( l5 r
  77.   t6 K* ^$ a" a4 N# E
  78. static int acnt = 512;
    2 r! F9 |* [# T# A$ J# ]/ U" \9 T& Z
  79. static int bcnt = 8;
    ' b8 S* m$ }( U: y. @: y
  80. static int ccnt = 8;! m& a$ |  B& }  e- _

  81. ' D2 J! t1 u- ?8 o# M9 \+ p" d
  82. module_param(acnt, int, S_IRUGO);
    4 Y$ E% T8 K; D1 H3 P+ R. y
  83. module_param(bcnt, int, S_IRUGO);
    5 w4 N7 c+ ?; e! Y+ x5 H7 x
  84. module_param(ccnt, int, S_IRUGO);
复制代码
' ^; H- f, @+ x9 }

1 v; A* s, i  v8 n* f7 ^& a      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
. }" C, H' d9 `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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
- i1 U: z! r$ q3 J9 W     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。0 o' M1 a& f5 K* \9 h  x

' v2 I3 y# n5 f, P6 p
0 b4 \  V. o) I0 m
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

GMT+8, 2025-11-14 17:20 , Processed in 0.040919 second(s), 24 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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