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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑
5 t- J2 M2 x4 T# ]. }- G
  1. [code]EDMA sample test application- w) z% r" w4 f# H* z
  2. /*
    7 V5 K. L4 b# `
  3. * edma_test.c7 \( m" S/ q" X$ `5 K; j; d" F5 c
  4. *
    2 E( J9 v! H' ~7 n$ m
  5. * brief  EDMA3 Test Application
    7 O4 y, S5 D) }0 c& e7 [2 O
  6. *1 P6 c+ \! T1 j' a* T0 {' c  t$ d) ~
  7. *   This file contains EDMA3 Test code.
    ( G' Q3 f0 D5 {5 C- y1 d
  8. *
    6 V" s" l: Q  G( P9 @
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE3 D' u  v5 k( t# T
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT" i5 }0 Z: y9 l
  11. *         TO CHANGE.
    3 r% H+ Z- l% Y$ Z5 O6 ?) C! [
  12. *2 i% `% H( ^3 V  r/ e. M
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/- J( i6 G8 d" m. [+ P( c8 g5 p
  14. */ P5 t2 C/ }0 {8 n: f' v
  15. * This program is free software; you can redistribute it and/or. I/ G% P  z- W# a$ R, |. J
  16. * modify it under the terms of the GNU General Public License as9 i" S+ W! Y! O& O
  17. * published by the Free Software Foundation version 2.0 h0 `/ ^! s" d& i$ W: n
  18. *6 L2 s& |2 {' _- {0 X
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any
    ; g) M8 i  K1 I/ `* C
  20. * kind, whether express or implied; without even the implied warranty
    . Q& X, J7 Y! v! p+ i
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    / ?3 X2 D% K$ S( j9 r! n4 E( a& |
  22. * GNU General Public License for more details.
    , U+ }- V. v8 x5 R
  23. */
    0 [  b7 l" U) m% J
  24. 6 R* Q* T5 f& j, r+ i# J7 H4 ~6 s/ U
  25. #include <linux/module.h>& i) B9 V3 D: Z( j9 S
  26. #include <linux/init.h>$ p" u1 w5 l- w$ F, z+ y
  27. #include <linux/errno.h>( `/ v2 X" P: u- M8 r5 s
  28. #include <linux/types.h>
    - ?) W4 R6 e: F) P* i8 t  ^4 x
  29. #include <linux/interrupt.h>* w9 v8 t5 n1 R* O! P3 i( x- R1 J  {
  30. #include <asm/io.h>% H7 d1 {9 P, W7 L8 m
  31. #include <linux/moduleparam.h>
    7 T/ e- v- _5 \, @6 z
  32. #include <linux/sysctl.h>
    % ~. \: V3 ?% v
  33. #include <linux/mm.h>
    4 o# X' O# u2 T0 T0 d
  34. #include <linux/dma-mapping.h>4 O5 Q7 P+ ?# I9 Q; x
  35. : f, k: J" X9 q6 P0 r. h
  36. #include <mach/memory.h>% f; p( d: R" r
  37. #include <mach/hardware.h>
    % ]% @: C0 ^$ o$ K4 g
  38. #include <mach/irqs.h>
    , f7 g5 @; |5 r& |4 ]2 `& Q; a
  39. #include <asm/hardware/edma.h>" ?9 R$ h2 Z* r- {2 t9 Y

  40. 2 K% K4 P' f  U" Y! A$ L
  41. #undef EDMA3_DEBUG& e1 {7 t* l6 [6 w" F$ E$ N' c# o
  42. /*#define EDMA3_DEBUG*/
    3 J5 u# e" }& [; t7 i1 u5 x/ G$ _

  43. ' k3 {+ u3 G, B
  44. #ifdef EDMA3_DEBUG% A7 S+ }. L. q8 _& g  C
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
    + D' w4 L& y2 A" j: E
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)- T8 @' Y0 m  ~. d
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
      p$ k# k2 S5 V! k. y5 A9 q, D
  48. #else+ R& `5 a8 @" I; _( c
  49. #define DMA_PRINTK( x... )
      g$ H) c; U9 v5 C' W  l9 D
  50. #define DMA_FN_IN
    9 s' V1 X& `; X' U" m& q
  51. #define DMA_FN_OUT, N7 S2 e8 b  B
  52. #endif: L( l0 i: E; J' ~5 u7 \7 p9 h

  53. ; O+ L9 Y7 {/ {- b* @
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768): [: [' L8 x+ y; U
  55. #define STATIC_SHIFT                3
    . E7 K1 R  E  s; y0 O
  56. #define TCINTEN_SHIFT               20
    5 |9 \1 p8 S! l8 P
  57. #define ITCINTEN_SHIFT              21
    0 Z9 z7 ]0 Q( J' i! L! T' Z
  58. #define TCCHEN_SHIFT                221 _3 w! N' ^2 K% p2 U+ a6 R( j
  59. #define ITCCHEN_SHIFT               23
    ( A0 \: N9 L6 c  X: ]/ B
  60. & f/ V/ k2 t2 m& |# e* _
  61. static volatile int irqraised1 = 0;3 m; l, t& g7 {1 F+ w
  62. static volatile int irqraised2 = 0;
      N  r1 J1 K2 D; u

  63. ' I" K* i' W9 V  [
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);9 z: W& g. S7 f" t3 i
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    , H3 @# a" B- e9 F! E9 b8 H
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);" H' @: E, j0 E

  67. ( d, `9 y- t5 Z! l" L
  68. dma_addr_t dmaphyssrc1 = 0;
    $ F8 _; {3 q% [1 c3 i+ l  I# J
  69. dma_addr_t dmaphyssrc2 = 0;
    1 Y0 e  i3 e& @" G
  70. dma_addr_t dmaphysdest1 = 0;
    2 N$ n2 F7 s! j* C
  71. dma_addr_t dmaphysdest2 = 0;' h) X, m+ |* @

  72. / I2 U3 L/ L! A6 u6 b. _9 C
  73. char *dmabufsrc1 = NULL;
    0 y. n9 M2 p0 z, w) _1 L
  74. char *dmabufsrc2 = NULL;
    4 J$ S4 d: x; f
  75. char *dmabufdest1 = NULL;
    / R. H3 e( W3 z% D; h# x" Y4 \9 p
  76. char *dmabufdest2 = NULL;* s% k7 K1 D: K/ C- _. T* v$ h

  77. ; J) e4 }+ U# n
  78. static int acnt = 512;
    4 S# t9 {& ^2 n: @+ o# t/ m0 y
  79. static int bcnt = 8;
    2 T  S2 H: U/ h1 v1 f
  80. static int ccnt = 8;: z% d; G6 A6 e) F$ ^4 R
  81. # S$ Q) g) O. i7 z# Q  h- F' E  E6 N1 I
  82. module_param(acnt, int, S_IRUGO);
    / \( p8 k/ a  O& Q5 K$ a( y
  83. module_param(bcnt, int, S_IRUGO);* x; Z- }. Y2 f2 @0 p. [
  84. module_param(ccnt, int, S_IRUGO);
复制代码
  v4 p; t- Y2 Z% k6 b% ?! j7 y) _

! ~) {  \; o1 k  V8 B, d- y" a/ K  K      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
+ A2 p( F, f+ b& \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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。# r5 N0 ]4 w; @- I5 E* G& s+ M
     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。- e2 J" j" O3 _( J: n) l
) E$ x6 `: L: C

0 K0 B9 `, v! s8 Q4 g- L
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2026-3-24 11:04 , Processed in 0.040177 second(s), 25 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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