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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑 ! U2 N' K+ f; x0 \4 z8 ^0 [& [
  1. [code]EDMA sample test application( z3 L0 `, Q" `; i5 C
  2. /*7 c. z: {9 c' @7 [$ a
  3. * edma_test.c+ I! i# K- P1 X. O7 W" V
  4. *
    ) t5 B. X* B/ Y; L( [0 u8 [
  5. * brief  EDMA3 Test Application8 T- s8 C; [9 y, C4 J, {( t
  6. *; g! m! A/ g  a6 P8 g4 L' X- Z, J# @
  7. *   This file contains EDMA3 Test code.
      |# n2 i* ^/ ]3 `! g9 @
  8. *- V& c) ?0 m. }% ~- t  k1 k
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE) o0 {6 y2 a/ _; ]$ u; }6 ?/ P' O
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT$ L0 O1 S: T- {$ `  O, c
  11. *         TO CHANGE.
    ! h+ {6 k4 W0 i- K( X
  12. *5 i- u) Z9 t! E; n3 J
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
    # x/ ^6 K5 F  `* M& H
  14. *. Y) Q+ G2 D+ l) c8 n) Z6 K7 ^) y
  15. * This program is free software; you can redistribute it and/or
    6 C+ h3 {  L; V
  16. * modify it under the terms of the GNU General Public License as
    ; A( E/ i# g1 N2 T8 T% T
  17. * published by the Free Software Foundation version 2.7 f* ]# I7 h% m8 j' N; n1 G
  18. *
    ; m4 i/ Q) z. h- s1 N( J
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any
    # w& E5 J( d8 d* M$ F, j# u- J
  20. * kind, whether express or implied; without even the implied warranty8 d$ Q& \/ K! T( F* m  E. U0 X
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the% u0 j- n# h5 q2 L4 R; e7 B) V) o
  22. * GNU General Public License for more details.; i1 _/ f3 ]1 k8 R% r) o* D& i6 k
  23. */1 J" ?/ G) B: i

  24. 7 n/ f1 o+ j1 V. [+ q6 Z
  25. #include <linux/module.h>4 R$ S. g3 S4 j- P
  26. #include <linux/init.h>
    $ a/ I  [& i6 F9 c* j
  27. #include <linux/errno.h>
    0 @; H5 j- p5 Q; [
  28. #include <linux/types.h>
    # P% S0 s0 u5 r& H. h( _  f1 f
  29. #include <linux/interrupt.h>' ]# b5 `( Y. w+ |9 b0 V8 E
  30. #include <asm/io.h>
    # B" X9 l8 ?* j: Q- [' p% d8 S
  31. #include <linux/moduleparam.h>9 A( L5 s* [7 G! o5 N
  32. #include <linux/sysctl.h>
    5 h3 I+ k* \% W. `4 ^4 b7 r+ B; l
  33. #include <linux/mm.h>0 d  Q/ }$ S" ~# Z7 S4 J: c- c1 Q
  34. #include <linux/dma-mapping.h># ^6 G4 m( y& O- s7 u6 W; b# O! W

  35. 2 W8 D2 _- Q+ F/ n( R9 p4 G2 Y) k
  36. #include <mach/memory.h>
    8 G2 `, v. g% v5 h, A' g
  37. #include <mach/hardware.h>
      |* [! Z/ H* X; D, \/ f
  38. #include <mach/irqs.h>
    & B' Y7 o2 B. t6 ?3 g! V7 X
  39. #include <asm/hardware/edma.h>9 b, A: r; `" }: j

  40. ; [* k" ^6 q" |$ d% B/ D, `
  41. #undef EDMA3_DEBUG
    ; K: P/ T9 D9 P! i* G1 P
  42. /*#define EDMA3_DEBUG*/0 s6 y* P0 a& x! G1 d! T" @% D% R/ J

  43. : `! H4 U9 z( b+ E
  44. #ifdef EDMA3_DEBUG: E+ {1 d, |7 D7 s
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)- y) @1 N+ a5 ]  ]
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
    4 j# i6 F; c% J, L; M( {
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
    8 U+ Y& p$ {( h* ]6 J, `$ o% y
  48. #else* h  d# u/ j! \/ S
  49. #define DMA_PRINTK( x... ). ~, b0 l# i3 c' R
  50. #define DMA_FN_IN
    , j' M  l  Y8 k* o' H" d  k
  51. #define DMA_FN_OUT& `# s0 x8 I% i! c, P& ?/ D% [/ W2 G
  52. #endif
    0 P5 W6 J! g9 Z# U

  53. 0 I! X0 V( J! z' e6 V" R
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)) i' m5 Q2 |4 O
  55. #define STATIC_SHIFT                3
    + N/ m7 q6 j6 G; n, T
  56. #define TCINTEN_SHIFT               20
    1 N. x' A6 S5 q9 @
  57. #define ITCINTEN_SHIFT              21# v; E' E% s2 t$ B* ]8 i; n
  58. #define TCCHEN_SHIFT                226 J$ I" G' U, d% A# V( a& r
  59. #define ITCCHEN_SHIFT               236 C; X3 ~3 ]. O, L2 F
  60. ! o/ Y9 P& a. {; B+ U) u
  61. static volatile int irqraised1 = 0;
    ) w$ K( J0 E, \0 H1 v- C! U
  62. static volatile int irqraised2 = 0;) a: V: N- {: @* @' h
  63. " ]4 P% w! |" Z* j$ n; \4 J
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);0 }# @; U2 b: l8 p
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);+ X0 i+ U6 J. }4 h/ K& a/ g6 c
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    + Z+ {, C+ Q1 ~/ _) l' X- G# E' E
  67. - S! X' {% [! k- D: W. w
  68. dma_addr_t dmaphyssrc1 = 0;
    & g" L$ G# p) S+ t
  69. dma_addr_t dmaphyssrc2 = 0;% Y. p: g1 ]. k' C9 V: s% v
  70. dma_addr_t dmaphysdest1 = 0;  @! v+ F( _7 p  H( o
  71. dma_addr_t dmaphysdest2 = 0;
    ' B/ R+ a/ j. J0 k" m0 m4 x1 P

  72. ! l3 Z3 _- y0 z0 g5 q0 J
  73. char *dmabufsrc1 = NULL;
    7 r2 a) E" g4 u# s  Z
  74. char *dmabufsrc2 = NULL;
    % h% y# _6 ?1 G. E
  75. char *dmabufdest1 = NULL;: \5 K: y  l3 g5 u7 Q
  76. char *dmabufdest2 = NULL;
    ) \3 {/ [( `. z6 x3 R2 T
  77. 9 d2 O6 v- j3 G7 L
  78. static int acnt = 512;
    0 d1 s% n) z5 R; Y! h" n
  79. static int bcnt = 8;3 C  [- J$ f) q. x$ h& o9 b  ^
  80. static int ccnt = 8;" g/ F* W- [- }% W$ Z: g

  81. " i; g* r% }9 }- x
  82. module_param(acnt, int, S_IRUGO);; j7 X2 W9 i. U: }5 G
  83. module_param(bcnt, int, S_IRUGO);3 i+ }/ l( }  R5 z$ t0 }- S4 w
  84. module_param(ccnt, int, S_IRUGO);
复制代码

0 l* D( F+ _. g( p) A: K4 g/ f) V! n1 E
      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
4 c! p3 ^# O( u" Y: oarm-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  B4 T( X. f9 x     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。+ b  ^1 u; U% o9 [( ?7 J- {
- d# R8 B0 d# y  v3 C  D3 O
8 M0 a# t0 ]- \& T" I" B- g) o7 z
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2026-1-31 11:59 , Processed in 0.549533 second(s), 26 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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