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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑
! |  e( o/ @2 A
  1. [code]EDMA sample test application. L% I3 @9 M: d3 y- f8 [8 H* X) T
  2. /*7 J" d# n; E; a9 I  L! Y5 Z, ]8 G
  3. * edma_test.c% Z4 y) W" z) {2 v
  4. *
    4 ^" Y. ?& u* x# x5 T/ P
  5. * brief  EDMA3 Test Application
    5 s4 u# p) }4 w/ w6 x3 d7 V
  6. *
    ! r/ ~3 q4 p  R
  7. *   This file contains EDMA3 Test code.. i  [) \4 ?  x3 ~6 O
  8. *
    0 z- p, @$ Y8 L+ u6 R" Q% K4 M
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE0 h' W7 o1 t7 e9 |' j* j
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
    4 q: C+ N0 j6 a1 B( [) z
  11. *         TO CHANGE.
    8 G1 l7 w* ?* \2 @" z! Z( n
  12. *
    # N" _* C+ @) V+ J/ o
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/+ I; u/ C% Y: ^; I( b
  14. *
    6 G& N% Y8 U- l( U
  15. * This program is free software; you can redistribute it and/or
    % T8 s3 j+ _6 H3 ^* L
  16. * modify it under the terms of the GNU General Public License as
    ) T! ]0 ^) n$ J& O! o: W
  17. * published by the Free Software Foundation version 2.7 ^4 |1 k) d) b9 M' p- i  K& N
  18. *, e% U9 H6 D) t- f8 T! t
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any
      s8 J3 V# _$ R. h  ^
  20. * kind, whether express or implied; without even the implied warranty
    ; a  B# ^# x! r
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    7 @5 e- T) V& A+ N; x' v/ P/ ?
  22. * GNU General Public License for more details.
    % B, V% L- m( \, Z  H4 r$ z
  23. */: t8 R8 W" l/ y( c+ {* K! ^
  24. * q; i" q/ {! f8 @4 |
  25. #include <linux/module.h>
    ' Z9 `5 x  [9 k' v
  26. #include <linux/init.h>" x  C2 x! }; ?
  27. #include <linux/errno.h>. }0 k/ G' @+ l! L3 `8 b
  28. #include <linux/types.h>
    ) Z5 `3 |" @: c9 U& l3 _
  29. #include <linux/interrupt.h>: ?* {  r0 m# `8 x7 V7 p
  30. #include <asm/io.h>
    ! d" G1 N, J- f- R! \: |
  31. #include <linux/moduleparam.h>
    * _* B' W, g& t5 @
  32. #include <linux/sysctl.h>
    ; j) D5 i# o0 P( y* s' H
  33. #include <linux/mm.h>; |6 h" k* _! J
  34. #include <linux/dma-mapping.h>
    ! Y4 C9 @: x$ Z; S! k5 U$ [

  35. , M; P$ a5 U) U7 u: S
  36. #include <mach/memory.h>
    : A# ~& U8 D0 p( h
  37. #include <mach/hardware.h>! Y1 T6 O: l3 p+ `! K5 ]$ |; A) q
  38. #include <mach/irqs.h>- V, V+ V' U4 v! o+ h
  39. #include <asm/hardware/edma.h>: X6 O6 C6 R7 m8 E. w
  40. - G! G( }' t4 R) ?
  41. #undef EDMA3_DEBUG! \- A6 C& e5 i7 c
  42. /*#define EDMA3_DEBUG*/9 C2 n, {* V# l" p9 g7 s) H9 r
  43. . \3 a1 d' [  A; I$ q6 j7 V: g) \
  44. #ifdef EDMA3_DEBUG6 a! z4 W3 y& K, E
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)( {2 C! m+ Q3 P2 ]: ?2 w
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
    ! V, {/ i) F/ n. D! k' y( H
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)# T3 T8 ]! h! z$ `
  48. #else4 \5 T% y7 t( p- n) A; X2 }+ c1 T8 {
  49. #define DMA_PRINTK( x... )
    / L" E: e% f/ X5 n
  50. #define DMA_FN_IN
    ; b3 U, O' }1 b) Q& v+ ^% h& g
  51. #define DMA_FN_OUT. k  u4 x- ~3 I% `; t
  52. #endif- }' u! B& Y- G; u3 d; ~4 |; {

  53. # j) u/ z1 S& M$ y+ j9 B
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)
    . E9 i$ K5 v1 d* y4 Q, R  U$ `% w7 {
  55. #define STATIC_SHIFT                3
    . U0 W! C( S; i" A* m
  56. #define TCINTEN_SHIFT               20
    8 Z; s5 P' _' z
  57. #define ITCINTEN_SHIFT              21, A4 U$ H& k. B6 t  i+ i5 n
  58. #define TCCHEN_SHIFT                222 r( F1 \! f/ u
  59. #define ITCCHEN_SHIFT               23
    , x/ P- g+ m* R+ N# l/ K% L* V- ~
  60. & k, u8 \# ]  F4 F+ E, N1 N
  61. static volatile int irqraised1 = 0;
    2 C# T1 {) \/ L0 |4 I
  62. static volatile int irqraised2 = 0;" Q4 K9 ~( X% K# A
  63. 2 N0 ^5 p8 a% a5 k# K. q# \* _8 i
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    " p4 T/ r$ }. m$ d3 s; I
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    5 |8 q; S1 r1 A  M$ r4 E+ Q5 \
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);1 {; ^0 ?$ Y4 z$ j+ {" G
  67. . i' @7 x8 g+ g# z
  68. dma_addr_t dmaphyssrc1 = 0;; ]. e2 j/ t9 m. e- Y: q) B) b' @" M
  69. dma_addr_t dmaphyssrc2 = 0;, ~+ a4 |( k8 b
  70. dma_addr_t dmaphysdest1 = 0;
    * x, `0 u% ~7 R+ S1 l6 z& w
  71. dma_addr_t dmaphysdest2 = 0;# a- d% s4 k( @* K( P

  72. ; _7 ^; k/ J" M: _3 t
  73. char *dmabufsrc1 = NULL;& S! D, y3 Y6 C
  74. char *dmabufsrc2 = NULL;( s9 q+ n1 N7 S6 F. `$ `
  75. char *dmabufdest1 = NULL;
    ) A% m0 p: a( D9 h  z8 K" E
  76. char *dmabufdest2 = NULL;' Z9 ]! A' j" {1 H- q9 b

  77. + P, V7 ~) T/ t$ a
  78. static int acnt = 512;% T% G2 N4 e! Q: A  q0 H, m. n  S
  79. static int bcnt = 8;
    8 Z; T. Q3 `" ]( v8 p
  80. static int ccnt = 8;
    ( G6 W  V. F6 o/ `7 o
  81. 8 }; s# \( D$ J# [: k) y' z
  82. module_param(acnt, int, S_IRUGO);4 }$ l7 H1 F# f3 ]0 d4 D
  83. module_param(bcnt, int, S_IRUGO);
    1 h$ a! W: r* ~* V. b0 Q
  84. module_param(ccnt, int, S_IRUGO);
复制代码
; [2 }# i7 u- A

4 R: L$ M( G4 T! Z8 y' D  [      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用7 G4 m4 F: h9 c  B, D
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
, f+ e$ R. f8 S, p     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
) e  D1 R; r2 J% L- A8 B" x
" _0 Y) p# {' Q
) c" o7 L% `+ N' Q7 `
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2026-4-3 07:10 , Processed in 0.040670 second(s), 25 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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