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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑
( {0 I/ \6 Z9 ?; z: R
  1. [code]EDMA sample test application
    2 N! w" ]$ ~# Q$ O6 e6 v
  2. /*
    & N. U2 f8 u: Y* v" C& ~' i
  3. * edma_test.c
    9 w$ F4 p4 z( u: [# J9 \! M8 p$ p
  4. *$ A, a5 `, y; q# H% D: @0 {3 t! X
  5. * brief  EDMA3 Test Application
    . v9 {- W  l" W1 w/ P5 m* f/ k  L, m- h
  6. *
    ' P4 |5 k6 }# H  j0 e
  7. *   This file contains EDMA3 Test code.7 F. G) `/ Z2 ?- R# B: O& ~3 Y
  8. *
    ) t( P; ?8 |- ^& N
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
    : i: j& d' w5 ]; S/ E  r
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT, M+ |  t3 W% z+ Z" l( ]
  11. *         TO CHANGE.1 C" ~$ M! ]( f& k
  12. *: u& d$ d: l" o" X5 T3 _. q
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/$ s$ P! q& |* p  D' f" G8 o) W
  14. *
    3 Q& r9 n3 G0 F' L
  15. * This program is free software; you can redistribute it and/or
    ( x1 |9 `; d, E& O
  16. * modify it under the terms of the GNU General Public License as
    9 W: w# {5 j- S. v4 V" B
  17. * published by the Free Software Foundation version 2.3 m  U) E) H/ v  G$ U: Z8 c
  18. *
    5 o# [7 T! y1 W4 ]% |
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any
      u, U' L* s. w9 j+ r. X3 Y
  20. * kind, whether express or implied; without even the implied warranty
    ! }# o: ]' _8 I4 L
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    8 {. o* m2 F0 p7 S
  22. * GNU General Public License for more details.
    4 N2 Q$ S8 l& M0 G( ]) ^
  23. */
    / E# ]( W. N" [. ^

  24. 6 m6 ^- f% K) I* \- w0 I# a% Z: ?
  25. #include <linux/module.h>% I0 Y3 ~* U0 }0 b' {; s
  26. #include <linux/init.h>6 X' c) e: }- ?' m' q/ }
  27. #include <linux/errno.h>9 L( E: J' Z; g* C4 B  y! E. r  J" _* Y
  28. #include <linux/types.h>; C  O  K7 @- T" x: z
  29. #include <linux/interrupt.h>; H+ }+ z$ t  O  M( d/ V
  30. #include <asm/io.h>
    ) R* Q6 @# s3 M# `% `) z! K3 l
  31. #include <linux/moduleparam.h>
    & _6 p% z: ?6 E) m
  32. #include <linux/sysctl.h>
    6 h' s! ?, v1 T. {
  33. #include <linux/mm.h># c& J& r% I3 w0 `/ n( M7 |% A& C8 A
  34. #include <linux/dma-mapping.h>5 E: k- `" m+ C3 ^& h) e  e

  35. ' \# B- Y/ }5 B4 [( z1 }
  36. #include <mach/memory.h># ^- K: l- }( X& C& W! e! `/ v
  37. #include <mach/hardware.h>
    ( \, W6 M" s- z! Y
  38. #include <mach/irqs.h>
    ; V- P0 q) E1 }$ e
  39. #include <asm/hardware/edma.h>
    " V/ M. J- M! J* \7 ?5 P+ h
  40. ( L1 l( @; O. z! T) H
  41. #undef EDMA3_DEBUG
    3 n  d+ I# L$ f5 Z; x
  42. /*#define EDMA3_DEBUG*/
    ( F* V, k! w1 U" R4 s/ t- f% ?
  43. $ H) u# J) @$ n$ ~, x& l
  44. #ifdef EDMA3_DEBUG" R8 H( U: |& G. n. L
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)& D+ a  r" `# s4 _* B- ~7 o% K* d
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
    ( [4 c/ D0 q* N+ R0 q
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)0 F! E' f# t& {$ v& j6 w! }5 Q
  48. #else
    9 {7 p% |/ |" A0 Y2 Y) V
  49. #define DMA_PRINTK( x... )
    $ C) ?- x( Q- j3 F2 V+ k8 ?' I
  50. #define DMA_FN_IN+ T/ T# a$ `' t1 M* I6 ]
  51. #define DMA_FN_OUT: f/ R% ^( _! Q! t
  52. #endif, I0 u  u) H) Y. z, O

  53. # G' k2 P& \/ a$ t- c
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)  w; X+ [) ?) n9 X
  55. #define STATIC_SHIFT                3
    $ O: }) f6 D5 d8 m0 G- H
  56. #define TCINTEN_SHIFT               20! f. B6 G; _8 d' A0 q% Y
  57. #define ITCINTEN_SHIFT              21
    : O9 I' y2 q* w3 ]" R8 F
  58. #define TCCHEN_SHIFT                22
    6 g; b) B6 ?. h, e
  59. #define ITCCHEN_SHIFT               23
    6 [/ G! N# q+ }" ]/ J0 b2 `2 x
  60. 6 C: L$ b( {# v7 A7 M$ b) d
  61. static volatile int irqraised1 = 0;; g5 r3 l$ v( r6 x* j$ _
  62. static volatile int irqraised2 = 0;9 g, R$ V6 g0 ?. v& C

  63. % z; _3 R8 s+ k$ H0 n' c& E
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);% Y/ o0 |8 K8 s9 s
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);+ o6 I6 S9 Z2 f0 |  Y2 M
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);- T* q1 |9 W0 F
  67. ' e+ E" w7 F! b1 H% ~! N; o8 ?
  68. dma_addr_t dmaphyssrc1 = 0;
    0 {5 A( V; x: ~: V) T
  69. dma_addr_t dmaphyssrc2 = 0;
    9 ^; ~: i* J+ h; _1 Q# J8 A- w, R
  70. dma_addr_t dmaphysdest1 = 0;
    : J8 s+ K: k# _8 K5 [$ R* i( q
  71. dma_addr_t dmaphysdest2 = 0;' Q2 N1 \# D( x( O+ f! E

  72. 6 _: L2 s) T' F
  73. char *dmabufsrc1 = NULL;+ G5 L" l0 U+ V  B. v
  74. char *dmabufsrc2 = NULL;
    : o: W' @) `2 Y. ?8 Q6 @! j/ e
  75. char *dmabufdest1 = NULL;- P5 M$ u% y, ?7 ~5 E: _) F
  76. char *dmabufdest2 = NULL;! g' p! A% q- H* R1 L: o
  77. 0 N# h5 ~' V5 l
  78. static int acnt = 512;- e8 \/ c" C" M+ p1 n+ a$ h: V
  79. static int bcnt = 8;
    : d6 [  V$ b3 g  I4 n
  80. static int ccnt = 8;
    ' K4 h, g1 W( S. P8 @  _
  81. 9 q: c5 ]# A% A9 h$ x7 h
  82. module_param(acnt, int, S_IRUGO);8 k; |' C* G! n
  83. module_param(bcnt, int, S_IRUGO);
    4 C3 u3 ^+ f8 p
  84. module_param(ccnt, int, S_IRUGO);
复制代码
( F  c0 i2 z1 s- h

2 y7 v, T/ l( O. K+ Q1 R' }% x( z      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
" m! d" _1 i' n0 k! 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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
; Y, B4 J4 h  D1 r" C$ F: p5 N' r     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
% B* U6 X0 D- D! ~* h8 Q3 ]/ o+ W5 ]" R  C3 U" f
& A4 S9 L  a" _
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2026-2-3 18:07 , Processed in 0.041253 second(s), 26 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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