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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑 3 r; T+ [7 Q6 b7 b" j0 b5 b
  1. [code]EDMA sample test application1 l# Y5 ~3 u9 G) }9 h- ]
  2. /*
    3 k6 b) C- U& b
  3. * edma_test.c
      T6 ^: T3 J- q- [
  4. *6 \/ z" b# s2 G5 Z9 M0 ^
  5. * brief  EDMA3 Test Application
    + a4 D5 U7 y1 y5 e/ g1 N
  6. *; ?7 b* p' F4 v4 T
  7. *   This file contains EDMA3 Test code.
    1 ^% v( u* Y, H$ @8 S( H# ~7 {
  8. *& r: U+ _8 u& T4 s0 _
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE& i+ H( a# l, V1 u2 r
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT: M7 |* O; \0 s( R9 u! Y
  11. *         TO CHANGE.: V) ^' i3 F1 g/ R; ~, e: m9 a
  12. *( {/ E3 @, \& a! S  K
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/+ m5 P  ^! {# }0 p" ?
  14. *6 E" D* t' C) R0 Y  |* o
  15. * This program is free software; you can redistribute it and/or' a$ ^8 b( L: o  A, A
  16. * modify it under the terms of the GNU General Public License as* X: w2 u% v0 f8 c8 m. x# E
  17. * published by the Free Software Foundation version 2.
    4 B! R- G) ?* g: y1 r
  18. *& p7 x% G5 s) S3 }
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any
    6 j+ n  v, h. g* v
  20. * kind, whether express or implied; without even the implied warranty; Y9 p# L  t7 \: b( Y1 g9 g- x
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the2 \5 Z+ R3 a) Y
  22. * GNU General Public License for more details.9 ]0 e0 ?3 ]1 N/ t% s
  23. */2 y' d( C# q, O1 W8 ]

  24. - U) }# |* [! G2 A
  25. #include <linux/module.h>/ v3 ^3 d' C5 @, h: D$ m
  26. #include <linux/init.h>7 \" J( s1 [0 a8 H. C0 B/ m9 v
  27. #include <linux/errno.h>
    ! b9 m7 S" r5 S- N. ?' U
  28. #include <linux/types.h>8 {4 u' ]  v7 n) n4 Q, u! X& B- S
  29. #include <linux/interrupt.h>
    & y0 Z$ ]/ M' N( p6 I
  30. #include <asm/io.h>
    , A5 M# j, c0 T7 I  f0 a% M" r& n- K
  31. #include <linux/moduleparam.h>, D2 R8 {+ B0 `/ O
  32. #include <linux/sysctl.h>
    0 A5 l& h! P* ]- B& k
  33. #include <linux/mm.h>
    - B3 [' J! a& q. u7 L
  34. #include <linux/dma-mapping.h>% d* ^5 y3 I, y7 G# H

  35. 6 y" _- J& W% ?4 o' U3 Y2 C
  36. #include <mach/memory.h>0 l; Z6 P9 z" S7 w* ?: {
  37. #include <mach/hardware.h>
    - h4 k8 _# I0 m: g+ t2 F
  38. #include <mach/irqs.h>
    ; y" D! {5 w. [4 q# q
  39. #include <asm/hardware/edma.h>) G- o- t3 r7 v$ x7 K, W
  40. , n0 }) O0 c) `- z
  41. #undef EDMA3_DEBUG
    . Q5 C/ S' j, R2 I2 g0 j9 `, T
  42. /*#define EDMA3_DEBUG*/  J3 ^' e, E7 F. t
  43. " F; U+ m3 c' d6 J
  44. #ifdef EDMA3_DEBUG3 p; O0 ~/ Q( o$ M2 J0 j
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)3 M* f) {* U) t/ S3 m* w
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)- T9 H6 u) o; z( _$ T
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
    2 f; ^8 h( p! X; h/ u' W
  48. #else
    . a& j2 S& p# S" z1 T
  49. #define DMA_PRINTK( x... )! c! T& p- e% W; R3 A
  50. #define DMA_FN_IN
    9 G* ^' D7 b$ u5 M# D" n
  51. #define DMA_FN_OUT
    % P: P( b6 ^; b- b3 k
  52. #endif
    $ u8 B. ?  g' ^3 c: U$ N
  53. 8 P! O, m8 X) @- ]; P( ~! a% e
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)
    ' ^( \2 Y) |* H, J8 `' O" w
  55. #define STATIC_SHIFT                35 k! _; e( X  `- H
  56. #define TCINTEN_SHIFT               20& M3 ?% F0 O. Q( [. g
  57. #define ITCINTEN_SHIFT              21
    & F" Q, U! O& q: j, a4 W; p  @
  58. #define TCCHEN_SHIFT                22
    ! j' P& h5 B, Q
  59. #define ITCCHEN_SHIFT               233 p4 m0 R! O$ Q& \6 U5 G
  60. 0 I4 T' Y2 ~+ e
  61. static volatile int irqraised1 = 0;4 n6 Z; b6 V+ W1 Z) K3 @. |5 B
  62. static volatile int irqraised2 = 0;3 z6 A7 {! _0 B8 P3 r( T( I4 H; H

  63. ! v3 A& z: w" e* s
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    ( e$ i4 _9 I; i. Z9 n1 y
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    2 P9 z9 t. m; F, ~; a% c4 ?
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);; X" g  ~# v1 C: p. N3 Q. O
  67. 8 ^' W: b0 m3 n* v# o0 c+ C& j
  68. dma_addr_t dmaphyssrc1 = 0;
    - j2 T$ T; V$ e3 P8 _4 h( `3 |% _
  69. dma_addr_t dmaphyssrc2 = 0;
    1 T2 F* K9 Q7 l  r1 F
  70. dma_addr_t dmaphysdest1 = 0;
    5 {2 z$ D4 L* U6 d, e0 T
  71. dma_addr_t dmaphysdest2 = 0;  S" K/ s  c! N' t
  72. . p2 v* x* n7 Z! d7 p' n
  73. char *dmabufsrc1 = NULL;% W% s, G3 N# O6 q9 _8 O
  74. char *dmabufsrc2 = NULL;! ?, t+ i# t- O/ @8 E4 E" t
  75. char *dmabufdest1 = NULL;
    ' Y8 u% r1 l1 v( p( Q
  76. char *dmabufdest2 = NULL;
    4 p$ e7 e" s2 H6 K. f' T

  77. , m  k: }5 @; c0 p! k; L, K1 t6 o
  78. static int acnt = 512;
    0 k7 g1 l( C: o4 C2 H7 J9 E0 Q
  79. static int bcnt = 8;: s0 ~. {. h6 w/ {, Q1 }; I8 V8 a! \
  80. static int ccnt = 8;) Q7 W, T" D8 [7 c; j* C8 J7 m
  81. : d4 U* D; ?9 }4 z
  82. module_param(acnt, int, S_IRUGO);
    0 \% j$ Q. y% r% R7 y: |! O
  83. module_param(bcnt, int, S_IRUGO);
    - D9 k- c5 ^9 N' y4 G
  84. module_param(ccnt, int, S_IRUGO);
复制代码
7 o* [. l, g( B9 P% V

4 [% W, Q7 M* Y  P, {! u1 c      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用2 f: k4 L8 S7 F9 [3 j1 x; u
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。6 }6 L% a  u: T  x5 c
     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。0 r3 H. }* f. B/ _% s

" u: Q% ]  O( M' n7 K; w7 D) j! T4 Z6 n0 A/ k& c' @
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2026-4-25 17:14 , Processed in 0.040984 second(s), 26 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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