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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑
0 Q5 I+ j) W& v2 |% l; |
  1. [code]EDMA sample test application- s6 X4 s! g0 v
  2. /*7 ?. \$ r+ O# M1 b3 a+ m
  3. * edma_test.c6 t9 |& T2 t3 L" k" P8 L' b& L4 j
  4. *& ?; k4 M6 z/ \
  5. * brief  EDMA3 Test Application; |9 z; e. K" L7 W
  6. */ M5 g8 c/ y. i  m) I
  7. *   This file contains EDMA3 Test code.
    ' g9 o/ c* d7 j7 L
  8. *
    ) X* _1 A# B- L- ^" X. H0 X
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE% ]# E  E2 `" s2 L4 {  Y( m- ]
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT: w; p( S' ~+ w
  11. *         TO CHANGE.3 Z1 S6 l4 ~$ G$ M
  12. *
    % f' c$ x9 y+ f6 |8 X7 z! L1 C; y
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/8 N* ^6 P( F- Y  O! b: [  {
  14. *7 G5 c& k6 ]. E: Z
  15. * This program is free software; you can redistribute it and/or& ^& p$ ~6 l2 c  e0 v% Y+ e: X8 h
  16. * modify it under the terms of the GNU General Public License as
    ) Y7 @) N$ n" ^7 \; B
  17. * published by the Free Software Foundation version 2.
    % J4 {4 D+ m" V) _: j& m( `
  18. *( `; `" Y. @1 y3 C
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any
    ! a0 w" H% d$ d
  20. * kind, whether express or implied; without even the implied warranty
    * J8 Y7 e2 i% `
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    3 L8 t8 h9 g$ V/ C
  22. * GNU General Public License for more details.
    ! v/ A! F' r9 S: I
  23. */4 D3 D  r4 q5 c/ R$ a1 h/ Y( t

  24. 2 Q$ P  n4 p) e- A3 J$ o' k1 Q+ a% U& e
  25. #include <linux/module.h>
    3 P; t! y' c2 C6 E
  26. #include <linux/init.h>
    6 |8 }5 x0 _" R( a+ e# L5 B
  27. #include <linux/errno.h>
      K  l1 L* @% y" }$ @4 ~& i1 Q
  28. #include <linux/types.h>
    ; D8 ]  @# `0 e) x% d0 x
  29. #include <linux/interrupt.h>7 r& B( T) G" \9 X
  30. #include <asm/io.h>3 l: F" b, v/ n# {5 l
  31. #include <linux/moduleparam.h>
      m0 C* L1 K& s
  32. #include <linux/sysctl.h>
    5 C  I( Q  I* `
  33. #include <linux/mm.h>/ m# r/ `4 z# t
  34. #include <linux/dma-mapping.h>1 \8 s$ Y5 J4 s

  35. / N4 O; \% O* O6 c  N2 j" B7 B* r0 w
  36. #include <mach/memory.h>
    . B3 z' @! |# k- |
  37. #include <mach/hardware.h>
    . G3 d# n. r, T3 n- ]* k: [0 K9 A  M4 R
  38. #include <mach/irqs.h>% C8 D/ }; W8 Y/ b; V! d! y) d
  39. #include <asm/hardware/edma.h>  h0 A, g6 \; v# H9 M+ s# Z

  40. 1 I5 Z; q" \0 ?2 u/ H9 m$ ?) K
  41. #undef EDMA3_DEBUG/ U2 G1 |6 V; g* }* o; g
  42. /*#define EDMA3_DEBUG*/
    9 @7 Z0 J, L9 A3 ^6 |
  43. , X, E+ S4 ~, Y& `
  44. #ifdef EDMA3_DEBUG# _1 e' C1 s  p- R
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
      B$ B8 {9 N% U; l# |$ c6 Z
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
    * y' h) U( J" ?5 x# {3 u" T
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
    $ x- c, Z- @  c9 w
  48. #else
    : w0 V( k  [2 F
  49. #define DMA_PRINTK( x... )4 m# f8 d, Q2 ^( ^
  50. #define DMA_FN_IN
    / ?7 D1 n9 `3 y& Y: i  s+ c8 [
  51. #define DMA_FN_OUT
    / r4 `3 |" b- q( Z+ v. {% _# E
  52. #endif
    5 ~) c8 M. }! z( ?5 a0 v+ ^

  53. + m3 V. ]' G& H' |% Q
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)2 s" N/ o$ H: ~) ^* {
  55. #define STATIC_SHIFT                3' o" k7 O  ^2 O$ u
  56. #define TCINTEN_SHIFT               20
    ) e/ N) Y) E6 e7 G
  57. #define ITCINTEN_SHIFT              214 {/ z$ b1 I! \3 R- p% v
  58. #define TCCHEN_SHIFT                22
    0 c3 t% }: y+ `, E, Y
  59. #define ITCCHEN_SHIFT               23" V/ m, E$ i- F
  60. 7 M' N; ^- U  s+ ^" Y1 |
  61. static volatile int irqraised1 = 0;$ a; v: i8 C! L4 K* M6 q
  62. static volatile int irqraised2 = 0;
    . j2 K% g! b5 |( z
  63. ( l7 U" C' S) z; }5 h7 }- y+ e  @
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    : W; e" f" @! o9 g+ E4 q6 N
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    & P0 n$ w3 G  J: ^& |0 @% |
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);; l- f( Y) [& p0 l

  67. * ?* `- h' R) h2 M2 _1 k1 E( ]/ e
  68. dma_addr_t dmaphyssrc1 = 0;
    / }' a# P* d9 ?" M
  69. dma_addr_t dmaphyssrc2 = 0;  Z! o2 W* E* }3 ^
  70. dma_addr_t dmaphysdest1 = 0;  Q4 m3 J& T* b. y! q, t' u* d
  71. dma_addr_t dmaphysdest2 = 0;
    ( Z! O2 j- J: F' ^' t/ d% a$ F# V

  72. ) r, \8 [  B1 K! M3 f0 U
  73. char *dmabufsrc1 = NULL;: L" G% w# |& d
  74. char *dmabufsrc2 = NULL;2 Q9 D6 }" Q, B6 |0 i; X3 p+ k2 z
  75. char *dmabufdest1 = NULL;6 N3 P" k3 m4 [! x, |$ H2 M5 O
  76. char *dmabufdest2 = NULL;" T3 H; ^* j' T* ?, {3 V4 R
  77. # ]+ a1 a% {+ o4 `: }
  78. static int acnt = 512;
    4 C. w/ x, h8 U5 Y( ~! |
  79. static int bcnt = 8;6 s$ \) O! k. t( I
  80. static int ccnt = 8;# ^7 h4 A3 L0 I& R' h4 I- V
  81. ' c4 N6 e" g4 P' n2 V: T
  82. module_param(acnt, int, S_IRUGO);
    ( L' S" x' A7 W
  83. module_param(bcnt, int, S_IRUGO);  c# Y. G5 y, m0 t
  84. module_param(ccnt, int, S_IRUGO);
复制代码
5 s3 u0 y5 a' E) b
1 a* i* i  n. x7 z" [( f
      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用# O  n& \5 S2 C
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。$ m( C$ k2 Y+ h9 N6 m
     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
1 u1 `/ y) _( V: D' B" n/ N3 Q/ |( p" Z

; j) y" }& Q6 ^1 L6 h4 ^9 A
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

GMT+8, 2025-11-8 13:58 , Processed in 0.038026 second(s), 25 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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