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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑
1 b( L6 n% D9 [( N0 ~
  1. [code]EDMA sample test application
    5 T: J2 J) x8 x$ ]: k
  2. /*  x; G* J" ]9 v4 s# @
  3. * edma_test.c5 w2 K2 ^3 @- `2 V9 O, z' \/ _; J
  4. *
    $ d8 B3 s3 a+ u2 j5 r$ \
  5. * brief  EDMA3 Test Application- O& Q$ m9 U$ u  m0 C
  6. *
    ' \, A3 P  e  F) I% p" D4 n, k: }
  7. *   This file contains EDMA3 Test code.& x# @! H5 A1 z( g
  8. *
    . V# h# }5 e% y! D
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
    4 E; ^; a+ q+ T: P" g: T
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
    $ M# s% t; J" @4 X
  11. *         TO CHANGE.- m' F" k9 y) [- S
  12. *1 d" f/ U( B. m( f+ m" ~
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/7 m. X6 |' y, l; Y) ]& c
  14. *7 N# Q4 @1 D9 y$ H. v. A* ]- t
  15. * This program is free software; you can redistribute it and/or
      p2 X# J& W/ g) g; y; L0 V
  16. * modify it under the terms of the GNU General Public License as
    3 U& f3 a- w, A
  17. * published by the Free Software Foundation version 2.
    8 j* J7 d8 X0 ]: z, k4 h$ D( O7 ~+ U
  18. *
    1 k( O7 z5 Y, z( ]) u
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any3 ~; o& u' W7 K. W2 G# n
  20. * kind, whether express or implied; without even the implied warranty
    ' ~4 O4 ~  l6 M3 R% ^
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the1 x8 q1 G+ X  I9 O7 a$ C& \2 e
  22. * GNU General Public License for more details.
    3 [8 K: |9 p) |( Q
  23. */5 A# h/ l2 Y% R: o  F) \4 f. H
  24. 2 K7 p, @8 e+ p# v- _% P
  25. #include <linux/module.h>7 T1 n- @9 }  _' F* \- o
  26. #include <linux/init.h>  |; d! c# t% {2 g
  27. #include <linux/errno.h>$ c. J2 S+ G$ S: G: M
  28. #include <linux/types.h>. J3 y) d0 _! o% s* x; [
  29. #include <linux/interrupt.h>; }5 d/ `' @7 V- O$ x+ h8 b0 [
  30. #include <asm/io.h>/ N4 I, ]# u! t# G/ G" E1 h+ h. g& W! R
  31. #include <linux/moduleparam.h>6 u! J. X: j" F3 ]* h. {* D
  32. #include <linux/sysctl.h>
    0 y8 |1 b! E; [' y- t# u% e
  33. #include <linux/mm.h>
    : O. a1 u4 x+ U' e7 J
  34. #include <linux/dma-mapping.h>, t  O0 J% g; c4 W: n
  35. 8 c7 j  w3 E; H8 o  p
  36. #include <mach/memory.h>; S" [' c* \/ s: q: T9 Y9 g
  37. #include <mach/hardware.h>
    - d9 m& P- L& c: p* T! n% j
  38. #include <mach/irqs.h>+ a8 t8 Y# G) `! s" `
  39. #include <asm/hardware/edma.h>* w  }  s! ^' Y, k- q" F: n4 w6 D, I
  40. 0 D* m' m; W' c* R
  41. #undef EDMA3_DEBUG7 c! A& j  Q( g% L
  42. /*#define EDMA3_DEBUG*/& x5 k/ V2 e" N- X. p

  43. $ R7 i: ^0 w9 z4 O) z/ ~: [
  44. #ifdef EDMA3_DEBUG
    1 u5 C* g. p/ j8 @9 N
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
    7 E: _. B- V2 \2 ?- r4 ~# b( g
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
    # ]! ?: ^; C- x
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
    ' b4 A" W+ u; T4 i
  48. #else
    ! F9 v- F4 ]. ]8 T4 g: l+ l
  49. #define DMA_PRINTK( x... )
    ' g& P+ B" c  Z
  50. #define DMA_FN_IN2 D8 I5 k4 n$ B* V4 F
  51. #define DMA_FN_OUT2 T7 E' `# Z- {! q  C+ [( Q
  52. #endif2 Z6 @+ g( J$ Z% F/ [$ d- e
  53. + L/ M0 r6 A8 C8 N/ r1 L( H
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768); P3 {% D# f+ m
  55. #define STATIC_SHIFT                3! @: S) O. [6 Q: z: T( I, M# e
  56. #define TCINTEN_SHIFT               20- V: S  I) R) Q$ o, e
  57. #define ITCINTEN_SHIFT              214 j; G  K  ~9 j+ c
  58. #define TCCHEN_SHIFT                227 v5 \! t. D/ b8 v
  59. #define ITCCHEN_SHIFT               23% r6 o, n2 i* n1 e9 Y9 ~
  60. ( g. }& A+ B" `# q
  61. static volatile int irqraised1 = 0;! E+ |+ K/ ?- d# b3 I; w% T( U
  62. static volatile int irqraised2 = 0;
    0 Q0 i9 W9 o" l! S6 z4 g; O3 u
  63. ) V# M. d( }* F
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);- m7 S2 l& _: D" a6 [, u& N
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    2 U0 O' _; O4 N( \( H) T
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    ; ]; t' q$ w* W
  67. 6 r9 w$ d- e) a! V! ?0 P
  68. dma_addr_t dmaphyssrc1 = 0;
    4 b. e# M' ?4 o- ^+ e0 v
  69. dma_addr_t dmaphyssrc2 = 0;
      y' m, o- s; a. Z: O4 w% s
  70. dma_addr_t dmaphysdest1 = 0;# I, E' _& Q# l
  71. dma_addr_t dmaphysdest2 = 0;
    # s* f$ s( ~$ \$ |0 C
  72. % f: E5 [& n! J' z. f4 q; S
  73. char *dmabufsrc1 = NULL;, ~6 N5 H; N. e. L$ j
  74. char *dmabufsrc2 = NULL;
    # o7 q3 U: R- V6 z3 o1 Q  g
  75. char *dmabufdest1 = NULL;
    - f/ o8 U" w& s2 W
  76. char *dmabufdest2 = NULL;
    $ F+ F" r1 ?3 q+ e9 L6 \- H
  77. + B2 o' N4 b" Y7 B2 Q
  78. static int acnt = 512;
    * v7 b1 k% r: g' t' F9 j
  79. static int bcnt = 8;* q) ^8 l% Q, R0 J0 d
  80. static int ccnt = 8;  B; x# S5 R" R$ M: ]/ U3 u- w
  81. 0 ~" E1 K# T6 d; M) C- ?. v7 N
  82. module_param(acnt, int, S_IRUGO);$ p. K' a/ P5 `: t9 \6 E
  83. module_param(bcnt, int, S_IRUGO);8 u/ x" s, B" `' S" e
  84. module_param(ccnt, int, S_IRUGO);
复制代码
, q0 G: g/ V. k, F8 \
  w# G9 _. o0 e" p" V2 m; w8 S; s7 e
      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用" o4 K# L- ^. T- t3 @/ n) w9 S2 H
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。3 t' J! ^9 {; _( u+ E- {) Q
     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。- t! z6 C! ]- T9 }4 w. E
3 C- H4 K) w# ^3 \
& g* T5 N5 A! C9 I; X1 U
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2026-8-22 22:58 , Processed in 0.041637 second(s), 26 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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