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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑 8 J, \. y* O3 d4 p8 _4 E! ?
  1. [code]EDMA sample test application- J3 N4 j" r( ^1 u. G1 g4 I
  2. /*% T, w; _% D& \5 v
  3. * edma_test.c
    * n. h5 h7 O  Y; }: J* k4 I
  4. *
    1 l* z; p+ o8 ?5 ?( |8 i2 I0 [
  5. * brief  EDMA3 Test Application
    % }2 v8 F# v& a) R0 m0 Y/ O
  6. *
    * \; k$ {$ A6 C: ^1 F+ n% w% z! x4 r
  7. *   This file contains EDMA3 Test code.* d  p# u, G! N  L6 N
  8. *0 S+ W* T, j$ O% }2 I
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE1 h* G; w! h: p, z* q& n& [$ J8 B
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
    ! W' N$ h0 t$ R6 ~& [
  11. *         TO CHANGE.5 E8 t4 ]' |4 o
  12. *
    ) f9 t$ o6 }5 c- K* ?* h+ P5 W
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
    * a9 Z& Q' a3 V$ F7 R' S1 M
  14. *
    / t9 B% y* T6 e. P
  15. * This program is free software; you can redistribute it and/or
    7 P4 e3 ~6 c0 w$ D1 ~
  16. * modify it under the terms of the GNU General Public License as  B! B# Y0 g! z9 R3 R! M3 ~5 [
  17. * published by the Free Software Foundation version 2.; |( p# ^- H( O8 b
  18. *
    * U: B2 a8 Q9 v& F
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any
    ) W% v* B8 |  t- `
  20. * kind, whether express or implied; without even the implied warranty
    # Q2 Y2 l' e7 ^! Q( ^2 w/ g) D8 \
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the$ m4 @2 f' g% }( E) T1 F4 p2 Z+ x4 t
  22. * GNU General Public License for more details.
    # s% h+ ]2 @" @9 o
  23. */
    % v/ V$ B. E- h% o: w, F5 A

  24. 9 M9 P3 W; E6 H
  25. #include <linux/module.h>
    8 m& D1 P$ e+ ^' ]6 `$ Y7 c  s
  26. #include <linux/init.h>- i! E+ y$ X+ {# d4 B# ]
  27. #include <linux/errno.h>
    6 T/ a" e7 o) {( M: w4 V6 S
  28. #include <linux/types.h>
    , J0 |( K  l' W1 Y
  29. #include <linux/interrupt.h>3 l1 }. u* X  i
  30. #include <asm/io.h>/ _  o- G) ^8 s. X4 H* e
  31. #include <linux/moduleparam.h>
    ' i' X1 K, \5 H! ^( Y- e1 C
  32. #include <linux/sysctl.h>3 s7 p2 k$ B( I, G7 j
  33. #include <linux/mm.h>1 x. K2 T$ x- a. u* S  ^3 T. {4 y
  34. #include <linux/dma-mapping.h>  ~- U5 D+ \! m2 w

  35. 2 d/ _9 A5 J: H4 T  j' u2 o% H
  36. #include <mach/memory.h>
    # N6 `; J3 q- P6 k  s  o
  37. #include <mach/hardware.h>6 Z4 y, Q% Q; h6 i* p# q
  38. #include <mach/irqs.h>
    / ]0 L2 W6 \+ w+ [  T  t
  39. #include <asm/hardware/edma.h>
    % ?. {' }8 E5 f$ g. Q

  40. , z$ |' j  w; H: f$ J, E
  41. #undef EDMA3_DEBUG
    " V. A" L8 [, U2 |4 B3 `
  42. /*#define EDMA3_DEBUG*/7 t  |0 _0 g; S( q

  43. ) N  o, s0 h- N; ~2 v2 h
  44. #ifdef EDMA3_DEBUG
    ) g$ T4 M) w5 O9 Q) b1 f) d7 y
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)8 m5 ~- N& e8 }1 J; U, E7 n
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
    ! l- Z# O3 b+ b: C
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
      R2 g* O9 G6 b/ I2 N
  48. #else
    9 [' S. y6 }( E4 S
  49. #define DMA_PRINTK( x... )  ~5 W; ~( h: W9 N  x* O2 c- h4 {
  50. #define DMA_FN_IN
    ) H8 H  t2 r3 o+ U6 n9 \" I
  51. #define DMA_FN_OUT2 d! T, |; Y/ x0 y5 N
  52. #endif% o  t- R$ }2 Y! F( D% I

  53. % X! U, R. Q$ K3 b. z
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)  m" P; l6 P1 X. R
  55. #define STATIC_SHIFT                3% P, H0 |& S/ i; a3 U
  56. #define TCINTEN_SHIFT               205 ]- Q( Q# J6 S8 B+ t3 i7 k
  57. #define ITCINTEN_SHIFT              21
    + K- f1 i7 q+ p$ X9 U
  58. #define TCCHEN_SHIFT                22" x- E# p) d8 e3 d  T
  59. #define ITCCHEN_SHIFT               23
    . p  D3 \) h% t! D/ |
  60. 8 |8 ?* h0 Z$ R1 o1 P
  61. static volatile int irqraised1 = 0;
    % W3 T1 P" c* `
  62. static volatile int irqraised2 = 0;& l' {* ~: ^5 K& U' d- I

  63. " b4 t4 N0 w/ [# N7 ]( j1 H
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);7 m5 F6 {% m% z7 s+ }
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);& o0 l3 t3 U  h& B, P
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    1 G, T; Y9 d& P! d7 V' G/ U

  67. 6 }- Z7 D' a  h' M: Y: `
  68. dma_addr_t dmaphyssrc1 = 0;- q$ a8 n. V' {
  69. dma_addr_t dmaphyssrc2 = 0;: V9 Z, M3 ~# W4 t# x7 s# I$ ]
  70. dma_addr_t dmaphysdest1 = 0;
    4 x! s+ z) B* N) Q
  71. dma_addr_t dmaphysdest2 = 0;& F0 S& E4 l' j* H. G9 k

  72. ' S* y" u0 Y: {3 g6 I: y- X; J
  73. char *dmabufsrc1 = NULL;+ `, N; D( R% T
  74. char *dmabufsrc2 = NULL;
    2 U. D: m# _5 ?# ]& A# M) L
  75. char *dmabufdest1 = NULL;
    9 A# N' u7 v6 g3 K$ U
  76. char *dmabufdest2 = NULL;
      o5 J/ f6 H9 H2 v' d: z# i

  77. ! C" h+ o- G  z0 e' w' S
  78. static int acnt = 512;
    : B. I0 y% U& G+ s) ^+ Y
  79. static int bcnt = 8;
    " ?# @  F( S/ j# C
  80. static int ccnt = 8;; H5 J. }  ?6 {5 H% G. f

  81. & L- ~0 ~7 g! Q: ]. Q
  82. module_param(acnt, int, S_IRUGO);1 Q- f# W. K# Z/ @5 o, x$ P  @
  83. module_param(bcnt, int, S_IRUGO);  [) o5 p. j" o, U
  84. module_param(ccnt, int, S_IRUGO);
复制代码
/ f. g, W. _6 t% Q9 N" N: ]' d

$ m+ x, O# P  D  T      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
6 X) d' f1 }1 M3 Harm-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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。/ w! C, w0 _; R0 g+ L4 ?' a
     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。; O) z4 p0 G. W$ V

8 C  A3 A- a7 O) A
% Q4 a6 R$ L, `8 w
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2026-9-12 00:41 , Processed in 0.042456 second(s), 26 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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