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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑 ' o1 }1 y6 y- h3 f# s+ F
  1. [code]EDMA sample test application7 J; x9 D, [5 `
  2. /*8 P' ?1 z* X% F% u! Y4 H1 S
  3. * edma_test.c
    $ d* S  ^! Z' K7 A' I( Q4 {
  4. *6 J. c$ e1 W! ?5 [* d% e
  5. * brief  EDMA3 Test Application, k! v0 h& F/ ^' g: [2 Z
  6. *" F) w$ J- t  x( V: o
  7. *   This file contains EDMA3 Test code.2 d  u# W* n! D+ ~* F% g
  8. *8 q$ r' ?% a. k$ S
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
    : u5 \( g, P, u: e- D
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
    2 i3 ~$ M; U1 w0 w7 Y( h
  11. *         TO CHANGE.
    / j) q- u4 v( Y0 p7 o" [
  12. *# D2 A6 v3 K2 L- i/ r) [
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
    7 q/ i4 m, E( W/ `( B" S5 i
  14. *
    ' T! c0 m! t. ~
  15. * This program is free software; you can redistribute it and/or( q+ z6 g4 A) U  v7 k$ t+ F: K
  16. * modify it under the terms of the GNU General Public License as' I% w) Q$ J% e6 r" t0 N
  17. * published by the Free Software Foundation version 2.9 P" b/ T9 U. h
  18. *
    5 o9 z  R4 Q( M
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any) ~+ C* I8 W: X& i' F& K6 `; t3 D
  20. * kind, whether express or implied; without even the implied warranty
    4 q' K' o8 V+ P/ B+ S
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    1 ^0 u1 M2 f4 W  Z: L! r# T
  22. * GNU General Public License for more details.( m9 n" ~8 i: q6 y
  23. */
    $ A  o2 W( v- k( r3 W4 e
  24. . `6 k% E' ^+ \4 p; F+ ?; |
  25. #include <linux/module.h>! ]0 Z9 N5 g; T8 u
  26. #include <linux/init.h>! |' }  g8 u4 x" d
  27. #include <linux/errno.h>
    & Z. s+ W. S( O- b% l3 `
  28. #include <linux/types.h>
    - H) @; w6 `1 D
  29. #include <linux/interrupt.h>
    2 v+ i. D) R& {3 |& ~: |! b6 D
  30. #include <asm/io.h>3 \+ ^2 x  d; q' ?! m2 V
  31. #include <linux/moduleparam.h>
    9 \* L8 l/ d) V
  32. #include <linux/sysctl.h>0 p7 r) i% R0 K7 h9 {3 K. X
  33. #include <linux/mm.h>
    $ D4 K$ `" X+ O8 _: U4 @% I
  34. #include <linux/dma-mapping.h>% U. T- _( T) M! W) J+ W6 K

  35. 8 n6 Y+ Y: f! i' K2 j
  36. #include <mach/memory.h>
    % B1 ?5 h1 J7 x, w9 `9 X% J
  37. #include <mach/hardware.h>
    ( v4 F& Q. E- V- ~4 Q+ C8 h
  38. #include <mach/irqs.h>) T# b1 n/ I6 v8 L. Y
  39. #include <asm/hardware/edma.h>4 g5 i1 b3 x+ V6 b
  40. ( X9 N/ ?8 L6 ~% Q% Y
  41. #undef EDMA3_DEBUG  v( T+ x; D! w5 a
  42. /*#define EDMA3_DEBUG*/1 E/ I4 J; C. h1 y

  43. $ u- |' u; e& M# g$ X4 a
  44. #ifdef EDMA3_DEBUG
    # M0 m# z5 i) c, N; o* v5 e% z
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)1 J* H9 r. c$ }8 b! n  p  J
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)( u! D0 Q1 k: H' l5 X3 O2 Y1 W/ U
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)3 g2 X2 |$ C' ~3 R9 [: B. Y
  48. #else
    / U6 n# K+ L$ t. }# o7 ~
  49. #define DMA_PRINTK( x... ); t" ~, ]8 ^7 x/ V) U- _
  50. #define DMA_FN_IN7 ]: S  i: v2 H8 A0 P
  51. #define DMA_FN_OUT  O, E) @9 u1 h  a6 Q8 H  h
  52. #endif6 [6 ?( p# ~0 j& z
  53. 4 x/ M9 w% C+ H+ g
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)
    6 T# D7 b3 V$ E/ r
  55. #define STATIC_SHIFT                3( {/ E7 V/ r6 V3 x" _2 d
  56. #define TCINTEN_SHIFT               200 d5 B7 b6 {* N. h
  57. #define ITCINTEN_SHIFT              21
    % O( H4 s8 _0 U" s& D
  58. #define TCCHEN_SHIFT                22( r. a2 G9 N- z* d
  59. #define ITCCHEN_SHIFT               23
    . e' R  G. w4 ^% o1 p

  60. 5 {1 S6 H( C0 h
  61. static volatile int irqraised1 = 0;& s4 K: V$ A+ k( [
  62. static volatile int irqraised2 = 0;
    4 f  x5 K4 C. D2 B' x- t

  63. ! `) T" i6 s4 j/ D' q& i( K  A
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    ' p# `) q$ ~* i/ D8 r" [/ y
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    $ S2 V( ~2 _4 l7 Z) t
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);- H/ K: }& v/ o3 x
  67. 8 k, T# @6 [  B. b. f9 J, C
  68. dma_addr_t dmaphyssrc1 = 0;
    ) ^1 k: _% }6 L5 P' @
  69. dma_addr_t dmaphyssrc2 = 0;
    . {$ R* G% v/ [2 O6 s3 Y; i" L: Z& B& G7 A
  70. dma_addr_t dmaphysdest1 = 0;
    5 i- R, y. j; B3 P
  71. dma_addr_t dmaphysdest2 = 0;
    ) ]4 Q9 w# S- G9 L) I  t3 \

  72. $ q6 M  t# k  @( ]& r# y* ?) w/ f1 X
  73. char *dmabufsrc1 = NULL;
    , i, B/ H, R( f" G% e
  74. char *dmabufsrc2 = NULL;
    ! L( A( r5 f) l7 h9 A# L1 X4 {
  75. char *dmabufdest1 = NULL;, Y& u/ ~2 d. A* g- P
  76. char *dmabufdest2 = NULL;
    * o$ v9 J7 i) _; C$ {

  77. 3 P# t: L% E* h2 X" z
  78. static int acnt = 512;2 f+ J1 [6 W: r6 i
  79. static int bcnt = 8;
    + N( W5 C9 p+ \7 j' @2 K
  80. static int ccnt = 8;( U6 ?6 n7 W5 U. V
  81. . n/ Y0 X) t+ Y: e' y1 `
  82. module_param(acnt, int, S_IRUGO);1 R9 A- H9 t7 d2 T
  83. module_param(bcnt, int, S_IRUGO);3 @* r) b/ c& H' b, n3 Y
  84. module_param(ccnt, int, S_IRUGO);
复制代码

% s  ?5 f& i& ]- ^0 I* G; v2 a, z( N$ p8 [. k- I
      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
/ u& w7 @5 P% barm-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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
! e# z6 ~/ @. z     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。6 m" T' @- x& d

0 D/ H: ^7 b4 W* T# r, s( e' h  W) M4 B2 ^, Y* L
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2026-2-16 21:58 , Processed in 0.039664 second(s), 26 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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