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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑
  C- c  k/ u2 I+ W) C  l
  1. [code]EDMA sample test application
    * a2 p  f- i5 a: O8 a: Z# i: D
  2. /*( F9 _9 m( k* \
  3. * edma_test.c6 G- `1 c2 x3 x
  4. *$ L0 h: P# x3 I! r5 @4 U4 G
  5. * brief  EDMA3 Test Application1 j; N/ }9 S. L
  6. *  j% f5 i  `2 e! V6 l8 r& I' G
  7. *   This file contains EDMA3 Test code.
    ; `$ {9 R2 W  ]6 ^2 U
  8. *: i, F; a+ X' U" q* s& [9 V& A
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
    3 J0 ~! e8 o; H0 M
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
    $ m( d5 b( J& r
  11. *         TO CHANGE.
    ( ]% \) c% e2 v7 @
  12. *
    7 P' E3 J0 U4 ^& s: F
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
    9 D, {# [4 k4 H  r1 ^. ?
  14. *8 o2 m# r6 {- h+ l( y6 M1 x$ p! t
  15. * This program is free software; you can redistribute it and/or
      h1 f" G/ u  J4 E' F2 d4 P
  16. * modify it under the terms of the GNU General Public License as
    ; H  d. O- M1 C" v4 \# k" B
  17. * published by the Free Software Foundation version 2.
    2 ]" q" j2 P* C; t0 l; ?. u
  18. *5 U5 m% E# D( X( p% D2 i' z7 r
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any9 }0 p! V! W7 ~. ?. b& v; k
  20. * kind, whether express or implied; without even the implied warranty
    * N4 q4 L9 e. @5 V. e" w1 f. p5 d. v
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    & ^9 A3 ~# |# {# T& e9 w
  22. * GNU General Public License for more details.4 R) u( M+ K5 a% j9 i9 H8 Y
  23. */
    5 }  C( @' t3 m' D6 }2 A
  24. 1 F* V( g# q3 ?9 g- A$ g! W
  25. #include <linux/module.h>: b* N+ r' H# S* i/ T& I) l. a
  26. #include <linux/init.h>/ L" J  v$ @) d5 o7 _. f$ c
  27. #include <linux/errno.h>
    / \2 T  k* K; s' v# `( U. f* g
  28. #include <linux/types.h>! b7 s4 M# m# v0 s# y
  29. #include <linux/interrupt.h>" [$ t5 P+ I) P$ P$ W" x2 C
  30. #include <asm/io.h>9 M6 I: r6 m) \7 S# k) f, w
  31. #include <linux/moduleparam.h>
    $ }/ }# U8 i+ w/ Q
  32. #include <linux/sysctl.h>
    , d8 ^1 ^9 a( N1 r' Z; e* N
  33. #include <linux/mm.h>
    * I3 Q; U& c2 S/ s1 T4 L5 e1 _
  34. #include <linux/dma-mapping.h>
    6 e/ G8 Y0 q. T$ o. k0 p4 Y

  35. - n1 m/ r* j. {! R
  36. #include <mach/memory.h>7 I3 i. d. S2 Y9 B
  37. #include <mach/hardware.h>4 @6 ~+ u. `+ x3 ?5 C9 J
  38. #include <mach/irqs.h>
    . G6 p4 x$ {" B- x. ~( p3 ^
  39. #include <asm/hardware/edma.h>
    5 y: k4 g* Y% G' D
  40. % q1 |. N5 U! c: _
  41. #undef EDMA3_DEBUG8 q9 v5 d% R" C# l% ^9 P2 f1 V
  42. /*#define EDMA3_DEBUG*/
    ) O7 q4 F( R8 h& ]
  43. ' V3 S1 d( `" @2 h. X
  44. #ifdef EDMA3_DEBUG
    5 x2 n; Z0 V$ L6 A
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
    ( @6 Y" ?! c/ @
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)+ m$ i+ S! c+ S8 S7 x, w% k; X; t
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)  u% ]+ O- h  e* }5 X
  48. #else1 y; _' _6 n' T" F8 i2 \  y" M
  49. #define DMA_PRINTK( x... )5 F2 C( c6 Q- @8 t
  50. #define DMA_FN_IN  H$ c' _5 W& F4 u% G
  51. #define DMA_FN_OUT
    7 z7 X8 f% r2 s
  52. #endif
    ) q# E  B0 M0 J6 \/ Q

  53. 2 Q$ s) F- y' ~
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)
    + r7 u9 b0 X& n! k! l
  55. #define STATIC_SHIFT                3* ?; Q1 P0 O# R0 U/ D0 |
  56. #define TCINTEN_SHIFT               20
    8 W- ~8 [  Q, c% Y
  57. #define ITCINTEN_SHIFT              214 t3 s9 }6 _1 a8 Q5 D  i
  58. #define TCCHEN_SHIFT                222 `; ]! S. b$ ^: d8 W- {# j1 s
  59. #define ITCCHEN_SHIFT               234 U- ]" L( x3 G  K( t( l! n- w

  60. 8 R$ Q+ x% O1 \! i3 _
  61. static volatile int irqraised1 = 0;
    . z& y5 M6 ^) m( X3 P9 A, y
  62. static volatile int irqraised2 = 0;
    5 |; `+ _! V' J  r9 M  ^

  63. 9 N" Q* ]! r+ i! f. Y0 X9 m4 J
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    ) h& `5 l1 o3 j
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);! p% h4 m; X9 [
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);+ u* y% t. j. ]
  67. - e1 E/ v+ B; S% r2 k# ~
  68. dma_addr_t dmaphyssrc1 = 0;
    : S* R9 P' E  V9 ]* [4 B7 @5 V
  69. dma_addr_t dmaphyssrc2 = 0;+ E9 K, A2 G# ?
  70. dma_addr_t dmaphysdest1 = 0;
    - ~3 |* I0 r( V5 g. T: Z& d# x
  71. dma_addr_t dmaphysdest2 = 0;
    4 p# Q3 A9 y, Y/ Q  T0 H: ~

  72. . J  M' c$ ?, E$ Z
  73. char *dmabufsrc1 = NULL;
    2 \: f- l/ c& l5 @% C+ r0 l
  74. char *dmabufsrc2 = NULL;( I1 J& C4 Q! r6 [7 ?
  75. char *dmabufdest1 = NULL;
    $ d8 f" ]7 Z1 e0 x: @; u, c3 }; Q
  76. char *dmabufdest2 = NULL;' [9 {: O. ^0 F. X1 z3 v; C
  77. * |' s% }6 a. y
  78. static int acnt = 512;
    " P! q. M6 B  Z6 K1 c# s$ e4 C
  79. static int bcnt = 8;2 S) o. P" p# q& n0 u$ D
  80. static int ccnt = 8;
    & c) }5 L8 d  h6 R, J" w8 q

  81. 2 R' Y) ^( L* Q/ R2 v5 _
  82. module_param(acnt, int, S_IRUGO);
    3 y  K3 Z* v9 o- ^
  83. module_param(bcnt, int, S_IRUGO);9 y( a) \( b) }7 M0 J
  84. module_param(ccnt, int, S_IRUGO);
复制代码
5 g  H4 O: e0 k% L5 m

* r5 T- f3 _( x/ {/ L# ]      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用6 {$ H) r; q2 n+ Z* ?
arm-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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
5 `& y! P7 S* i' j/ r     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
0 U; w7 b# \  m: N$ n5 m
5 Z$ F3 E  F. @% x1 m2 P* ?2 J; s4 R1 V( P) U4 e, ^
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2026-1-19 14:56 , Processed in 0.042250 second(s), 26 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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