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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑
* T7 l4 b* c9 H0 K3 V
  1. [code]EDMA sample test application
    ; X9 [; u  T  i: ]
  2. /*% _8 |2 U" \; I- H4 D
  3. * edma_test.c$ a: Z8 d' \1 Y
  4. *
      x. p' W2 @$ E7 C
  5. * brief  EDMA3 Test Application# ~7 b9 j1 P; Y+ O" n
  6. *
    $ J3 l. g# H/ t. j
  7. *   This file contains EDMA3 Test code.7 ~! x' k6 R; w  T1 v% D8 I: v
  8. *
    ) y3 x# Z8 o! f- B: u+ Q; Z
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
    ; z' {# s/ H: V6 N+ }* W. B. I' M
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT! e  [9 g. Y7 n) [. r8 D& j/ I0 ]
  11. *         TO CHANGE.
    7 h; I: I' }  h, C& w; X
  12. *
    ( e' J, J. t( o% T% i
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/; q9 c) @3 U* }4 b* s/ A
  14. *
    . v6 ^0 p. [0 \& z8 U
  15. * This program is free software; you can redistribute it and/or
    : _2 c/ Q5 {- F+ J; f7 [
  16. * modify it under the terms of the GNU General Public License as
    " E3 j$ B+ I, m, N. f, A# I6 m
  17. * published by the Free Software Foundation version 2.
    ! ^9 }% R% F( P
  18. *
      m1 V  D9 r3 ~
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any" n5 U) n& d; v7 K5 b5 x& {
  20. * kind, whether express or implied; without even the implied warranty! |9 |9 x& F9 H3 @3 |  D( h
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    $ l" E6 ]8 `, k/ L5 F  B+ u
  22. * GNU General Public License for more details.
    ! h3 k# }' G2 t, [
  23. */0 [" ?' V/ |# W
  24. ' o% [, l8 n7 K+ `1 n; H
  25. #include <linux/module.h>
    ! l0 g1 q% x$ C8 _
  26. #include <linux/init.h>
    6 ?+ H" t4 d& ^. c0 K- Z
  27. #include <linux/errno.h>- ~2 ]9 _. R5 o( S: ?% X
  28. #include <linux/types.h>' P2 U) t: o. M9 l
  29. #include <linux/interrupt.h>8 s+ w, \- D4 m; z* ^
  30. #include <asm/io.h>/ ?9 `( `& v- Q/ l
  31. #include <linux/moduleparam.h>* q4 Z# p# p4 @3 @) F
  32. #include <linux/sysctl.h>" o: W6 d# t  P& {- \
  33. #include <linux/mm.h>
    5 h$ P# |: H/ e
  34. #include <linux/dma-mapping.h>3 d  c* g1 H% O) M8 y- X4 r
  35. # P+ s! \( u4 }$ K6 [5 _# x
  36. #include <mach/memory.h>
    2 E+ O0 }/ }5 q- t( B: \
  37. #include <mach/hardware.h>
    + |) ]- V3 m4 O! a" Q
  38. #include <mach/irqs.h>
    & P5 ?8 q  c) J9 Z
  39. #include <asm/hardware/edma.h>% i& \  L5 `$ |& c2 ?/ _
  40. 4 x# X+ Y. E/ H  d0 |7 {2 E8 V
  41. #undef EDMA3_DEBUG3 h! }) _2 G7 B: F/ k* p
  42. /*#define EDMA3_DEBUG*// c# \3 b1 Y% W7 z1 G4 E5 D' w( {( \

  43. ( I+ ~9 G% e! E  D, M
  44. #ifdef EDMA3_DEBUG! }- V1 H0 f* b" R8 G, C
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)' F/ U+ c* F" `) X
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)1 e+ Q3 S/ A  n  E
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
    + x6 b2 G' l) Y  {
  48. #else5 l9 \' n) t) w/ m6 ^1 x: Y
  49. #define DMA_PRINTK( x... )* h+ n- e& ^9 \, a; k
  50. #define DMA_FN_IN" d8 c; h/ @8 {; T8 z. L
  51. #define DMA_FN_OUT$ t5 [  |5 {; D
  52. #endif) J$ S7 Z/ X" F" z$ M
  53. 1 m% @$ _7 ]( m
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)
    0 D4 P* a2 x0 J  j2 D/ g
  55. #define STATIC_SHIFT                3
    + W: U( T5 B! ?1 `( W9 ]
  56. #define TCINTEN_SHIFT               20
    ' d, j4 n/ f) w" I
  57. #define ITCINTEN_SHIFT              21) e) G" l  _) r& O
  58. #define TCCHEN_SHIFT                22: ?4 P& J6 I: l" N. d
  59. #define ITCCHEN_SHIFT               23
    0 d5 K1 |0 }- }+ ]/ S
  60. 0 A$ c- G* j+ F! R" {. p7 q+ y
  61. static volatile int irqraised1 = 0;
    ' A# v# R0 m5 C+ ?, ?
  62. static volatile int irqraised2 = 0;, e2 c9 X& E" U! M! N- a. D

  63. ) K2 Q2 l, ?9 w/ m- E5 U
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);, N7 |. M# I8 e
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    - s, R  y8 d  l9 T( N/ s% P3 z
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    5 i8 w, l0 R- d9 k7 G% k
  67. 4 E3 J2 M3 P2 {# d; ?7 @
  68. dma_addr_t dmaphyssrc1 = 0;: B$ E- @. L- P) c1 y' k3 Q! E8 T& S
  69. dma_addr_t dmaphyssrc2 = 0;
    0 o+ S' f# Z9 W4 o: f0 \% p
  70. dma_addr_t dmaphysdest1 = 0;" [6 E8 C! l8 V, R" c. M
  71. dma_addr_t dmaphysdest2 = 0;& w: o1 l1 m; j" O! v6 a2 w
  72. ' A* }: e, X" D1 @7 D, l2 S) i
  73. char *dmabufsrc1 = NULL;
    ' R9 H* @9 L5 R7 j4 u3 k7 A
  74. char *dmabufsrc2 = NULL;
    1 P& @' m/ E# N1 R/ i5 W$ K0 p
  75. char *dmabufdest1 = NULL;
    # Y0 y# r6 ]% O
  76. char *dmabufdest2 = NULL;8 c: h- t4 q3 e  b; y% S0 B

  77. - f0 g# t6 G5 B8 G
  78. static int acnt = 512;
    $ x! e; v6 P$ ~% y/ @/ S
  79. static int bcnt = 8;/ K/ [4 C' _3 U8 u
  80. static int ccnt = 8;% y+ D- A1 ^6 B4 P3 m7 H9 `
  81. . W+ o7 F1 n- V: I5 \5 ~
  82. module_param(acnt, int, S_IRUGO);  E% P, c* v0 T7 L  z/ P6 }
  83. module_param(bcnt, int, S_IRUGO);4 F( H1 n* X* v7 Z/ s! H. b
  84. module_param(ccnt, int, S_IRUGO);
复制代码
8 o; E7 N+ L, v. q' ]# Z7 e7 u

) x: Y& {  h# p  E) B/ r) l      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
+ C' l; |6 p4 J( Yarm-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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。1 K/ W4 Q- c& F6 N9 D
     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
7 \3 k2 r# j, R/ n/ s# p- @. ?9 |8 D# v' u: k* X

" g2 A3 D& Q* d  m
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2026-3-18 01:12 , Processed in 0.038607 second(s), 26 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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