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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑 8 O, M- b) @  n  H; O/ N! J  M
  1. [code]EDMA sample test application
    / F9 h2 R% [5 s. c1 V) j
  2. /*, F' Q/ J$ g' V. A, j" _
  3. * edma_test.c
    5 p! V9 M) ?2 U  F2 f  y1 M; S
  4. *: ]' q5 s6 S# j. X2 H
  5. * brief  EDMA3 Test Application
    ; W/ n) f# Z2 F' V( a
  6. *& Y+ ]" ?* d+ Y, g
  7. *   This file contains EDMA3 Test code.$ q% M! z& i+ b9 z, g
  8. *
    " ^3 G3 l) n& m7 ?& j
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
    + E$ D: ~6 ]" @
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
    % o. S2 k+ x( x6 n$ h+ c
  11. *         TO CHANGE.
    7 c2 ^) }* }$ C7 [: c8 n0 F. W
  12. *
    " {' Z/ G0 Z% ~0 U
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
    " s! O* x; U' y+ A
  14. *
    ; v% p7 D3 a* ~* _6 A+ D
  15. * This program is free software; you can redistribute it and/or5 L- U9 a) m. ~
  16. * modify it under the terms of the GNU General Public License as$ V# q, p2 g5 T- B' `
  17. * published by the Free Software Foundation version 2.& s' X  g3 U5 f. c6 D+ \
  18. *
    6 t" C& v. ^  }% S
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any
    1 F  }. J/ c2 T. _9 T( f* D  D
  20. * kind, whether express or implied; without even the implied warranty
    8 t! t7 M  v. C5 h7 ~3 c$ y
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    0 M8 g6 ^# y$ R0 ]
  22. * GNU General Public License for more details.
    ; k1 o- w$ N+ q) o& \
  23. */6 u3 I0 m+ }9 t" s# ]& g1 P2 z, N
  24. % m: k& W/ _9 W& z* L
  25. #include <linux/module.h>
    ; _" \+ |7 c2 g; l5 N$ h
  26. #include <linux/init.h>, x9 ]' c% v7 U, }7 ]' `
  27. #include <linux/errno.h>; R+ x0 D- R, O( Z! Z! N
  28. #include <linux/types.h>
    # c7 V  L9 F# O7 n! {  L# S* B& g
  29. #include <linux/interrupt.h>% E: l( _; @( u" P$ {
  30. #include <asm/io.h>8 i& J4 X" g7 p* w7 T
  31. #include <linux/moduleparam.h>& z0 g' a+ B( l  K$ L  J
  32. #include <linux/sysctl.h>* h' g* @+ w  M6 ]" ^
  33. #include <linux/mm.h>& W# i1 K* `( }
  34. #include <linux/dma-mapping.h>" }" f/ `2 e( V
  35. 7 b1 O' R, G0 Q2 I4 |! N+ k5 |. x
  36. #include <mach/memory.h>* B3 S2 f5 N9 M0 f9 {& c
  37. #include <mach/hardware.h>5 {1 U$ _. {5 }0 \. O% G4 r
  38. #include <mach/irqs.h>
    3 Q0 c/ i# ?; y4 N2 [
  39. #include <asm/hardware/edma.h>7 ?' k, w4 n% j& F* J+ \
  40.   u& F+ P" Z  V5 O; i! X- k
  41. #undef EDMA3_DEBUG
    8 Z9 i* }4 g- ]& r8 s" d
  42. /*#define EDMA3_DEBUG*/5 H3 _/ K9 o8 B5 j, ~7 X# N

  43. 7 V7 m& h; Q/ l# R; d, F
  44. #ifdef EDMA3_DEBUG
    % i: D  s6 B9 `
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)- l2 D( T  O6 u
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
    0 h. O, @- R, Z+ V/ t
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
    ! i/ S0 u5 y- L9 c
  48. #else; n; I! `8 R3 _. Q, v! _
  49. #define DMA_PRINTK( x... )
    " S' o2 J  a% ^" s1 `
  50. #define DMA_FN_IN1 u5 M7 c4 L7 J% i6 I+ ^7 |) ?
  51. #define DMA_FN_OUT# b  w: }* W) u- H' T
  52. #endif
    5 F( K$ B% M$ b8 y9 c

  53. 5 s4 K' C( {' U( ]8 e3 ?
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)
    & n6 `$ h% ~# x, y* C
  55. #define STATIC_SHIFT                3* P1 ?' E, U* f! t5 h$ b5 ~4 g
  56. #define TCINTEN_SHIFT               20: @$ s' M0 {+ m! E5 |
  57. #define ITCINTEN_SHIFT              21# a+ V2 h) c! g. S" r# Q: v
  58. #define TCCHEN_SHIFT                22
    ; A6 U" G- N1 E
  59. #define ITCCHEN_SHIFT               23
    , G$ Z8 e9 @- v4 M  J& o, H% a

  60. % o; @7 h( Y+ `2 p1 ~' ~
  61. static volatile int irqraised1 = 0;; R9 Y3 N. T  y
  62. static volatile int irqraised2 = 0;
    ) }3 U1 v! Q6 M+ V" N; v3 n7 K& [/ F$ Q

  63. 4 v4 W6 n9 X3 x6 D$ }2 s( C8 E" [
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);. \" m, N2 |( v7 `( o
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    % w( p& M: v3 n" g+ T& s
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    ) g1 J+ P0 U* ?* P5 T4 v! Z3 v. p
  67. ( N2 N  b/ S8 c- ]+ N- q
  68. dma_addr_t dmaphyssrc1 = 0;$ K& ^8 L" ~$ R
  69. dma_addr_t dmaphyssrc2 = 0;
    5 A3 q8 s$ n7 f4 R5 e* g( }  d
  70. dma_addr_t dmaphysdest1 = 0;
    # i- V6 G" D* {( X. L: u
  71. dma_addr_t dmaphysdest2 = 0;6 ?0 x% J4 Y9 \

  72. 2 B2 f  W0 O. x$ ^& O+ b* ]+ B* x
  73. char *dmabufsrc1 = NULL;$ D1 B; }9 A. k
  74. char *dmabufsrc2 = NULL;$ P' Z- G4 Y; ^. V' q3 q
  75. char *dmabufdest1 = NULL;3 }) P6 I# f6 p
  76. char *dmabufdest2 = NULL;
    $ q8 x0 m. A8 M4 f- P

  77. ! o3 g* g, @* _* E: N# ?
  78. static int acnt = 512;1 `$ W1 f* Y0 k! g
  79. static int bcnt = 8;# t& C! L+ _" r4 Q, U
  80. static int ccnt = 8;) T" G- G3 {# w
  81. / `! @- G' D- B9 I
  82. module_param(acnt, int, S_IRUGO);* N, {. }3 P1 {5 y2 J
  83. module_param(bcnt, int, S_IRUGO);& C' I. ?4 Q! m. o* z% _  v1 l5 p, _; U
  84. module_param(ccnt, int, S_IRUGO);
复制代码

8 m* L) R: E7 P- H2 w/ J$ f1 \) `+ o, D
      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
, {, `- \; \& u8 x5 x$ M: rarm-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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。( Z5 ~  j4 O- v8 x+ c8 w  E
     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。# j9 g. ~" b/ o$ l6 H' E% t
# `/ y* l  o) }1 q

: M# I+ I" \2 X
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2026-6-18 06:01 , Processed in 0.044052 second(s), 28 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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