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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑 ' M' V7 K6 w( s4 X8 U% B
  1. [code]EDMA sample test application* z. q8 K' L7 B# n- J# H( Z
  2. /*/ ~6 H  ]4 O2 }! _
  3. * edma_test.c! ?+ D# n6 F+ c5 o: {2 C" D
  4. *5 _8 H/ i  S: W
  5. * brief  EDMA3 Test Application
    + k" f. o* k  w, |/ b8 G" {3 A
  6. *
    7 {# S( ?8 H% k6 ^: ~. ^8 `. C
  7. *   This file contains EDMA3 Test code.
    5 O: k  |  a/ e5 F( r7 Q
  8. *
    ; k7 Y) r7 V/ _# C. B7 k1 \0 h
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
    1 ?. |' Z* G$ p0 p: ]" F( M. W
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
    8 R  P$ o: |9 _6 _5 S0 S
  11. *         TO CHANGE.
    9 x1 R' x5 S9 g) c3 l: Q
  12. *
    3 b8 e: E$ r4 E
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
      }: s& l$ u0 ?0 B" B1 u6 K  X
  14. *) K) D/ j  ~9 ~7 B$ P: }- H5 Y9 _
  15. * This program is free software; you can redistribute it and/or/ |0 `; W1 t; P1 H3 q* Q
  16. * modify it under the terms of the GNU General Public License as
    5 x. M; v7 O* K9 _8 B" q
  17. * published by the Free Software Foundation version 2.( D" H- a$ {( F$ D( V/ l: T1 c
  18. *  ~& v  u" ]! f* t9 F7 |! ^" b0 `$ b
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any
    9 _- w# Z. S/ Y4 I
  20. * kind, whether express or implied; without even the implied warranty
    ; ?# F4 }& z' p, d+ w3 A& Q
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    5 w1 q6 T( K/ }  {7 y+ ?7 I
  22. * GNU General Public License for more details.' q3 f; q. k* i# ?' e
  23. */
    6 A0 Y8 l/ I5 W) F0 K2 O

  24. 7 n* Z$ a; `% B, [1 Z# X
  25. #include <linux/module.h>) C! _. G* v2 b3 D; }6 `
  26. #include <linux/init.h>
    : L5 l9 ^1 |5 r/ b$ B1 m+ b
  27. #include <linux/errno.h>
    0 m# e& E) |7 f) K5 x
  28. #include <linux/types.h>
    3 S6 N& l/ e* u! P% J' m3 A
  29. #include <linux/interrupt.h>4 w+ _& B5 h- N% W% f1 d
  30. #include <asm/io.h>
    4 Y& [) \' g7 K) H% c
  31. #include <linux/moduleparam.h>
    % J8 {5 `* D3 C! Z- n
  32. #include <linux/sysctl.h>, P4 F7 s( Y  k2 E$ C
  33. #include <linux/mm.h>7 p  C, V! y9 I. f& r
  34. #include <linux/dma-mapping.h>
    # }) t" c! l  L9 I# W. U
  35. ' \5 Y$ N3 E2 {/ F. Q. i2 U
  36. #include <mach/memory.h>
    ; _; A8 y+ F9 r0 c5 F5 n
  37. #include <mach/hardware.h>
    3 [: v7 }$ A( V/ g8 C
  38. #include <mach/irqs.h>  f' S0 m3 U9 r+ f
  39. #include <asm/hardware/edma.h>3 n) q# }9 O7 u  A& Z5 j. i4 p

  40. % u: b" W2 v% `1 M" }5 n1 R
  41. #undef EDMA3_DEBUG
    $ h- \3 P1 A# j) p4 X7 a( ^) ?. F
  42. /*#define EDMA3_DEBUG*/5 V& C+ o5 N% ]

  43. : u7 k; Q- t7 T; [- H, r4 Y3 g
  44. #ifdef EDMA3_DEBUG; P/ J( j+ P, i; A; m, Q
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
    3 g' Q$ c/ Z( k1 p
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)5 y" p" j& Y% @! E5 |0 T
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__), o' r' g7 }$ B( R
  48. #else
    ' f! f* e# v; P4 `3 w+ S) z2 J
  49. #define DMA_PRINTK( x... )
    % H5 G1 z, F/ z- r8 U& B! p
  50. #define DMA_FN_IN- R# r8 q2 A- ?) ]8 Y; }! Y, o: i5 B
  51. #define DMA_FN_OUT
    - a% W, _% x# u6 H, T7 G5 Q9 U
  52. #endif+ ?  Z6 m- f9 m6 _: x

  53. " T' Q9 I  h. ?- a, {
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)! ^; |  n$ s+ i  m
  55. #define STATIC_SHIFT                3$ i% P9 `# x+ O, K; l% R) j
  56. #define TCINTEN_SHIFT               203 y. w% Z/ L' b$ S; v: g
  57. #define ITCINTEN_SHIFT              21
    1 w! s* \. M/ y5 V( j: v
  58. #define TCCHEN_SHIFT                22" s5 R% l+ b/ h  L/ w' J6 D" k. T8 a
  59. #define ITCCHEN_SHIFT               23
    * k: p2 l) ]$ H/ v% X5 ^4 ]

  60. 9 u- x  F' c6 V6 r9 v, }* V) b$ `1 M
  61. static volatile int irqraised1 = 0;
    " H6 Z8 \' ~% b, n
  62. static volatile int irqraised2 = 0;/ u) _0 n$ p2 G7 f

  63. . c! z: U7 G2 m* f/ D8 \4 `- b# W
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    ! E$ f" Z' e2 V9 N
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    - E2 \2 h  ^1 B4 M; [) A& ?
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);# v) }2 Y: Y0 K4 Q5 R9 a
  67. 1 \% F( h0 Q0 a0 T$ u3 x* H
  68. dma_addr_t dmaphyssrc1 = 0;$ m7 F4 g8 d: o3 D
  69. dma_addr_t dmaphyssrc2 = 0;& l& A4 [$ L# x0 [
  70. dma_addr_t dmaphysdest1 = 0;+ R* G: m# J0 o# s' U  X
  71. dma_addr_t dmaphysdest2 = 0;
    2 ^5 ~2 Z7 y' u4 d; e

  72. # U, Y9 C* X' o/ h* r6 m
  73. char *dmabufsrc1 = NULL;/ S: X$ C  a0 Q4 x) E6 h
  74. char *dmabufsrc2 = NULL;
    0 }0 v! s- v8 \8 Y+ t  k! ?
  75. char *dmabufdest1 = NULL;  k/ K4 x) b5 g2 e& Y
  76. char *dmabufdest2 = NULL;1 E' }8 `$ t' g: N8 ~
  77. 5 `7 j9 A- x8 T% m
  78. static int acnt = 512;
    & q; s, @* o+ Y# `8 L' T
  79. static int bcnt = 8;' |) Y0 t3 s: C8 E( s7 @$ U
  80. static int ccnt = 8;
    " [* e, _2 [7 p( k4 M
  81. . A' f' N3 Q1 W; j9 T- K
  82. module_param(acnt, int, S_IRUGO);
    ( R% I  q% o4 e/ Y! z
  83. module_param(bcnt, int, S_IRUGO);& ?  _8 m9 I  ~: {8 @9 o& V
  84. module_param(ccnt, int, S_IRUGO);
复制代码

/ F" q: X0 ~0 r1 {4 }& X
. O7 i9 Y, h; q9 z9 R      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
8 y/ ~8 _+ d" c/ M# ]; R/ Warm-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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。# _" P. g* S$ q- N$ H$ R' A
     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
: h6 r6 q1 O1 P! R3 ]/ t1 p8 D, F# T7 ^/ v/ a. m

5 |# T, X' D- }5 u1 i. l
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2026-1-25 04:11 , Processed in 0.038583 second(s), 25 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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