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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |正序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑 # u2 |* w1 n, R) W+ z
  1. [code]EDMA sample test application/ C* z( v1 B: a! q, Y
  2. /*' Y. d; p2 g8 o. c, n! s2 k
  3. * edma_test.c0 u2 q' ?9 s  U9 }  P
  4. *  Y0 z5 ]+ v3 |
  5. * brief  EDMA3 Test Application
    3 p5 ]7 D1 i8 @8 s/ ~# z# _
  6. *
    7 A4 z6 K' J7 k$ V
  7. *   This file contains EDMA3 Test code.! S1 O. J/ U5 N+ K/ `+ \7 u* J6 U
  8. *0 }) Y( A1 |% C
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE( |3 T, T6 [) ]8 p- D: F1 m
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT1 h8 d5 x. D; |, h% I
  11. *         TO CHANGE.) I7 V1 o! f' _  |. n
  12. *# H5 `/ @7 f7 [% Z- |* I. j8 K$ Q
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/9 P: d, }9 Q1 H/ V% B. [
  14. *
    " w: n6 x4 F: s7 z
  15. * This program is free software; you can redistribute it and/or
    ' O* I% Z" D: [0 E/ J5 A9 h; e
  16. * modify it under the terms of the GNU General Public License as
    : h0 V' L; B0 _* D( u
  17. * published by the Free Software Foundation version 2.
    8 y$ ]& m3 }/ x7 b6 x( L
  18. *
    & c* z$ V9 |5 h9 I" B1 O+ \+ M
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any9 G" {6 ?& P) e! N: E
  20. * kind, whether express or implied; without even the implied warranty/ M7 u) I+ ~/ I, W# [8 L1 W8 n
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the2 N: q) n( w, R+ @; u9 |
  22. * GNU General Public License for more details.4 I  m# E3 C5 ?0 ]
  23. */
    7 W; d2 A: I$ R! [, d' K

  24. 0 P& a9 v6 ^" R( c- l/ W( g
  25. #include <linux/module.h>
    ( E" M8 M4 z+ w' w( k) G
  26. #include <linux/init.h>
    % `  J9 @* I9 r8 T. {" D% X6 u
  27. #include <linux/errno.h>" R. t% d2 R/ M' l. j
  28. #include <linux/types.h>) r5 \# d! r' c( L+ ]
  29. #include <linux/interrupt.h>
    " G; y; w# T+ u7 T+ L& n
  30. #include <asm/io.h>1 S0 L8 g$ ?. i: F1 S- |) u) T% G
  31. #include <linux/moduleparam.h>. J# l5 k- w* i6 K' s+ y2 c
  32. #include <linux/sysctl.h>
    # H. i5 ?1 _- p6 Z
  33. #include <linux/mm.h>5 ^3 A( q- a: f$ R; }
  34. #include <linux/dma-mapping.h>; X' f1 y: t* j% @
  35. $ `9 i  G: h$ Y; \. z5 V+ g
  36. #include <mach/memory.h>$ [/ P' x1 d% y0 B7 B# p
  37. #include <mach/hardware.h>, C5 {1 V( r( f3 e2 V$ ]1 s
  38. #include <mach/irqs.h># Y: W$ r2 B2 a. m
  39. #include <asm/hardware/edma.h>: g& N) V0 v) I8 V
  40. $ n: w$ ?, K/ E( ]1 Y2 p; _7 l
  41. #undef EDMA3_DEBUG/ j; J- x: {6 O
  42. /*#define EDMA3_DEBUG*/
    9 \  Z- U. D4 j3 r4 L" G/ A/ X- u

  43. / J% @. @4 w6 v. x
  44. #ifdef EDMA3_DEBUG$ C5 w# g2 u. ]4 k3 s+ x6 {! k; c
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)$ Q* R* p, E# j+ y: f* S7 ~
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)$ Z* n2 m% |6 C) @5 m: A" H% w
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)( i/ k7 Y# g8 Y$ E4 @% P8 P
  48. #else
    + {9 S3 \& n$ I
  49. #define DMA_PRINTK( x... )
    # T- I( z: o9 m" r% i
  50. #define DMA_FN_IN
    ; w) Y$ P2 v- j9 o' D
  51. #define DMA_FN_OUT' H& `/ ?( U- {: I6 }, V
  52. #endif5 I7 l3 W5 A7 |+ T& V' n
  53. 5 W! {1 w8 G8 ]# O- F) z
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)5 o8 \; J, B0 I1 a
  55. #define STATIC_SHIFT                3% u# n! o/ x6 C. a$ A$ M1 {( D3 y
  56. #define TCINTEN_SHIFT               20* _2 q0 m  T5 z2 Z& ?( O& B
  57. #define ITCINTEN_SHIFT              21' s+ ~3 P5 r+ G8 }  v- w
  58. #define TCCHEN_SHIFT                22
    ; m/ V6 [' B9 W1 o- q
  59. #define ITCCHEN_SHIFT               23
    7 O) s, E$ C: [$ n' X& I

  60. 7 {3 a3 F6 ^9 d% u( E
  61. static volatile int irqraised1 = 0;
    7 r) V8 Z4 u. p0 M- `1 J4 a
  62. static volatile int irqraised2 = 0;
    6 m+ r; {; O; x1 x; F
  63. $ G/ j" }9 H: X+ @
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
      \. M( d6 G8 o
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    / ?. c3 ~' X) g: Q" y$ Q
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);5 ?% i5 R9 m/ e4 k
  67. 3 [+ m3 N* B0 j% n" M8 H) m
  68. dma_addr_t dmaphyssrc1 = 0;! L' O9 }0 p. \/ Q# y* o% g7 [
  69. dma_addr_t dmaphyssrc2 = 0;
    ( L; z6 V1 ]2 o1 c9 Q
  70. dma_addr_t dmaphysdest1 = 0;
    5 Z# t( D, }5 w- K
  71. dma_addr_t dmaphysdest2 = 0;
    6 G$ R* x# H0 O" L$ N

  72. 6 ]$ j9 Z0 I* K/ k9 E$ u7 Z+ f: {2 [
  73. char *dmabufsrc1 = NULL;& f. Z" |, m6 \$ W
  74. char *dmabufsrc2 = NULL;
    5 K; S7 b& Z3 }" O/ q, n
  75. char *dmabufdest1 = NULL;
    # |  }( J( c9 D5 H: X# L
  76. char *dmabufdest2 = NULL;1 f" U' L, K- V* v$ q- E7 n
  77.   s5 L5 F) _# s2 D& \/ x
  78. static int acnt = 512;5 k5 R- U6 F, v# F
  79. static int bcnt = 8;
    9 x3 r6 f" m% R, Y$ g% M* a; L
  80. static int ccnt = 8;
    . \& a; G3 t" B. d( K) [
  81. 8 l- V& j# \1 `2 B6 x7 F) g, G
  82. module_param(acnt, int, S_IRUGO);
    3 x. f* J( a, X) M
  83. module_param(bcnt, int, S_IRUGO);/ B0 e2 G/ o* b* `. X. Q- B
  84. module_param(ccnt, int, S_IRUGO);
复制代码

1 b% i6 P+ O0 u' D8 T# X. Y2 w% j# d7 l* O# h" ?: _, e
      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
" U$ W* X' Z7 J& F; Aarm-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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
3 t# L. y1 p, k3 k3 z     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。% M  ], f, `0 j
! T5 |6 f( T( e; W
2 t  r. d# f- [4 L4 a0 u
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2026-4-5 09:23 , Processed in 0.040466 second(s), 26 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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