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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑
# F  P& x2 q9 C, y
  1. [code]EDMA sample test application" k( z8 ~' @5 E2 }/ m
  2. /*
      V' C% Y& J7 e; {
  3. * edma_test.c
    $ U0 ]5 E- ~  z  g9 ]$ d
  4. *  r2 s7 z' B$ K( r/ p
  5. * brief  EDMA3 Test Application
    , J$ h- `1 h. k7 V' }9 M
  6. ** m! A! i2 L& ~+ W4 ^3 h4 F6 ^
  7. *   This file contains EDMA3 Test code.
    0 r9 y* W' A7 ^  M/ P+ y
  8. *( ?: P* P: N: u, h4 I5 W2 @/ {
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE7 }5 H9 ]% k7 v4 G/ t! T# y
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT+ z" l0 L( i$ O2 ^& ~
  11. *         TO CHANGE.
    7 V6 C  w/ ^9 e* \
  12. *
    8 ]. M0 x4 y5 c  X& y% o4 U
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
    - Q' b. I9 R+ E, _
  14. *
    8 \0 I) T- k3 [$ {$ d4 C. G  e# ~
  15. * This program is free software; you can redistribute it and/or7 r% H+ Z% f$ h/ E" L
  16. * modify it under the terms of the GNU General Public License as
    0 @* G8 a/ }2 w
  17. * published by the Free Software Foundation version 2.
    ) V7 H7 |8 y" h! Q. S
  18. *
    . C4 w5 \: W6 v& D( W2 R! j$ M% j
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any) d3 k  \* h+ Z
  20. * kind, whether express or implied; without even the implied warranty
    $ d$ w( C. n6 E4 `1 X5 z
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the2 D$ X% n0 e& Y2 y: f2 k
  22. * GNU General Public License for more details.
    ! i8 `* b  L; T' H
  23. */
    6 n; K0 c% b' ~9 Q( i1 D& b* N1 h5 N
  24. 5 V0 F, n" C# e( J
  25. #include <linux/module.h>. x7 z% z: [0 H$ n4 v5 x  i
  26. #include <linux/init.h>
    $ m3 H& I5 S# `( I9 I
  27. #include <linux/errno.h>
    4 |) ]% g9 h2 O0 D
  28. #include <linux/types.h>
    ; W- B& p" @, l0 [2 R" i
  29. #include <linux/interrupt.h>; E, h# @- ]; Y! g) E! `  t
  30. #include <asm/io.h>
    5 W/ f  Q6 O# a$ G  v* I: |
  31. #include <linux/moduleparam.h>
    $ I/ b9 m$ n$ y
  32. #include <linux/sysctl.h>
    & B7 h3 U7 X7 j4 ^
  33. #include <linux/mm.h>
    . T: I# [% t+ |: G! H4 y4 q
  34. #include <linux/dma-mapping.h>
    6 k) a' R  _* m; u. L, f

  35. - X% |  s% D% ~* u- d4 d
  36. #include <mach/memory.h>
    4 C3 Q/ o" _! ^, e3 ?. i9 A
  37. #include <mach/hardware.h>; r1 p, e) ^( N
  38. #include <mach/irqs.h>& Y, E1 |4 i: s/ T: f# f
  39. #include <asm/hardware/edma.h>
    & ^1 C% W# Q/ H  F6 l% ~! _( L

  40. . A: T) ^  }7 m; Q% m
  41. #undef EDMA3_DEBUG5 C9 ]$ P- K/ `0 v' Q
  42. /*#define EDMA3_DEBUG*/9 B5 q7 P$ b0 M3 `) x! M
  43. 7 j! R' b9 b$ Y
  44. #ifdef EDMA3_DEBUG4 O# I/ Q5 J' U  D2 v
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)6 i2 q+ Z, z! L2 N; M. w' R' ~; D
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)& z7 E, O$ j4 V
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
      C, Y8 p7 A# d( c3 N6 A" G+ Q
  48. #else
    - x, P( H2 p8 U( g- w9 Y
  49. #define DMA_PRINTK( x... )
    - t8 W. ]* O0 ?
  50. #define DMA_FN_IN5 Z, ]9 X2 }9 F8 i/ d' `4 h
  51. #define DMA_FN_OUT7 s+ a4 |2 O9 w) [2 p3 L! S
  52. #endif- ]4 X$ _! M9 A6 I
  53. 8 ]& k7 A1 i& Q3 V7 W" D4 L6 F7 e
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)8 C; q9 i$ i; U: m3 E
  55. #define STATIC_SHIFT                36 H9 |: }  S; _2 i; G9 x5 ~
  56. #define TCINTEN_SHIFT               209 h+ P* f' x: R
  57. #define ITCINTEN_SHIFT              21
    - v# m7 \2 |/ H' s2 C
  58. #define TCCHEN_SHIFT                221 G# W- v: G. I( W; q& W
  59. #define ITCCHEN_SHIFT               232 F! c5 ?, R9 F# ]8 S' a; Z

  60. 2 r3 o  t: |2 {% w7 [
  61. static volatile int irqraised1 = 0;
    ( }; F: A% O9 i# G! D) c
  62. static volatile int irqraised2 = 0;
    ! J5 D( C* W3 N2 }* O8 y/ I

  63. 5 S  j! d# ~# }: r) e4 b/ p
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    2 H7 \0 }& u. N$ _( t4 ^4 S2 Y9 [
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);( V4 F5 }* V8 K$ R
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);" q; o. v# ]; b# i8 A( }

  67. : t3 }" |! i2 \: Y" ?: \( B' d
  68. dma_addr_t dmaphyssrc1 = 0;
    8 h5 C/ z& W' Z4 _$ ~0 i& z
  69. dma_addr_t dmaphyssrc2 = 0;
    , |3 D+ x3 a! w0 d9 S- w
  70. dma_addr_t dmaphysdest1 = 0;
    7 d+ F+ ~8 f  i
  71. dma_addr_t dmaphysdest2 = 0;
    ( s+ ~$ x% X) j

  72. / N2 J7 m9 |+ j7 i" w. y
  73. char *dmabufsrc1 = NULL;
    0 |6 K* c: b( f
  74. char *dmabufsrc2 = NULL;+ n6 L& J  P9 A5 B  \; V
  75. char *dmabufdest1 = NULL;
    8 Q! w$ D8 t+ \6 T
  76. char *dmabufdest2 = NULL;
    8 M, \* G, N, q1 `* ]& T6 `& C/ v( r
  77. 1 i/ w! |+ \6 r& Q7 o, R1 e
  78. static int acnt = 512;
      U: M7 t, x; Q9 H; a( L$ F5 ~  D
  79. static int bcnt = 8;
    2 n7 _' ]& j/ P  w( P
  80. static int ccnt = 8;' k4 q# j' p! Y$ a; \- b" c

  81. " C* _3 c! a' P/ Q% R
  82. module_param(acnt, int, S_IRUGO);
    4 w3 q) A8 h" o* O3 {
  83. module_param(bcnt, int, S_IRUGO);
    % ?$ j, G- g. K* H# D  ^
  84. module_param(ccnt, int, S_IRUGO);
复制代码

* Y3 M" A* c0 G! O* q& t
& n$ I8 S0 j4 }: g1 f0 r/ ^% z) I      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
- q( e% s6 ~1 Narm-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 X- s- L. Q6 W! F
     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
5 j6 e  T6 y( D3 x  M
$ ~* E: E- D* h0 G+ {# x7 T: n; x& [- w
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2026-1-23 15:23 , Processed in 0.040056 second(s), 25 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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